| name | build-check |
| description | Auto-detects the project's build system and runs compile/type-check after file changes, auto-fixing straightforward errors (max 3 attempts). Use after completing a multi-file feature or when asked to build or check compilation. |
Build Check Skill
Purpose
Auto-detect the project's build system and run compilation/type-checking after creating or modifying files. Catches errors (missing imports, type mismatches, DI failures) before the user discovers them at runtime.
Activation
Run once per logical change set — after completing a multi-file feature or a self-contained modification, NOT after each individual file:
- After completing a multi-file feature (run once at the end)
- After a single-file change that could affect compilation (run once for that change)
- When the user asks to build or check compilation
How It Works
This skill does NOT hardcode build commands. It detects them from the project.
Results cached in .codex/idev/build-check/cache.json after first detection.
Phase 1: Detect Build System
Scan for build configuration files. Check ALL — do not assume any stack:
.NET:
Glob for *.sln → dotnet build {solution.sln}
Glob for *.csproj (if no .sln) → dotnet build {project.csproj}
Check for specific project to build (API project .csproj for faster builds)
Node.js/TypeScript:
Read package.json → check scripts section:
"build" → npm run build / yarn build / pnpm build
"typecheck" or "tsc" → npm run typecheck (preferred — faster than full build)
"check" → npm run check (Svelte)
Detect package manager: look for yarn.lock, pnpm-lock.yaml, or package-lock.json
Python:
Glob for pyproject.toml → check for build tool (poetry, setuptools, hatch)
Check for mypy.ini or pyproject.toml [tool.mypy] → mypy for type checking
Check for ruff.toml or pyproject.toml [tool.ruff] → ruff check
Java:
Glob for pom.xml → mvn compile
Glob for build.gradle → gradle compileJava / ./gradlew compileJava
Go:
Glob for go.mod → go build ./...
Rust:
Glob for Cargo.toml → cargo check (faster than cargo build)
Ruby:
Glob for Gemfile → bundle exec ruby -c (syntax check)
Check for sorbet → srb tc (type check)
PHP:
Glob for composer.json → check for phpstan or psalm → phpstan analyse / psalm
Phase 2: Generate Cache
Write detected build commands to .codex/idev/build-check/cache.json:
{
"generated": "YYYY-MM-DD",
"projects": [
{
"name": "ProjectName",
"root": "relative/path/to/project",
"layer": "backend|frontend",
"buildCommand": "dotnet build path/to/project.csproj",
"typeCheckCommand": "npm run typecheck (if different from build)",
"lintCommand": "npm run lint (if available)",
"workingDirectory": "relative/path (if command must run from specific dir)",
"timeout": 120000
}
],
"quickChecks": {
"backend": "dotnet build path/to/api.csproj --no-restore",
"frontend": "npx tsc --noEmit"
}
}
Phase 3: When to Run
After creating a NEW feature (multi-file):
1. Wait until ALL files are created (entity, DTOs, service, controller, etc.)
2. Run the backend build command
3. If frontend files were also created, run frontend type-check
4. Report results: success or list of errors
After modifying a SINGLE file:
1. Determine which project the file belongs to (use architecture-scanner)
2. Run ONLY that project's build/type-check
3. Use quick check command (--no-restore, --noEmit) for speed
When NOT to run:
- After reading files (no changes made)
- After modifying only .md, .json, .txt, .css files (non-compiled)
- When user explicitly says "don't build" or "skip build"
- When creating skill/config files (not source code)
Phase 4: Handle Build Errors
If build succeeds:
Report: "Build passed ✓" (brief, one line)
If build fails:
1. Parse error output for:
- File path and line number
- Error code and message
- Missing reference or type
2. Categorize the error:
- Missing using/import → Add it
- Missing registration (DI) → Use post-creation-verify skill
- Type mismatch → Fix the type
- Missing file → Check if it was created
3. Fix the error automatically if it's straightforward
4. Re-run build to verify fix
5. If fix is unclear, report the error to the user
Error fix limits:
- Max 3 auto-fix attempts per build
- If still failing after 3 attempts, report all errors to user
- Never suppress or ignore build errors
Phase 5: Usage Commands
The user can trigger builds manually:
- "build" or "check build" → Run all project builds
- "build backend" → Run backend build only
- "build frontend" → Run frontend type-check only
- "skip build" → Suppress auto-build for current task
Integration with Other Skills
After creating a new backend feature:
1. post-creation-verify → Check all registrations exist
2. build-check → Run dotnet build
3. If errors → auto-fix → re-build
4. Report final status
After creating a new frontend feature:
1. build-check → Run tsc --noEmit
2. If errors → auto-fix → re-check
3. Report final status
Anti-Patterns
- Do NOT run build after every single file in a multi-file creation — wait until done
- Do NOT run full build when a quick check (--noEmit, --no-restore) suffices
- Do NOT hardcode build commands — always detect from project config
- Do NOT ignore build failures — always report or fix
- Do NOT run builds for non-compiled file changes