Skip to content

supabase/cli

Supabase CLI. Manage postgres migrations, run Supabase locally, deploy edge functions. Postgres backups. Generating types from your database schema.

https://skillcdn.ai/gh/supabase/cli

Connect this address to your AI to use this skill. How to connect

  • Unverified
  • Default branchdevelop
  • Commit940b07e
  • LicenseMIT
  • Searchwords

Showing commit 940b07e

The newest commit, 0e8cd8a, is being indexed. Until it is ready, this page and every agent are served the last indexed commit.
View on GitHub

port-base-ui-component

Port one Base UI component into effect/ui/kit as an unstyled view function or headless component. Use when asked to add a kit component that Base UI has, such as Switch, Toggle, Tabs or Dialog.

Path
vendor/effect/.agents/skills/port-base-ui-component/SKILL.md
License
MIT

Port a Base UI component into the kit

One run ports one component. If the port needs another kit component that doesn't exist yet, such as a Popover, stop and open a separate issue for it. When the missing piece only backs an optional feature, leave it out and document any resulting limitation in the kit's own terms.

Read references/conventions.md before step 3. Switch (packages/effect/src/ui/kit/Switch.ts and packages/effect/test/ui/kit/Switch.test.ts) is the worked example of a view function. For a headless component, ai-docs/src/90_ui/03_headless/10_drawing-a-headless-component.ts and ai-docs/src/90_ui/fixtures/kit/Listbox.ts show the core API, and the conventions say where the kit wraps it.

Checklist

Work top to bottom. Put the notes from steps 1 to 3 in the PR description.

  1. Read Base UI. Fetch https://base-ui.com/react/components/<name>.md (the .md page has the full API tables) and the source under packages/react/src/<name>/ in https://github.com/mui/base-ui. Note:

    • the parts (anatomy) and the element each one renders
    • the props, and which are controlled, default* or React-only (className, style, render, refs)
    • the state, and the data attributes on each part
    • the keyboard interaction, and whether a native element gives it (useButton with native) or a key handler does
    • the ARIA roles and attributes, and which element carries each
    • the contexts it reads (Field, Form, Direction): each is a dependency for the scope rule above
  2. Read Foldkit. Look for packages/ui/src/<name>/ on the codex/layers-and-submodels branch of https://github.com/foldkit/foldkit. If it exists, note where it differs from Base UI and why. It is the closest reference for the same ideas without React.

  3. Decide the shape, using the conventions:

    • view function, headless component, or (rarely) a component with slots. Count the state Base UI keeps that the port puts off
    • one element returned as a builder with chained .children(...), or several arranged in view
    • the parts, the tag each accepts, and the attributes and events each owns
    • each part's arguments, and the markup a part adds and where it goes
    • the props, and the events: on<Event> options for a view function, <Name>Events for a component
    • for a component, the Model, which holds only interaction state the consumer never stores
    • for a component, its restore: false when the Model depends on a Command an update started or on DOM state such as hover, focus or a measurement, a function that clears those fields when the rest should come back after Back, or left out. A measurement that scroll restoration needs may stay: see ai-docs/src/90_ui/05_state/70_history-restore.ts
    • the message and event names: past-tense facts for messages, and for each event the report/request test in ai-docs/src/90_ui/01_basics/20_naming.ts
    • the Base UI features you leave out, and why
  4. Implement packages/effect/src/ui/kit/<Name>.ts, unstyled, and add export * from "./<Name>.ts" to packages/effect/src/ui/kit/index.ts in alphabetical order, with the JSDoc block the other entries have. That file is written by hand: don't run pnpm codegen for it.

  5. Test in packages/effect/test/ui/kit/<Name>.test.ts. Test a view function with Scene.make and a small consumer component that calls it, and call it directly with a View.makeHelper helper for its attributes and markup (a non-interactive view function already covered directly needs no Scene, as in Separator.test.ts). Test a headless component with Scene.make and a stand-in view for rendered interaction, Story.parts for a part on its own, and Story.make for update and Command tests. Behaviour that needs a real DOM, such as a mount that measures or moves focus, goes in <Name>Document.test.ts under // @vitest-environment happy-dom, with the helpers in packages/effect/test/ui/kit/utils/document.ts. Cover, in as few tests as you can:

    • each interaction sends the right message or emits the right event
    • disabled and read-only, each in its own test: what each suppresses is in the "State" section of the conventions
    • the ARIA and data attributes for each state, on every part that has them
    • the keyboard: fire keydown for the keys the component handles. For keys a native element handles, assert that a part rejects another tag
    • the markup a part function adds, such as the form field
    • precedence: on each part, a consumer value for every attribute the part owns loses, both when the part sets it and when the state leaves it absent, while the consumer's class and other attributes stay. For a view function's part, that holds for a value chained after the part too
    • for a view function, an element that already handles an event fails the render if any option reserves that event, in every state, whether the handler was set before the call or chained after it. Check that the consumer's handler stays when no option reserves the event

    Add packages/effect/typetest/ui/kit/<Name>.tst.ts for each part: the builder it returns, the inferred message type and requirements, and the tags it rejects. Then break the code (for example, drop the disabled guard, or the undefined a part writes for an absent state) and check that a test fails.

  6. Document and check.

    • Keep upstream research and links in this skill and the PR. In kit code, comments and JSDoc, describe the kit's own behavior without naming the upstream project. Check that this search returns no matches: git grep -inE 'base[[:space:]_./-]*ui|@mui/base' -- packages/effect/src/ui/kit/<Name>.ts packages/effect/test/ui/kit/<Name>*.test.ts packages/effect/typetest/ui/kit/<Name>.tst.ts.
    • Write the module JSDoc in the shape the conventions give, following the jsdocs skill. The one example goes in a fence opened with ts import.meta.vitest, so it runs as a doctest. A component's example renders it with HtmlServer.renderToHtml and throws unless the HTML shows one thing, such as the consumer's class next to the part's role, and a utility's example throws unless a result is the one expected.
    • Add @since, @category and @stability unstable to every public declaration, as the rest of the kit has.
    • Name the parts argument after the component in the JSDoc and the tests, as the "Call shape" section of the conventions says.
    • Add a changeset with the changesets skill. The kit is @stability unstable, so a new component is "effect": patch.
    • Run each of these from the repository root, with nix develop -c: pnpm lint-fix, pnpm check, pnpm test --run packages/effect/test/ui/kit/<Name>.test.ts (and the Document test), pnpm test-types packages/effect/typetest/ui/kit/<Name>.tst.ts, pnpm doctest --run packages/effect/src/ui/kit/<Name>.ts, pnpm jsdocs --check and pnpm circular. Never run bare pnpm test or pnpm doctest, which start watch mode.

Files of this skill

Browse all supporting files