
Api Designer
- 187 installs
- 33 repo stars
- Updated December 25, 2025
- daffy0208/ai-dev-standards
Design consistent REST or RPC APIs with versioning, error models, auth boundaries, and OpenAPI-ready contracts for AI-assisted services.
About
api-designer from daffy0208/ai-dev-standards guides Claude Code through production API design: resource naming, pagination, error envelopes, authentication scopes, versioning strategy, and OpenAPI documentation aligned with team AI development standards.
- REST contract conventions
- Versioning and error schemas
- Auth and rate-limit patterns
- OpenAPI documentation alignment
- AI-dev consistency standards
Api Designer by the numbers
- 187 all-time installs (skills.sh)
- Ranked #2,132 of 4,347 Backend & APIs skills by installs in the Skillselion catalog
- Data as of Jul 30, 2026 (Skillselion catalog sync)
npx skills add https://github.com/daffy0208/ai-dev-standards --skill api-designerAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 187 |
|---|---|
| repo stars | ★ 33 |
| Last updated | December 25, 2025 |
| Repository | daffy0208/ai-dev-standards ↗ |
What it does
Design consistent REST or RPC APIs with versioning, error models, auth boundaries, and OpenAPI-ready contracts for AI-assisted services.
Files
API Designer
Design robust, scalable, and developer-friendly APIs.
Core Principles
1. Developer Experience First
- Clear, predictable naming conventions
- Comprehensive documentation
- Helpful error messages
- Consistent patterns across endpoints
2. Design for Evolution
- Versioning strategy from day one
- Backward compatibility
- Deprecation process
- Migration guides for breaking changes
3. Security by Default
- Authentication and authorization
- Rate limiting and throttling
- Input validation and sanitization
- HTTPS only, no exceptions
4. Performance Matters
- Efficient queries and indexing
- Caching strategies
- Pagination for large datasets
- Compression (gzip, brotli)
REST API Design
Resource Naming Conventions
✅ Good (Nouns, plural, hierarchical):
GET /users # List all users
GET /users/123 # Get specific user
POST /users # Create user
PUT /users/123 # Replace user
PATCH /users/123 # Update user
DELETE /users/123 # Delete user
GET /users/123/posts # User's posts (nested)
GET /users/123/posts/456 # Specific post
❌ Bad (Verbs, inconsistent, unclear):
GET /getUsers
POST /createUser
GET /user-list
GET /UserData?id=123HTTP Methods & Semantics
| Method | Purpose | Idempotent | Safe | Request Body | Response Body |
|---|---|---|---|---|---|
| GET | Retrieve data | Yes | Yes | No | Yes |
| POST | Create resource | No | No | Yes | Yes (created) |
| PUT | Replace resource | Yes | No | Yes | Yes (optional) |
| PATCH | Partial update | No | No | Yes | Yes (optional) |
| DELETE | Remove resource | Yes | No | No | No (204) or Yes |
Idempotent: Multiple identical requests have same effect as single request Safe: Request doesn't modify server state
HTTP Status Codes
Success (2xx):
200 OK- Successful GET, PUT, PATCH, DELETE201 Created- Successful POST, includesLocationheader204 No Content- Successful request, no response body (often DELETE)
Client Errors (4xx):
400 Bad Request- Invalid syntax, validation error401 Unauthorized- Authentication required or failed403 Forbidden- Authenticated but lacks permission404 Not Found- Resource doesn't exist409 Conflict- Request conflicts with current state422 Unprocessable Entity- Validation error (semantic)429 Too Many Requests- Rate limit exceeded
Server Errors (5xx):
500 Internal Server Error- Generic server error502 Bad Gateway- Upstream service error503 Service Unavailable- Temporary unavailability504 Gateway Timeout- Upstream timeout
Response Format Standards
Success Response:
{
"data": {
"id": "123",
"type": "user",
"attributes": {
"name": "John Doe",
"email": "john@example.com",
"created_at": "2025-01-15T10:30:00Z"
}
}
}Error Response:
{
"error": {
"code": "VALIDATION_ERROR",
"message": "Request validation failed",
"details": [
{
"field": "email",
"code": "REQUIRED",
"message": "Email is required"
},
{
"field": "age",
"code": "OUT_OF_RANGE",
"message": "Age must be between 18 and 120"
}
],
"request_id": "req_abc123",
"documentation_url": "https://api.example.com/docs/errors/validation"
}
}List Response with Pagination:
{
"data": [...],
"pagination": {
"cursor": "eyJpZCI6MTIzfQ==",
"has_more": true,
"total_count": 1000
},
"links": {
"next": "/users?cursor=eyJpZCI6MTIzfQ==&limit=20",
"prev": "/users?cursor=eyJpZCI6MTAwfQ==&limit=20"
}
}Pagination Strategies
Cursor-based (Recommended):
GET /users?cursor=abc123&limit=20
Pros: Consistent results, efficient, handles real-time data
Cons: Can't jump to arbitrary page
Use when: Large datasets, real-time data, performance criticalOffset-based:
GET /users?page=1&per_page=20
GET /users?offset=0&limit=20
Pros: Simple, can jump to any page
Cons: Inconsistent with concurrent writes, inefficient at scale
Use when: Small datasets, admin interfaces, simple use casesFiltering, Sorting, and Search
Filtering:
GET /users?status=active&role=admin&created_after=2025-01-01Sorting:
GET /users?sort=-created_at,name # Descending created_at, then ascending nameSearch:
GET /users?q=john&fields=name,email # Search across specified fieldsAuthentication & Authorization
JWT Bearer Token (Recommended for SPAs):
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
Pros: Stateless, includes user claims, works across domains
Cons: Can't revoke until expiry, larger payloadAPI Keys (for service-to-service):
X-API-Key: sk_live_abc123...
Pros: Simple, easy to rotate, per-service keys
Cons: No user context, must be kept secretOAuth 2.0 (for third-party access):
Authorization: Bearer access_token
Pros: Delegated auth, scoped permissions, industry standard
Cons: Complex setup, requires OAuth serverBasic Auth (only for internal/admin tools):
Authorization: Basic base64(username:password)
Pros: Simple, built-in to HTTP
Cons: Credentials in every request, must use HTTPSRate Limiting
Standard Headers:
X-RateLimit-Limit: 1000 # Max requests per window
X-RateLimit-Remaining: 999 # Requests left
X-RateLimit-Reset: 1640995200 # Unix timestamp when limit resets
Retry-After: 60 # Seconds to wait (on 429)Common Strategies:
- Fixed window: 1000 requests per hour
- Sliding window: 1000 requests per rolling hour
- Token bucket: Burst allowance with refill rate
- Per-user, per-IP, or per-API-key limits
Versioning Strategies
URL Versioning (Recommended):
/v1/users
/v2/users
Pros: Explicit, easy to route, clear in logs
Cons: URL pollution, harder to evolve incrementallyHeader Versioning:
Accept: application/vnd.myapp.v2+json
API-Version: 2
Pros: Clean URLs, follows REST principles
Cons: Less visible, harder to test in browserBest Practices:
- Start with v1, not v0
- Only increment for breaking changes
- Support N and N-1 versions simultaneously
- Provide migration guides
- Announce deprecation 6-12 months ahead
---
GraphQL API Design
Schema Design
type User {
id: ID!
name: String!
email: String!
posts(first: Int, after: String): PostConnection!
createdAt: DateTime!
}
type PostConnection {
edges: [PostEdge!]!
pageInfo: PageInfo!
}
type PostEdge {
node: Post!
cursor: String!
}
type PageInfo {
hasNextPage: Boolean!
endCursor: String
}
type Query {
user(id: ID!): User
users(first: Int, after: String): UserConnection!
}
type Mutation {
createUser(input: CreateUserInput!): CreateUserPayload!
updateUser(id: ID!, input: UpdateUserInput!): UpdateUserPayload!
}
input CreateUserInput {
name: String!
email: String!
}
type CreateUserPayload {
user: User
errors: [Error!]
}GraphQL Best Practices
1. Use Relay Connection Pattern for Pagination:
query {
users(first: 10, after: "cursor") {
edges {
node {
id
name
}
cursor
}
pageInfo {
hasNextPage
endCursor
}
}
}2. Input Types for Mutations:
# ✅ Good: Input type + payload
mutation {
createUser(input: { name: "John", email: "john@example.com" }) {
user {
id
name
}
errors {
field
message
}
}
}
# ❌ Bad: Flat arguments
mutation {
createUser(name: "John", email: "john@example.com") {
id
name
}
}3. Error Handling:
type Mutation {
createUser(input: CreateUserInput!): CreateUserPayload!
}
type CreateUserPayload {
user: User # Null if errors
errors: [Error!] # Field-level errors
}
type Error {
field: String!
code: String!
message: String!
}REST vs GraphQL Decision
Use REST when:
- Simple CRUD operations
- Caching is critical (HTTP caching)
- Public API for third-parties
- File uploads/downloads
- Team unfamiliar with GraphQL
Use GraphQL when:
- Clients need flexible queries
- Reducing over-fetching/under-fetching
- Rapid frontend iteration
- Complex nested data relationships
- Strong typing and schema benefits
---
API Documentation
OpenAPI/Swagger Specification
openapi: 3.0.0
info:
title: User Management API
version: 1.0.0
description: API for managing users and posts
servers:
- url: https://api.example.com/v1
paths:
/users:
get:
summary: List users
parameters:
- name: page
in: query
schema:
type: integer
default: 1
- name: per_page
in: query
schema:
type: integer
default: 20
maximum: 100
responses:
'200':
description: Success
content:
application/json:
schema:
$ref: '#/components/schemas/UserList'
'401':
$ref: '#/components/responses/Unauthorized'
post:
summary: Create user
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/CreateUserInput'
responses:
'201':
description: User created
content:
application/json:
schema:
$ref: '#/components/schemas/User'
components:
schemas:
User:
type: object
properties:
id:
type: string
name:
type: string
email:
type: string
format: email
securitySchemes:
bearerAuth:
type: http
scheme: bearer
bearerFormat: JWTDocumentation Best Practices
- ✅ Include request/response examples
- ✅ Document all error codes
- ✅ Provide authentication guides
- ✅ Interactive API playground (Swagger UI, GraphQL Playground)
- ✅ Code examples in multiple languages
- ✅ Rate limit information
- ✅ Changelog for API updates
---
Security Checklist
- [ ] HTTPS only (redirect HTTP → HTTPS)
- [ ] Authentication required for protected endpoints
- [ ] Authorization checks (user can only access own data)
- [ ] Input validation (schema validation, sanitization)
- [ ] Rate limiting per user/IP
- [ ] CORS configuration (whitelist origins)
- [ ] SQL injection prevention (parameterized queries)
- [ ] No sensitive data in URLs (use headers/body)
- [ ] Audit logging for sensitive operations
- [ ] API keys rotatable and revocable
---
Related Resources
Related Skills:
frontend-builder- For consuming APIs from frontenddeployment-advisor- For API hosting decisionsperformance-optimizer- For API performance tuning
Related Patterns:
META/DECISION-FRAMEWORK.md- REST vs GraphQL decisionsSTANDARDS/architecture-patterns/api-gateway-pattern.md- API gateway architecture (when created)
Related Playbooks:
PLAYBOOKS/deploy-api.md- API deployment procedure (when created)PLAYBOOKS/version-api.md- API versioning workflow (when created)
name: api-designer
kind: skill
description: Design REST and GraphQL APIs with proper authentication, versioning, documentation, and best practices
preconditions:
- check: file_exists('package.json') or file_exists('requirements.txt')
description: Backend project initialized
required: true
- check: not file_exists('app/api/') and not file_exists('src/routes/')
description: No existing API structure
required: false
- check: has_backend_framework('express') or has_backend_framework('fastapi') or has_backend_framework('nextjs')
description: Backend framework available
required: true
effects:
- creates_api_routes
- implements_authentication
- adds_rate_limiting
- configures_cors
- implements_pagination
- adds_input_validation
- creates_error_handling
- generates_openapi_spec
- implements_versioning
- adds_api_documentation
domains:
- api
- rest
- graphql
- backend
- authentication
- security
- documentation
- versioning
cost: free
latency: fast
risk_level: medium
side_effects:
- modifies_files
- creates_api_endpoints
- configures_authentication
- exposes_public_endpoints
idempotent: false
success_signal: "API endpoints respond correctly, authentication works, documentation generated, OpenAPI spec validates, rate limiting functional"
failure_signals:
- "Routes not accessible"
- "Authentication fails"
- "CORS errors"
- "Rate limiting not working"
- "Input validation missing"
- "Documentation incomplete"
compatibility:
requires:
- backend-framework
- database-connection
conflicts_with:
- incompatible-api-version
composes_with:
- frontend-builder
- security-engineer
- testing-strategist
- deployment-advisor
- performance-optimizer
enables:
- client-server-communication
- third-party-integration
- mobile-app-backend
- microservices-architecture
observability:
logs:
- "Creating API route: {method} {path}"
- "Configuring authentication with {strategy}"
- "Setting up rate limit: {requests} per {window}"
- "Generating OpenAPI specification"
metrics:
- api_request_count
- api_latency_ms
- api_error_rate
- rate_limit_hits
- endpoint_count
metadata:
version: "1.0.0"
created_at: "2025-10-28"
tags:
- api
- rest
- graphql
- authentication
- security
- documentation
- backend
examples:
- "Design REST API for user management"
- "Implement GraphQL API with pagination"
- "Add JWT authentication to existing API"
- "Create OpenAPI specification"
API Designer - Quick Start
Version: 1.0.0 Category: Technical Development Difficulty: Intermediate
What This Skill Does
Guides design of RESTful and GraphQL APIs with best practices for naming, versioning, authentication, error handling, and documentation.
When to Use
Use this skill when you need to:
- Design a new backend API
- Define API contracts and specifications
- Choose between REST and GraphQL
- Implement authentication and authorization
- Version an existing API
- Document API endpoints
Quick Start
Fastest path to a well-designed API:
1. Choose API style (REST vs GraphQL)
- REST: Simple CRUD, public API, caching critical
- GraphQL: Flexible queries, complex nested data, rapid frontend iteration
2. Design resources (REST) or schema (GraphQL)
- REST: Nouns, plural, hierarchical (
/users/123/posts) - GraphQL: Types, queries, mutations with input/payload pattern
3. Define authentication
- JWT Bearer: SPAs and mobile apps
- API Keys: Service-to-service
- OAuth 2.0: Third-party integrations
4. Implement core patterns
- Pagination: Cursor-based for scale
- Filtering: Query parameters
- Error handling: Structured error responses
- Versioning: URL versioning (
/v1/users)
5. Document with OpenAPI/Swagger (REST) or GraphQL schema
- Include examples, error codes, auth guide
- Provide interactive playground
6. Add security & rate limiting
- HTTPS only
- Input validation
- Rate limits (1000 req/hour typical)
Time to first endpoint: 1-2 days for simple API, 1 week for comprehensive
File Structure
api-designer/
├── SKILL.md # Main skill instructions (start here)
└── README.md # This filePrerequisites
Knowledge:
- HTTP protocol basics (methods, status codes, headers)
- JSON and data structures
- Basic security concepts (auth, tokens)
Tools:
- API development framework (Express, FastAPI, Next.js API routes)
- API documentation tool (Swagger UI, GraphQL Playground)
- API testing tool (Postman, Insomnia, curl)
Related Skills:
- None required, but
frontend-builderhelps for API consumption context
Success Criteria
You've successfully used this skill when:
- ✅ API follows REST conventions or GraphQL best practices
- ✅ All endpoints use proper HTTP methods and status codes
- ✅ Authentication and authorization implemented
- ✅ Pagination and filtering available for lists
- ✅ Error responses include helpful messages and field details
- ✅ API versioning strategy defined
- ✅ Rate limiting configured
- ✅ Complete API documentation published (OpenAPI or GraphQL schema)
- ✅ Security checklist completed
Common Workflows
Workflow 1: New REST API
1. Use api-designer to design resource structure 2. Define HTTP methods and status codes 3. Implement pagination and filtering 4. Add authentication (JWT Bearer) 5. Document with OpenAPI/Swagger 6. Use deployment-advisor for hosting
Workflow 2: New GraphQL API
1. Use api-designer to design schema (types, queries, mutations) 2. Implement Relay connection pattern for pagination 3. Use input/payload pattern for mutations 4. Add authentication resolver 5. Publish GraphQL Playground 6. Use deployment-advisor for hosting
Workflow 3: API Versioning
1. Use api-designer versioning strategy (URL-based) 2. Identify breaking changes 3. Create /v2 endpoints 4. Support v1 and v2 simultaneously 5. Announce v1 deprecation (6-12 months ahead) 6. Provide migration guide
Key Concepts
REST Principles:
- Resources: Nouns (users, posts), not verbs
- HTTP Methods: GET, POST, PUT, PATCH, DELETE
- Status Codes: 2xx success, 4xx client error, 5xx server error
- Idempotency: PUT, PATCH, DELETE should be idempotent
GraphQL Patterns:
- Schema-first: Define types, queries, mutations
- Relay Connections: Cursor-based pagination standard
- Input Types: For mutations (encapsulate arguments)
- Payload Types: Include data and errors
Authentication:
- JWT: Stateless, includes claims, works across domains
- API Keys: Simple, per-service, easy to rotate
- OAuth 2.0: Delegated auth, scoped permissions
Pagination:
- Cursor-based: Efficient, consistent, scales well (recommended)
- Offset-based: Simple, can jump to page, inefficient at scale
Versioning:
- URL:
/v1/users,/v2/users(recommended) - Header:
API-Version: 2orAccept: vnd.myapp.v2+json
Troubleshooting
Skill not activating?
- Try explicitly requesting: "Use the api-designer skill to..."
- Mention keywords: "API", "REST", "GraphQL", "endpoints", "authentication"
Choosing between REST and GraphQL?
- REST: Simple CRUD, public APIs, caching important, team familiarity
- GraphQL: Flexible queries, complex relationships, reducing over-fetching
- Can use both: REST for simple endpoints, GraphQL for complex queries
Status code confusion?
- 200: Success for GET, PUT, PATCH, DELETE
- 201: Success for POST (resource created)
- 204: Success with no response body (often DELETE)
- 400: Client error (validation, malformed request)
- 401: Authentication required or failed
- 403: Authenticated but no permission
- 404: Resource not found
- 422: Validation error (semantic)
- 429: Rate limit exceeded
- 500: Server error
Pagination strategy?
- Use cursor-based for large datasets, real-time data, performance
- Use offset-based for small datasets, admin interfaces, simplicity
- Cursor-based is generally recommended for production APIs
Authentication method?
- JWT Bearer: Web/mobile apps (SPAs, React Native)
- API Keys: Server-to-server, internal services
- OAuth 2.0: Third-party integrations, delegated access
- Never use Basic Auth except for internal admin tools with HTTPS
Versioning too complex?
- Start with
/v1/from day one - Only increment for breaking changes (not additions)
- Support N and N-1 versions (two versions)
- Announce deprecation 6-12 months ahead
- Provide clear migration guides
Error messages unclear?
- Include error code for programmatic handling
- Provide human-readable message
- List field-level errors for validation
- Include
request_idfor debugging - Link to documentation for error codes
Version History
- 1.0.0 (2025-10-21): Initial release, enhanced from api-designer skill with GraphQL and comprehensive REST guidance
License
Part of ai-dev-standards repository.