v1.0.0 • AI Agent Skill / Zero Silent Failures

Never ship raw errors again!

Automated 3-part error UX for agent workflows.

Install:
$ npx skills add Kushal20057/error-state-handling
Works out of the box with any agent supporting the open Agent Skills standard.
🚫
0 Stack Traces Hidden safely in server logs
🎯
3-Part Rule What, Why, and What's Next
⚡
On-Sight Refactor Replaces generic alerts proactively
🔒
Zero Leakage Prevents backend info disclosure

The Three Questions Every Error Must Answer

Most production bugs aren't fatal crashes - they're features that succeed in the happy path but turn silent, cryptic, or hostile the instant an edge case triggers.

01
WHAT

What happened?

Written in plain, conversational English without jargon. Explain the situation clearly without raw system abbreviations, HTTP numbers, or database symbols.

✕ Bad ERR_UPLOAD_MAX_PAYLOAD_SIZE
✓ Good Your file exceeds the 10MB limit.
02
WHY

Why did it happen?

Provide a tangible reason that the human user can actually comprehend and act upon — not an internal driver exception or memory address.

✕ Bad 403 Forbidden: auth_session_ttl_exceeded
✓ Good You were inactive for 30 minutes.
03
NEXT

What to do next?

A concrete, single-action recovery step. An interactive button, a guided link, or a clear instruction. Never leave the user at a dead-end period.

✕ Bad Something went wrong. Please try again later.
✓ Good [Re-authenticate & Save Draft]

See The Difference In Real Time

Explore how the skill refactors typical AI code generation from frustrating developer gibberish into empathetic, high-conversion recovery UX.

Scenario: Checkout Payment Failure
Without Skill (Typical AI) With Skill (UX Standard)
checkout.acme.com/pay
Production Safe UX
Why this matters

Card Processing Failure

Server Log (Secure & Traceable)
Private
{"timestamp": "2026-09-18T17:42:01Z", "error_id": "err_984f1a", "status": 402, "card_decline_code": "insufficient_funds"}

The Never vs Always Matrix

Directly from the skill's instructions. When an AI agent loads this skill, these invariants are prioritized over default lazy patterns.

NEVER

Forbidden in user interfaces

  • ✕
    Never show raw backend or system errors

    No stack traces, driver errors, [object Object], or raw HTTP codes like 502 Bad Gateway displayed in the UI.

  • ✕
    Never show generic "Something went wrong"

    A blank apology is not error handling. It gives zero context and leaves users completely stranded without a remedy.

  • ✕
    Never fail silently

    A failed background sync or rejected button click must immediately show visual feedback. A hidden console.log() is the same as zero handling.

  • ✕
    Never trap user inputs or unsaved work

    Never reset forms or discard draft inputs when an error triggers. Preserve user state during failures.

ALWAYS

Required on every failure path

  • ✓
    Log server-side, show client-side

    Capture technical traces and stack traces on the server with a unique Incident ID & timestamp. Only send friendly text to the client.

  • ✓
    Write like a human

    Use conversational language that any non-technical user understands immediately on first glance, avoiding internal jargon.

  • ✓
    Provide a concrete action step

    Every error message must include a button, guided link, or direct instructions ("Retry Payment", "Upload smaller file", "Sign in again").

  • ✓
    Proactively refactor existing bad errors

    Whenever reviewing or modifying existing components, agents refactor raw errors on sight even if not specifically asked.

Works With Every Modern AI Coding Tool

Installed via standard agent skills or loaded directly into your instructions file.

CC

Claude Code

Anthropic CLI
Native

Installs into your workspace's skill store with a single command.

npx skills add Kushal20057/error-state-handling
CW

Cursor & Windsurf

Rules / Cascade
Project Rules

Drop the rules directly into your .cursorrules or .windsurfrules.

curl -o .cursorrules https://raw.githubusercontent.com/...
AG

Antigravity IDE

Workspace Skill
Standard

Place in your .agents/skills/error-state-handling/ root to activate globally.

git clone ... .agents/skills/error-state-handling

The Complete Architecture for Modern Agentic Error UX

Explore the engineering methodology, threat models, and cognitive heuristics that turn silent failures and cryptic crashes into empathetic, high-converting recovery experiences.

Architecture & Philosophy Module 01

The Modern Dilemma: Why AI Coding Assistants Neglect Failure States

Modern software engineering is experiencing an unprecedented revolution driven by autonomous AI coding assistants, code generation models, and agentic workflows such as Claude Code, Cursor, Windsurf, and Copilot. Yet, while Large Language Models excel at generating functional "happy path" logic at breakneck speed, they consistently exhibit a critical architectural blind spot: failure-state negligence.

Left to default prompts, AI agents routinely generate empty catch blocks, unhandled promise rejections, unformatted stack traces, cryptic console.error logs, and unhelpful generic alerts like "Something went wrong." These ubiquitous anti-patterns transform transient edge cases into fatal friction points for end users. When a backend microservice times out, a rate limit triggers, or a payment method is declined, users are abandoned without clarity, context, or direction. Error State Handling was engineered to eliminate this chronic breakdown by establishing an uncompromising, deterministic UX standard across every codebase touched by AI assistants, ensuring resilient software resilience from initial prototype to enterprise production.

💡

Core Heuristic: An edge case is never an anomaly; it is an inevitable chapter in the user journey that requires equal design intention.

Cognitive UX Module 02

The 3-Part Cognitive Standard: Anatomy of Empathetic Recovery

At the core of the Error State Handling specification lies an uncompromising tri-part doctrine. Every user-facing error state must explicitly answer three foundational questions: What happened? Why did it happen? What should the user do next?

The first part, Context, demands clear, conversational human terminology rather than system abstractions like ERR_UPLOAD_MAX_PAYLOAD_SIZE or raw HTTP 504 status codes. The second part, Transparency, delivers a tangible, comprehensible explanation of the root cause—such as informing an editor that thirty minutes of inactivity required a session security refresh, rather than displaying a cryptic auth token expiration string. Finally, the third part, Agency, guarantees that no user is ever left stranded at a dead end. By providing concrete, single-click recovery controls—such as "Re-authenticate & Save Draft", "Retry With Smaller File", or "Update Payment Method"—the interface restores momentum and user autonomy immediately without requiring a full page refresh or causing irreversible loss of entered data.

1. Context: What Happened 2. Transparency: Why It Occurred 3. Agency: Next Step to Resolve
Security & Governance Module 03

Defense-in-Depth: Eliminating Sensitive Data Leakage & CVE Risks

Beyond interface aesthetics and user satisfaction, error handling is a primary frontline pillar of modern web application security and regulatory compliance.

Naive error handling implemented by generative AI frequently leaks proprietary database schemas, raw SQL query parameters, internal microservice URIs, and authentication tokens directly onto client-side viewports. Malicious actors actively manipulate application edge cases to force system exceptions and map out infrastructure topology from unformatted stack traces and framework error payloads. Error State Handling enforces an immutable architectural separation of concerns: technical diagnostics belong strictly on the server, while safe, empathetic guidance belongs in the client interface. The specification instructs AI models to automatically capture full stack traces, request payloads, and environment telemetry inside protected backend log streams tagged with unique Incident IDs (e.g., err_984f1a). The browser receives only sanitized metadata alongside this correlation identifier, allowing customer support and SRE teams to trace issues instantly without exposing system internals to the public internet.

Server: [Structured Log + PII Masked + Incident UUID] ➔ Client: [Empathetic Guidance + Safe Reference ID]
Developer Ergonomics Module 04

Agent Orchestration & The "On-Sight Refactoring" Engine

Error State Handling operates as a lightweight, zero-dependency skill file (SKILL.md) natively compatible with the open Agent Skills specification, Cursor rules (.cursorrules), Windsurf cascades (.windsurfrules), and workspace environments like Antigravity IDE and Claude Code.

Unlike bloated npm packages that inflate dependency trees or lock engineering teams into proprietary UI component wrappers, this standard instructs the AI model's cognitive reasoning engine itself. When loaded into an agent's active memory context, the skill triggers an automatic "On-Sight Refactor" heuristic. Whenever an AI assistant inspects, edits, or generates code across any modern frontend or full-stack framework—including React, Vue, Svelte, Angular, Next.js, or vanilla JavaScript—it identifies substandard, fragile error handling and upgrades it proactively. Whether handling complex multipart uploads, asynchronous form validations, Stripe webhooks, or third-party OAuth flows, agents immediately implement accessible ARIA live alerts, stateful retry triggers, and persistent draft recovery without waiting for manual prompting.

✓ Zero runtime overhead or npm dependency bloat
✓ Framework-agnostic: React, Next.js, Vue, Svelte, Node.js
✓ Proactive code modernization on every file edit
Product Velocity & ROI Module 05

Business Impact: Transforming Failure Points into High-Conversion Retention

In modern software economics, silent friction and abrupt crashes are the single largest source of customer churn, abandoned checkout funnels, and escalating support costs.

A prospective customer confronted with a blank screen or a cryptic [object Object] error during checkout or onboarding will bounce to a competitor within seconds. Conversely, a user presented with an empathetic card offering an immediate fallback—such as switching payment methods or retrying a sync—is retained seamlessly. By standardizing error recovery mechanisms, engineering organizations eliminate up to 70% of repetitive Tier-1 support tickets generated by transient network hiccups or minor client-side formatting discrepancies. Furthermore, by strictly prohibiting form resets during submission failures, the standard safeguards user effort and prevents irreversible loss of typed content. Error State Handling bridges the crucial divide between rapid AI code velocity and enterprise-grade reliability, empowering high-growth teams to ship ambitious products with lasting user trust.

70% Fewer repetitive support tickets from transient glitches
100% Form state preservation on unexpected server rejections
0 Raw stack traces or internal schema leaks exposed to users

Got Questions? Everything You Need to Know

Learn how Error State Handling transforms AI coding habits, integrates with your favorite tool, and keeps production resilient.

When loaded into Claude Code, Cursor, Windsurf, or Antigravity, the skill injects cognitive heuristics into the agent's context. Rather than writing bare try/catch blocks with console.error or dumping raw backend errors like 500 Internal Server Error: [object Object], the agent is trained to build a complete 3-part user experience:

  • What happened: Plain-English explanation free from technical jargon or cryptic codes.
  • Why it happened: An empathetic, comprehensible reason the user can actually understand.
  • What to do next: Actionable recovery pathways such as retry buttons, preserved form state, or direct guided links.

No. The SKILL.md specification is engineered with strict token economy (~1.2KB total prompt size). It leverages compact few-shot matrices and high-density directive rules rather than verbose conversational padding. It loads dynamically when relevant files (APIs, forms, network layers, auth hooks) are being generated or refactored, introducing virtually zero latency to agent inference.

Diagnostic depth is actually improved. The skill strictly enforces the "Log Server-Side, Show Client-Side" invariant. Full stack traces, database exceptions, and third-party response payloads are captured in your telemetry (Datadog, Sentry, CloudWatch, OpenTelemetry) tagged with a unique, cryptographically-safe Incident ID (e.g., #err_984f1a).

The client UI receives only clean, helpful recovery guidance alongside the Incident ID, preventing system architecture leakage while making customer support tickets effortless to triage.

Component libraries provide design primitives (buttons, dialogs, toasts, banners), but they don't give the AI brain any guidance on what copy, state transitions, or recovery actions to build.

Without this skill, an AI will gladly render a sleek shadcn toast with title="Error: 500" and empty actions. Error State Handling acts as the cognitive guidance layer, ensuring whatever UI library you use is populated with resilient, empathetic logic.

Yes! Because the skill is an open markdown specification (SKILL.md), you can fork it or edit it directly in your repo. You can tune the voice guidelines (e.g., enterprise vs conversational), mandate specific internal monitoring libraries, or inject your company's own custom design system error components.

Yes! The skill includes an explicit "On-Sight Refactor" instruction. Whenever an AI assistant is asked to inspect, edit, or extend an existing component that contains silent catch blocks, cryptic alerts, or unhandled promise rejections, it proactively upgrades them to the 3-part UX standard.

💬

Have another question or a custom enterprise setup?

Join the discussion on GitHub or open an issue to contribute to the open skill specification.

Ask on GitHub

Stop building fragile software.

Make failure paths as thoughtfully designed as your happy paths in under 30 seconds.

$ npx skills add Kushal20057/error-state-handling
View Repository