Best for
- A new component / screen is being designed and the boundary
- An existing component has 10 props, conditional rendering
- A primitive (button, card, dialog) is being added to the design
event4u-app/agent-config/src/skills/ui-component-architect/SKILL.md
Use when shaping a UI component tree — composition vs inheritance, slot patterns, prop API design, controlled vs uncontrolled, polymorphic — even on 'split this component'.
Decision brief
Decide the shape of a component tree before the markup is written. Picks composition over inheritance, names the slot contract, draws the controlled/uncontrolled axis, and stops prop bags from growing into god-components. Stack-agnostic — the same lens applies to Blade, Livewire…
Compatibility matrix
| Platform | Status | Evidence | What to check |
|---|---|---|---|
| Codex | Not declared | No explicit evidence | Portability before use |
| Claude Code | Not declared | No explicit evidence | Portability before use |
| Cursor | Not declared | No explicit evidence | Portability before use |
| Gemini CLI | Not declared | No explicit evidence | Portability before use |
Installation
The source command is displayed only when detected. A safe inspection prompt is always available so your agent can explain every action before execution.
npx skills add https://github.com/event4u-app/agent-config --skill "src/skills/ui-component-architect"Inspect the Agent Skill "ui-component-architect" from https://github.com/event4u-app/agent-config/blob/798a65522c7a73b90526641d6d1589fe0937cb5f/src/skills/ui-component-architect/SKILL.md at commit 798a65522c7a73b90526641d6d1589fe0937cb5f. List every install step, command, network request, credential, file read/write, external action, and rollback step. Explain whether it fits my task. Do not install or execute anything until I approve.
Workflow
Review existing components in the codebase for the same responsibility — extend rather than rebuild when a match is found. If none exists, write the new component's purpose: "Renders a labelled input with inline error and hint." If the sentence has an "and" joining two unrelated…
A new component / screen is being designed and the boundary
Extract a stateful component only when an element repeats 4× or more AND carries real props/state (the stateful-component bar of the per-class canon, abstraction-thresholds — it does not lower the code-level two-repetition bar). One or two repeats, or a repeat with no varying pr…
Review existing components in the codebase for the same responsibility — extend rather than rebuild when a match is found. If none exists, write the new component's purpose: "Renders a labelled input with inline error and hint." If the sentence has an "and" joining two unrelated…
Composition trades verbose call-sites for a tiny, stable component. Inheritance trades short call-sites for ABI fragility.
Permission review
No configured static risk pattern was detected
This is not proof of safety. Runtime behavior, indirect dependencies, and hidden external systems are outside the static scan.
Evidence record
| Signal | Value | Evidence type | Meaning |
|---|---|---|---|
| Quality score | 91/100 | Computed | Documentation, specificity, maintenance, and trust rules |
| Repository stars | 7 | Source | Repository attention, not individual Skill quality |
| Compatibility | 0 platforms | Source | Declared in the catalog source record |
| Usage guide | automated source guide | Editorial | Generated or reviewed according to the visible evidence level |
Pinned source
Decide the shape of a component tree before the markup is written. Picks composition over inheritance, names the slot contract, draws the controlled/uncontrolled axis, and stops prop bags from growing into god-components. Stack-agnostic — the same lens applies to Blade, Livewire, React, or Vue trees. Pair with
existing-ui-auditfirst; never invent components that already exist.
variant-prop with > 4 values.Do NOT use when:
tailwind-engineer.existing-ui-audit first; reusing
beats inventing.Extract a stateful component only when an element repeats ~4× or more AND
carries real props/state (the stateful-component bar of the per-class canon,
abstraction-thresholds —
it does not lower the code-level two-repetition bar). One or two repeats, or a
repeat with no varying props, is not a component — inline it (a props-only
shell earns extraction at 3+ uses). A long single-file body is normal, not a smell;
premature extraction (a "component" used once, or a pure-markup fragment split
for tidiness) adds indirection without reuse and is the more common mistake
than under-splitting. Meet BOTH conditions before you extract.
Review existing components in the codebase for the same responsibility — extend rather than rebuild when a match is found. If none exists, write the new component's purpose: "Renders a labelled input with inline error and hint." If the sentence has an "and" joining two unrelated jobs, the component is two components. Reject the draft and split before continuing.
Rules of thumb:
| Pattern | When |
|---|---|
Compound components (Card.Header, Card.Body) | Multiple slots with order semantics |
| Children + named slots | One main child, plus 1–2 optional regions |
| Render props / function-as-children | Caller controls rendering of internal state |
Polymorphic (as prop) | Same shell, different semantic element |
| Inheritance / class-extension | Almost never — last resort for legacy adapters |
Composition trades verbose call-sites for a tiny, stable component. Inheritance trades short call-sites for ABI fragility.
For every piece of state (open, value, selected, expanded), pick:
defaultValue + optional value. The most flexible, also the
most code; reserve for design-system primitives.Mixing controlled / uncontrolled in the same prop without a default is the single largest source of "why doesn't my component update?" tickets.
Prop budget per component:
| Tier | Cap |
|---|---|
| Primitive (Button, Input) | ≤ 6 props + ...rest to underlying element |
| Composite (Card, Dialog) | ≤ 8 props; prefer slots for variants |
| Page section / feature shell | ≤ 4 props; everything else via context |
Over-budget triggers a refactor: extract a config object, push state into context, or split into compound parts.
For every slot, document: required vs optional, expected element type or component, default rendering when absent, accessibility implications (does the slot become the accessible name?). Slots without contracts become "stuff a div in there and pray".
Return:
Concrete shape:
Component: <Name>
Responsibility: <one sentence — reject if "and" joins two jobs>
Pattern: <compound | slots | render-props | polymorphic>
State: value=<controlled|uncontrolled|both>; open=<...>; ...
Props (≤ tier): [name: type — purpose]
Slots: [name: required? default? a11y note]
Children: <count, kind>
Anti-cases: <combinations the component refuses to support>
variant props with > 4 values are usually two components in a
trench coat — split when the rendering branches diverge.as polymorphism is cheap in TypeScript when typed via generics,
expensive without — the type cost is invisible in plain JS.useCallback or hoist.Before proposing a component, check the project root for DESIGN.md
(written by design-system-capture). If present, apply its captured
visual conventions (radius/shadow/motion/spacing) to the new component
rather than deriving them from scratch. Flag any new design decision
(e.g., a first-use of a new elevation tier) for capture:
"Suggest adding to DESIGN.md: [decision]."
existing-ui-audit first.
Reinventing primitives is the #1 source of design drift.config={...}) just to dodge
the prop cap — that hides the API instead of taming it.Alternatives
coreyhaines31/marketingskills
When the user wants to plan, design, or implement an A/B test or experiment, or build a growth experimentation program. Also use when the user mentions "A/B test," "split test," "experiment," "test this change," "variant copy," "multivariate test," "hypothesis," "should I test this," "which version is better," "test two versions," "statistical significance," "how long should I run this test," "growth experiments," "experiment velocity," "experiment backlog," "ICE score," "experimentation program
JasonColapietro/suede-creator-skills
Suede-owned experimentation discipline for hypotheses, sample sizing, test duration, significance, and repeatable experiment programs. Use when comparing variants, deciding whether a result is reliable, or building an experiment backlog and cadence. NOT FOR: analytics instrumentation (use suede-analytics), post-click conversion diagnosis (use suede-site-alchemy), or writing the variant copy itself (use suede-copy).
narrative-io/narrative-skills-marketplace
Translate a fuzzy analytical question into a rigorous investigation plan. Interrogates the ask, grounds the plan in the available data dictionary, applies analytical best practices, and produces a structured brief of query specifications for a downstream query-writing skill. Plans, does not write SQL. Use when: "why did X drop", "is there a relationship between A and B", "who are our highest-value customers", "what's driving the change in Y", "investigate this trend", "design an analysis for", "
event4u-app/agent-config
Use BEFORE writing or editing any non-trivial UI — inventories components, design tokens, shadcn primitives, and reusable patterns into state.ui_audit. Hard gate for the ui directive set.