add-skeleton-loaders

Add layout-matching shadcn skeleton placeholders to TanStack Start routes with async data fetching.

22|3|Updated Jul 28, 2024
One-click install
npx skills add https://github.com/webdevcody/go-mailing-list --skill add-skeleton-loaders
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: add-skeleton-loaders
Source: https://github.com/webdevcody/go-mailing-list/tree/main/.claude/skills/add-skeleton-loaders
Command: npx skills add https://github.com/webdevcody/go-mailing-list --skill add-skeleton-loaders

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Route pages often show spinners, blank gaps, or mismatched placeholders while async data loads, causing layout shift and a confusing first-second user experience.

Core Features & Use Cases

  • Detect async fetch sites in TanStack Start routes: Identifies useSuspenseQuery, useQuery, and route loader-based pending behavior that must be covered.
  • Enforce layout-matching skeleton placeholders: Requires shadcn <Skeleton /> blocks with shape, count, and approximate dimensions that mirror the eventual content.
  • Fix loading gaps inline with correct boundaries: Ensures each independently fetched region has its own <Suspense> or pending branch so fast sections don’t wait for slow ones.

Quick Start

Use the add-skeleton-loaders skill on your updated route file to audit every async fetch and insert correctly shaped <Skeleton /> placeholders for each loading region.

Frequently Asked Questions about add-skeleton-loaders

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

FAQPage Schema
How do I add skeleton loaders in TanStack Start to prevent layout shift?

To prevent layout shift in TanStack Start, wrap independently fetched regions in `<Suspense>` boundaries with shadcn `<Skeleton />` fallbacks that match the shape and dimensions of your real UI components.

Why does my React Suspense fallback show a blank gap instead of a loading skeleton?

A blank gap appears when your React Suspense fallback lacks a skeleton placeholder matching the loaded layout. You need to add shadcn `<Skeleton />` blocks mirroring the expected content shape and count for each fetch region.

How do I handle multiple independent data fetches with useSuspenseQuery without waiting for the slowest one?

To prevent fast sections from waiting on slow ones, wrap each independent `useSuspenseQuery` fetch in its own `<Suspense>` boundary or `isPending` branch rather than relying on a single router-wide pending component.

When should I avoid using defaultPendingComponent for async route loaders in TanStack Start?

Avoid using `defaultPendingComponent` when a route has multiple independent fetch regions with varying load times, as it forces all sections to wait for the slowest query instead of rendering individual skeleton placeholders inline.

What is the best way to match skeleton UI placeholders to real content dimensions?

The best way to match skeleton UI placeholders to real content is using shadcn `~/components/ui/skeleton` blocks, ensuring the skeleton shape, count, and approximate dimensions directly mirror the eventual loaded data components.

Does this skeleton loader approach work with useQuery isPending states in TanStack Start?

Yes, this approach works with `useQuery` by replacing blank `isPending` branches with correctly shaped shadcn `<Skeleton />` placeholders, ensuring users see layout-matching loading states instead of spinners or gaps during async data fetching.