composition-patterns — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited composition-patterns (Agent Skill) and scored it 100/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 0 flagged
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
Part of Agent Skills™ by googleadsagent.ai™
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.
graph TD
A[Component Design Request] --> B{Pattern Selection}
B --> C[Compound: Related UI Family]
B --> D[State Lifting: Shared State]
B --> E[Internal Composition: Sub-render]
B --> F[Render Delegation: Consumer Control]
C --> G[Parent provides context]
G --> H[Children consume context]
D --> I[State lives in nearest common ancestor]
E --> J[Component composes internally]
F --> K[Consumer passes render function]The agent selects the appropriate pattern based on the relationship between components, the degree of consumer control needed, and the complexity of shared state.
const TabsContext = createContext<TabsState | null>(null);
function Tabs({ defaultValue, children }: TabsProps) {
const [active, setActive] = useState(defaultValue);
return (
<TabsContext.Provider value={{ active, setActive }}>
<div role="tablist">{children}</div>
</TabsContext.Provider>
);
}
function Tab({ value, children }: TabProps) {
const { active, setActive } = useContext(TabsContext)!;
return (
<button
role="tab"
aria-selected={active === value}
onClick={() => setActive(value)}
>
{children}
</button>
);
}
function TabPanel({ value, children }: TabPanelProps) {
const { active } = useContext(TabsContext)!;
if (active !== value) return null;
return <div role="tabpanel">{children}</div>;
}
Tabs.Tab = Tab;
Tabs.Panel = TabPanel;
// Usage: consumer controls structure
<Tabs defaultValue="a">
<Tabs.Tab value="a">Tab A</Tabs.Tab>
<Tabs.Tab value="b">Tab B</Tabs.Tab>
<Tabs.Panel value="a">Content A</Tabs.Panel>
<Tabs.Panel value="b">Content B</Tabs.Panel>
</Tabs>// BAD: Boolean prop explosion
<Card
showHeader={true}
showFooter={false}
isCompact={true}
hasAvatar={true}
showActions={true}
/>
// GOOD: Compositional API
<Card compact>
<Card.Header>
<Avatar src={user.avatar} />
<Card.Title>{user.name}</Card.Title>
</Card.Header>
<Card.Body>{content}</Card.Body>
<Card.Actions>
<Button>Edit</Button>
<Button>Delete</Button>
</Card.Actions>
</Card>| 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 |
composition compound-components react-patterns state-lifting boolean-props render-delegation design-system composable-api
© 2026 googleadsagent.ai™ | Agent Skills™ | MIT License
~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.