/build-fix Command
Incrementally fix build and type errors with minimal, safe changes.What This Command Does
- Detect Build System - Identify project type and build command
- Parse and Group Errors - Group by file, sort by dependency order
- Fix Loop - Fix one error at a time, verify after each
- Summary - Report errors fixed, remaining, and new errors
Supported Build Systems
| Indicator | Build Command |
|---|---|
package.json with build script | npm run build or pnpm build |
tsconfig.json (TypeScript only) | npx tsc --noEmit |
Cargo.toml | cargo build 2>&1 |
pom.xml | mvn compile |
build.gradle | ./gradlew compileJava |
go.mod | go build ./... |
pyproject.toml | python -m py_compile or mypy . |
Fix Strategy
- Build errors first - Code must compile
- Vet warnings second - Fix suspicious constructs
- Lint warnings third - Style and best practices
- One fix at a time - Verify each change
- Minimal changes - Don’t refactor, just fix
Fix Loop Process
For each error:- Read the file - See error context (10 lines around error)
- Diagnose - Identify root cause
- Fix minimally - Smallest change that resolves error
- Re-run build - Verify error is gone
- Move to next - Continue with remaining errors
Command Syntax
Example Session
Common Errors Fixed
| Error | Typical Fix |
|---|---|
undefined: X | Add import or fix typo |
cannot use X as Y | Type conversion or fix assignment |
missing return | Add return statement |
X does not implement Y | Add missing method |
import cycle | Restructure packages |
declared but not used | Remove or use variable |
cannot find package | go get or go mod tidy |
Stop Conditions
The command stops and asks for help if:- Same error persists after 3 attempts
- Fix introduces more errors than it resolves
- Requires architectural changes (not just a build fix)
- Missing external dependencies need installation
Integration with Other Commands
- Use after making code changes
- Use before running tests with
/verify - Language-specific:
/go-buildfor Go projects
Related
- Agent:
agents/build-error-resolver.md - Commands:
/go-build,/verify,/tdd