/rulebook:rulebook-extractfrom rulebook
Extracts business rules from code into rule cards for business readers. Use when rulebook/index.md exists and you need to document domain rules.
Ships in rulebook. 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.
Turn what the code actually enforces into rule cards a business reader understands, each one proven by the lines that decide it. The code is the only evidence: comments, names and docs can point you somewhere, never prove anything.
CLI. rulebook … below means the rulebook CLI: rulebook, or npx --yes rulebook-cli@latest. Without Node, use the manual column of references/cli.md.
rulebook/index.md yet → use rulebook-map first.rulebook/inbox.md has pending entries → use rulebook-sync first.If rulebook/.index.json exists, run rulebook check first: a later rulebook index would
silently accept code that moved since the last sync. Read references/card-template.md — the CLI parses that exact layout; anything else is
invisible (0 cards). Also skim references/vocabulary.md, policy-vs-rule.md, writing-style.md.
One file per domain: rulebook/<CODE>-<slug>.md, starting with # <CODE> · <Title>.
Data. Settle the data question once, as references/data.md says: use the sources recorded
in config.json, respect a refusal, otherwise ask one question and record the answer. Read
only, always, and never copy personal data. Read OKF knowledge already in the project as
context, never as evidence (references/okf.md).
rulebook scan --domain <CODE> --format md: the decision points of the
domain's code, found by line patterns. It is your checklist, not the truth — it misses
decisions spread over several lines and lists lines that are not rules. If the domain is
large (more than about 80 points to review or 3,000 lines), split the reading between
parallel readers when you can start sub-agents: one sub-area each, its list of points,
and the instruction to return each decision with its exact lines, the tests that assert
it, dead code and open gaps. Wait for every reader to finish before writing: start
them in the foreground when your tools allow it, and never end your turn or hand back
while a reader is still running. You write the cards.### <CODE>-R<nnn> · <Title>), one per decision — never
several decisions merged into one card to save work:
statement in plain words with the real values, category, confidence, exact evidence lines,
Verified at: <short HEAD sha> (<today>) and a History line created.
Context..read.Context. and add an open question.## <CODE>-P<nn> · <Title> policy with a mandatory Nature. Technical choices (rounding,
retries…) and rules with no clear why go under ## Other operating rules.rulebook/not-rules.md with a
reason (references/cli.md) — including the points "reached from the domain's code"
(views, helpers, providers the domain uses outside its paths): a rule only this domain
uses gets a card here; one that belongs to another domain is dismissed with
"relève du domaine XXX". not-rules.md is a list of decisions you read, one by one:
never generate it with a script or give reasons by file; "applique " only when that
card's rule states what the line decides. Then go through what line patterns miss: enums and state
tables, DB constraints, scheduled jobs, rules decided in views or templates.
With a data source: for each rule the data can show, follow references/data.md —
values that decide (cite them in Parameters.), rows that break the rule (count, up to
three ids), data that contradicts the code or itself (conflicting, or an open question),
states the code does not handle. Data never rewrites what the code does.rulebook/ (the audit needs them; no drafts folder),
with Verified at and History as above, and a **Scope.** paragraph under the domain
title: what you read, and what you did not. Run rulebook index: a method it reports as
referenced only by tests, or never, is probably dead — check, and remove its card if so.
Run rulebook scan --domain <CODE> again until no point is left to review.references/audit.md, unchanged. For more than about 30 rule cards,
run two independent auditors on every card and fix the union of their failures: on a
67-card domain each auditor found 13 failures, they agreed on 8, and each missed 5 of the
other's. Split very large domains in halves to keep each audit short. Otherwise, do it yourself as a separate pass with that checklist, reading only
the cards and the cited lines — not your notes. Wait for the audit result before going on: if
sub-agents run in the background, wait for it to finish; never stop or hand back with
Audit: pending. Set Audit: passed or failed: <reason>; fix or downgrade (inferred)
every failure, then have the fixed cards audited again before marking them passed.rulebook index --strict and fix every warning
and unresolved anchor until it exits 0 (fallback without the CLI: re-open every cited line).
Then run rulebook build: the document is produced first, corrections come after.rulebook/rulebook.html first, and say
that rulebook export okf can share the rulebook with other tools (references/okf.md). Then show
the policies, the rule titles, every conflicting card, every audit fix and the main open
questions, and ask what to correct: rename, merge or drop a policy, reword or remove a rule.rulebook index --strict and
rulebook build again.Tests as runtime evidence. You may run the tests a card cites to confirm verified, only
when they cannot touch a real database: they use an in-memory or dedicated test database, and
nothing in the project's instructions forbids it. Otherwise read them; never run anything
that resets or seeds a developer's database.
Write only under rulebook/. Never change source code or tests. Next free IDs only (ids.md).
rulebook build, so the document matches the cards. Never edit the HTML yourself (references/cli.md).| Mistake | Instead |
|---|---|
One file per rule, or headings like ## Rule | The card template, one file per domain |
| Trusting a comment or a function name | Read the executing code; cite it |
| A card for dead code | Report it, no card |
| A policy for rounding or a technical limit | ## Other operating rules, no policy |
| Evidence pointing at the caller | Cite the lines that decide |
No Audit: line | Every rule card gets one from step 6 |
| Asking for validation before building | Build the HTML first (step 7), then offer corrections |
| Points left "to review" in the scan | A card or a not-rules.md line for each |
| A card for a method only tests call | Dead code: no card, say it in the report |
| "Only" or "always" checked against one branch | Walk every branch, write the exceptions |
A scripted not-rules.md to reach 0 to review | Read each point; a hidden rule is a missed rule |
verified because a test runs the code | A test whose assertion checks this rule, quoted |
references/audit.md (opens in a new tab)references/card-template.md (opens in a new tab)references/cli.md (opens in a new tab)references/data.md (opens in a new tab)references/hotspots.md (opens in a new tab)references/ids.md (opens in a new tab)references/okf.md (opens in a new tab)references/policy-vs-rule.md (opens in a new tab)references/vocabulary.md (opens in a new tab)references/writing-style.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub gregorybabonaux/rulebook --plugin rulebook5 skills in this plugin
/rulebook-edge-casesUse when asked for the edge cases, boundary conditions, corner cases or "cas limites" of a documented business rule or domain in rulebook/, or when a rule card has no Edge cases section and someone asks what happens at its limits./rulebook-mapUse when a codebase's business rules are to be documented and no rulebook/index.md exists yet, or when asked to map, list or split the business domains of an application ("what are the domains", "cartographie des domaines", first step of a rulebook)./rulebook-publishUse when asked to publish, share, export, regenerate or send the rulebook / business-rules reference ("publier le référentiel") — as an HTML page, a PDF, or to Notion, Google Drive, Confluence or another documentation tool./rulebook-syncUse when rulebook/inbox.md has pending detections ("traiter l'inbox", "mettre à jour les règles"), when a hook or `rulebook check` reports that a rule "may have changed", "may have been removed" or "possible new rule", or when asked to sync, realign or update the rulebook after code changes.Other plugins' skills for the same job