api-error-handling
Installation
SKILL.md
API Error Handling
Use this skill when
- Defining a standard error contract
- Returning precise error codes and messages
- Adding error context without leaking internals
Do not use this skill when
- Internal error logging (use backend-error-handling)
Instructions
- Return a structured error body: code, message, details/fields, traceId.
- Include a stable, machine-readable error code per failure kind.
- Provide field-level validation errors; mention constraints in the message.
- Use 4xx for client errors and 5xx for server errors; never 200 for failures.
- Correlate errors with request tracing.
- Do not leak stack traces, SQL, or internal paths.
- Document the error taxonomy in the API spec.