studio-ui
Build or change Cloudhal admin UI (Studio, capability panels, docs UI) using Kumo via @cloudhal/ui. Use for any React component, page or block in apps/studio or packages/ui. Not for visitor-facing sites (those use the theme system, not Kumo).
- License 许可
- Apache-2.0
- 最近更新
- 2026-11-15
- Stars
- ★ 1
- Forks
- 0
01 前言 Front Matter
- name
- studio-ui
- license
- Apache-2.0
- metadata
- { "cloudhal.area": "area:studio", "cloudhal.kind": "repo-skill" }
- description
- Build or change Cloudhal admin UI (Studio, capability panels, docs UI) using Kumo via @cloudhal/ui. Use for any React component, page or block in apps/studio or packages/ui. Not for visitor-facing sites (those use the theme system, not Kumo).
03 SKILL.md 正文
Studio UI
Read first: docs/design/DESIGN.md (binding) and the official kumo-design skill in .agents/skills/kumo-design. Every file you write in apps/studio/src or packages/ui/src/blocks is checked by apps/studio/scripts/design-lint.ts — in CI, with pnpm design:lint, and by the Claude Code hook right after each edit. Do not work around a rule; fix the code or add a block to @cloudhal/ui.
Stack (ADR-0003): Vite 8 + React 19 SPA, TanStack Router + Query, Tailwind 4, Kumo (@cloudflare/kumo 2.x on @base-ui/react, Phosphor icons) consumed only through @cloudhal/ui. Cloudhal is a premium, community-facing product: use Kumo's components and blocks, not hand-rolled markup.
Workflow (every UI change)
- Look it up, don't guess:
pnpm kumo ls(every component),pnpm kumo doc <Name>(props, sub-components, examples),pnpm kumo blocks/pnpm kumo add <Block>(copied intopackages/ui/src/blocks/kumo, owned by us),pnpm kumo ai(usage guide). Registry:packages/ui/node_modules/@cloudflare/kumo/ai/component-registry.json. - Pick the template (DESIGN.md §2) and register a new route in
ROUTE_TEMPLATES(apps/studio/scripts/design-lint.ts):list,dashboard,settings,editor,auth,shell. Copy the reference screen:SitesPage(list + aside),PagesPage(list),SiteOverviewPage(dashboard),LoginPage(auth). - Compose from blocks:
- page →
PageLayout(crumbsfromCrumbs/SiteCrumbs,title,description,actionsfor the primary action,tabsonly for sub-views,asidefor usage/help,width="narrow"for forms). Never your own container, header, breadcrumbs or columns. - sections →
SectionCard(title,icon,actions,description,flushfor tables,footerfor Save); settings →SettingsLayout+SettingsSection; never nest cards. - lists →
ListToolbar+LayerCard p-0+Table(+TableSkeletoninside<Table>) +Pagination; empty → a bareEmptyin the table's place (it has its own frame); empty inside a card/cell/dialog →SectionEmpty. - two-column bodies →
Columns(container-aware), never KumoGrid variant="2-1|1-2". - summaries / quoted agent text inside a card or dialog →
InsetPanel(outline,recessed). - forms →
Input/InputArea/Select/TagInput/InputGroupwith their ownlabel/description/error; passwords →PasswordField;className="w-full"in cards. - messages →
Banner; confirmations →ApprovalDialog,DeleteResource,ConfirmDialog; forms in overlays →LayerDialog; menus →DropdownMenu; actions →Button(icon,loading,variant),ButtonGroup,Toolbar.
- page →
- Nothing fits? Build it in
packages/ui/src/blocks(export it fromsrc/index.ts, follow the same rules, add it to DESIGN.md §6), then use it. Screens never grow private visual primitives. - Verify:
pnpm design:lint,pnpm --filter @cloudhal/studio test, thenSTUDIO_EMAIL=… STUDIO_PASSWORD=… pnpm design:shots -- <routes>(local test account; 1440 and 390 px, fails on sideways scroll or console errors) and look at every PNG: edges aligned with the page header, one control height per row, no nested cards.
Kumo design rules (kumo-design skill — the lint enforces the mechanical ones)
- 14px content text; 16px+ only headings (titles come from
PageLayout/SectionCard). Sentence case, neveruppercase. Neverfont-bold(<Text bold>), nevertracking-*. - Related text closer together than unrelated (
gap-1.5inside a title/description pair,gap-6between groups); optically balance padding (px-5 py-4, neverp-5). - No hover colour transitions. No borders with drop shadows:
ring ring-kumo-line; concentric radii when nested. - Never stack
LayerCard/SectionCard. Never conditionally render dialogs — controlopen. - Semantic tokens only (
bg-kumo-base,text-kumo-subtle,text-kumo-danger…); no raw Tailwind colours; nodark:; no arbitrary[..px]values in screens; merge classes withcn(). - Icons from
@phosphor-icons/reactonly (16 px inline/nav, 24 px list-page title, 48 pxEmpty), aligned with the first line of text; icon-only buttons needaria-labelandshape="square".
Cloudhal rules
- Import only from
@cloudhal/ui(Biome blocks@cloudflare/kumoand@base-ui/reactin apps). Kumo blocks live inpackages/ui/src/blocks/kumo(lint/format disabled there). - Routing: Kumo
hrefs go throughLinkProvider→ TanStack Router (AppLink); usehrefonSidebar.MenuButton,Breadcrumbs.Link,Link,LinkButton. - Navigation lives in the sidebar; page tabs never repeat it. Surface-wide actions (Publish) live in the top bar (
AppFrame actions). - Lifecycle changes are explicit actions (
StatusActions), never a statusSelect; publishing always passesApprovalDialog. - Counts are ICU
pluralmessages ({count, plural, one {# file} other {# files}}) called ast(key, { count }), never a…Onekey or a ternary on the count; choices of a fixed set areselect(DESIGN.md §1 "Message syntax", RFC-0032). - Every string through
useT()with keys inen.tsand every registered language's<locale>.ts(i18n/locales.ts; page titles/descriptions underpageHeaders.*) — or, for a feature's own wording, in a lazy namespace (DESIGN.md §1):i18n/lazy/<ns>.<locale>.ts(found by name; its type ini18n/namespaces.ts), read withuseT("<ns>"), loaded with its routes throughwithMessages(import(…), ["<ns>"])inrouter.tsx.analytics.*,analyticsSettings.*,readers.*,comments.*andcommentsSettings.*live there; add their keys to thelazy/files, never to the core catalogs. New features with screens of their own start as a lazy namespace. Kumo's own strings follow the Studio language too (DESIGN.md §2v "Kumo locale"):KumoLocaleProvidercovers dialogs only; aDatePickeralways gets{...calendarLocaleProps(locale, labels)}(never the deprecated, English-onlyDateRangePicker); blocks take every word, including what Kumo would hard-code (chart loader, map legend), as labels.TimeseriesChart'stooltipTimestampFormatexists only throughpatches/@cloudflare__kumo@2.14.0.patch— re-check it on every Kumo upgrade. - Styles:
@import "@cloudhal/ui/styles.css"once; rootclass="isolate"; app wrapped inLinkProvider→TooltipProvider→Toasty. - Tests: Vitest + Testing Library on happy-dom with the ResizeObserver/matchMedia setup; test behaviour (actions, labels), not Kumo internals.
References
- https://kumo-ui.com/installation · https://github.com/cloudflare/kumo (AGENTS.md, skills/kumo-design)
docs/adr/0003-studio-architecture.md
04 同仓库更多 Skills
stale-review
Review a few published articles that have not been updated for a long time, make small safe fixes in drafts, and leave them as one proposed release for a person to schedule - never publishing anything. Built for a weekly scheduled agent task (begin_run, then end_run) that does not read visitor text. Use for a periodic content review or when asked which old articles need attention.
site-design
Design or redesign Cloudhal pages that look modern and follow the site's own design rules (DESIGN.md). Use when asked to build, design, restyle or improve a page, a landing page or a home page, or to write the site's design rules.
site-bootstrap
Set up a new Cloudhal site's first pages and navigation from a short brief. Use when a site is empty or the user asks to "set up", "scaffold" or "bootstrap" a site.
safe-edit
Make a reviewable change to an existing page or article - snapshot first, edit, preview, report the diff. Use for any edit request on existing content, including re-filing an article under other categories or tags.
rollback
Restore a site to an earlier snapshot after confirming the target with the user. Use when something published is wrong and the user asks to revert, undo or roll back.
publish-article
Check a draft article, file it under the site's categories and tags, produce a preview and submit it for publication now or at a set time, optionally under an embargo or with an expiry. Use when the user asks to publish, release, schedule or go live with an article.