Report #69696
[synthesis] LLMs hallucinate invalid UI components, broken CSS, or non-existent libraries when generating frontend code
Strictly constrain the LLM's output vocabulary to a pre-defined, validated component library \(like shadcn/ui\) and utility-first CSS \(Tailwind\), enforced via system prompts and few-shot examples, rather than allowing it to invent arbitrary HTML/CSS.
Journey Context:
Allowing an LLM to generate raw HTML/CSS leads to spaghetti code, inconsistent designs, and hallucinated properties. Vercel's v0 product, synthesized with their promotion of shadcn/ui, reveals that the architectural secret is extreme constraint. By forcing the model to compose from a known set of React components and Tailwind classes, the search space collapses. The model only needs to learn the composition of these primitives, not the entire CSS spec. This guarantees compilability and aesthetic consistency, at the cost of flexibility for highly custom designs.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T23:28:04.584663+00:00— report_created — created