agentleFS
gandolhgandolh/my-personal-skills/skills/base-ui/SKILL.md

base-ui

Skill0 starsChanged 13 days agoMITView on GitHub

The estate's conventions for React UI built on Base UI (@base-ui/react, pinned at 1.9.0) and styled with Tailwind 4, as 17 numbered rules, each with its reason and what enforces it (the house-style check-base-ui script, or review). Copy-ready Tailwind wrappers for dialogs, menus, popovers, selects, tabs, toasts, forms and the rest, the Light / Dark / System theme switch, the one stylesheet and its token names, and the method for moving an app from plain CSS to Tailwind.

4 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

2 rules. 0 are common, 0 are distinctive, and 2 are very specific to this project.

  • 0

    Common

    Most of the 4 edited versions we read keep these.

  • 0

    Distinctive

    This author's own choices. Worth a look.

  • 2

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Every web app in the estate builds its interactive parts on Base UI (@base-ui/react), pinned at 1.9.0, and styles the whole app with …

    line 10
  2. Very specific:

    Rule 6: No literal radius, shadow or z value (rounded-[6px], z-[999]) where a token exists.

    line 107

“Common” is measured: kept by at least 6 in 10 of the 4 edited versions of this file we could read. “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

Base UI with Tailwind

Every web app in the estate builds its interactive parts on Base UI (@base-ui/react), pinned at 1.9.0, and styles the whole app with Tailwind 4. There is no shared component library: each app keeps its own look on purpose (many carry a DESIGN.md), and the one shared kit that exists, imbatranimOS's, shows what lockstep costs. What repeats from app to app is behaviour and its traps: an Esc that closes the wrong layer, a button nested in a button, a select showing a raw id, a native confirm(). This skill writes those down once, as numbered rules and as wrappers each app copies and restyles with its own tokens.

The verdict and the alternatives it beat are in the library's corpus/wiki/decisions.md ("Base UI conventions as a skill, not a shared library"). The owner's calls of 2026-11-10 that shaped the rules are on grilling-2026-11-10.md and grilling-2026-11-10-technical-calls.md; their Q numbers appear below.

How the rules are checked

The checker ships in the library's house-style/ folder and reaches each repo with the rest of house-style, by npm run house-style:sync. Nobody copies it by hand.

node vendor/house-style/bin/check-base-ui.mjs [--warn-only] [--version 1.9.0] [repo-root]
  • check:conventions runs it, with --warn-only from the repo's harness brief until its own Base UI brief is done.
  • What it counts: errors are rules 1, 2, 3, 5, 6 (arbitrary colours only) and 11; warnings are 9 and 10. Rules 4 and 7, inline style under 5, and radius, shadow and z literals under 6 are review only. A repo brief's "record the counts for rules 4-7" means counts found in review, not checker output.
  • Each finding is one line, file:line rule-N error|warning: message. Exit 0 when no error is left, 1 when one is, 2 when it can't check (a bad flag, a malformed conventions.json). Warnings never fail the run.
  • The repo's conventions.json (root, scripts/ or tools/) names the web roots as source folders (web/src, apps/*/src, ui/app). Inside each root, ui lists where Base UI may be imported (default **/components/ui and **/features/*/ui), and stylesheet names the one stylesheet (default styles/index.css).
  • A finding the repo accepts is an exception there: the check, the rule number, the path, an optional match, and a reason. An exception without a reason is an error. An exception may also record a review-only rule's case (Ward's dark-only console under rule 14), so a reviewer finds it.
  • Tests (*.test.*, *.spec.*, files under test, tests, __tests__, testing or e2e) are exempt from rules 3, 6, 9, 10 and 11.
  • ui and stylesheet are per web root, one value each. A kit package whose components folder isn't components/ui (imbatranimOS: 18 findings), a token sheet shared by several roots, a lazy route's vendor sheet and a public-pages sheet (ward-auth, churchix's three token sheets) each take an exception with a reason. A repo whose one stylesheet stays at src/index.css sets "stylesheet": "index.css" (comercial-website) instead of an exception.
  • Rule 9 skips an icon child inside a trigger (postern's ComposeForm and SearchBox warned on lucide icons until house-style 1.3.0): a name imported from an icon package, or one named Icon or …Icon. Another icon component still warns; it is a warning and stays one, don't except it.

The house-style package README has the full format.

The rules

#RuleWhyEnforced by
1Pin exactly: "@base-ui/react": "1.9.0", never ^ or ~The estate moves together; a later bump is a brief of its own, like the library's brief 04check-base-ui rule 1, in every package.json from a web root up to the repo root
2Import a part's subpath, @base-ui/react/dialog, never the package rootOne module per part keeps the dev server and tests small, and a grep for a part finds every userule 2
3Base UI is imported only under a ui/ folder: one wrapper per primitive at components/ui/<Name>.tsx, or a composite only one feature uses in features/<name>/ui/ (Q15, Q59). Feature code imports the wrapperThe look and the behaviour rules live in one file per primitive, and a Base UI change touches one folderrule 3, against the ui globs; tests exempt
4Style each part with Tailwind on its className: state through data-* variants (data-checked:, data-[side=top]:), positioner variables through origin-(--transform-origin) and the like, merged with cn() from src/lib/cn.ts. No CSS selector aimed at a part, no query into Base UI's DOMThe state is on the element; Base UI's inner markup is not an API and changes in minor releasesreview
5One stylesheet, src/styles/index.css: @import "tailwindcss", the @theme tokens, @custom-variant dark, fonts, third-party CSS in layer(vendor), a small @layer base. No other .css, no CSS modules, no inline style except computed geometryCascade layers decide what wins only when every rule sits in one ordered stackrule 5: other stylesheets, CSS modules, and the one without @import "tailwindcss". Inline style is review
6Colours, radii, shadows and z-indexes come from @theme tokens named for a role (bg-surface, text-ink, rounded-control, z-popup; Q17, Q61). No arbitrary colourA token restyles the app at once, and dark mode is a token's second valuerule 6: an arbitrary colour anywhere in code (bg-[#…], rgb(, hsl(, oklch(, color-mix(, in cn() and cva too). Radius, shadow and z literals are review
7Motion keys on data-starting-style and data-ending-style, under motion-safe:; keyframes are --animate-* in @themeBase UI keeps a popup mounted until its transition ends, and reduced motion is honoured in one placereview
8Every popup goes through its Portal, and its z-index comes from the token scaleA popup inside overflow or a transform gets clipped; literal z values put a Select under a Dialog in imbatranimOSreview
9A trigger that wraps a component uses render: <Tooltip.Trigger render={<Button … />} />, for every trigger. A render function returns the element itself, not a span around itA trigger is a <button>; a Button inside it nests a button in a button, invalid and click-swallowingrule 9, a warning. It can't see a part re-exported under a new name; an icon child (from an icon package, or named …Icon) is skipped since house-style 1.3.0
10A Select whose values differ from their labels passes items to Select.RootWithout them the trigger shows the raw valuerule 10, a warning on every Select.Root without items. Blind to a re-exported root
11No window.confirm, alert or prompt. Ask with ConfirmAction, useConfirm() or an inline Yes / No (Q58)A native dialog blocks every script on the page, can't be styled, and some browsers suppress itrule 11: bare, window., globalThis. and self. calls; a name the file binds itself is skipped
12Dialogs: controlled open and onOpenChange with the Escape guard; initial focus on [data-autofocus], else the first field, else the footer's first button; disablePointerDismissal on a dialog that holds a form (Q58); a Title on every dialog; an aria-label on every icon-only controlEach was found by hand in three or more appsreview
13Prefer Base UI over a hand-built or third-party widget: a menu, dialog, popover, select, switch, checkbox, tabs, toast or slider starts from Base UI (sonner moves behind a wrapper with its call shape). Native stays for text, date and time inputs, and for a <select> on phones where an app decided so (Q16)One accessible behaviour per widget, one look per appreview
14Every app has a Light / Dark / System choice; a first visit shows light; the choice is kept on the device under the app's own key, <app>.theme, never the bare theme (one localStorage serves every app on the domain); dark: keys off data-theme on <html> through @custom-variant, never prefers-color-scheme alone; the theme-color meta follows it (Q18)The owner's call: a switch everywhere, light first. The attribute lets the choice override the systemcheck-base-ui for the key; the rest by review. The apps that bend it record a conventions.json exception
15A phone navigation panel is a Drawer, closed by a swipe, a tap outside, the X or Esc, and it has a Drawer.Title (Q40)A swipe is how a phone closes a side panel; the title names it for a screen readerreview
16One of several. A filter that always has one chosen, and a setting kept only on the device (theme, language, a view mode), is a RadioGroup (Tabs with activateOnFocus when it switches panels). A picker that saves to the server on each choice is a ToggleGroup with the guard. A filter that can be empty, where a second press clears it, is a ToggleGroup without the guard (Q41, Q57)Arrow keys may try out a filter or a device setting, which cost nothing; they must never write to the server. A radio can't be clearedreview
17jsdom tests only for wrappers that hold logic; flows in Playwright. Tests select by role and name, with data-testid only where no role fits (Q60, Q62)A test of a thin wrapper tests Base UI; a role query tests what a user and a screen reader getreview

check-base-ui reports rules 1, 2, 3, 5, 6, 11 and 14 (the key only) as errors and 9 and 10 as warnings. The rest, and the parts of 5 and 6 the script can't see, are review's.

What review covers

A reviewer works through these, skipping what the checker already reports:

  • Rule 4. Class names on the parts, never a stylesheet selector such as .dialog__title or [data-highlighted] .label; no querySelector into a Base UI part.
  • Rule 5. Inline style holds only computed geometry or data.
  • Rule 6. No literal radius, shadow or z value (rounded-[6px], z-[999]) where a token exists; token names say a role.
  • Rules 7 and 8. Transitions under motion-safe:; every popup portalled and on the z scale. Rule 7 is where the checker is blind and the repos were too: imbatranimOS had 63 transition and animate- uses and none under motion-safe:, imbatranim-apps 20 and none. Grep for them (transition|animate-|data-starting-style) and count the ones that aren't under motion-safe:.
  • Rules 9 and 10 through aliases. A repo's own DialogTrigger or Select re-export hides its call sites from the checker. Look at each caller.
  • Rule 12. Each dialog: controlled, guarded, focus lands on the field, a title, a labelled X, and a form dialog that ignores outside presses.
  • Rules 13 to 17. A hand-built widget, a missing theme switch, a phone menu that isn't a Drawer, an arrow key that saves, a test selected by class.

The references

Each page has a wrapper ready to copy, written fresh against the owner's code, compiled with tsc --noEmit against 1.9.0, and a note on what to adapt to the app's tokens. The class names use the small-tools family's token names (surface, raised, ink, line, accent, danger); substitute the app's own.

  • tailwind.md: the one stylesheet in full, the layer order, token naming, the attribute-to-variant table, the positioner variables, cn() with extendTailwindMerge, Button and the shared looks. Read it first: every other page imports from it.
  • theme.md: rule 14, the Light / Dark / System switch, the boot script and the store.
  • dialog.md: rule 12 as a wrapper: the Escape guard, initial focus, three sizes, full screen below md, a form dialog.
  • confirm.md: ConfirmAction with a pending state, useConfirm(), and when an inline Yes / No is right.
  • menu.md: the menu and its items, opening a dialog from an item, modal, and an item that moves focus.
  • popover.md: the popover, and an info button that works on touch.
  • tooltip.md: render, the provider, and what replaces a tooltip on touch.
  • select.md: items, the label, and native selects on phones.
  • combobox.md: a filtered long list that stores ids, with Combobox.createItems.
  • switch-checkbox.md: both, with labels, the indeterminate state, and the value the server takes.
  • tabs-toggle-group.md: rule 16: RadioGroup, Tabs and the guarded ToggleGroup, and which is which.
  • toast.md: one manager, notify(), the host, and leaving sonner.
  • field.md: Field, a text field, validation, and a form that shows the server's errors.
  • drawer.md: rule 15, the phone navigation drawer.
  • toolbar.md: a toolbar with toggles, a menu and a tooltip, and the order of render.
  • migrating-from-plain-css.md: the method every app's Tailwind brief follows.
  • conversion-traps.md: where Tailwind 4 differs from the CSS being converted (what Preflight removes, state order, translate, grid-cols, color-mix, class hooks in code), and what the ten moves measured.
  • Platform features beyond Base UI (browser support, time zones, sanitizing, view transitions) are in the web-platform skill.

The package ships its own docs, one Markdown file per component with the full API tables, at node_modules/@base-ui/react/docs/react/. Check a prop or an attribute there, never from memory.

In a repo

A repo meets this skill through two briefs of its own, in the owner's order (Q20):

  • Before its Tailwind brief, a repo not yet on Tailwind writes the wrappers with plain classes and state through [data-*] selectors in its one stylesheet: cn() and the tokens don't exist yet. Its Tailwind brief then converts them.
  • Its Tailwind brief follows migrating-from-plain-css.md step by step. A repo already on Tailwind (ro-housing) skips to the token and stylesheet checks.
  • Its Base UI brief moves every Base UI import under ui/ (rule 3), replaces hand-built widgets and native dialogs (rules 11, 13), audits each dialog against rule 12, adds the theme switch and the phone drawer (14, 15), sorts its choice controls (16), and drops --warn-only from check:conventions when check-base-ui passes.

What the 2026-11 builds settled (every repo's Base UI and Tailwind briefs):

  • The skill beats a repo brief's wording where they differ, and the outcome note lists it. It happened for the theme picker (a RadioGroup in six repos where the brief said ToggleGroup: ro-housing, sports-app, Shelfmark, public-resource-map, SocialEvents, 3D-sandbox), for dark tokens (light-dark() pairs with color-scheme from data-theme, where the brief said a block under [data-theme="dark"]) and for the error toast (it stays until dismissed, timeout: 0, where a brief said about 5 s).
  • An error toast stays at every call site, not only in the wrapper. Almanac added type: "error" and left its six callers on the old default; Postern's 17 failure toasts needed duration: null one by one. Grep every failure toast after changing the default.
  • A Button wrapper for a repeated look is in scope for a Tailwind brief (lantern), beside looks.ts for the repeated class strings.
  • Before and after screenshots decide parity. Two throwaway clones, pixelmatch, a pinned clock, seeded data. It found Satchel's lost bubble looks, Lantern's changed grid widths and Almanac's utilities that generated no CSS. migrating-from-plain-css.md has the recipe.

The repo's .claude/rules/web.md carries a short copy of the rules that apply to it, scoped to its web roots, so they load even where this skill doesn't. The house-style skill describes that file.

Upgrading Base UI

A new Base UI version is its own brief: read the release notes in node_modules/@base-ui/react/docs/react/overview/releases/, bump every repo together, and raise check-base-ui's default --version in a house-style minor version. 1.4 to 1.9 had two breaking renames: OTPFieldPreview became OTPField, and sanitizeValue() became normalizeValue().

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.