Once UI Handbook
Beginner Guides
What is Once UI?
Install & config
Page skeleton
Your first page
Build And Launch
How to launch a portfolio site that actually gets you hired
How to build a documentation site with MDX and Next.js
How to ship a landing page and dashboard with authentication in Next.js
How to launch a social app with Next.js and Supabase
Vibe Coding
Introduction to vibe coding
Set up your local dev environment
Essential tools for vibe coding
Build your first Once UI app
Common Patterns
Hero section
Static panel
Form layout
Highlighted card
Responsive stacking
Decoration layers
Dialog & modal
Toast & feedback
Tables & lists
Loading states
App shell navigation
Dashboard & charts
Chat & messaging
Auth & verification
Settings & split panels
Data filters & toolbar
Command palette
Pricing & plans
Accordion & FAQ
Media & uploads
Empty & error states
SEO, Open Graph, and structured data
Documentation code blocks with live preview
Carousels, galleries, and before/after comparisons
Date pickers and scheduling
Context menus and dropdown actions
Tags, chips, and multi-value inputs
Roadmap & kanban
Form inputs & controls
Progress, status & badges
Scrolling & feeds
Profile, avatars & identity
Social proof & logo clouds
Masonry & media grids
Table pagination, search & bulk selection
Banners & announcements
Footer layouts
Onboarding & first run
Waitlist & coming soon
Design Tips
Color & surfaces
Harness overview
Row, Column & Grid
Spacing & rhythm
Icons & buttons
Reveal & motion
Theme tokens, FOUC-free init, and runtime style controls
Tooltips and hover cards
Block updates
Block updates changelog
Agent Resources
Column, not Flex
Semantics over CSS
Typography scale
Common gotchas
Block anchors
Validate generated code
Pro block registry
Match task bundles
TrademarkTrademark
Ctrl k
Search...
Sign up
Once UI Handbook
Beginner Guides
What is Once UI?
Install & config
Page skeleton
Your first page
Build And Launch
How to launch a portfolio site that actually gets you hired
How to build a documentation site with MDX and Next.js
How to ship a landing page and dashboard with authentication in Next.js
How to launch a social app with Next.js and Supabase
Vibe Coding
Introduction to vibe coding
Set up your local dev environment
Essential tools for vibe coding
Build your first Once UI app
Common Patterns
Hero section
Static panel
Form layout
Highlighted card
Responsive stacking
Decoration layers
Dialog & modal
Toast & feedback
Tables & lists
Loading states
App shell navigation
Dashboard & charts
Chat & messaging
Auth & verification
Settings & split panels
Data filters & toolbar
Command palette
Pricing & plans
Accordion & FAQ
Media & uploads
Empty & error states
SEO, Open Graph, and structured data
Documentation code blocks with live preview
Carousels, galleries, and before/after comparisons
Date pickers and scheduling
Context menus and dropdown actions
Tags, chips, and multi-value inputs
Roadmap & kanban
Form inputs & controls
Progress, status & badges
Scrolling & feeds
Profile, avatars & identity
Social proof & logo clouds
Masonry & media grids
Table pagination, search & bulk selection
Banners & announcements
Footer layouts
Onboarding & first run
Waitlist & coming soon
Design Tips
Color & surfaces
Harness overview
Row, Column & Grid
Spacing & rhythm
Icons & buttons
Reveal & motion
Theme tokens, FOUC-free init, and runtime style controls
Tooltips and hover cards
Block updates
Block updates changelog
Agent Resources
Column, not Flex
Semantics over CSS
Typography scale
Common gotchas
Block anchors
Validate generated code
Pro block registry
Match task bundles
TrademarkTrademark
Once UIDocumentationBlog
© Once UI. All rights reserved.
Built with Aveiro

Validate generated code

Run pnpm validate-ai-code after codegen — what it catches and how to pair with gotchas.json.
Updated 19d ago
Block anchors
Pro block registry
5 min · For agents
Mechanical validation catches mistakes that pass TypeScript — wrong layout primitives, hex colors, invented icons. Run it after every codegen pass.

The command

From the monorepo root (or any app with the harness installed): The script lives in @once-ui-system/core and checks output against rules.compact.md and gotchas.json — the same sources you load before generation.

What it catches

Category
Example mistake
Expected fix
Layout`Flex direction="column"``Column`
Shorthands`fillWidth fillHeight``fill`
Colors`#3b82f6` or `rgb(...)``onBackground="brand-medium"`
Icons`icon="settings"` (invented)Valid `IconName` from spec.json
Defaults`variant="primary"` on ButtonOmit — primary is default
Surfaces`Card` without `href`/`onClick`Column surface recipe
Validation is fast and deterministic. Use it instead of re-reading full doc pages to spot-check output.

Recommended workflow

1. Load rules.compact.md + catalog.json 2. Match intent → task bundle (tasks/index.json) 3. Load component slices + gotchas for that bundle 4. Generate TSX 5. pnpm validate-ai-code <file> 6. Fix reported issues → re-run until clean
See Harness overview for the loading order.

Pair with gotchas.json

Validation catches syntax-level issues. gotchas.json catches semantic traps that still compile:
Gotcha key
Why validation alone misses it
`RevealFx.delay``delay={80}` is valid TS — but means 80 seconds
`Card.interactive``<Card>` without click props compiles fine
`section.gaps``gap="48"` between sections is valid but off-rhythm
`Background.absolute`Missing `top`/`left` still renders — just misaligned
Load gotcha keys listed in your task bundle before generating. Run validation after.

Task bundle quality targets

Each bundle in tasks/*.json includes a quality section with acceptance criteria:
pnpm validate-ai-code path/to/GeneratedPage.tsx
// tasks/dashboard.json excerpt
"quality": {
  "statCard": "Column surface recipe — not Card",
  "kpiNumber": "CountFx or display-strong-s with viewport latch"
}
Check generated output against these targets even when validation passes.

When validation is not enough

The script does not check:
  • Copy quality or accessibility labels
  • Responsive breakpoint coverage
  • Visual decoration budget (see Reveal & motion)
  • Whether the composition matches the referenced Pro block
For structure fidelity, compare against a block anchor:
See Block anchors for the workflow.

Context budget

Step
Cost
`rules.compact.md` + task bundle + gotchas~4KB
`pnpm validate-ai-code`0 context — runs locally
Re-reading a full component doc page10–50KB — avoid

Related

→ Harness overview → Common gotchas → Block anchors → Source: gotchas.json
https://once-ui.com/blocks/{category}#{BlockId}