backend-error-handling

backend-error-handling is a skill for Claude Code, Codex from kensaurus/cursor-kenji. It costs 60 tokens per session (2,843 once invoked), scanned A, original, MIT.

A guide for adding consistent error handling across application boundaries, user messages, and API responses.

In plain words
What is it for?
Use it to add error boundaries, error toasts, or a shared format for API errors and failed actions.
Why use it?
It prevents errors from becoming blank screens, inconsistent messages, or unsafe technical details shown to users.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to add error boundaries, error toasts, or a shared format for API errors and failed actions.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/kensaurus/cursor-kenji/backend-error-handling
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add kensaurus/cursor-kenji --skill backend-error-handling
Clone the repo
git clone --depth 1 https://github.com/kensaurus/cursor-kenji

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for backend-error-handling

README.md
[![agentmods](https://agentmods.dev/badge/skills/kensaurus/cursor-kenji/backend-error-handling.svg)](https://agentmods.dev/skills/kensaurus/cursor-kenji/backend-error-handling)
Your own site
<a href="https://agentmods.dev/skills/kensaurus/cursor-kenji/backend-error-handling"><img src="https://agentmods.dev/badge/skills/kensaurus/cursor-kenji/backend-error-handling.svg" alt="Measured on agentmods" height="20"></a>
Per session 60 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,843 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00060 $0.02843
Opus 5 $0.00030 $0.01422
Sonnet 5 $0.00012 $0.00569
Haiku 4.5 $0.00006 $0.00284

Measured 5d ago against content hash e1205c34c491, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, from the pricing page.

Security

Grade A, and why

backend-error-handling scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/backend-error-handling/SKILL.md · 492 lines

How it starts

The opening of the file, as written. The whole thing — 492 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Error Handling Skill

Degree of freedom: MIXED. Which layer and message [HIGH freedom]; existing-type/boundary probes [LOW freedom — run exactly].

How to reason

  1. Observe — existing error types, boundaries, ActionResult / ApiError
  2. Interpret — missing layer vs inconsistent shape vs swallowed catch
  3. Classify — reuse-existing / extend-codes / add-boundary / toast-only
  4. Severity — unhandled 500 on a mutation outranks a missing toast

Worked example

Observe: createUser throws Prisma P2002; UI shows a blank catch; ActionResult already lives in types/errors.ts. Interpret: known conflict is unmapped; no field/toast path. Classify: reuse ActionResult + CONFLICT; toast the message; do not add a second error type. Verify: duplicate email returns { success: false, error: { code: 'CONFLICT' } }; form alert shown.

Self-critique before reporting

  • Reuse shape — searched ActionResult / ApiError / error.tsx before adding a type
  • User-safeINTERNAL_ERROR is generic; PII is not in the client message
  • Layered — boundary + action result + toast, not toast-only
  • Right owner — plan-only observability audit → plan-error-handling; live Sentry triage → debug-sentry-monitor

full error handling patterns for full-stack applications.

When to Use

  • Adding error handling to new features
  • Improving error user experience
  • Standardizing error responses
  • Debugging error propagation
  • Adding error monitoring

CRITICAL: Check Existing First [LOW freedom — run exactly]

Before adding ANY error handling, verify:

  1. Check for existing error types:
rg "type.*Error|interface.*Error" --type ts
rg "ActionResult|ApiError" --type ts
  1. Check for existing error boundaries:
ls -la app/error.tsx app/global-error.tsx
rg "ErrorBoundary" --type tsx
  1. Check for existing error utilities:
rg "formatError|handleError|reportError" --type ts
ls -la src/lib/errors* src/lib/error* 2>/dev/null # @/lib/errors

Read the full file on GitHub · 492 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 5d ago First seen · 492 lines · 60 tokens per session scan A e1205c34c491

Subscribe to this mod's changes

backend-error-handling is a skill published in the GitHub repository kensaurus/cursor-kenji (9 stars, last pushed 10d ago), licensed MIT. It adds 60 tokens to every session and 2,843 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.

Related

Other skills, from other repositories

error-handling-standardizer

Creates consistent error handling with custom error classes, HTTP status mapping, structured logging, safe client messages, and error taxonomy. Use when standardizing "error handling", "logging", "error responses", or "exception management".

patricio0312rev/skills · 50 tokens

backend-latency-profiler-helper

Identifies API latency hotspots and bottlenecks with profiling tools, slow endpoint detection, suspected causes, and fix roadmap. Use for "latency profiling", "performance bottlenecks", "slow APIs", or "backend performance".

patricio0312rev/skills · 54 tokens

error-handling

Python error handling patterns for FastAPI, Pydantic, and asyncio. Follows "Let it crash" philosophy - raise exceptions, catch at boundaries. Covers HTTPException, global exception handlers, validation errors, background task failures. Use when: (1) Designing API error responses, (2) Handling RequestValidationError…

jiatastic/open-python-skills · 95 tokens

diagnose-backend-bug

Diagnose a bounded backend or multi-service failure from GitHub Issues, Jira, Aone, user-provided exports, logs, traces, responses, stack traces, or job records. Use when a service, API, RPC, worker, queue, CLI, or scheduled job bug needs correlation through the project's existing observability route before repair; do…

QoderAI/better-harness · 87 tokens

lcx-report-bug

Create a high-signal bug issue or PR in the repo that owns the defect. Use this whenever the user asks to report, file, open, or triage a LazyCodex, lazycodex-ai, omo-codex, Codex plugin, or upstream Codex CLI bug, especially when they need source-backed root cause, reproduction steps, fix guidance, and GitHub routing.

code-yeongyu/oh-my-openagent · 85 tokens

ast-grep

Searches and rewrites code by AST shape across 25 languages. Use when the target is a syntax pattern (every call/class/import shaped like X, a codemod, a YAML rule) rather than literal text; for plain strings, comments, or filenames, use rg.

code-yeongyu/oh-my-openagent · 61 tokens