agentleFS
aethroxaethrox/doctrine/skills/writing-for-agents/SKILL.md

writing-for-agents

Skill18 starsChanged 3 months agoMITView on GitHub

Classify and structure content going into a document an agent reads (a skill, AGENTS.md, CLAUDE.md, a linked doc) so procedure, facts, and rationale don't get tangled together. Use when creating or editing a skill, or writing/editing AGENTS.md or CLAUDE.md.

97 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use setup-ts-deep-modules, writing-beats and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • loulanyueSkill

    setup-ts-deep-modules

    Wire dependency-cruiser into a TypeScript repo so each package is a deep module — implementation hidden in subfolders, reachable only through its entry-point files. User-invoked.

    Also in 13 projects that use this

  • RoentekSkill

    writing-beats

    Writing, exploit — assemble raw material into a journey of beats, grounding each term before a beat leans on it.

    Also in 16 projects that use this

  • RoentekSkill

    writing-shape

    Writing, exploit — shape raw material into an article, paragraph by paragraph.

    Also in 16 projects that use this

  • pahwarangerSkill

    setup-skills

    Sets up an `## Agent skills` block in AGENTS.md/CLAUDE.md and `docs/agents/` so the engineering skills know this repo's ticket tracker (GitHub or local markdown), triage label vocabulary, and domain doc layout. Run before first use of `to-tickets`, `to-prd`, `triage`, `diagnose`, `tdd`, `improve-codebase-architecture`, or `zoom-out` — or if those skills appear to be missing context about the ticket tracker, triage labels, or domain docs.

    Also in 5 projects that use this

  • qwlabsSkill

    claude-handoff

    Hand the current conversation off to a fresh background agent that picks up the work immediately.

    Also in 12 projects that use this

  • qhuang20Skill

    migrate-to-shoehorn

    Migrate test files from `as` type assertions to @total-typescript/shoehorn. Use when user mentions shoehorn, wants to replace `as` in tests, or needs partial test data.

    Also in 14 projects that use this

  • +2 more from Roentek

The file

We split this skill into the rules it gives an agent

1 rule. 0 are common, 1 is distinctive, and 0 are very specific to this project.

  • 0

    Common

    Most of the 87 edited versions we read keep these.

  • 1

    Distinctive

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Before adding a line, decide which Diátaxis quadrant it belongs to:

    line 12

“Common” is measured: kept by at least 6 in 10 of the 87 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Writing for Agents

A document a human reads and a document an agent re-reads on every invocation serve different needs, and the mismatch is where most skill docs go wrong. This skill's defining constraint adapts Diátaxis (the four-way documentation framework (tutorial, how-to, reference, explanation)) to that difference: an agent almost never needs a tutorial (a guided first-exposure experience; the agent isn't building lasting comprehension across sessions the way a human learner is), so a document written for an agent should be built almost entirely from how-to (the steps it executes) and reference (facts it consults on demand), with explanation (the "why") minimized or relocated to where a human maintainer, not the executing agent, will actually read it.

Phase 1: Classify before writing

Before adding a line, decide which Diátaxis quadrant it belongs to:

  • How-to: an ordered action the agent takes. This is the spine of most skill documents.
  • Reference: a fact, definition, or rule consulted on demand, not read top to bottom (a table of standards, a checklist of criteria).
  • Explanation: the reasoning behind a choice, useful for understanding why, not for knowing what to do.
  • Tutorial: a guided first-exposure walkthrough. Almost never belongs in an agent-facing document: see Phase 4.

Content of one kind buried inside another is where documents go stale and hard to maintain: an explanation sitting mid-procedure reads like a step, and an agent that treats it as one either stalls or improvises past it.

Phase 2: Write the how-to as the spine

The numbered phases or steps are what the agent actually executes, in order, each ending on a condition clear enough to tell done from not-done. This is the tier that earns the top of the document; everything else exists to support it, not to compete with it for attention. Write generated prose without em dashes, using a comma, colon, period, or a reworded sentence instead.

Phase 3: Push reference behind structure, not narrative

Facts consulted on demand (a table, a checklist, a glossary) don't need to be read in sequence, so don't force them into one. Keep them as a clearly separate, flat structure (a table, a bulleted list under its own heading) rather than folding them into prose the agent has to parse linearly to extract one row. If the reference material is large enough to dwarf the how-to, split it into a linked file the agent reaches only when that step needs it; a document whose reference outweighs its procedure buries the procedure.

Phase 4: Relocate explanation, don't delete it

The reasoning behind a decision is real and worth keeping, but an agent re-executing a procedure every invocation doesn't need to re-read why it exists; a human maintaining or reviewing the skill later does. Where the "why" doesn't change what the agent does, move it to where a maintainer will find it (a commit message, a PR description, an ADR per domain-modeling) rather than paying its cost in the agent's context on every run. Where the "why" does change behavior (a caveat that alters what the agent should do in a specific case), it isn't explanation at all; it's a rule, and belongs in the how-to or reference tier where the agent will actually apply it.

Phase 5: Skip the tutorial tier

A tutorial's job is building a learner's confidence and mental model over a first guided pass; valuable for a human onboarding to a topic, essentially wasted on an agent that has no persistent mental model between invocations to build. If a document is drifting toward "first, let's understand X, then we'll look at Y" framing, that's tutorial voice leaking into agent-facing content; cut straight to the how-to and let reference carry the concepts it needs.

Done when

  • Every piece of content was classified as how-to, reference, or explanation before being placed, and tutorial-voice framing was avoided.
  • The how-to (numbered steps) is the spine, not interleaved with reference material mid-procedure.
  • Reference material is structured for lookup (tables, checklists), and split to a linked file if it would otherwise dwarf the how-to.
  • Explanation that doesn't change agent behavior was relocated to where a human maintainer reads it, not left in the agent's re-read path.
  • Explanation that does change agent behavior was rewritten as a rule in the how-to or reference tier, not left as unexecuted rationale.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.