api-error-standard

Defines the standard error response format for HTTP APIs based on RFC 7807 Problem Details. Use when implementing or reviewing API error responses.

16 stars

Best use case

api-error-standard is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Defines the standard error response format for HTTP APIs based on RFC 7807 Problem Details. Use when implementing or reviewing API error responses.

Teams using api-error-standard should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/api-error-standard/SKILL.md --create-dirs "https://raw.githubusercontent.com/woojubb/robota/main/.agents/skills/api-error-standard/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/api-error-standard/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How api-error-standard Compares

Feature / Agentapi-error-standardStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Defines the standard error response format for HTTP APIs based on RFC 7807 Problem Details. Use when implementing or reviewing API error responses.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# API Error Response Standard

## Rule Anchor

- `AGENTS.md` > "No Fallback Policy"
- `AGENTS.md` > "Type System (Strict)"

## Use This Skill When

- Implementing HTTP API error responses.
- Reviewing API endpoint error handling.
- Adding new error types to an API surface.

## Standard Format (RFC 7807)

All HTTP API error responses MUST use the Problem Details format:

```ts
interface IProblemDetails {
  type: string; // URI reference identifying the error type
  title: string; // Short human-readable summary
  status: number; // HTTP status code
  detail?: string; // Human-readable explanation specific to this occurrence
  instance?: string; // URI reference identifying the specific occurrence
}
```

## SSOT

The canonical `IProblemDetails` interface is owned by the API package or app that exposes the HTTP
surface. Shared consumers must import from that owner instead of redeclaring the same shape.

## Usage Rules

1. **Always return Problem Details** for 4xx and 5xx responses.
2. **Use specific `type` URIs** — not generic strings. Format: `urn:robota:error:<domain>:<error-name>`.
3. **Match `status` to HTTP status code** — do not return 200 with an error body.
4. **Include `detail`** for errors that need context beyond the title.
5. **Never expose internal details** (stack traces, database errors, internal paths) in production responses.

## Error Type Registry Pattern

Each API package should maintain a typed error union:

```ts
type TOrderError = 'ORDER_NOT_FOUND' | 'ORDER_ALREADY_COMPLETED' | 'INSUFFICIENT_INVENTORY';

function toHttpStatus(error: TOrderError): number {
  const statusMap: Record<TOrderError, number> = {
    ORDER_NOT_FOUND: 404,
    ORDER_ALREADY_COMPLETED: 409,
    INSUFFICIENT_INVENTORY: 422,
  };
  return statusMap[error];
}
```

## Anti-Patterns

- Returning `{ error: true, message: "something went wrong" }` without structure.
- Returning 200 status with an error body.
- Exposing stack traces or internal error messages to clients.
- Using inconsistent error shapes across endpoints in the same API.
- Catching all errors and returning a generic 500 without classification.

## Checklist

- [ ] All error responses use `IProblemDetails` shape.
- [ ] Error `type` field uses the `urn:robota:error:` namespace.
- [ ] HTTP status code matches the error semantics.
- [ ] No internal details exposed in production error responses.
- [ ] Error types are documented in the package SPEC.md.

Related Skills

We are still matching the closest adjacent skills for this page. In the meantime, continue through the full directory.