App First-Generation Safety
Objective
When creating a new application (frontend, backend, CLI) from this template, always provide a minimal but robust safety net:
- a global error boundary around the startup/bootstrap path, and
- for UI frameworks that support it, a top-level UI error boundary,
so that:
- unexpected errors do not result in silent crashes or blank screens, and
- users still see a controlled fallback message plus copyable technical details.
This skill complements the generic patterns from wshobson/error-handling-patterns and specializes them for this template.
version: "1.0.0"
When to Use
Use this skill whenever:
architecture.md defines a new application (web frontend, backend service, CLI, worker, etc.), and
- you are implementing its first generation (initial bootstrap / entrypoint).
Examples:
- creating a new SPA frontend under
apps/<current_project>/frontend/,
- adding a new backend service under
apps/<current_project>/backend/,
- adding a new CLI entrypoint.
version: "1.0.0"
Core Principles
Single boundary per layer
- Each application should have:
- one startup boundary that wraps the main bootstrap path, and
- if applicable, one UI boundary at the top of the visual tree.
Generic, not feature-specific
- Boundaries are generic: they transform any unexpected error into:
- a clean fallback message for users, and
- detailed logs / technical details for developers.
- Do not special-case particular features (e.g. MSW vs something else) inside the boundary.
Separation of concerns
- Local error handling (e.g. validation errors, expected failures) is still handled near the source.
- Boundaries are a last resort for unexpected, unrecoverable errors.
version: "1.0.0"
Process
Step 1 – Identify application type and entrypoint(s)
- Read
architecture.md to determine:
- whether the app is a frontend, backend service, CLI, etc.,
- what the main entrypoints are (e.g.
main.tsx, server.ts, cli.ts).
- For each new application, choose the appropriate boundary mapping:
- Web frontend (React, etc.):
- Startup boundary around the bootstrap function (
main() / bootstrap()),
- UI boundary (top-level Error Boundary component).
- Backend HTTP service:
- Startup boundary around the server bootstrap (e.g.
main() / startServer()),
- Global error handler / middleware for HTTP requests.
- CLI / worker:
- Startup boundary around
main() that converts unexpected errors into:
- exit codes,
- concise terminal output with copyable technical details.
Step 2 – Apply startup boundary (all app types)
For any new application:
- Wrap the main bootstrap path in a
main() (or equivalent) that:
- calls lower-level
bootstrap() / run() functions, and
- is wrapped in a
try { ... } catch (error) { ... } (or language-idiomatic equivalent).
- In the
catch:
- log a generic message and the error details (stack, context),
- produce a safe fallback output:
- web UI → error screen with generic message +
<details><pre> or equivalent for copyable details,
- backend → structured error (e.g. JSON) plus reliable HTTP status,
- CLI → human-readable message plus enough detail that can be copy–pasted.
- Do not silently swallow errors; boundaries must be observable (log + fallback).
Step 3 – Apply UI error boundary (for frontends)
For frontends using a UI framework that supports error boundaries (e.g. React):
- Create a top-level Error Boundary component (for example
AppErrorBoundary in React) that:
- catches rendering / lifecycle errors,
- logs a generic “Unexpected UI error” and technical details,
- renders a generic error screen with:
- a short explanation for users,
- a toggle (
<details>, dialog, or similar) containing copyable technical details (message + stack).
- Wrap the root app component with this boundary in the entrypoint:
- React example:
createRoot(...).render(<AppErrorBoundary><App /></AppErrorBoundary>)
- Keep the boundary generic:
- no feature-specific logic inside (
if (error is from MSW) ...),
- it simply transforms arbitrary exceptions into an understandable fallback.
Step 4 – Keep boundaries aligned with error-handling-patterns
When implementing boundaries:
- Use
wshobson/error-handling-patterns to guide:
- how you structure error types (ApplicationError, ValidationError, etc.),
- what is considered recoverable vs unrecoverable.
- Position boundaries at the edges:
- process boundaries (startup / main),
- user-visible boundaries (UI root, HTTP global handler),
- not deep inside local feature code.
version: "1.0.0"
React + Vite Frontend Mapping (current stack)
For the React + Vite SPA described in docs/<current_project>/architecture.md and implemented under apps/<current_project>/frontend/:
Startup boundary:
- Implement a
main() function in apps/<current_project>/frontend/src/main.tsx that:
- calls
bootstrap() (which may include MSW setup and React rendering),
- wraps the call in a
try/catch and renders an "Unexpected startup error" screen with copyable technical details.
UI boundary:
- Implement an
AppErrorBoundary component under apps/<current_project>/frontend/src/root/ (or equivalent),
- Wrap
<App /> with <AppErrorBoundary> in the React root.
This pattern ensures:
- no silent blank screen on unexpected errors,
- consistent error surfaces with both user-friendly text and copyable debug info.
Source: dsissoko/oneticket-skills — distributed by TomeVault.
1---2name: oneticket-safety-for-vite-react-primer3description: Ensure every new application created from this template has a minimal, generic error boundary at startup and at the UI/root level, based on cross-language error handling patterns. Use when this capability is needed.4---56# App First-Generation Safety78## Objective910When creating a **new application** (frontend, backend, CLI) from this template, always provide a **minimal but robust safety net**:1112- a global error boundary around the startup/bootstrap path, and 13- for UI frameworks that support it, a top-level UI error boundary,1415so that:1617- unexpected errors do not result in silent crashes or blank screens, and 18- users still see a controlled fallback message plus copyable technical details.1920This skill complements the generic patterns from `wshobson/error-handling-patterns` and specializes them for this template.2122version: "1.0.0"23---2425## When to Use2627Use this skill whenever:2829- `architecture.md` defines a new application (web frontend, backend service, CLI, worker, etc.), and 30- you are implementing its **first generation** (initial bootstrap / entrypoint).3132Examples:3334- creating a new SPA frontend under `apps/<current_project>/frontend/`,35- adding a new backend service under `apps/<current_project>/backend/`,36- adding a new CLI entrypoint.3738version: "1.0.0"39---4041## Core Principles42431. **Single boundary per layer**44 - Each application should have:45 - one **startup boundary** that wraps the main bootstrap path, and46 - if applicable, one **UI boundary** at the top of the visual tree.47482. **Generic, not feature-specific**49 - Boundaries are generic: they transform *any* unexpected error into:50 - a clean fallback message for users, and51 - detailed logs / technical details for developers.52 - Do **not** special-case particular features (e.g. MSW vs something else) inside the boundary.53543. **Separation of concerns**55 - Local error handling (e.g. validation errors, expected failures) is still handled near the source.56 - Boundaries are a last resort for unexpected, unrecoverable errors.5758version: "1.0.0"59---6061## Process6263### Step 1 – Identify application type and entrypoint(s)64651. Read `architecture.md` to determine:66 - whether the app is a frontend, backend service, CLI, etc.,67 - what the main entrypoints are (e.g. `main.tsx`, `server.ts`, `cli.ts`).682. For each new application, choose the appropriate boundary mapping:69 - **Web frontend (React, etc.)**:70 - Startup boundary around the bootstrap function (`main()` / `bootstrap()`),71 - UI boundary (top-level Error Boundary component).72 - **Backend HTTP service**:73 - Startup boundary around the server bootstrap (e.g. `main()` / `startServer()`),74 - Global error handler / middleware for HTTP requests.75 - **CLI / worker**:76 - Startup boundary around `main()` that converts unexpected errors into:77 - exit codes,78 - concise terminal output with copyable technical details.7980### Step 2 – Apply startup boundary (all app types)8182For any new application:83841. Wrap the main bootstrap path in a `main()` (or equivalent) that:85 - calls lower-level `bootstrap()` / `run()` functions, and 86 - is wrapped in a `try { ... } catch (error) { ... }` (or language-idiomatic equivalent).872. In the `catch`:88 - log a generic message and the error details (stack, context),89 - produce a safe fallback output:90 - web UI → error screen with generic message + `<details><pre>` or equivalent for copyable details,91 - backend → structured error (e.g. JSON) plus reliable HTTP status,92 - CLI → human-readable message plus enough detail that can be copy–pasted.933. Do **not** silently swallow errors; boundaries must be observable (log + fallback).9495### Step 3 – Apply UI error boundary (for frontends)9697For frontends using a UI framework that supports error boundaries (e.g. React):98991. Create a top-level Error Boundary component (for example `AppErrorBoundary` in React) that:100 - catches rendering / lifecycle errors, 101 - logs a generic “Unexpected UI error” and technical details, 102 - renders a generic error screen with:103 - a short explanation for users, 104 - a toggle (`<details>`, dialog, or similar) containing copyable technical details (message + stack).1052. Wrap the root app component with this boundary in the entrypoint:106 - React example:107 - `createRoot(...).render(<AppErrorBoundary><App /></AppErrorBoundary>)`1083. Keep the boundary **generic**:109 - no feature-specific logic inside (`if (error is from MSW) ...`),110 - it simply transforms arbitrary exceptions into an understandable fallback.111112### Step 4 – Keep boundaries aligned with `error-handling-patterns`113114When implementing boundaries:1151161. Use `wshobson/error-handling-patterns` to guide:117 - how you structure error types (ApplicationError, ValidationError, etc.), 118 - what is considered recoverable vs unrecoverable.1192. Position boundaries at the **edges**:120 - process boundaries (startup / main),121 - user-visible boundaries (UI root, HTTP global handler),122 - not deep inside local feature code.123124version: "1.0.0"125---126127## React + Vite Frontend Mapping (current stack)128129For the React + Vite SPA described in `docs/<current_project>/architecture.md` and implemented under `apps/<current_project>/frontend/`:130131- **Startup boundary**:132 - Implement a `main()` function in `apps/<current_project>/frontend/src/main.tsx` that:133 - calls `bootstrap()` (which may include MSW setup and React rendering),134 - wraps the call in a `try/catch` and renders an "Unexpected startup error" screen with copyable technical details.135136- **UI boundary**:137 - Implement an `AppErrorBoundary` component under `apps/<current_project>/frontend/src/root/` (or equivalent),138 - Wrap `<App />` with `<AppErrorBoundary>` in the React root.139140This pattern ensures:141142- no silent blank screen on unexpected errors,143- consistent error surfaces with both user-friendly text and copyable debug info.144145---146> Source: [dsissoko/oneticket-skills](https://github.com/dsissoko/oneticket-skills) — distributed by [TomeVault](https://tomevault.io).147<!-- tomevault:4.0:skill_md:2026-06-10 -->