# API Design — Contract-First REST, Errors & Versioning

> Contract-first HTTP API design and review: resources, status codes, pagination, errors, idempotency, versioning.

API Design — Contract-First REST, Errors & Versioning is a free AI agent skill on Agensi by Cristhian Zanforlin Lousa, in APIs & Backend. It loads into your AI agent through the Agensi MCP server, always in its latest approved version.

- Price: Free
- Creator: [Cristhian Zanforlin Lousa](https://www.agensi.io/creators/cristhian-zanforlin-lousa)
- Category: [APIs & Backend](https://www.agensi.io/skills/apis-backend)
- Uses: 2
- Version: 1.1
- Last updated: 2026-11-25
- Security: scan passed (2026-11-25); every new listing is also reviewed by a person
- Listing: https://www.agensi.io/skills/api-design-contract-first-rest-errors-versioning
- Tags: api, security, rest, openapi, backend, api-security, versioning, idempotency

## About this skill

**API Design** is a workflow skill for designing a new API or reviewing a change to one. It treats the API as a contract that has to keep evolving without breaking the clients that already depend on it.

**Problems it solves**
- Verbs in paths (`POST /createUser`), `200 OK` with an error in the body, and casing that changes from one endpoint to the next.
- List endpoints that return everything, and pagination added later in a way that silently breaks clients.
- POST requests that create duplicates when a client retries after a timeout.
- Missing object-level authorization (BOLA, OWASP API #1), secrets in URLs, and stack traces in error responses.

**How it works.** It is an 11-step workflow, and each step ends with a check you can verify. You choose the protocol on purpose (REST, GraphQL or gRPC), write the OpenAPI spec before the code, model resources as nouns, use HTTP methods and status codes as specified, and classify every change as additive or breaking. Errors use RFC 9457 `problem+json` with a stable `code`. Every list is paginated by cursor from day one. Writes are safe to retry with `Idempotency-Key` and `ETag`/`If-Match`. Security is on by default. The skill also lists anti-patterns to reject on sight.

**References, loaded only when needed**
- `rest-conventions.md`: naming, methods, status codes, pagination, filtering, caching.
- `versioning-and-compatibility.md`: versioning strategies, additive vs breaking changes, deprecation with `Deprecation`/`Sunset` headers.
- `errors-idempotency-concurrency.md`: problem+json, idempotency keys, optimistic concurrency, retries, long-running operations, webhooks.
- `security.md`: TLS, OAuth2/OIDC, BOLA/BFLA, mass assignment, rate limiting, CORS.

**When it triggers.** It activates on tasks that touch an API: adding an endpoint, choosing a status code, paginating, versioning, modeling errors, webhooks or OpenAPI. It reads a project `learnings/` folder first, and your own conventions there override the defaults.

Free and MIT-licensed. Part of the claude-skills-czl collection.

**Source on GitHub:** [this skill](https://github.com/Cristhianzl/claude-skills-czl/tree/main/configs/agnostic/skills/api-design) · [full repository](https://github.com/Cristhianzl/claude-skills-czl)

## Known limitations

Workflow and checklists, not a linter: it recommends a spec linter such as Spectral but does not run one itself. The detailed conventions target HTTP/REST; for GraphQL and gRPC it covers the protocol choice and the general principles only. Project conventions placed in learnings/ override its defaults.

## How to use this skill

1. Connect your AI agent to Agensi once: add the MCP server https://mcp.agensi.io/mcp/auth and sign in with your Agensi account (OAuth, no API key). Steps for Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and other agents: https://www.agensi.io/docs/mcp-setup
2. Ask your agent: "Use the API Design — Contract-First REST, Errors & Versioning skill from Agensi" and describe your task.
3. Your agent loads the skill from Agensi when it needs it. Nothing is downloaded.

## Frequently asked questions

### Does it work outside Claude Code?

Yes. It is a plain SKILL.md with Markdown references, so any agent that supports the SKILL.md format can load it. It was built and tested mainly on Claude Code.

### Does it change my code or run anything?

In a review it only reads files and reports findings. When you ask it to design or implement an endpoint, it writes the spec and code you asked for. It does not need to run shell commands.

### How is it triggered?

Automatically, when the task touches an API: endpoints, routes, status codes, pagination, versioning, webhooks or OpenAPI. You can also ask for it by name, for example "use api-design to review this spec".

### Can it follow my team's conventions instead of the defaults?

Yes. Put a short Markdown file in the skill's `learnings/` folder, for example "we version with a date header". Learnings override the defaults, and the skill tells you when one applies.

### How do I install it?

Unzip it into `~/.claude/skills/` to use it in every project, or into your project's `.claude/skills/` to use it in that repo only. The folder must stay named `api-design/` with `SKILL.md` at its root.

---

Source: [Agensi](https://www.agensi.io), the marketplace of skills for AI agents. Any MCP-compatible agent (Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and more) connects at https://mcp.agensi.io/mcp/auth and signs in with an Agensi account; setup for every agent: https://www.agensi.io/docs/mcp-setup. Append .md to any skill, guide or docs address on agensi.io for its markdown version.
