agentleFS
YassimbaYassimba/loom/skills/code-contracts/SKILL.md

code-contracts

Skill9 starsChanged 2 months agoApache-2.0View on GitHub

Use when code contains @cc or CONTRACTS, when the user asks to record obligations beside code, or when contract compliance must be verified.

2 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

7 rules. About 0 are common, 3 are distinctive, and 4 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Discover: Before designing, changing, or reviewing code, find every applicable contract on the target declaration, its enclosing …

    line 12
  2. Distinctive:

    Enforce: Keep code, tests, and contract prose coherent.

    line 15
  3. Very specific:

    Verify: When loom contracts supports the target language, run loom contracts check and confirm discoverability with loom contracts list.

    line 16
  4. Very specific:

    Before writing or editing contracts, read references/format.md.

    line 20
  5. Distinctive:

    Keep a proposed contract only when a reviewer can identify both:

    line 24
  6. Very specific:

    When materializing a contract, set owner from the authenticated GitHub identity when available and ask rather than guess.

    line 29
  7. Distinctive:

    Before completing work, account for every applicable contract and every durable obligation surfaced by the obligation sweep: represented by …

    line 33

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

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.

Writing contracts

Before writing or editing contracts, read 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.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.