vercel-composition-patterns

Refactor React components using composition patterns and React 19 APIs.

Updated Jan 14, 2026
One-click install
npx skills add https://github.com/erwinkn/ai-config --skill vercel-composition-patterns-erwinkn
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: vercel-composition-patterns
Source: https://github.com/erwinkn/ai-config/tree/main/.agents/skills/vercel-composition-patterns
Command: npx skills add https://github.com/erwinkn/ai-config --skill vercel-composition-patterns-erwinkn

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve?

This Skill helps developers refactor complex React components, manage state effectively, and improve code maintainability by applying best practices in composition patterns.

Core Features & Use Cases

  • Component Architecture: Provides guidelines to avoid boolean prop proliferation and use compound components for better structure.
  • State Management: Offers patterns for lifting state, defining clear context interfaces, and decoupling state management from UI.
  • Implementation Patterns: Includes techniques for creating explicit component variants and preferring children over render props.
  • React 19 APIs: Covers the use of React 19+ features like replacing forwardRef with use() and using use() instead of useContext().

Quick Start

Use the vercel-composition-patterns skill to refactor a complex React component using the guidelines provided.

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 complex React components to avoid boolean prop proliferation?

To refactor React components and avoid boolean prop proliferation, apply composition patterns to create explicit component variants. This technique decouples state management from the UI and uses compound components for a more maintainable component architecture.

What is the best way to manage state in React 19 component architecture?

The best way to manage state in React 19 involves lifting state and defining clear context interfaces. You can leverage React 19 APIs by using the use() hook instead of useContext() to decouple state management from your UI components effectively.

How do compound components improve React state management?

Compound components improve React state management by providing a clearer structure that decouples state from the UI. This composition pattern replaces complex boolean props and render props with explicit variants using children, enhancing overall code maintainability.

When should I replace forwardRef with the use() hook in React 19?

You should replace forwardRef with the use() hook in React 19 when refactoring existing components to leverage the latest APIs. This composition pattern simplifies your component architecture and aligns with modern React state management best practices.

Can I use these React composition patterns to decouple state management from my UI?

Yes, you can use these React composition patterns to decouple state management from your UI. The guidelines focus on lifting state, defining clear context interfaces, and creating explicit component variants to achieve better separation of concerns.

Why does lifting state help with React component maintainability?

Lifting state helps with React component maintainability by moving shared state to a common ancestor, which prevents complex prop drilling. Combined with clear context interfaces, it creates a cleaner architecture that is easier to refactor and scale.