fix-ts-errors
Fix TypeScript Errors
Autonomous TypeScript error detection and fixing loop. Eliminates the manual "check → fix → still broken → fix again" cycle.
Trigger Conditions
- User reports TS errors in a file
- User says "not working" after a TS change
- After writing/editing TypeScript files (proactive)
- User says "fix types", "ts errors", "type errors"
Workflow
Step 1: Identify Target Files
Determine which files to check:
- If user specifies files → use those
- If user says "changed files" → run
git diff --name-onlyto get modified.ts/.tsxfiles - If after a code edit → check the files just edited
- If unclear → ask which files
Step 2: Get Diagnostics
Use the IDE integration to get TypeScript diagnostics:
Use the LSP tool (or mcp__ide__getDiagnostics) to get diagnostics for each target file.
If IDE integration is unavailable, fall back to reading the file and analyzing types manually based on imports and type definitions.
Step 3: Fix Errors
For each error found:
- Read the file around the error location
- Understand the root cause (don't just suppress the error)
- Fix with proper type-safe patterns
Fix priority:
- Missing imports → add the import
- Type mismatches → fix the type, not add
ascast - Missing properties → check the source type definition and align
- Null/undefined issues → add proper narrowing (no
!assertions) - Generic type issues → provide explicit type parameters
Never do:
- Add
// @ts-ignoreor// @ts-expect-error - Use
as anyoras unknown as X - Use non-null assertions (
!.) - Suppress errors without understanding them
Step 4: Re-verify
After fixing, re-run diagnostics on the same files to confirm all errors are resolved.
If new errors appeared (cascade effect), go back to Step 3.
Step 5: Report
Once clean, briefly report:
- How many errors were found
- What was fixed
- Any remaining concerns
Loop Breaker
If after 3 fix-verify cycles errors persist:
- Stop and explain the root cause
- Show the remaining errors
- Suggest whether the issue is in the file itself or in a dependency
- Ask the user how to proceed
Important Rules
- Always understand the error before fixing — read surrounding code and type definitions
- Prefer fixing at the source over fixing at the symptom
- If a type is wrong in a shared package (@gsm3/types, @gsm3/validators), flag it — don't work around it
- Check if the error is in generated code (drizzle schema) vs authored code
- For Drizzle schema errors, check if
db:generateneeds to run
More from bhagyamudgal/skills
review-pr
Deep, anti-slop review of a GitHub PR. Grounds findings in the linked issue's intent, runs a Claude reviewer (+ conditional silent-failure hunter) in parallel with existing CodeRabbit comments fetched from the PR, then critic-passes the findings before printing. Use when user says "review this pr", pastes a GitHub PR URL, or asks "check this pull request". NOT for local uncommitted changes — use /parallel-review for those.
12fix-pr-review
Triage and fix CodeRabbit / review-pr findings on a GitHub PR, then reply + resolve conversations. Classifies each finding (FIX/DISMISS/DEFER/DISAGREE/NEEDS-INPUT), runs /done, posts specific replies. Use on CodeRabbit review URLs, PR URLs, or local review files. Pairs with /review-pr.
7forge-plan
Use when starting any non-trivial feature or design task that needs the full idea-to-implementation pipeline. Also use when user says "forge", "forge plan", "full pipeline", or wants the complete AI development workflow before shipping.
6harden-plan
Pre-code quality gate that runs /review-pr's anti-slop lens against a written plan BEFORE any code is written. Grounds the plan against the real codebase, runs 11 category checks (security, concurrency, round-trip, control-flow, error-handling, pattern-consistency, plus /review-pr's Q1-Q6), then grills the user one question at a time until the plan is hardened. Use when the user says "harden my plan", "check my plan", "grill my plan before I code", "lint this plan", or invokes `/harden-plan` explicitly. Also invoke proactively after `/superpowers:brainstorm` or `/grill-me` completes with a written plan and before any implementation begins. Do NOT invoke after coding has started — redirect to `/review-pr` / `/fix-pr-review` in that case.
6project-discovery
Deep project discovery and architecture planning. Use when starting a new project, when user says "new project", "let's build", or asks for help architecting/planning a non-trivial application.
5qa
Use when user says "qa", "test the flow", "QA this", "verify the UI", "test this page", "check if it works", "end-to-end check", or after completing code changes that affect UI and need manual verification replaced by automation.
4