Instructing an AI to Build ChainRender Apps
How to phrase instructions so an AI produces correct, Grade-A ChainRender apps. These patterns work with any capable AI assistant (in a chat, an editor, or via the ChainRender MCP server).
The golden rule: give it the vocabulary first
Always start by providing the machine-readable vocabulary as context:
Here is the ChainRender vocabulary you must compose within:
<paste JSON.stringify(vocabulary()) here>
Compose only using these node types, capabilities, and resolver kinds. Use the compose.* builders from
@chainrender/client. Do not invent constructs outside this vocabulary.
This one instruction prevents the most common AI failure — inventing an API that doesn't exist. ChainRender's closed vocabulary makes the AI's output constrained by construction.
Instruction patterns that work
Be explicit about the trust grade you want:
"Build a token-claim page. It must be Grade A — fully on-chain, no off-chain images or fetches. Use on-chain resolvers for any data."
Name the resolver for live data:
"Show the ETH/USDC price using the Chainlink feed resolver, rendered as a live value."
Ask it to self-verify:
"After composing, call
grade()and show me the letter and breakdown. If it's not Grade A, tell me exactly which dependency lowered it and fix it."
Specify the app type:
"Make this a multi-view app with tabs: an Overview tab and a Details tab. Use
buildTabs."
Request the presentation as tokens, not hardcoded:
"Style it with the design tokens (spacing, colors) so it re-themes cleanly — don't hardcode pixel values."
Instruction patterns to AVOID
- Don't ask for arbitrary code or scripts — ChainRender has no arbitrary-code path; the AI can't produce one, and asking wastes turns. Ask for declared actions and resolvers instead.
- Don't ask it to "just fetch" off-chain data casually — that drops the grade. If you want Grade A, say so, and the AI will use on-chain resolvers.
- Don't skip the grade check — always have the AI grade + show the breakdown, so trust is verified, not assumed.
A complete example prompt
You are building a ChainRender app. Vocabulary:
<paste vocabulary()>
Task: An on-chain "member badge" that shows a verified-membership checkmark using the selective-disclosure
credential resolver, plus the member's ENS name via the EnsProfile resolver. Requirements:
- Grade A (fully on-chain).
- Compose with compose.* builders.
- After composing, call grade() and compileComponent(); show me the grade letter, the breakdown, and the hash.
- If the grade isn't A, name the offending dependency and fix it before finishing.
This gives the AI the schema, the task, the trust bar, and the self-verification step — everything it needs to produce a checkable, Grade-A result.
Why this is safe
Because ChainRender makes AI output verifiable:
- Closed vocabulary → the AI can't express an invalid app.
grade()→ the AI's trust claim is computed, not asserted; you see the real letter + reasons.- Deterministic
compileComponent()→ you reproduce the exact hash independently. - The enforcer → an unsafe app is refused at registration, even if the AI tried to produce one.
You're never trusting the AI's word that an app is safe or trustless — you're checking the grade and the hash. That's the whole point: AI proposes, the SDK and chain verify.
Related
- Building ChainRender Apps with AI — the step-by-step workflow.
- The Vocabulary · The Trust Grade