Skill

Type Annotate

typescriptpython typesagentic

Save the file as ~/.claude/skills/type-annotate/SKILL.md (user-level, available everywhere) or .claude/skills/type-annotate/SKILL.md (project-level). Claude Code loads it automatically when its trigger condition matches.

Type Annotate Skill: Narrow Beats Wide

Adding types to untyped code is half archaeology, half discipline. The lazy version makes every parameter any or Optional[Any] and calls it a day. This skill does the harder thing: open every call site, intersect the real types, and refuse to widen for safety.

Full Prompt
An installable type-annotation skill. Reads the call sites first, then adds parameter and return types in TypeScript or Python — narrow over wide, no silent signature changes.

What It Does

  • Reads the callers — types come from what's actually passed, not what's plausible
  • Matches the project styleinterface vs type, PEP 604 vs Optional, strict mode aware
  • No any smugglingunknown with a one-line note beats hiding the gap
  • No behavior changes — annotations only, signature changes surfaced separately

Install in 30 Seconds

Pick your tool above and download:

  • Claude Code: ~/.claude/skills/type-annotate/SKILL.md
  • OpenAI Codex CLI: append to AGENTS.md
  • Cursor: append to .cursorrules

Point it at a file or function: "Add types to src/billing/refund.ts — strict mode."

Why "Narrow Beats Wide"

A function typed as (input: any) => any is worse than no types — it lies about its contract. A function typed as (amount: number, currency: 'USD' | 'EUR') => number documents intent and catches the next bug. This skill leans toward narrow types, even at the cost of the occasional caller having to adjust — because that adjustment is the bug fix.

Install once, get types that mean something.