vercel-composition-patterns

Refactor React components by replacing boolean props with variant components and shared context.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

React projects often suffer from boolean prop proliferation and tangled component APIs. This Skill provides patterns to replace boolean flags with compound components, render props, and context-driven architecture so libraries scale cleanly.

Core Features & Use Cases

  • Explicit component variants (ThreadComposer, EditMessageComposer, ForwardMessageComposer) to replace boolean props
  • Shared context and dependency-injected state to compose internals without prop drilling
  • Guidance on React 19 API changes (use() over useContext, avoid unnecessary forwardRef)

Quick Start

Refactor an existing React component library to replace boolean props with explicit variant components and a provider-based state pattern.

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 React components to replace boolean props with explicit variants?

To refactor React components, replace boolean props by creating explicit variant components like ThreadComposer or EditMessageComposer, utilizing shared context to manage state without prop drilling and scale cleanly.

What is the best way to manage shared state in compound components without prop drilling?

The best way to manage shared state in compound components is by using a provider-based state pattern with shared context, allowing internals to compose efficiently without passing props down the component tree.

How does React 19 change context usage and do I still need forwardRef?

React 19 changes context usage by introducing the use() API as an alternative to useContext and reduces the need for unnecessary forwardRef wrappers, streamlining component composition and architecture.

When should I use render props instead of boolean props in my React architecture?

You should use render props instead of boolean props when explicit component variants become too rigid, allowing dynamic rendering logic and avoiding tangled APIs in your React component library.

Can I migrate an existing React codebase to use composition patterns and context providers?

Yes, you can migrate an existing React codebase by applying structured refactoring strategies that replace boolean flags with compound components and dependency-injected context providers for scalable architecture.

Why does boolean prop proliferation cause problems in React component libraries?

Boolean prop proliferation causes problems by creating tangled component APIs that are hard to maintain, requiring complex conditional logic instead of clean composition patterns to scale React projects.