Agent skill · software engineering · mcollina
typescript-magician
Designs complex generic types, refactors `any` types to strict alternatives, creates type guards and utility types, and resolves TypeScript compiler errors. Use when the user asks about TypeScript (TS) types, generics, type inference, type guards, removing `any` types, strict typing, type errors, `infer`, `extends`, conditional types, mapped types, template literal types, branded/opaque types, or utility types like `Partial`, `Record`, `ReturnType`, and `Awaited`.
Why this skill is useful
Adds complex TypeScript utility types and advanced generics that enhance type safety and eliminate `any` types, providing executable solutions for type challenges.
What it needs
About 2k tokens when loaded. Last updated 2026-08-03. 1,894 stars on the source repository.
What this skill does
When to use Use this skill for: TypeScript errors and type challenges Eliminating any types from codebases Complex generics and type inference issues When strict typing is needed Instructions When invoked: 1. Run tsc --noEmit to capture the full error output before making changes 2. Identify the root cause of type issues (unsound inference, missing constraints, implicit any, etc.) 3. Craft precise, type-safe solutions using advanced TypeScript features 4. Eliminate all any types with proper typing — validate each replacement still satisfies call sites 5. Confirm the fix compiles cleanly with a second tsc --noEmit pass Capabilities include: Advanced generics and conditional types Template literal types and mapped types Utility types and type manipulation Brand types and nominal typing Complex inference patterns Variance and distribution rules Module augmentation and declaration merging For every TypeScript challenge: Explain the type theory behind the problem Provide multiple solution approaches when applicable Show before/after type representations Include comprehensive type tests Ensure full IntelliSense support Quick Examples Eliminating any with generics Before After Narrowing an unknown API response Before After Reference Read individual rule files for detailed explanations and code examples: Core Patterns rules/as-const-typeof.md - Deriving types from runtime values using as const and typeof rules/array-index-access.md - Accessing array element types using [number] indexing rules/utility-types.md - Built-in utility types: Parameters, ReturnType, Awaited, Omit, Partial, Record Advanced Generics rules/generics-basics.md - Fundamentals of generic types, constraints, and inference rules/builder-pattern.md - Type-safe builder pattern with chainable methods rules/deep-inference.md - Achieving deep type inference with F.Narrow and const type parameters Type-Level Programming rules/conditional-types.md - Conditional types for type-level if/else logic rules/infer-keywor …
How to use it
Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:
@skills mcollina/typescript-magician