pocs/agent-plugins/claude-pragma/skills/contract/SKILL.md
Turn capsule invariants and boundary crossings into executable contracts. Use after creating a concept capsule, or when invariants need to be enforced in code. Covers preconditions, postconditions, constructor validation, domain types, and contract tests.
npx skillsauth add hashintel/labs contractInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Turn capsule invariants into executable contracts: domain types that prevent invalid states, validation at boundaries, and tests that prove enforcement. Operationalizes "design by contract" (Meyer) and "parse, don't validate."
Invariants to enforce (or audit to check current coverage): $ARGUMENTS
Preconditions:
/pragma:capsule first./pragma:card + /pragma:slice first.Also read: the capsule (glossary + invariants), recent cards (boundary crossings), and existing source code.
For each capsule invariant, determine current enforcement status:
| Invariant | Enforcement | Location | Evidence | |-----------|-------------|----------|----------| | [from capsule] | Type system / Constructor / Test / None | [file:line or "missing"] | [test name or "none"] |
Enforcement levels (best → worst): Type system (invalid states unrepresentable) → Constructor/validator (checked at entry points) → Test (at least a check somewhere) → None (fix this).
For each public entry point in scope:
Module: [name]
Function: [name]
Preconditions: [what must be true on entry]
Postconditions: [what must be true on exit]
Errors: [what can go wrong and how it's signaled]
Use glossary terms. No clear pre/postconditions → design smell, module may need splitting.
One invariant at a time. Prioritize "None" first, then upgrade "Test" → "Constructor" → "Type system":
Keep tests green throughout. Do not change behavior — only tighten enforcement.
Write or update docs/contracts.md with:
Run full verification harness. All checks must pass. Contract extraction must not change behavior.
Commit: Contract: enforce [invariant] at [boundary]
/pragma:card./pragma:contract passes, or back to /pragma:card + /pragma:sliceState: governance, Next: /pragma:consult (or the explicitly recommended next step), Loop: /pragma:consult (default unless user explicitly continues directly)documentation
Read and write a Petri net (SDCPN) document by Automerge URL. Use when creating, editing, or querying Petri nets — adding or removing places, transitions, arcs, color types, differential equations, and parameters.
development
Time-boxed throwaway investigation to answer one hard question. Use when facing technical uncertainty before a slice — the output is knowledge, not production code. Retires risk by producing a spike verdict with clear recommendations.
development
Implement one tracer-bullet slice following the inside-out methodology. Use when you have a tracer-bullet card ready to build. Implements functional core first, then imperative shell, then end-to-end wiring, then alignment refactor.
tools
Build a walking skeleton — the thinnest runnable system that proves build, test, and runtime work end-to-end. Use when starting a new project, before any feature work. Front-loads tooling and infrastructure so every subsequent slice is cheaper.