What is the Typescript Magician skill?
Typescript Magician is a coding skill by mcollina for Claude Code, Cursor, Codex and other AI coding agents. Designs complex generic types, refactors `any` types to strict alternatives, creates type guards and utility types, and resolves TypeScript compiler errors.
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
When to use it
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 When invoked: 1.
What the SKILL.md covers
- When to use
- Instructions
- Quick Examples
- Eliminating any with generics
- Narrowing an unknown API response
- Reference
- Core Patterns
- Advanced Generics
- Type-Level Programming
- Type Safety Patterns
- Author
- mcollina
- Pack
- mcollina/skills (11 skills)
- Category
- Coding, #809 of 1826
- Alyn Score
- 66 / 99
- Files
- 16
- License
- MIT
- Last updated
- 9 days ago
- Works with
- Claude Code, Claude, Cursor, Codex, Gemini CLI, Copilot
Typescript Magician compared to similar skills
| Skill | Alyn Score | GitHub stars | Updated |
|---|---|---|---|
| Typescript Magician · mcollina | 66 | 2k | 9 days ago |
| Template Skill · Anthropic | 68 | 200k | 9 days ago |
| Typescript · Gentleman-Programming | 37 | 680 | 8 months ago |
| Ts Coder · sno-ai | 56 | 874 | 2 days ago |
Install Typescript Magician
Pick your agent. Every command is ready to paste.
npx alyn-cli add typescript-magicianDetects your agents (Claude Code, Cursor, Codex and 70+ more) and installs to the right folder. Add -g to install globally.
npx skills add mcollina/skills --skill typescript-magicianOr use the open skills CLI directly.
01
Install it
Run the command above, or upload the folder in Claude.
02
Ask naturally
Describe the task. Your agent loads typescript-magician when the request matches its description.
03
Name it if needed
If it does not trigger, say “use the typescript-magician skill”. In Codex, type $typescript-magician.
When to use
Use this skill for:
- TypeScript errors and type challenges
- Eliminating
anytypes from codebases - Complex generics and type inference issues
- When strict typing is needed
Instructions
When invoked:
- Run
tsc --noEmitto capture the full error output before making changes - Identify the root cause of type issues (unsound inference, missing constraints, implicit
any, etc.) - Craft precise, type-safe solutions using advanced TypeScript features
- Eliminate all
anytypes with proper typing — validate each replacement still satisfies call sites - Confirm the fix compiles cleanly with a second
tsc --noEmitpass
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
function getProperty(obj: any, key: string): any {
return obj[key];
}
After
function getProperty<T, K extends keyof T>(obj: T, key: K): T[K] {
return obj[key];
}
// getProperty({ name: "Alice" }, "name") → inferred as string ✓
Narrowing an unknown API response
Before
async function fetchUser(): Promise<any> {
const res = await fetch("/api/user");
return res.json();
}
After
interface User { id: number; name: string }
function isUser(value: unknown): value is User {
return (
typeof value === "object" &&
value !== null &&
"id" in value &&
"name" in value
);
}
async function fetchUser(): Promise<User> {
const res = await fetch("/api/user");
const data: unknown = await res.json();
if (!isUser(data)) throw new Error("Invalid user shape");
return data;
}
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 constandtypeof - 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-keyword.md - Using
inferto extract types within conditional types - rules/template-literal-types.md - String manipulation at the type level
- rules/mapped-types.md - Creating new types by transforming existing type properties
Type Safety Patterns
- rules/opaque-types.md - Brand types and opaque types for type-safe identifiers
- rules/type-narrowing.md - Narrowing types through control flow analysis
- rules/function-overloads.md - Using function overloads for complex function signatures
Debugging
- rules/error-diagnosis.md - Strategies for diagnosing and understanding TypeScript type errors
Tips for Typescript Magician
- • Start a fresh session after installing so your agent picks up the new skill.
- • It is part of a pack with 11 skills. Install only the ones you need with --skill to keep triggers precise.
- • If two skills overlap, mention the one you want by name.
Questions about Typescript Magician
What does the Typescript Magician skill do?
Designs complex generic types, refactors `any` types to strict alternatives, creates type guards and utility types, and resolves TypeScript compiler errors.
How do I install Typescript Magician?
Run "npx alyn-cli add typescript-magician" in your project. The Alyn CLI installs it for Claude Code, Cursor, Codex and 70+ other agents. In Claude on the web, upload the skill folder as a ZIP under Customize > Skills.
Does Typescript Magician work in Cursor and Codex?
Yes. Typescript Magician uses the open SKILL.md format, so it works in Claude Code, Claude, Cursor, OpenAI Codex, Gemini CLI, GitHub Copilot and other agents that support agent skills.
When should I use the Typescript Magician skill?
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 When invoked: 1.
What is inside the Typescript Magician skill?
The SKILL.md covers When to use, Instructions, Quick Examples, Eliminating any with generics, Narrowing an unknown API response, Reference, and the skill folder has 16 files.
What is a good alternative to Typescript Magician?
Template Skill by Anthropic is the highest-ranked similar skill from another creator, with an Alyn Score of 68 compared to 66 for Typescript Magician.
Is Typescript Magician free?
Typescript Magician is open source on GitHub under the MIT license. It is free to install; check the license before commercial use.
Who made Typescript Magician?
Typescript Magician is published by mcollina in the mcollina/skills repository, together with 10 other skills.


