From typescript-idioms
Use when writing or reviewing TypeScript — getting value from the type system (unknown over any, discriminated unions, narrowing, satisfies, readonly) and avoiding the escape hatches (any, unchecked as casts, non-null !) that silently defeat it.
How this skill is triggered — by the user, by Claude, or both
Slash command
/typescript-idioms:writing-idiomatic-typescriptThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
The point of TypeScript is to make illegal states unrepresentable and let the compiler catch
The point of TypeScript is to make illegal states unrepresentable and let the compiler catch
mistakes. Idiomatic TS works with the type system instead of around it. Assume strict: true.
{ kind: "ok"; value } | { kind: "err"; error }),
then switch on the tag — the compiler checks exhaustiveness.type aliases for unions/functions/mapped types; interface for object shapes that may be
extended or merged. Be consistent.type Mode = "r" | "w") over enum.readonly where it shouldn't mutate; use as const for literal tuples/objects.Pick, Omit, Partial, Record, ReturnType) before restating shapes.unknown, not any, at boundaries (JSON, catch) — then narrow with type guards.as casts; when unavoidable, cast to the narrowest type and comment why. Never
double-cast through unknown to silence an error.!; narrow instead (if (x == null) return).satisfies to check a value against a type without widening it.x is T) and in/typeof/instanceof narrowing over manual casts.async/await over raw .then chains; never leave a promise unawaited (handle or void it).map/filter/reduce) over mutation when it reads clearly.any (especially implicit), unchecked as, !, @ts-ignore without a justification.enum where a string-literal union would do; Function/Object/{} as types.American English in identifiers and comments.
Creates, edits, and optimizes skills for Claude Code, including drafting, evaluating with test prompts, iterating on performance, and improving skill descriptions for better triggering accuracy.
npx claudepluginhub meaganewaller/rosetta --plugin typescript-idioms