Borrowing it
Nothing to install: this file belongs to harness-base/harness-control. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.
curl -O https://raw.githubusercontent.com/harness-base/harness-control/main/.agents/skills/hc-add-rule/SKILL.mdgit clone --depth 1 https://github.com/harness-base/harness-controlWrote 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.
[](https://agentmods.dev/skills/harness-base/harness-control/hc-add-rule)<a href="https://agentmods.dev/skills/harness-base/harness-control/hc-add-rule"><img src="https://agentmods.dev/badge/skills/harness-base/harness-control/hc-add-rule/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.
<a href="https://agentmods.dev/skills/harness-base/harness-control/hc-add-rule"><img src="https://agentmods.dev/badge/skills/harness-base/harness-control/hc-add-rule.svg" alt="Reviewed on agentmods" width="80" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00132 | $0.03191 |
| Opus 5 | $0.00066 | $0.01596 |
| Sonnet 5 | $0.00026 | $0.00638 |
| Haiku 4.5 | $0.00013 | $0.00319 |
Grade A, and why
hc-add-rule scanned grade A with 0 findings 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 9d 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.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 99 lines — stays where its author put it; the contents beside it link to each section on GitHub.
规则的加 / 改 / 删(hc-add-rule)
规则写完没人读、没人拦 = 白写;改了语义 / 删了规则但引用点没跟 = 全仓悬空。本 skill 是规则加 / 改 / 删的统一入口:三步保证它放对地方、会被加载、会被执行;「规则关联对照表」保证一条规则的所有关联点(索引 / 挂钩 / eval 指针 / 引用点 / lessons 销点)加时挂全、改删时跟全。
何时用 / 何时不用
- 用(加):用户说"以后都要 / 不许 / 必须…",或你发现一条该固化的规范。
- 用(改):一条既有规则的语义 / severity / 位置 / 挂钩要变。
- 用(删):规则过时要收回(连同其全部关联点一起清)。
- 用(晋升):lessons 里反复同根的坑该升成规则(见「从 lessons 晋升」)。
- 不用:一次性临时提醒(那只记
tasks/lessons.md)。
三步(缺一步,规则就等于白加)
第 1 步:定范围 —— 这规则管谁?
先过 rule-0015 的边界:通用的归控制面(harness 资产不掺具体项目的领域名词 / 业务假设),项目专属的归被管工程(projects/<工程>/)。然后一律入驻就近的 AGENTS.md(ADR-0004),放到"能覆盖其所有目标的最浅 AGENTS.md":
- harness 全局治理(如"改业务码前先立项")→ 根
AGENTS.md - 某工程通用(如"这后端时间一律 UTC")→ 该工程根
projects/<x>/AGENTS.md - 只管某层(如"数据层用 ent、非必要不 raw SQL")→ 离那层最近的
<dir>/AGENTS.md
第 2 步:写下来 + 登记 —— 让它会被读到
- 在选定的
AGENTS.md加 / 改一条 bullet:一句"必须 / 禁止"(必要时带一行为什么 / 怎么做)。 - 带隐形标记供索引扫描:
<!-- rule: <id> | sev: blocker|warn | eval: <考题号,可空> -->。id 有两种口径,scripts/rules-index.sh全仓扫AGENTS.md、两种都收进 catalog:- 全局数字
rule-00NN:harness 全局规则(根AGENTS.md)。编号取现有最大 +1(查docs/rules/index.yaml),全仓唯一、稳定引用键,被 eval 考题 / ADR 按号引用。 - 工程命名 id
<工程>/<主题>(如backend-service/db-eager-load-fail-fast,中性占位):被管工程 / 目录级规则。命名空间 = 工程短名,主题 slug 说人话、见名知义。
- 全局数字
- 重生成 catalog:
bash scripts/rules-index.sh(生成docs/rules/index.yaml,禁手改)。加 / 改 / 删都要 regen。 - 自检:
make verify绿(rules 索引无漂移 + 该AGENTS.md有CLAUDE.mdshim)= 已收录、就近可加载。
第 3 步:挂执行 —— 让违反会被发现
按"能不能机器判"分两路:
- 能机器判(某命令 / 字符串、改 A 必须改 B、某路径模式)→
scripts/hook-policy.sh加一条匹配 +scripts/hook-policy.test.sh加正反用例 → 提交 / CI 自动拦。 - 要人判(设计是否合理 / 过度)→
docs/eval/prompts/加一道考题引用规则 id + 登记docs/eval/index.yaml→ 收尾 eval 打分。 - 两者都不便 → 至少完成第 2 步(会被加载),显式标"软约束"。
规则关联对照表(一表两用)
一条规则在仓里有 8 个关联点。**主 agent 加 / 改 / 删时照它当操作清单;hc-rule-reviewer 照它当巡查判据。**机器能查的行 make verify 已兜,reviewer 不重复查。
| # | 关联点 | 要求 | 谁兜底 |
|---|---|---|---|
| 1 | 规则本体 | 就近 AGENTS.md bullet + 隐形标记,id 口径对(全局数字 / 工程命名,见第 2 步);rule-0015 边界(通用归控制面 / 项目归工程) |
主 agent 第 1/2 步自查 + 用户拍(范围与措辞在引导环节定,reviewer 不复审内容本身) |
| 2 | 索引 | bash scripts/rules-index.sh regen docs/rules/index.yaml(禁手改) |
机检(make verify 的 --check 防漂移) |
| 3 | shim | 所在 AGENTS.md 有同级 CLAUDE.md |
机检(make verify) |
| 4 | 执行挂钩 | 机器判 → hook-policy.sh + 测试;人判 → eval 考题 + 登记;都不便 → 显式标软约束 |
reviewer(挂没挂、挂得对不对) |
| 5 | eval 指针 | 标记里的 eval: NNN 与 docs/eval/ 考题双向对上(标了号考题在、考题引的规则号存在) |
正向存在性 / 登记 = 机检(rules-index --check + verify-eval-materials);内容真伪(考题真考这条)= reviewer |
| 6 | 引用点(改 / 删要害) | 全仓 grep 该规则 id——skill 正文 / reviewer 判据 / ADR / 模板都可能复述它;改语义 / 删除时引用点全要跟(防"复述点没扫"留悬空) | reviewer |
| 7 | lessons 闭环 | 源自错题晋升的,tasks/lessons.md 对应条标 <!-- opt: rule-00NN --> 销掉(该标记也用于"已被既有规则覆盖、不另升"的条目——两种来路读 lesson 正文分辨,覆盖型不当晋升源核) |
reviewer |
| 8 | 反向引用 | 新规则该不该被现有 skill 引为指针(rule-0015 立完、各 skill 补指针,是先例) | reviewer |
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.
- 9d ago First seen · 99 lines · 132 tokens per session scan A df36120803d0
hc-add-rule is a skill published in the GitHub repository harness-base/harness-control (22 stars, last pushed 1mo ago), licensed MIT. It adds 132 tokens to every session and 3,191 once invoked, about $0.0007 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
Other skills, from other repositories
systematic-debugging
Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes.
local-ai-agents
Build local-first AI agents that run entirely on a developer workstation with Microsoft Foundry Local and Qwen function-calling models. Covers Small Language Models (SLMs), the OpenAI-compatible local endpoint, sandboxed local tools, local RAG with Chroma, local MCP servers, hybrid cloud/local routing, and the…
next-cache-components-adoption
Turn on Cache Components in a Next.js app and resolve the blocking routes it surfaces. Use when the user wants to enable, adopt, or migrate to Cache Components, flip the cacheComponents flag, work through a flood of blocking-prerender / instant validation errors, run the cache-components-instant-false codemod, or…
insight-error-page
Write or audit an insight-kind error page for the Next.js dev overlay. Use when creating a new errors/ .mdx page, auditing an existing one, or checking that a page matches the framework fix cards. Covers page structure, title alignment, FixCard cards with Copy prompt button, code snippets, terminology verification…
next-cache-components-optimizer
Drive a Next.js route to instant navigation by setting up an agentic loop, under Cache Components / PPR, on initial load (hard navigation) and client-side navigation (soft navigation). Encode the goal as a failing @next/playwright instant() e2e and work it to green, one verified route at a time; the shipped test then…
next-partial-prefetching-adoption
Turn on Partial Prefetching in a Next.js app and work through the insights it surfaces. Use when the user wants to enable or adopt Partial Prefetching, flip the partialPrefetching flag, opt routes in with export const prefetch = 'partial', audit Link prefetch={true} behavior, preserve existing prefetched UI with…