youhai020616/pi-extensions/api-design
Claude Code and agent skill by youhai020616/pi-extensions
Trust tier 3
- community
Source check pending
Checking that the SKILL.md file is still in the repository.
Use when designing, building, or reviewing REST/GraphQL APIs — covers endpoint design, error handling, versioning, authentication, and documentation
Install
npx vskill@latest install youhai020616/pi-extensions/api-designSKILL.md
API Design
Overview
Good APIs are consistent, predictable, and hard to misuse.
Core principle: Design the API from the consumer's perspective first, then implement.
RESTful Design Rules
URL Structure
Rules:
- Nouns, not verbs (
/usersnot/getUsers) - Plural resources (
/usersnot/user) - Nested for relationships (
/users/:id/posts) - Max 2 levels deep — beyond that, use query params or top-level resource
- Lowercase, hyphen-separated (
/user-profilesnot/userProfiles)
HTTP Methods & Status Codes
| Method | Success | Common Errors | |
|---|---|---|---|
| GET | 200 | 404 not found | |
| POST | 201 + Location header | 400 validation, 409 conflict | |
| PUT/PATCH | 200 | 400 validation, 404 not found | |
| DELETE | 204 (no body) | 404 not found |
Error Response Format
Always use consistent error shape:
Rules:
- Machine-readable
code(UPPER_SNAKE_CASE) - Human-readable
message detailsarray for field-level errors- Never expose stack traces in production
Pagination
For large datasets, prefer cursor-based:
Filtering & Sorting
Versioning
Use URL versioning (/api/v1/) for simplicity:
- Explicit and visible
- Easy to route
- Easy to deprecate
Deprecation flow:
- Add
Sunsetheader with date - Return
Warningheader - Log usage for monitoring
- Remove after sunset date
Authentication
| Method | When to Use | |
|---|---|---|
| Bearer Token (JWT) | SPAs, mobile apps | |
| API Key | Server-to-server, third-party integrations | |
| OAuth 2.0 | Third-party access delegation | |
| Session Cookie | Traditional web apps |
Security checklist:
- [ ] HTTPS everywhere (no exceptions)
- [ ] Rate limiting per endpoint
- [ ] Input validation on all parameters
- [ ] No sensitive data in URLs (use headers/body)
- [ ] CORS configured correctly
- [ ] Auth tokens expire and refresh
Documentation
Every API endpoint needs:
Document:
- All parameters with types and constraints
- All response codes with examples
- Authentication requirements
- Rate limits
- Breaking changes in changelog
Checklist Before Shipping
- [ ] Consistent URL patterns across all endpoints
- [ ] Consistent error format
- [ ] Pagination on all list endpoints
- [ ] Input validation with clear error messages
- [ ] Authentication and authorization
- [ ] Rate limiting
- [ ] CORS headers
- [ ] API documentation / OpenAPI spec
- [ ] Versioning strategy decided
- [ ] No breaking changes without version bump
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/api-design/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/youhai020616/pi-extensions/api-design)