← ClaudeAtlas

composition-patterns-guidelisted

Use when refactoring React or React Native components that suffer from boolean prop proliferation, lack of compound structure, prop drilling, or unclear ownership of state. Codifies the 7 Vercel composition-patterns rules adapted to our web + RN stack: avoid boolean props (use composition or explicit variants), prefer compound components with shared context, lift state into providers, use children over render props, modern React 19 patterns (no forwardRef). Also enforces our colocation rules (Rule of Three for promotion, L0/L1/L2 hierarchy, _components/ naming). Triggers on: "refactor this component", "questo componente ha troppi prop booleani", "rendi questo componente più componibile", "compound component", "context provider per X", "design del componente". Not for: scaffolding new components from scratch (use design-md-to-app, screenshot-to-page, rn-add-screen), or moving components up the hierarchy (use promote-component).
lukedj78/dev-flow · ★ 4 · Web & Frontend · score 77
Install: claude install-skill lukedj78/dev-flow
# composition-patterns-guide — modern React composition + our colocation rules This skill is a **knowledge guardrail** that activates whenever you're designing, refactoring, or reviewing the architecture of a React/RN component. It combines two layers: 1. **The 7 Vercel `composition-patterns` rules** (originally from `vercel-labs/agent-skills`), adapted to our stack. 2. **Our colocation rules** (Rule of Three for promotion, L0/L1/L2, `_components/` and `components/shared/<dominio>/`). It does NOT execute refactors — for that, use `promote-component`. It provides the *thinking framework*. ## When this skill applies - About to add a 4th boolean prop to an existing component. - About to write a component with `renderHeader`, `renderFooter`, `renderActions` render-prop callbacks. - A component grew over ~250 lines and needs structural refactor. - You see prop drilling 3+ levels deep. - About to use `forwardRef` in new code (React 19+ projects). - Reviewing a PR that touches component architecture. Orchestrator does NOT route here automatically — invoked by the agent's own judgment when the patterns match. ## The 7 composition rules (priority order) ### Priority 1 — Component Architecture (HIGH) #### Rule 1: Avoid boolean prop proliferation **Wrong**: ```tsx <Composer onSubmit={...} isThread={true} channelId={42} isDMThread={false} dmId={null} isEditing={true} isForwarding={false} /> ``` Each boolean doubles the state-space. 5 booleans = 32 possible combin