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/thefear078/cursor-kit-for-ai --skill react-composition-thefear078
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: react-composition
Source: https://github.com/thefear078/cursor-kit-for-ai/tree/main/plugins/frontend/skills/react-composition
Command: npx skills add https://github.com/thefear078/cursor-kit-for-ai --skill react-composition-thefear078

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? React components often degrade into prop explosions, boolean prop matrices, deep prop drilling, and god components that are hard to maintain and reuse. This Skill diagnoses those composition smells and prescribes concrete refactoring patterns with before/after call-site examples. ## 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. - Use Case: When refactoring a Select or Modal component with 12+ props, use this Skill to convert it into a compound component with Component.SubComponent exports and implicit shared state via context. ## Quick Start Review this component's props and consumers, then recommend a composition pattern 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 to eliminate intermediaries, placing context at the lowest common ancestor of consumers, 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 that consumers may reorder or omit. Shared state stays internal via 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 work better with RSC. Use render props when the consumer must control rendering of shared logic, such as custom row rendering in a data table.

Does React context cause performance problems?▼

Context causes re-renders for all consumers when its value changes, so app-wide state in one context is a bad boundary. Split contexts by update frequency or use selector-based libraries like zustand or use-context-selector to limit re-renders.

When is a React component too big to keep?▼

A component over 500 lines or with more than six boolean flags should be refactored immediately by splitting concerns and applying the compound pattern. Components with 6-8 clearly named props are acceptable and need no action.