typescript-magician

Diagnose TypeScript type errors and refactor any types into strict generic alternatives.

7|Updated May 13, 2026
One-click install
npx skills add https://github.com/DawnMoon1542/agents-skills --skill typescript-magician-dawnmoon1542
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: typescript-magician
Source: https://github.com/DawnMoon1542/agents-skills/tree/main/typescript-magician
Command: npx skills add https://github.com/DawnMoon1542/agents-skills --skill typescript-magician-dawnmoon1542

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? TypeScript codebases accumulate unsafe any types, cryptic compiler errors, and weak inference that undermine type safety. This Skill diagnoses type errors, eliminates any types, and designs precise generic, conditional, and utility types so code compiles cleanly under strict mode. ## Core Features & Use Cases - Type Error Diagnosis: Runs tsc --noEmit before and after changes, reads errors bottom-up, and identifies root causes like unsound inference, missing constraints, and implicit any. - Advanced Type Design: Builds conditional types, mapped types, template literal types, infer-based extraction, branded/opaque types, and type-safe builder patterns. - Any Elimination & Type Guards: Replaces any with generics, unknown plus type predicates, and assertion functions, validating that call sites still type-check. - Use Case: Given an API client returning Promise<any>, convert it to return a validated User interface using an isUser type guard, then confirm the fix with a clean tsc --noEmit pass. ## Quick Start Ask the assistant to fix the TypeScript type errors in your project and replace all any types with strict, properly inferred types.

Frequently Asked Questions about typescript-magician

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
Why does my conditional type return unexpected results with unions?

Conditional types distribute over union members, so ToArray<string | number> becomes string[] | number[] rather than (string | number)[]. Wrap the checked type in a tuple, like [T] extends [any[]], to prevent distribution and evaluate the union as a whole.