mk:build-fix
Triages build, compile and type errors by language and fixability, applies minimal fixes, and retries up to three times.
| Source | .claude/skills/build-fix/SKILL.md |
| Owner | testing |
| Runtime | claude-code |
| Risk | medium |
mk:build-fix takes a failing build, detects the language from the error output, classifies each error by how safely it can be fixed, applies a minimal fix and confirms the build with mk:verify. Use it when npm run build, tsc, go build, cargo build, python -m build or a type check just failed. It sits in Phase 3 (Build) and hands off to Phase 4 (Review) once the build is green.
When not to use it
| If you need | Use |
|---|---|
| A runtime error or general bug fixed | mk:fix |
| The root cause of a deeper or architectural problem | mk:investigate |
Usage
/mk:build-fix [error output or file path]Pass the error output or a file path. With neither, the skill runs the failing build command itself and captures the output.
What it does
-
Capture the error output.
-
Detect the language. The first matching pattern wins.
Pattern Language Reference error TS\d{4}:TypeScript references/typescript-errors.mdSyntaxError:,ModuleNotFoundError:,IndentationError:Python references/python-errors.mdcannot find package,undefined:,syntax error nearGo references/general-errors.mderror[E\d{4}]Rust references/general-errors.mdAnything else Unknown references/general-errors.md -
Classify the error.
Class Examples Action auto-fixable TS1005 missing semicolon, TS2307 cannot find module, missing imports Apply the fix suggest-with-confidence TS2322 type mismatch, TS2345 argument mismatch Explain briefly, then apply report-only Circular dependency, architectural mismatch, runtime errors Describe the cause and stop without editing -
Apply the smallest change that resolves the error. Never use TypeScript
anyas the fix. Useunknownwith a type guard or correct the type. -
Verify with
mk:verify, or the project's build command if verify is unavailable. -
If the build still fails, re-classify and try a different approach. After 3 failed attempts, escalate with all three error outputs, each attempted fix and why it failed, the suspected root cause and next steps. The counter resets when you switch to a different error.
The reference files list codes with fix patterns. The TypeScript one has a lookup by symptom that is faster than the full catalogue.
Gotchas
- A stale
.tsbuildinfocan hide errors. Delete it and runrm -rf dist .tsbuildinfo && tsc --noEmitbefore calling the build clean, since a cold build shows errors an incremental one skips. - Packages such as
esbuild,sharpand@swc/coreship OS-specific binaries. Runnpm cifresh inside the container and never sharenode_modulesacross platforms. - Resolve peer dependency warnings before treating the build as clean, because they can hide real version mismatches.
- Circular imports pass
tscbut can break Vite or webpack bundles. Runmadge --circular src/during triage.