vercel-composition-patterns

Refactor React components with boolean props into explicit variants.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/SonPaier/carfect --skill vercel-composition-patterns-sonpaier
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: vercel-composition-patterns
Source: https://github.com/SonPaier/carfect/tree/main/.claude/skills/composition-patterns
Command: npx skills add https://github.com/SonPaier/carfect --skill vercel-composition-patterns-sonpaier

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) and scripts (resource) components.

What problem does it solve?

This Skill addresses the complexity of building maintainable and scalable React components by providing patterns to avoid prop proliferation and enable flexible composition.

Core Features & Use Cases

  • Component Architecture: Patterns for structuring components to avoid boolean prop proliferation and use compound components effectively.
  • State Management: Techniques for lifting state into provider components and defining generic context interfaces for dependency injection.
  • Implementation Patterns: Guidance on creating explicit component variants and preferring children over render props.
  • Use Case: Refactor a large, monolithic React component with many conditional props into smaller, composable pieces that are easier to manage and extend.

Quick Start

Use the vercel-composition-patterns skill to refactor a component with many boolean props into explicit variants.

Frequently Asked Questions about vercel-composition-patterns

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I refactor a React component with too many boolean props?

You can refactor a React component by replacing boolean props with explicit variants and adopting compound components. This composition approach breaks monolithic structures into manageable pieces, reducing conditional logic and making the architecture easier to maintain and extend.

What is the best way to manage state in reusable React component libraries?

Lifting state into provider components is the best way to manage state in React libraries. This technique defines generic context interfaces for dependency injection, ensuring clean separation of concerns and enabling flexible composition without complex prop drilling.

When should I use compound components in React architecture?

Use compound components in React when building scalable UI elements requiring flexible composition. This pattern allows sub-components to share implicit state through context, avoiding prop proliferation and enabling developers to compose complex interfaces cleanly without rigid configuration.

Should I use render props or children for React component composition?

Preferring children over render props is recommended for React component composition. Using children provides a more explicit and readable structure for component variants, simplifying the architecture and avoiding the callback nesting often associated with extensive render prop usage.

How do I define generic context interfaces for dependency injection in React?

Define generic context interfaces in React by lifting state into provider components and specifying clear type definitions. This dependency injection technique decouples state management from UI rendering, allowing composable components to consume shared data without tight coupling.