jig-harness/jig
Skill · runsM4

docs

/jig:docs

Typed in Claude Code. In Codex, ask for the jig:docs skill by name.

Checks a docs tree in one pass against the docs-governance module’s gates (frontmatter schema, generated index, last_updated dates, review scars, deferrals), flags drafts left stale, and lists the documents the project’s type calls for and the tree lacks; holds those gates for a repository’s hooks and CI

Works with · Inspect and analyse Sends the scars it reports to descar; finds the decision records adr keeps

A documentation tree grows into hundreds of pages, and without checks nobody can tell a current page from a stale one: frontmatter values drift, the index falls behind the tree, dates stop moving with the text, approved pages keep the traces of the review that produced them, and a “follow-up will be filed” names nothing anyone can look up. Jig’s docs-governance module (M4) states the rules; this skill is their runnable form. It holds M4’s gates, each a command a hook or a CI job runs, and a pass that runs them all over a repository’s docs tree, adds the warnings no gate gives (drafts nobody finished) and lists the documents the project should have and lacks.

The pass

sh
bun "<skill-dir>/scripts/docs.ts"            # text, findings grouped by file
bun "<skill-dir>/scripts/docs.ts" --json     # the same report, schema docs-report/v1

Run it from the repository’s root. It runs, in order:

CheckWhat it reportsApplies when
frontmattereach document whose frontmatter breaks the schema, with a “did you mean” hint; a document the branch adds is also held to the schema’s required_new fieldsthe tree has a frontmatter schema
indexa committed INDEX.md or .orphans.md that no longer matches the tree, and the orphan count as a warningthe tree has a generated INDEX.md
last_updateda document under the tree whose body the branch changed without advancing its datea base branch resolves
scarsreview scars in promoted documents (approved, or the statuses docs.promoted_statuses lists)always
deferralsa deferral that names no tracker item, over every documentthe repository has .config/deferral-references.yaml
stale draftsa status: draft document not updated for longer than the threshold, as a warningalways

Then it reads the project type from the tracked files (a deploy file makes a service; a published package a library; any other build manifest an application) and lists, under “Missing documentation”, what M4’s three layers and its wiki schema expect and the tree lacks: the docs tree itself, an instruction file, the wiki schema, the frontmatter schema, a generated index, the activity log, decision records and a raw layer for every project; architecture pages and runbooks for a service; a guide and a reference for a library; architecture pages and a guide for an application. A document whose frontmatter type: matches (a type: runbook page) counts as much as the conventional folder.

Exit 0 means no error, 1 an error found, 2 a check that could not run (or an unusable configuration), whatever the other checks found. Warnings and missing documents never fail it.

Configuration

Everything is detected; set a field in .config/jig.yaml only when detection picks the wrong thing (configuration reference):

yaml
docs:
  root: handbook                         # default: the first of docs/, doc/, documentation/
  schema: handbook/meta/schema.yaml      # default: the shallowest frontmatter-schema.yaml under the root
  stale_after_days: 90                   # default: 180, M4's six months
  promoted_statuses: [approved, active]  # statuses the scar lint scans; default: [approved]

The last_updated check compares with --base <ref>, else repository.base_branch, else the remote’s default branch; a configured repository.base_branch that does not resolve stops the pass rather than falling back to another branch. --type overrides the detected project type.

The gates

Each gate keeps the command line its README documents, so a repository that runs one in a hook or CI calls it at its path in a pinned Jig checkout. M4’s mappings give the wiring per CI provider and hook manager.

GateREADME
Frontmatter check, with its YAML subset and path-scoped rulesscripts/frontmatter-check/
Index generator, orphan report and freshness checkscripts/index/
Stale last_updated gatescripts/stale-last-updated/
Sticky date stamping for generatorsscripts/stamp/
De-scarring lintscripts/scar-lint/
Deferral references, static and livescripts/deferral-references/

They share one frontmatter reader, scripts/lib/docs.ts, which reads a stated subset of YAML and rejects everything outside it. The frontmatter check reads the schema with the plugin’s vendored js-yaml (shared/vendor/js-yaml.mjs), so a copy of the gates keeps the plugin’s layout: the skill’s folder two levels below the folder holding shared/.

Works with

  • descar removes the scars this pass reports.
  • promote-memory writes the pages the raw layer promotes.
  • adr keeps the decision records the plan expects.

Source: plugin/skills/docs/README.mdThe agent's contract (SKILL.md)