/codereview:codereview-apifrom codereview
Reviews API contracts for breaking changes, backward compatibility, and interface consistency. Analyzes REST/RPC endpoints, event schemas, versioning, and input validation.
Ships in codereview. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
A specialist focused on API contracts, breaking changes, and interface consistency. This skill ensures APIs remain stable, well-designed, and backward compatible.
You are an API platform engineer responsible for maintaining contracts with hundreds of consumers. You know that breaking changes cause cascading failures and that good API design prevents years of technical debt.
Removed Endpoints: Any endpoint deleted or moved?
- DELETE /api/v1/users/:id/legacy
Changed Response Structure: Fields removed, renamed, or type changed?
{
- "user_id": "123",
+ "userId": "123", // renamed
- "count": "42",
+ "count": 42, // type changed
- "metadata": {...} // removed
}
Changed Request Parameters: Required params added, optional made required?
- POST /users { name }
+ POST /users { name, email } // email now required = breaking
Changed HTTP Methods: GET → POST, etc.?
Changed Status Codes: 200 → 201, 400 → 422?
Additive Changes Only: New fields should be optional
// ✅ Safe: new optional field
{ name, email, phone? }
// 🚨 Breaking: new required field
{ name, email, phone } // old clients don't send phone
Deprecation Path: Is old behavior still supported?
// ✅ Deprecation with timeline
/**
* @deprecated Use /v2/users instead. Removal: 2025-01-01
*/
Version Strategy: Is versioning consistent?
/v1/, /v2/Accept: application/vnd.api+json;version=2?version=2All Inputs Validated: Type, range, format, length
// 🚨 No validation
const user = await createUser(req.body)
// ✅ Validated
const data = validateSchema(req.body, CreateUserSchema)
const user = await createUser(data)
Validation Errors Clear: Error messages help the caller
// 🚨 Unhelpful
{ error: "Validation failed" }
// ✅ Actionable
{
error: "Validation failed",
details: [
{ field: "email", message: "Invalid email format" },
{ field: "age", message: "Must be between 0 and 150" }
]
}
Reject Unknown Fields: Or explicitly allow them
// ✅ Explicit about extra fields
validateSchema(data, schema, { stripUnknown: true })
Consistent Response Shape: Same shape for success/error
// ✅ Consistent envelope
{ success: true, data: {...} }
{ success: false, error: {...} }
Null vs Absent: Consistent handling
// 🚨 Inconsistent
{ name: "Alice", bio: null } // vs { name: "Bob" } (bio absent)
// ✅ Consistent: always include, use null for missing
{ name: "Bob", bio: null }
Pagination Consistent: Same structure across endpoints
// ✅ Standard pagination
{
data: [...],
pagination: {
page: 1,
pageSize: 20,
total: 100,
hasMore: true
}
}
Idempotent Methods: GET, PUT, DELETE should be idempotent
// 🚨 Non-idempotent PUT
PUT /counter // increments each time
// ✅ Idempotent PUT
PUT /counter { value: 5 } // sets to 5, repeatable
Idempotency Keys: For non-idempotent operations
// ✅ Idempotency key for payments
POST /payments
Idempotency-Key: abc-123
Safe Retries: What happens if called twice?
Stable Error Codes: Clients can programmatically handle
// ✅ Stable code
{ code: "USER_NOT_FOUND", message: "..." }
// 🚨 Unstable: message can change
{ error: "User with ID 123 not found" }
Appropriate HTTP Status Codes:
| Scenario | Code |
|---|---|
| Success | 200, 201, 204 |
| Client error | 400, 401, 403, 404, 422 |
| Server error | 500, 502, 503 |
No Stack Traces in Production: Error details for devs, not users
## API Review Findings
### Breaking Changes 🔴
| Change | Impact | Migration Path |
|--------|--------|----------------|
| Removed `user_id` field | All clients using this field | Use `id` instead |
| Changed `/users` to require `email` | Clients not sending email | Add email to requests |
### Compatibility Issues 🟡
| Issue | Location | Recommendation |
|-------|----------|----------------|
| New required field | `POST /orders` | Make `shipping_address` optional |
| Missing deprecation notice | `GET /v1/legacy` | Add deprecation header |
### Design Recommendations 💡
- Consider pagination for `/users` endpoint (currently returns all)
- Add rate limiting headers to responses
- Include request ID in error responses
□ Breaking Changes
□ Endpoints removed/moved?
□ Response fields removed?
□ Request params now required?
□ Types changed?
□ Backward Compatibility
□ New fields optional?
□ Deprecation path exists?
□ Versioning consistent?
□ Validation
□ Inputs validated?
□ Errors actionable?
□ Unknown fields handled?
□ Output Guarantees
□ Response shape consistent?
□ Null handling consistent?
□ Pagination standard?
□ Idempotency
□ Methods correctly idempotent?
□ Idempotency keys for mutations?
□ Errors
□ Codes stable?
□ Status codes appropriate?
□ No internal details leaked?
/users, not /getUsers/users, not /user/users/:id/ordersPOST /api/doEverything/api/createUseruser_id and userIdWhat SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub xinbenlv/codereview-skills --plugin codereview16 skills in this plugin
/codereview-architectDeep codebase context analysis like Greptile. Analyzes blast radius of changes, dependency graphs, and architectural consistency. Use when reviewing changes to core utilities, shared libraries, or database models./codereview-concurrencyReview distributed systems patterns, concurrency, and resilience. Analyzes retry policies, idempotency, timeouts, circuit breakers, and race conditions. Use when reviewing async code, workers, queues, or distributed transactions./codereview-configReview configuration, secrets, and environment handling. Checks for safe defaults, secret management, feature flags, and environment parity. Use when reviewing config files, environment variables, or feature flags.Other plugins' skills for the same job