Skip to content
Skill

Contract first

Coordinates API and event boundaries around one machine-checkable contract shared by both

Contract first is an open-source agent skill for developer tools. It is available on Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose.

Scripts
None
Platforms
Claude Code, Codex, Cursor
GitHub stars
66
Last commit
License
MIT
Listing updated

Similar skills

About Contract first

This skill guides teams that build a frontend and backend, or two services, against a shared boundary. It asks the agent to pick one version-controlled artifact such as an OpenAPI, AsyncAPI, Protocol Buffers or JSON Schema file as the single source of truth, then derive consumer types and fixtures from it instead of maintaining separate copies in mocks, wikis and provider code.

The workflow walks through identifying consumers and owners, describing what each consumer needs, defining the smallest useful contract with explicit required fields, nullability, enums and errors, and generating types from the repository's pinned generator. It also covers verifying provider output against the same artifact, including sandbox, error and conditional response paths, and a contract change protocol that updates the contract before implementation changes. The skill includes guidance on resolving $ref targets only from allowlisted paths and reviewing generated diffs before committing.

No scripts are bundled. The examples assume a TypeScript project using OpenAPI-generated types, and the skill relies on the repository's own generator and test tooling rather than providing them.

When your agent uses it

Coordinate frontend/backend or service-to-service work through one authoritative machine-checkable contract (OpenAPI, AsyncAPI, Protocol Buffers, or JSON Schema), with generated consumer types and contract-verified integration. Use when parallel consumer and provider work must evolve an API or event schema without field drift, mock/production shape mismatch, or one side silently redefining the interface.

From the skill's SKILL.md. Your agent reads this description to decide when to load the skill.

What it can access

From a static check of its 2 files (10 KB) on GitHub on 1 December 2026. Nothing was run. Read the files before you install a skill: it can tell your agent to run anything its tools allow.

Check another skill before you install it.

Install

This skill ships in the rea-skills plugin. In Claude Code, add the marketplace and install the plugin (it may include other skills too):

/plugin marketplace add smartworldarafath/REA_Skill
/plugin install rea-skills@smartworldarafath

Or copy only this skill to ~/.claude/skills/contract-first:

tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/smartworldarafath/REA_Skill.git "$tmp" &&
mkdir -p ~/.claude/skills &&
rm -rf ~/.claude/skills/contract-first &&
cp -R "$tmp/.agents/skills/contract-first" ~/.claude/skills/contract-first &&
rm -rf "$tmp"

For one project only, put the folder in .claude/skills/contract-first inside it instead.

Claude Code docs on skills

Copy the skill folder to ~/.agents/skills/contract-first to use it in every repository:

tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/smartworldarafath/REA_Skill.git "$tmp" &&
mkdir -p ~/.agents/skills &&
rm -rf ~/.agents/skills/contract-first &&
cp -R "$tmp/.agents/skills/contract-first" ~/.agents/skills/contract-first &&
rm -rf "$tmp"

For one repository only, put the folder in .agents/skills/contract-first inside it instead.

Codex docs on skills

Copy the skill folder to ~/.cursor/skills/contract-first to use it in every project:

tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/smartworldarafath/REA_Skill.git "$tmp" &&
mkdir -p ~/.cursor/skills &&
rm -rf ~/.cursor/skills/contract-first &&
cp -R "$tmp/.agents/skills/contract-first" ~/.cursor/skills/contract-first &&
rm -rf "$tmp"

For one project only, put the folder in .cursor/skills/contract-first inside it instead.

Cursor docs on skills

Run in a terminal (add --scope workspace to install it for the current workspace only):

gemini skills install https://github.com/smartworldarafath/REA_Skill.git --path .agents/skills/contract-first

Or copy the folder to ~/.gemini/skills/contract-first yourself.

Gemini CLI docs on skills

For GitHub Copilot in VS Code, copy the skill folder to ~/.copilot/skills/contract-first:

tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/smartworldarafath/REA_Skill.git "$tmp" &&
mkdir -p ~/.copilot/skills &&
rm -rf ~/.copilot/skills/contract-first &&
cp -R "$tmp/.agents/skills/contract-first" ~/.copilot/skills/contract-first &&
rm -rf "$tmp"

For one project only, put the folder in .github/skills/contract-first inside it instead.

VS Code docs on skills

Get the folder:

git clone --depth 1 https://github.com/smartworldarafath/REA_Skill.git

Then copy REA_Skill/.agents/skills/contract-first into your agent's skills folder as contract-first. Agents that support SKILL.md read one folder per skill.

The SKILL.md format

What it does

Single authoritative contract
Guides choosing one canonical artifact per boundary, such as OpenAPI for HTTP or Protocol Buffers for RPC.
Consumer-driven design
Starts from what each consumer must render, covering required fields, null meaning and identifier types.
Generated consumer types
Shows how to derive typed interfaces and contract-valid mocks from the shared schema.
Provider verification
Checks that serialized responses, including error and feature-flagged paths, match the contract at runtime.
Contract change protocol
Sets an order for proposing, reviewing and regenerating changes before implementation is updated.
Safe tooling practices
Limits contract-driven generators to expected output paths and restricts external reference resolution.

Good for

  • Keep frontend and backend teams building against the same API schema
  • Generate TypeScript types from an OpenAPI file for a client
  • Check that an event producer and consumer agree on a message shape
  • Review a proposed API field rename for breaking changes
  • Create contract-valid mock responses for parallel frontend work

Contract first FAQ

Which contract formats does the skill support?

It names OpenAPI for HTTP APIs, AsyncAPI for event-driven APIs, Protocol Buffers for RPC or messages, JSON Schema for standalone payloads, and a shared typed interface when all participants share the same build and runtime.

Does Contract first run scripts or install tools?

No. The skill bundles no scripts. It refers to the repository's existing pinned generator and suggests a generate command that the project would need to define.

When should I not use Contract first?

The skill says not to add contract machinery to a single-module boundary that changes in one atomic commit and has no independent consumer; a shared type may be enough.

Which related skills does Contract first reference?

It points to api-design for API design, ai-regression-testing for regression tests, backend-patterns, frontend-patterns and tdd-workflow.

How do I install Contract first in Claude Code?

Copy the skill folder from GitHub to ~/.claude/skills/contract-first to use it in all your projects, or to .claude/skills/contract-first in one project. Or install the rea-skills plugin, which includes it: /plugin marketplace add smartworldarafath/REA_Skill, then /plugin install rea-skills@smartworldarafath.

Does Contract first run scripts?

No. It is instructions only, with no scripts. This comes from a static check of the files on GitHub; nothing was run. Read the files before you install it.

Which AI agents can use Contract first?

Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose. Each reads skills in the SKILL.md format from its own folder; the install steps on this page list them.

What are the best alternatives to Contract first?

The closest alternatives to Contract first are Contracts, Contract design, API, Use smart contract platform and Openapi to application code.

Where this comes from

  • Description: from the skill's own SKILL.md.

More from smartworldarafath/REA_Skill

  1. Guides building and auditing UI to WCAG 2.2 AA across web, iOS and Android

    • Open source
    • 66 GitHub stars
    • Developer tools
  2. Diagnoses agent and LLM stacks for hidden failures and ranks the fixes by severity

    • Open source
    • 66 GitHub stars
    • Developer tools
  3. Compare coding agents head-to-head on your own tasks by pass rate, cost and time

    • Open source
    • 66 GitHub stars
    • Developer tools
  4. Guides an agent to design tool sets, observations and error recovery for better completion

    • Open source
    • 66 GitHub stars
    • Developer tools
  5. Lets an AI agent make x402 payments within per-task budgets and spending policies

    • Open source
    • 66 GitHub stars
    • Finance and payments