brand-ui-component
Create or extend a component IN the brand-ui monorepo (maintainer workflow). Use when adding a new primitive or block to @elabs-ai/components-ui, @elabs-ai/components-data, @elabs-ai/components-ai, @elabs-ai/components-flow, @elabs-ai/components-maps, @elabs-ai/components-charts, @elabs-ai/components-marketing, @elabs-ai/components-editor, @elabs-ai/components-viewer, @elabs-ai/components-terminal, or @elabs-ai/components-process, when extending an existing component, or when the user says "new component", "add a component to the library", or "scaffold a <Name>". Enforces the dedupe gate (reuse before create), the component API rules, the quality gates, and re-generates the component manifest. For consuming a component in an app, use the `brand-ui` skill instead.
- License 许可
- MIT
- 最近更新
- 2026-10-07
- Stars
- ★ 1
- Forks
- 1
01 前言 Front Matter
- name
- brand-ui-component
- description
- Create or extend a component IN the brand-ui monorepo (maintainer workflow). Use when adding a new primitive or block to @elabs-ai/components-ui, @elabs-ai/components-data, @elabs-ai/components-ai, @elabs-ai/components-flow, @elabs-ai/components-maps, @elabs-ai/components-charts, @elabs-ai/components-marketing, @elabs-ai/components-editor, @elabs-ai/components-viewer, @elabs-ai/components-terminal, or @elabs-ai/components-process, when extending an existing component, or when the user says "new component", "add a component to the library", or "scaffold a <Name>". Enforces the dedupe gate (reuse before create), the component API rules, the quality gates, and re-generates the component manifest. For consuming a component in an app, use the `brand-ui` skill instead.
- allowed-tools
- [ "Bash(pnpm brand-ui *)", "Bash(pnpm --filter *)", "Bash(pnpm gen)", "Bash(pnpm gen:check)" ]
- argument-hint
- <package> <Name> [purpose]
- user-invocable
- true
03 SKILL.md 正文
brand-ui-component (maintainer)
Add or extend a component in the monorepo. Runs the project's own workflow; this
skill is the portable front door to .claude/commands/new-component.md and the
component-builder / review-component agents.
1. Dedupe gate (before writing anything)
Search first — don't duplicate. brand-ui search <name/concept> and check the
registry. If something close exists, decide with the user: reuse, extend,
merge, replace, or (only if truly new) create. This mirrors
/new-component's analysis step.
2. Place it correctly
App UI → @elabs-ai/components-ui; data-dense → @elabs-ai/components-data; chat/AI → @elabs-ai/components-ai; canvas →
@elabs-ai/components-flow; geospatial/MapLibre map → @elabs-ai/components-maps; KPI/chart → @elabs-ai/components-charts;
landing → @elabs-ai/components-marketing; code
editor (Monaco) → @elabs-ai/components-editor (markdown authoring/preview + frontmatter utils
on the @elabs-ai/components-editor/markdown + @elabs-ai/components-editor/markdown/frontmatter subpaths);
displaying a file the app did not write (upload, signed URL, agent output) → @elabs-ai/components-viewer
(a new FORMAT is an adapter registration, not a new component);
shell/agent terminal output or a coding-agent CLI look-alike → @elabs-ai/components-terminal
(a leaf — nothing may depend on it, and @elabs-ai/components-ai must never import it).
One direction of dependency:
tokens → ui/icons → data/ai/flow/maps/charts/marketing/editor/viewer/terminal → process
(process is the one layer-3 composite — ADR 0034; primitives go down, compositions go up).
Import across packages via @elabs-ai/components-*, never relative paths.
3. Build to the rules
Follow .claude/rules/conventions.md (Component API, Styling & tokens, Accessibility):
forwardRef+ spread...props+classNamemerged withcn()last.- Variants via
class-variance-authority; export thexxxVariantsfn and all public types. - Semantic tokens only — no raw hex outside
themes.css. - Radix for interactive/overlay behavior; visible focus ring; correct roles/labels.
- Compound components over boolean-prop explosions;
"use client"when it uses hooks.
Co-locate name.tsx, index.ts, name.stories.tsx (with tags: ["autodocs"]),
name.test.tsx. Add the barrel export in the package's src/index.ts.
4. Quality gate + manifest
pnpm --filter @elabs-ai/components-<pkg> typecheck && pnpm --filter @elabs-ai/components-<pkg> lint && pnpm --filter @elabs-ai/components-<pkg> testmust pass (three separate invocations — pnpm chains only the first script).- Verify it renders in both themes (Storybook).
- Run
pnpm genso the new component reaches the manifest and every generated doc surface at once (pnpm gen:checkconfirms nothing is stale). - Audit it:
pnpm brand-ui audit packages/<pkg>/src/components/<name>and, for visual/contrast, thebrand-ui-auditskill.
5. Done = quality gates pass
Types exported, composable, semantic tokens, theme-safe, accessible, story + smoke
test, barrel export, green typecheck/lint/test (see the definition of done in CONTRIBUTING.md).
Findings during the work → /file-issue, don't silently patch unrelated things.
Composition patterns
Build compound, not configurable: avoid boolean-prop modes (use explicit variants),
share a context not props, lift state into a provider exposing state/actions/meta,
prefer children over render-props. Keep forwardRef; prefer use(). See
.claude/rules/conventions.md → Component API.
04 同仓库更多 Skills
brand-ui
Build UI with the brand-ui component system (@elabs-ai/components-* packages — ui, data, ai, flow, maps, charts, marketing, editor, viewer, terminal, tokens, icons). Use when working in a project that depends on @elabs-ai/components-ui or any @elabs-ai/components-* package, when adding/composing components, building dashboards, data tables, AI/chat surfaces, React Flow canvases, MapLibre maps, code editors, file/document viewers, app shells, forms, or marketing sections, when theming with the token system, or when the user mentions brand-ui, @brand, light/dark themes, or "our design system". Provides live project context, the real component API, composition patterns, and the rules that keep components token-driven, accessible, and theme-safe.
brand-ui-update-theme
Use when an existing brand-ui theme family should be improved from new material — updated brand guidelines, a new logo, product screenshots, a live site, feedback like "the green is off" or "match their new design system" — e.g. "update the qlik theme with these links", "refresh our theme from the new brand book", "/update-theme". For a brand with no theme yet, use brand-ui-create-theme.
brand-ui-theme
Create or retune a brand-ui theme (token work). Use when adding a new theme, re-branding the system to a customer's palette, adjusting global radius/spacing/surfaces, or fixing token-level contrast across themes. Use when the user says "new theme", "brand it for <customer>", "make corners less rounded", "dark theme", "adjust the tokens", or "our colors". Every change is a token in a theme stylesheet — never a hardcoded value in a component.
brand-ui-start
The front door for building UI with brand-ui — a router/concierge that asks what you want to do and hands you to the right flow. Use when someone is starting out and unsure where to begin ("help me with brand-ui", "where do I start", "I want to build something", "what can brand-ui do", "get me going"), or types /brand-ui-start. Routes to three flows — build a NEW app (brand-ui-new-app), improve/migrate an EXISTING app (brand-ui-migrate), or just help me USE brand-ui in an app that already has it (brand-ui). If the intent is already obvious (the person said "build me a dashboard" or "audit this screen"), skip the question and go straight to that flow.
brand-ui-registry
Curate the brand-ui shadcn-compatible registry (maintainer workflow). Use when deciding whether something belongs as an imported @elabs-ai/components-* primitive vs a copy-own registry block/template, when adding or editing a registry item, or when validating/building the registry for distribution. Use when the user says "add a registry item", "make this a block", "publish to the registry", or "package vs registry". For consuming registry items in an app, use the `brand-ui` skill (npx shadcn add).
brand-ui-new-app
Define-to-build — scaffold a new brand-ui app from a plain-language description (VP-02). Use when the user wants to START an app, page, or demo ("build me a sales dashboard", "I need an admin console for X", "new app", "scaffold a chat assistant", "create a landing page for a pitch") rather than add to an existing one. Runs a staged interview (quick 3-question mode or full 7-stage spec mode), writes an app-spec.md, then scaffolds from the matching template + playbook with every wiring point annotated and a starter CLAUDE.md so later agent sessions stay on-brand. For adding components to an existing app use `brand-ui`; for authoring library components use `brand-ui-component`.