set-up-error-boundaries
Skill7 starsChanged 16 days agoMITView on GitHub
Use when adding error handling to a frontend app - app-shell, page and component error boundaries with a retryable fallback, a captureError seam, and global handlers, ready for an error tracker.
- Reads credentials
1 other project uses a version of this.
Adopted by
Most recently taken up by
- VelimirMueller/claude-skillsword for word, first seen Oct 11, 2026
Other versions1 project uses a version of this.
Word for word · 1
- VelimirMueller/claude-skills★ 7100% same
Edited · 0
None found.
Wrote their own version · 0
None found.
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository156 other files it gives its agents.
- skills/swift/swiftui-design-principles/AGENTS.mdAGENTS.md
- skills/swift/ios-code-audit/CLAUDE.mdCLAUDE.md
- skills/swift/swift-focusengine-pro/llms.txtllms.txt
- build-llm-seamSkill
- build-mcp-serverSkill
- build-rag-pipelineSkill
- secure-llm-featuresSkill
- set-up-llm-evalsSkill
- build-nextjs-backendSkill
- build-supabase-edge-functionSkill
- configure-backend-testsSkill
- design-http-apiSkill
- harden-backendSkill
- scaffold-fastapi-serviceSkill
- scaffold-go-serviceSkill
- scaffold-hono-serviceSkill
- secure-supabase-rlsSkill
- set-up-backend-authSkill
- set-up-background-jobsSkill
- set-up-databaseSkill
- set-up-nextjs-supabase-authSkill
- set-up-observabilitySkill
- set-up-supabaseSkill
- build-cliSkill
- release-cliSkill
- set-up-dev-toolchainSkill
- audit-securitySkill
- audit-toolchainSkill
- extend-skillsetSkill
- promote-releaseSkill
- set-up-stack-profileSkill
- write-commit-messagesSkill
- write-pull-requestsSkill
- analyze-complexitySkill
- apply-algorithmsSkill
- apply-design-patternsSkill
- apply-design-principlesSkill
- apply-solidSkill
- choose-data-structureSkill
- debug-systematicallySkill
- enforce-dependency-ruleSkill
- refactor-safelySkill
- slice-and-estimateSkill
- write-clean-testsSkill
- write-readable-codeSkill
- clean-frontend-scaffoldingSkill
- configure-accessibilitySkill
- configure-analyticsSkill
- configure-ciSkill
- configure-error-trackingSkill
- configure-lintingSkill
- configure-test-stackSkill
- configure-typescriptSkill
- create-moduleSkill
- optimize-performanceSkill
- scaffold-frontend-projectSkill
- set-up-authSkill
- set-up-design-systemSkill
- set-up-document-headSkill
- set-up-feature-flagsSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
5 rules. About 0 are common, 3 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 15
Read .claude/stack-profile.md if present: frontend.framework replaces the detection in step 3.
- Very specific: line 17
Check the root (src/main.tsx / src/main.ts): is the tree wrapped in a boundary, and are errors outside any boundary reported?
- Distinctive: line 21
If a boundary exists at the root, the audit may still find missing page-level placement or missing global handlers.
- Distinctive: line 25
No boundary → full setup (steps 4–6).
- Distinctive: line 46
Component: only what can fail on its own data or a third party (chart, embedded editor, a card fed by an untrusted payload).
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Set Up Error Boundaries
1. Audit current state
grep -rnE "ErrorBoundary|errorCaptured|onErrorCaptured|errorHandler|react-error-boundary|onUncaughtError" src/ package.json 2>/dev/null
ls src/libs/error-reporter.ts .claude/stack-profile.md 2>/dev/nullRead .claude/stack-profile.md if present: frontend.framework replaces the detection in step 3; package_manager replaces pnpm; observability.backend: sentry means run configure-error-tracking right after this skill.
Check the root (src/main.tsx / src/main.ts): is the tree wrapped in a boundary, and are errors outside any boundary reported?
Prerequisites: src/components/atoms/ and molecules/ (set-up-frontend-structure; otherwise write the boundary into a flat src/components/ErrorBoundary/ and note the deviation) and the @/ alias (configure-typescript).
If a boundary exists at the root, the audit may still find missing page-level placement or missing global handlers; report those. A project that already uses react-error-boundary keeps it: add only the captureError seam and the global handlers (error-boundaries.md, "When to deviate").
2. Decide what to do
- No boundary → full setup (steps 4–6).
- Boundary at the root only → add the page boundary (step 5).
- Boundaries present, but no
captureErrorseam or global handlers → add steps 4 (seam) and 5 only. - Everything present → exit "Error boundaries already in place."
3. Detect framework
React or Vue, from the profile or package.json. The seam and the fallback copy are the same; the boundary differs.
4. Write the boundary, the fallback and the seam
Copy the files from ./boundary-code.md, framework branch as detected:
src/components/molecules/ErrorBoundary/— a molecule: one atom (ErrorFallback) plus one behaviour (catch, report, reset). React: a class (React has no function-component boundary;overrideis required bynoImplicitOverride). Vue:onErrorCapturedreturningfalse. Both take a reset hook and clear their state on retry.src/components/atoms/ErrorFallback/— friendly copy, a "Try again" button, stack detail in development only. The Vue version readsimport.meta.env.DEVin<script>:import.metainside a<template>fails the build, whilevue-tscaccepts it.src/libs/error-reporter.ts—captureError(error: unknown, context?)andinstallGlobalErrorHandlers(). One seam, so a provider swap is a one-file change;configure-error-trackingreplaces the body (and removes the global handlers, because Sentry installs its own).
5. Wire the boundaries
Three depths (error-boundaries.md), wired once each:
- App shell: wrap the whole tree in
main.tsx(React) orApp.vue(Vue), outside the Query/Pinia providers so a provider-setup error is still caught. - Page: one boundary around the router outlet in the layout,
keyed by the route (key={pathname}/:key="route.fullPath"). A failing page shows the fallback while header and navigation keep working, and navigating away clears the error. Do not edit every page. - Component: only what can fail on its own data or a third party (chart, embedded editor, a card fed by an untrusted payload).
Errors no boundary sees go to the seam as well:
- React 19:
createRoot(el, { onUncaughtError, onRecoverableError })callcaptureError. LeaveonCaughtErrorunset: the boundary already reports what it catches, and wiring both double-reports. - Vue:
app.config.errorHandler = (error) => captureError(error). - Both:
installGlobalErrorHandlers()once in the entry (event-handler errors in React, timers, rejected promises).
The entry-file code is in ./boundary-code.md, "Wire the boundaries".
6. Verify
pnpm typecheckExpected: exit 0. Add the component test from ./boundary-code.md ("Test") once configure-test-stack has run:
pnpm vitest run --project ui tests/ui/ErrorBoundary.test.tsx # Vue: ErrorBoundary.test.tsIt asserts the fallback appears, captureError is called once, and "Try again" recovers.
Manual: throw in a page component, confirm the fallback replaces only the page, remove the throw, press "Try again", and check the console shows one [captureError] line.
References
- ./boundary-code.md — every file this skill writes, plus the React and Vue tests.
- ./error-boundaries.md — why try/catch is not enough, the three depths, fallback design, the seam and global handlers, the Vue test, anti-patterns.
- ../_shared/glossary.md — "molecule" vs "organism".
- ../_shared/conventions.md —
@/prefix, thetypecheckrule.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

