agentleFS
TJM-NZTJM-NZ/claude-skills/api-design/SKILL.md

api-design

Skill0 starsChanged 9 days agoMITView on GitHub

API design and review - starts from who consumes the API and what they must be able to rely on, then produces a spec for approval (resources, methods, status codes, response and error shapes, pagination, idempotency, concurrency, versioning and deprecation, authorization of objects and properties). Reviews an existing API against the same rules. REST/HTTP first, with a guide to when another style fits. No code until approved.

192 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use db-design, everything-claude-code and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • yuexueyuSkill

    db-design

    数据库工程师技能 - Schema设计、索引优化、并发安全、数据库审计。当你涉及数据库表/字段/索引/SQL/迁移/MCP数据库操作、建表改表、写查询时必须使用此技能。即使用户只是说"加个字段"或"查下数据",也应触发。

    Also in 4 projects that use this

  • InfopibeSkill

    everything-claude-code

    Also in 9 projects that use this

  • mryeastcodeSkill

    everything-claude-code-conventions

    Development conventions and patterns for everything-claude-code. JavaScript project with conventional commits.

    Also in 8 projects that use this

  • tpavanipradeepSkill

    nextjs-turbopack

    Next.js 16+ and Turbopack — incremental bundling, FS caching, dev speed, and when to use Turbopack vs webpack.

    Also in 15 projects that use this

  • Indium-AI-LabsSkill

    data-pipeline-design

    Design batch or incremental ETL and ELT pipelines and warehouse models: grain, partitioning, idempotent loads, late-arriving data, data quality tests, PII controls, and cost monitoring, before building them. Use when adding or changing a dbt model, warehouse table, scheduled transformation, or ingestion job. Not for transactional schema design (use the database-design skill) or event-sourced stores (use the event-sourcing-architecture skill).

    Also in 3 projects that use this

  • thejordanleopoldSkill

    third-party-integration

    Use when integrating with external APIs, payment processors (Stripe), webhooks, or third-party services. Use when implementing API clients with authentication and rate limiting, handling webhooks with signature verification and idempotency, writing contract tests for external services, or isolating third-party dependencies behind adapters. Triggers: \"Stripe\", \"payment integration\", \"webhook\", \"third-party API\", \"external service\", \"API client\", \"integrate with\", \"signature verification\", \"idempotency key\".

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

1 rule. 0 are common, 1 is distinctive, and 0 are very specific to this project.

  • 0

    Common

    Most of the 166 edited versions we read keep these.

  • 1

    Distinctive

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Consumers first: Ask who calls this and how they recover from failure before naming a single path.

    line 78

“Common” is measured: kept by at least 6 in 10 of the 166 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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

API designer. An API is a promise to people you can't easily call and ask to change. Design for the consumer's worst day (a timeout mid-request, a retry, a page that shifts, a field that changes type) and for the day you must change it. Produce a spec the user can approve, or a review of what exists. Write no implementation code.

Scope: resource and operation design, contracts, errors, pagination, idempotency and concurrency, versioning and deprecation, webhooks and async operations, object- and property-level authorization rules. Not in scope: login, sessions and roles are auth-design; request validation internals are data-validation; exploit-level review is security-audit; retries and timeouts inside the service are resilience. State the rule an API needs and hand off the rest.

Workflow

  1. Mode. New design, or review of an existing API (routes exist in the repo or an OpenAPI file is provided). Review mode is read-only: map what exists, then compare it to the rules below.
  2. Context. Load references/method.md. Establish who consumes the API (own frontend, partners, the public, other services), how long clients live (a web app redeploys with the server; a mobile app or partner integration does not), and what a failed or repeated call costs (money, data, a user's trust).
  3. Detect. In review mode, glob for route definitions, OpenAPI/Swagger/AsyncAPI/GraphQL schema files and API tests (references/frameworks.md lists where frameworks keep them). Build an endpoint inventory: method, path, auth, request and response schema, status codes, pagination, side effects. The inventory is the artefact the review works from.
  4. Scope. Offer: Full (all modules) | Quick (resources, contracts, errors) | Targeted (a module or one endpoint family). Skip if specified.
  5. Design or analyse. Load the chosen modules. For a new design, make each decision explicit with its reason; for a review, cite the endpoint and the rule.
  6. Output in the format below, then wait for approval. Offer an OpenAPI 3.1 file afterwards; writing it needs the user's go-ahead.
ModuleCovers
method.mdConsumer-first discovery, review workflow, spec template, evidence rules
resources.mdResource modelling, naming, method semantics, status codes, IDs, when REST is the wrong tool
contracts.mdResponse shapes, field conventions (time, money, enums, null), errors (RFC 9457), pagination, filtering, partial updates
reliability.mdIdempotency keys, optimistic concurrency, rate limits, long-running operations, webhooks, caching
evolution.mdBreaking vs compatible changes, versioning options, deprecation and sunset, OpenAPI as the contract
api-security.mdObject-level and property-level authorization, mass assignment, resource limits, what the spec must state
frameworks.mdOptional: where routes and schemas live, OpenAPI tooling, per-framework notes

Confidence (review mode)

LevelMeaning
ConfirmedThe behaviour is visible in the code or schema and breaks a consumer promise
LikelyPattern suggests it; middleware, a gateway or a generated layer may cover it. Name the check
PossibleDepends on consumers or traffic not visible. Goes under "Needs verification"

Severity (review mode)

  • High: consumers can lose data or money (non-idempotent create with retries, lost updates), or a client can read or write what it must not (object/property authorization).
  • Medium: inconsistent or unsafe contracts (mixed error shapes, unbounded lists, ambiguous status codes), no evolution path.
  • Low: naming and convention drift. List in one line.

Breaking-change risk is its own flag: a finding that cannot be fixed without breaking clients is marked needs migration and the fix includes the migration path.

Output format

# API Design: [name]   (design | review)

Consumers: [...] | Style: [REST/...] | Auth: [defer to auth-design | ...]
Decisions: [n] | Open questions: [n]

## Decisions
| Area | Decision | Reason | Alternative rejected |

## Endpoint table
| Method | Path | Auth / who | Request | Success | Errors | Idempotent / safe to retry |

## Shapes
[one example per resource, one error example, one list example]

## Rules the whole API follows
[time, money, IDs, null/omitted, pagination, errors, versioning, rate limits]

## Findings (review mode)
### [Severity] [Title]   (Confirmed | Likely | Possible)
Where: METHOD /path or file:line
Breaks: what a consumer relies on
Fix: ...   (needs migration: path)

## Open questions / needs approval

Principles

  • Consumers first. Ask who calls this and how they recover from failure before naming a single path.
  • Every convention is a choice with a reason. Rules like "plural nouns" or "ISO dates" are defaults; say what is chosen and why, then apply it everywhere. Consistency beats the "right" answer.
  • Safe to retry. Any operation a client may repeat must say what happens the second time.
  • Authorization is not obscurity. Opaque IDs help, but every object and property access is checked server-side (api-security.md).
  • Additive by default. Design so that the next change doesn't break anyone, and decide how you will say goodbye to things.
  • Cite standards accurately. HTTP semantics are RFC 9110, problem details RFC 9457, deprecation RFC 9745; drafts (idempotency keys, rate-limit headers) are named as drafts.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.