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
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.
About
Use cases: documents, design, backend
Reviews
Write a reviewNo 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 twiceFrom pabloleonalcaide/development-skills, MIT.
More from pabloleonalcaide/development-skills
- 0.592score
develop
pabloleonalcaide
Orchestrates any non-trivial development or analysis task end-to-end — discovery, alignment, blueprint, registration, implementation and delivery.
SkillAFreshness: A★ 1Claude Code +9 - 0.592score
disk-cleanup
pabloleonalcaide
Reclaim local disk space safely on a development machine — leftover git worktrees, Docker leftovers from integration tests (Testcontainers containers, orphan…
SkillAFreshness: A★ 1Claude Code +9 - 0.587score
observability
pabloleonalcaide
Instrument code so production behavior is visible and diagnosable — structured logs with correlation ids, metrics, traces, symptom-based alerts and minimal…
SkillAFreshness: A★ 1Claude Code +9 - 0.587score
deprecation
pabloleonalcaide
Retire code, endpoints, fields, flags and dependencies safely, and migrate data without downtime using expand/contract.
SkillAFreshness: A★ 1Claude Code +9 - 0.587score
setup
pabloleonalcaide
Sets up an `## Agent skills` block in AGENTS.md/CLAUDE.md and `docs/agents/` so the engineering skills know this repo's issue tracker (GitHub by default, or…
SkillAFreshness: A★ 1Claude Code +9 - 0.587score
security-hardening
pabloleonalcaide
Threat-model a change and harden it before it ships — trust boundaries, authn/authz, input validation, secrets, SSRF, destructive operations, rate limits and…
SkillAFreshness: A★ 1Claude Code +9 - 0.584score
create-pr
pabloleonalcaide
Commit the current branch, push it, and open a pull request.
SkillAFreshness: A★ 1Claude Code +9 - 0.567score
diagnose
pabloleonalcaide
Disciplined diagnosis loop for hard bugs and performance regressions.
SkillAFreshness: A★ 1Claude Code +9 - 0.562score
receiving-code-review
pabloleonalcaide
Use when receiving code review feedback, before implementing suggestions, especially if feedback seems unclear or technically questionable - requires…
SkillAFreshness: A★ 1Claude Code +9 - 0.562score
grilling
pabloleonalcaide
Grill the user relentlessly about a plan or design until shared understanding — interview one decision at a time, no code until confirmed.
SkillAFreshness: A★ 1Claude Code +9 - 0.562score
tdd
pabloleonalcaide
Test-driven development with red-green-refactor loop.
SkillAFreshness: A★ 1Claude Code +9 - 0.562score
write-a-skill
pabloleonalcaide
Create new agent skills with proper structure, progressive disclosure, and bundled resources.
SkillAFreshness: A★ 1Claude Code +9
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
- Source
- GitHubgithub-graphql
More from pabloleonalcaide
- 0.592score
disk-cleanup
pabloleonalcaide
Reclaim local disk space safely on a development machine — leftover git worktrees, Docker leftovers from integration tests (Testcontainers containers, orphan…
SkillAFreshness: A★ 1Claude Code +9 - 0.592score
develop
pabloleonalcaide
Orchestrates any non-trivial development or analysis task end-to-end — discovery, alignment, blueprint, registration, implementation and delivery.
SkillAFreshness: A★ 1Claude Code +9 - 0.587score
observability
pabloleonalcaide
Instrument code so production behavior is visible and diagnosable — structured logs with correlation ids, metrics, traces, symptom-based alerts and minimal…
SkillAFreshness: A★ 1Claude Code +9 - 0.587score
deprecation
pabloleonalcaide
Retire code, endpoints, fields, flags and dependencies safely, and migrate data without downtime using expand/contract.
SkillAFreshness: A★ 1Claude Code +9 - 0.587score
security-hardening
pabloleonalcaide
Threat-model a change and harden it before it ships — trust boundaries, authn/authz, input validation, secrets, SSRF, destructive operations, rate limits and…
SkillAFreshness: A★ 1Claude Code +9 - 0.587score
setup
pabloleonalcaide
Sets up an `## Agent skills` block in AGENTS.md/CLAUDE.md and `docs/agents/` so the engineering skills know this repo's issue tracker (GitHub by default, or…
SkillAFreshness: A★ 1Claude Code +9
Cite this page
api-design skill. Agent Mart. https://agentmart.dev/skills/pabloleonalcaide-api-design (last updated 2026-10-24)