api-design

api-design is a skill for Claude Code from MartinOlivero/saas-builder. It costs 118 tokens per session (1,074 once invoked), scanned A, original, MIT.

A guide for designing the routes and data formats that software uses to communicate through an API, including REST and GraphQL APIs.

In plain words
What is it for?
It is for planning endpoints, request and response shapes, errors, pagination, versioning, and the choice between REST and GraphQL.
Why use it?
It helps make API behavior consistent and predictable, so clients can use it reliably and it can change safely over time.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the saas-builder plugin — 18 skills, 1 hook shipped together

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/martinolivero/saas-builder/api-design
Any agent
npx skills add MartinOlivero/saas-builder --skill api-design
Clone the repo
git clone --depth 1 https://github.com/MartinOlivero/saas-builder

Made for: Claude Code.

Or install saas-builder, the plugin that ships this one along with the rest of its 18 skills, 1 hook.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for api-design

README.md
[![agentmods](https://agentmods.dev/badge/skills/martinolivero/saas-builder/api-design.svg)](https://agentmods.dev/skills/martinolivero/saas-builder/api-design)
Your own site
<a href="https://agentmods.dev/skills/martinolivero/saas-builder/api-design"><img src="https://agentmods.dev/badge/skills/martinolivero/saas-builder/api-design.svg" alt="Measured on agentmods" height="20"></a>
Per session 118 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,074 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.1 $0.00118 $0.01074
Opus 5 $0.00059 $0.00537
Sonnet 5 $0.00024 $0.00215
Haiku 4.5 $0.00012 $0.00107

Measured 5d ago against content hash f6d3fef6e970, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

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 5d 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 · 62 lines

How it starts

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

API Design

This skill turns "I need an endpoint" into an API that is consistent, predictable, and safe to evolve. It encodes the conventions that the best public APIs (Stripe, Microsoft, GitHub) share.

Analogy: an API is the menu of a restaurant. A good menu is consistent — every dish described the same way, prices where you expect, no surprises. A messy menu makes every order a negotiation.

Discovery (max 3 questions, only if unknown)

  1. Who consumes this — your own React SPA only, or also mobile / partners / the public?
  2. Is it mostly simple CRUD, or deeply nested reads across many relations?
  3. Is it public-facing (needs versioning + stability) or internal?

Step 1 — REST vs GraphQL (decide first)

Default to REST. Reach for GraphQL only when: clients need flexible, deeply nested reads across many relations; you have multiple divergent clients (web + mobile + partners); or you're composing several backend services. For a single React SPA on one Postgres DB, REST (or tRPC for end-to-end TS types) is simpler and cacheable.

If you do choose GraphQL:

  • Solve N+1 from day one with DataLoader (batch + cache per request).
  • Design the schema around the domain graph, not DB tables.
  • Paginate every list field (Relay-style edges/node/pageInfo); enforce depth/complexity limits.
  • Mutations return the mutated object so clients update cache without a refetch.

Step 2 — REST conventions (the defaults)

  • Resources are plural nouns: /invoices, /invoices/{id}/lines. Verbs are HTTP methods, not paths. Non-CRUD actions: /invoices/{id}:send.
  • Version from day one: URI versioning /v1/..., even with only a v1.
  • Cursor-based pagination by default (opaque cursor + has_more), not offset — stays consistent on insert, avoids slow OFFSET scans. Default page 25, max 100.
  • One consistent error envelope with the correct HTTP status:
    { "error": { "type": "validation_error", "code": "invalid_email", "message": "…", "param": "email" } }
    
    Never return 200 on failure.
  • Status codes: 201 + Location on create, 204 on delete, 409 conflict, 422 validation, 429 + Retry-After rate limit.
  • Idempotency: require an Idempotency-Key header on unsafe POSTs (payments, signups). Store key→response for 24h; replay returns the original — no double-charge on retry. GET/PUT/DELETE are idempotent by spec.
  • Consistency: ISO-8601 UTC timestamps, one field-casing convention (snake_case or camelCase) across the whole API.
  • Filtering over endpoint sprawl: ?status=open&fields=id,total instead of a new endpoint per view.

Read the full file on GitHub · 62 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. 5d ago First seen · 62 lines · 118 tokens per session scan A f6d3fef6e970

Subscribe to this mod's changes

api-design is a skill published in the GitHub repository MartinOlivero/saas-builder (2 stars, last pushed 18d ago), licensed MIT. It adds 118 tokens to every session and 1,074 once invoked, about $0.0006 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-31.