/coding-by-contract:coding-by-contractfrom coding-by-contract
Hold a codebase to its contract: the few load-bearing rules (3 to 8) every change is adjudicated against and that are changed only on purpose. Use when the user types /coding-by-contract; wants a CONTRACT.md for a project or subsystem; wants a diff, PR, or proposed change checked against the rules (root cause vs symptom); wants the core question about a subsystem answered from the real code; wants a rule added or changed; or wants an in-repo guard skill for a subsystem (a "/<subsystem>-dev" that loads the contract as the single source of truth and walks the change recipe). Five actions: init, check, ask, amend, scaffold. Reading-side sibling: grounding-rules. NOT Meyer's design-by-contract, NOT an API spec, NOT a test framework.
Trending skills
7-day visitors to each skill page
Ships in coding-by-contract. 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.
A few statements carry everything (纲举目张). In a codebase those statements are a contract: 3 to 8 rules, each with a claim, a why, where it lives in code, and what pins it (a test, a fixture, a check). A contract here is a handful of statements, not a document.
Four habits. Every action below serves them.
CONTRACT.md at the repo root, or contracts/<subsystem>/CONTRACT.md per subsystem. Shape:
templates/CONTRACT.md. A rule reads:
Rn. name · Claim (one line) · Why (one line) · Lives in
file:symbol· Pinned bytest | fixture | check(orunpinned, plus the smallest pin that would hold it)
Never paraphrase the contract into answers, code comments, or generated skills. Link to it. A rule
that feels missing or wrong is an amend, not a local reinterpretation.
init [path | subsystem]Write the contract for a project or subsystem. Propose the file, write it on approval.
unpinned and
propose the smallest one. A rule without a pin is a wish.check [diff | PR | description]Hold a change to the contract.
git diff, gh pr diff <n>, or the description.amend.ask <topic>Ask the question that goes straight to the core, then answer it.
file:symbol. Cite the rule it confirms ("this is R3") or
contradicts.amend. A new load-bearing fact is a candidate rule.amend <rule change>Change the contract on purpose.
scaffold <name> [--contract <path>] [--scope <paths>] [--path <dir>]Generate an in-repo guard skill for a subsystem: .claude/skills/<name>/SKILL.md (override with
--path), from templates/SKILL.md. The generated skill is the contract's front door for that
subsystem: it links to the contract, walks the change recipe, and proposes updates. It never
copies the rules.
--contract, else the nearest CONTRACT.md above the scope. None:
run init first./<name> before
touching anything in scope.Not Meyer's design-by-contract (pre/postconditions on functions). Not an API spec. Not a test framework: it names the pins, it does not replace them. Reading-side sibling: grounding-rules distills a system into its few so a reader understands it; this skill develops against them.
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub initialneil/coding-by-contract --plugin coding-by-contract