How-toSelected

用一套审计 prompt 精简 AGENTS.md 和 skills,把规则文本转成代码

Why we picked it

老项目的 AGENTS.md 和 skills 越堆越肥的朋友可以试试这套 prompt,思路是把规则能转 lint 和测试的都机器化,剩下文本再用消融实验实测有没有用,没用就删,上下文能省不少。

vikingmute 分享了 lauren(@poteto)提供的一套 prompt,用于审计仓库中所有面向 agent 的非结构化文本,包括 AGENTS.md、skills、cursor rules 和架构文档。核心思路是把每条规则分三类处理:复述代码或类型的直接删除,可机械执行的转换成 linter、编译检查、类型化 API 或测试后再删除文本,只有无法化简的判断类内容才保留。

Body

具体流程分四步:先盘点每个文件的字节大小并分类;再把可执行的规则移入 CI/lints/tests 并删除冗余文本;然后用盲测消融实验验证保留内容的实际价值——从仓库中选 1 到 2 个代表性真实任务,预设裁剪规则(例如较大文本集的中位数必须比较小集合至少高出 2 分才保留),在仅文本不同的干净提交上跑 3 次独立复现,条件包括完整指令、仅领域指令、仅最小根指令三组,并用独立 judge 模型加自动化探针测试对盲评 diff 打分。

最后输出记分卡,标注哪些文档和 skills 从未被打开、哪些文本有害或有益,删除所有未通过预设裁剪规则的内容,并把反复出现的失败模式转化成测试或 lint 而不是新文本。长期维护的老项目里 AGENTS.md 和 skills 容易越积越多,这套方法能同时精简规则文本和减少上下文占用。

Original · Viking

好实用的一个 prompt,我发现时间长了项目中的 AGENTS.md, skills 和 技术文档会越来越长,里面塞的东西越来越多,土豆姐的这个 prompt 本质上是把这些内容审计并尽可能精简甚至删除仓库里所有面向agent的规则文本。 然后把能机器化的部分全部转成代码 类型 lint以及测试等等,而且最后一步测试删除以后跑真实测试看是否真的有影响,用这样的过程精简了规则文本又可以减少上下文。 大家如果老项目这些文件越来越冗长就可以来试试看。 lauren @poteto here's a prompt you can try Audit all unstructured agent-facing text in this repo (AGENTS.md, skills, cursor rules, architecture/spec markdown docs) and replace as much of it as possible with executable code, types, lints, and tests. Then prove empirically what text actually earns its context window. 1. Inventory: list every doc, rule, and skill file, its byte size, and classify each claim into: - Restates code or types (delete) - Mechanically enforceable (convert into a linter, compiler check, typed API, or test, then delete the prose) - Irreducible judgment call (candidate to keep, only if concise) 2. Prune and enforce: move enforceable rules into CI/lints/tests first, delete the dead prose, and shrink root instructions to only what automated checks cannot catch. 3. Run a blinded ablation eval before keeping any remaining instructions/skills: - Pick 1 to 2 representative real tasks from this repo with an objective rubric and stress tests. - Pre-register a prune rule before running (for example: drop the larger text set unless its median beats the smaller set by at least 2 points). - Run 3 fresh isolated replicates per condition on clean commits that differ ONLY in the text under test: - A: full current instructions/skills - B: domain-only instructions - C: minimal root instructions only (0 skills/extra docs) - Audit transcripts for leaks (verify which files were actually opened vs just sitting in the system prompt). - Grade blinded diffs + built artifacts only (strip branch names, SHAs, and notes) using a separate judge model + automated probe tests. 4. Report the scorecard, which docs/skills were never opened, where extra text hurt or helped, and delete everything that fails the pre-registered prune rule. Turn any recurring failure modes into tests or lints, not new prose. 🔗 View Quoted Tweet📊 7 ⚡

Industry Coordinates & Source Verification

This report is categorized under AITOP's "How-to" desk, focusing on US frontier AI labs and Silicon Valley technology leaders. Within our cross-regional analytical framework, it directly maps to AI developer toolchains, coding agents, and engineering workflows. Key entities and technical topics under continuous tracking include AGENTS.md, prompt engineering, Cursor Rules, context optimization.

Source attribution: curated from Viking (@vikingmute).

Spotted an error in the summary or translation? Tell us