Agent skill
build-fix
Incrementally fix build, TypeScript, and lint errors one at a time with minimal, safe changes. Detects the error type, fixes the root cause, re-runs the build to verify, and repeats until clean.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/other/other/build-fix-corbat-tech-coco
SKILL.md
Build Fix
Fix build, typecheck, and lint errors incrementally. One error at a time, minimal changes.
Step 1: Detect and Run
# TypeScript errors
pnpm typecheck 2>&1
# Lint errors
pnpm lint 2>&1
# Full check (typecheck + lint + tests)
pnpm check 2>&1
# Build only
pnpm build 2>&1
Capture full output. Count total errors for progress tracking.
Step 2: Group and Prioritize
Group errors by type:
- Import errors — fix first (missing
.jsextensions, wrong paths) - Type errors — fix second (incorrect types, missing types)
- Lint errors — fix third (style, pattern violations)
- Test failures — fix last (logic errors)
Sort by file — fix all errors in a file before moving to the next.
Step 3: Fix Loop (one error at a time)
For each error:
- Read the file — understand context around the error (±10 lines)
- Diagnose root cause — don't just suppress, fix the underlying issue
- Fix minimally — smallest change that resolves the error
- Re-run — verify the specific error is gone
- Check no new errors — fix must not introduce new issues
- Move to next
Common corbat-coco Errors & Fixes
Missing .js extension in imports
// ❌ Error: Cannot find module './foo'
import { foo } from "./foo";
// ✅ Fix
import { foo } from "./foo.js";
CommonJS usage
// ❌ Error: require is not defined / CommonJS not allowed
const fs = require("fs");
const __dirname = ...;
// ✅ Fix
const fs = await import("node:fs/promises");
import { fileURLToPath } from "node:url";
const __dirname = path.dirname(fileURLToPath(import.meta.url));
Explicit any type
// ❌ oxlint: no-explicit-any
const data: any = result;
// ✅ Fix — use proper type or unknown
const data: unknown = result;
// Then narrow with type guard or Zod parse
Unhandled promise (floating promise)
// ❌ TypeScript: Promise returned from call is ignored
doAsyncWork();
// ✅ Fix
await doAsyncWork();
// or if fire-and-forget is intentional:
void doAsyncWork();
noUncheckedIndexedAccess violation
// ❌ Type 'string | undefined' is not assignable to 'string'
const first = array[0];
const value = first.toUpperCase(); // Error: first might be undefined
// ✅ Fix
const first = array[0];
if (first !== undefined) {
const value = first.toUpperCase();
}
// or
const value = array[0]?.toUpperCase() ?? "";
Unused variables
// ❌ noUnusedLocals: 'foo' is declared but never read
const foo = bar();
// ✅ Fix — remove if unused, or prefix with _ if intentionally unused
const _foo = bar(); // or delete entirely
Guardrails — STOP and Ask User If:
- A fix introduces more errors than it resolves
- The same error persists after 3 attempts (likely architectural issue)
- The fix requires significant refactoring (not a build fix)
- Missing dependency requires
pnpm add(ask user to confirm)
Step 4: Verify Clean
pnpm check
Must show zero errors for typecheck, lint, and tests.
Step 5: Summary Report
## Build Fix Summary
### Fixed
- `src/path/file.ts:L10` — Added .js extension to import
- `src/path/other.ts:L42` — Fixed any type to explicit interface
### Remaining
- [none] or [list with explanation]
### Next Steps
- [suggested follow-up if any]
Usage
/build-fix
/build-fix typecheck only
/build-fix src/tools/
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?