Help us improve
Share bugs, ideas, or general feedback.
From futuregerald-claude-plugin
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.
How this skill is triggered — by the user, by Claude, or both
Slash command
/futuregerald-claude-plugin:api-design-principlesThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Master REST and GraphQL API design principles to build intuitive, scalable, and maintainable APIs that delight developers and stand the test of time.
Share bugs, ideas, or general feedback.
Master REST and GraphQL API design principles to build intuitive, scalable, and maintainable APIs that delight developers and stand the test of time.
Resource-Oriented Architecture
HTTP Methods Semantics:
GET: Retrieve resources (idempotent, safe)POST: Create new resourcesPUT: Replace entire resource (idempotent)PATCH: Partial resource updatesDELETE: Remove resources (idempotent)Schema-First Development
Query Structure:
| Strategy | Format | Tradeoffs |
|---|---|---|
| URL path | /api/v1/users | Simple, visible; pollutes URIs |
| Header | Accept: application/vnd.api+json; version=1 | Clean URIs; harder to test in browser |
| Query param | /api/users?version=1 | Easy to test; non-standard |
Pick one strategy per API surface and stick to it. URL versioning is the most common choice for public APIs.
# Good: Resource-oriented endpoints
GET /api/users # List users (with pagination)
POST /api/users # Create user
GET /api/users/{id} # Get specific user
PUT /api/users/{id} # Replace user
PATCH /api/users/{id} # Update user fields
DELETE /api/users/{id} # Delete user
# Nested resources
GET /api/users/{id}/orders # Get user's orders
POST /api/users/{id}/orders # Create order for user
# Bad: Action-oriented endpoints (avoid)
POST /api/createUser
POST /api/getUserById
POST /api/deleteUser
Status Code Map:
STATUS_CODES = {
"success": 200,
"created": 201,
"no_content": 204,
"bad_request": 400,
"unauthorized": 401,
"forbidden": 403,
"not_found": 404,
"conflict": 409,
"unprocessable": 422,
"internal_error": 500
}
Consistent error response shape:
class ErrorResponse(BaseModel):
error: str # Machine-readable code (e.g., "NotFound")
message: str # Human-readable description
details: Optional[dict] = None
timestamp: str
path: str
# Example helper
def raise_not_found(resource: str, id: str):
raise HTTPException(
status_code=404,
detail={
"error": "NotFound",
"message": f"{resource} not found",
"details": {"id": id}
}
)
/users, not /user)@deprecated directive for gradual migration| File | Contents |
|---|---|
| references/rest-patterns.md | Pagination/Filtering (Pattern 2), HATEOAS (Pattern 4) |
| references/graphql-patterns.md | Schema Design, Resolver Design, DataLoader (N+1 prevention) |
| references/rest-best-practices.md | Comprehensive REST API design guide |
| references/graphql-schema-design.md | GraphQL schema patterns and anti-patterns |
| assets/rest-api-template.py | FastAPI REST API template |
| assets/api-design-checklist.md | Pre-implementation review checklist |
npx claudepluginhub futuregerald/futuregerald-claude-pluginCreates, edits, and optimizes skills for Claude Code, including drafting, evaluating with test prompts, iterating on performance, and improving skill descriptions for better triggering accuracy.