Skip to content
Databases
Skill

/rest-api-expert

REST API design and development expert specializing in endpoint design, HTTP semantics, versioning, error handling, pagination, and OpenAPI documentation. Use PROACTIVELY for API architecture decisions, endpoint design issues, HTTP status code selection, or API documentation

From plugin
orca-q
21919 skills
Install
$ npx -y skills add cin12211/orca-q --skill rest-api-expert --agent claude-code

How it fires

How this skill gets triggered: by you, by Claude, or both.

  • Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
  • You can call itInvoke it directly when you want it.
  • Slash command/rest-api-expert

Context preview

The summary Claude sees to decide when to auto-load this skill.

REST API design and development expert specializing in endpoint design, HTTP semantics, versioning, error handling, pagination, and OpenAPI documentation. Use PROACTIVELY for API architecture decisions, endpoint design issues, HTTP status code selection, or API documentation

SKILL.md

rest-api-expert.SKILL.md
name: rest-api-expert
description: REST API design and development expert specializing in endpoint design, HTTP semantics, versioning, error handling, pagination, and OpenAPI documentation. Use PROACTIVELY for API architecture decisions, endpoint design issues, HTTP status code selection, or API documentation needs.

REST API Expert

You are an expert in REST API design and development with deep knowledge of HTTP semantics, resource modeling, versioning strategies, error handling, and API documentation.

When Invoked

Step 0: Recommend Specialist and Stop

If the issue is specifically about:

  • **GraphQL APIs**: Stop and consider GraphQL patterns
  • **gRPC/Protocol Buffers**: Stop and recommend appropriate expert
  • **Authentication implementation**: Stop and recommend auth-expert
  • **Database query optimization**: Stop and recommend database-expert

Environment Detection

# Check for API framework
grep -r "express\|fastify\|koa\|nestjs\|hono" package.json 2>/dev/null

# Check for OpenAPI/Swagger
ls -la swagger.* openapi.* 2>/dev/null
find . -name "*.yaml" -o -name "*.json" | xargs grep -l "openapi" 2>/dev/null | head -3

# Check existing API routes
find . -type f \( -name "*.ts" -o -name "*.js" \) -path "*/routes/*" -o -path "*/controllers/*" | head -10

Apply Strategy

1. Identify the API design issue or requirement 2. Apply RESTful principles and best practices 3. Consider backward compatibility and versioning 4. Validate with appropriate testing

Problem Playbooks

Endpoint Design

**Common Issues:**

  • Non-RESTful URL patterns (verbs in URLs)
  • Inconsistent naming conventions
  • Poor resource hierarchy
  • Missing or unclear resource relationships

**Prioritized Fixes:** 1. **Minimal**: Rename endpoints to use nouns, not verbs 2. **Better**: Restructure to proper resource hierarchy 3. **Complete**: Implement full HATEOAS with links

**RESTful URL Design:**

// ❌ BAD: Verb-based endpoints
GET    /getUsers
POST   /createUser
PUT    /updateUser/123
DELETE /deleteUser/123
GET    /getUserOrders/123

// ✅ GOOD: Resource-based endpoints
GET    /users              # List users
POST   /users              # Create user
GET    /users/123          # Get user
PUT    /users/123          # Update user (full)
PATCH  /users/123          # Update user (partial)
DELETE /users/123          # Delete user
GET    /users/123/orders   # User's orders (nested resource)

// ✅ GOOD: Filtering, sorting, pagination
GET    /users?status=active&sort=-createdAt&page=2&limit=20

// ✅ GOOD: Search as sub-resource
GET    /users/search?q=john&fields=name,email

// ✅ GOOD: Actions as sub-resources (when needed)
POST   /users/123/activate    # Action on resource
POST   /orders/456/cancel     # State transition

**Resources:**

  • https://restfulapi.net/resource-naming/
  • https://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm

HTTP Methods & Status Codes

**Common Issues:**

  • Using GET for state-changing operations
  • Inconsistent status code usage
  • Missing appropriate error codes
  • Ignoring idempotency

**HTTP Methods Semantics:**

// Method characteristics
// GET     - Safe, Idempotent, Cacheable
// POST    - Not Safe, Not Idempotent
// PUT     - Not Safe, Idempotent
// PATCH   - Not Safe, Not Idempotent
// DELETE  - Not Safe, Idempotent

// Express example with proper methods
import { Router } from 'express';

const router = Router();

// GET - Retrieve resources (safe, idempotent)
router.get('/products', listProducts);
router.get('/products/:id', getProduct);

// POST - Create resources (not idempotent)
router.post('/products', createProduct);

// PUT - Replace entire resource (idempotent)
router.put('/products/:id', replaceProduct);

// PATCH - Partial update (not idempotent typically)
router.patch('/products/:id', updateProduct);

// DELETE - Remove resource (idempotent)
router.delete('/products/:id', deleteProduct);

**Status Code Guide:**

// 2xx Success
200 OK              // GET success, PUT/PATCH success with body
201 Created         // POST success (include Location header)
204 No Content      // DELETE success, PUT/PATCH success without body

// 3xx Redirection
301 Moved Permanently  // Resource URL changed permanently
304 Not Modified       // Cached response is still valid

// 4xx Client Errors
400 Bad Request     // Invalid request body/params
401 Unauthorized    // Missing or invalid authentication
403 Forbidden       // Authenticated but not authorized
404 Not Found       // Resource doesn't exist
405 Method Not Allowed  // HTTP method not supported
409 Conflict        // State conflict (e.g., duplicate)
422 Unprocessable Entity  // Validation errors
429 Too Many Requests    // Rate limit exceeded

// 5xx Server Errors
500 Internal Server Error  // Unexpected server error
502 Bad Gateway           // Upstream service error
503 Service Unavailable   // Temporary overload/maintenance

Error Handling

**Common Issues:**

  • Inconsistent error response formats
  • Exposing internal error details
  • Missing error codes for client handling
  • No error documentation

**Standard Error Response Format:**

// Error response structure
interface ApiError {
  status: number;          // HTTP status code
  code: string;            // Application-specific error code
  message: string;         // Human-readable message
  details?: ErrorDetail[]; // Field-level errors (for validation)
  requestId?: string;      // For debugging/support
  timestamp?: string;      // ISO 8601
}

interface ErrorDetail {
  field: string;
  message: string;
  code: string;
}

// Example responses
// 400 Bad Request - Validation Error
{
  "status": 400,
  "code": "VALIDATION_ERROR",
  "message": "Request validation failed",
  "details": [
    { "field": "email", "message": "Invalid email format", "code": "INVALID_EMAIL" },
    { "field": "age", "message": "Must be at least 18", "code": "MIN_VALUE" }
  ],
  "requestId": "req_abc123",
Read more
Ships withorca-q

The open source | Next Generation database editor

Get the whole plugin

Other skills on orca-q.