What problem does it solve?
Many React codebases accumulate boolean props that create combinatorial complexity, fragile conditionals, and unmaintainable component variants. This Skill provides concrete composition patterns—compound components, provider boundaries, generic context interfaces, and explicit variants—to simplify APIs, improve testability, and make components easier for engineers and AI agents to generate and refactor.
Core Features & Use Cases
- Composition patterns: Use compound components and children composition to eliminate boolean-driven conditional logic.
- State & dependency injection: Lift state into providers and define a generic state/actions/meta interface so the same UI works with different implementations.
- Explicit variants & readability: Replace boolean-mode components with explicit variants (e.g., ThreadComposer, EditComposer) for self-documenting code.
- React 19 guidance: Advise on React 19 API changes (use() over useContext, ref as a prop) for modern codebases.
- Use cases: Refactoring legacy Composer-like components, building reusable component libraries, performing code reviews, or guiding agent-driven code generation.
Quick Start
Apply vercel-composition-patterns to refactor a Composer component that uses multiple boolean flags into an explicit Provider with Composer.Frame, Composer.Input, and Composer.Footer subcomponents.