Get the FREE Ultimate OpenClaw Setup Guide →

build-and-fix

Scanned
npx machina-cli add skill yu-iskw/coding-agent-fabric/build-and-fix --openclaw
Files (1)
SKILL.md
1.6 KB

Build and Fix Loop

Purpose

An autonomous loop for the agent to identify, analyze, and fix build errors using pnpm build.

Loop Logic

  1. Identify: Run pnpm build to identify build failures.
  2. Analyze: Examine the build output to determine:
  3. Fix: Apply the minimum necessary change to resolve the error (e.g., fixing TypeScript types, correcting imports, or updating configurations).
  4. 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

  1. pnpm build fails because of a type mismatch in packages/common/src/index.ts.
  2. Agent analyzes the error and finds an incorrect interface implementation.

Resources

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

  1. Step 1: Run pnpm build to identify the failure details
  2. Step 2: Analyze the output to find the failing package/file and the error message
  3. 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

Frequently Asked Questions

Add this skill to your agents
Sponsor this space

Reach thousands of developers