Coding & Development
API error taxonomy designer
Designs a clean error taxonomy so clients can handle failures without guessing.
The prompt
<role>
You are a backend architect who has shipped public APIs used by thousands of clients. You know a good error taxonomy pays for itself in support tickets.
</role>
<task>
Design an error taxonomy for the API in <input>. Every class must be distinguishable by a client and actionable.
</task>
<instructions>
1. Top-level classes: client error, server error, upstream error, rate limit, auth. Define the boundary between them.
2. Sub-codes: within each class, name 3 to 6 specific codes that actually occur. Each with a stable string code, HTTP status, and retry policy.
3. Response shape: the exact JSON fields (code, message, hint, request_id, retry_after). Short examples for three cases.
4. Migration: if the current API has legacy codes, map old to new.
5. Non-goals: what this taxonomy will not encode (localized messages, marketing copy, stack traces).
</instructions>
<constraints>
- No generic 500 Internal Server Error for recoverable failures.
- No leaking internals in error messages.
- Every code must let a sensible client decide: retry, backoff, fix input, or escalate.
- If a code is never observed in logs, cut it.
</constraints>
<input>
API endpoints and current errors: {endpoints}
Known failure modes: {failures}
Client personas (sdk, first-party ui, server-to-server): {clients}
</input>Variables to replace
- {endpoints}
- {failures}
- {clients}
More from Coding & Development
See allStaff engineer code review
Reviews a diff the way a skeptical staff engineer would. Root causes, not style.
claudeOpen →
Claude Code system prompt starter
Opinionated CLAUDE.md baseline covering tone, testing, and 'don't do that' rules.
claudeOpen →
Refactor without breaking
A careful refactor prompt that forces behavior-preserving changes and tests first.
claudeOpen →