itallstartedwithaidea/agent-skills/composition-patterns
Claude Code and agent skill by itallstartedwithaidea/agent-skills
- community
- ext:[{"type":"context","description":"Custom context provider definitions"}]
Checking that the SKILL.md file is still in the repository.
Composition Patterns teaches agents to build flexible, maintainable React components using compound components, state lifting, internal composition, and the elimination of boolean prop proliferation.
Install
npx vskill@latest install itallstartedwithaidea/agent-skills/composition-patternsSemi-extensibleMentions customization, but needs skill-specific knowledge. Read the extensible skills standard
SKILL.md
The same SKILL.md was published earlier as itallstartedwithaidea/claude-googleadsagent/composition-patterns.
Composition Patterns
Part of Agent Skills™ by googleadsagent.ai™
Description
Composition Patterns teaches agents to build flexible, maintainable React components using compound components, state lifting, internal composition, and the elimination of boolean prop proliferation. These patterns replace rigid, prop-heavy APIs with composable interfaces that scale gracefully as requirements evolve.
The most common agent mistake in React is building monolithic components with dozens of boolean props: showHeader, showFooter, isCompact, isLoading, hasSearch, enableDarkMode. Each boolean doubles the component's state space, creating an exponential testing surface and making the component impossible to extend without modifying its internals. Composition patterns replace these booleans with structural composition, where the consumer assembles the component from smaller pieces.
This skill addresses four complementary patterns: compound components for related UI families, state lifting for shared cross-component state, internal composition for encapsulated sub-rendering, and render delegation for maximum consumer flexibility. Applied together, these patterns produce components that are simple to use, powerful to customize, and trivial to test.
Use When
- A component has more than 3 boolean configuration props
- Related components need to share implicit state (tabs, accordions, selects)
- The consumer needs to control layout or ordering of sub-elements
- A component needs to support use cases not anticipated at design time
- Refactoring a "god component" into composable pieces
- Building a component library or design system
How It Works
The agent selects the appropriate pattern based on the relationship between components, the degree of consumer control needed, and the complexity of shared state.
Implementation
Compound Components
Eliminating Boolean Props
Best Practices
- Use compound components when sub-elements share implicit state
- Expose composable APIs instead of adding boolean flags for new features
- Keep context providers narrow—one context per concern, not one mega-context
- Provide sensible defaults so simple use cases remain simple
- Document the compositional API with usage examples, not just prop tables
- Use TypeScript discriminated unions instead of boolean prop combinations
Platform Compatibility
| Platform | Support | Notes | |
|---|---|---|---|
| Cursor | Full | Component generation + refactoring | |
| VS Code | Full | TypeScript-aware refactoring | |
| Windsurf | Full | React pattern recognition | |
| Claude Code | Full | Component design guidance | |
| Cline | Full | Pattern-based generation | |
| aider | Partial | Limited compositional awareness |
Related Skills
Keywords
composition compound-components react-patterns state-lifting boolean-props render-delegation design-system composable-api
© 2026 googleadsagent.ai™ | Agent Skills™ | MIT License
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/web-frontend/composition-patterns/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Extension points
contextCustom context provider definitions
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
[](https://verified-skill.com/skills/itallstartedwithaidea/agent-skills/composition-patterns)