vercel-composition-patterns

Refactor React component APIs into compound components with shared context.

1|Updated Oct 10, 2025
One-click install
npx skills add https://github.com/cgRGM/rivercitymd --skill vercel-composition-patterns-cgrgm
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: vercel-composition-patterns
Source: https://github.com/cgRGM/rivercitymd/tree/main/.agents/skills/vercel-composition-patterns
Command: npx skills add https://github.com/cgRGM/rivercitymd --skill vercel-composition-patterns-cgrgm

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps you refactor React interfaces that have become hard to maintain because of boolean flags, prop drilling, and tangled conditional rendering. It replaces brittle component APIs with clearer composition patterns that scale with the codebase.

Core Features & Use Cases

  • Compound Components: Organize complex UIs around shared context so consumers can assemble only the pieces they need.
  • State Lifting and Provider Design: Move state into provider components so sibling elements can read and update it without awkward prop passing.
  • Explicit Variants: Replace ambiguous mode flags with self-documenting components such as thread, edit, or forward variants.
  • React 19 Guidance: Apply modern ref and context patterns when updating components for React 19.
  • Use Cases: Refactoring a messaging composer, designing a reusable design system, or reviewing a component library for hidden conditional logic.

Quick Start

Ask the AI to rewrite a React component with multiple boolean props into explicit compound components backed by a provider and shared context.

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 with too many boolean props?

To refactor React components with too many boolean props, replace ambiguous mode flags with explicit compound components backed by a shared context. This eliminates brittle conditional rendering and creates self-documenting component variants that scale cleanly.

What is the best way to share state across compound components in React?

The best way to share state across compound components in React is lifting state into provider components. This provider-based dependency injection allows sibling elements to read and update shared state without awkward prop passing or deep prop drilling.

How do React 19 context and ref patterns affect component composition?

React 19 context and ref patterns affect component composition by modernizing how shared state contracts and provider dependencies are structured. Updating components for React 19 ensures cleaner ref forwarding and context consumption without legacy limitations.

When should I replace render props with compound components?

You should replace render props with compound components when your component API becomes hard to maintain due to tangled conditional rendering. Organizing complex UIs around shared context allows consumers to assemble only the needed pieces explicitly.

Can I use compound components for design system maintenance?

Yes, you can use compound components for design system maintenance to review and refactor reusable component libraries. This approach removes hidden conditional logic and boolean prop proliferation, ensuring your design-system components remain scalable and maintainable.

Why does prop drilling make React components brittle?

Prop drilling makes React components brittle by forcing parent elements to pass data through multiple layers just to reach deep children. Replacing this with provider-based state lifting and shared context contracts decouples siblings and eliminates fragile intermediate props.