docs
The procedure an agent follows when it runs docs. For people, the docs guide explains it.
A docs tree governed by Jig’s docs-governance module
(M4)
holds every document to a frontmatter schema, keeps a generated index,
moves last_updated with the body, keeps approved pages free of review
scars, and makes a
deferral name the tracker item that carries it. This skill runs each of those
gates over the tree, flags drafts nobody finished, and lists the documents the
project should have and does not. The gates themselves live in scripts/,
one folder each, so a repository’s hooks and CI run the same code. The human’s
page is README.md.
Paths and working directory
${CLAUDE_SKILL_DIR} in the commands below stands for the absolute path of the
directory containing this SKILL.md. Claude Code fills it in. In any other
harness, replace it with that path yourself before running a command: a shell
would expand the unset variable to an empty string.
Run every command from the root of the repository whose docs you are
checking. Never cd into the skill directory.
Not this skill
- Removing scars from a page: the pass reports them;
/jig:descarremoves them, with the judgment a lint cannot make. - Writing a decision record:
/jig:adr. - Promoting an agent’s memory into the docs tree:
/jig:promote-memory.
1. Run the pass
bun "${CLAUDE_SKILL_DIR}/scripts/docs.ts" --jsonIt detects everything it needs and reads the docs section of the
repository’s Jig configuration only where detection is wrong:
- The docs tree:
docs.root, else the first ofdocs/,doc/,documentation/that exists. A tree, or a schema, that leads outside the repository once symbolic links are followed is refused: the index is written under it. A link to a folder or a schema inside the repository is read as its target, the path git reports its files under. - The schema:
docs.schema, else the shallowestfrontmatter-schema.yaml(dotted or not,.yamlor.yml) under the docs tree. The repository’s own schema is the one that applies: never check its documents against M4’s template or rules of your own. - Promoted documents: the scar lint scans documents whose
statusisapproved, or the statusesdocs.promoted_statuseslists instead (a corpus whose lifecycle ends inactivelists[approved, active]). A document with another status is not scanned, and a named one is reported as such. - The index layout:
docs.index(preamble,descriptions,descriptions_from_readme,order,frontmatter) adds a “start here” section, a line per category, a category order and frontmatter to the generatedINDEX.md; unset, the index is the bare listing. The generator and its--checkread it themselves, so regenerate rather than edit. An index withdocs.index.frontmatteris held to the schema like any page. - Stale drafts: a
status: draftdocument whoselast_updatedis more thandocs.stale_after_daysdays old (180). - The base for the
last_updatedcheck and for the documents the branch adds (held to the schema’srequired_newfields):--base <ref>, elserepository.base_branch, which must resolve, else the remote’s default branch. - The project type:
service(a deploy file such as aDockerfile, a Compose file or a Helm chart),library(a published package), orapplication(any other build manifest), from the tracked files.--typeoverrides it; use it only after telling the user the detected type and its evidence, which the report gives.
The report (schema: docs-report/v1) lists each check’s status: ok,
findings, warnings, skipped (with why) or failed (it could not
check). Then every finding with its file, check, severity and message, and
under expected each document the project type calls for, with found null
when it is missing. Without --json the same report is printed as text,
findings grouped by file.
Exit 0: no error. Exit 1: a check found an error. Exit 2: a check could not run, or the configuration or command line is unusable, whatever the other checks found; report the message and stop. Stale drafts, orphaned documents and missing documents are warnings and never fail the pass.
2. Act on it
Work in this order, and tell the user what you changed and what you left:
- A
failedcheck: report it; a pass with an unchecked gate is not a clean pass. - Frontmatter errors: fix each value against the schema. Take a “did you mean” hint when it fits; never add a value to the schema to make an error go away unless the user asks.
- Index drift: regenerate, never edit by hand:
bun "${CLAUDE_SKILL_DIR}/scripts/index/regenerate.ts". It reads the report’srootfrom the configuration itself, so never type the root into the command. StageINDEX.mdand.orphans.mdtogether. last_updatednot advanced: set it to today’s date in Coordinated Universal Time on each document whose body changed.- Scars: hand the pages to
/jig:descar; do not rewrite them here. - Deferrals that name no item: name the tracker item that carries the work, or say what is true today. Never invent an item key.
- Stale drafts: list them for the user with their owners; finishing, promoting or archiving one is the owner’s call.
- Missing documents: propose a plan, one line per document, with where it goes and the M4 template it starts from (templates). Create documents only after the user agrees; with nobody there to answer, stop and state the plan.
Run the pass again after the fixes and report the checks that are still not
ok.
The gates on their own
Each gate keeps its own command line, for a hook or a CI job; their READMEs, beside each script, give the variables, modes and exit codes, and M4’s mappings give the CI and hook wiring:
| Gate | Script |
|---|---|
| Frontmatter valid | scripts/frontmatter-check/frontmatter-check.ts |
| Index and orphan report fresh | scripts/index/generate-index.ts, with --check |
last_updated advanced | scripts/stale-last-updated/stale-last-updated.ts |
| Generator date stamping | scripts/stamp/frontmatter-stamp.ts (a library) |
| No scars in promoted docs | scripts/scar-lint/check-descarring-scars.ts |
| A deferral names a live item | scripts/deferral-references/check-deferrals.ts |