api-design-principles
Design REST and GraphQL APIs with confidence
API design decisions often become inconsistent and hard to maintain. This skill provides clear patterns, templates, and checklists to guide your choices.
Download the skill ZIP
Upload in Claude
Go to Settings → Capabilities → Skills → Upload skill
Toggle on and start using
Test it
Using "api-design-principles". Review my user and order endpoints for REST best practices.
Expected outcome:
- Use plural nouns: /api/users and /api/orders
- Replace action paths like /api/createUser with POST /api/users
- Add pagination to list endpoints with page and page_size
- Return 201 Created on successful POST and 204 on DELETE
Using "api-design-principles". How should I structure a GraphQL schema for a blog with users, posts, and comments?
Expected outcome:
- Define User, Post, Comment types with proper relationships
- Use Relay-style cursor pagination for collections
- Create input types for mutations with error payloads
- Add DataLoaders to prevent N+1 queries on relationships
Using "api-design-principles". What status codes should my API return for validation errors?
Expected outcome:
- Return 400 Bad Request for malformed request syntax
- Return 422 Unprocessable Entity for validation failures
- Include field-level error details in the response body
- Use consistent error format across all endpoints
Security Audit
SafeThis skill contains only educational documentation, code templates, and best practices for API design. All 233 static findings are false positives: 'weak cryptographic algorithm' flags educational password hashing examples; 'backtick execution' misinterprets markdown code formatting; 'system reconnaissance' triggers on legitimate programming terms like fetch/decode; hardcoded URLs/IPs are documentation examples, not actual network calls. No executable code, network calls, or data access patterns pose security risks.
Risk Factors
🌐 Network access (7)
⚙️ External commands (134)
Quality Score
What You Can Build
Define new API standards
Create consistent REST and GraphQL rules for a team before implementation.
Review API specifications
Audit specs for naming, versioning, and error handling issues.
Improve API usability
Refine endpoints and schema to reduce client confusion and rework.
Try These Prompts
Review this REST API outline and list naming, method, and status code fixes. Provide a short corrected example.
Evaluate this GraphQL schema for pagination, input types, and error patterns. Suggest improvements with brief examples.
Recommend a versioning approach for this API and explain the tradeoffs. Provide a migration checklist.
Apply an API design checklist to this spec and return pass or fail with fixes for each failed item.
Best Practices
- Document versioning and deprecation rules before launch
- Use consistent error formats with stable error codes
- Paginate all collection endpoints with clear limits
Avoid
- Using POST for read-only operations
- Deeply nested resource paths beyond two levels
- Returning inconsistent error shapes across endpoints