Api Design Principles
Unverified●31/40Claude Code◐PartialHas SKILL.md but declares no allowed-tools — Claude Code will ask for permission each time
Cursor◐PartialPlain prose you can paste in — but no Cursor rules file
Codex◐PartialPlain prose you can paste in — but no AGENTS.md
Gemini CLI◐PartialPlain prose you can paste in
Copilot◐PartialPlain prose you can paste in — but no Copilot instructions file
npx agentalley add api-design-principlesWho is stuck, and on what
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.
The whole source
Frontmatter — 2 properties
| 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. |
| 1 | --- |
| 2 | name: api-design-principles |
| 3 | 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. |
| 4 | ---A5 — No allowed-tools declared — no way to tell what this skill may touch |
| 5 | |
| 6 | # API Design Principles |
| 7 | |
| 8 | Master REST and GraphQL API design principles to build intuitive, scalable, and maintainable APIs that delight developers and stand the test of time. |
| 9 | |
| 10 | ## When to Use This Skill |
| 11 | |
| 12 | - Designing new REST or GraphQL APIs |
| 13 | - Refactoring existing APIs for better usability |
| 14 | - Establishing API design standards for your team |
| 15 | - Reviewing API specifications before implementation |
| 16 | - Migrating between API paradigms (REST to GraphQL, etc.) |
| 17 | - Creating developer-friendly API documentation |
| 18 | - Optimizing APIs for specific use cases (mobile, third-party integrations) |
| 19 | |
| 20 | ## Core Concepts |
| 21 | |
| 22 | ### 1. RESTful Design Principles |
| 23 | |
| 24 | **Resource-Oriented Architecture** |
| 25 | |
| 26 | - Resources are nouns (users, orders, products), not verbs |
| 27 | - Use HTTP methods for actions (GET, POST, PUT, PATCH, DELETE) |
| 28 | - URLs represent resource hierarchies |
| 29 | - Consistent naming conventions |
| 30 | |
| 31 | **HTTP Methods Semantics:** |
| 32 | |
| 33 | - `GET`: Retrieve resources (idempotent, safe) |
| 34 | - `POST`: Create new resources |
| 35 | - `PUT`: Replace entire resource (idempotent) |
| 36 | - `PATCH`: Partial resource updates |
| 37 | - `DELETE`: Remove resources (idempotent) |
| 38 | |
| 39 | ### 2. GraphQL Design Principles |
| 40 | |
| 41 | **Schema-First Development** |
| 42 | |
| 43 | - Types define your domain model |
| 44 | - Queries for reading data |
| 45 | - Mutations for modifying data |
| 46 | - Subscriptions for real-time updates |
| 47 | |
| 48 | **Query Structure:** |
| 49 | |
| 50 | - Clients request exactly what they need |
| 51 | - Single endpoint, multiple operations |
| 52 | - Strongly typed schema |
| 53 | - Introspection built-in |
| 54 | |
| 55 | ### 3. API Versioning Strategies |
| 56 | |
| 57 | **URL Versioning:** |
| 58 | |
| 59 | ``` |
| 60 | /api/v1/users |
| 61 | /api/v2/users |
| 62 | ``` |
| 63 | |
| 64 | **Header Versioning:** |
| 65 | |
| 66 | ``` |
| 67 | Accept: application/vnd.api+json; version=1 |
| 68 | ``` |
| 69 | |
| 70 | **Query Parameter Versioning:** |
| 71 | |
| 72 | ``` |
| 73 | /api/users?version=1 |
| 74 | ``` |
| 75 | |
| 76 | ## Detailed patterns and worked examples |
| 77 | |
| 78 | Detailed pattern documentation lives in `references/details.md`. Read that file when the navigation tier above is insufficient. |
| 79 | |
| 80 | ## Best Practices |
| 81 | |
| 82 | ### REST APIs |
| 83 | |
| 84 | 1. **Consistent Naming**: Use plural nouns for collections (`/users`, not `/user`) |
| 85 | 2. **Stateless**: Each request contains all necessary information |
| 86 | 3. **Use HTTP Status Codes Correctly**: 2xx success, 4xx client errors, 5xx server errors |
| 87 | 4. **Version Your API**: Plan for breaking changes from day one |
| 88 | 5. **Pagination**: Always paginate large collections |
| 89 | 6. **Rate Limiting**: Protect your API with rate limits |
| 90 | 7. **Documentation**: Use OpenAPI/Swagger for interactive docs |
| 91 | |
| 92 | ### GraphQL APIs |
| 93 | |
| 94 | 1. **Schema First**: Design schema before writing resolvers |
| 95 | 2. **Avoid N+1**: Use DataLoaders for efficient data fetching |
| 96 | 3. **Input Validation**: Validate at schema and resolver levels |
| 97 | 4. **Error Handling**: Return structured errors in mutation payloads |
| 98 | 5. **Pagination**: Use cursor-based pagination (Relay spec) |
| 99 | 6. **Deprecation**: Use `@deprecated` directive for gradual migration |
| 100 | 7. **Monitoring**: Track query complexity and execution time |
| 101 | |
| 102 | ## Common Pitfalls |
| 103 | |
| 104 | - **Over-fetching/Under-fetching (REST)**: Fixed in GraphQL but requires DataLoaders |
| 105 | - **Breaking Changes**: Version APIs or use deprecation strategies |
| 106 | - **Inconsistent Error Formats**: Standardize error responses |
| 107 | - **Missing Rate Limits**: APIs without limits are vulnerable to abuse |
| 108 | - **Poor Documentation**: Undocumented APIs frustrate developers |
| 109 | - **Ignoring HTTP Semantics**: POST for idempotent operations breaks expectations |
| 110 | - **Tight Coupling**: API structure shouldn't mirror database schema |
| 111 |
Reviews
Installed this one?Write the first review and take the Trailblazer badge.
Alternatives
Subagent Driven DevelopmentUse when executing implementation plans with independent tasks in the current session◐◐◐◐◐●36/40Python Code Style & DocumentationPython code style, linting, formatting, naming conventions, and documentation standards. Use when writing new code, reviewing style, configuring linters, writing docstrings, or establishing project standards.◐····●35/40Competitor Price Analysis 💲Competitor pricing strategy analysis and market positioning. Price mapping, pricing gaps identification, elasticity signals evaluation, and strategic pricing optimization. Use when the user asks about competitor pricing, price analysis, pricing strategy, or co◐····●34/40Competitor Price Tracker 📊Set up competitor price tracking and monitoring workflows. Track price changes, detect promotions, analyze pricing patterns, and get alerts for competitive price movements.◐····●34/40