10xequity/claude-skill-library/composition-patterns

Claude Code and agent skill by 10xequity/claude-skill-library

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

Design component APIs around composition — compound components, slots, and context — to eliminate prop drilling and configuration-object bloat. Use this skill when a component's prop list is growing, when building a reusable component for others, or when a boolean flag is about to be added to control layout.

Install

npx vskill@latest install 10xequity/claude-skill-library/composition-patterns

SKILL.md

The same SKILL.md was published earlier as 10xequity/claude-skill-library/composition-patterns.

Composition Patterns Skill

Purpose

Design component APIs around composition — compound components, slots, and context — to eliminate prop drilling and configuration-object bloat.

When to use

Use this skill when a component's prop list is growing, when building a reusable component for others, or when a boolean flag is about to be added to control layout. Use react-best-practices.md for runtime performance.

Inputs

  • the component and its current API
  • the variations it must support, actual and anticipated
  • consumers of the component and how they use it

Output

Return:

  • the proposed API with usage examples showing the common and the awkward cases
  • the implementation
  • a migration path for existing call sites
  • what the new API deliberately cannot express

Constraints

  • prefer <Card><Card.Header/><Card.Body/></Card> over <Card title=… subtitle=… footer=… showDivider />
  • children over configuration; a prop that accepts JSX is usually a slot that should be a subcomponent
  • boolean props that alter layout are a smell — they multiply combinatorially and most combinations are untested
  • context for implicit parent-child coupling within a compound component; never as a general data bus
  • keep the parent unaware of which children are present; children read from context, they are not enumerated
  • forward refs and spread remaining props to the underlying element so consumers are not blocked
  • an escape hatch (className, asChild, render prop) beats a growing prop surface
  • do not abstract on the first repetition; two similar call sites are not yet a pattern

Examples

  • Convert a 14-prop Modal into a compound component
  • Replace prop drilling through three layers with a scoped provider
  • Design a DataTable API that supports custom cells without a config object

Security

  • Security scanPassed, 95 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

7-day trend score
0

Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/10xequity/claude-skill-library/composition-patterns/badge)](https://verified-skill.com/skills/10xequity/claude-skill-library/composition-patterns)

Something wrong with this skill or its page? Tell us.