component

Creates route-scoped React and Astro components that own their own data fetching.

4|Updated Jul 30, 2026
One-click install
npx skills add https://github.com/gabriellst/codm --skill component-gabriellst
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: component
Source: https://github.com/gabriellst/codm/tree/main/.claude/skills/component
Command: npx skills add https://github.com/gabriellst/codm --skill component-gabriellst

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? It enforces a consistent architecture for building route-scoped UI components across a React web app and an Astro landing site, preventing prop drilling, misplaced data fetching, and inconsistent loading or empty states. ## Core Features & Use Cases - Platform routing: Detects the working directory and loads only the matching child guide — TanStack Router patterns for React or static-first island patterns for Astro. - Data ownership rules: Components fetch their own data via React Query SDK hooks, read URL state through routeApi.useSearch(), and handle mutations internally with toast and cache invalidation. - Pattern registry: Ships registries of mandatory patterns and detectable bad practices (icon libraries, skeletons, enum labels, aria-labels, dialog stores) to keep code reviewable and testable. - Use Case: When adding a product list page, the skill scaffolds a ProductList component that reads pagination from the URL, queries the SDK, renders skeletons while loading, and maps items to leaf ProductCard components. ## Quick Start Ask the agent to create a route-scoped component for a given route, for example: create a ProductList component for the products route that fetches products and handles pagination.

Frequently Asked Questions about component

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

FAQPage Schema
How do I create a React component that fetches its own data with TanStack Router?

Use getRouteApi to read search params via routeApi.useSearch(), then call the SDK query hook inside the component. The route never passes data as props; React Query deduplicates identical requests across components.

When should a component receive props instead of owning its query?

Apply the rule: am I rendered N times in a .map()? If yes, the component is a leaf and receives a single item as a prop while the parent owns the list query. Leaves may own mutations but should not re-fetch the item they received.

Can I use React hooks inside an Astro component file?

No. Astro frontmatter runs at build or SSR time, so hooks like useState or useQuery never execute there. Move the interactive piece into a .tsx React island and mount it from the .astro file with a client directive such as client:visible.

What is the difference between client:load and client:visible in Astro islands?

client:load ships JavaScript during initial page load and suits critical above-the-fold interactivity. client:visible defers hydration until the island scrolls into view and is the default choice for below-the-fold widgets like forms or carousels.

When should I not use this component skill?

Use the primitive skill for reusable design system components, the route skill for new pages, the form skill for validated forms, and the store skill for Zustand state management. This skill covers route-specific components and dialog shells only.