ruleengineeringtrueorfalse
error-codes-registry
Maps stable codes (ERR_/WARN_/INFO_/SUCC_) to titles, messages and severity so UI and API stay consistent.
looks for
- inline error strings in components or controllers
- an API returning plain-text errors
- the same message written twice with different words
- a new failure mode or empty state
outputs
- → a new entry in {{MESSAGES_FILE}}
- → structured error payloads from the server
- → components that render by code
drawing flowchart…
SKILL.md
Error codes and message registry
Never hardcode user-facing error, alert or empty-state strings in components or controllers. Every message has a code in one registry.
Why
- One wording per situation, reused everywhere.
- Type-safe references (no typos).
- The server reports what happened; the client decides how to say it.
- Ready for translation and for docs that link per code.
Registry
// {{MESSAGES_FILE}}
export interface AppMessage {
code: string;
title?: string;
message: string;
severity: "success" | "info" | "warning" | "error";
}
export const MESSAGES = {
ERR_NETWORK_TIMEOUT: {
code: "ERR_NETWORK_TIMEOUT",
title: "Connection timed out",
message: "We couldn't reach the server. Check your connection and try again.",
severity: "error",
},
} as const satisfies Record<string, AppMessage>;
Rules
- No inline strings.
Bad:
<Alert severity="error">Service not configured. Check settings.</Alert>Good:const m = MESSAGES.ERR_SERVICE_OFFLINE; <Alert severity={m.severity}>{m.message}</Alert> - Structured API errors. The server never sends plain text:
{ "error": true, "code": "ERR_INVALID_BARCODE", "details": "expected 13 digits" }detailsis for logs and developers, never shown raw to users. - New message: add the key, fill code/title/message/severity, reference it by key.
- Prefixes:
ERR_failures,WARN_warnings,INFO_neutral/empty states,SUCC_confirmations. - Copy: say what happened and what to do next; no blame, no "please", no exclamation marks. Never leak internals (stack traces, SQL, hostnames).
- Codes are stable: rename the message, never the code.
Customize for your project
{{MESSAGES_FILE}} (e.g. src/registry/messages.ts), your server error
middleware, and where help pages per code live ({{DOCS_DIR}}/errors/<code>).
pairs with
- skilltrueorfalse
api-contract
Locks request/response shapes and change rules so clients and servers can ship independently without breaking.
- a new or changed endpoint
- a field rename, removal or type change
- plain-text error responses
Claude · Codex · ChatGPT - skilltrueorfalse
accessibility
Checks and fixes semantics, keyboard, focus, contrast, labels and motion against WCAG 2.2 AA.
- div or span used as a button
- custom controls (switch, tabs, menu, dialog, combobox)
- icon-only buttons
Claude · Codex · ChatGPT - agenttrueorfalse
docs-drift-auditor
Cross-checks docs against code registries, copy and git history and lists each drift with its file.
- docs that quote buttons or labels
- error-code pages vs. the error registry
- screenshots older than the screen they show
Claude · Codex · ChatGPT