component

Builds and audits presentational React components with Storybook stories and prop API design.

Updated Nov 20, 2025
One-click install
npx skills add https://github.com/apuya/react-basics-ui --skill component-apuya
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: component
Source: https://github.com/apuya/react-basics-ui/tree/main/.claude/skills/component
Command: npx skills add https://github.com/apuya/react-basics-ui --skill component-apuya

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Presentational components often accumulate business logic, inconsistent prop APIs, missing interaction states, and incomplete Storybook coverage. This Skill enforces a strict props-in/events-out contract, designs minimal prop APIs, and audits components for logic leaks, token violations, and story gaps. ## Core Features & Use Cases - Component Authoring: Scaffolds new components following the react-basics-ui folder conventions — forwardRef + memo, shared size/tone unions, Base* primitive composition, and CSF3 stories. - Storybook Coverage: Generates default, variant-matrix, per-state, and interaction stories with play functions using userEvent and expect assertions. - Library Audits: Runs five audit dimensions (business-logic leaks, state coverage, token leaks, prop API smells, reachability) and produces severity-ranked findings with file:line locations. - Use Case: When adding a new DatePicker variant or reviewing an existing Table component, ask for an audit to receive a report flagging raw hex values, missing disabled-state stories, and props that should be discriminated unions. ## Quick Start Ask the assistant to audit the Button component for business-logic leaks and missing Storybook state coverage.

Frequently Asked Questions about component

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

FAQPage Schema
How do I write Storybook stories for React component states?

Create one CSF3 story per applicable state (default, hover, focus-visible, disabled, loading, error, empty) with the story name matching the state. Add interaction stories using play functions with userEvent and expect for each public behavior like open, submit, or keyboard navigation.

How to design a controlled vs uncontrolled component API in React?

Pick one convention; if supporting both, pair value with defaultValue and onChange, using a hook like useControlledState. Avoid mixing conventions across siblings, since dual sources of truth cause synchronization bugs.

What is a presentational component vs a container component?

A presentational component takes props, renders deterministically, and emits events for state the parent owns. It must not fetch data, read routers or stores, import domain types, or hold business rules — those belong to the consuming application.

How do I detect business logic leaks in UI components?

Grep the component file for imports like useQuery, useMutation, useRouter, useStore, fetch, axios, or API paths. Each hit should be lifted to a prop or callback the consumer supplies, or extracted into a co-located hook taking plain arguments.

When should I use compound components instead of a single props API?

Expose sub-components like Dialog.Header when consumers legitimately rearrange parts; otherwise keep a single closed surface. Sub-components are public API and cost more to evolve, so prefer composition only when rearrangement is a real need.

Why should components avoid raw hex and pixel values in styles?

Raw values bypass the design-token system, causing visual drift and breaking theming. Reference named semantic tokens instead; if a needed token does not exist, propose a name as an open question rather than hardcoding the value.