skills_all/api-design-principles/SKILL.md
Defines resource naming conventions, designs REST endpoints and GraphQL schemas, structures error responses with proper HTTP status codes, plans pagination and filtering strategies, and establishes API versioning and contracts. Use when designing new APIs, reviewing OpenAPI/Swagger specs, structuring routes and endpoints, defining API contracts, or establishing versioning and error code standards.
npx skillsauth add activer007/ordinary-claude-skills api-design-principlesInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Follow these steps sequentially when designing or reviewing an API:
Identify domain entities as plural nouns. Map them to a URL hierarchy:
GET /api/users # List collection (paginated)
POST /api/users # Create resource
GET /api/users/{id} # Get single resource
PUT /api/users/{id} # Replace resource
PATCH /api/users/{id} # Partial update
DELETE /api/users/{id} # Remove resource
GET /api/users/{id}/orders # Nested sub-collection
Every collection endpoint must support pagination. Use cursor-based pagination for large or real-time datasets, offset-based for simpler cases:
# Offset-based pagination response structure
{
"items": [...],
"total": 142,
"page": 2,
"page_size": 20,
"pages": 8
}
# Cursor-based pagination response structure (Relay-style)
{
"edges": [{"node": {...}, "cursor": "abc123"}],
"pageInfo": {
"hasNextPage": true,
"endCursor": "abc123"
},
"totalCount": 142
}
Support filtering via query parameters: ?status=active&created_after=2024-01-01&search=term&sort=name:asc.
Return a consistent error envelope across all endpoints:
{
"error": "ValidationError",
"message": "Request validation failed",
"details": {
"errors": [
{"field": "email", "message": "Invalid email format"}
]
},
"timestamp": "2024-01-15T10:30:00Z",
"path": "/api/users"
}
Map errors to correct HTTP status codes: 400 (bad request), 401 (unauthorized), 403 (forbidden), 404 (not found), 409 (conflict), 422 (validation), 429 (rate limited), 500 (internal).
Choose one strategy and apply it consistently:
/api/v1/users - simple, explicit, easy to routeAccept: application/vnd.api+json; version=1 - cleaner URLs, harder to test/api/users?version=1 - easy to test, clutters query stringDocument deprecation timelines in API contracts. Use Sunset and Deprecation headers to signal upcoming removals.
Define types, connections, inputs, and payloads:
type User {
id: ID!
email: String!
name: String!
orders(first: Int = 20, after: String): OrderConnection!
}
type OrderConnection {
edges: [OrderEdge!]!
pageInfo: PageInfo!
totalCount: Int!
}
type Mutation {
createUser(input: CreateUserInput!): CreateUserPayload!
}
input CreateUserInput {
email: String!
name: String!
}
type CreateUserPayload {
user: User
errors: [Error!]
}
Use DataLoaders to prevent N+1 queries on relationship fields. Return structured errors in mutation payloads rather than throwing exceptions.
Before finalizing, verify:
X-RateLimit-Limit, X-RateLimit-Remaining)tools
Generate typed TypeScript SDKs for AI agents to interact with MCP servers. Converts verbose JSON-RPC curl commands to clean function calls (docs.createDocument() vs curl). Auto-detects MCP tools from server modules, generates TypeScript types and client methods, creates runnable example scripts. Use when: building MCP-enabled applications, need typed programmatic access to MCP tools, want Claude Code to manage apps via scripts, eliminating manual JSON-RPC curl commands, validating MCP inputs/outputs, or creating reusable agent automation.
testing
Generate structured task lists from specs or requirements. IMPORTANT: After completing ANY spec via ExitSpecMode, ALWAYS ask the user: "Would you like me to generate a task list for this spec?" Use when user confirms or explicitly requests task generation from a plan/spec/PRD.
tools
Create compelling story-format summaries using UltraThink to find the best narrative framing. Support multiple formats - 3-part narrative, n-length with inline links, abridged 5-line, or comprehensive via Foundry MCP. USE WHEN user says 'create story explanation', 'narrative summary', 'explain as a story', or wants content in Daniel's conversational first-person voice.
testing
Navigate through the original three-world shamanic technology. Deploy when soul retrieval, power animal guidance, or journey between realms emerges. Deeply respectful of Tungus, Buryat, Yakut, Evenki traditions. Use for consciousness navigation, NOT cultural appropriation.