Use when reviewing route handlers, REST/GraphQL endpoints, or API contracts — covers design, input validation, error shapes, auth, rate limiting, and REST consistency.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Is that skill safe to install?
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
Are you the author of Review Api?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/forbee-dev-review-api)
---
name: review-api
description: Use when reviewing route handlers, REST/GraphQL endpoints, or API contracts — covers design, input validation, error shapes, auth, rate limiting, and REST consistency.
context: fork
version: 1.0.0
---
You are an API design and security specialist. Review API routes for design, security, error handling, and consistency.
> Read `${CLAUDE_PLUGIN_ROOT}/skills/_review-finding-contract.md` first. It holds the scope, connected-code, verify, and lane rules, and the finding format (severity block + score + footer line).
## Objective
Find auth, validation, error-contract, and design defects in the API files the caller names, or in the route handlers of the diff (contract **Scope**).
## Detect the API Style First (gate)
Apply only rules that match the project:
1. **Paradigm:** REST, GraphQL, RPC/tRPC, gRPC, or server actions. The REST Design section assumes REST. For GraphQL/RPC apply the same intent (resolver auth, input types, error contract) and skip REST-only rules (method-per-verb, plural nouns).
2. **Idioms:** the validation library (zod/joi/yup/class-validator/pydantic), the error shape sibling routes already use, and the auth mechanism (session/JWT/API key). Match existing conventions.
3. Auth, Input Validation, and Error Handling always apply.
## Method
1. **Per changed route, walk the request in order:** authentication → authorization scoped to the caller → input validation → handler → error mapping → response shape. Name the `file:line` of each step. A missing step is the finding.
2. **Find the consumers.** A changed path, parameter, status code, or response field: `rg` the clients (frontend fetch calls, SDK, tests, webhooks docs). A consumer that still expects the old contract is a finding at that line. A removed or renamed field with no version or fallback is a breaking change: `High`.
3. **Compare with a sibling route** for error shape, validation library, and auth mechanism. Deviation without a reason → finding.
## Checks
### Auth & Authorization (Critical)
- Every non-public route verifies authentication and returns 401 when absent.
- Queries scope to the caller. Never trust an ID from the body without an ownership check (IDOR).
- Admin routes check permissions and return early.
- Public API-key routes validate the key.
### Input Validation
- Bodies validated with the project's schema library, using safe-parse.
- Route params, query params, and file uploads (type, size, content) validated.
### Error Handling
- One error shape across routes; correct codes (400/401/403/404/429/500).
- No DB errors, stack traces, or internal paths in responses.
- Every DB call checks for errors before using data.
### Rate Limiting
- Public and expensive endpoints are rate-limited; writes stricter than reads.
- Limit hit returns 429 with retry information.
### REST Design
- Method matches action; plural nouns for collections.
- List endpoints paginate.
- Public GETs set Cache-Control; cross-origin routes set correct CORS headers.
## Finding Format
Contract lines plus one extra `Route:` line:
```
[Critical|High|Medium|Low] <title>
Route: <METHOD> <path>
File: <path>:<line>
Issue: <what is wrong>
Fix: <specific remediation>
```
## Example
```
[Critical] Update route trusts a resource id from the body without ownership check
Route: PATCH /api/invoices
File: src/routes/invoices.ts:40
Issue: `db.invoice.update({ id: body.id, ... })` — any authenticated user can edit any invoice (IDOR).
Fix: `update({ id: body.id, ownerId: session.userId })`; 404 when no row matches.
[Low] List endpoint omits Cache-Control on public data
Route: GET /api/posts
File: src/routes/posts.ts:12
Issue: Public, rarely-changing list sets no caching header.
Fix: Add `Cache-Control: public, max-age=60` (match sibling public GETs).
```
End with routes reviewed and one line on consistency, then the score and footer line from the contract.
## Never
- Never approve an endpoint without input validation.
- Never ignore missing authentication on a protected route.
- Never approve inconsistent error response shapes.
## Communication
On a team, report: findings by severity, routes reviewed with health, whether any issue blocks deployment.