agentleFS
LeonxLJXLeonxLJX/web-engineer-skills/skills/component-review/SKILL.md

component-review

Skill0 starsChanged 2 months agoMITView on GitHub

A rigorous component API review checklist — prop design, composition over configuration, controlled vs uncontrolled, escaping hatches — runnable by an agent before shipping UI. Use when designing a new component or reviewing one for a library.

The file

We split this skill into the rules it gives an agent

5 rules. About 0 are common, 4 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈4

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Run this checklist in order.

    line 8
  2. Distinctive:

    If the pitch is "a table and a filter panel and export", it's three components wearing one badge.

    line 12
  3. Distinctive:

    Prefer children/slots over prop-driven DOM:

    line 35
  4. Distinctive:

    Every abstraction is wrong for someone.

    line 53
  5. Very specific:

    If users need !important and DOM hacking, the API failed.

    line 59

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Component API review

Run this checklist in order. A "no" on the first five questions usually means redesign, not patching.

1. Can I describe the component in one sentence without "and"?

If the pitch is "a table and a filter panel and export", it's three components wearing one badge. Split.

2. Props: nouns not adjectives-soup

  • Data props (what to render) vs behavior props (what to do) vs style props (rare).
  • 5 booleans → the component has modes; extract variants or split components.

  • Booleans named isXxxDisabledWhenYyy are logic leaking into API — compute in the caller.

3. Controlled, uncontrolled, or both — declared explicitly

// the React idiom for "both"
const [value, setValue] = useControlled({
  value: props.value,
  defaultValue: props.defaultValue,
  onChange: props.onChange,
})

A component that is sometimes controlled and sometimes mutates internal state without saying so is a bug factory.

4. Composition over configuration

Prefer children/slots over prop-driven DOM:

// ❌ 12 layout props
<Card titleAlign="left" footerBorder={false} actionsPosition="top" ... />

// ✅ slots
<Card>
  <Card.Header>Title</Card.Header>
  <Card.Body>...</Card.Body>
  <Card.Footer>...</Card.Footer>
</Card>

Render props / children-as-function for cross-component coupling (render prop <Select>{(items) => ...}</Select>), never for trivial layout.

5. Escape hatches exist

Every abstraction is wrong for someone. Provide, in order of preference:

  1. className/styling hook — cosmetic overrides
  2. slot/render props — structural overrides
  3. a real escape: asChild/Component polymorphism — behavioral overrides

If users need !important and DOM hacking, the API failed.

6. Events name outcomes, not gestures

onCollapse, onSelectionChange (intent) beat onClick, onMouseMove (raw gesture) — the latter belongs on the underlying element anyway.

7. Accessibility is part of the API

  • The contract includes roles/keyboard behavior; document which ARIA pattern it implements.
  • Slotting arbitrary children must not break semantics (a <div> inside <ul> is a violation the component must prevent or sanitize).

8. Refs & SSR

  • Forward refs; the DOM node is part of the contract.
  • No window/document at module top or during render — guard for SSR.

Definition of done (agent checklist)

  • One-sentence pitch, no "and"
  • Controlled/uncontrolled story explicit
  • Slots for structure, props for data, minimal booleans
  • Escape hatch documented
  • Keyboard + ARIA behavior documented and tested
  • Ref forwarding + SSR safe

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.