add-empty-error-states

Add empty and error UI states to TanStack Query and route loader views.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

It prevents list and results pages from looking broken when data loads successfully but returns nothing, or when the request fails, by ensuring both empty and error states are explicitly designed and implemented.

Core Features & Use Cases

  • Find data-fetch entry points: locates TanStack Query surfaces (useQuery, useSuspenseQuery), route loaders, and related render sites in the relevant route/component.
  • Validate all three branches: confirms Loading is handled elsewhere (skeletons), and that Empty and Error render correctly in the component or via route-level boundaries.
  • Reuse existing UI primitives: prefers the project’s shadcn-style <EmptyState /> (or equivalent) and proposes the smallest consistent fallback when a primitive is missing.
  • Implement correct UX guardrails: uses specific, user-friendly copy (no raw error messages), includes retry where safe, and ensures empty is not confused with loading.

Quick Start

Use the skill to audit a named route/component and then implement missing empty and error UI by reusing the existing empty/error primitives and adding retry affordances for retry-safe failures.

Frequently Asked Questions about add-empty-error-states

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

FAQPage Schema
How do I handle empty and error states in TanStack Query list pages?

Implementing empty and error UI states involves locating data-fetch entry points like useQuery or route loaders and ensuring they render human-readable messages with retry options when requests fail or return zero results. This skill audits those fetch surfaces to enforce consistent UX guardrails across the render site.

Why does my list page look broken when the API returns no results?

Your list page looks broken because it lacks an explicit empty state UI for when data loads successfully but returns nothing. This skill identifies data-driven views missing dedicated empty and error rendering branches and implements them using existing UI primitives to prevent broken-looking interfaces.

What's the best way to add retry buttons to error states in shadcn UI?

The best way to add retry to error states in shadcn UI is to reuse existing EmptyState or ErrorState primitives and implement retry affordances for safe failures. This skill prioritizes your project's existing UI components to maintain visual consistency while adding retry functionality.

Does this approach work with route loaders or only with useQuery?

This approach works with both route loaders and TanStack Query hooks like useQuery and useSuspenseQuery. The skill enumerates every fetch surface within your route or component to verify that loading, empty, and error branches are all reachable and correctly rendered.

How do I avoid showing raw error messages to users in React data views?

To avoid showing raw error messages in React data views, render user-friendly copy for production while surfacing raw error details only in development. This skill implements correct UX guardrails by ensuring error states display human-readable messages instead of exposing technical error traces.

When should I not use a shared empty state primitive for my list?

You should not use a shared empty state primitive if your project lacks one and needs a highly customized design. This skill prefers reusing existing shadcn-style EmptyState components but proposes the smallest consistent fallback UI when a primitive is missing.