build-and-fix
Scannednpx machina-cli add skill yu-iskw/coding-agent-fabric/build-and-fix --openclawBuild and Fix Loop
Purpose
An autonomous loop for the agent to identify, analyze, and fix build errors using pnpm build.
Loop Logic
- Identify: Run
pnpm buildto identify build failures. - Analyze: Examine the build output to determine:
- The failing package and file.
- The specific compiler or build error message.
- Refer to ../common-references/troubleshooting.md for common TS errors.
- Fix: Apply the minimum necessary change to resolve the error (e.g., fixing TypeScript types, correcting imports, or updating configurations).
- Verify: Re-run
pnpm build.- If passed: Finish.
- If failed: Analyze the new failure and repeat the loop.
Termination Criteria
- The project builds successfully (as reported by
pnpm build). - Reached max iteration limit (default: 5).
- The error persists after multiple distinct fix attempts, indicating a need for human intervention.
Examples
Scenario: Fixing a TypeScript compilation error
pnpm buildfails because of a type mismatch inpackages/common/src/index.ts.- Agent analyzes the error and finds an incorrect interface implementation.
Resources
- pnpm Commands for Node.js: Common commands for building and managing dependencies.
- TypeScript Documentation: Official documentation for TypeScript.
Source
git clone https://github.com/yu-iskw/coding-agent-fabric/blob/main/.claude/skills/build-and-fix/SKILL.mdView on GitHub Overview
Build and Fix Loop is an autonomous agent that runs pnpm build, analyzes failures, and applies minimal fixes (like TypeScript types, imports, or config updates). It repeats the cycle until the project builds or the iteration limit is reached, helping recover from broken states after significant changes.
How This Skill Works
The loop runs pnpm build to identify failures, analyzes the output to locate the failing package/file and the exact error, applies the smallest necessary change to resolve the issue (types, imports, or configurations), and then re-runs pnpm build to verify. If the build still fails, it repeats the process up to a maximum iteration limit or until success.
When to Use It
- The project fails to build when running pnpm build
- The project shows 'broken' states after significant changes
- A TypeScript type mismatch or incorrect interface implementation is reported by the build
- There are incorrect imports or path resolution issues revealed by the build
- Dependency or configuration changes caused cascading build errors
Quick Start
- Step 1: Run pnpm build to identify the failure details
- Step 2: Analyze the output to find the failing package/file and the error message
- Step 3: Apply the minimal fix (type, import, or config) and re-run pnpm build; repeat as needed
Best Practices
- Always start by running pnpm build to identify the exact failure location
- Fix only the minimum necessary change to resolve the error (types, imports, configs)
- After each fix, re-run pnpm build to verify the result
- Refer to common TS errors in the troubleshooting guide for guidance
- Limit iterations to the defined max (default 5) and escalate if unresolved
Example Use Cases
- A TypeScript compilation error in packages/common/src/index.ts is fixed by correcting an incorrect interface implementation
- An invalid import path is corrected after the build points to a missing or renamed module
- A missing or incompatible TS config value is updated to align with project expectations
- A dependency version conflict is resolved by aligning workspace package versions
- A tsconfig.json paths mapping is corrected to resolve module resolution failures