agentleFS
a365ngaya365ngay/CogniRouter/skills/senior-api-design/SKILL.md

senior-api-design

Skill2 starsChanged 5 days agoMITView on GitHub

Use when designing, reviewing, documenting, or evolving API contracts for REST, GraphQL, gRPC, webhooks, or events, including resource modeling, naming, HTTP methods and status codes, error formats, pagination, filtering, idempotency, versioning and deprecation, authentication, rate limits, or OpenAPI/AsyncAPI specs.

The file

We split this skill into the rules it gives an agent

4 rules. About 0 are common, 4 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈4

    Distinctive · estimate

    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:

    Read existing API conventions (naming, casing, error format, pagination, auth, versioning) and any OpenAPI, GraphQL schema, or proto files.

    line 14
  2. Distinctive:

    Treat any change to a published contract as potentially breaking until proven otherwise.

    line 16
  3. Distinctive:

    Use HTTP methods and status codes by their semantics (201 with Location on create, 204 on empty success, 400/422 validation, 401 vs 403, …

    line 21
  4. Distinctive:

    Keep the spec (OpenAPI, schema, proto) in sync with the implementation and validate it with the project's linter (Spectral, buf, …

    line 30

≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “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

Senior API Design

Role

Design APIs that are consistent, hard to misuse, evolvable without breaking clients, and documented as a contract.

Before Designing

  1. Read existing API conventions (naming, casing, error format, pagination, auth, versioning) and any OpenAPI, GraphQL schema, or proto files.
  2. Identify consumers, their use cases, expected volume, and compatibility requirements.
  3. Treat any change to a published contract as potentially breaking until proven otherwise.

Design Rules

  • Model resources and operations from consumer use cases; use consistent nouns, casing, and identifiers across the API.
  • Use HTTP methods and status codes by their semantics (201 with Location on create, 204 on empty success, 400/422 validation, 401 vs 403, 404, 409 conflict, 429 rate limit). Use one documented error format (for example RFC 9457 problem details) with machine-readable codes.
  • Paginate every list (cursor-based for large or changing sets), with bounded page sizes and documented filtering and sorting.
  • Make unsafe operations safe to retry with idempotency keys; make webhooks signed, retried with backoff, and idempotent for receivers.
  • Evolve additively: new optional fields and endpoints are compatible; removing or renaming fields, changing types, or tightening validation is breaking and needs versioning and a deprecation period.
  • Specify authentication, authorization scopes, rate limits, and timeouts. Never put secrets or personal data in URLs.
  • For GraphQL, bound query depth and cost and avoid N+1 resolvers; for gRPC, never reuse or renumber proto field numbers.

Verification

Keep the spec (OpenAPI, schema, proto) in sync with the implementation and validate it with the project's linter (Spectral, buf, graphql-inspector). Add contract or API tests for status codes, error bodies, and pagination.

Review Checklist

  • Is the contract consistent with the rest of the API?
  • Is every change backward compatible, or versioned with a deprecation plan?
  • Are errors, pagination, and idempotency defined?
  • Is the spec accurate and validated?

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.