bend-laws
Skill4 starsChanged 11 days agoMITView on GitHub
Prove business rules with Bend laws and check shipped TypeScript or Go against the proven model. Use for formal proof, LAWS.bend or PROOF.bend, or acceptance criteria that must hold for every input.
In this repository117 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- accessibilitySkill
- agent-watchdogSkill
- aipSkill
- animateSkill
- animation-performanceSkill
- animation-vocabularySkill
- ask-benSkill
- ask-sonnerSkill
- bazelSkill
- blast-radiusSkill
- brain-dumpSkill
- break-uiSkill
- ci-fixesSkill
- codebase-designSkill
- codex-compatSkill
- codexSkill
- commit-push-prSkill
- connect-querySkill
- create-verification-skillSkill
- demoSkill
- development-lifecycleSkill
- diagnosing-bugsSkill
- docsSkill
- dogfoodSkill
- domain-modelingSkill
- e2e-testingSkill
- effect-tsSkill
- effect-v3-to-v4Skill
- efficient-frontierSkill
- eli5Skill
- excalidraw-diagramSkill
- extend-harnessSkill
- frontend-invariantsSkill
- frontend-starter-kitSkill
- full-sendSkill
- gesturesSkill
- golang-reviewSkill
- golangSkill
- goSkill
- grillingSkill
- handoffSkill
- hook-auditSkill
- implement-specSkill
- improve-animationsSkill
- improve-codebase-architectureSkill
- improveSkill
- launchdarklySkill
- lie-detectorSkill
- maintain-verification-skillSkill
- make-pr-easy-to-reviewSkill
- mobile-nativeSkill
- plan-arbiterSkill
- plow-aheadSkill
- postgresqlSkill
- primeSkill
- productSkill
- protobufSkill
- prototypeSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
10 rules. About 0 are common, 4 are distinctive, and 6 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 9
When proving changed behavior or maintaining verification, read the Poteto adaptation.
- Distinctive: line 17
Use laws for rules that decide money, access, or safety and are finite or integer arithmetic: modes, permissions, statuses, thresholds, …
- Distinctive: line 32
Read the shipped rule and its tests.
- Very specific: line 37
Call only the functions under test.
- Very specific: line 41
Write imported constructors qualified and braced: case P.Yes{}:.
- Very specific: line 50
Write oracle.bend, whose main prints the # @generated header and one <inputs> <decision> line per input, then run laws/check.sh --write.
- Very specific: line 67
Before writing Bend, run bend guide.
- Very specific: line 73
Keep @unsafe, def f? and foreign code out of law directories: they switch off the soundness a proof relies on.
- Very specific: line 75
Keep the Bend version pinned in install-bend.sh.
- Distinctive: line 76
Keep source on the machine: sending code to BendAI or publishing to the Bend hub needs explicit approval.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 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.
Files
When proving changed behavior or maintaining verification, read the Poteto adaptation.
A law is an acceptance criterion that a proof must meet for every input. Bend checks the proofs against a reference model of the rule. A table generated from that model ties the shipped code to the laws.
Fit
Use laws for rules that decide money, access, or safety and are finite or integer arithmetic: modes, permissions, statuses, thresholds, time windows, rounding. Route strings, parsers, JSON, floats (Bend's F32 is axiomatic and there is no F64), and UI to property tests (fast-check, rapid) instead; proving them costs more than it catches.
Ownership
File in laws/<rule>/ | Owner |
LAWS.bend | Human. The bend-laws-guard hook denies agent writes; a human opts a session in with BEND_LAWS_AUTHOR=1. |
policy.bend (model), PROOF.bend, oracle.bend | Agent |
decisions.txt | Generated by laws/check.sh --write |
Workflow
- Read the shipped rule and its tests. List every input and the decision it returns. Done when the input domain is enumerated (finite) or its boundaries are named.
- Draft the laws in a scratch directory as
LAWS_draft.bend(import paths allow only letters, digits,_and-), and prove them there. Give each law one plain-English comment. Done when the human has reviewed the draft and committed it asLAWS.bend.- Call only the functions under test. Define every helper a law uses inside
LAWS.bend, so the model cannot weaken a law by redefining its vocabulary. - State what must hold. Anything a law leaves open is whatever the model does, so pair each prohibition ("never runs X") with the requirement ("runs only what declares Y").
- Write imported constructors qualified and braced:
case P.Yes{}:. A barecase Yes:on an imported type binds every value and the law passes vacuously (bendlang/bend#1328);check.shand the hook reject it.
- Call only the functions under test. Define every helper a law uses inside
- Model the rule in
policy.bend, mirroring the shipped code's branch order, and prove each law inPROOF.bendasdef Laws.<law>(...). Done whenbend PROOF.bendprintsALL PROOFS CHECK. - Mutate the model once per law: change a branch the law guards and confirm
bend PROOF.bendprintsSOME PROOFS FAILat that law; then revert. Done when every law has rejected a mutant. A law no mutant fails is vacuous. - Write
oracle.bend, whosemainprints the# @generatedheader and one<inputs> <decision>line per input, then runlaws/check.sh --write. - Compare the shipped code: a unit test parses
decisions.txtand asserts the shipped function returns every row. For a finite domain, also assert each input appears once, with the domain derived from the code's types so a new value breaks the build. For an unbounded domain, generate inputs with property tests, seed the law boundaries, and compare against the model compiled withbend -o model.mjs. Done when a mutant in the shipped code fails the test. - Copy templates/install-bend.sh and
templates/check.sh into
laws/, then add a required CI job that runs both. Add CODEOWNERS forlaws/**/LAWS.bendandlaws/**/decisions.txt. Done when the job fails on a missingLAWS.bendand passes once it lands.
To change a rule: the human edits the law, the agent updates the model and proofs, runs
check.sh --write, then changes the shipped code until its unit test matches. Review
every decisions.txt diff as a behavior change.
Before writing Bend, run bend guide; read REFERENCE.md for the syntax
traps, proof patterns, --verdict setup and upgrades.
Guardrails
- Propose law changes to the human; never edit
LAWS.bendor work around the hook. - Keep
@unsafe,def f?and foreign code out of law directories: they switch off the soundness a proof relies on. Bend's gate andcheck.shboth reject them. - Keep the Bend version pinned in
install-bend.sh; upgrade deliberately and re-prove. - Keep source on the machine: sending code to BendAI or publishing to the Bend hub needs explicit approval.
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
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.

