writing-for-agents
它能做什么
它为 AI 智能体所阅读的文件提供写作指导,例如技能和项目指令文件。它适合撰写智能体必须可靠遵循的指令的人。
适用场景
- ✓你正在为智能体创建或编辑技能的时候。
- ✓你正在撰写 AGENTS.md 或 CLAUDE.md 文件的时候。
- ✓你希望智能体每次运行都以相同方式遵循某份文件的时候。
技能链接
https://github.com/mattpocock/skills/blob/main/skills/productivity/writing-for-agents/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请帮我重写 CLAUDE.md,让智能体更可靠地遵循我们的项目规则。”
每周 5 个新技能,1 分钟读完。
工作原理
它说明如何撰写清晰的指引和触发条件,让智能体知道何时阅读每一部分。它建议先打磨措辞,再添加更多材料。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Reference for writing any document an agent consumes: a skill, an AGENTS.md / CLAUDE.md, a doc reached by a pointer. The packaging differs; the writing does not: the same levers make each one predictable, since the agent takes the same process every run rather than producing the same output.
When the document you're writing is a skill, read SKILL-MECHANICS.md for frontmatter, invocation choice, and router skills.
Context pointers
A context pointer is a reference held in the agent's context that names some out-of-context material and encodes the condition for reaching it. A skill's description is one; a line in AGENTS.md naming a doc is the same object. The pointer's wording, not its target, decides when the agent reaches the material, and how reliably. A must-have target behind a weakly worded pointer is a variance bug: sharpen the wording first, and inline the material only if sharpening fails.
A pointer does two jobs: state what the material is, and list the branches that should trigger reaching it (a branch is a distinct case the document handles, so different runs take different paths through it). Every word of an always-loaded pointer costs on every turn, so it earns even harder pruning than the body:
- Front-load the leading word: the pointer is where it does its triggering work.
- One trigger per branch. Synonyms that rename a single branch are one branch written twice; collapse them and keep only genuinely distinct branches.
- Cut identity the body already carries.
The two loads
Every document and pointer you add spends one of two budgets:
- Context load is the cost of always-loaded material on the agent's window: an
AGENTS.mdline, a skill description, anything sitting in context every turn, spending tokens and attention whether or not it fires. - Cognitive load is the cost on the human: which documents exist and when to reach for each. The human is the index. Not a cost to minimise: it is the price of human agency; spend it where human judgement matters, remove it where it does not.
Material reached only through a pointer escapes context load at the price of the pointer's own line; material with no pointer at all rides entirely on cognitive load.
Information hierarchy
A document is built from two content types: steps (the ordered actions the agent performs) and reference (definitions, rules, facts consulted on demand). The two mix freely: all steps (a recipe), all reference (a review's rules, this skill), or both. The core decision is where each piece sits on the information hierarchy, a ladder ranked by how immediately the agent needs the material:
- In-file step is the primary tier: what the agent does, in order.
- In-file reference is consulted on demand. Often a legitimately flat peer-set (every rule of a review on one rung), which is a fine arrangement, not a smell.
- Disclosed reference is pushed out into a separate file, reached by a context pointer, loaded only when the pointer fires. Spans a sibling file in the same folder through fully external reference that lives anywhere and any document can point at.
Push too little down and the top bloats; push too much and you hide material the agent actually needs. That tension is the whole decision.
Progressive disclosure is the move down the ladder (out of the main file and behind a pointer) so the top stays legible. Not primarily a token optimisation: it is how the hierarchy is protected. Branching is the cleanest disclosure test: inline what every branch needs, and push behind a pointer what only some branches reach. When a document has steps, in-file reference that should be disclosed buries them and turns attending to them into a coin-flip: a variance lever, not just a legibility one.
Co-location is the within-file companion: where the ladder decides how far down a piece sits, co-location decides what sits beside it once there. Keep a concept's definition, rules, and caveats under one heading rather than scattered, so reading one part brings its neighbours with it. The test: the document should read like documentation written for the agent. Grouped material reads that way; scattered material does not. (Distinct from duplication: that repeats one meaning in two places; scattering fragments one meaning across many.)
Sprawl is the failure mode here: a document simply too long, even when every line is live and unique. Attenti
常见问题
什么是上下文指引?
智能体所持有的一种引用,它指明某些材料,并说明何时阅读它。
它也涵盖技能文件的设置吗?
涵盖。对于技能,它会指向另一份关于 frontmatter 以及技能如何被调用的参考资料。
为什么措辞如此重要?
技能说明,指引的措辞决定智能体何时会读到相应材料,这比材料本身更关键。
详情
作者的原始描述
Writing documents for agents. Use when creating or editing skills, or modifying AGENTS.md or CLAUDE.md.
repo: mattpocock/skills
热度
- GitHub 星标
- 310k
- 排名
- #125
- 许可证
- MIT
- 更新时间
- 2026/11/1
评论
- …