api-design-principles

api-design-principles is a skill for Claude Code, Codex from orlando-japan/claude-code-setting. It costs 36 tokens per session (850 once invoked), scanned A, original, MIT.

Guidance for designing APIs, the interfaces that software uses to communicate with other software. It covers consistent naming, safe defaults, clear errors, and behavior that remains manageable as the API changes.

In plain words
What is it for?
Use it when adding or changing HTTP, gRPC, or software-development-kit interfaces used by other code or users.
Why use it?
It helps prevent difficult-to-fix interface decisions and makes APIs easier for current and future callers to understand.

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/orlando-japan/claude-code-setting/api-design-principles
Any agent
npx skills add orlando-japan/claude-code-setting --skill api-design-principles
Clone the repo
git clone --depth 1 https://github.com/orlando-japan/claude-code-setting

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-principles

README.md
[![agentmods](https://agentmods.dev/badge/skills/orlando-japan/claude-code-setting/api-design-principles.svg)](https://agentmods.dev/skills/orlando-japan/claude-code-setting/api-design-principles)
Your own site
<a href="https://agentmods.dev/skills/orlando-japan/claude-code-setting/api-design-principles"><img src="https://agentmods.dev/badge/skills/orlando-japan/claude-code-setting/api-design-principles.svg" alt="Measured on agentmods" height="20"></a>
Per session 36 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 850 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.00036 $0.00850
Opus 5 $0.00018 $0.00425
Sonnet 5 $0.00007 $0.00170
Haiku 4.5 $0.00004 $0.00085

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

Security

Grade A, and why

api-design-principles 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.

templates/extra/skills/api-design-principles/SKILL.md · 86 lines

How it starts

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

API design principles

APIs are contracts. Contracts are expensive to change. Design them once, carefully.

The core principles

Consistency beats cleverness

If every other endpoint is POST /resource, don't invent PUT /resource/create because it feels more REST-ful. Future callers learn one pattern; every deviation costs them.

Make the easy path the correct path

If the right behavior requires a flag, users won't find it. Defaults must be correct. Dangerous behaviors must be opt-in and verbose.

Names tell the whole story

  • GET /users/:id — obvious.
  • POST /users/:id/orders — obvious.
  • POST /users/:id/block — obvious.
  • POST /do-thing — never.
  • POST /api/v2/users/:id?action=block — no, make it an endpoint.

Verbs in paths are fine when REST's resource model doesn't fit. Don't contort.

Errors are part of the API

  • Structured. { "error": { "code": "not_found", "message": "User 42 does not exist" } }.
  • Stable codes. Callers will branch on code. Don't rename it.
  • No stack traces in production responses.
  • HTTP status matches semantics. 400 ≠ 404 ≠ 422. Don't return 200 with an error body.

Idempotency

Mutations that might be retried (creates especially) should accept an idempotency key and dedupe server-side. Otherwise, retries create duplicates and you'll find out on an incident.

Pagination

  • Every list endpoint gets pagination from day one. Adding it later breaks callers.
  • Cursor-based beats offset-based for large datasets (stable under writes).
  • Max page size enforced server-side. ?limit=1000000 must be clamped or rejected.

Versioning

  • Major version in the URL (/v1/, /v2/) for external APIs. Clean, visible, routable.
  • No implicit breaking changes. Adding a field to responses = safe. Removing or renaming = breaking → new version.
  • Deprecation has a date. "Deprecated in v1" with no sunset date stays forever.

Backwards compatibility

For public APIs, assume someone will call you wrong. Be liberal in what you accept, strict in what you return.

Read the full file on GitHub · 86 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 · 86 lines · 36 tokens per session scan A a7f1f50c6762

Subscribe to this mod's changes

api-design-principles is a skill published in the GitHub repository orlando-japan/claude-code-setting (2 stars, last pushed 3mo ago), licensed MIT. It adds 36 tokens to every session and 850 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-31.