agentleFS
atuljha23atuljha23/holocron/skills/api-design/SKILL.md

api-design

Skill2 starsChanged 6 months agoMITView on GitHub

REST and GraphQL API design conventions — resource modeling, pagination, error envelopes, versioning, idempotency. Use when adding, changing, or reviewing endpoints.

We split this skill into the rules it gives an agent

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

  • 0

    Common

    Most of the 164 edited versions we read keep these.

  • 1

    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
  1. Distinctive:

    Prefer additive changes. Add fields.

    line 65
  2. Very specific:

    Observability: Every request has a requestId.

    line 90

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

REST

Resource, not action

URLs name nouns. Actions are verbs.

Good: POST /users/:id/password-reset Bad: POST /resetUserPassword?id=123

Status codes mean things

  • 200 success with body
  • 201 created (include Location)
  • 204 success, no body
  • 400 client sent something invalid (bad syntax, bad shape)
  • 401 not authenticated
  • 403 authenticated but not authorized
  • 404 resource doesn't exist (or the caller isn't allowed to know it does)
  • 409 conflict (version conflict, duplicate, precondition failed)
  • 422 semantic validation failed (body parses but rules reject)
  • 429 rate limited
  • 5xx server fault — internal detail logged, opaque to caller

Error envelope

Pick one. Use it everywhere.

{
  "error": {
    "code": "resource_not_found",
    "message": "User alice@example.com not found.",
    "requestId": "abc123"
  }
}
  • code is machine-readable, stable, lowercase_snake.
  • message is human-readable. Safe to surface.
  • requestId lets the caller tell you what went wrong without you reading prod logs.

Pagination

Cursor-based for anything you'll scale. Offset paging breaks under concurrent writes.

GET /messages?cursor=abc&limit=50
→ { items: [...], nextCursor: "xyz" }

Idempotency

Any POST that has side-effects and will be retried needs an idempotency key:

POST /payments
Idempotency-Key: <uuid-v4>

Server stores the (key → response) for a reasonable TTL. Retries return the cached response, not a second charge.

Versioning

Prefer additive changes. Add fields; don't remove or rename. When you must break, version:

  • URL (/v2/...) — simple, explicit, slightly ugly
  • Accept header (Accept: application/vnd.foo.v2+json) — prettier URLs, slightly opaque

Pick one per service. Never mix.

GraphQL

Nullability is a contract

String! says "this WILL be present". If you're not sure, it's String (nullable). A lie here cascades.

Relay-style pagination

Connections, edges, pageInfo, cursors. Don't invent your own.

One mutation per intent

updateUser(input: { name, email, password }) is three different operations glued together. Split them.

Errors as types

Return { user: User | UserNotFoundError | ValidationError } unions where it matters. Generic errors[] at the top is for transport-level fault, not business rules.

Across both

  • Typed shapes. Schemas (OpenAPI / GraphQL / proto). Generate clients from them.
  • Rate limit expensive or abuse-prone endpoints.
  • Observability. Every request has a requestId. Log it. Return it on errors. Tie logs, metrics, and traces together with it.
  • Auth at the edge — check in the handler or middleware the handler trusts. Never rely on the gateway alone.

Download now (ZIP)

  • Other versions192 projects use a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 192

    1. affaan-m/ECC★ 246ksame name
    2. authgear/authgear-server★ 2.1ksame name
    3. xu-xiang/everything-claude-code-zh★ 1.9ksame name
    4. Aaronontheweb/dotnet-skills★ 1.2ksame name
    5. epam/ai-dial-chat★ 505same name
    6. loulanyue/awesome-claude-notes★ 272same name
    7. KbWen/agentic-os★ 218same name
    8. DevelopersGlobal/ai-agent-skills★ 215same name
    9. kid-sid/claude-spellbook★ 190same name
    10. margelo/react-native-skills★ 172same name

    182 more not listed

    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.

  • Used alongsideProjects with it also use everything-claude-code, everything-claude-code-conventions 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.
    • 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

    • InfopibeSkill

      investor-materials

      Create and update pitch decks, one-pagers, investor memos, accelerator applications, financial models, and fundraising materials. Use when the user needs investor-facing documents, projections, use-of-funds tables, milestone plans, or materials that must stay internally consistent across multiple fundraising assets.

      Also in 21 projects that use this

    • CodeWithBehnamSkill

      dmux-workflows

      Multi-agent orchestration using dmux (tmux pane manager for AI agents). Patterns for parallel agent workflows across Claude Code, Codex, OpenCode, and other harnesses. Use when running multiple agent sessions in parallel or coordinating multi-agent development workflows.

      Also in 16 projects that use this

    • Indium-AI-LabsSkill

      data-pipeline-design

      Design safe ETL/ELT pipelines, data warehouse schemas, partition strategies, idempotency controls, and data quality assertions before implementation.

      Also in 3 projects that use this

    • +1 more from Infopibe
  • In this repository10 other files it gives its agents.

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

Reviews can't be read right now.

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.