composition-patterns · git:20261102.1cee6fa · 2026-11-02 · sha256 853a0a0497bbd52b
composition-patterns git:20261102.1cee6faA
Immutable. This exact content never changes and is served at /api/v1/blob/853a0a0497bbd52b.
No tool to install first
claude plugin marketplace add https://markdownregistry.com/mp/a/art_syvpybjuxgi3u7dt/853a0a0497bbd52b7c8adf0c1429f30467ed395206bb83ed045c9eeb71d15f9c.json
Then /plugin install composition-patterns@markdownregistry-syvpybjuxgi3u7dt in Claude Code. It installs this exact version, the one graded A here, pinned to the commit it was graded at, and leaves it there.
--- name: composition-patterns description: React component composition patterns. Use when refactoring boolean prop proliferation, designing reusable component APIs or libraries, or working with compound components and context providers. Not for performance tuning — use react-best-practices. --- # React Composition Patterns ## Rule Categories by Priority | Priority | Category | Impact | Prefix | | -------- | ----------------------- | ------ | --------------- | | 1 | Component Architecture | HIGH | `architecture-` | | 2 | State Management | MEDIUM | `state-` | | 3 | Implementation Patterns | MEDIUM | `patterns-` | | 4 | React 19 APIs | MEDIUM | `react19-` | ## Quick Reference ### 1. Component Architecture (HIGH) - `architecture-avoid-boolean-props` - Don't add boolean props to customize behavior; use composition - `architecture-compound-components` - Structure complex components with shared context ### 2. State Management (MEDIUM) - `state-decouple-implementation` - Provider is the only place that knows how state is managed - `state-context-interface` - Define generic interface with state, actions, meta for dependency injection - `state-lift-state` - Move state into provider components for sibling access ### 3. Implementation Patterns (MEDIUM) - `patterns-explicit-variants` - Create explicit variant components instead of boolean modes - `patterns-children-over-render-props` - Use children for composition instead of renderX props ### 4. React 19 APIs (MEDIUM) > **⚠️ React 19+ only.** Skip this section if using React 18 or earlier. - `react19-no-forwardref` - Don't use `forwardRef`; use `use()` instead of `useContext()` ## How to Use The quick reference above is the index. Every rule has its own file under `rules/`, named for the rule id — read the ones that apply to the component in front of you, not the whole set. Each file carries the rationale, an incorrect and a correct example, and further context. There is no compiled all-in-one document.