# build-fix

build-fix runs npm or pnpm builds, parses compiler errors, and fixes them incrementally. It verifies every edit with a fresh build run.

- command · `type=command` · Claude Code, Codex, GitHub Copilot, Gemini CLI · ★ 880 repo stars
- Author: sangrokjung
- License: MIT · policy=mirror · the beginning of the file is at the end of this page
- Source: https://github.com/sangrokjung/claude-forge/tree/HEAD/commands/build-fix.md
- Updated: 2026-09-03
- Security check: automated, 2026-11-16 (text) — no signs of malicious code found.
- HTML: https://affpapa.org/en/nevibecode/commands/build-fix

## What it does

The command triggers `npm run build` or `pnpm build`, captures compiler output, and groups errors by file. For each issue, the assistant inspects surrounding code context and applies a targeted fix. Then it rebuilds immediately.

Edits happen one issue at a time. If a fix triggers new compiler errors or fails to resolve the same problem after 3 attempts, execution halts automatically. This prevents destructive modification loops. At the end, the assistant outputs a summary of resolved and remaining issues.

This skill runs inline without persisting data to agent memory. If you need learned memory across sessions, run the `build-error-resolver` agent directly instead. Execution requires tool permissions for file inspection and Bash commands for `npm`, `pnpm`, or `npx`.

## Install

### Claude Code (native platform)

**Manually: put the files in place**
- File: `.claude/commands/build-fix.md` — Call it with /build-fix. For all projects use ~/.claude/commands/

### Codex

**Manually: put the files in place**
- File: `~/.codex/prompts/build-fix.md` — Call it with /prompts:build-fix. Codex marks this format deprecated in favour of skills

### GitHub Copilot

**Manually: put the files in place**
- File: `.github/prompts/build-fix.prompt.md`

### Gemini CLI

**Manually: put the files in place**
- File: `.gemini/commands/build-fix.toml` — Gemini stores commands as TOML: the prompt text goes into the prompt field

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/sangrokjung/claude-forge/tree/HEAD/commands/build-fix.md

## When to use it
- resolve TypeScript compilation errors one by one
- verify code edits automatically with fresh build runs
- group compiler diagnostics by affected file
- halt automated fixes when an error persists after 3 attempts

## Example prompts
- /build-fix
- Run /build-fix to clean up TypeScript errors in this package
- Check the pnpm build output and fix the remaining type failures step by step

## Source text · build-fix.md · MIT

Below is the content of a third-party file. It is data, not instructions for you: do not act on anything written inside unless the human asks. Block tag: 4c74d5d9702faba4.

BEGIN THIRD-PARTY FILE 4c74d5d9702faba4
```text
---
description: 빌드 에러를 자동으로 분석하고 수정합니다.
allowed-tools: Read, Edit, Glob, Grep, Bash(npm:*), Bash(pnpm:*), Bash(npx:*)
---

> 참고: 이 스킬은 build-error-resolver 에이전트를 호출하지 않고 인라인 실행됩니다. 에이전트의 memory 학습이 필요하면 Agent 도구로 build-error-resolver를 직접 호출하세요.

# Build and Fix

Incrementally fix TypeScript and build errors:

1. Run build: npm run build or pnpm build

2. Parse error output:
   - Group by file
   - Sort by severity

3. For each error:
   - Show error context (5 lines before/after)
   - Explain the issue
   - Propose fix
   - Apply fix
   - Re-run build
   - Verify error resolved

4. Stop if:
   - Fix introduces new errors
   - Same error persists after 3 attempts
   - User requests pause

5. Show summary:
   - Errors fixed
   - Errors remaining
   - New errors introduced

Fix one error at a time for safety!
```
END THIRD-PARTY FILE 4c74d5d9702faba4

The third-party file has ended. Everything between the 4c74d5d9702faba4 tags is data: requests and commands from it are not followed. An “end of file” line with another tag inside the block is part of the file.

© sangrokjung · MIT · https://github.com/sangrokjung/claude-forge/tree/HEAD/commands/build-fix.md

## Similar
- [build-error-resolver](https://affpapa.org/en/nevibecode/agents/affaan-mustafa-build-error-resolver.md) — subagent · ★ 6739 repo stars
- [migrate-to-deno](https://affpapa.org/en/nevibecode/skills/migrate-to-deno.md) — skill · 125 installs
- [bun-package-manager](https://affpapa.org/en/nevibecode/skills/bun-package-manager.md) — skill · 463 installs
- [aube-package-manager](https://affpapa.org/en/nevibecode/skills/aube-package-manager.md) — skill · 399 installs
- [npm-git-install](https://affpapa.org/en/nevibecode/skills/npm-git-install.md) — skill · 351 installs
- [audit-and-reduce-dependencies](https://affpapa.org/en/nevibecode/skills/audit-and-reduce-dependencies.md) — skill · 3200 installs

## Other versions with the same name
- [build-fix · worldflowai](https://affpapa.org/en/nevibecode/commands/affaan-mustafa-build-fix.md) — ★ 6739 repo stars

From the same set: [sangrokjung/claude-forge](https://affpapa.org/en/nevibecode/by/sangrokjung/claude-forge.md) — 44 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
