api-design

api-design is a skill for Claude Code from MartinOlivero/saas-builder. It costs 118 tokens per session (1,312 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 — 22 skills, 1 hook shipped together

Good fit It is for planning endpoints, request and response shapes, errors, pagination, versioning, and the choice between REST and GraphQL.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/martinolivero/saas-builder/api-design
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.

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 22 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/github.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/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for api-design

Your own site · 80×15
<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="Reviewed on agentmods" width="80" 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,312 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.01312
Opus 5.5 $0.00047 $0.00525
Sonnet 5.5 $0.00024 $0.00262
Haiku 4.5 $0.00012 $0.00131

Measured 15d ago against content hash 5231457a449f, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, 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 15d 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 · 79 lines

How it starts

The opening of the file, as written. The whole thing — 79 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 · 79 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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. 15d ago Changed · +17 lines 5231457a449f
  2. 1mo 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 (4 stars, last pushed 11d ago), licensed MIT. It adds 118 tokens to every session and 1,312 once invoked, about $0.0005 per session on Opus 5.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.

Related

Other skills, from other repositories

architecture-paradigm-microkernel

Applies microkernel architecture with minimal core and plugin extensibility. Use when building platforms where third parties extend core functionality.

athola/claude-night-market · 32 tokens

plugin-system

Generic plugin system for Python applications. Auto-discovery, validation, fault tolerance. Zero dependencies (Python stdlib only).

ellmos-ai/skills · 27 tokens

saas-migration-audit

Use when analyzing an existing project for migration feasibility to the canonical SaaS stack (Turborepo, Next.js, tRPC, Drizzle, Auth.js, Stripe, PageShell). Triggers on: migrar projeto, migration audit, avaliar migração, stack audit, comparar stack, viabilidade de migração, analisar projeto existente, modernizar…

parisgroup-ai/imersao-ia-setup · 90 tokens

multi-tenancy

Multi-tenant architecture patterns: row-level, schema-level, database-level isolation and tenant routing.

camilooscargbaptista/cto-toolkit · 22 tokens

moai-ref-api-patterns

REST/GraphQL API design patterns, error handling conventions, and input validation reference for backend development. Agent-extending skill that amplifies backend domain work (spawned via Agent(general-purpose) with backend instructions) with production-grade API patterns. Use when designing APIs, implementing…

modu-ai/moai-adk · 85 tokens

flow-next-impl-review

Carmack-level implementation review of changes via the configured backend. Use when asked to review code or a diff in a flow-next repo.

gmickel/flow-next · 34 tokens