GenesisTools gt:typescript-error-fixer
Fix TypeScript compilation errors and eliminate 'any' types across the codebase. Use when build fails due to type errors, when auditing type safety, or when eliminating 'any' types.
install
source · Clone the upstream repo
git clone https://github.com/genesiscz/GenesisTools
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/genesiscz/GenesisTools "$T" && mkdir -p ~/.claude/skills && cp -r "$T/plugins/genesis-tools/skills/typescript-error-fixer" ~/.claude/skills/genesiscz-genesistools-gt-typescript-error-fixer && rm -rf "$T"
manifest:
plugins/genesis-tools/skills/typescript-error-fixer/SKILL.mdsource content
TypeScript Error Fixer
Fix all TypeScript compilation errors systematically using a 4-phase workflow. Zero tolerance for
any types.
Phase 1: Discovery
- Detect the package manager (check for
,package-lock.json
,yarn.lock
,bun.lockb
).pnpm-lock.yaml - Run the TypeScript compiler with a 1-2 minute timeout, redirecting output to a log file:
Filter to specific directories:tsgo --noEmit 2>&1 | tee tsc-<YYYY-MM-DD-HHmmss>.logtsgo --noEmit | rg "src/" - Parse the log: extract every error with its file path, line number, error code, and message.
- Group errors by file and produce a structured error report.
Phase 2: Planning
- Analyze dependencies -- fixing a type definition file may resolve cascading errors elsewhere. Identify these first.
- Prioritize: type definition files and core utilities before consumers.
- Estimate complexity per file and plan fix order (dependency roots first, leaves last).
Phase 3: Subagent Deployment
For each file with errors, deploy a subagent (via the Agent tool):
- Identifier:
ts-fix-<filename-without-extension> - Context to provide:
- The specific file path and all its errors (line numbers, codes, messages).
- Relevant project patterns from CLAUDE.md.
- Related type definitions the file depends on.
- Subagent instructions:
- Read the file and understand its purpose.
- Examine related files and type definitions.
- Research the root cause of each error.
- Apply proper type fixes (never use
-- see rules below).any - Verify the fix does not introduce new errors.
Phase 4: Verification
- Re-run
(or filter:tsgo --noEmit
).tsgo --noEmit | rg "src/" - Confirm all original errors are resolved.
- Confirm no new errors were introduced.
- Produce a summary report: files changed, errors fixed, types improved.
Zero Tolerance for any
anyany is never an acceptable fix. When you encounter it:
- Research the actual type by examining:
- Function signatures and return types
- API response structures
- Library type definitions (
packages)@types - Runtime data flow and usage patterns
- Use proper TypeScript utilities:
,Partial<T>
,Pick<T, K>
,Omit<T, K>Record<K, V>
with type guards instead ofunknownany
,ReturnType<T>
for function-derived typesParameters<T>- Create dedicated type/interface definitions for complex shapes
- If
is temporarily unavoidable, add aany
comment explaining why and the resolution path. This is the only exception.// TODO:
Type Research Tools
Per-file checking (faster than full recompilation):
-- persistent LSP server, ~100ms for incremental checkstools mcp-tsc <file>
-- type introspection to find the correct type replacingtools mcp-tsc --hover --line N --text symbol file.tsany
Claude Code LSP operations (built-in):
-- trace type origins to their sourcegoToDefinition
-- get inline type info for any symbolhover
-- understand usage patterns across the codebasefindReferences
Use these when researching actual types to replace
any instead of guessing.
Error Handling
- If
fails to run, checktsgo
for config issues first.tsconfig.json - If errors span >100 files, prioritize critical/shared files and process in batches.
- If circular type dependencies exist, identify and document them before fixing.
Quality Checklist
- Every type is properly researched, not guessed.
- Fixes align with project-specific patterns (check CLAUDE.md).
- Complex type decisions have explanatory comments.
- Typing patterns are consistent across the codebase.
- No
types remain (or each has a documented TODO with resolution path).any