UX case study · AI design agent
Prompt to Blade UI
Type your prompt → Claude creates a JSON description of a screen → real Blade components rendered on screen. Built solo for Razorpay's Blade Build Challenge in about 1.5 hours, from my phone with Claude Code.
Autonomy bounded by the system, not by the prompt.
01The brief
On 24 Jun 2026 Razorpay ran an AI × Design Meetup for product designers at its Bengaluru office, with talks from its design team, including Saurabh Soni (VP Design) on “The Next Design Frontier”. Then came a build challenge on Blade, Razorpay's design system: two briefs, one evening.





One page, a known layout, a known answer.
Any prompt, any screen, and it has to stay on-brand.
Brief 1 was a reskin with a known answer. Brief 2 was open-ended, and it had to stay on-brand no matter what someone typed. That's the product problem I care about, so I took it.
02The problem
By default, an LLM is a free-form text generator. Ask it to "design a payment screen" and it might hand back code with hard-coded colours like #00ff00, random pixel sizes, a layout that ignores your design system, or a component that doesn't exist. Often useful — but unpredictable. You can't guarantee it'll be on-brand.
It's also non-deterministic and stateless: every run starts from zero, with no memory of the one before, so nothing keeps one screen consistent with the next. Just prompt it, and you get a different screen every run.
<Card sx={{ borderRadius: 4, boxShadow: 3 }}> <CardHeader title="Payment successful" sx={{ bgcolor: "#6200EE" }} /> <Typography fontSize={40}> ₹2,499.00</Typography> <Button sx={{ color: "#6200EE" }}> Download receipt</Button></Card>
<div className="bg-gradient-to-br from-[#ff6b6b] to-[#ffb86b] rounded-[28px] p-[30px]"> <h2 className="text-[28px]"> You're all set</h2> <p className="text-[46px]">₹2,499</p> <PillButton>View receipt</PillButton></div>
const Card = styled.div` background: rgba(17,24,39,.92); border-radius: 24px; padding: 28px;`<Card> <GlowCard title="Payment confirmed" /> <Amount size={42}>₹ 2,499.00</Amount> <Button color="#14b8a6">Done</Button></Card>
<div style={{ fontFamily: "Georgia" }}> <h1 style={{ fontSize: 40 }}> Transaction complete</h1> <p style={{ color: "#0057ff", fontSize: 50 }}>Rs. 2,499</p> <a style={{ color: "#0057ff" }}> Back to home</a></div>
<StatusBox style={{ background: "#ffde59", border: "3px solid #000", boxShadow: "8px 8px 0 #000" }}> <h2 style={{ fontFamily: "Impact" }}> Payment received!!</h2> <button style={{ letterSpacing: 4 }}> CONTINUE</button></StatusBox>
<ReceiptPanel className="bg-[#f5f3ff] rounded-[16px] p-[22px] font-[Poppins]"> <Row label="Amount" value="₹2,499" /> <Row label="Status" color="#7c3aed" /> <button className="bg-[#7c3aed]"> Get receipt</button></ReceiptPanel>
To check it wasn't one bad roll, I sent this exact prompt to six Claude models, twice each.
| Model | What came back |
|---|---|
| Haiku 4.5 | Laravel PHP templates: the other Blade |
| Sonnet 4.6 | 28 to 41 invented “Blade” colours |
| Opus | A different layout every run |
| All 12 runs | 5 didn't compile |
03The technique
Don't let it write freely — make it fill a form. The Anthropic API has a feature called structured outputs: you hand the model a schema (a rulebook), and the reply is forced to match it. Claude chooses what goes in the blanks, but it can't add a blank that isn't on the form — the API rejects anything off-shape.
UI_SCHEMA is that strict form — the rulebook the reply is forced to match. Everything Claude is allowed to return is defined in it, and anything off-shape is rejected.
For designers: it's a component library with “detach instance” switched off.
04What's inside UI_SCHEMA
UI_SCHEMA is a component library written as rules — a fixed set of elements, each with a fixed set of props, and additionalProperties: false at every level.
export const UI_SCHEMA = {
type: 'object',
additionalProperties: false, // anything off-shape is rejected outright
required: ['title', 'sections'],
properties: {
title: { type: 'string' },
subtitle: { type: 'string' },
sections: { type: 'array', items: {
additionalProperties: false,
required: ['elements'],
properties: {
variant: { enum: ['card', 'plain'] },
layout: { enum: ['stack', 'grid'] },
heading: { type: 'string' },
elements: { type: 'array', items: { anyOf: [
// every element Claude may place — and nothing else is valid
{ kind: 'heading', text, size? small | medium | large },
{ kind: 'text', text, tone? normal | subtle | muted },
{ kind: 'amount', value, label?, currency? },
{ kind: 'statTile', label, value, currency?, delta?, up? },
{ kind: 'badge', text, color? positive | negative | notice |
information | neutral | primary },
{ kind: 'button', text, variant? primary | secondary | tertiary, icon? },
{ kind: 'input', label, placeholder?, inputType? text | email | password | textarea },
{ kind: 'switchRow', title, description?, on? },
{ kind: 'person', name, subtitle? },
{ kind: 'feature', text },
{ kind: 'divider' },
]}},
},
}},
},
} as const;
// note: even 'color' is a semantic token — positive, notice — never a hex.
05Blade Schema Playground
Explaining a guardrail is weaker than letting someone hit one — so I built a playground. You assemble a screen the way Claude has to, by filling the fixed form; the exact JSON spec builds alongside; then you try to add a raw colour and feel additionalProperties: false push back. Try it right here.
06The renderer — Claude's JSON becomes real Blade
Claude's reply goes through three steps before anything reaches the screen.
{
"title": "Payment successful",
"elements": [
{ "kind": "badge", "text": "Paid" },
{ "kind": "amount", "value": 2499 },
{ "kind": "button",
"text": "Download receipt" }
]
}the filled-in form
each kind becomes a real Blade component, already carrying Razorpay's tokens
Claude picks the parts and the order. Blade owns every colour, size and font.
The validated spec never touches the DOM directly. A deterministic renderer walks it and swaps each kind for a real @razorpay/blade component — every colour, space and radius resolved through Blade tokens. An unknown kind is skipped, so schema drift can't crash the screen.
// a validated UIScreen → real @razorpay/blade components
const Element = ({ el }: { el: UIElement }) => {
switch (el.kind) {
case 'heading': return <Heading size={el.size ?? 'small'} color="surface.text.gray.normal">{el.text}</Heading>;
case 'text': return <Text color={TEXT_COLOR[el.tone ?? 'subtle']}>{el.text}</Text>;
case 'amount': return <Amount value={el.value} currency={el.currency ?? 'INR'} type="heading" size="large" />;
case 'badge': return <Badge color={el.color ?? 'neutral'} emphasis="intense">{el.text}</Badge>;
case 'button': return <Button variant={el.variant ?? 'primary'} icon={ICONS[el.icon]} isFullWidth>{el.text}</Button>;
case 'input': return el.inputType === 'password' ? <PasswordInput label={el.label} /> : <TextInput label={el.label} type={el.inputType} />;
case 'switchRow': return <Box …><Text weight="semibold">{el.title}</Text><Switch defaultChecked={el.on} /></Box>;
case 'divider': return <Divider />;
default: return null; // unknown kind → skipped, the screen never crashes
}
};


If Claude can't be reached, the studio falls back to pre-built Blade recipes matched by keyword, so it degrades instead of breaking.
07Streaming — it worked, it just felt slow
Once it worked, the next problem was perceived speed. Claude takes about five seconds to finish a screen, and the first version showed a spinner for all of it. So I streamed it: the screen paints as the reply lands, instead of waiting for the whole answer.
Measured on the live app: 5 runs, median. The total time is the same; the wait isn't.
08Reach
People didn't just read it, they tried it. One LinkedIn post reached 19,749 members, and 610 people opened the live app. 41 saves is the number I like: people kept it to come back to.

AI makes the decisions. The design system guarantees the quality.
09What's next
- Multi-screen flows, not one screen at a time.
- An eval harness that scores the on-brand rate across prompts.
- Tokens read straight from the Blade source, so the schema never drifts.

How I got AI to turn a prompt into Blade UI
A step-by-step walkthrough, written for designers as much as engineers.
linkedin.com/pulse ↗Fork it, read it, build on it
The whole studio, MIT-licensed, with an architecture walkthrough.
github.com/arun-dev-des ↗
Learn the schema by playing
Build a screen the way Claude has to, and feel the guardrail push back.
schema-playground ↗
