code-contracts
/code-contracts
Use when code contains @cc or CONTRACTS, when the user asks to record obligations beside code, or when contract compliance must be verified.
- Author
- yassimba ↗
- Repository
- loom ↗
- Licence
- Apache-2.0
- Last repository change
- 27.10.2026
Assessment and security
- Files in this package
- 4
- Scripts
- 0
- HTML comments
- 0
- URLs in SKILL.md
- 0
No signals detected. Repository changed on 27.10.2026, without references to retired models or APIs.
Apache-2.0, otwarta: można używać i zmieniać, z zachowaniem licencji i informacji o zmianach.
What it does and when to use it
Use when code contains @cc or CONTRACTS, when the user asks to record obligations beside code, or when contract compliance must be verified.
Original author description
Use when code contains @cc or CONTRACTS, when the user asks to record obligations beside code, or when contract compliance must be verified.
How it works
- Workflow
- Writing contracts
- Completion
SKILL.md preview
--- name: code-contracts description: Use when code contains @cc or CONTRACTS, when the user asks to record obligations beside code, or when contract compliance must be verified. --- # Code contracts Record durable obligations beside the code they govern. Contracts are structured natural-language specifications, not runtime checks or formal proofs; keep tests, types, and validation that can enforce the same behavior mechanically. ## Workflow 1. **Discover.** Before designing, changing, or reviewing code, find every applicable contract on the target declaration, its enclosing declarations, ancestor `CONTRACTS` files, and relevant called symbols. Treat them as simultaneous obligations. Surface conflicts instead of choosing silently. 2. **Obligation sweep.** While planning or implementing, inspect the affected behavior for assumptions, requirements, invariants, input/output guarantees, error and fallback behavior, side effects, state transitions, security rules, and architectural boundaries worth preserving. Do not restrict the sweep to exceptional or high-risk behavior. Propose every concrete obligation that future changes must continue to satisfy. 3. **Place.** Put declaration-specific contracts in supported documentation comments or docstrings. Put directory-wide obligations in `CONTRACTS`. Use the narrowest boundary that governs the behavior. Once a blueprint direction is approved, materialize its contracts in existing code before handoff when possible; leave only contracts whose target code does not exist or whose assumptions remain unresolved for the implementation agent. 4. **Enforce.** Keep code, tests, and contract prose coherent. Update contracts with intentional behavior changes. Never weaken or remove a contract merely to make an implementation appear compliant; fix the mismatch or surface it. 5. **Verify.** When `loom contracts` supports the target language, run `loom contracts check` and confirm discoverability with `loom contracts list`; otherwise inspect manually and disclose the tooling limit. For `$code-contracts verify` or a contract review, read and follow [`references/verification.md`](references/verification.md). ## Writing contracts Before writing or editing contracts, read [`references/format.md`](references/format.md). Each contract carries one concrete obligation. Include decisive conditions, boundaries, missing-data behavior, errors, fallbacks, or effects when they determine compliance. Preserve intent across implementations: omit purpose-only documentation, rationale, algorithm narration, and accidental implementation details unless they impose a real constraint. Keep a proposed contract only when a reviewer can identify both: - a concrete change that would violate it; and - an alternative implementation that would satisfy it. When materializing a contract, set `owner` from the authenticated GitHub identity when available and ask rather than guess. A blueprint may omit unknown ownership metadata. Set `notify` only when the user explicitly requests violation notifications. ## Completion Before completing work, account for every applicable contract and every durable obligation surfaced by the obligation sweep: represented by a satisfied or intentionally updated contract, rejected by the violation-and-alternative test, or surfaced as conflicting, obsolete, or impossible. Syntax validation alone does not establish semantic compliance.
Files in this package (4)
- SKILL.md 3 KB
- deps.yml 1 KB
- references/format.md 5 KB
- references/verification.md 4 KB
Versions
The database has no other skills named code-contracts.
Database snapshot: 13.11.2026 · package version a9156dab7f6e (SHA-256 digest of the entire package)
Downloads in the last 30 days: 0 · ranking
Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.
Similar skills
- 100generating-api-contracts
Generate API contracts and OpenAPI specifications from code or design documents. Use when documenting API contracts and specifications. Trigger with phrases like "generate API contract", "create OpenAPI spec", or "document API contract". - 100generating-api-contracts
Generate API contracts and OpenAPI specifications from code or design documents. Use when documenting API contracts and specifications. Trigger with phrases like "generate API contract", "create OpenAPI spec", or "document API contract". - 100code-review
Review changes since a fixed point along separate Standards and Spec axes, plus Code Contracts when the repository defines @cc or CONTRACTS obligations. Runs enabled reviews in parallel sub-agents and reports them side by side. Use for branches, PRs, work-in-progress changes, or "review since X". - 90drift-sync
Find and resolve drift between intent, contracts, tests, code, and documentation after a change. Use when a task is finished, before a PR, when asked whether things are in sync or what is stale or missing, or when the README, architecture notes, or contracts may no longer match the code. - 90docs-contract-sync
Synchronize implementation changes with framework/app docs contracts across API surfaces, behavior specs, and constraints. Use when code changes must be reflected in docs. - 100validating-api-contracts
Validate API contracts using consumer-driven contract testing (Pact, Spring Cloud Contract). Use when performing specialized testing. Trigger with phrases like "validate API contract", "run contract tests", or "check consumer contracts".