/react:extract-ui-componentfrom react
Extracts reusable React components from repeated UI patterns. Guides through pattern analysis, API design, implementation, Storybook stories, and refactoring.
Ships in react. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Extract reusable React components from inline patterns found in the codebase.
Before extracting, find 3-5 instances of the pattern in the codebase:
# Search for common button patterns
grep -rn "className.*btn\|className.*button" src/ --include="*.tsx" | head -20
# Search for card-like patterns
grep -rn "className.*card\|className.*rounded.*shadow" src/ --include="*.tsx" | head -20
Document:
Based on the pattern analysis:
React.HTMLAttributes<HTMLElement> for native HTML compatibility// Good: discriminated union for structural variants
type CardProps =
| { variant: 'simple'; title: string; children: React.ReactNode }
| { variant: 'media'; title: string; image: string; children: React.ReactNode };
// Good: extend HTML attributes
interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
variant?: 'primary' | 'secondary' | 'ghost';
size?: 'sm' | 'md' | 'lg';
}
Create the component following the modlet pattern:
ComponentName/
├── index.ts
├── ComponentName.tsx
├── ComponentName.test.tsx
├── ComponentName.stories.tsx
└── types.ts (optional)
Guidelines:
className prop and merge with internal classes using cn()Create stories covering:
Visually verify each story renders correctly.
Add re-exports in index.ts:
export { ComponentName } from './ComponentName';
export type { ComponentNameProps } from './types';
Replace inline patterns one file at a time:
Do not refactor all files at once. One file at a time reduces risk.
Add the new component to the component registry (if one exists).
<button>, <nav>, <main>, not <div> with click handlers)aria-label for icon-only buttonsrole attributes when semantic HTML isn't sufficientclassName prop for customizationWhat SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub bitovi/ai-enablement-prompts --plugin react5 skills in this plugin
/component-registryTrack reusable UI components and unextracted patterns. Maintains a REGISTRY.md inventory of extracted components and patterns that need extraction. Use when auditing components, planning extractions, or checking what components exist./component-reuseEnsure existing UI components are reused before creating new ones. Must run BEFORE any UI implementation. Audits the codebase for matching components and reports whether to REUSE, WRAP, or CREATE./create-react-modletCreate React components, hooks, or utilities following the modlet pattern. Use when creating any component in packages/client/src/components/. Modlets are self-contained folders with index.ts, implementation, tests, stories (for visual), and optional types.Other plugins' skills for the same job