typescript-strict-patterns
Installation
SKILL.md
TypeScript Strict Patterns
Project setup — read
project-setup.mdwhen bootstrapping a new project or changing tsconfig / ts-reset / type-fest. ESLint baseline — readeslint.config.mjswhen adding or tweaking lint rules.
Discriminated Unions + Exhaustive Checking
Model variants as discriminated unions — never bags of optional properties:
// GOOD — each variant carries exactly its data
type Result =
| { status: "ok"; data: string }
| { status: "error"; message: string };
// Exhaustive check helper — will fail to compile if a variant is missed
function assertNever(x: never): never {
throw new Error(`Unexpected: ${JSON.stringify(x)}`);
}