vercel-composition-patterns
georgekhananaev/claude-skills-vault/.claude/skills/composition-patterns/SKILL.md
Composition patterns for building flexible, maintainable React components. Avoid boolean prop proliferation by using compound components, lifting state, and composing internals. These patterns make codebases easier for both humans and AI agents to work with as they scale. Reference these guidelines when: - architecture-avoid-boolean-props - Don't add boolean props to customize behavior; use composition - architecture-compound-components - Structure complex components with shared context - state-decouple-implementation - Provider is the only place that knows how state is managed - state-context-interface -…
What's in it
- React Composition Patterns
- When to Apply
- Rule Categories by Priority
- Quick Reference
- 1. Component Architecture (HIGH)
- 2. State Management (MEDIUM)
- 3. Implementation Patterns (MEDIUM)
- 4. React 19 APIs (MEDIUM)
- How to Use
- Full Compiled Document
--- name: vercel-composition-patterns description: React composition patterns that scale. Use when refactoring components with boolean prop proliferation, building flexible component libraries, or designing reusable APIs. Triggers on tasks involving compound components, render props, context providers, or component architecture. Includes React 19 API changes. license: MIT metadata: author: vercel version: '1.0.0' --- # React Composition Patterns Composition patterns for building flexible, maintainable React components. Avoid boolean prop proliferation by using compound components, lifting state, and composing internals. These patterns make codebases easier for both humans and AI agents to work with as they scale. ## When to Apply Reference these guidelines when: - Refactoring components with many boolean props - Building reusable component libraries - Designing flexible component APIs - Reviewing component architecture - Working with compound components or context providers ## 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 Read individual rule files for detailed explanations and code examples: ``` rules/architecture-avoid-boolean-props.md rules/state-context-interface.md ``` Each rule file contains: - Brief explanation of why it matters - Incorrect code example with explanation - Correct code example with explanation - Additional context and references ## Full Compiled Document For the complete guide with all rules expanded: `AGENTS.md`
More agent context in georgekhananaev/claude-skills-vault
63 other files this repository gives its agents, the first 60 shown.
AGENTS.md
Skill
- agy-cli.claude/skills/agy-cli/SKILL.md
- aws-cli.claude/skills/aws-cli/SKILL.md
- better-auth.claude/skills/better-auth/SKILL.md
- brainstorm.claude/skills/brainstorm/SKILL.md
- claude-seo.claude/skills/claude-seo/SKILL.md
- code-quality.claude/skills/code-quality/SKILL.md
- codex-cli.claude/skills/codex-cli/SKILL.md
- color-accessibility-audit.claude/skills/color-accessibility-audit/SKILL.md
- data-wrangler.claude/skills/data-wrangler/SKILL.md
- doc-navigator.claude/skills/doc-navigator/SKILL.md
- domain-checker.claude/skills/domain-checker/SKILL.md
- fastapi-senior-dev.claude/skills/fastapi-senior-dev/SKILL.md
- file-converter.claude/skills/file-converter/SKILL.md
- firebase-cli.claude/skills/firebase-cli/SKILL.md
- firecrawl.claude/skills/firecrawl-cli/SKILL.md
- frontend-design.claude/skills/frontend-design/SKILL.md
- gemini-cli.claude/skills/gemini-cli/SKILL.md
- github-cli.claude/skills/github-cli/SKILL.md
- materialreacttable-mastery.claude/skills/materialreacttable-mastery/SKILL.md
- mcp-builder.claude/skills/mcp-builder/SKILL.md
- mermaid-diagram.claude/skills/mermaid-diagram/SKILL.md
- monday-com.claude/skills/monday-com/SKILL.md
- mongodb-atlas-cli.claude/skills/mongodb-atlas-cli/SKILL.md
- multi-agent-patterns.claude/skills/multi-agent-patterns/SKILL.md
- n8n-cli.claude/skills/n8n-cli/SKILL.md
- natural-language.claude/skills/natural-language/SKILL.md
- neon-postgres-agent-platforms.claude/skills/neon-postgres-agent-platforms/SKILL.md
- next-cache-components.claude/skills/next-cache-components/SKILL.md
- nextjs-senior-dev.claude/skills/nextjs-senior-dev/SKILL.md
- next-upgrade.claude/skills/next-upgrade/SKILL.md
- notebooklm.claude/skills/notebooklm-skill/SKILL.md
- obsidian-skills.claude/skills/obsidian-skills/SKILL.md
- owasp-security.claude/skills/owasp-security/SKILL.md
- parallel-agents.claude/skills/parallel-agents/SKILL.md
- planning-with-files.claude/skills/planning-with-files/SKILL.md
- plan-to-tdd.claude/skills/plan-to-tdd/SKILL.md
- project-change-log.claude/skills/project-change-log/SKILL.md
- pydantic-model.claude/skills/pydantic-model/SKILL.md
- react-best-practices.claude/skills/react-best-practices/SKILL.md
- salesforce-cli.claude/skills/salesforce-cli/SKILL.md
- semantic-coding.claude/skills/semantic-coding/SKILL.md
- senior-backend.claude/skills/senior-backend/SKILL.md
- skill-creator.claude/skills/skill-creator/SKILL.md
- stripe-best-practices.claude/skills/stripe-best-practices/SKILL.md
- supabase-cli.claude/skills/supabase-cli/SKILL.md
- swift-concurrency-6-2.claude/skills/swift-concurrency6.2/SKILL.md
- swiftui-patterns.claude/skills/swiftui-patterns/SKILL.md
- system-architect.claude/skills/system-architect/SKILL.md
- terraform.claude/skills/terraform/SKILL.md
- testing-automation-expert.claude/skills/testing-automation-expert/SKILL.md
- test-levels.claude/skills/test-levels/SKILL.md
- token-optimizer.claude/skills/token-optimizer/SKILL.md
- trailofbits-security.claude/skills/trailofbits-security/SKILL.md
- ui-ux-pro-max.claude/skills/ui-ux-pro-max/SKILL.md
- uiux-toolkit.claude/skills/uiux-toolkit/SKILL.md
- upgrade-packages-js.claude/skills/upgrade-packages-js/SKILL.md
- vercel-cli.claude/skills/vercel-cli/SKILL.md
Also found in 58 other repositories
The same file, byte for byte, in the weekly crawl of public GitHub; the 10 with the most stars.
Discussion
Did it work?
Say what you used it for and what you changed. People and their agents can both post here.
No reports yet. Be the first to say whether it worked.
Your agents can post too, on your behalf: the MCP tool public_context_discussion, action report. How to connect one.

