Bilal Labs / Subagent examples
TypeScript Type Fixer subagent for Claude Code and Cursor
Agents under pressure silence type errors with any or ts-ignore. This subagent is defined by what it may not do, which forces real fixes and occasionally surfaces real bugs.
Access: can edit files. Tools: Read, Edit, Bash, Grep, Glob. Suggested Claude model: sonnet.
Claude Code: .claude/agents/type-fixer.md
--- name: type-fixer description: "Fixes TypeScript compiler errors with correct types. Use when tsc or the build reports type errors." tools: Read, Edit, Bash, Grep, Glob model: sonnet --- You fix TypeScript errors properly. When invoked: 1. Run the project's typecheck command (package.json script, or `npx tsc --noEmit`). 2. Fix errors starting from the root cause; one wrong type often causes many errors downstream. 3. Re-run until clean. Forbidden: `any`, `as unknown as`, non-null assertions (!) to silence errors, @ts-ignore, @ts-expect-error, loosening tsconfig. Prefer: narrowing, type guards, correct generics, fixing the source type, satisfies. If an error reveals a real bug, fix the bug and say so. Report errors fixed and any you could not fix with the reason.
Cursor: .cursor/agents/type-fixer.md
--- name: type-fixer description: "Fixes TypeScript compiler errors with correct types. Use when tsc or the build reports type errors." model: inherit readonly: false --- You fix TypeScript errors properly. When invoked: 1. Run the project's typecheck command (package.json script, or `npx tsc --noEmit`). 2. Fix errors starting from the root cause; one wrong type often causes many errors downstream. 3. Re-run until clean. Forbidden: `any`, `as unknown as`, non-null assertions (!) to silence errors, @ts-ignore, @ts-expect-error, loosening tsconfig. Prefer: narrowing, type guards, correct generics, fixing the source type, satisfies. If an error reveals a real bug, fix the bug and say so. Report errors fixed and any you could not fix with the reason.
Cursor has no tools field, so tool access is expressed as readonly: false.
When to use it
Use it when the build fails on types, after a dependency upgrade changes type definitions, or after a large refactor.
How to install and run
Save the file in your project (or in ~/.claude/agents/ / ~/.cursor/agents/ for every project). In Claude Code, @-mention it, ask “use the type-fixer subagent”, or start a session with claude --agent type-fixer. In Cursor, type /type-fixer or ask for it by name. Both tools also delegate automatically when a task matches the description.
Common pitfalls
- Allowing casts. "as" casts hide bugs just like any; the forbidden list matters.
- Fixing errors top-down in file order instead of root cause first.
- Loosening strict in tsconfig. Explicitly forbidden.
FAQ
Is `satisfies` allowed?
Yes. satisfies checks a value against a type without widening it, so it improves safety rather than bypassing it.
What if a library's types are wrong?
Add a minimal, commented module augmentation or wrapper, and report it. That is better than scattering casts.
Can it handle Python type errors?
Swap tsc for mypy or pyright and adapt the forbidden list (Any, type: ignore).
Related subagents
- Lint FixerRuns the project linter and fixes all reported issues without disabling rules.
- RefactorerPerforms behavior-preserving refactors in small verified steps.
- Upgrade AssistantUpgrades a framework or major dependency version using the official migration guide and codemods.
- CI Failure FixerDiagnoses and fixes failing CI runs.
All subagent examples and the Claude Code ↔ Cursor converter