| name | api-design |
| description | Use when the user says "design this API", "API design for X", "define the contract for Y", or is introducing a new REST / GraphQL / webhook surface. Documents key design decisions in `docs/api/<topic>-design.md` first, then generates the formal OpenAPI/GraphQL/AsyncAPI spec. |
| version | 1.0.0 |
| source | haac-aikit |
| license | MIT |
| allowed-tools | ["Read","Write","Edit","Grep","Glob"] |
When to use
Explicit invocation only: "design this API", "API design for X", "define the contract for Y"
Works standalone or after the software-architect skill has defined the broader system shape.
Phase 1 ā Decisions Doc
Document key design decisions before writing any spec. Save to docs/api/<topic>-design.md.
REST
ā” Resource naming ā nouns, plural, nested vs. flat hierarchy
ā” Verb mapping ā which operations map to which HTTP methods
ā” Error shape ā consistent envelope (code, message, details)
ā” Versioning strategy ā URL path (/v1/) vs. header vs. none
ā” Pagination ā cursor vs. offset, response envelope shape
GraphQL
ā” Schema-first vs. code-first
ā” Query depth limits and complexity rules
ā” Mutation naming ā verbObject (createUser) vs. objectVerb (userCreate)
ā” Error handling ā errors array vs. union types
ā” Subscription scope ā what warrants real-time vs. polling
Events / Webhooks
ā” Event naming ā past tense (user.created, order.shipped)
ā” Envelope shape ā id, type, timestamp, data, version
ā” Delivery guarantees ā at-least-once vs. exactly-once
ā” Retry and idempotency strategy
ā” Versioning ā how breaking changes are signaled to consumers
Phase 2 ā Formal Spec
Generate the formal spec from the committed decisions doc.
| Style | Output file |
|---|
| REST | docs/api/<topic>.openapi.yaml |
| GraphQL | docs/api/<topic>.graphql |
| Events | docs/api/<topic>.asyncapi.yaml |
Commit the spec file after the decisions doc is committed.
Anti-patterns to avoid
- Writing the spec before the decisions doc ā spec-driven design works backwards from format, not intent
- Mixing API styles in one surface without documenting why
- No versioning strategy ā every API will need one eventually; decide now
- Inconsistent error shapes across endpoints ā consumers have to handle every variation
- Skipping pagination design for list endpoints ā retrofitting pagination is always a breaking change