composition
Build a variation by assembling smaller parts.
Use this when A component accumulates flags for every screen that uses it.
without the term
“This component has like ten true/false props now, isCompact, isEditing, showHeader, and they keep conflicting. Can you restructure it so each screen builds what it needs instead of adding more flags?”
with the term · How do you ask a model for composition?
Use composition for these two variants. Share their common parts, make each layout explicit, and verify both preserve the intended behavior.
What is composition?
Composition connects parts with explicit responsibilities. The caller chooses the arrangement.
Why does composition matter when vibe coding?
Adding another boolean mode can create combinations nobody intended.
How do you do composition?
Extract the shared parts and compose two real variants. Check that each arrangement remains understandable.
What goes wrong with composition?
Tiny parts still depend on a single giant component full of mode checks.