UIDL Runtime
Overview
A UIDL document is JSON that describes layout, state, queries, bindings, events,
and actions. The runtime validates it and renders it through a component registry.
Documents must not name a data source, HTTP client, or database: reads go through
one DataAdapter; writes go through a host mutationHandler and fail closed
when none is permitted.
When to use
- Authoring or editing a UIDL JSON document or page generator.
- Changing schema, bindings, expressions, queries, or actions.
- Wiring
UIDocumentRenderer / DocumentSchema in a React host.
- Validating documents with
uidl-validate or compiling with uidl-compile.
- Extending Flutter, Android, or the Java document builder against the same spec.
Process
- Confirm it is UIDL. If the screen is hand-built JSX/Compose/Widgets with
no document, stop and use
frontend-ui-engineering.
- Read the spec first.
spec/README.md, then the relevant file under
spec/semantics/ (state, bindings, expressions, queries, mutations,
actions). Do not invent node types or action kinds.
- Keep the seams. Documents and generators import no concrete adapter.
Reads:
$query → DataAdapter. Writes: mutate / command → host handler.
Schema $id values are names, never fetch targets.
- Validate before render.
DocumentSchema.parse / safeParse in code, or
uidl-validate <file.json>. Reject unknown document majors
(UNSUPPORTED_VERSION); accept additive minors.
- Fail closed. A
mutate without a permitted host handler must fail, not
invent a backend. API-backed actions are allowlisted.
- Pick the runtime honestly. React (
packages/core, npm uidl-runtime) is
the full widget suite. Flutter and Android are semantic cores with smaller
default catalogs — do not assume pixel parity with the React reference.
- Verify. Unit/conformance tests for schema and actions; Playwright only for
React surfaces. Load
webapp-testing for browser journeys.
See references/document-model.md for the document shape and
references/commands.md for repo commands.
Red flags
- HTTP, SQL, or a concrete adapter imported from a document or generator.
mutate succeeding with no host handler.
- Hand-building a React page that should be a UIDL document.
- Assuming Flutter or Compose render the full React catalog.
- Fetching
https://uidl.dev/schema/... — those $ids are not URLs to retrieve.
- Treating reference consoles as production-ready products.
Verification
uidl-validate (or DocumentSchema.safeParse) succeeds on the document.
- Nearby non-match: "add a settings button in JSX" does not use this skill.
- Failure case: missing mutation handler → closed failure, no invented API.
- Reads go through
DataAdapter; writes through the host handler.
- Conformance fixtures under
conformance/cases/ still pass for the changed area.
1---2name: uidl-runtime3description: Author, validate, and render UIDL documents — schema-driven JSON UI for lists, forms, reports, dashboards, and settings — with the uidl-runtime package (React reference, Flutter and Android semantic cores, Java document builder). Use when creating or changing a UIDL document, the document schema, DataAdapter seam, $bind/$query/$expr/mutate behaviour, uidl-validate, or uidl-compile. Do not use for hand-built React/Flutter/Compose screens that are not UIDL documents (frontend-ui-engineering) or for ordinary REST work that does not produce UIDL (quarkus-service, rest-api-contract).4---56# UIDL Runtime78## Overview910A UIDL document is JSON that describes layout, state, queries, bindings, events,11and actions. The runtime validates it and renders it through a component registry.12Documents must not name a data source, HTTP client, or database: reads go through13one `DataAdapter`; writes go through a host `mutationHandler` and fail closed14when none is permitted.1516## When to use17- Authoring or editing a UIDL JSON document or page generator.18- Changing schema, bindings, expressions, queries, or actions.19- Wiring `UIDocumentRenderer` / `DocumentSchema` in a React host.20- Validating documents with `uidl-validate` or compiling with `uidl-compile`.21- Extending Flutter, Android, or the Java document builder against the same spec.2223## Process241. **Confirm it is UIDL.** If the screen is hand-built JSX/Compose/Widgets with25 no document, stop and use `frontend-ui-engineering`.262. **Read the spec first.** `spec/README.md`, then the relevant file under27 `spec/semantics/` (`state`, `bindings`, `expressions`, `queries`, `mutations`,28 `actions`). Do not invent node types or action kinds.293. **Keep the seams.** Documents and generators import no concrete adapter.30 Reads: `$query` → `DataAdapter`. Writes: `mutate` / `command` → host handler.31 Schema `$id` values are names, never fetch targets.324. **Validate before render.** `DocumentSchema.parse` / `safeParse` in code, or33 `uidl-validate <file.json>`. Reject unknown document majors34 (`UNSUPPORTED_VERSION`); accept additive minors.355. **Fail closed.** A `mutate` without a permitted host handler must fail, not36 invent a backend. API-backed actions are allowlisted.376. **Pick the runtime honestly.** React (`packages/core`, npm `uidl-runtime`) is38 the full widget suite. Flutter and Android are semantic cores with smaller39 default catalogs — do not assume pixel parity with the React reference.407. **Verify.** Unit/conformance tests for schema and actions; Playwright only for41 React surfaces. Load `webapp-testing` for browser journeys.4243See `references/document-model.md` for the document shape and44`references/commands.md` for repo commands.4546## Red flags47- HTTP, SQL, or a concrete adapter imported from a document or generator.48- `mutate` succeeding with no host handler.49- Hand-building a React page that should be a UIDL document.50- Assuming Flutter or Compose render the full React catalog.51- Fetching `https://uidl.dev/schema/...` — those `$id`s are not URLs to retrieve.52- Treating reference consoles as production-ready products.5354## Verification55- `uidl-validate` (or `DocumentSchema.safeParse`) succeeds on the document.56- Nearby non-match: "add a settings button in JSX" does not use this skill.57- Failure case: missing mutation handler → closed failure, no invented API.58- Reads go through `DataAdapter`; writes through the host handler.59- Conformance fixtures under `conformance/cases/` still pass for the changed area.