Diátaxis
Reference: https://diataxis.fr
The four modes are the meta-framework the artifact skills sit inside.
This skill forces the mode pick the artifact skills assume. Pick one
mode per document before writing; a doc that needs two modes is two
documents.
Cheapest layer first
Doc work escalates up the user-CLAUDE.md ladder; reach for a
Diátaxis doc only when the cheaper layer can't carry the knowledge:
inline comment → docstring → Diátaxis doc → repo-local CLAUDE.md
→ ~/.claude/CLAUDE.md.
A non-obvious why is a comment. An interface contract is a docstring.
Reach a docs/ artifact only for knowledge shared across the project
that no closer layer holds.
Defer to the artifact skills
readme, contributing, adr, changelog own their specific
artifacts. This skill owns the meta-mode for everything else under
docs/. When both could apply, the artifact skill wins — a README is a
README, not a "reference doc."
Pick the mode
Two axes: action vs cognition (do something / understand
something), acquisition vs application (studying / working).
| Mode |
Axis |
Serves |
Reader |
| Tutorial |
action + acquisition |
learning by doing |
newcomer, no prior context |
| How-to |
action + application |
a goal at work |
practitioner who knows the goal |
| Reference |
cognition + application |
a fact at work |
practitioner who needs to look it up |
| Explanation |
cognition + acquisition |
understanding |
someone studying the why |
Smell test before writing: is the reader learning, doing,
looking up, or understanding? One answer. If two, split the doc.
Tutorial
- Purpose — a lesson. The reader ends able to do the thing, having
done it once under guidance.
- Audience — a newcomer with no prior context; assume nothing.
- Shape — a single guaranteed-success path, concrete and
hand-held. Author owns every step; the reader only follows.
- Anti-patterns
- Over-explaining mechanics — why belongs in explanation; the
tutorial just has the reader do it.
- Assuming the reader will deviate or offering branches — one path,
no choices.
- Reference-style completeness — list only what this lesson touches,
not every option.
- Leaving a step that can fail on a clean machine — a tutorial that
doesn't reproduce isn't a lesson.
How-to
- Purpose — a recipe to reach a goal the reader already has.
- Audience — a competent practitioner who knows what they want and
needs the steps, not the background.
- Shape — an ordered series of actions. Imperative. Starts at a
realistic precondition, ends at the goal.
- Anti-patterns
- Narrating wrapper/tool internals — the reader runs the command,
they don't need its call graph.
- Restating idempotence or guarantees already in source comments —
if the code says it, the how-to doesn't.
- Predicting self-describing prompts or output — don't transcribe
what the tool already tells the operator on screen.
- Explanatory prose wrapped around code blocks ("documentation
poetry") — if a paragraph doesn't change what the reader types,
cut it. (Primary motivating failure.)
Reference
- Purpose — describe the machinery so the reader can look up a
fact and trust it.
- Audience — a practitioner mid-task who needs an authoritative
answer fast.
- Shape — dry, structured, consistent. Mirror the code's own
structure (one section per command/flag/field). Complete within
scope.
- Anti-patterns
- Narrative connective tissue — no "now that we've seen X, let's…";
entries stand alone.
- Opinionated commentary or recommendations — state what is, not
what you'd choose; advice belongs in how-to or explanation.
- Selective coverage — partial reference is a trap; if it's in
scope, document it or say it's out of scope.
Explanation
- Purpose — illuminate the why: context, background, the shape
of the decision space.
- Audience — someone studying the topic away from the keyboard,
building a mental model.
- Shape — discursive prose. Free to discuss alternatives, history,
trade-offs, opinions (owned as opinions).
- Anti-patterns
- Drifting into runnable commands or step lists — link the how-to,
don't inline it.
- Ending with a recipe — if it tells the reader what to do next,
that's a how-to wearing an explanation's clothes.
- Pretending to be neutral reference — explanation takes positions;
own them rather than disguising them as fact.
Procedure
- Confirm the artifact isn't a README/CONTRIBUTING/ADR/CHANGELOG — if
it is, hand off to that skill.
- Run the smell test; name the single mode. If the doc wants two,
surface the split before writing.
- Draft against that mode's shape; check the draft against its
anti-patterns before claiming done.
- On an edit, first classify the existing doc's mode, then flag any
prose that belongs to a different mode (the drift this skill exists
to catch).
1---2name: diataxis3description: Diátaxis4---56# Diátaxis78Reference: <https://diataxis.fr>910The four modes are the meta-framework the artifact skills sit inside.11This skill forces the mode pick the artifact skills assume. Pick one12mode per document *before* writing; a doc that needs two modes is two13documents.1415## Cheapest layer first1617Doc work escalates up the user-`CLAUDE.md` ladder; reach for a18Diátaxis doc only when the cheaper layer can't carry the knowledge:1920inline comment → docstring → **Diátaxis doc** → repo-local `CLAUDE.md`21→ `~/.claude/CLAUDE.md`.2223A non-obvious *why* is a comment. An interface contract is a docstring.24Reach a `docs/` artifact only for knowledge shared across the project25that no closer layer holds.2627## Defer to the artifact skills2829`readme`, `contributing`, `adr`, `changelog` own their specific30artifacts. This skill owns the meta-mode for everything else under31`docs/`. When both could apply, the artifact skill wins — a README is a32README, not a "reference doc."3334## Pick the mode3536Two axes: **action vs cognition** (do something / understand37something), **acquisition vs application** (studying / working).3839| Mode | Axis | Serves | Reader |40| --- | --- | --- | --- |41| Tutorial | action + acquisition | learning by doing | newcomer, no prior context |42| How-to | action + application | a goal at work | practitioner who knows the goal |43| Reference | cognition + application | a fact at work | practitioner who needs to look it up |44| Explanation | cognition + acquisition | understanding | someone studying the why |4546Smell test before writing: is the reader *learning*, *doing*,47*looking up*, or *understanding*? One answer. If two, split the doc.4849## Tutorial5051- **Purpose** — a lesson. The reader ends able to do the thing, having52 done it once under guidance.53- **Audience** — a newcomer with no prior context; assume nothing.54- **Shape** — a single guaranteed-success path, concrete and55 hand-held. Author owns every step; the reader only follows.56- **Anti-patterns**57 - Over-explaining mechanics — *why* belongs in explanation; the58 tutorial just has the reader do it.59 - Assuming the reader will deviate or offering branches — one path,60 no choices.61 - Reference-style completeness — list only what this lesson touches,62 not every option.63 - Leaving a step that can fail on a clean machine — a tutorial that64 doesn't reproduce isn't a lesson.6566## How-to6768- **Purpose** — a recipe to reach a goal the reader already has.69- **Audience** — a competent practitioner who knows what they want and70 needs the steps, not the background.71- **Shape** — an ordered series of actions. Imperative. Starts at a72 realistic precondition, ends at the goal.73- **Anti-patterns**74 - Narrating wrapper/tool internals — the reader runs the command,75 they don't need its call graph.76 - Restating idempotence or guarantees already in source comments —77 if the code says it, the how-to doesn't.78 - Predicting self-describing prompts or output — don't transcribe79 what the tool already tells the operator on screen.80 - Explanatory prose wrapped around code blocks ("documentation81 poetry") — if a paragraph doesn't change what the reader *types*,82 cut it. (Primary motivating failure.)8384## Reference8586- **Purpose** — describe the machinery so the reader can look up a87 fact and trust it.88- **Audience** — a practitioner mid-task who needs an authoritative89 answer fast.90- **Shape** — dry, structured, consistent. Mirror the code's own91 structure (one section per command/flag/field). Complete within92 scope.93- **Anti-patterns**94 - Narrative connective tissue — no "now that we've seen X, let's…";95 entries stand alone.96 - Opinionated commentary or recommendations — state what is, not97 what you'd choose; advice belongs in how-to or explanation.98 - Selective coverage — partial reference is a trap; if it's in99 scope, document it or say it's out of scope.100101## Explanation102103- **Purpose** — illuminate the *why*: context, background, the shape104 of the decision space.105- **Audience** — someone studying the topic away from the keyboard,106 building a mental model.107- **Shape** — discursive prose. Free to discuss alternatives, history,108 trade-offs, opinions (owned as opinions).109- **Anti-patterns**110 - Drifting into runnable commands or step lists — link the how-to,111 don't inline it.112 - Ending with a recipe — if it tells the reader what to *do* next,113 that's a how-to wearing an explanation's clothes.114 - Pretending to be neutral reference — explanation takes positions;115 own them rather than disguising them as fact.116117## Procedure1181191. Confirm the artifact isn't a README/CONTRIBUTING/ADR/CHANGELOG — if120 it is, hand off to that skill.1212. Run the smell test; name the single mode. If the doc wants two,122 surface the split before writing.1233. Draft against that mode's shape; check the draft against its124 anti-patterns before claiming done.1254. On an *edit*, first classify the existing doc's mode, then flag any126 prose that belongs to a different mode (the drift this skill exists127 to catch).