REST API Design

A guide to designing REST APIs, which are web interfaces that let software exchange data using standard web requests. It covers resource names, request methods, response codes, errors, pagination, and filtering.

In plain words
What is it for?
Use it to plan endpoint names and behavior, choose correct HTTP status codes, define error and list-response formats, and produce a specification for API consumers.
Why use it?
It prevents inconsistent endpoints and misleading responses that force every API user to add special cases. Clear rules are easier to build against and harder to break later.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/skillmedev/skills/api-design
Any agent
npx skills add SkillMedev/skills --skill api-design
Clone the repo
git clone --depth 1 https://github.com/SkillMedev/skills

Made for: Claude Code, Codex.

Per session 156 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,537 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00156 $0.01537
Opus 5 $0.00078 $0.00768
Sonnet 5 $0.00031 $0.00307
Haiku 4.5 $0.00016 $0.00154

Measured 2d ago against content hash 221e583e98a5, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

REST API Design scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/api-design/SKILL.md · 107 lines

How it starts

The opening of the file, as written. The whole thing — 107 lines — stays where its author put it; the contents beside it link to each section on GitHub.

REST API Design

APIs are products: the consumer's mental model, not your database schema, decides the shape. The costly mistake this skill prevents is shipping an inconsistent surface - mixed naming, wrong status codes, offset pagination on a growing table - that every consumer then hardcodes around, making it effectively unfixable once integrated.

Operating procedure

Work in this order. Resources come before methods because method semantics depend on what the resource is; error and pagination contracts come before the spec is written because retrofitting them breaks consumers.

Step 1: gather inputs

Collect before designing. Label any assumption as a guess.

  1. The consumers: internal services, first-party clients, or external developers. External consumers raise the consistency bar - default to external if unknown.
  2. The core nouns of the domain and which ones own which (drives nesting).
  3. Expected collection sizes and growth. A list that can exceed ~10,000 rows rules out offset pagination.
  4. Read/write ratio and latency expectations per endpoint.
  5. Auth model (affects 401 vs 403 correctness).

Step 2: name resources

  • Plural nouns: /users, /orders, /products.
  • Nest one level for ownership: /users/{id}/orders. Do not nest deeper than two levels - flatten with filters instead (/orders?user_id=... beats /users/{id}/orders/{oid}/items/{iid}).
  • No verbs in paths; the HTTP method is the verb. For genuine actions that fit no CRUD verb (e.g. sending an invoice), model a subresource POST: POST /invoices/{id}/send-attempts.
  • Consistent case: kebab-case for multi-word path segments, snake_case for JSON fields - pick once, apply everywhere.

Step 3: assign methods and status codes

  • GET: read, idempotent, no request body. 200 with body.
  • POST: create. Return 201 plus a Location header pointing at the new resource. Return the created representation in the body so the client skips a follow-up GET.
  • PUT: full replace, idempotent. Missing fields mean "clear", not "keep".
  • PATCH: partial update (JSON Merge Patch or JSON Patch - state which in the spec).
  • DELETE: remove, idempotent, returns 204. Deleting an already-deleted resource returns 204 or 404 - pick one and document it.
  • Errors: 400 for malformed input, 401 for missing/invalid credentials, 403 for valid credentials without permission, 404 for absent resources (also use 404 instead of 403 when revealing existence is a leak), 409 for state conflicts, 422 for well-formed but semantically invalid input, 429 for rate limits (with Retry-After), 500 for server faults - never expose stack traces or internal identifiers.

Read the full file on GitHub · 107 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 107 lines · 156 tokens per session scan A 221e583e98a5

Subscribe to this mod's changes

REST API Design is a skill published in the GitHub repository SkillMedev/skills (11 stars, last pushed 1mo ago), licensed MIT. It adds 156 tokens to every session and 1,537 once invoked, about $0.0008 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

webinar-funnel-builder

Designs a complete webinar funnel - registration page promise, reminder email sequence timed against typical 35-45 percent show-up rates, webinar structure with a 70 percent teach / 30 percent offer split and the pivot script, replay window and urgency rules, and the post-webinar email sequence - with a funnel-metrics…

SkillMedev/creator-studio · 180 tokens

Creator Content Calendar

Designs a sustainable publishing system for a solo creator - 3-4 content pillars, a cadence set at the creator's consistent floor, a fixed pillar rotation, a 30-day idea bank, and a monthly audit loop - delivered as a weekly calendar skeleton. Use when someone says "help me plan my content", "I keep falling off my…

SkillMedev/creator-studio · 167 tokens

Show Notes Writer

Produces complete podcast show notes from a transcript or episode outline - a standalone summary block, timestamped chapters that name what happens, screenshot-worthy key takeaways, guest bio, curated links, and keyword placement for search. Use when someone says "write show notes for this episode", "turn this…

SkillMedev/creator-studio · 146 tokens

YouTube Script Writer

Writes retention-engineered long-form YouTube scripts on a hook/body/payoff architecture - a first-30-seconds hook that survives the retention cliff, a beat-sheet body with mini-hooks and bridges, timed pattern interrupts, and a payoff that over-delivers - with B-roll and editing cues marked inline. Use when someone…

SkillMedev/creator-studio · 180 tokens

Systematic Review

Runs a PRISMA-compliant systematic review from PICO question and pre-registered protocol through search strings, two-stage screening, risk-of-bias appraisal, and GRADE-rated synthesis. Use when someone asks "run a systematic review", "build my search strategy and inclusion criteria", "screen these studies against a…

SkillMedev/academic-researcher · 123 tokens

Policy Brief

Writes a concise, evidence-based policy brief - problem, options compared on consistent criteria, and a recommendation - that a decision-maker can act on in minutes. Use when someone asks "write a policy brief", "summarize the evidence and options for this decision", "brief the minister/board/council on X", or needs a…

SkillMedev/academic-researcher · 121 tokens