agentleFS
LNSDLNSD/lorecraft/skills/docs-rules-check/SKILL.md

docs-rules-check

Skill0 starsChanged 57 days agoApache-2.0View on GitHub

Review documents under docs/ and the Lorecraft specifications in docs/__meta__/ that govern them - run lorecraft check for frontmatter, section outline, word caps and token budget, walk each specification's checklist for what a machine cannot decide, and check that each changed specification loads, that its prose and JSON agree, and that it governs the documents intended. Use after editing anything under docs/, when reviewing a pull request that touches docs/, before committing, when lorecraft check exits 2 or a document is unexpectedly ungoverned, or when setting the checks up in CI. Not for writing documents or specifications; see /docs-rules and /docs-rules-creator

The file

We split this skill into the rules it gives an agent

3 rules. About 0 are common, 1 is distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Every command below calls lorecraft directly.

    line 23
  2. Distinctive:

    Check only what the changeset touches — an unchanged document breaking a rule is not this changeset's finding.

    line 89
  3. Very specific:

    Consequence: Run lorecraft check. A rule change that breaks existing documents must fix them in the same change, or say why they are left: …

    line 144

≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “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

Docs Rules Check

The review pass over docs/. For a changed document it verifies that the document follows the specifications in docs/__meta__/ that govern it; for a changed specification, that it loads, agrees with itself, and governs what it claims to. This is a rules check, not a review of content: it does not question whether a rule is the right rule, or whether the code a document describes works.

This skill carries no per-corpus rules. It resolves the specifications from each document's path and validates against them. It reports; the fixes belong to the writing paths — /docs-rules for a document, /docs-rules-creator for a specification.

Running lorecraft

Every command below calls lorecraft directly. Where it is not on PATH, run uvx lorecraft … instead, or uv run lorecraft … in a uv project that declares Lorecraft as a dependency. Run from the repository root.

1. The changeset

git status --short -- docs                                     # uncommitted work, the default
git diff --name-only "$(git merge-base HEAD main)"...HEAD -- docs   # a whole branch

Given explicit paths, check those instead. Split what changed in two:

  • Documents — every changed Markdown file outside docs/__meta__/. §2 to §5 check them.
  • Specifications — every changed file in docs/__meta__/. A change to any file at a specification name is a change to that specification: its prose and every JSON file beside it. §6 checks them.

2. The specifications that govern each document

lorecraft inspect

Each document is followed by the names of the specifications governing it, broad to narrow; the name <name> is the prose at docs/__meta__/<name>.md. cli-inspect describes the output. Read every specification listed for a document before the document, so its checklist is in hand while reading. A document can be governed by one check and not another; check says what governs it for each. Report a document a check does not govern as unvalidated for that check, rather than borrowing another corpus's rules.

3. Run the checks

The checks decide every mechanical rule — required and allowed frontmatter fields, their vocabularies and patterns, name against the filename, the title, section order, empty and forbidden sections, word caps and the token budget. Do not check those by hand.

lorecraft check                              # every check over every document and skill, one read of the tree
lorecraft check frontmatter <files>          # frontmatter, the structure spec's frontmatter key
lorecraft check structure <files>            # sections and word caps, against <name>.structure.json
lorecraft check budget <files>               # the whole-file token budget, the structure spec's tokens key
lorecraft check --format json                # machine-readable

Findings print as path:line: [rule] message, and may be followed by = help: and = note: lines, or a notes list in JSON; for a missing section they say what it holds and show a sample, so read them before fixing it. Exit 0 means no findings, 1 findings, and 2 that the run could not happen: a rejected path, or a specification that cannot be loaded — §6 covers that one. A <corpus>.ungoverned line is not a failure; report the corpus as unvalidated for that check. Each check's rule identifiers are explained in its guide: check, frontmatter, structure, budget.

A bare run checks every agent skill too. A skill.* finding is about a skill, not a document, and falls outside this review; check skills explains each.

A word cap or budget finding on a section the change added to blocks, like any other finding. One on a section the change did not touch is pre-existing: report it as such. The fix for an overage is to move or cut, never to compress.

4. Walk the checklist

A specification's checklist is the check surface for what the commands cannot decide: whether a section says what the specification asks of it, cross-reference direction, whether a description genuinely helps a reader find the document. Walk each item against each changed document, and each namespace layer's checklist too. Where a specification has no checklist, walk its rules instead.

Check only what the changeset touches — an unchanged document breaking a rule is not this changeset's finding. The one exception is §5.

5. Hunt for inventories that will rot

A list of files inside a document is a second source of truth nothing keeps honest. Flag every one, whether or not the changeset introduced it: a table or list whose entries are documents, a "see also" naming each sibling, a count ("the four principle documents"). For each, report the derivation that should replace it: the corpus directory, a naming convention, or lorecraft inspect. A references section naming what a document depends on is not a finding. Where a list survives for a stated reason, compare it with ls docs/<corpus>/; a list already out of sync is a finding.

6. Changed specifications

Lorecraft loads and validates each JSON file on its own, but it cannot tell whether the JSON says what the prose says, or whether a specification name governs the documents its author meant. Check each changed specification for both.

Load. lorecraft inspect validates every specification before any document is read. A structure specification must use only the dialect's keys and state usable rules, and its frontmatter key must satisfy the JSON Schema Draft 2020-12 meta-schema, state "type": "object" at its root, and carry no $id at any depth. A leftover <name>.header.json is not read: its schema belongs in that key now. A file that fails stops the run with an error naming it: inspect and lorecraft check both exit 2. That error is the finding; spec-structure says what is refused for any file, and spec-structure-outline, spec-structure-budget and spec-structure-frontmatter what is refused for their keys.

Resolution. In the inspect tree, compare what is governed with what was meant. spec owns the rules.

  • Each changed specification appears under its corpus. A file whose name does not parse — a hyphen in a corpus name, a dot in a specification name, a <name>.<token>.json that no file type's pattern claims — is left out silently, and so is a namespace specification whose corpus has no file of its own or no directory under docs/.
  • Each document lists the specification names intended. A namespace matches a filename that equals it or continues it with a hyphen: code-python governs python-typing.md, not pythonic.md.
  • A namespace specification matches at least one document. One that matches none still loads and governs nothing, usually after a rename.
  • For each check the corpus means to run, the documents meant are governed, as check defines it. A namespace file never governs alone: its rules apply only once the corpus specification has a structure file, and its frontmatter only once that file states the key.

Agreement. Nothing detects drift between a specification's prose and its JSON, so read both:

  • Frontmatter: every frontmatter field the prose describes is in the frontmatter schema's properties, and none is only in the schema; required fields, vocabularies and patterns match the prose's wording.
  • Structure: the prose's section list, order, and optional sections match outline; any word cap, token budget, forbidden section or empty-section rule in one is in the other, with the same number.
  • Layering: a namespace file states only what it adds, and does not restate or contradict its base. A namespace written as though it could relax a corpus rule is a finding.
  • Direction: the base names none of its extensions, in prose, description, or references.
  • A checklist: the prose ends with checklist items for the rules no JSON file holds, since those are checked by reading or not at all.

Consequence. Run lorecraft check. A rule change that breaks existing documents must fix them in the same change, or say why they are left: a finding the changed specification introduced belongs to this changeset.

7. Report

Clean:

Docs rules check clean. Applied: docs/__meta__/code.md, docs/__meta__/code-python.md.

Findings, per document or specification, most severe first, one per line, with the fix:

docs/code/python-typing.md:3 — code.md, Frontmatter: description has no trigger clause. Name the situations the document should be read in.

docs/__meta__/code.structure.json — drift: its frontmatter schema allows status, which code.md's frontmatter section does not describe. Describe it in the prose, or remove it from the schema.

  • Every document finding cites the specification and section that states the rule. A finding with no specification behind it is a style opinion — drop it.
  • Quote the checklist item when the violation is not self-evident.
  • A drift finding cites both halves; a load error is quoted as lorecraft printed it.
  • A rule that seems wrong, or contradicts another specification, is a finding against the specification.

Setting the checks up in CI

lorecraft check with no arguments is the whole gate: it runs every check over every document and every skill, and exits non-zero on a finding or a specification that cannot load. Run it in CI and in a pre-commit hook as is; do not narrow it to changed files, since a change to one document or specification can break another.

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.