Provides a single, well-reasoned TypeScript opinion for every common decision point. Eliminates the "multiple ways to do it" problem when writing, refactoring, or reviewing TypeScript code. Use when generating TypeScript, performing TypeScript code review, or deciding between multiple valid TypeScript patterns.
How this skill is triggered — by the user, by Claude, or both
Slash command
/the-typescript-narrows:the-typescript-narrowsThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
One opinion per decision point. When TypeScript gives you five valid ways, this skill picks one and tells you why.
references/async-promises.mdreferences/control-flow.mdreferences/discriminated-unions.mdreferences/error-handling.mdreferences/functions.mdreferences/generics.mdreferences/immutability.mdreferences/iteration.mdreferences/modules.mdreferences/naming.mdreferences/null-handling.mdreferences/resource-management.mdreferences/tsconfig-advanced.mdreferences/type-declarations.mdreferences/type-safety.mdOne opinion per decision point. When TypeScript gives you five valid ways, this skill picks one and tells you why.
Apply these opinions when writing new TypeScript code, refactoring existing code, or reviewing pull requests. Each opinion has a stance (what to do), a rationale (why), and do/don't examples in the reference files.
Severity tiers indicate impact level:
| Tag | Tier | Meaning |
|---|---|---|
| [B] | Bug prevention | Can cause runtime errors, data corruption, or silent wrong behavior |
| [M] | Maintenance | Makes code harder to understand, refactor, or extend over time |
| [S] | Style | Consistency and readability with no functional impact |
Exception clause: All opinions allow exceptions when there is no other viable alternative. If you must deviate, document why in a code comment. Convenience alone is not a valid exception.
any; use unknown and narrow before use. [B]unknown for values of uncertain type to force callers to narrow. [B]! non-null assertion operator; use proper null checks. [B]unknown; never assume error shape. [B]any-typed values from functions. [B]For rationale and examples: references/type-safety.md
const enum); use as const objects with type unions instead. [B]import type for type-only imports. [S]For rationale and examples: references/type-declarations.md
?? instead of || for nullish fallbacks. [B]strictNullChecks and never disable it. [B]undefined over null; match JavaScript's natural defaults. [S]For rationale and examples: references/null-handling.md
async unless they use await. [M]return await inside try/catch blocks. [B].then() chains. [M]For rationale and examples: references/async-promises.md
for...of over .forEach(); forEach swallows break/continue/return/await. [M].reduce(); use for...of or .map/.filter combinations. [M]For rationale and examples: references/iteration.md
{ cause: err } when rethrowing; never discard the original error. [M]For rationale and examples: references/error-handling.md
For rationale and examples: references/control-flow.md
For rationale and examples: references/functions.md
const by default; use let only when reassignment is required. [S]var. [S]readonly when they are not reassigned. [M]Readonly<T> and ReadonlyArray<T> for function parameters. [M]For rationale and examples: references/immutability.md
For rationale and examples: references/modules.md
I, T, or E (no Hungarian notation). [S]is, has, should, or can. [S]For rationale and examples: references/naming.md
type or kind field as the discriminant property. [M]For rationale and examples: references/discriminated-unions.md
extends. [M]in/out variance annotations on generic classes and interfaces. [M]For rationale and examples: references/generics.md
using and await using to bind resource lifetimes to scope; never rely on manual try/finally cleanup. [B]For rationale and examples: references/resource-management.md
strict: true and all strict family flags. [B]noUncheckedIndexedAccess for safe index access. [B][T] to prevent unintended distribution over unions. [B]For rationale and examples: references/tsconfig-advanced.md
npx claudepluginhub sethlivingston/claude-marketplace --plugin the-typescript-narrowsTypeScript type system, strict mode, and TS-specific patterns beyond JavaScript fundamentals. Invoke whenever task involves any interaction with TypeScript code — writing, reviewing, refactoring, debugging .ts/.tsx files, type definitions, generics, narrowing, tsconfig, or type-level programming.
Enforces TypeScript type safety with strict mode, no `any`, and discriminated unions. Use when writing or reviewing TypeScript code.
Provides TypeScript best practices for type-safe code including strict mode, interfaces, discriminated unions, generics, async patterns, and null safety. Useful for type definitions and maintainable TS.