api-design-principles · wshobson — Claude Code skill for API design
Use this skill to plan or review REST and GraphQL APIs. It helps when writing a specification or setting API conventions for a team.
/plugin marketplace add wshobson/agents
/plugin install backend-development@claude-code-workflowsWhat api-design-principles does
The skill covers REST resources and HTTP methods, GraphQL schemas, API versioning, and common design pitfalls. Its guidance includes pagination, status codes, rate limits, and documentation. For GraphQL, it also addresses N+1 queries and structured mutation errors.
More patterns and worked examples are in references/details.md; the skill points there when its core guidance is not enough. It suits developers making API design decisions or reviewing specifications. If you need generated implementation code or automated code checks, this skill alone is not the right tool.
What it helps with
- design REST resources and choose HTTP methods
- compare API versioning approaches
- review a GraphQL schema and its operations
- spot pagination and error-format issues
- set API design conventions for a team
Example prompts for the agent
- Design a REST API for users and orders with pagination and versioning.
- Review this GraphQL schema for N+1 risks and propose structured mutation errors.
- Draft API conventions for resource names and HTTP methods in this project.
How to install api-design-principles
1Plugin marketplace
/plugin marketplace add wshobson/agents/plugin install backend-development@claude-code-workflowsThis installs the whole backend-development plugin with all its skills
2Skills CLI (Vercel)
npx skills add wshobson/agents --skill api-design-principles -a claude-code3Manually: put the files in place
~/.claude/skills/api-design-principles/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/api-design-principles/
1Skills CLI (Vercel)
npx skills add wshobson/agents --skill api-design-principles -a codex2Manually: put the files in place
.agents/skills/api-design-principles/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add wshobson/agents --skill api-design-principles -a cursor2Manually: put the files in place
.cursor/skills/api-design-principles/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install wshobson/agents api-design-principles2Manually: put the files in place
.github/skills/api-design-principles/SKILL.mdPlatform CLI
gemini skills install https://github.com/wshobson/agents --path plugins/backend-development/skills/api-design-principlesManually: put the files in place
.devin/skills/api-design-principles/SKILL.mdThe legacy .windsurf/skills/ path still works
Claude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
From the same set213
The whole set →Other versions of api-design-principles
Similar
Questions about api-design-principles
How do I install api-design-principles in Claude Code?
Run npx skills add wshobson/agents --skill api-design-principles -a claude-code. You can also add the marketplace with /plugin marketplace add wshobson/agents and install /plugin install backend-development@claude-code-workflows.
What does api-design-principles do?
It guides REST and GraphQL API design, including versioning and specification reviews. It also covers pitfalls such as GraphQL N+1 queries and incorrect use of HTTP methods.
Where are the detailed examples for api-design-principles?
They are in references/details.md. The skill directs you there when its core guidance is not sufficient.
Source text
SKILL.md · MIT
--- name: api-design-principles description: Master REST and GraphQL API design principles to build intuitive, scalable, and maintainable APIs that delight developers. Use when designing new APIs, reviewing API specifications, or establishing API design standards. --- # API Design Principles Master REST and GraphQL API design principles to build intuitive, scalable, and maintainable APIs that delight developers and stand the test of time. ## When to Use This Skill - Designing new REST or GraphQL APIs - Refactoring existing APIs for better usability - Establishing API design standards for your team - Reviewing API specifications before implementation - Migrating between API paradigms (REST to GraphQL, etc.) - Creating developer-friendly API documentation - Optimizing APIs for specific use cases (mobile, third-party integrations) ## Core Concepts ### 1. RESTful Design Principles **Resource-Oriented Architecture** - Resources are nouns (users, orders, products), not verbs - Use HTTP methods for actions (GET, POST, PUT, PATCH, DELETE) - URLs represent resource hierarchies - Consistent naming conventions **HTTP Methods Semantics:** - `GET`: Retrieve resources (idempotent, safe) - `POST`: Create new resources - `PUT`: Replace entire resource (idempotent) - `PATCH`: Partial resource updates - `DELETE`: Remove resources (idempotent) ### 2. GraphQL Design Principles **Schema-First Development** - Types define your domain model - Queries for reading data - Mutations for modifying data - Subscriptions for real-time updates **Query Structure:** - Clients request exactly what they need - Single endpoint, multiple operations - Strongly typed schema - Introspection built-in ### 3. API Versioning Strategies **URL Versioning:** ``` /api/v1/users /api/v2/users ``` **Header Versioning:** ``` Accept: application/vnd.api+json; version=1 ``` **Query Parameter Versioning:** ``` /api/users?version=1 ``` ## Detailed patterns and worked examples Detailed pattern documentation lives in `references/details.md`. Read that file when the navigation tier above is insufficient. ## Best Practices ### REST APIs 1. **Consistent Naming**: Use plural nouns for collections (`/users`, not `/user`) 2. **Stateless**: Each request contains all necessary information 3. **Use HTTP Status Codes Correctly**: 2xx success, 4xx client errors, 5xx server errors 4. **Version Your API**: Plan for breaking changes from day one 5. **Pagination**: Always paginate large collections 6. **Rate Limiting**: Protect your API with rate limits 7. **Documentation**: Use OpenAPI/Swagger for interactive docs ### GraphQL APIs 1. **Schema First**: Design schema before writing resolvers 2. **Avoid N+1**: Use DataLoaders for efficient data fetching 3. **Input Validation**: Validate at schema and resolver levels 4. **Error Handling**: Return structured errors in mutation payloads 5. **Pagination**: Use cursor-based pagination (Relay spec) 6. **Deprecation**: Use `@deprecated` directive for gradual migration 7. **Monitoring**: Track query complexity and execution time ## Common Pitfalls - **Over-fetching/Under-fetching (REST)**: Fixed in GraphQL but requires DataLoaders - **Breaking Changes**: Version APIs or use deprecation strategies - **Inconsistent Error Formats**: Standardize error responses - **Missing Rate Limits**: APIs without limits are vulnerable to abuse - **Poor Documentation**: Undocumented APIs frustrate developers - **Ignoring HTTP Semantics**: POST for idempotent operations breaks expectations - **Tight Coupling**: API structure shouldn't mirror database schema
© Seth Hobson · MIT · wshobson/agents