typescript-magician

mcollina/skills · updated Apr 8, 2026

$npx skills add https://github.com/mcollina/skills --skill typescript-magician
0 commentsdiscussion
summary

Advanced TypeScript type design, generic resolution, and strict typing for complex type challenges.

  • Eliminates any types by crafting precise generics, conditional types, and type guards tailored to your codebase
  • Handles complex inference patterns including template literal types, mapped types, branded types, and utility type composition
  • Diagnoses and resolves TypeScript compiler errors by identifying root causes (unsound inference, missing constraints, implicit any ) and validating f
skill.md

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

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

Advanced Generics

Type-Level Programming

Type Safety Patterns

Debugging

Discussion

Product Hunt–style comments (not star reviews)
  • No comments yet — start the thread.
general reviews

Ratings

4.854 reviews
  • Pratham Ware· Dec 24, 2024

    Solid pick for teams standardizing on skills: typescript-magician is focused, and the summary matches what you get after install.

  • Noah Chawla· Dec 20, 2024

    We added typescript-magician from the explainx registry; install was straightforward and the SKILL.md answered most questions upfront.

  • Advait Ndlovu· Dec 20, 2024

    We added typescript-magician from the explainx registry; install was straightforward and the SKILL.md answered most questions upfront.

  • Dhruvi Jain· Dec 16, 2024

    typescript-magician reduced setup friction for our internal harness; good balance of opinion and flexibility.

  • Meera Verma· Dec 4, 2024

    typescript-magician fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.

  • Advait Martin· Nov 23, 2024

    typescript-magician is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.

  • Noah Malhotra· Nov 11, 2024

    Keeps context tight: typescript-magician is the kind of skill you can hand to a new teammate without a long onboarding doc.

  • Anaya Shah· Nov 11, 2024

    typescript-magician has been reliable in day-to-day use. Documentation quality is above average for community skills.

  • Layla Thomas· Nov 11, 2024

    Keeps context tight: typescript-magician is the kind of skill you can hand to a new teammate without a long onboarding doc.

  • Oshnikdeep· Nov 7, 2024

    I recommend typescript-magician for anyone iterating fast on agent tooling; clear intent and a small, reviewable surface area.

showing 1-10 of 54

1 / 6