api-contract
Skill3 starsChanged 8 months agoMITView on GitHub
Use when designing API contracts between frontend and backend, implementing contract testing, or managing API versioning and breaking changes
6 other projects use a version of this.
Adopted by
Most recently taken up by
- gonimar/claude-web-studiotheir own version, first seen Sep 27, 2026
- ryktara/Foundrytheir own version, first seen Sep 25, 2026
- 1398281322-a11y/java-backend-guardrailstheir own version, first seen Aug 31, 2026
- PatriotAgenticLLC/better_claude_skillztheir own version, first seen Jul 1, 2026
- camilo-acevedo/claude-skillstheir own version, first seen May 14, 2026
- damienlaine/agentic-sprinttheir own version, first seen Dec 23, 2025
Other versions6 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 6
- damienlaine/agentic-sprint★ 18same name
- gonimar/claude-web-studio★ 5same name
- PatriotAgenticLLC/better_claude_skillz★ 3same name
- 1398281322-a11y/java-backend-guardrails★ 2same name
- camilo-acevedo/claude-skills★ 0same name
- ryktara/Foundry★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository36 other files it gives its agents.
- adrSkill
- analyticsSkill
- api-designSkill
- ci-pipelineSkill
- claude-mdSkill
- code-qualitySkill
- data-modelSkill
- db-migrateSkill
- debugSkill
- deploySkill
- dep-updateSkill
- disk-cleanupSkill
- docker-buildSkill
- eng-leadSkill
- event-drivenSkill
- fullstack-healthcheckSkill
- go-featureSkill
- go-integration-testSkill
- go-refactorSkill
- go-scaffoldSkill
- incident-responseSkill
- interactive-clarifySkill
- observabilitySkill
- onboardingSkill
- product-specSkill
- py-featureSkill
- py-integration-testSkill
- py-migrateSkill
- py-refactorSkill
- py-scaffoldSkill
- react-featureSkill
- react-refactorSkill
- react-scaffoldSkill
- review-codeSkill
- securitySkill
- system-designSkill
The file
We split this skill into the rules it gives an agent
3 rules. 0 are common, 2 are distinctive, and 1 is very specific to this project.
0
Common
Most of the 5 edited versions we read keep these.
2
Distinctive
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
- Distinctive: line 172
Verify that frontend expectations match backend reality:
- Distinctive: line 221
Keep v1 running while migrating clients to v2.
- Very specific: line 261
REQUIRED: Update CLAUDE.md with API contract conventions (claude-md)
“Common” is measured: kept by at least 6 in 10 of the 5 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
API Contract Design
Overview
Define the API contract before implementing frontend or backend. Contract-first development prevents integration surprises.
Core principle: The API contract is the agreement between frontend and backend. Change it deliberately, never accidentally.
When to Use
- Starting a new feature that spans frontend and backend
- Frontend and backend developed in parallel
- Changing existing API endpoints
- Detecting or preventing breaking changes
Contract-First Workflow
1. Define contract (OpenAPI spec or TypeScript types)
2. Frontend and backend agree on the contract
3. Implement in parallel:
- Backend: implement endpoints matching contract
- Frontend: build against contract with MSW mocks
4. Integration test: verify both sides matchOpenAPI Spec (Source of Truth)
For Go projects, swaggo generates this from annotations. For contract-first, write the spec first:
# openapi.yaml
openapi: 3.0.3
info:
title: Project API
version: 1.0.0
paths:
/api/v1/users:
get:
summary: List users
parameters:
- name: limit
in: query
schema: { type: integer, default: 20 }
- name: offset
in: query
schema: { type: integer, default: 0 }
responses:
'200':
content:
application/json:
schema:
type: object
properties:
items:
type: array
items: { $ref: '#/components/schemas/User' }
pagination:
$ref: '#/components/schemas/Pagination'
post:
summary: Create user
requestBody:
content:
application/json:
schema: { $ref: '#/components/schemas/CreateUserRequest' }
responses:
'201':
content:
application/json:
schema: { $ref: '#/components/schemas/User' }
'400':
content:
application/json:
schema: { $ref: '#/components/schemas/ErrorResponse' }
components:
schemas:
User:
type: object
properties:
id: { type: string, format: uuid }
email: { type: string, format: email }
name: { type: string }
created_at: { type: string, format: date-time }
Pagination:
type: object
properties:
limit: { type: integer }
offset: { type: integer }
total: { type: integer }
ErrorResponse:
type: object
properties:
code: { type: string }
message: { type: string }
details:
type: array
items:
type: object
properties:
field: { type: string }
message: { type: string }Shared Types (TypeScript)
Generate or manually maintain shared types between frontend and backend:
// src/api/types.ts — mirrors the API contract exactly
export interface User {
id: string
email: string
name: string
created_at: string
}
export interface CreateUserRequest {
email: string
name: string
}
export interface PaginatedResponse<T> {
items: T[]
pagination: {
limit: number
offset: number
total: number
}
}
export interface ErrorResponse {
code: string
message: string
details?: { field: string; message: string }[]
}Typed API Client
// src/api/users.ts
import { api } from './client'
import type { User, CreateUserRequest, PaginatedResponse } from './types'
export const usersApi = {
list: (params?: { limit?: number; offset?: number }) =>
api.get<PaginatedResponse<User>>('/users', { params }),
getById: (id: string) =>
api.get<User>(`/users/${id}`),
create: (data: CreateUserRequest) =>
api.post<User>('/users', data),
update: (id: string, data: Partial<CreateUserRequest>) =>
api.patch<User>(`/users/${id}`, data),
delete: (id: string) =>
api.delete(`/users/${id}`),
}Contract Testing
Verify that frontend expectations match backend reality:
// tests/contract/users.contract.test.ts
import { usersApi } from '../api/users'
describe('Users API Contract', () => {
it('GET /users returns paginated response', async () => {
const { data } = await usersApi.list({ limit: 10, offset: 0 })
// Verify response shape matches contract
expect(data).toHaveProperty('items')
expect(data).toHaveProperty('pagination')
expect(data.pagination).toHaveProperty('limit')
expect(data.pagination).toHaveProperty('offset')
expect(data.pagination).toHaveProperty('total')
if (data.items.length > 0) {
const user = data.items[0]
expect(user).toHaveProperty('id')
expect(user).toHaveProperty('email')
expect(user).toHaveProperty('name')
expect(user).toHaveProperty('created_at')
}
})
})Breaking Change Detection
Breaking changes (require version bump):
- Removing a field from response
- Changing a field's type
- Adding a required field to request
- Changing URL path
- Changing error codes
Non-breaking changes (safe):
- Adding optional field to request
- Adding field to response
- Adding new endpoint
- Adding new error code
Versioning strategy:
/api/v1/users — current stable
/api/v2/users — new version (when breaking changes needed)Keep v1 running while migrating clients to v2. Deprecate v1 with a timeline.
MSW Mocks (Frontend Development)
// src/mocks/handlers/users.ts
import { http, HttpResponse } from 'msw'
import type { User, PaginatedResponse, CreateUserRequest } from '../../api/types'
const mockUsers: User[] = [
{ id: '1', email: 'alice@test.com', name: 'Alice', created_at: '2024-01-01T00:00:00Z' },
]
export const userHandlers = [
http.get('/api/v1/users', ({ request }) => {
const url = new URL(request.url)
const limit = Number(url.searchParams.get('limit') ?? 20)
const offset = Number(url.searchParams.get('offset') ?? 0)
const items = mockUsers.slice(offset, offset + limit)
return HttpResponse.json<PaginatedResponse<User>>({
items,
pagination: { limit, offset, total: mockUsers.length },
})
}),
http.post('/api/v1/users', async ({ request }) => {
const body = await request.json() as CreateUserRequest
const newUser: User = {
id: crypto.randomUUID(),
...body,
created_at: new Date().toISOString(),
}
return HttpResponse.json(newUser, { status: 201 })
}),
]Chains
- REQUIRED: Update CLAUDE.md with API contract conventions (
claude-md) - Contract defined in:
system-designorapi-design - Backend implementation:
go-feature/py-featurewith swaggo annotations - Frontend implementation:
react-featurewith typed API client - Swagger generation:
swag initvalidates backend matches contract
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
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.

