Check & Fix
Auto-detect and fix build, typecheck, and lint errors. $ARGUMENTS
Step 1: Detect Available Checks
bash ~/.claude/scripts/detect-check-scripts.sh
Parse output key=value pairs. Report findings:
- •Package manager (PM)
- •Available checks (BUILD, TYPECHECK, LINT)
- •Monorepo packages if applicable
If NO_PROJECT=true → report "No package.json found" and stop.
If PM_UNKNOWN=true → no lock file found. Ask the user which package manager to use (npm, pnpm, yarn, bun). Then re-run with the chosen PM:
bash ~/.claude/scripts/detect-check-scripts.sh . <chosen_pm>
Step 2: Filter by Arguments
- •No
$ARGUMENTS→ run all detected checks - •
lint→ only LINT - •
typecheckortypes→ only TYPECHECK - •
build→ only BUILD - •Multiple args supported:
lint typecheck
Step 3: Run Checks
Run each selected check command. For monorepo packages, run from their directory using the *_DIR value:
cd <DIR> && <COMMAND>
Capture full output including exit code. Run checks sequentially — stop at first failure to fix before continuing.
Step 4: Fix Errors
If a check fails:
- •Read error output — identify files and line numbers
- •Read relevant source files — understand the context
- •Fix the issues — use Edit tool for targeted fixes
- •Re-run the failed check — verify fix worked
Repeat for up to 3 iterations per check. If still failing after 3 attempts → report remaining errors and move to next check.
Step 5: Continue Remaining Checks
After fixing (or giving up on) a check, proceed to the next one. Each check gets its own 3-iteration budget.
Step 6: Report Results
Summarize final status for each check:
- •Passed: check passed (on first run or after fixes)
- •Fixed: had errors, successfully fixed
- •Failed: still has errors after 3 iterations (list remaining issues)
- •Skipped: not available in this project
Format:
Build: [status] Typecheck: [status] Lint: [status]
Rules
- •Never modify test files to make checks pass (unless the test itself has a bug)
- •Never disable lint rules to suppress errors — fix the actual code
- •Never add
@ts-ignoreor// eslint-disablecomments - •If a fix requires architectural changes → report it, don't attempt
- •For monorepo: report which package had issues