Skip to content
Back to skills

Api Contract

ASecurity

Format for contracts/api.md, the single source of truth between frontend and backend. The architect writes it. Everyone else reads it.

  • 2 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added December 3, 2026
ai-agentsgoapifrontendbackend

Works with

  • api

Security analysis

A100/100

Scanned December 3, 2026

npx -y skills add sayeed1999/aidlc-agent-crew --skill api-contract --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Api Contract?

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

Security grade badge for Api Contract
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/sayeed1999-api-contract/badge)](https://www.skillsdirectory.com/skills/sayeed1999-api-contract)

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: api-contract
description: Format for contracts/api.md, the single source of truth between frontend and backend. The architect writes it. Everyone else reads it.
---

# api-contract

Output: `contracts/api.md`. Used by the architect.

## Steps
### 1. Check an API is needed
- If no approved requirement needs an API, do not write the file. The architecture sets the backend root to `none`.

### 2. Write the header
- Use the Header format below. Naming follows `skills/stack-defaults` unless the architecture says otherwise.

### 3. Write the endpoints
- One block per endpoint, in the Endpoint format below.
- Every approved requirement that needs an API has at least one endpoint.
- For chat or AI endpoints: define the HTTP endpoint shape here (request body, response body). The LLM tool definitions and AI-specific behavior go in `contracts/ai.md`.
- Skip `[DEPRECATED]` requirements.

### 4. Check it
- Every endpoint lists its R-IDs.
- Every field has a type, required or optional, and rules.
- Every response has the exact JSON shape and status code.
- Every endpoint lists its error cases.

## Format: header
```
# API Contract
- Base URL: <from architecture>
- Auth: <for example: Bearer token in the Authorization header>
- Content type: application/json
- Naming: snake_case
- Version: v1

## Error format (all errors)
{ "error": { "code": "STRING_CODE", "message": "human text", "details": [] } }

## Common errors
- 400 VALIDATION_ERROR: request breaks the contract
- 401 UNAUTHENTICATED: missing or invalid token
- 403 FORBIDDEN: not allowed
- 404 NOT_FOUND
- 500 INTERNAL_ERROR

## GET /health
- Auth: none
- Success: 200 { "status": "ok" }
```

## Format: endpoint
```
### POST /v1/auth/signup
- R-IDs: R-01
- Auth: none
- Request body:
  - email: string, required, valid email
  - password: string, required, min 8 chars
- Success: 201
  { "id": "string", "email": "string", "token": "string" }
- Errors:
  - 409 EMAIL_TAKEN: email already exists
  - 400 VALIDATION_ERROR: invalid field
```

## Changing a contract
- Only the architect edits it.
- Under a changed endpoint add `Changed: <date> <reason>`.
- If the endpoint is built or being built, write a handoff to each affected engineer.

## MUST
- Use one naming style everywhere.
- Use the common error format for every error.
- Keep it plain markdown.

## NEVER
- Add an endpoint without an approved requirement.
- Use OpenAPI, unless the architecture says so.

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.