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`.
- License 许可
- MIT
- 最近更新
- 2026-10-07
- Stars
- ★ 1
- Forks
- 1
01 前言 Front Matter
- name
- brand-ui-new-app
- description
- 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`.
- allowed-tools
- [ "Bash(npx @elabs-ai/components-cli *)", "Bash(pnpm brand-ui *)", "Bash(pnpm exec brand-ui *)", "Bash(npx brand-ui *)", "Bash(npx shadcn@latest *)", "Bash(pnpm dlx shadcn@latest *)", "Bash(pnpm storybook *)" ]
- argument-hint
- [description of the app, e.g. 'sales pipeline dashboard, dark']
- user-invocable
- true
02 资源文件 10
- 参考文档reference/app-shells.md5.9 KB
- 参考文档reference/app-spec-template.md3.5 KB
- 参考文档reference/app-spec.example.md3.1 KB
- 参考文档reference/app-spec.schema.json8.9 KB
- 参考文档reference/archetypes.md4.2 KB
- 参考文档reference/lint-and-taxonomy.md3.6 KB
- 参考文档reference/patterns.md6.0 KB
- 参考文档reference/stages.md8.2 KB
- 参考文档reference/starter-claude-md.md8.3 KB
- 参考文档reference/visual-loop.md6.0 KB
03 SKILL.md 正文
brand-ui-new-app (define-to-build)
Take a developer from "I want to build X" to a running, on-brand scaffold — without them needing to know component names, composition patterns, or design rules. Ask first, generate second: interview to a concrete spec, write the spec down, scaffold from the spec.
0 · Pick the mode
| Signal | Mode |
|---|---|
| Short ask, archetype obvious ("a dashboard for deals") | Quick (3 questions) |
| Rich description, multiple surfaces/entities, or user asks to "spec it out" | Full (7 stages) |
| User said "just scaffold it" / "defaults are fine" | Quick, zero extra questions where the description already answers them |
Never re-ask what the description already states (theme, archetype, title).
Quick mode (the 80% path)
One AskUserQuestion round, only for the unknowns among:
- Archetype — dashboard · data app · AI assistant · flow workspace ·
settings · marketing page (mapping table:
reference/archetypes.md). - App shell — flagship (recommended) · dashboard · mail · double-sided
— the frame every screen lives in, one of Storybook's Layout/App Shell
entries (catalog + the exact question:
reference/app-shells.md). Always asked (except for marketing, which has no shell): the archetype templates ship in a bareSidebarProviderframe that is a story stand-in, not a finished shell, and an app left in it looks unfinished. Render the shell stories in the visual loop before the person picks. - Theme — light (default) · dark. Offer a preview when Storybook is available (ladder below).
- App title — free text, defaults to the archetype name.
Then go straight to Scaffold with the archetype's defaults; record the
defaults used in app-spec.md so the user sees what was decided for them.
shell is never a recorded default — it is the person's answer.
Quick mode does not ask about taste — it records the restrained default
profile (product / comfortable / system / 0) in the spec, except for the
marketing archetype, which records register: "brand".
Full mode — the 7 stages (VP-02)
Each stage is 1–2 AskUserQuestion rounds (≤4 questions each, options ≤4,
"Other" is free). Every answer is appended to app-spec.md immediately —
the spec is the source of truth, reviewable and re-runnable. Full per-stage
question script: reference/stages.md (stage-6 archetype question sets:
reference/archetypes.md).
| # | Stage | Capture |
|---|---|---|
| 1 | Intent | what, for whom, rough scale |
| 2 | Archetype | app shape → template + playbook (show rendered archetypes if possible) |
| 3 | Shell, surfaces & nav | the app shell (reference/app-shells.md, rendered in the loop) + screens/sections (multi-select common ones per archetype + own) |
| 4 | Data & entities | main objects + key fields → table/form/detail stubs |
| 5 | Brand & feel | theme (+ render a sample surface in it), the taste profile (register · density · motion · expressiveness), brand color |
| 6 | Per-surface detail | per archetype — columns/filters, KPI list, chart types, fields, node taxonomy, message parts (question sets: reference/archetypes.md) |
| 7 | Confirm → scaffold | show the assembled spec, confirm, generate |
Stage 6 is skippable ("scaffold with sensible defaults") — record the defaults in the spec. If the user corrects the same dimension twice, stop patching and re-derive the frame (conceptual-framing rule).
Visual feedback (propose → preview → pick → refine)
At every visual decision (archetype, nav, theme, chart types) run the shared
loop — reference/visual-loop.md (VP-04). Use the highest fidelity rung
available — real Storybook render > generated artifact > option preview >
text — and never decide a visual on prose when a render is possible
(start pnpm storybook in the background to reach the MCP if needed; theme
slugs light/dark).
Layout options come from the curated arsenal — reference/patterns.md —
filtered by the spec's taste profile (calm/product is the default; brand and
high-expressiveness patterns are opt-in).
Design pass (every net-new screen, before its code)
The same pass applies when adding one new screen or page to an existing app.
Settle these before writing route code, and record them in app-spec.md:
- Intent, one sentence — who opens it and what answer or decision they leave with. "Tells ops which orders need action today", not "a directory of orders".
- References — look at 2–3 comparable products or screens first; name what this one must match or beat.
- 2–3 distinct concepts — different approaches ("reading desk" vs "mission control" vs "guided wizard"), not parameter tweaks of one layout. Score them against the intent, recommend one, confirm it, and mock it as a story before wiring it into the app.
- The full state grid, designed with the happy path — ready · loading
(layout-shaped
Skeleton) · empty (StatePanel kind="empty": icon, title, one sentence, one action) · error (StatePanel kind="error": what happened, how to fix it) · first-run (a real onboarding moment, not the empty state relabelled). - Non-component layers — illustration (or deliberately none), motion that
must be felt (gated
duration-*/ease-*+motion-reduce:), fix-oriented microcopy, and what reads first.
Component lists come last. A layout that repeats a second time is a pattern — name it and extend the library or a registry block instead of a third copy.
Scaffold (generated FROM the spec — run the CLI, don't hand-roll it)
brand-ui scaffold is the deterministic half. It reads the spec's fenced json
block, applies it to the archetype template and writes the app. Do not
hand-roll the files it emits (step 3) — the CLI is what makes the flow repeatable.
-
Standalone or in-monorepo? Ask once, and record it in the spec (
"standalone": true+ an optional"release"). A standalone app lives outside the brand-ui repo, so it needs the private-registry install handoff and real semver ranges; an in-monorepo app keepsworkspace:*. Getting this wrong is the difference between an app that installs and one that doesn't. -
Locate the target. A new app folder (a Vite app, or whatever the project uses) or a folder the user names; in an existing project, its
app/orsrc/. -
Write
app-spec.mdfirst (template:reference/app-spec-template.md). It carries a single fencedjsonMachine spec block — the contract the CLI reads (schema:reference/app-spec.schema.json, validated bybrand-ui scaffold --dry-run; example:reference/app-spec.example.md). Keep the prose and thejsonblock in sync. -
Emit.
brand-ui scaffold <path>/app-spec.md --dry-run --write <target> # see the plan brand-ui scaffold <path>/app-spec.md --write <target> # emit(
pnpm brand-ui …inside the brand-ui repo;pnpm exec brand-ui …in a project that installed@elabs-ai/components-cli— the CLI ships the archetype templates and the manifest, so--writeworks with no brand-ui checkout anywhere.--write <target>may point at any directory.) It writes:File What it carries index.htmlthe Vite entry — <div id="root">+ the module script,data-themeset for the first paintsrc/App.tsxthe archetype template with the spec applied — nav labels, interface <Entity>,ColumnDef<Entity>[]— its screen rendered INSIDE the chosen app shellsrc/components/<block>/…the chosen app shell as a copy-own block ( workspace-shell/sidebar-02/sidebar-04/sidebar-05) —reference/app-shells.mdsrc/main.tsxroot wiring: the token stylesheet, <ThemeProvider defaultTheme="<chosen>">, engine side-effectssrc/styles.cssthe token @import+ one@sourceper installed package (skip these and it renders unstyled)vite.config.tsreact + @tailwindcss/vite— without that pluginstyles.cssis never processedtsconfig.jsonstrict, react-jsx,vite/clienttypes —pnpm typecheckruns on day oneapp-spec.mdthe spec, verbatim CLAUDE.mdthe agent contract every later session inherits (theme, archetype, playbook, install recipe) AGENTS.mdthe vendor-neutral pointer at the same contract brand-ui-context.mdthe manifest-derived component inventory — what exists, so a later agent never guesses an API eslint.config.jsbrand/no-raw-font-size+brand/no-raw-coloraterror(reference/lint-and-taxonomy.md).github/workflows/brand-ui.ymlthe gates that actually run: typecheck,lint,audit:ui(brand-ui audit src)package.jsondeps ( workspace:*or real semver ranges) + engine peers at their declared ranges, and the toolingThe emitted app runs:
pnpm install && pnpm dev.It never overwrites an existing file unless you pass
--force. Scaffolding into a folder that already has some of these (e.g. acreate-viteapp) comes backpartialwith a non-zero exit and names what it skipped — that app is incomplete until you merge those files by hand. Don't reach for--forceto silence it: it overwrites the user'spackage.json/src/App.tsxtoo. -
Apply the taste profile — through the dials, never per component. Carry the spec's
tasteblock into the root<ThemeProvider>as props —defaultRegister,defaultDensity,defaultMotionPreference,defaultDecoration(=taste.expressiveness) — and writebrand-ui.config.jsonat the app root with the same block, sobrand-ui audit/brand-ui infojudge the app against the profile it was built to. Apply the profile ONLY through those dials; never bake a density/expressiveness decision into emitted component source (the scaffoldedbrand/no-raw-*lint already blocks the colour/size half).defaultMotionPreferenceis only ever"system"or"reduced"— never"full", which is an informed-consent override that suppresses a visitor's OS reduce-motion request (reference/stages.md; the app-spec schema rejects it). If the app wants a motion control, scaffold a settings toggle overuseMotionPreference()and let the person choose. -
Do the judgment the CLI can't. Wire the generated entity model into the real surface and delete the placeholder rows; build the surfaces the template had no slot for; pick the KPI/chart shapes the spec described in prose (renderer per field type — see
playbooks/data-app.md§Columns). Anything the spec doesn't answer stays a// TODO(spec):comment — never invent data, never silently drop an unanswered field. The command prints the fullTODO(spec)list; that is the work queue. -
Cover the state grid. Loading (
Skeleton/DataTable loading), empty and error (StatePanel kind="empty" | "error") — never a blank region. -
Verify props against the real API before using them —
brand-ui docs <Component>or themcp__brand-ui__docstool. Never guess a prop. -
Hand off the install. For a standalone app the command prints a "Make it runnable (standalone)" block — the
.npmrcscope mapping + auth line, thepnpm addfor the packages, thepnpm addfor the engine peers (@xyflow/react/monaco-editor/maplibre-gl/ theaiSDK), the CSS@import+@sourcelines, and any one-time side-effect import. Give that block to the user verbatim and point atdocs/CONSUMING.md§1–4 in the brand-ui repo for the full recipe. A scaffold nobody can install is not done.
Verify before "done"
- It runs.
pnpm installthenpnpm dev(orpnpm build) in the target — the scaffold emitsindex.html,vite.config.tsandtsconfig.jsonprecisely so this is a command you run, not a promise you make. Apartialemit is NOT done. typecheckandlinton the scaffolded app — green. The scaffold wiresbrand/no-raw-font-size/brand/no-raw-color, so raw sizes/colours must be clean.brand-ui audit <target> --json --strict— REQUIRED, and it blocks "done" by EXIT CODE, not by you remembering. Run it over the generated app (pnpm brand-ui audit …in this monorepo;pnpm exec brand-ui audit …in a consuming project —docs/CONSUMING.md§7a).--strictexits 1 when there is any blocking style finding or any content slop, and 0 when the app is clean — so "did the bar pass?" is a status code you can't talk your way past. A scaffolded app is born compliant or it isn't done. (The rendered cross-theme + WCAG-contrast pass is thebrand-ui-auditskill.) It judges against the spec's taste profile automatically: the audit resolvesbrand-ui.config.jsonfrom the target path (nearest config wins), which is the one step 4 wrote beside the app, so this holds whether you run it from the app dir or from the monorepo.- Content slop BLOCKS "done". Any
slop-generic-name/slop-fake-number/slop-brand-namefinding means the scaffold shipped placeholder content — "John Doe", "99.99%", "Acme". Replace it with real domain content drawn from the spec'sintentandentities, then re-run. Do not report done, and do not explain it away: a generated app full of Jane Does is the exact failure this bar exists to stop. (Cite the rule ids the audit prints; don't restate the patterns — the detector owns them.) - Blocking token/style findings (raw hex,
gradient-text,space-y-*, …) are fixed before "done" too — they are the same rules the scaffolded lint enforces. - Advisory findings are reported to the user, not silently dropped.
- The scaffold wires the same pass as an npm script —
pnpm audit:ui(=brand-ui audit src) — and runs it in the emitted CI workflow, so the bar outlives this session (that script omits--strict; add it when you want the non-zero exit). On a standalone app it is the only machine enforcement of the taxonomy — the shared eslint-config is private and unpublished — which is why that CI job exists.
- Content slop BLOCKS "done". Any
- For a standalone app: the install handoff has been emitted (step 8). Not optional — without it the app cannot be installed at all.
- Open the playbook checklist for the archetype; confirm each block the spec ordered is present.
- The app lives in the shell the person chose —
src/App.tsxrenders the screen insideWorkspaceShell/DashboardShell/MailShell/SettingsShell, and no bareSidebarProvider+Sidebar+SidebarInsetframe of the template's own is left around it (shell: minimalis the one deliberate exception, and it was the person's explicit choice). A scaffold that still shows the template's one-word header in a plain rail is the failure this check exists for. - If Storybook/browser rendering is available, render the scaffold in every
shipped theme —
light,dark— and name the surface you looked at; otherwise say plainly that the scaffold compiled and audited clean but was not visually verified. Never claim a visual result you didn't see. - Report remaining
// TODO(spec):placeholders as the user's explicit next steps (that's the handoff, not a failure).
Hard rules the scaffold must obey
Type is a role, not a size (text-<role> / Heading / Text — never
text-2xl/text-sm/text-[18px]) · semantic tokens only — never raw hex
or Tailwind palette (text-gray-500), both enforced by the scaffolded
brand/no-raw-* lint · no placeholder slop — sample content is
domain-specific, drawn from the spec's intent/entities; never "John Doe",
"99.99%", "Acme", or a filler verb ("Elevate", "Seamless"), and the audit above
enforces it · taste comes from the dials — the profile is applied via
ThemeProvider props + brand-ui.config.json, never hardcoded per component ·
import via @elabs-ai/components-* · Lucide for generic glyphs ·
loading/empty/error states wired, never blank regions · brand-ui never owns
model calls or data fetching (D5) — scaffold stubs, not transport.
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-migrate
Bring an app that already exists onto brand-ui (@elabs-ai/components-*). Use when someone wants to migrate, port, adopt or "move to" the design system in a codebase they already have ("migrate this project to brand-ui", "we use MUI, can we switch", "adopt your design system in our admin app", "replace our components with yours"). Profiles the repo, maps every component it finds to a brand-ui verdict, writes a phased migration plan, and then walks the phases with the user approving each one. Read-only until the plan is approved. For a brand-new app use `brand-ui-new-app`; for using components in an app already on brand-ui use `brand-ui`.