# Contract first

> Contract first is an open-source agent skill for developer tools. Coordinates API and event boundaries around one machine-checkable contract shared by both. It is available on Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose.

- **Kind:** Skill
- **Pricing:** Open source
- **Platforms:** Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf, Goose
- **Website:** https://github.com/smartworldarafath/REA_Skill/tree/main/.agents/skills/contract-first
- **Repository:** https://github.com/smartworldarafath/rea_skill
- **GitHub stars:** 66
- **License:** MIT
- **Skill name:** contract-first
- **Collection:** https://github.com/smartworldarafath/REA_Skill
- **Categories:** [developer tools](https://ai-powered.com/categories/developer-tools)
- **Listing updated:** 2026-12-01

## About

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.

## What it can access

From a static check of the files on GitHub; nothing was run.

- [Instructions only, no scripts](https://github.com/smartworldarafath/REA_Skill/tree/HEAD/.agents/skills/contract-first)
- [License: MIT](https://github.com/smartworldarafath/REA_Skill/tree/HEAD/.agents/skills/contract-first)

## Features

- **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

## Install

### Claude Code

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

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

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

```sh
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.

### Codex

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

```sh
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.

### Cursor

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

```sh
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.

### Gemini CLI

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

```sh
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.

### VS Code

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

```sh
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.

### Other agents

Get the folder:

```sh
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.

## 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.

## Alternatives

- [Contracts](https://ai-powered.com/skills/contracts-ramboz): Contracts is an open-source agent skill for developer tools.
- [Contract design](https://ai-powered.com/skills/contract-design): Contract design is an open-source agent skill for developer tools.
- [API](https://ai-powered.com/skills/api): API is an open-source agent skill for developer tools.
- [Use smart contract platform](https://ai-powered.com/skills/use-smart-contract-platform): Use smart contract platform is an open-source agent skill for legal and government.
- [Openapi to application code](https://ai-powered.com/skills/openapi-to-application-code): Openapi to application code is an open-source agent skill for developer tools.
- [TypeScript best practices](https://ai-powered.com/skills/typescript-best-practices): TypeScript best practices is an open-source agent skill for developer tools.
- [Integration adapter](https://ai-powered.com/skills/integration-adapter): Integration adapter is an open-source agent skill for developer tools.
- [API connector builder](https://ai-powered.com/skills/api-connector-builder): API connector builder is an open-source agent skill for developer tools.

---
Source: https://ai-powered.com/skills/contract-first
