API Design Rules
REST API design rules for Claude Code — covers URL structure, HTTP methods, response formats, and status codes.
Prompt
When creating or modifying API endpoints, follow these REST conventions:
## URL Structure
- Use nouns, not verbs: /api/users (not /api/getUsers)
- Use plural nouns: /api/posts (not /api/post)
- Nest for relationships: /api/users/:id/posts
- Use kebab-case for multi-word resources: /api/user-profiles
- Max nesting depth: 2 levels
## HTTP Methods
- GET — Read (no side effects, cacheable)
- POST — Create (returns 201 + created resource)
- PUT — Full replace (idempotent)
- PATCH — Partial update (returns updated resource)
- DELETE — Remove (returns 204 no content)
## Response Format
- Always return JSON
- Wrap collections: { data: [], meta: { total, page, limit } }
- Single resources: { data: { ... } }
- Errors: { error: { code: "NOT_FOUND", message: "User not found", details: {} } }
- Use consistent date format: ISO 8601 (2025-01-15T10:30:00Z)
## Status Codes
- 200 OK — Successful read/update
- 201 Created — Successful creation
- 204 No Content — Successful deletion
- 400 Bad Request — Validation error
- 401 Unauthorized — Missing/invalid auth
- 403 Forbidden — Valid auth but insufficient permissions
- 404 Not Found — Resource doesn't exist
- 409 Conflict — Duplicate or state conflict
- 422 Unprocessable Entity — Business logic validation failure
- 429 Too Many Requests — Rate limit exceeded
- 500 Internal Server Error — Unexpected server errorWhat you get when you save this prompt
Your workspace unlocks powerful tools to iterate and improve.
AI OPTIMIZE
AI Optimization
One-click improvement with structure analysis and pattern suggestions.
VERSION DIFF
Version History
Track every edit. Compare versions side-by-side with word-level diffs.
ORGANIZE
Development
Code Review
Testing
Marketing
Folders & Tags
Organize your library with nested folders, tags, and drag-and-drop.
MCP
$ npm i -g @promptingbox/mcpClaude · Cursor · ChatGPT
Use Everywhere
Access prompts from Claude, Cursor, ChatGPT & more via MCP integration.
Your prompts, organized
Save, version, and access your best prompts across ChatGPT, Claude, Cursor, and more.