react-composition

Designs React component APIs using compound components, slots, hooks, and context boundaries.

15|3|Updated Jul 9, 2026
One-click install
npx skills add https://github.com/kiurakku/cursor-kit-for-ai --skill react-composition-kiurakku
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: react-composition
Source: https://github.com/kiurakku/cursor-kit-for-ai/tree/main/plugins/frontend/skills/react-composition
Command: npx skills add https://github.com/kiurakku/cursor-kit-for-ai --skill react-composition-kiurakku

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? React components often degrade into prop-heavy, deeply drilled, or monolithic structures that are hard to read and maintain. This Skill diagnoses composition smells like prop explosion, boolean prop matrices, and god components, then applies the right composition pattern to fix them. ## Core Features & Use Cases - Smell Detection: Identifies prop explosion, boolean matrices, prop drilling, god components, and render callback hell with a severity model for prioritizing refactors. - Pattern Catalog: Provides implementations for compound components, slot patterns, render props vs custom hooks, context boundaries, and prop drilling alternatives with before/after call-site examples. - Use Case: A Select component with 12 configuration props gets refactored into a compound component (Select.Trigger, Select.Content, Select.Item) so consumers compose readable JSX instead of passing prop spreadsheets. ## Quick Start Review this React component for composition problems and propose a refactoring using compound components or slots with before and after call-site examples.

Frequently Asked Questions about react-composition

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

FAQPage Schema
How do I fix prop drilling in React components?▼

Prop drilling is fixed by passing content as children or slot props to eliminate intermediaries, placing context at the lowest common ancestor for shared state, or fetching data in a Server Component and passing it directly to the client child. Drilling two levels is acceptable and needs no refactor.

When should I use compound components in React?▼

Use compound components when a UI has multiple coordinated parts like tabs, accordions, selects, or modals, and consumers should reorder or omit parts. Shared internal state lives in context, and parts are exported as Component.SubComponent for discoverability.

Render props vs custom hooks: which should I use?▼

Use a custom hook when sharing logic only, since hooks are cleaner in DevTools and avoid nesting. Use render props when the consumer must control rendering of shared logic. If a render prop only shares state, extract it into a hook.

Does React context cause performance problems?▼

Context re-renders all consumers when its value changes, so a single app-wide context causes widespread re-renders. Split contexts by update frequency, place providers at the lowest common ancestor, or use selector-based libraries like zustand or use-context-selector.

When is a React component too big and needs splitting?▼

A component over 300 lines handling multiple concerns is a god component and should be split, while over 500 lines demands refactoring in the current PR. More than 8 props or 6 boolean flags also signals a composition problem.