/diataxis-docs:diataxis-docsfrom diataxis-docs
Generates a complete Diátaxis documentation set (tutorials, how-to guides, reference, explanation) from a codebase via a phased, gated workflow.
Ships in diataxis-docs. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Generate a Diátaxis-shaped documentation set from a codebase: tutorials, how-to guides, reference and explanation. Runs as a gated, phased workflow — survey, then plan and get approval, then write one quadrant at a time, then assemble.
Never self-trigger. Only act on explicit invocation (/diataxis-docs, or the
user naming the skill).
Do not write or move any file in this phase.
git rev-parse --is-inside-work-tree) with a clean working tree (git status --porcelain empty). If the repo is not under git, STOP and offer to run
git init and make an initial commit — git init alone leaves every
file untracked and still fails this gate. If the tree is dirty, STOP and
offer to commit or stash the outstanding changes. Do not proceed until
the tree is clean — later phases move and split human-written files, and
every such change must be revertable.diataxis-plan.md exists at the repo root, read it.
It is the durable record of previous runs: audiences, real-world goals,
decisions worth explaining, approved reference scope, not-created
quadrant reasoning, and tutorial verification status. Treat its contents
as established context — Phase 1 updates this file rather than starting
blank, and re-asks only what the current run's evidence contradicts.docs/ for
mkdocs.yml, conf.py, docusaurus.config.*, or a docs/ directory
with no generator config beside it. Whatever is found fixes the output
format and location for everything written in Phases 2–6; if a generator
config and a bare docs/ are both present, the generator config wins.
Absent any of these, fall back to Markdown under docs/.typedoc.json,
godoc conventions, cargo doc / rustdoc setup, or similar. Where one is
found, it sets the reference-phase mode — see the Autodoc rule in
references/reference.md before writing reference material.references/diagrams.md, loaded
only in the explanation phase.examples/, integration and end-to-end tests (the best available source
of real user goals), commit history, PR/issue titles via gh when the
repo has a GitHub remote and gh is authenticated (skip this source
otherwise), and docstrings/inline comments.references/compass.md and run every
existing piece of documentation through it — section by section as well
as whole-document, since a document can pass at the wide view and still
fail at the close view. Record the quadrant of each document and of each
of its sections (or "misclassified" / "blurred") for use in Phase 1.Write diataxis-plan.md at the repo root, outside any published docs tree,
so site generators never render it. If a prior plan exists (Phase 0), update
it in place — keep its durable answers, add this run's proposals — instead of
starting blank. For every proposed document, record:
Annotate every existing doc from the Phase 0 compass pass as keep, move, or split, at the section granularity that pass recorded. For every move and for every part of every split, name the destination quadrant and the destination document — an annotation with no destination cannot be approved and leaves the content with nowhere to go in Phases 2–6. List the proposed reference scope (e.g. public API only, or top-level modules) as its own approvable item — "document the product surface" is unbounded on a large codebase, and the user approves scope, not just the document list. A quadrant with no genuine material backing it is listed as not created — no directory, no landing page, no placeholder. An empty section is itself the forbidden scaffold. Every not created entry must state (a) the reason — what material is missing (e.g. "no user-goal evidence found: no examples/, no e2e tests, no issues"), and (b) a remedy — what would make the quadrant creatable in a future run (e.g. "add an examples/ script per supported workflow", "answer the audience questions", "record ADRs for the decisions worth explaining"). A bare "not created" with no reason and remedy cannot be approved.
When the architecture-evidence harvest found material for them, the plan
proposes an About the architecture explanation page carrying C4
diagrams, naming each proposed level — System Context, Container — in
the entry. A level without evidence behind it (e.g. a single deployable
unit makes a Container diagram redundant) is recorded as a not-created
entry with reason and remedy, exactly like a quadrant. If the docs
tooling detected in Phase 0 cannot render Mermaid, note that in the plan
and propose the fallback — a plain fenced code block with a rendering
note — as an approvable item rather than silently degrading. Plan
approval covers the page and its levels; the diagram rules live in
references/diagrams.md. If no level has evidence behind it, the page
itself is a not-created entry, reason and remedy included, like any
quadrant.
Then ask the user one batched round of questions, covering only what the
repo could not answer: who the audiences are, their top real-world goals, and
which decisions carry rationale worth explaining. Answers already recorded in
a prior plan are not re-asked unless this run's evidence contradicts them.
Fold the answers back into
diataxis-plan.md before asking for approval — those answers decide which
documents exist, so the plan put up for approval must be the revised one, not
the draft written before the questions were asked.
STOP. Do not write, move, or split any documentation file until the user has explicitly approved the plan and the reference scope. Presenting the plan is not approval. Asking the batched questions is not approval. Silence is not approval. A vague or partial reply ("looks fine", "sure") that does not address the plan and scope is not approval — ask again. There is no condition under which Phase 2 may begin without an explicit yes from the user on this specific plan.
Order: reference → how-to → explanation → tutorial. Reference goes first because it is the most reliably derivable and becomes the link target that keeps the other three uncluttered. Tutorial goes last because it is the most expensive to produce and depends on knowing what reference and how-to material already exists to link out to.
For a single-quadrant run, write only the requested quadrant. Link out to other quadrants only where they already exist; if a linked-to quadrant does not exist, omit the link rather than creating a placeholder for it.
Write each quadrant's pages into their own directory under the output
location fixed in Phase 0 (e.g. docs/reference/). Phase 6 adds the landing
pages and cross-links on top of that placement; it does not relocate pages.
For each quadrant, before writing:
references/reference.mdreferences/how-to-guides.mdreferences/explanation.md — plus
references/diagrams.md when the approved plan includes the
architecture pagereferences/tutorials.mdApply this quadrant's move and split annotations from the plan as rewrites: content moved here is held to this quadrant's rule sheet exactly like newly written content. A move is a rewrite into the destination register, not a relocation with fact fixes — reference tables, instruction, or teaching that arrive inside moved content are rewritten or linked out, the same as anywhere else.
Before closing each phase:
diataxis-plan.md,
tagged for its future phase. Do not write it into the current quadrant
and do not discard it.Load references/structure.md. Write landing pages as overviews with
introductory prose, apply the list rule, and wire up cross-links between
quadrants per the sheet.
Wire the README. The repo's README is the de-facto documentation entry point; generated docs that the README never mentions are invisible. If the repo has a README, add — or update, on a rerun — a short documentation section linking the docs landing page, with one sentence per quadrant landing page that exists. Keep it an overview, not a copy of the landing page; the README remains the repo's front door, not a docs mirror. Respect any keep/split annotations already applied to the README in this run.
Verify standing decisions. Re-read every standing decision and constraint recorded in the plan file — link policies, scope limits, directories declared off-limits — and check the generated pages against each one. A decision recorded in the plan binds the output; fix violations before committing.
Then close the run by trimming and committing diataxis-plan.md:
docs/reference/plan-file.md).These are hard rules. They apply across every phase and every quadrant:
Misplaced content is always moved, never deleted.
This file (SKILL.md) is original work, copyright © Peter Knego, licensed
under the MIT License. The rule sheets under references/ are adaptations
of diataxis.fr content, copyright © Daniele Procida,
licensed under CC BY-SA 4.0 — each carries its own attribution header —
except references/diagrams.md, which is original MIT-licensed text
describing the C4 model by Simon Brown (c4model.com
content is CC BY 4.0).
README.md (opens in a new tab)references/compass.md (opens in a new tab)references/diagrams.md (opens in a new tab)references/explanation.md (opens in a new tab)references/how-to-guides.md (opens in a new tab)references/reference.md (opens in a new tab)references/structure.md (opens in a new tab)references/tutorials.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub peterknego/diataxis-docs-skill --plugin diataxis-docsOther plugins' skills for the same job