coding-agent-harness

coding-agent-harness is a skill for Claude Code, Codex from bojieli/ai-agent-book. It costs 106 tokens per session (2,096 once invoked), scanned C, original, Apache-2.0.

A guide to building the surrounding system that lets an AI agent safely work on code. This system provides tools, rules, tests, feedback, permissions, and ways to undo changes.

In plain words
What is it for?
Use it to build or improve coding agents, choose their tools and limits, connect test and lint results, define completion checks, and add sandboxing, version control, or rollback.
Why use it?
A coding model may produce code but still run the wrong commands, take unsafe shortcuts, or claim success too early. Clear checks and recovery paths make those failures easier to detect and reverse.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to build or improve coding agents, choose their tools and limits, connect test and lint results, define completion checks, and add sandboxing, version control, or rollback.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/bojieli/ai-agent-book/coding-agent-harness
About the project

AI Agent: Design Principles and Engineering Practice is an open-source book that explains how AI agents combine language models, context, and tools, with accompanying experiments and code. It is intended for readers studying the principles and engineering of AI agents, from fundamentals through production use. The catalogue skills support coding-agent work related to the book's subject matter.

bojieli/ai-agent-book · 54,406 stars · on GitHub

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.

Any agent
npx skills add bojieli/ai-agent-book --skill coding-agent-harness
Clone the repo
git clone --depth 1 https://github.com/bojieli/ai-agent-book

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for coding-agent-harness

README.md
[![agentmods](https://agentmods.dev/badge/skills/bojieli/ai-agent-book/coding-agent-harness/github.svg)](https://agentmods.dev/skills/bojieli/ai-agent-book/coding-agent-harness)
Your own site
<a href="https://agentmods.dev/skills/bojieli/ai-agent-book/coding-agent-harness"><img src="https://agentmods.dev/badge/skills/bojieli/ai-agent-book/coding-agent-harness/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for coding-agent-harness

Your own site · 80×15
<a href="https://agentmods.dev/skills/bojieli/ai-agent-book/coding-agent-harness"><img src="https://agentmods.dev/badge/skills/bojieli/ai-agent-book/coding-agent-harness.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 106 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,096 The whole file, excluding the scripts and references it only reads on demand.
Security scan C 1 finding. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found 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.1 $0.00106 $0.02096
Opus 5.5 $0.00042 $0.00838
Sonnet 5.5 $0.00021 $0.00419
Haiku 4.5 $0.00011 $0.00210

Measured 22d ago against content hash 0acb76ed2496, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade C, and why

coding-agent-harness 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 22d 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.

**约束管动作,不只是管结果。** 验收基线管结果对不对,执行边界管过程:删库重建"修复"了故障但数据没了,删光重写让编译通过但实现没了。这类破坏性捷径 Agent 总能绕开指标找到(reward hacking 的日常形态),因此 `rm -rf`、删生产数据、覆盖未读文件要设专门检查与审批。
skills/coding-agent-harness/SKILL.md · 88 lines

How it starts

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

Coding Agent 与 Harness 工程

何时使用

  • 从零搭建 Coding Agent(选工具集、定工作流、接测试反馈)
  • 为已有 Agent 补可靠性:加护栏、验收基线、执行边界、回退手段
  • 评估一个任务是否适合交给 Agent 自主执行(四象限判断)
  • Agent "能跑但不可靠":跑偏、走破坏性捷径、过早宣布完成
  • 优化 Harness 本身(提示词、工具中间件、自验证循环)而不是换模型

核心原则

Agent = Model + Harness,Harness = 上下文管理 + 工具接口 + 约束 + 验证 + 纠正。 Harness 是"Agent 边界内、模型之外"的运行与治理层:工具定义、调用适配器、沙箱权限属于 Harness;沙箱内的文件进程、外部数据库、用户属于 Environment。模型能力趋同后,竞争力在 Harness。

Coding Agent 场景的 Harness 四组件(把抽象机制落地成工程件):

组件 回答的问题 落地形态
验收基线 什么算做完了 测试套件、CI 管道、代码审查标准
执行边界 能碰什么不能碰什么 模块边界、依赖规则、权限控制
反馈信号 自动化的对错判断 Linter 输出、测试结果、类型检查错误
回退手段 出了问题怎么恢复 Git 版本控制、沙盒隔离、快照回滚

任务四象限(目标清晰度 × 验证自动化程度)——Harness 的目标是把任务推向"目标明确 + 可自动验证":

  • 目标明确 + 可自动验证 = 最佳区域(修复有测试用例的 bug)
  • 目标明确 + 需人工验证 = 吞吐量受限,天花板是人的审查速度
  • 目标模糊 + 可自动验证 = 高效地跑偏(如拿 linter 分数优化"代码质量")
  • 目标模糊 + 需人工验证 = 难以启动(如"让 UI 更好看")

代码编写天然处于象限核心:测试套件给验收标准,Linter/类型检查给即时验证,Git 给版本控制与回退。Coding Agent 成熟度最高不是因为代码模型最强,而是软件工程几十年积累的基础设施天然就是一套 Harness。

四条可迁移的设计原则:

  1. 约束优先于指导——能用代码强制的规则不要用文档建议。Linter 规则、类型约束、CI 检查是"做不了",系统提示词里"请遵循..."只是"建议别做"。
  2. 验证要自动化——人工审查是不可扩展的瓶颈,测试/检查/监控的投入回报率远高于加人力。
  3. 反馈越快越好、越结构化越好——错误信息越详细、越接近出错时刻,Agent 纠正效率越高。
  4. 回退要可靠——有安全网 Agent 才敢试错;Git 分支、沙盒、快照确保任何错误可逆。

约束管动作,不只是管结果。 验收基线管结果对不对,执行边界管过程:删库重建"修复"了故障但数据没了,删光重写让编译通过但实现没了。这类破坏性捷径 Agent 总能绕开指标找到(reward hacking 的日常形态),因此 rm -rf、删生产数据、覆盖未读文件要设专门检查与审批。

并行调用的故障边界控制:一个工具失败时,故障只在同一批并行调用内传播(级联中止依赖它的调用),不取消独立调用,不上升到父级操作、不让整个任务中止。每个工具声明是否支持并发(默认否,失败安全)。

业界经验:

  • 大规模代码迁移成功靠三件事:知识必须存在于代码库本身(Agent 看不到的等于不存在)、约束编码进 Linter/CI 而非文档、验证与纠正全链路自动化。
  • LangChain 只优化 Harness(提示词、工具中间件、自验证循环)就把 Terminal Bench 2.0 从 52.8% 提到 66.5%,并用 Agent 分析失败轨迹反哺 Harness,让 Harness 工程从经验驱动变数据驱动。
  • Anthropic 拆两个角色:初始化 Agent 分解任务清单,执行 Agent 逐步推进并留下清晰的交接产物,解决"一次想做太多"和"过早声称完成"。

实践模式

建一个 Coding Agent 的最小清单:

  1. 工具集:文件读写(read/write/edit)、目录浏览(glob/ls)、内容搜索(grep)、命令执行(bash)七件套;每个工具命名直观、参数带例子、边界有说明(防呆设计)。
  2. 工作流:先理解项目(读文档、建认知框架)→ 设计 → 实现 → 立即写测试并跑 → 失败则分析-定位-修复循环,直到测试全绿。把"测试通过"而非"代码写完"定义为完成标准——跳过测试直接报完成是 Coding Agent 最常见的偷懒方式。
  3. 验收基线:接入现成的测试套件、Linter、类型检查、CI;没有就先补最小可跑的。
  4. 执行边界:默认权限最小化(故障安全默认值,能力默认关闭、显式开放);危险命令走审批。
  5. 回退手段:每次任务前开 Git 分支或快照;沙盒内执行不可逆操作。
  6. 反馈回路:把 Linter/测试/编译错误结构化地喂回上下文(附行号、文件路径、错误类型)。
  7. 持续改进:收集失败轨迹,让 Agent 分析轨迹反哺 Harness 修改。

Read the full file on GitHub · 88 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. 22d ago First seen · 88 lines · 106 tokens per session scan C 0acb76ed2496

Subscribe to this mod's changes

coding-agent-harness is a skill published in the GitHub repository bojieli/ai-agent-book (54,406 stars, last pushed 7d ago), licensed Apache-2.0. It adds 106 tokens to every session and 2,096 once invoked, about $0.0004 per session on Opus 5.5. A static security scan graded it C with 1 finding (recursive force delete). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-24.

Related

Other skills, from other repositories

ccc

This skill should be used when code search is needed (whether explicitly requested or as part of completing a task), when indexing the codebase after changes, or when the user asks about ccc, cocoindex-code, or the codebase index. Trigger phrases include 'search the codebase', 'find code related to', 'update the…

cocoindex-io/cocoindex-code · 80 tokens

aafb9b1b091b4dc00c7d838fa91f75c507e51c36045f31bccfc864a8532819f8

Use exact retained evidence.

kungfu-systems/kungfu · 0 tokens

04-audit

Audit a codebase read-only across seven quality pillars into one ranked report. Use when the user wants to assess, health-check, or audit a codebase or one pillar. Not for fixing findings, reviewing a change, or checking a feature works.

ai-driven-dev/framework · 54 tokens

07-refactor

Improve code across four axes (cleanup, performance, security, architecture) by scanning and fixing, or applying a pushed audit report. Use when the user wants to refactor, optimize, harden, or remove code. Not for read-only diagnosis or adding tests.

ai-driven-dev/framework · 57 tokens

03-assert

Assert the work behaves by iterating the project's coding assertions until they pass, plus optional architecture and frontend facets. Use to validate an implementation. Not for reviewing or writing tests.

ai-driven-dev/framework · 39 tokens

08-debug

Reproduce and fix a known bug, or find an unknown root cause by hypothesis validation. Use when the user wants to fix a bug, find why something breaks, or reopen a stuck investigation. Not for building a feature or reviewing a diff.

ai-driven-dev/framework · 52 tokens