void-typescript-strict

Enforces strict TypeScript typing rules including zero any, branded types, and exhaustive switches.

Updated May 29, 2026
One-click install
npx skills add https://github.com/voidcorp-core/void-harness --skill void-typescript-strict-voidcorp-core
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: void-typescript-strict
Source: https://github.com/voidcorp-core/void-harness/tree/main/packages/core/skills/void-typescript-strict
Command: npx skills add https://github.com/voidcorp-core/void-harness --skill void-typescript-strict-voidcorp-core

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? TypeScript codebases drift toward unsafe patterns: any escapes, as casts that silence the compiler, enums with footguns, and raw strings passed where domain IDs belong. This Skill installs a strict typing discipline so the compiler catches these bug categories before they reach production. ## Core Features & Use Cases - Strict tsconfig baseline: Enforces strict, noUncheckedIndexedAccess, exactOptionalPropertyTypes, and related flags, with any deviation recorded as a deliberate ADR. - Zero any and restricted as budget: Requires unknown plus narrowing instead of any, and limits casts to as const, post-validation smart constructors, and Zod schema.parse() results. - Domain modeling patterns: Prescribes branded types for IDs and semantic primitives, discriminated unions over enums and boolean flags, and exhaustive switches verified via never. - Use Case: While editing a TypeScript service, you model a fetch state as a discriminated union, brand UserId and OrgId so they cannot be swapped, and the companion hooks block a commit that introduces as any outside test fixtures. ## Quick Start Ask the agent to review or write TypeScript code following the strict baseline, for example by requesting that a new domain module use branded IDs, discriminated unions, and exhaustive switches with no any or unchecked casts.

Frequently Asked Questions about void-typescript-strict

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I eliminate any types from a TypeScript codebase?

Replace any with unknown and narrow before use, typically by validating with a Zod schema whose parse method returns the typed value. A pre-commit grep hook can block new : any and as any occurrences outside fixture and test whitelists.

What is the difference between satisfies and as in TypeScript?

satisfies checks a value against a constraint while preserving its literal type, so the compiler still catches missing fields. The as cast tells the compiler to trust you and silently accepts wrong structures, which is why it is rejected outside narrow exceptions.

Should I use TypeScript enums or discriminated unions?

Prefer as const objects with a derived union type over the enum keyword, since numeric enums are loose and have surprising runtime emit. For state with multiple variants, use discriminated unions so invalid states become unrepresentable and the compiler narrows automatically.

How do branded types prevent ID mixups in TypeScript?

Branded types attach a phantom tag to a primitive, so a UserId and an OrgId are both strings but not interchangeable at compile time. Create them through smart constructors that validate the raw value before returning the branded type.

Why does exactOptionalPropertyTypes complain when spreading objects?

With exactOptionalPropertyTypes, an optional property may be absent but cannot hold an explicit undefined, so spreading an object containing undefined values fails. Build the object literal explicitly, omitting properties instead of assigning undefined.

When should I use Result types instead of throwing exceptions?

Use a Result<T, E> discriminated union for expected failure modes like validation errors, so the signature tells callers exactly what can go wrong. Reserve exceptions for truly unexpected bugs that callers cannot reasonably handle.