Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 79 additions & 0 deletions .agents/skills/robomous-component-review/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
---
name: robomous-component-review
description: Reviews a component of @robomous/ui-core, or a change to one, independently of whoever wrote it, and reports verified findings ordered by severity with file:line references. Covers public API consistency, anatomy and data-slot, native semantics, accessibility, keyboard and pointer parity, focus, controlled and uncontrolled state, event semantics, dependency choice against ADR 0001, composition, tokens and state variants, responsive behaviour, light and dark themes, complexity and effects, performance, tests, documentation and regression risk. Use when asked to review, audit or check a component, a component PR, or the catalog.
---

# Review a Robomous component

You are the second pair of eyes. Assume nothing the author says is true until the code, a test or
the rendered output shows it. The rules you review against live in [AGENTS.md](../../../AGENTS.md),
[DESIGN.md](../../../docs/DESIGN.md) and [ADR 0001](../../../docs/adr/0001-ui-sdk-adoption.md);
cite them, don't restate them.

## 1. Gather the evidence

- The component file in `src/components/`, every component it imports, and its export in
`src/index.ts`.
- Its tests (`grep -rl "<PartName>" tests/`) and its reference in
`docs/generated/components/<slug>.md`, which lists the parts, props, `data-slot`s, state props
and foundation as extracted from the source.
- Its page and demos in `examples/catalog/src/content/components/<slug>.mdx` and
`examples/catalog/src/demos/<slug>/`.
- For a change: the diff, plus the public API snapshot `docs/architecture/public-api-0.6.json`.
- Two sibling components with the same role (two overlays, two form controls), to judge
consistency.

## 2. Review every dimension

Go through each one and write down what you checked, even when it is fine.

| Dimension | What to look for |
| --- | --- |
| Public API | Names, `variant`/`size` values and controlled pairs that match the siblings; props JSDoc'd; no dependency type in an exported prop; no breaking change without a migration note |
| Anatomy | One function per part, `data-slot` on each, `className` merged last through `cn` (or passed through on an unstyled part) |
| Native semantics | The right element (`button`, `a`, `nav`, `table`, `input`) before any `role`; no role a native element already carries; no ARIA reproducing what the primitive does |
| Accessibility | A name on every control, especially icon-only ones; states in attributes (`aria-pressed`, `aria-expanded`, `aria-selected`, `aria-invalid`); relationships (`aria-controls`, `aria-labelledby`) that point at elements that exist; the APG pattern followed |
| Keyboard and pointer parity | Everything a pointer does, the keyboard does; every key the pattern defines; one tab stop per composite |
| Focus | Visible ring; moves predictably; returns to the trigger when a surface closes; never lost to `body` |
| Controlled and uncontrolled | `value` wins when given; `default*` only seeds; the callback fires once per change, with the new value, in both modes; no state duplicated between prop and state |
| Event semantics | The caller's handlers are called, and `preventDefault` from them is respected; native events are not swallowed; keys handled only when they mean something here |
| Dependency choice | The foundation is the first fitting rung of ADR 0001, section 1; no hand-rolled behaviour that a primitive or Robomous component already provides |
| Composition | Reuses Robomous components instead of re-styling raw primitives; the composition is shown on the page |
| Tokens and states | Roles only; states through shadcn's variants, brackets only where DESIGN allows; status never a stroke on a container; action hierarchy respected |
| Responsive, light and dark | Layout at narrow widths; overflow handled; both themes through roles alone |
| Complexity and effects | Effects only for external subscriptions (DOM listeners, observers); no derived state synced through an effect; no global listener without an owner; no needless memoisation |
| Performance | Heavy dependencies pulled into a light import; work repeated per render; listeners that never detach |
| Tests | A test for each behaviour a screen would lose, by role and name; controlled and uncontrolled both covered; no class strings pinned |
| Documentation | JSDoc on the part and its props; page with Usage, Composition, Examples, Guidelines, Accessibility; demos for each state; frontmatter complete |
| Regression risk | Behaviour the change alters for existing callers; snapshot or migration needed |

## 3. Verify each finding before you report it

A finding is only reported once you have done at least one of these:

- read the exact lines again and traced the value through to where it matters;
- written or run a test that shows the defect (`pnpm test -- <file>`, or a scratch test you
delete afterwards);
- found the rule it breaks in DESIGN.md, ADR 0001 or the WAI-ARIA APG, and quoted it.

Drop anything you cannot verify, or list it separately as an open question. A wrong finding costs
more than a missed one.

## 4. Report

Order findings by severity, using [references/severity.md](references/severity.md). For each:

```
[severity] path/to/file.tsx:LINE — one-sentence defect
Scenario: concrete input or interaction → wrong outcome
Evidence: the check you did (lines traced, test, rule quoted)
Fix: the smallest change that resolves it
```

Then:

- **Checked, no findings:** the dimensions that passed, in one line each.
- **Open questions:** what you could not verify, and what would settle it.

"No findings" is a valid review. Do not pad a report, and do not edit the code under review unless
you are asked to.
57 changes: 57 additions & 0 deletions .agents/skills/robomous-component-review/references/severity.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Severity

Rank each finding by what it costs a person using the component, then by how many callers it
reaches. When in doubt between two levels, choose the lower one and say why.

## critical

Someone cannot complete a task, loses data, or is harmed. It also covers a published API that
breaks for existing callers without a migration note.

- A control that cannot be reached or operated by keyboard at all.
- A destructive action that runs without the confirmation the component promises.
- Focus trapped with no way out, or a dialog that cannot be dismissed.
- A removed or renamed export, or a narrowed prop type, shipped without `docs/MIGRATION-*.md`.

## high

The component works, but a documented contract is broken for a whole class of use: a WAI-ARIA
pattern, a DESIGN.md rule, controlled state, or integration with the environment it ships into.

- Behaviour that a router-managed app cannot observe.
`useFilterParams` writes `window.history.replaceState` behind the router's back
(`src/components/filter-params.tsx`, baseline debt 3).
- A controlled prop the component ignores, or a callback that fires twice per change.
- An icon-only button with no accessible name.
- `aria-controls` or `aria-labelledby` pointing at an id that does not exist.
- A literal colour, or a state written in the attribute a library emits instead of shadcn's
variant (DESIGN, *State attributes*).

## medium

Something is wrong or fragile in a narrower case, or costs every consumer a little.

- Two instances that fight over one global listener. Every `SearchInput` with `shortcut`
registers ⌘K (baseline debt 5).
- A list keyed by a value that may repeat (CodeBlock's tabs keyed by `item.label`).
- Hand-rolled interaction logic beside a component that already does it. CodeBlock's tablist
sits beside `Tabs` (baseline debt 4).
- A heavy dependency in a light import. `toast` keeps sonner in an esbuild Button-only bundle
(baseline debt 1).
- A missing test for a behaviour a screen would lose.

## low

Correct but untidy: redundancy, naming, documentation, or a nicer way that changes no behaviour.

- A role a native element already has (`<nav role="navigation">` in Pagination).
- A prop without JSDoc, so the API table shows "—".
- A demo missing for one documented state.
- An effect that could be an event handler, with no visible bug.

## Not a finding

- A matter of taste with no rule behind it.
- A rule from the `ui-sdk` skill that AGENTS.md, *Agent skills*, overrides here.
- Something already tracked in an issue. Link the issue instead of re-reporting it, unless the
change under review makes it worse.
1 change: 1 addition & 0 deletions .claude/skills/robomous-component-review
4 changes: 4 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,9 @@ directories for Claude Code.
- `robomous-component-development` walks an agent from a requirement to a verified, documented
component: reuse, foundation, anatomy, API, tokens, accessibility, tests, docs and verification.
Use it for any task that adds or changes a component.
- `robomous-component-review` is the independent review: every dimension from API to regression
risk, findings verified before they are reported, ordered by severity with `file:line`. Run it
on your own component change before the PR is ready, and for any audit.
- `ui-sdk` is UI SDK's official skill, linked to the copy inside the installed `@ui-sdk/core`, so
it always matches the pinned version. `pnpm skills:sync` re-links it after an upgrade, and
`tests/docs/skills.test.ts` fails until you do. See
Expand Down Expand Up @@ -180,4 +183,5 @@ When you follow the `ui-sdk` skill here, these rules of this repository win over
- [ ] The docs page, demos, JSDoc and README row are updated.
- [ ] Exports are updated, with no unapproved breaking change.
- [ ] `pnpm verify` passes.
- [ ] A `robomous-component-review` pass found no unresolved critical or high finding.
- [ ] The issue is linked and its acceptance criteria are met.
11 changes: 6 additions & 5 deletions docs/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,12 @@ demos and islands.
Project skills for coding agents live in `.agents/skills/<name>/`, where Codex reads them.
`.claude/skills/<name>` is a link to the same directory, for Claude Code.

**Skills of this repository** (`robomous-component-development`) are directories under
`.agents/skills/`, written and reviewed like any other file. Each gets a relative link for Claude
Code, `ln -s ../../.agents/skills/<name> .claude/skills/<name>`. `tests/docs/skills.test.ts` checks
that every skill has its link, a `name` matching its directory, a description, and links that
resolve. `pnpm skills:sync` leaves them alone; it only manages skills that come from packages.
**Skills of this repository** (`robomous-component-development`, `robomous-component-review`) are
directories under `.agents/skills/`, written and reviewed like any other file. Each gets a relative
link for Claude Code, `ln -s ../../.agents/skills/<name> .claude/skills/<name>`.
`tests/docs/skills.test.ts` checks that every skill has its link, a `name` matching its directory,
a description, and links that resolve. `pnpm skills:sync` leaves them alone; it only manages
skills that come from packages.

**UI SDK's `ui-sdk` skill** is not copied into this repository. `@ui-sdk/core` ships a copy that
matches its version, and the [`skills`](https://www.npmjs.com/package/skills) CLI links agents to
Expand Down