api-design

api-design is a skill for Claude Code, Codex from majiayu000/spellbook. It costs 42 tokens per session (2,233 once invoked), scanned A, original, MIT.

A guide to designing REST, GraphQL, and gRPC APIs, which are different ways for software systems to communicate. It covers API contracts, versioning, pagination, errors, and streaming data.

In plain words
What is it for?
Use it to choose an API style, define endpoints or schemas, handle changes over time, and design data-fetching or real-time interfaces.
Why use it?
It helps teams make APIs predictable for the clients and services that depend on them.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

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

Made for: Claude Code, Codex.

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/majiayu000/spellbook/api-design.svg)](https://agentmods.dev/skills/majiayu000/spellbook/api-design)
Your own site
<a href="https://agentmods.dev/skills/majiayu000/spellbook/api-design"><img src="https://agentmods.dev/badge/skills/majiayu000/spellbook/api-design.svg" alt="Measured on agentmods" height="20"></a>
Per session 42 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,233 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.00042 $0.02233
Opus 5 $0.00021 $0.01117
Sonnet 5 $0.00008 $0.00447
Haiku 4.5 $0.00004 $0.00223

Measured 6d ago against content hash 36bcb620e85d, 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 6d 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 · 398 lines

How it starts

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

API Design

Core Principles

  • Contract-First — Define API spec before implementation
  • OpenAPI 3.2 — Use OpenAPI for REST API documentation
  • URL Versioning — Version in path /v1/, with Sunset headers
  • Idempotency — PUT/DELETE must be idempotent, POST uses Idempotency-Key
  • Cursor Pagination — Avoid offset-based pagination
  • RFC 7807 Errors — Standard Problem Details format
  • No backwards compatibility — Delete, don't deprecate

Quick Reference

When to Use What

Scenario Choice Reason
Public API / MVP REST Simple, universal, easy debugging
Frontend-driven / Mobile GraphQL Fetch exactly what you need
Microservices internal gRPC High performance, strong typing
Real-time data gRPC / GraphQL Subscriptions Bidirectional streaming

REST API Design

Resource Naming

# Good
GET  /users              # List users
GET  /users/123          # Get user
POST /users              # Create user
PUT  /users/123          # Replace user
PATCH /users/123         # Update user
DELETE /users/123        # Delete user

# Nested resources
GET /users/123/orders    # User's orders

# Actions (when CRUD doesn't fit)
POST /users/123/activate # Action on resource

# Query parameters for filtering
GET /users?status=active&role=admin&limit=20

HTTP Methods

Method Purpose Idempotent Safe
GET Read Yes Yes
POST Create No No
PUT Replace Yes No
PATCH Update No No
DELETE Remove Yes No

Status Codes

# Success
200 OK              - Successful GET/PUT/PATCH
201 Created         - Successful POST (include Location header)
204 No Content      - Successful DELETE

# Client Errors
400 Bad Request     - Malformed request syntax
401 Unauthorized    - Missing/invalid authentication
403 Forbidden       - Authenticated but not authorized
404 Not Found       - Resource doesn't exist
409 Conflict        - Duplicate/conflict (e.g., unique constraint)
422 Unprocessable   - Validation failed
429 Too Many        - Rate limited

# Server Errors
500 Internal Error  - Unexpected server error
503 Unavailable     - Service temporarily down

Read the full file on GitHub · 398 lines

Files

What ships with it

7 files 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. 6d ago First seen · 398 lines · 42 tokens per session scan A 36bcb620e85d

Subscribe to this mod's changes

api-design is a skill published in the GitHub repository majiayu000/spellbook (272 stars, last pushed yesterday), licensed MIT. It adds 42 tokens to every session and 2,233 once invoked, about $0.0002 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

cao-session-management

Interact with CAO (CLI Agent Orchestrator) — launch multi-agent sessions, check status, send follow-up instructions, unblock stuck terminals, or shut down sessions. Use when working with CAO sessions in any capacity.

awslabs/cli-agent-orchestrator · 49 tokens

skill0

Root index of x-cmd skill0 sub-skills. Defines the OKR-style agent workflow (goal → rule-verified results → execute), skill discovery, and agent tooling preferences. Style: principle-first, concise, delegate specifics to authoritative external sources.

x-cmd/x-cmd · 54 tokens

prompt-proximity-architecture

Turn an approved measurement charter, ICPs, and buyer jobs into a budget-aware prompt coverage blueprint across proximity bands, aided status, information acts, journey states, roles, locales, evidence grades, partitions, and measurement lanes. Use before prompt wording to define required, optional, and prohibited…

elvisun/newsjack · 67 tokens

workflow

Skill "workflow" from zhinkgit/embeddedskills, covering workflow 编排层, 命令, 配置说明, 配置结构 and 参数解析顺序.

zhinkgit/embeddedskills · 88 tokens

output-dev-workflow-function

Create workflow.ts files for Output SDK workflows. Use when defining workflow functions, orchestrating steps, or fixing workflow structure issues.

growthxai/output · 31 tokens

pneuma-session

Rewrite the active Pneuma session's UI title + one-line summary so the launcher and ProjectPanel rows reflect what the session is actually about. Use this skill whenever the user asks to "整理 / 概括 / refresh / re-title / summarize this session", whenever the conversation has produced substantive work and the default…

pandazki/pneuma-skills · 127 tokens