Skip to content
Agentmart
Submit a tool

api-design

Design public APIs and CLIs — naming, ergonomics, versioning, error surfaces, and backward-compat discipline.

Skill by xanstomper

IndexedMIT★ 1
Write a review

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/xanstomper-api-design

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Design public APIs and CLIs — naming, ergonomics, versioning, error surfaces, and backward-compat discipline. Use when adding a public command, SDK surface, REST/JSON contract, or plugin interface. Ported from Anthropic/OpenAI API-design practice.

Use cases: documents, design, backend

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/api-design

What's inside

Skill name
api-design
Description
Design public APIs and CLIs — naming, ergonomics, versioning, error surfaces, and backward-compat discipline. Use when adding a public command, SDK surface, REST/JSON contract, or plugin interface. Ported from Anthropic/OpenAI API-design practice.
License
MIT
Instructions
38 lines in SKILL.md · view on GitHub

Files (1)

  • SKILL.md

SKILL.md (first lines)

# API Design Procedure

APIs are promises. Design for the version that ships in 2 years, not the demo next week.

## 1. Shape from the consumer's side first
- Write the ideal consumer code BEFORE the implementation. If the call site reads awkwardly, redesign — the call site is the product.
- Consistency with the sibling surface: a new CLI command follows the existing command grammar (`mochi <noun> <verb> --flag`), a new REST route follows the existing resource grammar. Surprise = defect.

## 2. Naming discipline
- Nouns for resources, verbs for operations, plain English throughout. One concept = one word everywhere (`session`, never session/job/instance mixed).
- Avoid abbreviations except universal ones (id, url). Avoid negated flags (`--no-cache` beats `--cache=false` which beats `--disable-caching`).
- Reserved for the future: every list response gets `nextCursor` from day one, every object carries `id` and timestamps, even if unused.

## 3. Error surface
- Errors are data: stable machine-readable code + human message + actionable hint. Never a bare string, never a stack trace.
- 4xx = caller's problem (fixable by changing the request), 5xx = callee's problem (retryable or reportable). Timeouts are 5xx-shaped.
- Every failure mode a consumer can hit is documented with an example response.

## 4. Versioning and compat
- Additive changes only within a version: new optional fields, new endpoints. Removing/renaming = new major version, period.
- Never repurpose an existing field's semantics — consumers have already built on it. Deprecate with a timeline: announce, warn in responses (`Sunset` header / CLI warning), then remove in the next major.
- Unknown fields: consumers (and our parsers) must ignore unknown fields — forward compatibility is a two-way contract.

## 5. Ergonomics pass
- Sensible defaults so the hello-world is one call. Required params: as few as possible, ordered by importance.
- Idempotency on mutating operations (idempotency keys or natural keys) — retries are normal in production networks.
- Dry-run/plan mode where an operation is expensive or destructive.

## 6. Verification
- Contract tests capture the public surface (snapshot of routes/flags/errors) so breakage fails CI loudly.
- A consumer walkthrough: integrate the API fresh, using only the docs. Every stumble is a doc bug or a design bug — log which.

## Pitfalls
- Leaking internals into the public shape (`error: "ECONNRESET at /src/..."`) — translate at the boundary.
- Boolean traps (`process(x, true)`), out-parameters, and 7-arg functions: wrap in an options object past 3 params.
- Shipping v1 without the escape hatch (pagination, filters): retrofitting lists is a breaking change by default.

From xanstomper/mochi, MIT.

More from xanstomper/mochi

Signals

Stars
1
Forks
2
Open issues
6
Last commit (this folder)
Oct 12, 2026 (16 days ago)
Last release
Oct 23, 2026 (5 days ago)

From GitHub (fetched Oct 24, 2026).

Details

License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from xanstomper

Cite this page

api-design skill. Agent Mart. https://agentmart.dev/skills/xanstomper-api-design (last updated 2026-10-24)