api-design

api-design is a skill for Claude Code, Codex from int2t05/engineering-skills. It costs 63 tokens per session (1,501 once invoked), scanned A, original, MIT.

A guide to defining stable interfaces between pieces of software, such as REST or GraphQL APIs, including their inputs, outputs, versions, and errors.

In plain words
What is it for?
Use it to design endpoints, module boundaries, component properties, type contracts, request and response shapes, versioning, and API error models.
Why use it?
It makes interfaces easier to use correctly and reduces accidental breakage when code, teams, or public APIs change.

Skill for Claude CodeCodex

Installs and runs on its own, but its text points at files inside its plugin — anything it tells you to read at a ${CLAUDE_PLUGIN_ROOT} path is only there once the plugin is installed. Installing the plugin gets both.

Part of the engineering-skills plugin — 47 skills, 1 agent, 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/int2t05/engineering-skills/api-design
Any agent
npx skills add int2t05/engineering-skills --skill api-design
Clone the repo
git clone --depth 1 https://github.com/int2t05/engineering-skills

Made for: Claude Code, Codex.

Or install engineering-skills, the plugin that ships this one along with the rest of its 47 skills, 1 agent, 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/int2t05/engineering-skills/api-design.svg)](https://agentmods.dev/skills/int2t05/engineering-skills/api-design)
Your own site
<a href="https://agentmods.dev/skills/int2t05/engineering-skills/api-design"><img src="https://agentmods.dev/badge/skills/int2t05/engineering-skills/api-design.svg" alt="Measured on agentmods" height="20"></a>
Per session 63 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,501 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.00063 $0.01501
Opus 5 $0.00032 $0.00750
Sonnet 5 $0.00013 $0.00300
Haiku 4.5 $0.00006 $0.00150

Measured 3d ago against content hash 94582472ad64, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, 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 3d 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/03-design/api-design/SKILL.md · 137 lines

How it starts

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

API and Interface Design

Design stable, well-documented interfaces that are hard to misuse. Good interfaces make the right thing easy and the wrong thing hard. Applies to REST APIs, GraphQL schemas, module boundaries, component props, and any surface where one piece of code talks to another.

When to use

  • Designing new REST or GraphQL endpoints
  • Defining module boundaries or contracts between teams
  • Creating component prop interfaces or type contracts
  • Establishing database schema that informs API shape
  • Changing existing public interfaces
  • Triggers on "API design", "interface design", "REST", "GraphQL", "contract", "接口设计", "API 契约", "API 设计"

Not for: system-level architecture decisions (use architecture); deep-module or codebase structure (use codebase-design).

Steps

1. Define the contract first

The contract is the spec — implementation follows. Define typed input and output schemas before writing handlers. The types ARE the documentation.

2. Apply core principles

Hyrum's Law: With enough users, all observable behaviors become de-facto contracts — including undocumented quirks, error text, timing, and ordering. Be intentional about what you expose; don't leak implementation details; plan for deprecation at design time.

The One-Version Rule: Avoid forcing consumers to choose between multiple versions. Design for a world where only one version exists at a time — extend rather than fork. Multiple versions multiply maintenance cost and create diamond dependency problems.

Addition Over Modification: Extend interfaces without breaking consumers — add optional fields, never change existing field types or remove fields. Breaking changes without versioning break consumers.

3. Pick one error strategy and use it everywhere

Every error response follows the same shape. Don't mix patterns — if some endpoints throw, others return null, and others return { error }, the consumer can't predict behavior.

interface APIError {
  error: {
    code: string;        // Machine-readable: "VALIDATION_ERROR"
    message: string;     // Human-readable: "Email is required"
    details?: unknown;   // Additional context when helpful
  };
}

Read the full file on GitHub · 137 lines

Files

What ships with it

3 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. 3d ago First seen · 137 lines · 63 tokens per session scan A 94582472ad64

Subscribe to this mod's changes

api-design is a skill published in the GitHub repository int2t05/engineering-skills (3 stars, last pushed 15d ago), licensed MIT. It adds 63 tokens to every session and 1,501 once invoked, about $0.0003 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.