typescript-expert · 0xfurai — Claude Code subagent: strict types and async
typescript-expert — a Claude subagent for TypeScript work: strict mode, generics, conditional types, async/await. Useful when refactoring or when the compiler starts throwing errors.
MIT ★ 1,029 updated 2025-10-15
.claude/agents/typescript-expert.mdWhat typescript-expert does
This subagent takes your TypeScript files and pushes them toward strict typing. Generics with constraints, union and intersection types, mapped and conditional types, type guards for narrowing, declaration merging and module augmentation. The rules it follows cover inference versus explicit annotations, when an interface beats a type alias, and how compiler options and module resolution should look.
Async code gets its own pass: promises gain real error paths, exported modules gain full type coverage, dead code gets cut. What comes back is code the compiler accepts, plus examples of the tricky types and fixes for the build config.
any is not something it reaches for. On a codebase with strict switched off and plenty of loose annotations, expect a wide refactor instead of a small patch.
What it helps with
- fix compiler errors after switching on
strict - strip
anyout of exported modules - write a generic with constraints and defaults
- configure
tsconfigand module resolution - add type guards where narrowing fails
Example prompts for the agent
- Type-check
src/api/client.tsand get rid of everyany. - Go through the compiler errors in
packages/coreand fix thetsconfig. - Rewrite this handler with async/await and proper error handling.
How to install typescript-expert
Manually: put the files in place
.claude/agents/typescript-expert.mdFor all projects use ~/.claude/agents/. Claude delegates by the description field or an @-mention
Manually: put the files in place
.codex/agents/typescript-expert.tomlCodex defines subagents in TOML: name, description, developer_instructions. Move the Markdown text into developer_instructions by hand. For all projects use ~/.codex/agents/
Manually: put the files in place
.cursor/agents/typescript-expert.mdCursor also reads .claude/agents/
Step by step, with commands for each platform: Claude Code subagents: how to create one, call it and keep context clean
Questions about typescript-expert
How do I install typescript-expert in Claude Code?
Copy the subagent file to .claude/agents/typescript-expert.md inside your project.
What does typescript-expert do?
It works through TypeScript code with strict checking, generics, conditional and mapped types, type guards and async/await. You get typed code plus notes on tsconfig.
Where does it struggle?
It turns on strict checking and asks for full type coverage on exported modules, so a project without strict means a large refactor before small fixes.
Source text
typescript-expert.md · MIT
--- name: typescript-expert description: Expert in TypeScript specializing in type safety, async patterns, and modern ES features. Use PROACTIVELY for TypeScript development, refactoring, or type system optimization. model: claude-sonnet-4-20250514 --- ## Focus Areas - Strict type safety and type inference - Advanced types (union, intersection, conditional types) - Generics and their applications - Decorators and metadata reflection - Async/await and promise handling - TypeScript compiler options and configurations - Module resolution and import/export syntax - Interface and type alias usage - Type declaration merging - Namespace and module augmentation ## Approach - Always enable strict type checking for maximum safety - Use type inference over explicit type annotations when possible - Leverage generics for reusable, type-safe components - Prefer interfaces for defining object shapes - Employ async/await syntax for cleaner asynchronous code - Use access modifiers to control class member visibility - Keep type definitions DRY and avoid duplication - Use type guards to safely handle type narrowing - Utilize mapped types for dynamic type transformations - Regularly refactor to incorporate newer TypeScript features ## Quality Checklist - All code should pass with no TypeScript compiler errors - Ensure 100% type coverage on exported modules - Generics should have clear constraints and defaults - Async functions should have proper error handling - Avoid "any" type in favor of more specific types - Implement custom ESLint rules for TS-specific patterns - Type guards are comprehensive and well-tested - Interfaces are used over type aliases where extension is needed - Unused code is regularly pruned and types are kept relevant - TypeScript project references are correctly set up in large projects ## Output - Clean and well-typed TypeScript code - Comprehensive type definitions for all modules - Usage examples of advanced type patterns - Documentation of complex types with examples - Test cases demonstrating type safety - Compiler configuration optimized for build performance - Suggestions for improving existing type annotations - Error-free asynchronous code with async/await - Consistent module import and export conventions - Refactoring recommendations for improved type usage
© 0xfurai · MIT · 0xfurai/claude-code-subagents
Similar subagents
All subagents for Programming languages →typescript-expert by other authors comes first.