agentleFS
hassan-mohiddinhassan-mohiddin/freeflow/skills/write-docs/SKILL.md

write-docs

Skill3 starsChanged 5 months agoMITView on GitHub

Use when writing, updating, or reviewing documentation of how existing software works and why: architecture or subsystem docs, folder READMEs, and user guides, or when a change makes existing documentation wrong.

22 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use audit-choices, close-spec 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.
  • dzhngSkill

    audit-choices

    Audit the choices an implementing agent made, not its diff — a pure decision audit that traces the session's history into a choices ledger, changes no code, and never blocks an unsupervised run. Working code still embeds architecture the user never chose; surface it because future work inherits it. Use when the user wants to review the decisions the AI made on their behalf, before merging or committing AI-implemented work, when integrating a delegated subagent's pass, or when a fix "works" but might be a point fix.

    Also in 3 projects that use this

  • dzhngSkill

    close-spec

    When a spec under specs/<feature>/ is done shipping (a write-spec build, or any planned task that produced a spec), archive it to specs/done/ and rewrite it from a build-plan into a durable rationale — the why, the principles, the invariants — pointing back to the real code for the how. Use when implementation has landed and the plan no longer matches what shipped, or the user says a feature/spec is finished. Pairs with [write-spec](../write-spec/SKILL.md) (the plan this closes) and [review](../review/SKILL.md) (run before closing).

    Also in 3 projects that use this

  • LucasMatuszewskiSkill

    audit-agents

    Audit and maintain agent configuration files (.claude/agents, AGENTS.md, CLAUDE.md, agent-memory). Checks for duplicates, outdated info, naming conflicts, wrong technical facts, and files over 200 lines. Fixes all issues and commits.

    Also in 3 projects that use this

  • Halcyon666Skill

    write-skills

    Creates high-quality Agent Skills (SKILL.md files) that follow the open Agent Skills specification. Use when asked to create a skill, write a SKILL.md, package agent instructions, build a reusable capability, or turn a workflow into a shareable skill. Produces spec-compliant, concise, well-structured skills optimized for agent discovery and execution.

    Also in 3 projects that use this

  • isLinXuSkill

    eval-skills

    AI Agent Skill unit testing framework. A framework-agnostic toolkit for discovering, scaffolding, selecting, evaluating, and reporting on AI skills. Use this skill to assess skill quality before production, compare candidate skills on the same benchmark, enforce quality gates in CI/CD, and generate human-readable evaluation reports.

    Also in 3 projects that use this

  • TrecekSkill

    audit-tests

    Audit the test suite for useless tests, consolidation opportunities, over-mocking, weak assertions, and other test quality issues. Use when user says "audit tests", "audit test suite", "review tests", or "test quality check". Generates an improvement plan in temp/ with explanations for each proposed change.

    Also in 3 projects that use this

  • +6 more from dzhng

The file

Show its rules and text

We split this skill into the rules it gives an agent

13 rules. 0 are common, 13 are distinctive, and 0 are very specific to this project.

  • 0

    Common

    Most of the 21 edited versions we read keep these.

  • 13

    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:

    Write what is true now. Plans, task progress, and open work belong in the task's record, spec, or plan, not in documentation.

    line 16
  2. Distinctive:

    Check each claim against the code, its tests, or an observed run before writing it as fact.

    line 17
  3. Distinctive:

    When your change makes a document wrong, correct the document in the same change.

    line 18
  4. Distinctive:

    Follow the repository's documentation rules (AGENTS.md or its equivalent): where documentation lives, which parts need the user's approval …

    line 19
  5. Distinctive:

    Keep secrets, credentials, private task notes, and personal data out of documentation others can read.

    line 20
  6. Distinctive:

    Write documentation where the repository keeps it.

    line 36
  7. Distinctive:

    Name, do not link to lines: Write paths, functions, types, configuration keys, and messages exactly, in backticks, so readers and search …

    line 45
  8. Distinctive:

    When you finish a change, ask whether any document now says something false: a user guide, a subsystem doc, a folder README, an overview.

    line 57
  9. Distinctive:

    Before you treat behavior in a documented subsystem as a bug, read its decisions and its list of intended behavior that looks wrong.

    line 59
  10. Distinctive:

    Delete or correct documentation that is no longer true.

    line 60
  11. Distinctive:

    After checking a document against the code, update the commit it records as verified.

    line 61
  12. Distinctive:

    Run the bundled docs check after writing or changing documentation:

    line 67
  13. Distinctive:

    Stop and ask when where documentation lives, who may change it, or whether a disputed behavior is intended cannot be settled from the code, …

    line 83

“Common” is measured: kept by at least 6 in 10 of the 21 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

Write Docs

Documentation tells a reader how a system works now and why it works that way, so they can use or change it without rebuilding the design from the code. It differs from a spec or a plan: those decide work before it happens and can be left behind once it is done (Write Spec, Write Plan). Documentation describes what exists and stays true only if it changes with the code. If the document you are asked for decides work that is not done yet, use Write Spec or Write Plan instead.

Its readers include agents. An agent that reads code sees what it does but not why; without the why, it may treat a deliberate choice as a bug, rebuild a design that was rejected for a reason, or break a rule nobody wrote down. Documentation is where that knowledge outlives the task that produced it.

The Rules below are binding; if one cannot be met, stop and say why. Everything else is judgment: follow its stated goal, and adapt when a different choice serves that goal better.

Rules

  • Write what is true now. Plans, task progress, and open work belong in the task's record, spec, or plan, not in documentation; history appears only as a short list of major changes.
  • Check each claim against the code, its tests, or an observed run before writing it as fact. State what you could not check as unverified, or leave it out.
  • When your change makes a document wrong, correct the document in the same change. Writing new documentation, or rewriting more than your change made wrong, needs a request or the repository's documentation rules.
  • Follow the repository's documentation rules (AGENTS.md or its equivalent): where documentation lives, which parts need the user's approval to change, and what is public.
  • Keep secrets, credentials, private task notes, and personal data out of documentation others can read.

Choose The Document

Goal: each fact lives in one place, written for the reader who needs it.

ReaderDocumentHolds
Someone using the softwareUser guideWhat it does and how to use it: tasks, settings, commands, from the user's side.
Someone finding their way around the codeOverview (an ARCHITECTURE.md, or the index of the developer docs)The problem the software solves, its parts and how they relate, a map of where things are, and the rules that hold across parts. Short and slow to change.
Someone changing one subsystemSubsystem docHow the subsystem works and why: its surface, state, invariants, decisions, failure behavior, code map, and tests.
Someone editing files in one folderFolder README.mdWhat each file owns, local rules, and a pointer to its subsystem doc.
Anyone revisiting a hard-to-reverse choiceDecision recordThe context, the decision, and its consequences.

Prefer extending an existing document to creating a new one: a small set of current documents serves readers better than many partly current ones. A subsystem earns its own doc when the reasons behind it cannot be read from the code and readers keep needing them: agents re-derive the same design, or mistake a deliberate behavior for a bug. A user guide and a subsystem doc about the same feature are different documents for different readers; link them rather than merging them.

Write documentation where the repository keeps it. If it keeps none and you are asked to start, propose where it should live and confirm with the user before creating it.

Write The Document

Read Documentation Shapes before choosing the structure of an overview, a subsystem doc, or a folder README, or before restructuring one. Its shapes are judgment to adapt to the software and to the repository's own conventions; only its header, which the docs check reads, is binding where used.

Goal: a reader with only the document and the code can make a correct change, and can tell what is deliberate.

  • Start from the code and its tests, then read what explains them: specs, task records, decision records, commit messages, review threads. A reason that exists only in a task record or a conversation is the one most worth writing down, because it disappears with that record.
  • Name, do not link to lines. Write paths, functions, types, configuration keys, and messages exactly, in backticks, so readers and search tools find them. Line numbers go stale with the next edit.
  • Write invariants, including absences. "Nothing outside config.ts reads the config file" or "the request path never reads session files" cannot be seen by reading any one file, so state it.
  • Say what looks wrong but is intended. For behavior a careful reader would take for a bug, state the behavior, the reason, and what would break if it changed.
  • Keep explanation apart from reference. Explanation (purpose, how it works, why) is read once to understand; reference (surface, state, invariants, code map, tests) is consulted while working. Put them in separate sections so a reader looking up a fact does not wade through reasoning.
  • Prefer present-tense facts to narrative. "Compaction runs at the end of a turn" rather than "We changed compaction so that it now runs at the end of a turn". History gets one short section of major changes, with commits.

Depth follows the reader's risk. A subsystem with many hidden reasons needs most of the shape; a small one may need only purpose, surface, and code map. Leave out a section with nothing true to say rather than filling it.

Keep Documentation Current

Goal: documentation stays true as the code changes, without anyone remembering to check.

  • When you finish a change, ask whether any document now says something false: a user guide, a subsystem doc, a folder README, an overview. Correct it in the same change.
  • When work settles a decision about a documented subsystem (a design choice, a rejected alternative, a limit accepted on purpose), record the decision and its reason in the subsystem doc once the work it decided is done. The task record is deleted or forgotten with the task; the doc stays.
  • Before you treat behavior in a documented subsystem as a bug, read its decisions and its list of intended behavior that looks wrong. If the behavior is listed there, changing it is a design change for the user to decide, not a fix.
  • Delete or correct documentation that is no longer true. A wrong document misleads more than a missing one.
  • After checking a document against the code, update the commit it records as verified.

Check The Documentation

Goal: evidence that the document is accurate and that a reader without your context understands it.

Run the bundled docs check after writing or changing documentation:

node <write-docs-directory>/scripts/docs-check.mjs <docs-file-or-directory>... [--root <repository>] [--strict] [--json]

It reports paths a document names that do not exist and, for documents with the header, those whose covered code changed since the commit they record as verified. A change made together with the document, in the same commit or both uncommitted, counts as reviewed with it. Missing paths are errors (exit code 1). Changed code is a warning, since many changes leave a document true; --strict makes it an error. Read the changes it lists and update the document or its verified commit.

For a new subsystem doc or overview, or one you substantially rewrote, test it on a reader without your context. Write five to ten questions a newcomer would ask: where is the code that does X, why does it do Y, is Z a bug, what breaks if W changes, which test proves V. Give a fresh agent only the document and the questions (a subagent where the host has one; otherwise ask the user to run it in a new session). Compare each answer with the code. Where an answer is wrong or unsure, fix the document and ask again. The check passes when the answers are right without new gaps.

A passing check shows the named paths exist and the reader understood the document; it does not prove every claim is current. Report what was checked.

Stop

Stop when the document says only what is true now, each claim is checked or marked unverified, the docs check passes, and, for a new or rewritten subsystem doc or overview, the reader test answers correctly. Then return to the activity that asked for the documentation.

Stop and ask when where documentation lives, who may change it, or whether a disputed behavior is intended cannot be settled from the code, its tests, and its sources.

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.