harness-engineering
它能做什么
这个技能可以让编程项目更适合 AI 助手使用,更加可靠。它会把反复出现的错误整理成规则和检查机制,防止同样的问题再次发生。
适用场景
- ✓当你希望 AI 助手在某个项目中少犯错时。
- ✓当你要为 AI 助手制定清晰的项目规则时。
- ✓当你想记录已经发生过的错误,并确保它们不再重演时。
技能链接
https://github.com/github/awesome-copilot/blob/main/skills/harness-engineering/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“让这个项目对编程助手更可靠,防止已经发生过的错误再次出现。”
每周 5 个新技能,1 分钟读完。
工作原理
这个技能会分析项目的结构和出现过的错误,然后为项目生成具体的说明和检查机制,帮助 AI 助手以后避开这些错误。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Harness Engineering
Harness engineering turns repeated coding-agent mistakes into durable repository artifacts:
Harness = Instructions + Constraints + Feedback + Memory + Evaluation + Governance
Use this skill when the user asks to:
- make a repository more reliable for GitHub Copilot or other coding agents
- add durable agent instructions, repository rules, or guardrails
- prevent repeated AI coding-agent mistakes
- record known failure paths and the checks that prevent recurrence
- add lightweight drift checks for project rules
- review, refresh, or update an existing agent harness
Do not use this skill for ordinary feature implementation unless the user asks to improve the repository's agent operating environment.
Core Principles
- Treat the target repository as the source of truth.
- Inspect before editing. Preserve the existing stack, package manager, CI, docs, naming, and architecture.
- Add the smallest useful harness. Prefer updating existing files over adding duplicate guidance.
- Make important rules enforceable where practical through tests, linters, type checks, CI, pre-commit hooks, or drift scripts.
- Use manual review points only when automation would be brittle or misleading.
- Record high-risk failures that should not recur, and name the check or review point that catches recurrence.
- Do not copy generic templates blindly. Adapt every artifact to real evidence in the target repository.
Discovery
Before proposing or making harness changes, inspect the repository for existing rules and evidence.
Read these files and folders when they exist:
README.mdAGENTS.md.github/copilot-instructions.md.github/instructions/.github/workflows/CONTRIBUTING.md- package manifests such as
package.json,pyproject.toml,go.mod,Cargo.toml,pom.xml, orbuild.gradle - existing docs under
docs/ - existing scripts under
scripts/ - existing tests and CI checks
Then summarize:
- stack, package manager, and entry points
- existing development and verification commands
- current agent instructions or repository conventions
- known failures, incidents, flaky paths, or repeated review comments
- gaps where project rules are not enforced
Adoption Workflow
Follow this sequence:
- Choose the harness surface that fits the target repository.
- Write target-specific agent instructions.
- Add enforceable checks for high-value rules.
- Record failure memory for high-risk or recurring failures.
- Add drift checks for guidance that can silently become stale.
- Report the adoption with evidence, assumptions, and follow-up.
1. Choose the Harness Surface
Pick only the surfaces that fit the target repository:
| Need | Preferred artifact |
|---|---|
| Always-on agent behavior | AGENTS.md or .github/copilot-instructions.md |
| File-scoped guidance | .github/instructions/*.instructions.md |
| Recurring project checks | scripts/check_*.py, shell scripts, or package scripts |
| CI enforcement | existing workflow files or a small new workflow |
| Known failures | docs/failures/*.md |
| Architecture or process decisions | docs/decisions/*.md |
| Adoption evidence | docs/harness/adoption-report.md or similar |
If the repository already has an equivalent location, update it instead of creating a parallel system.
2. Write Agent Instructions
Agent instructions should be concrete and operational. Include:
- project purpose and major ownership boundaries
- setup, test, lint, build, and verification commands
- package manager and dependency rules
- safe editing rules, generated file rules, and forbidden paths
- testing expectations for changed code
- PR and commit conventions if the repo has them
- how to record new failures or decisions
Avoid broad personality guidance, generic best practices, and rules that cannot be checked or reviewed.
3. Add Enforceable Checks
Convert high-value rules into checks. Good harness checks are:
- narrow enough to avoid false positives
- fast enough to run locally and in CI
- named clearly so agents can run them before finishing
- documented with the rule they protect
Examples:
Rule: Do not edit generated API clients.
Check: script scans diffs for generated paths and fails with a clear message.
Rule: Every failure memory note names a regression check.
Check: script validates docs/failures/*.md for a "Detection" section.
Rule: Profile docs and templates must stay aligned.
…
常见问题
什么是“仓库工件”(repository artifacts)?
指项目里的各种文件和配置(比如说明文件、测试或脚本),它们用来引导并验证 AI 助手的行为。
这个技能如何防止错误重复出现?
它会把错误转化为“失败记忆”,并创建测试或脚本等检查机制,用来发现并阻止这些错误再次发生。
使用这个技能需要会编程吗?
不需要成为有经验的程序员。这个技能就是为即使不懂代码技术细节的人设计的。
详情
作者的原始描述
Adopt repository-level harness engineering for coding agents. Use when a user wants to prevent repeated AI coding-agent mistakes by turning failures into durable instructions, drift checks, regression tests, failure memory, and adoption reports tailored to the target repository.
repo: github/awesome-copilot
热度
- GitHub 星标
- 40k
- 排名
- #7245
- 许可证
- MIT
- 更新时间
- 2026/10/15
评论
- …
同一仓库的更多技能
acquire-codebase-knowledge
40k帮你的智能体理解并编写现有代码项目的文档。它有助于新成员快速上手,或者快速了解项目架构。
acreadiness-assess
40k让你的智能体评估一个项目对 AI 的准备程度,并生成报告。它有助于了解项目在使用 AI 工具方面的准备情况。
acreadiness-generate-instructions
40k帮你的智能体根据评估结果编写 AI 工具的指令文件。它有助于改善 AI 与代码的交互方式,并弥补已发现的不足。
acreadiness-policy
40k让你的智能体协助制定或应用 AI 项目评估的政策。它有助于规范项目的评估方式,并确保合规。