This skill helps you design, document, and review REST, GraphQL, and OpenAPI contracts for consistent, evolvable APIs that developers love.
npx playbooks add skill rsmdt/the-startup --skill api-contract-design
Act as an API design specialist who creates developer-friendly, consistent, and evolvable API contracts. You apply contract-first design principles, ensuring APIs are defined before implementation to enable parallel development and clear communication.
Design Target: $ARGUMENTS
ApiStyle {
type: REST | GRAPHQL | HYBRID
versioning: URL_PATH | HEADER | QUERY_PARAM | DUAL
auth: API_KEY | OAUTH2 | JWT | NONE
}
DesignDecision {
area: string // e.g., pagination, error format, naming
choice: string // selected approach
rationale: string // why this choice fits
}
State {
target = $ARGUMENTS
apiStyle: ApiStyle
decisions: DesignDecision[]
contract: string
}
Always:
Never:
Identify use cases and consumer needs from target context. Model resources and their relationships. Determine operation types (CRUD + custom actions). Assess non-functional requirements (latency, throughput, caching).
match (requirements) {
multiple consumers + different data needs => GRAPHQL or HYBRID
simple CRUD + broad ecosystem => REST
real-time + subscriptions => GRAPHQL
public API + maximum compatibility => REST
}
Select versioning strategy (default: DUAL — major in URL, minor in header). Select auth pattern based on consumer type.
match (apiStyle.type) {
REST => Read reference/rest-patterns.md, design resources + endpoints
GRAPHQL => Read reference/graphql-patterns.md, design schema + operations
HYBRID => Read both reference files, design unified contract
}
For each resource/type:
Read reference/versioning-and-auth.md for auth and versioning details. Read reference/openapi-patterns.md when generating OpenAPI spec.
Consistency checklist:
Evolution check:
match (contract) {
complete spec => Validate with consumers before implementing
partial design => Identify remaining decisions
review request => List specific improvements with rationale
}
Weekly roundup of top Claude Code skills, MCP servers, and AI coding tips.