skills.by true||false
LibraryHow to run

A product of true||false

Every item lists its source, license and what we changed.

library
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…
flow.mmd

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

  1. One wording per situation, reused everywhere.
  2. Type-safe references (no typos).
  3. The server reports what happened; the client decides how to say it.
  4. 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

  1. 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>
  2. Structured API errors. The server never sends plain text:
    { "error": true, "code": "ERR_INVALID_BARCODE", "details": "expected 13 digits" }
    
    details is for logs and developers, never shown raw to users.
  3. New message: add the key, fill code/title/message/severity, reference it by key.
  4. Prefixes: ERR_ failures, WARN_ warnings, INFO_ neutral/empty states, SUCC_ confirmations.
  5. Copy: say what happened and what to do next; no blame, no "please", no exclamation marks. Never leak internals (stack traces, SQL, hostnames).
  6. 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>).

audit trail

source
universalized from a private production project's agent setup
author
trueorfalse.dev
license
MIT
imported
2026-11-13
verified
2026-11-13
changes
Removed product-specific codes, file paths and framework names; kept the registry pattern, prefixes and payload rule.
privacy scan
pass
scripts
none
in the zip
1 file

works with

Claude, Codex, ChatGPT

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