void-loading-error-boundaries

Place Next.js App Router loading, error, and not-found boundary files at the correct route segments.

Updated May 29, 2026
One-click install
npx skills add https://github.com/voidcorp-core/void-harness --skill void-loading-error-boundaries-voidcorp-core
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: void-loading-error-boundaries
Source: https://github.com/voidcorp-core/void-harness/tree/main/packages/cli/core-assets/packs/pack-nextjs/skills/void-loading-error-boundaries
Command: npx skills add https://github.com/voidcorp-core/void-harness --skill void-loading-error-boundaries-voidcorp-core

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires @sentry/nextjs.

What problem does it solve? Next.js App Router boundary files (loading.tsx, error.tsx, not-found.tsx) are often placed too high, causing whole-page flashes on partial loads, or too low, letting errors leak past the intended catch. This Skill guides correct per-segment placement so each route streams independently and failures are handled gracefully. ## Core Features & Use Cases - Boundary placement rules: Explains the four boundary files (loading.tsx, error.tsx, not-found.tsx, global-error.tsx), what each wraps, and when each renders. - Skeleton design guidance: Shows how to build skeletons that match the final layout shape to avoid layout shift and jarring content appearance. - Error handling with Sentry: Provides an error.tsx pattern that captures exceptions to Sentry, hides stack traces from users, and offers a recovery action. - Use Case: When adding a new /dashboard/[id] route, use this Skill to decide which boundary files the segment needs, write a layout-matching skeleton, and wire Sentry capture into the error boundary. ## Quick Start Ask the agent to add loading, error, and not-found boundaries for a new route in the app directory with a skeleton matching the page layout.

Frequently Asked Questions about void-loading-error-boundaries

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
Where should I put loading.tsx in the Next.js App Router?

Place loading.tsx at the route segment that owns the unique loading state, not at the app root. Per-route boundaries let each route stream independently, so a slow /dashboard does not blank out /settings while the user is on it.

How do I handle errors in Next.js Server Components with error.tsx?

Create an error.tsx file as a Client Component in the route segment; it wraps the sibling page and descendants in an error boundary. Capture the error to Sentry in a useEffect, hide technical details from users, and provide a reset button for recovery.

Does error.tsx need to be a Client Component in Next.js?

Yes, error.tsx and global-error.tsx must be Client Components because they catch React errors through the error boundary mechanism. Add the 'use client' directive at the top of the file.

Why does my Next.js skeleton cause layout shift when content loads?

Layout shift happens when the skeleton's dimensions do not match the final content. Build skeleton bricks that reserve the exact space of the real layout, using matching heights and grid spans, instead of a centered spinner.

When should I use global-error.tsx instead of error.tsx?

Use global-error.tsx only to catch errors thrown in the root app/layout.tsx itself, which is rare. It must render its own html and body tags because it replaces the root layout entirely.