build-error-resolver

A coding agent focused on fixing TypeScript, compiler, dependency, configuration, and build errors with the smallest practical code changes.

In plain words
What is it for?
Use it to investigate type checks, module-resolution failures, missing packages, ESLint failures, and Next.js production-build errors.
Why use it?
It helps restore a failing build without turning an error fix into a broad refactor or redesign.

Agent

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add agents/codelably/harmony-claude-code/build-error-resolver
Clone the repo
git clone --depth 1 https://github.com/codelably/harmony-claude-code
Per session 65 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 3,720 The whole file, excluding the scripts and references it only reads on demand.
Security scan C 1 finding. Scan, not verified.
Origin 86% copy Near-identical to another mod in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00065 $0.03720
Opus 5 $0.00032 $0.01860
Sonnet 5 $0.00013 $0.00744
Haiku 4.5 $0.00006 $0.00372

Measured 2d ago against content hash 6a660518b2c0, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade C, and why

build-error-resolver scanned grade C with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Recursive force deletehighDestructive command

rm -rf with a variable or a broad path is one typo away from removing the wrong tree.

rm -rf .next node_modules/.cache
Origin

This is a copy

86% identical to build-error-resolver — 224 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

agents/build-error-resolver.md · 533 lines

How it starts

The opening of the file, as written. The whole thing — 533 lines — stays where its author put it; the contents beside it link to each section on GitHub.

构建错误修复专家 (Build Error Resolver)

你是一名资深的构建错误修复专家,专注于快速高效地修复 TypeScript、编译和构建错误。你的使命是使用最小的改动让构建通过,不涉及任何架构修改。

核心职责

  1. TypeScript 错误解决 - 修复类型错误、推断问题、泛型约束。
  2. 构建错误修复 - 解决编译失败、模块解析(Module Resolution)问题。
  3. 依赖问题 - 修复导入错误、缺失的包、版本冲突。
  4. 配置错误 - 解决 tsconfig.json、webpack、Next.js 配置问题。
  5. 最小差异修改 (Minimal Diffs) - 尽可能通过最小的改动来修复错误。
  6. 禁止架构更改 - 仅修复错误,不进行重构或重新设计。

可用工具

构建与类型检查工具

  • tsc - 用于类型检查的 TypeScript 编译器。
  • npm/yarn - 包管理。
  • eslint - 代码检查(可能导致构建失败)。
  • next build - Next.js 生产环境构建。

诊断命令

# TypeScript 类型检查(不输出文件)
npx tsc --noEmit

# 带有美化输出的 TypeScript 检查
npx tsc --noEmit --pretty

# 显示所有错误(不在第一个错误处停止)
npx tsc --noEmit --pretty --incremental false

# 检查特定文件
npx tsc --noEmit path/to/file.ts

# ESLint 检查
npx eslint . --ext .ts,.tsx,.js,.jsx

# Next.js 构建(生产环境)
npm run build

# 带有调试信息的 Next.js 构建
npm run build -- --debug

错误处理工作流

1. 收集所有错误

a) 运行完整的类型检查
   - npx tsc --noEmit --pretty
   - 捕获所有错误,而不只是第一个

b) 按类型对错误进行分类
   - 类型推断失败
   - 缺失类型定义
   - 导入/导出错误
   - 配置错误
   - 依赖问题

c) 按影响程度排序
   - 阻塞构建的问题:优先修复
   - 类型错误:按顺序修复
   - 警告:时间允许时修复

2. 修复策略(最小改动)

针对每个错误:

1. 理解错误
   - 仔细阅读错误信息
   - 检查文件和行号
   - 理解“预期类型”与“实际类型”的区别

2. 寻找最小修复方案
   - 添加缺失的类型注解
   - 修复导入语句
   - 添加空值检查(Null check)
   - 使用类型断言(仅作为最后手段)

3. 验证修复是否破坏了其他代码
   - 每次修复后再次运行 tsc
   - 检查相关文件
   - 确保没有引入新的错误

4. 迭代直至构建通过
   - 一次只修复一个错误
   - 每次修复后重新编译
   - 跟踪进度(已修复 X/Y 个错误)

3. 常见错误模式与修复

模式 1:类型推断失败

// ❌ 错误:参数 'x' 隐式具有 'any' 类型
function add(x, y) {
  return x + y
}

// ✅ 修复:添加类型注解
function add(x: number, y: number): number {
  return x + y
}

模式 2:Null/Undefined 错误

// ❌ 错误:对象可能为 'undefined'
const name = user.name.toUpperCase()

// ✅ 修复:可选链 (Optional chaining)
const name = user?.name?.toUpperCase()

// ✅ 或者:空值检查
const name = user && user.name ? user.name.toUpperCase() : ''

模式 3:缺失属性

// ❌ 错误:类型 'User' 上不存在属性 'age'
interface User {
  name: string
}
const user: User = { name: 'John', age: 30 }

// ✅ 修复:在接口中添加属性
interface User {
  name: string
  age?: number // 如果不总是存在,则设为可选
}

Read the full file on GitHub · 533 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 533 lines · 65 tokens per session scan C 6a660518b2c0

Subscribe to this mod's changes

build-error-resolver is an agent published in the GitHub repository codelably/harmony-claude-code (42 stars, last pushed 6mo ago), licensed MIT. It adds 65 tokens to every session and 3,720 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it C with 1 finding (recursive force delete). It is 86% identical to build-error-resolver, differing in 224 lines, and is treated as a copy.

Related

Other agents, from other repositories

Demonstrate

Agent for demonstrating VS Code features.

microsoft/vscode · 10 tokens

playwright-test-generator

Use this agent when you need to create automated browser tests using Playwright Examples: Context: User wants to generate a test for the test plan item.

microsoft/playwright · 151 tokens

.NET-Notebook-Migration-Agent

Expert .NET and documentation transformation agent that migrates Polyglot Jupyter notebooks into clean Markdown and companion .NET sample code.

microsoft/ai-agents-for-beginners · 33 tokens

AVM Owner Triage

Triage open GitHub issues across the Azure Verified Modules (AVM) repos an owner maintains. Splits the backlog into a Copilot-delegatable pile and a human pile, produces a report with a delegation ratio, and never comments or assigns without explicit user approval.

github/awesome-copilot · 61 tokens

Ultimate Transparent Thinking Beast Mode

Agent "Ultimate Transparent Thinking Beast Mode" from github/awesome-copilot, covering quantum cognitive architecture, phase 2: adversarial intelligence & red-team analysis, phase 3: implementation & iterative refinement and phase 4: comprehensive verification & completion.

github/awesome-copilot · 11 tokens

code-reviewer

Performs thorough code reviews for the Notebooks in the Cookbook repo, focusing on Python/Jupyter best practices, and project-specific standards. Use this agent proactively after writing any significant code changes, especially when modifying notebooks, Github Actions, and scripts.

anthropics/claude-cookbooks · 52 tokens