Compound Pattern
Teaches the compound component pattern for shared implicit state. Use when building related components like tabs, accordions, or dropdowns that need to coordinate without explicit prop passing.
Install
npx skills add PatternsDev/skills --skill compound-patterngit clone --depth 1 https://github.com/PatternsDev/skills.git /tmp/skills
mkdir -p ~/.claude/skills
cp -r /tmp/skills/react/compound-pattern ~/.claude/skills/compound-patternPersonal skills live in ~/.claude/skills. Use .claude/skills in a project folder to share a skill with your team.
From the SKILL.md
# Compound Pattern ## Table of Contents - [When to Use](#when-to-use) - [When NOT to Use](#when-not-to-use) - [Instructions](#instructions) - [Details](#details) - [Source](#source) In our application, we often have components that belong to each other. They're dependent on each other through the shared state, and share logic together. You often see this with components like `select`, dropdown components, or menu items. The **compound component pattern** allows you to create components that all work together to perform a task. ## When to Use - Use this when building components like dropdowns, tabs, or menus with related sub-components - This is helpful when you want to provide a clean component API without exposing internal state management ## When NOT to Use - When the sub-components don't share meaningful state — the pattern adds unnecessary Context overhead - For simple one-off UIs where a single component with props is clearer - When the implicit state sharing makes the component behavior hard to predict for consumers ## Instructions - Use React Context API to share state between the parent compound component and its children - Attach child components as static properties on the parent (e.g., `FlyOut.Toggle`, `FlyOut.List`) - Memoize context values to avoid unnecessary re-renders in complex scenarios - Prefer the Context approach over `React.Children.map` for more flexible component nesting ## Details ### Context API
Details
- Skill name
compound-pattern- Repository
- PatternsDev/skills
- Path
react/compound-pattern/SKILL.md- Repo updated
- 15 April 2026
FAQ
What does the Compound Pattern skill do?
Teaches the compound component pattern for shared implicit state. Use when building related components like tabs, accordions, or dropdowns that need to coordinate without explicit prop passing.
How do I install the Compound Pattern skill?
skills CLI (Claude Code, Cursor, Codex and more): npx skills add PatternsDev/skills --skill compound-pattern. Skills go in ~/.claude/skills (personal) or .claude/skills (project), and Claude loads them automatically when a task matches the description.
Is Compound Pattern popular?
It lives in PatternsDev/skills, which has 259 GitHub stars and 28 forks.
Related skills
AI UI Patterns
259PatternsDev/skills
Teaches design patterns for building AI-powered React interfaces. Use when creating chatbots, intelligent assistants, streaming UIs, or any AI-driven user experience in React.
Async Components
259PatternsDev/skills
Teaches async component loading in Vue for performance optimization. Use when you have heavy components that aren't needed on initial render and can be loaded on demand.
Bundle Splitting
259PatternsDev/skills
Teaches bundle splitting techniques for web performance. Use when your application has a large JavaScript bundle that affects load times or when you need to reduce FCP/LCP.
Data Provider
259PatternsDev/skills
Teaches the data provider pattern using renderless components and scoped slots. Use when you need to abstract data fetching or state management logic and expose it to child components via slots.
Composables
259PatternsDev/skills
Teaches Vue composables for reusable stateful logic with the Composition API. Use when extracting shared reactive state, side effects, or computed logic that multiple components need.
Dynamic Components
259PatternsDev/skills
Teaches dynamic component switching with Vue's <component> element. Use when you need to render different components conditionally based on runtime state using the is attribute.
Browse the most popular Claude skills, all frontend & design skills, or write your own with the skills generator.