harness-engineering
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseHarness Engineering Framework
Harness Engineering框架
One-click initialization of a complete Harness Engineering framework in any project directory.
Based on insights from OpenAI (Codex), Anthropic (3-agent GAN architecture), and LangChain (self-verify loops), this skill sets up:
- 3-agent architecture: Planner (spec), Generator (build), Evaluator (test)
- Sprint contracts: Machine-verifiable "done" criteria before coding
- Quality hooks: Loop detection, pre-completion checklist, context injection
- Slash commands: ,
/plan,/build,/qa/sprint - Golden principles: 10 non-negotiable rules enforced across all agents
一键在任意项目目录中初始化完整的Harness Engineering框架。
该技能基于OpenAI(Codex)、Anthropic(3-agent GAN架构)和LangChain(自验证循环)的技术洞察搭建,可配置:
- 3-Agent架构:Planner(规格制定)、Generator(构建)、Evaluator(测试)
- Sprint契约:编码前即可机器验证的“完成”标准
- 质量钩子:循环检测、完成前检查清单、上下文注入
- 斜杠命令:、
/plan、/build、/qa/sprint - 黄金原则:所有Agent需遵循的10条不可协商规则
When to Use
使用场景
- Starting a new project and want structured AI-assisted development
- Want to set up Plan-Build-Verify-Fix workflow in current project
- User says "harness", "init harness", "setup framework", or similar
- 启动新项目,希望采用结构化AI辅助开发流程
- 想要在当前项目中搭建Plan-Build-Verify-Fix工作流
- 用户提及"harness"、"init harness"、"setup framework"或类似表述
Initialization Process
初始化流程
Step 1: Gather Project Info
步骤1:收集项目信息
Before generating files, ask the user:
- Project name (or detect from current directory name)
- Tech stack (optional, e.g. "React + Node.js", "Python FastAPI", "Go microservice")
- Project type (web app, API service, CLI tool, library, etc.)
If the user provides a description with , extract the info from context.
/harness <description>生成文件前,需询问用户:
- 项目名称(或从当前目录名称自动检测)
- 技术栈(可选,例如"React + Node.js"、"Python FastAPI"、"Go微服务")
- 项目类型(Web应用、API服务、CLI工具、库等)
若用户提供形式的内容,则从上下文提取相关信息。
/harness <描述>Step 2: Generate Framework Files
步骤2:生成框架文件
Execute the scaffold script:
bash
python3 {{SKILL_PATH}}/scripts/scaffold.py --project-name "<PROJECT_NAME>" --tech-stack "<TECH_STACK>" --project-type "<PROJECT_TYPE>" --target-dir "<CURRENT_PROJECT_DIR>"This generates the following structure in the current project:
<project>/
CLAUDE.md # Project map (<80 lines)
.claude/
agents/
planner.md # Spec creation agent
generator.md # Implementation agent
evaluator.md # Testing/grading agent
doc-gardener.md # Doc freshness agent
commands/
plan.md # /plan command
build.md # /build command
qa.md # /qa command
sprint.md # /sprint command
hooks/
loop-detector.py # File edit loop detection
pre-completion-check.py # Task completion checklist
context-injector.py # Session context middleware
docs/
architecture.md # System design
golden-principles.md # Non-negotiable rules
sprint-workflow.md # Sprint process
contracts/
TEMPLATE.md # Sprint contract template
specs/ # (populated by planner)
plans/ # (populated by planner)执行脚手架脚本:
bash
python3 {{SKILL_PATH}}/scripts/scaffold.py --project-name "<PROJECT_NAME>" --tech-stack "<TECH_STACK>" --project-type "<PROJECT_TYPE>" --target-dir "<CURRENT_PROJECT_DIR>"此命令会在当前项目中生成以下结构:
<project>/
CLAUDE.md # 项目地图(少于80行)
.claude/
agents/
planner.md # 规格创建Agent
generator.md # 实现Agent
evaluator.md # 测试/评估Agent
doc-gardener.md # 文档更新Agent
commands/
plan.md # /plan命令
build.md # /build命令
qa.md # /qa命令
sprint.md # /sprint命令
hooks/
loop-detector.py # 文件编辑循环检测
pre-completion-check.py # 任务完成检查清单
context-injector.py # 会话上下文中间件
docs/
architecture.md # 系统设计
golden-principles.md # 不可协商规则
sprint-workflow.md # Sprint流程
contracts/
TEMPLATE.md # Sprint契约模板
specs/ # (由Planner填充)
plans/ # (由Planner填充)Step 3: Configure Hooks
步骤3:配置钩子
After generating files, merge hook configuration into the project's (or create it):
.claude/settings.jsonbash
python3 {{SKILL_PATH}}/scripts/merge_settings.py --target-dir "<CURRENT_PROJECT_DIR>"This adds hook definitions without overwriting existing settings.
生成文件后,将钩子配置合并到项目的中(若不存在则创建):
.claude/settings.jsonbash
python3 {{SKILL_PATH}}/scripts/merge_settings.py --target-dir "<CURRENT_PROJECT_DIR>"此操作会添加钩子定义,且不会覆盖现有配置。
Step 4: Verify Installation
步骤4:验证安装
Confirm all files were created:
bash
ls -la CLAUDE.md .claude/agents/ .claude/commands/ .claude/hooks/ docs/Report to the user what was created and how to start using it.
确认所有文件已创建:
bash
ls -la CLAUDE.md .claude/agents/ .claude/commands/ .claude/hooks/ docs/向用户报告已创建的内容及使用方法。
Usage After Initialization
初始化后的使用方法
| Command | Purpose |
|---|---|
| Create a feature specification from 1-4 sentences |
| Build the most recent spec using sprint workflow |
| Run evaluator against current code |
| Full Plan-Build-Verify cycle from scratch |
| 命令 | 用途 |
|---|---|
| 根据1-4句话的描述创建功能规格 |
| 使用Sprint工作流构建最新规格 |
| 针对当前代码运行Evaluator测试 |
| 从头开始执行完整的Plan-Build-Verify周期 |
Key Principles
核心原则
The framework enforces these rules (see after install):
docs/golden-principles.md- Spec before code - No implementation without a written spec
- Testable criteria - Every feature has machine-verifiable acceptance criteria
- Self-verify first - Generator must self-check before evaluator runs
- Loop awareness - Editing same file 5+ times triggers a stop-and-reassess
- Contract-driven - Sprint contracts define "done" before coding begins
该框架强制执行以下规则(安装后可查看):
docs/golden-principles.md- 先规格后编码 - 无书面规格则不进行实现
- 可测试标准 - 每个功能都有可机器验证的验收标准
- 先自我验证 - Generator必须先自行检查,再由Evaluator运行测试
- 循环感知 - 同一文件编辑5次以上时,触发停止并重新评估
- 契约驱动 - Sprint契约在编码前定义“完成”标准
Architecture
架构
For full details, read the generated after installation. Key flow:
docs/architecture.mdUser Prompt → Planner (spec) → Generator + Evaluator negotiate contract
→ Generator builds → Evaluator tests → Fix loop (max 3x) → Complete详细内容请查看安装后生成的。核心流程:
docs/architecture.md用户提示 → Planner(制定规格)→ Generator + Evaluator协商契约
→ Generator构建 → Evaluator测试 → 修复循环(最多3次)→ 完成