agentleFS
tuoithotuoitho/contract-first-agent-workflow/skills/authoring-executable-contracts/SKILL.md

authoring-executable-contracts

Skill1 starsChanged 3 months agoApache-2.0View on GitHub

Use when an approved design identifies APIs, events, UI-provider boundaries, or other shared interfaces that independent implementation owners must consume or provide.

The file

We split this skill into the rules it gives an agent

5 rules. About 0 are common, 4 are distinctive, and 1 is 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.

  • 1

    Very specific

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

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

    Create .dream/specs/<feature>/contracts/ from approved requirements and design.

    line 8
  2. Distinctive:

    Create one artifact per boundary in its native format — HTTP APIs (OpenAPI), RPC/gRPC (protobuf or equivalent IDL), events/streams …

    line 16
  3. Distinctive:

    Use OpenAPI, protobuf/IDL, AsyncAPI, JSON Schema, Avro, or typed interface schemas where appropriate, plus scenarios for stateful/semantic …

    line 41
  4. Distinctive:

    When a contract has independent consumers, state the verification expectation for both sides — provider checks and consumer checks against …

    line 43
  5. Distinctive:

    Only contract behavior that another owner or observable client depends on.

    line 61

≈ “Common” is an estimate: at least 1 in 5 of the 213,895 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

Authoring Executable Contracts

Create .dream/specs/<feature>/contracts/ from approved requirements and design.

Required Artifacts

Use:

  • references/contract-manifest.template.yaml
  • references/scenarios.template.yaml

Create one artifact per boundary in its native format — HTTP APIs (OpenAPI), RPC/gRPC (protobuf or equivalent IDL), events/streams (AsyncAPI, JSON Schema, Avro), typed UI-provider boundaries:

.dream/specs/<feature>/contracts/
├── manifest.yaml
├── order-api.yaml              # OpenAPI when applicable
├── inventory-api.proto         # RPC/IDL when applicable
├── order-confirmed-event.json  # event/stream schema when applicable
└── scenarios.yaml

Contract contents

For each boundary, define the exact observable agreement needed for independent implementation:

  • identifier and revision;
  • producer/provider and consumers;
  • request/input shape and caller context;
  • success status/result shape;
  • each material failure status/result shape;
  • semantic rules not expressible by schema alone;
  • concrete Given/When/Then examples (follow references/scenarios.template.yaml);
  • requirement IDs;
  • compatibility classification for later changes.

Use OpenAPI, protobuf/IDL, AsyncAPI, JSON Schema, Avro, or typed interface schemas where appropriate, plus scenarios for stateful/semantic behavior. Schema alone is insufficient when the same shape can carry different meaning.

When a contract has independent consumers, state the verification expectation for both sides — provider checks and consumer checks against the same frozen revision (consumer-driven contract testing or equivalent schema-based verification) — so independently implemented services cannot each pass locally yet fail at integration.

Example scenario

- id: PRODUCT-DETAIL-004
  requirement: REQ-PRODUCT-07
  given: authenticated user has liked product P1
  when: GET /products/P1
  then:
    status: 200
    body.viewer.isLiked: true

Specify anonymous behavior explicitly when response fields depend on current-user context.

Boundary rule

Only contract behavior that another owner or observable client depends on. Do not contract private class names, helper methods, or internal persistence structure.

Set new contracts to DRAFT in manifest.yaml (following references/contract-manifest.template.yaml). They are not implementation authority until reviewing-and-freezing-contracts marks a revision FROZEN.

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.