br-error-contract

Community

Enforce a universal error envelope for APIs.

AuthorLonsdale201
Version1.0.0
Installs0

System Documentation

What problem does it solve?

Reference for developers writing handlers that throw structured errors and for AI agents/clients interpreting better-route error responses. It codifies the invariant error envelope {error: {code, message, requestId, details}} used across all status codes and explains the normalization rules that prevent leaking sensitive data.

Core Features & Use Cases

  • Standardized envelope: every error uses the same {error: {code, message, requestId, details}} shape.
  • Guidance on common codes and how to throw ApiException for full control, including examples for 400, 401, 403, 404, 409, 429, and 503.
  • WP_Error integration and v0.3.0 normalization rules, ensuring safe serialization and consistent behavior for consumers and AI agents.

Quick Start

Implement error handling by throwing ApiException with a proper status and machine-readable code to produce a consistent error envelope.

Dependency Matrix

Required Modules

None required

Components

Standard package

💻 Claude Code Installation

Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.

Please help me install this Skill:
Name: br-error-contract
Download link: https://github.com/Lonsdale201/wp-agent-skills/archive/main.zip#br-error-contract

Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
View Source Repository

Agent Skills Search Helper

Install a tiny helper to your Agent, search and equip skill from 471,000+ vetted skills library on demand.