add-empty-error-states

Add empty and error UI states to TanStack Query and Router data-fetch surfaces.

121|2|Updated Apr 24, 2026
One-click install
npx skills add https://github.com/AgentSystemLabs/core --skill add-empty-error-states
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: add-empty-error-states
Source: https://github.com/AgentSystemLabs/core/tree/main/plugins/agentsystem-core/skills/add-empty-error-states
Command: npx skills add https://github.com/AgentSystemLabs/core --skill add-empty-error-states

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill prevents broken-feeling pages by ensuring your app shows clear, actionable UI when fetched data returns zero results or fails to load.

Core Features & Use Cases

  • Finds data-fetch entry points: Traces useQuery / useSuspenseQuery, route loaders, and loader/fetcher consumption sites to determine where empty and error UI must live.
  • Validates the three required branches: Confirms Loading (out of scope for this skill), plus correct Empty and Error handling for each fetch surface.
  • Reuses existing UI primitives: Preferentially uses the project’s existing <EmptyState /> (or equivalent) and proposes the smallest consistent component only if nothing matches.
  • Applies safe, user-friendly error messaging: Ensures errors show a human-readable message and includes retry affordance, surfacing raw error details only in dev.

Quick Start

Tell the AI: “Add empty and error states for the route/component I just wired with useQuery or a TanStack loader, using the project’s existing EmptyState/ErrorState patterns.”

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 add empty and error states to a React component using TanStack Query?

To add empty and error states to TanStack Query components, trace useQuery or useSuspenseQuery hooks to insert required branch handling, reuse existing UI primitives, and ensure user-safe error messaging with dev-gated details and retry functionality.

What is the best way to handle empty UI states when fetched data returns zero results?

The best way to handle empty UI states is to validate the data-fetch entry points and render a clear, actionable UI, preferentially reusing the project’s existing EmptyState component to maintain visual consistency across the application.

How do I safely display error details in a React frontend without exposing them to users?

To safely display error details in a React frontend, show a human-readable message and retry option to the user, while gating raw error specifics so they only surface during development for debugging purposes.

Does this approach to error handling work with TanStack Router and route loaders?

Yes, this error handling approach works with TanStack Router by targeting loader-based rendering and loader consumption sites after the data-fetch wiring is in place, ensuring correct empty and error handling for each fetch surface.

Why does my component break when a useQuery fetch fails without an ErrorBoundary?

A component breaks on useQuery fetch failure without an ErrorBoundary because it lacks the required error handling branch, which must render user-safe messaging and retry affordance instead of crashing the application.

Can I reuse my existing UI primitives when adding retry logic to error states?

Yes, you can reuse existing UI primitives when adding retry logic, as the process preferentially selects the project’s existing EmptyState or ErrorState patterns and only proposes a minimal matching component if nothing fits.