Skip to content
Back to skills

Openfleet Contracts

ASecurity

How OpenFleet defines cross-repo contracts as shared fixtures in contracts/, and how contract tests and contract changes work. v1 testing is contract tests only.

  • 4 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added November 7, 2026
ai-agentstypescripttestingapifrontend

Works with

  • cli
  • api

Security analysis

A100/100

Scanned November 7, 2026

npx -y skills add yashicon21/openfleet-tools --skill openfleet-contracts --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Openfleet Contracts?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Openfleet Contracts
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/yashicon21-openfleet-contracts/badge)](https://www.skillsdirectory.com/skills/yashicon21-openfleet-contracts)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: openfleet-contracts
description: How OpenFleet defines cross-repo contracts as shared fixtures in contracts/, and how contract tests and contract changes work. v1 testing is contract tests only.
---

# Contracts

A **contract** is any interface that crosses a child boundary. In v1, OpenFleet verifies cross-repo correctness with **contract tests only**: each repo tests itself against the same shared fixture.

## Fixtures

The coordinator writes the fixtures to `projects/<project>/contracts/` during the grill:

- Prefer machine-checkable formats: JSON Schema (`*.schema.json`), example payloads (`*.example.json`), OpenAPI fragments, `.proto` or `.graphql` snippets, or TypeScript `.d.ts` type declarations.
- Give each fixture a sibling Markdown note (`<name>.md`). It must state the producer, the consumers, the semantics that the format cannot capture (units, nullability, ordering, error cases), and a version line.
- Keep each fixture minimal: only the fields that cross the boundary.

## Contract tests

- **Planner:** the plan must include at least one contract test for every contract that the child produces or consumes.
- **Implementer:** writes the tests. Producers assert that real output conforms to the fixture. Consumers assert that they correctly handle the fixture's example payloads, including the error cases.
- **Tester:** verifies that the tests exist, reference the shared fixture, run in the child's test command, and pass.

## Greenfield projects

In a greenfield project, `contracts/` holds the agreed shapes from the grill (for an API: one OpenAPI 3.1 fragment per service, with every endpoint, request, response and error case of the MVP slice; for events: one JSON Schema per event). The `contracts` child turns them into the shared contracts package (full schemas plus generated types and clients) before any service or the frontend is built; those children import from that package, and their contract tests validate against it. A contract change during the run updates `contracts/` **and** the contracts package: send it to the contracts child (moved back to `implementing` if it is `done`) before the children that use it.

## Changing a contract during the run

Only the top coordinator changes contracts, usually after a child asks a question. This happens during the hands-off run, so the coordinator decides without asking the user. A repo coordinator never changes a contract or the Shared approach: it escalates the question (`npx openfleet escalate <project> <child> --question '…'`), and the top coordinator decides, changes the contract here, resolves each escalated child (`escalate … --resolve --decision '…'`) and resumes the repo coordinator with <!--host:copilot-->`write_agent`<!--host:claude-->`SendMessage`<!--/host-->.

1. Decide the change. If the spec already answers the question, use that answer. Otherwise decide yourself; do not ask the user. Log the decision as an `assumption` event with `"contractChange": true` (see `openfleet-orchestrate`).
2. Update the fixture, its `.md` note and version line, and the Contracts table in `spec.md`.
3. Log `contract.changed` with every affected child.
4. **Broadcast:** send each affected child that is running (<!--mode:subagent--><!--host:copilot-->`write_agent`<!--host:claude-->`SendMessage`<!--/host--><!--mode:session-->`npx openfleet agent reply <project> <job>`, which reaches a running job right after its current turn<!--/mode-->; for children of a repo coordinator, send it to the repo coordinator, which forwards it) a short message: what changed, the fixture path, and what they must adjust. <!--mode:subagent-->Log each message as `message.sent`. <!--/mode-->For affected children that are already `done`, move them back to `implementing`. <!--mode:subagent-->Spawn<!--mode:session-->Start<!--/mode--> a new implementer with the change as findings, then re-test.
5. **Re-plan if needed.** If a change invalidates a child's plan (for example, it has not started implementing yet, or the plan no longer fits), send the change to its planner, or <!--mode:subagent-->spawn<!--mode:session-->start<!--/mode--> a new one, and patch the child `{"phase":"plan-review"}`. This clears its `consistent` flag. After you re-validate the plan and patch `{"phase":"planned"}`, `npx openfleet next` returns `check-consistency` for it: compare it with the other plans again before it continues.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.