Skip to content
Agentmart
Submit a tool

api-design

Design stable public interfaces — HTTP endpoints, event payloads, module boundaries, SDK-style ports — and make retried operations safe with idempotency keys.

Skill by pabloleonalcaide

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/pabloleonalcaide-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 stable public interfaces — HTTP endpoints, event payloads, module boundaries, SDK-style ports — and make retried operations safe with idempotency keys. Use when adding or changing an endpoint, a request/response or event contract, an error format, a public module interface, or any operation that can be retried (payments, webhooks, jobs, queue consumers). Invoked by /develop when the blueprint declares API contract impact.

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 stable public interfaces — HTTP endpoints, event payloads, module boundaries, SDK-style ports — and make retried operations safe with idempotency keys. Use when adding or changing an endpoint, a request/response or event contract, an error format, a public module interface, or any operation that can be retried (payments, webhooks, jobs, queue consumers). Invoked by /develop when the blueprint declares API contract impact.
License
MIT
Instructions
54 lines in SKILL.md · view on GitHub

Files (2)

  • IDEMPOTENCY.md
  • SKILL.md

SKILL.md (first lines)

# API design

Every observable behavior of an interface becomes a contract once someone depends on it
(**Hyrum's Law**). Design the contract first, change it by adding, and make every operation that
can be retried safe to retry.

## When NOT to use

- Internal functions with a single caller in the same module — that is ordinary code design.
- Choosing *where* a seam goes for testing — that is `tdd`'s interface-design guidance.

## Process

1. **Contract first.** Write the request, response, error and event shapes (as types or a
   schema) before the implementation, and get them into the blueprint. Name the consumers.
2. **One error format** across the API: a stable machine-readable `code`, a human `message`, and
   optional `details`. Consumers branch on `code`, never on `message`.
3. **Change by adding.** New optional fields, new endpoints, new event types. Renaming, retyping,
   removing a field or tightening validation is a **breaking change** → version it or run an
   expand/contract migration (`deprecation`).
4. **Validate at the edge only.** The boundary turns raw input into typed values; inner layers
   trust their types and don't re-validate.
5. **Predictable naming.** Resources as plural nouns, actions as HTTP verbs, the same name for
   the same concept everywhere (match the project glossary).
6. **Make illegal states unrepresentable.** Discriminated unions for variants (`{status:
   'paid', paidAt}` vs `{status: 'pending'}`), branded types for ids that must not be mixed.
7. **Retried operations get an idempotency key.** Any operation that a client, a queue or a
   retry policy may deliver twice — open [IDEMPOTENCY.md](IDEMPOTENCY.md) when you reach it.

## Common Rationalizations

| Rationalization | Reality |
|---|---|
| "Nobody uses that field" | You can't see every consumer. Under Hyrum's Law someone does; prove zero consumers before removing. |
| "It's a small rename, clients will adapt" | A rename is a delete plus an add. Every client breaks at once. |
| "Retries are rare, idempotency can wait" | Retries happen exactly when things go wrong — timeouts, deploys, network blips — and that's when a double charge hurts. |
| "A timestamp in the key makes it unique" | Unique per attempt, so every retry looks new. Derive the key from the intent. |

## Red Flags

- A response field removed, renamed or retyped in the diff without a version or migration plan.
- Error handling that matches on message strings.
- Validation of the same input repeated in several layers.
- An idempotency key built from `Date.now()`, a random UUID per attempt, or the request count.
- "Check if exists, then create" without a unique constraint.

## Verification

- [ ] Contract types/schema written and listed in the blueprint, with consumers named
- [ ] No breaking change, or a version/expand-contract step is planned
- [ ] Errors use the shared format with a stable `code`
- [ ] Every retryable operation has an intent-derived idempotency key and a test that sends it twice

From pabloleonalcaide/development-skills, MIT.

More from pabloleonalcaide/development-skills

Signals

Stars
1
Forks
0
Open issues
0
Last commit (this folder)
Oct 7, 2026 (22 days ago)

From GitHub (fetched Oct 24, 2026).

Details

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

More from pabloleonalcaide

Cite this page

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