skills/api-conventions/SKILL.md
REST API design conventions and standards. Apply when writing, reviewing, or discussing API endpoints, routes, controllers, serializers, or HTTP handlers. Covers URL structure, HTTP methods, response formats, error handling, pagination, versioning, and authentication headers.
npx skillsauth add codewithbehnam/cc-docs api-conventionsInstall 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.
/user-profiles, not /userProfiles or /user_profiles/orders, /products, /users/orders/{id}/items is fine; /orders/{id}/items/{id}/notes is too deep - promote notes to a top-level resourceDELETE /sessions/{id} not POST /logoutGET /products?category=books&min_price=10| Method | Semantics | Idempotent | Safe | |--------|-----------|------------|------| | GET | Read resource(s) | Yes | Yes | | POST | Create resource or trigger action | No | No | | PUT | Replace resource entirely | Yes | No | | PATCH | Partial update | No | No | | DELETE | Remove resource | Yes | No |
POST /resources to create. Return 201 Created with Location header pointing to the new resource.PATCH for partial updates, not PUT, unless clients always send the full representation.All responses use JSON. Property names use camelCase:
{
"id": "ord_01HXZ",
"userId": "usr_abc",
"status": "pending",
"createdAt": "2025-03-15T10:00:00Z",
"items": [
{ "productId": "prd_xyz", "quantity": 2, "unitPrice": 9.99 }
]
}
"2025-03-15T10:00:00Z"currency field{
"error": {
"code": "validation_error",
"message": "Request validation failed",
"details": [
{ "field": "email", "issue": "Must be a valid email address" }
],
"requestId": "req_01HXZ"
}
}
code (snake_case string) for programmatic handlingmessage for displayrequestId for support and tracing| Code | When to use | |------|-------------| | 200 | Successful GET, PATCH, or DELETE with body | | 201 | Successful POST that created a resource | | 204 | Successful DELETE or action with no response body | | 400 | Client sent an invalid request (validation errors) | | 401 | Authentication required or invalid credentials | | 403 | Authenticated but not authorized for this resource | | 404 | Resource not found (or deliberately hidden) | | 409 | Conflict (duplicate, optimistic lock failure) | | 422 | Request is valid JSON but semantically wrong | | 429 | Rate limit exceeded | | 500 | Unexpected server error |
Never return 200 with an error body.
Use cursor-based pagination for all list endpoints returning potentially large data:
GET /orders?limit=25&cursor=eyJpZCI6IjEwMCJ9
Response:
{
"data": [ ... ],
"pagination": {
"limit": 25,
"nextCursor": "eyJpZCI6IjEyNSJ9",
"hasMore": true
}
}
/v1/orders, /v2/ordersDeprecation response header; support them for at least 12 monthsAuthorization: Bearer <token> for API keys and JWT tokenssk_live_..., pk_test_...WWW-Authenticate header in 401 responsesGET /products?status=active&category=booksGET /orders?sort=createdAt&order=desc (default to asc)GET /products?q=wireless+headphonesGET /orders?createdAfter=2025-01-01&createdBefore=2025-03-01Idempotency-Key header on POST requests that create resources or trigger payments409 Conflict if the same key is used with a different request bodyAlways return these headers:
X-RateLimit-Limit: 1000
X-RateLimit-Remaining: 487
X-RateLimit-Reset: 1741694400
Retry-After: 30 (only on 429)
tools
macOS GUI automation CLI. Use steer to see the screen, click elements, type text, send hotkeys, scroll, drag, manage windows and apps, run OCR on Electron apps, and wait for UI conditions.
testing
Ship workflow: merge main, run tests, review diff, bump VERSION, update CHANGELOG, commit, push, create PR.
testing
Import cookies from your real browser (Comet, Chrome, Arc, Brave, Edge) into the headless browse session. Opens an interactive picker UI where you select which cookie domains to import. Use before QA testing authenticated pages.
development
Weekly engineering retrospective. Analyzes commit history, work patterns, and code quality metrics with persistent history and trend tracking. Team-aware: breaks down per-person contributions with praise and growth areas.