API Design Principles
Seth HobsonCommunityCreated by Seth Hobson
- Skill
- Guidelines
- Software development
- MIT
- Low risk
- Has scripts
AutoGineer summary
Written by AutoGineer from the skill’s own files, not by the author
This skill provides a structured approach to API design, covering core principles for both REST and GraphQL paradigms. It offers best practices for resource modeling, HTTP semantics, schema-first development, versioning, and error handling. Designed for developers and architects, it helps ensure APIs are consistent, developer-friendly, and built to evolve over time.
What it does
- Defines RESTful resource-oriented architecture and HTTP method semantics.
- Outlines GraphQL schema-first development and type design patterns.
- Provides strategies for API versioning and evolution.
- Details patterns for pagination, filtering, and sorting.
- Establishes standards for consistent error handling and status codes.
- Offers guidance on modular schema organization and polymorphism.
When to use it
- When designing the architecture for a new API service.
- When refactoring existing endpoints to improve usability and consistency.
- When establishing organizational standards for API development.
- During the review phase of an API specification before implementation.
- When migrating or evaluating between REST and GraphQL paradigms.
Advantages
- Promotes consistency across API surfaces, reducing developer friction.
- Encourages scalable design patterns that handle growth and complexity.
- Provides clear, actionable patterns for common API challenges like pagination.
- Supports better maintainability through structured versioning and deprecation strategies.
Usage examples
- “How should I structure my REST endpoints for a user management system?”
- The agent will recommend a resource-oriented approach using plural nouns (e.g., /users) and standard HTTP methods (GET, POST, PUT, PATCH, DELETE) for operations.
- “What is the best way to handle pagination in a GraphQL API?”
- The agent will explain the Relay Cursor Pagination pattern, providing the necessary schema structure for edges, nodes, and pageInfo.
- “How can I ensure consistent error responses across my API?”
- The agent will suggest a standardized error payload structure including error codes, messages, and optional details, along with appropriate HTTP status codes.
- “Should I use URL or header versioning for my API?”
- The agent will compare the two approaches, explaining the trade-offs of each to help you decide based on your team's specific requirements.
Install
Download the skill as a ZIP:
https://mp-staging.autogineer.com/agent-skills/wshobson/api-design-principles/downloadUnzip it into the cross-client skills folder of your project:
mkdir -p .agents/skills && unzip api-design-principles.zip -d .agents/skills
Documentation by Seth Hobson
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 resourcesPUT: Replace entire resource (idempotent)PATCH: Partial resource updatesDELETE: 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/usersHeader Versioning:
Accept: application/vnd.api+json; version=1Query Parameter Versioning:
/api/users?version=1Detailed 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
Consistent Naming: Use plural nouns for collections (
/users, not/user)Stateless: Each request contains all necessary information
Use HTTP Status Codes Correctly: 2xx success, 4xx client errors, 5xx server errors
Version Your API: Plan for breaking changes from day one
Pagination: Always paginate large collections
Rate Limiting: Protect your API with rate limits
Documentation: Use OpenAPI/Swagger for interactive docs
GraphQL APIs
Schema First: Design schema before writing resolvers
Avoid N+1: Use DataLoaders for efficient data fetching
Input Validation: Validate at schema and resolver levels
Error Handling: Return structured errors in mutation payloads
Pagination: Use cursor-based pagination (Relay spec)
Deprecation: Use
@deprecateddirective for gradual migrationMonitoring: 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
Files
- ATTRIBUTION.mdAdded by AutoGineer1001 B
- LICENSELicence file added by AutoGineer1.0 KiB
- SKILL.md3.5 KiB
- assets/api-design-checklist.md3.8 KiB
- assets/rest-api-template.pyScript5.3 KiB
- references/details.md9.6 KiB
- references/graphql-schema-design.md9.1 KiB
- references/rest-best-practices.md7.4 KiB
Requirements and compatibility
Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta
“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.
Needs: Needs Python
Security
What our scanner noticed· Low risk
- Scripts that your agent may run
This skill includes scripts that your agent may run. Read them before you use it.
A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.
Attribution and licence
- Created by
- Seth Hobson
- Publisher
- Seth Hobson (Community)
- Source
- wshobson/agents · plugins/backend-development/skills/api-design-principles · commit 4bde316
- Licence
- MIT License (redistribution allowed)
- LICENSE (added by AutoGineer from LICENSE)
- ATTRIBUTION.md (written by AutoGineer)
- Synced
AutoGineer is not affiliated with or endorsed by Seth Hobson.
Download ZIP
The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download api-design-principles.zip