Comprehensive API design and review based on REST best practices and enterprise API standards.
/plugin marketplace add cameronsjo/claude-marketplace/plugin install api@cameronsjoThis skill inherits all available tools. When active, it can use any tool Claude has access to.
README.mdresources/common-types.jsonresources/error-codes.jsonresources/openapi-template.yamlscripts/check-naming.pyscripts/generate-error-schema.pyscripts/validate-openapi.pyComprehensive API design and review based on REST best practices and enterprise API standards.
This skill provides expert guidance for designing, reviewing, and validating RESTful APIs. It covers naming conventions, resource modeling, error handling, versioning, and OpenAPI specification compliance.
email_address, first_name)/v1/identity/validate-otp)password_hash ✓ password)written_by ✓ author)items_collected ✓ collected_items)collect_items ✓ collected_items)is_disabled ✓ disabled)uri not url (❌ redirect_url ✓ redirect_uri)_count (❌ num_nodes ✓ node_count){verb}_time format (❌ created_time ✓ create_time)_date, duration in _duration/{version}/{namespace}/{collection-resource}/{resource-id}/{sub-resource}/{sub-resource-id}
Examples:
/v1/identity/users
/v1/identity/users/123
/v1/identity/accounts/456/users
/v1/identity/accounts/456/users/789
| HTTP Method | Operation | URI Pattern | Idempotent |
|---|---|---|---|
| GET | List Resources | GET /{collection} | Yes |
| GET | Retrieve Resource | GET /{collection}/{id} | Yes |
| POST | Create Resource | POST /{collection} | With Idempotency-Key |
| PUT | Replace Resource | PUT /{collection}/{id} | Yes |
| PATCH | Partial Update | PATCH /{collection}/{id} | No |
| DELETE | Delete Resource | DELETE /{collection}/{id} | Yes |
| POST | Custom Action | POST /{controller-resource} | Varies |
200 OK - Successful GET, or successful operation with response body201 Created - Successful POST creating a resource204 No Content - Successful PUT/PATCH/DELETE with no response body202 Accepted - Long-running operation accepted207 Multi-Status - Batch operation with mixed results400 Bad Request - Invalid syntax, validation errors401 Unauthorized - Authentication failure403 Forbidden - Authorization failure404 Not Found - Resource does not exist409 Conflict - Duplicate idempotent request412 Precondition Failed - If-Match/If-None-Match failure413 Payload Too Large - Request entity too large415 Unsupported Media Type - Unsupported Content-Type422 Unprocessable Entity - Semantic validation failure428 Precondition Required - Missing If-Match header429 Too Many Requests - Rate limit exceeded500 Internal Server Error - Server-side error503 Service Unavailable - Service unavailable504 Gateway Timeout - External partner timeout onlyAll error responses MUST follow RFC 9457 Problem Details format:
{
"type": "https://api.example.com/errors/invalid-request",
"title": "Request is not well-formed, syntactically incorrect, or violates schema.",
"status": 400,
"detail": "Additional details about this specific occurrence",
"instance": "/v1/resource/123",
"trace_id": "90957fca61718",
"errors": [
{
"code": "https://api.example.com/errors/missing-required-property",
"reason": "A required field is missing.",
"property": "/credit_card/expire_month",
"location": "body"
}
]
}
https://api.example.com/errors/invalid-request - 400 Bad Requesthttps://api.example.com/errors/authentication-failure - 401 Unauthorizedhttps://api.example.com/errors/authorization-failure - 403 Forbiddenhttps://api.example.com/errors/resource-not-found - 404 Not Foundhttps://api.example.com/errors/resource-conflict - 409 Conflicthttps://api.example.com/errors/unprocessable-entity - 422 Unprocessable Entityhttps://api.example.com/errors/internal-server-error - 500 Internal Server Error/v{major_version}/v1, /v2)Deprecation header with timestampSunset header with EOL dateUse standard types for common concepts:
currency_code (ISO 4217) + value (string)minLength and maxLengthpattern for validation when appropriatenumber type - use string for decimalsinteger for 32-bit signed values (-2^31 to 2^31-1)minimum and maximum for integersstring with pattern for large numbers or decimalsmaxItems (default: 32767)minItems (usually 0 or 1)null values{"type": "null"}additionalProperties: falseUse cursor-based pagination:
Bidirectional Navigation:
?page_size=10&starting_after={id}&ending_before={id}&next_page=true
Unidirectional Navigation:
?page_size=10&page_token={token}
Response:
{
"items": [...],
"total_items": 100,
"next_page_token": "abc123",
"next_page": true
}
Content-Type: application/json; charset=utf-8Accept: application/jsonAuthorization: Bearer {token}Idempotency-Key: {client-generated-key} (POST/PATCH)If-Match: {etag} (PUT/PATCH/DELETE)ETag: {entity-tag} (responses)Prefer: return=representation (optional full response)Deprecation: {date} (deprecation notice)Sunset: {date} (EOL notice)Design a REST API for managing user accounts with the following requirements:
- CRUD operations for users
- User profile updates
- Account activation/deactivation
- List users with filtering and pagination
The skill will:
Review this OpenAPI specification for compliance:
[paste OpenAPI spec or provide file path]
The skill will:
Validate this API design against the guidelines:
- Check field names are snake_case
- Check URIs are kebab-case
- Verify error responses follow RFC 9457
- Check pagination implementation
The skill will use validation scripts to:
Generate the following API components:
- Error response schemas
- Common type definitions (money, address, phone)
- Pagination response schema
- OpenAPI template for a new service
The skill includes scripts for automated validation:
Validates OpenAPI specifications against API guidelines:
Usage:
python scripts/validate-openapi.py path/to/openapi.yaml
Validates field names and URI paths:
Usage:
python scripts/check-naming.py path/to/openapi.yaml
Generates RFC 9457 compliant error schemas:
Usage:
python scripts/generate-error-schema.py --type standard
python scripts/generate-error-schema.py --type business --code out-of-credit --title "Insufficient credit"
The skill includes reference resources:
Standard type definitions:
Standard error codes and messages:
Starter OpenAPI 3.0 template:
When reviewing an API, check:
When you ask to review an API, the skill will:
Parse the API specification (OpenAPI/Swagger)
Check naming conventions:
Validate resource modeling:
Review error handling:
Check data types:
Validate versioning:
Generate report:
This skill integrates with:
For detailed guidelines, see:
~/.claude/docs/api-guidelines/naming-conventions.md~/.claude/docs/api-guidelines/resource-modeling.md~/.claude/docs/api-guidelines/error-handling.md~/.claude/docs/api-guidelines/http-methods-headers-status-codes.md~/.claude/docs/api-guidelines/api-versioning.md~/.claude/docs/api-guidelines/common-types.md~/.claude/docs/api-guidelines/json-types.md