export const apiCheck = {
    name: "api-check",
    description: "API contract validation — response types match reality, consistent patterns, complete error handling",
    content: `Validate API contracts and consistency across all endpoints.

## 1. Type Safety Audit
For every API route and server action:
- Does the response type match what's actually returned?
- Are request body types accurate?
- Do error responses have typed shapes?
- Are there any as unknown as or type assertions hiding mismatches?

## 2. Response Shape Consistency
Check all API responses for:
- Consistent success shape: { data: T } or { result: T }
- Consistent error shape: { error: string, code: string, status: number }
- Consistent pagination: { data: T[], pagination: { page, limit, total } }
- No mixing of shapes (some routes return { user }, others { data: user })

## 3. HTTP Status Code Audit
For each API route, verify:
- 200 for successful GET
- 201 for successful POST creating a resource
- 204 for successful DELETE
- 400 for validation errors
- 401 for unauthenticated
- 403 for unauthorized (authenticated but not allowed)
- 404 for not found
- 500 for server errors
- No using 200 for errors with { success: false }

## 4. Input Validation Completeness
For every route accepting input:
- Is there Zod (or equivalent) schema validation?
- Are all fields validated (type, format, length, range)?
- Are optional fields properly marked?
- Is validation happening BEFORE any database/external calls?

## 5. Error Response Quality
For every error path:
- Does it return useful error messages?
- Does it NOT leak internal details (stack traces, SQL queries)?
- Does it include error codes for client-side handling?
- Are errors logged with context?

## 6. API Documentation
- Do routes have JSDoc or similar documentation?
- Are complex request/response shapes documented?
- Is there an OpenAPI spec or similar?

## Output: API-AUDIT.md

### Type Mismatches
| Route | Issue | Expected | Actual |
|-------|-------|----------|--------|
| POST /api/users | Missing field in response type | { id, email, name } | { id, email } |

### Inconsistent Patterns
- 5 routes return { data }, 3 routes return raw object
- Error shapes vary across 8 routes

### Missing Validation
- POST /api/orders - no input validation
- PUT /api/users/[id] - partial validation

### Recommendations (prioritized)
1. Create shared response type utilities
2. Add validation to X routes
3. Standardize error responses`
};
//# sourceMappingURL=api-check.js.map