vercel-composition-patterns

Refactor React components using composition patterns to avoid boolean props.

Updated Apr 24, 2026
One-click install
npx skills add https://github.com/RiciYT/M324 --skill vercel-composition-patterns-riciyt
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: vercel-composition-patterns
Source: https://github.com/RiciYT/M324/tree/main/.agents/skills/vercel-composition-patterns
Command: npx skills add https://github.com/RiciYT/M324 --skill vercel-composition-patterns-riciyt

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve?

This Skill provides guidelines for refactoring React components to avoid boolean prop proliferation and enhance maintainability.

Core Features & Use Cases

  • Avoid Boolean Prop Proliferation: Guidelines to replace boolean props with composition patterns for better code maintainability.
  • State Management: Techniques for lifting state into provider components and defining clear context interfaces.
  • Implementation Patterns: Best practices for creating compound components and using children for composition instead of render props.
  • React 19 APIs: Updated information on using ref as a regular prop and use() instead of useContext() in React 19+.
  • Use Case: If you're working on a large-scale React application and want to refactor components to be more maintainable and flexible.

Quick Start

To apply these patterns to your React components, refer to the individual rule files within the 'rules/' directory.

Frequently Asked Questions about vercel-composition-patterns

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

FAQPage Schema
How do I avoid boolean prop proliferation in React components?

You can prevent boolean prop proliferation by adopting composition patterns like compound components. This refactoring approach replaces multiple conditional props with flexible component structures, resulting in more maintainable React code.

What are the best practices for state management in large-scale React apps?

Best practices for state management in large-scale React apps involve lifting state into provider components and defining clear context interfaces. This structural pattern isolates state logic, creating a more scalable and maintainable component architecture.

How to use React 19 use() hook instead of useContext for composition?

In React 19, you use the `use()` hook instead of `useContext()` to consume context within your composition patterns. This updated API allows more flexible context integration, streamlining state management implementation.

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

You should use `children` for React component composition instead of render props. This pattern simplifies component APIs, avoids unnecessary prop drilling, and creates more readable JSX structures when building compound components.

When should I refactor React components using composition patterns?

You should refactor React components using composition patterns when working on large-scale applications facing maintainability issues from boolean prop proliferation. This refactoring isolates state management and improves overall component architecture flexibility.