Available in
Marketplaces, most starred first
Tags
Add to README
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Marketplaces, most starred first
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Marketplaces, most starred first
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
By initialneil Verifiedv1.0.0MITIn 1 marketplace
Hold a codebase to its contract: the few load-bearing rules (纲举目张) every change is adjudicated against and that are changed only on purpose. init a CONTRACT.md, check a change against it, ask the core question, amend on purpose, scaffold an in-repo guard skill for a subsystem.
Trending plugins
7-day copy clicks
Claude loads one when your task matches it, or you run it by name.
1 marketplace, most starred first
coding-by-contract, contract, load-bearing-few, invariants, architecture, design, skill
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
English | 中文
A few statements carry everything. Anyone should understand a whole system's design philosophy from a handful of contracts. Anyone should grasp a paper's point, novelty and insight from a few sentences. An agent should ask the question that goes straight to the core. An experiment's result should be read straight to its insight. Write the few down, hold everything else to them, and change them only on purpose.
coding-by-contract is this philosophy practiced in coding.
A contract here is a handful of statements, not a document: the few rules a codebase must honor, not Meyer's pre/postconditions and not an API spec.
Most of any large thing is derivable. A long project's thousand choices reduce to a handful of rules. A thirty-page paper reduces to three sentences. A wall of numbers reduces to one insight. A long conversation reduces to the one question that mattered. The contract is that irreducible few: the statements from which the rest can be regenerated, and against which anything new is judged.
A contract is good when it is:
The same thinking, in different arenas:
| Thing | Its contract | It is held when |
|---|---|---|
| A system | the few design rules everything else reduces to | every change is judged against the rules, not the ticket |
| A paper | a few sentences: the point, the novelty, the insight | a reader with only those sentences judges its relevance correctly |
| An experiment | the one reading that goes straight to the insight | a different result would have changed that reading |
| A question | the one question that goes straight to the core | the answer changes what you do next |
| A decision | the one reason it was made | a future re-proposal is stopped by citing it |
In a codebase, the load-bearing few become four habits:
CONTRACT.md)
plus a conformance corpus (fixtures or tests). Change the behavior, change the fixture, let every other
implementation go red, port it. Silent divergence is the one forbidden thing.CONTRACT.md and its fixture, in the same PR, approved by a human.Rules that have carried real systems, one line each:
A document is read once. A skill is invoked on every change. That is why this is a skill.
/coding-by-contract [init [path] | check [diff|PR|description] | ask <topic> | amend <rule change> | scaffold <name>]
| Action | What it does |
|---|---|
init [path] | Distill the project or subsystem into CONTRACT.md: the rules (claim · why · lives-in · pinned-by) and the change recipe. Proposes, you approve. |
check | Hold a change to the contract: which rules it touches, whether one is violated, whether the fix is root cause (the shared rule) or symptom (one caller). Runs the pins that are runnable. |
ask <topic> | Produce the question that goes straight to the core, and answer it from the real code by citing rules. |
amend <rule change> | Propose a contract edit: prose and pin together, shown as a diff, applied on approval. |
scaffold <name> | Generate an in-repo guard skill for one subsystem (below). |
Directly, on any repo: init once, then check every change and amend on purpose.
Built from public signals: copy clicks on this site, GitHub stars and activity, the README and the manifest. Not a security audit or an endorsement.
Plugins from other owners that cover similar ground
npx claudepluginhub initialneil/coding-by-contract --plugin coding-by-contract