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.
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 style —
interfacevstype, PEP 604 vsOptional, strict mode aware - No
anysmuggling —unknownwith 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.