.cursor/skills/rest-api-design/SKILL.md
Apply REST API design and review best practices: resource-oriented URLs, HTTP methods and idempotency, status codes, query parameters, pagination and versioning strategies, JSON request and error shapes, OpenAPI/Swagger documentation, and production concerns (validation, rate limits, CORS, logging). Use when the user asks to design, review, or standardize REST endpoints, fix anti-patterns in paths or responses, choose pagination or API versioning, align error bodies with RFC 9457-style problem details, or improve API docs—even if they say only "REST API" or "review my API".
npx skillsauth add dneprokos/skills-examples rest-api-designInstall 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.
Guide design and review of HTTP JSON APIs that follow REST-oriented conventions. Combine checklist-driven feedback with actionable recommendations.
If the user needs test cases for an existing endpoint, prefer the separate api-test-scenario-generator skill. This skill focuses on shape, semantics, and documentation of the API itself.
Use for requests such as:
Optional: if the workspace has a documentation MCP, you may use it for framework-specific snippets; this skill does not require any MCP.
Inputs (any combination):
Outputs:
/, avoid verbs in URLs. Prefer shallow paths; use query filters instead of deep nesting when possible (/nodes?flowsheetId= vs four-level paths)./v1/, /v2/). Avoid versioning only via query or ad-hoc headers as the sole mechanism.For anti-patterns, troubleshooting tables, production checklist, and Swagger/OpenAPI checklist detail, read references/detail.md when producing a full review.
# Collections (plural nouns)
GET /users
POST /users
GET /users/{id}
PUT /users/{id}
PATCH /users/{id}
DELETE /users/{id}
# Nested resources (keep shallow)
GET /users/{id}/posts
POST /users/{id}/posts
# Prefer not: /getUsers, /createUser, /user (singular collection)
| Method | Typical use | Idempotent | | ------ | ---------------------- | ---------- | | GET | Read | Yes | | POST | Create, actions | No | | PUT | Replace full resource | Yes | | PATCH | Partial update | Yes | | DELETE | Remove | Yes |
| Code | Meaning | Typical use | | ---- | -------------- | ------------------------------------ | | 200 | OK | Successful GET, PUT, PATCH | | 201 | Created | Successful POST creating a resource | | 204 | No Content | Successful DELETE or empty success | | 400 | Bad Request | Malformed request, generic client error | | 401 | Unauthorized | Missing or invalid auth | | 403 | Forbidden | Authenticated but not allowed | | 404 | Not Found | Resource missing | | 409 | Conflict | State conflict, duplicate | | 422 | Unprocessable | Validation / semantic error (common convention) | | 429 | Too Many Requests | Rate limited | | 500 | Server Error | Unexpected server failure |
Use 4xx for client-fixable issues and 5xx only for server-side failures. Do not return 200 with an error payload for failed operations.
Prefer a consistent envelope so clients can parse predictably:
{
"data": { "id": 1, "name": "Example" },
"meta": { "timestamp": "2024-01-15T10:00:00Z" }
}
For collections, include pagination metadata in meta (or a documented top-level object) consistent with your pagination strategy.
Errors (illustrative; align with your standard and RFC 9457 where applicable):
{
"error": {
"code": "VALIDATION_ERROR",
"message": "Validation failed",
"details": [{ "field": "email", "message": "Invalid format" }]
}
}
GET /users?status=active&sort=-createdAt&page=1&pageSize=20
GET /users?fields=id,name,email
GET /products?category=electronics&price_lt=100
Document filter operators if you use suffixes like _lt, _gt, etc.
cursor, limit, nextCursor / hasMore in response.page, pageSize with totalItems, totalPages in the response.Validate page ≥ 1 and pageSize within min/max; return clear error messages for out-of-range pagination (see detail reference).
2024-09-15T08:00:00Z).data-ai
Install and configure Windows Credential Manager style secret storage for PowerShell using SecretManagement and SecretStore. Use when users ask to install secret manager support, set up Credential Manager for GitHub token storage, or bootstrap GitHubToken for PR skills.
development
Generate a complete, compilable unit test file from an Analyst test plan and Architect strategy. Uses AAA pattern, language-specific frameworks (NUnit, JUnit 5, pytest, Vitest), correct mock/real dependency instantiation, constructor null-guard tests, parameterized tests, and setup/teardown hooks. Input is the Analyst JSON plan plus Architect strategy summary. Use when asked to generate test code, write test implementation, create test file, or implement tests from a plan. Also invoked as Phase 3 by the unit-test-generator agent.
development
Define the mocking strategy and assertion style for a unit test plan. Classifies each dependency as mock or real, resolves assertion framework and test file location from project patterns, lists constructor null-guard tests with expected exception types, and specifies abstraction interfaces for non-deterministic calls. Input is a JSON test plan from ut-analyst. Use when asked to define mocking strategy, plan test architecture, classify dependencies as mock vs real, or design test structure. Also invoked as Phase 2 by the unit-test-generator agent.
testing
Analyze a class or function and produce a structured JSON test plan. Classifies all dependencies (interface, abstract, valueObject, dto, primitive), detects non-deterministic calls, enumerates test cases using black-box techniques (Equivalence Partitioning, Boundary Value Analysis, Decision Table, State Transition), and lists constructor null-guard requirements. Use when asked to analyze a class for testing, create a test plan, classify dependencies, or produce test case inventory. Also invoked as Phase 1 by the unit-test-generator agent.