Generate Lynx OpenUI Programs
Generate valid OpenUI Lang v0.5 consumed by
<OpenUiRenderer response={...}>. Produce declarative DSL, not application
code.
Read The References
- Always read components.md before generating a
program. Treat caller-supplied component signatures as authoritative
extensions or replacements.
- Read runtime.md when the request involves state,
tools, live data, mutations, actions, repeated query data, or edits.
- Read examples.md for a non-trivial layout or tool
workflow. Adapt patterns; do not copy irrelevant content.
Workflow
- Identify the requested UI, supplied component catalog, available tool
schemas, media URLs, and whether the host supports full programs or
mergeStatements patches.
- Choose the data mode:
- Use static values for self-contained content and when no tool exists.
- Use
Query only for an actual read tool supplied by the caller or host.
- Use
Mutation only for an actual write tool and trigger it from an
explicit Action.
- Select only components and positional arguments allowed by the active
catalog.
- Write a streaming-friendly graph. For a complete program, put the root
first, followed by state, queries or mutations, structural components, and
leaf content. For an edit-mode patch, return only changed statements.
- Validate syntax, references, reachability, component names, argument order,
tool names, and action targets before returning the program.
Output Contract
- Return only OpenUI Lang. Do not return Markdown, code fences, prose, JSON,
XML, HTML, JavaScript, TypeScript, JSX, or CSS.
- Put one assignment statement on each line.
- For a complete program, make the first non-empty line
root = Stack(...).
- Return a complete program by default. When the caller explicitly says the
host uses edit mode or
mergeStatements, return only changed statements and
include root only when the root graph changes.
- If a request needs an unavailable component or capability, render a concise
explanation with supported OpenUI components instead of inventing syntax.
Syntax Rules
- Use
identifier = Expression for ordinary declarations and
$identifier = defaultValue for mutable state.
- Pass component arguments positionally. Never use named arguments such as
gap: "m".
- Omit optional arguments only from the end. When setting a later argument,
provide valid values for every earlier position.
- Use double-quoted strings and escape embedded quotes and backslashes.
- Use references or inline components. Prefer references for the root and
major sections so streaming reveals the structure progressively.
- Ensure every referenced identifier is defined. Ensure every declaration
other than
root is reachable from root, an expression reachable from
root, or an action reachable from root.
- Use only documented operators, built-ins, components, and action steps.
Correct positional layout:
root = Stack([header, content], "column", false, "l", "stretch", "start")
Incorrect positional layout:
root = Stack([header, content], "column", "l", "stretch")
The incorrect form passes a string into wrap and shifts every later prop.
Data And Interaction Rules
- Do not invent tool names. If no tool schema is supplied, use static data or
an explanatory supported UI.
- Give every
Query a representative default result matching the real tool
shape so the UI renders before the request resolves.
- Keep
Query and Mutation declarations on ordinary identifiers, never
$identifiers.
- Use
@Each for query-backed repeated UI. Keep its loop-dependent component
inline inside @Each.
- Put write operations on a submit or confirmation
Button. Do not attach a
mutation to an input's change action.
- When an input must update a
$variable, use the same-key name pattern in
runtime.md. Do not invent an event-value variable.
- Execute multi-step actions in deliberate order. Remember that a failed
mutation stops the remaining steps.
- Use
@ToAssistant for conversational continuation and @OpenUrl only with
a caller-provided or trustworthy URL.
- Use caller-provided media URLs. Do not fabricate CDN URLs or assume the host
resolves image-search strings.
Lynx UI Rules
- Prefer compact, mobile-first layouts with a shallow component tree.
- Use
Stack or Column for ordinary vertical structure, Row for small
horizontal groups, and List for grouped or repeated content.
- Prefer explicit
Image variants so the Lynx renderer has concrete sizing.
- Keep readable text in
Text or TextContent; do not emit raw Lynx elements.
- Use
Tabs for alternate views and Modal for tap-to-open details. Pass a
modal trigger first and content second; do not also render the trigger as a
sibling.
Final Verification
Before returning, verify all of the following:
- A complete program starts with
root = Stack(...). An edit-mode patch omits
root unless the root graph changes. The response contains only OpenUI Lang.
- Every component exists in the active catalog and every argument matches its
positional schema.
- No
Form, Input, Select, SelectItem, FormControl, table, or chart is
used unless the caller supplied that custom component.
- Every reference resolves and no declaration is orphaned.
- Every
Query or Mutation uses a real supplied tool and is referenced by
visible UI or a visible action.
- Every
$variable participates in visible UI, a query argument, or an action.
- Every
@Each loop variable stays inside its inline template expression.
- No working dynamic list relies on
TemplateChildren in the built-in Lynx
renderer.
- If a parser is available, parsing finishes with a root, no validation errors,
no unresolved references, and no orphaned statements.
1---
2name: lynx-openui
3description: Generate valid OpenUI Lang v0.5 functional-notation programs for the Lynx OpenUI renderer. Use when Codex must turn a natural-language UI request into raw OpenUI DSL for OpenUiRenderer, including static mobile UI, $state, Query/Mutation tool flows, Action plans, streaming-friendly output, or catalog-constrained revisions. Do not use for JSX, HTML, CSS, A2UI JSON, or implementing new ReactLynx components.
4metadata:
5 source: https://skillmd.com/skills/lynx-community/lynx-openui
6---
7
8# Generate Lynx OpenUI Programs
9
10Generate valid OpenUI Lang v0.5 consumed by
11`<OpenUiRenderer response={...}>`. Produce declarative DSL, not application
12code.
13
14## Read The References
15
16- Always read [components.md](references/components.md) before generating a
17 program. Treat caller-supplied component signatures as authoritative
18 extensions or replacements.
19- Read [runtime.md](references/runtime.md) when the request involves state,
20 tools, live data, mutations, actions, repeated query data, or edits.
21- Read [examples.md](references/examples.md) for a non-trivial layout or tool
22 workflow. Adapt patterns; do not copy irrelevant content.
23
24## Workflow
25
261. Identify the requested UI, supplied component catalog, available tool
27 schemas, media URLs, and whether the host supports full programs or
28 `mergeStatements` patches.
292. Choose the data mode:
30 - Use static values for self-contained content and when no tool exists.
31 - Use `Query` only for an actual read tool supplied by the caller or host.
32 - Use `Mutation` only for an actual write tool and trigger it from an
33 explicit `Action`.
343. Select only components and positional arguments allowed by the active
35 catalog.
364. Write a streaming-friendly graph. For a complete program, put the root
37 first, followed by state, queries or mutations, structural components, and
38 leaf content. For an edit-mode patch, return only changed statements.
395. Validate syntax, references, reachability, component names, argument order,
40 tool names, and action targets before returning the program.
41
42## Output Contract
43
44- Return only OpenUI Lang. Do not return Markdown, code fences, prose, JSON,
45 XML, HTML, JavaScript, TypeScript, JSX, or CSS.
46- Put one assignment statement on each line.
47- For a complete program, make the first non-empty line `root = Stack(...)`.
48- Return a complete program by default. When the caller explicitly says the
49 host uses edit mode or `mergeStatements`, return only changed statements and
50 include `root` only when the root graph changes.
51- If a request needs an unavailable component or capability, render a concise
52 explanation with supported OpenUI components instead of inventing syntax.
53
54## Syntax Rules
55
56- Use `identifier = Expression` for ordinary declarations and
57 `$identifier = defaultValue` for mutable state.
58- Pass component arguments positionally. Never use named arguments such as
59 `gap: "m"`.
60- Omit optional arguments only from the end. When setting a later argument,
61 provide valid values for every earlier position.
62- Use double-quoted strings and escape embedded quotes and backslashes.
63- Use references or inline components. Prefer references for the root and
64 major sections so streaming reveals the structure progressively.
65- Ensure every referenced identifier is defined. Ensure every declaration
66 other than `root` is reachable from `root`, an expression reachable from
67 `root`, or an action reachable from `root`.
68- Use only documented operators, built-ins, components, and action steps.
69
70Correct positional layout:
71
72```text
73root = Stack([header, content], "column", false, "l", "stretch", "start")
74```
75
76Incorrect positional layout:
77
78```text
79root = Stack([header, content], "column", "l", "stretch")
80```
81
82The incorrect form passes a string into `wrap` and shifts every later prop.
83
84## Data And Interaction Rules
85
86- Do not invent tool names. If no tool schema is supplied, use static data or
87 an explanatory supported UI.
88- Give every `Query` a representative default result matching the real tool
89 shape so the UI renders before the request resolves.
90- Keep `Query` and `Mutation` declarations on ordinary identifiers, never
91 `$identifiers`.
92- Use `@Each` for query-backed repeated UI. Keep its loop-dependent component
93 inline inside `@Each`.
94- Put write operations on a submit or confirmation `Button`. Do not attach a
95 mutation to an input's change action.
96- When an input must update a `$variable`, use the same-key `name` pattern in
97 [runtime.md](references/runtime.md). Do not invent an event-value variable.
98- Execute multi-step actions in deliberate order. Remember that a failed
99 mutation stops the remaining steps.
100- Use `@ToAssistant` for conversational continuation and `@OpenUrl` only with
101 a caller-provided or trustworthy URL.
102- Use caller-provided media URLs. Do not fabricate CDN URLs or assume the host
103 resolves image-search strings.
104
105## Lynx UI Rules
106
107- Prefer compact, mobile-first layouts with a shallow component tree.
108- Use `Stack` or `Column` for ordinary vertical structure, `Row` for small
109 horizontal groups, and `List` for grouped or repeated content.
110- Prefer explicit `Image` variants so the Lynx renderer has concrete sizing.
111- Keep readable text in `Text` or `TextContent`; do not emit raw Lynx elements.
112- Use `Tabs` for alternate views and `Modal` for tap-to-open details. Pass a
113 modal trigger first and content second; do not also render the trigger as a
114 sibling.
115
116## Final Verification
117
118Before returning, verify all of the following:
119
120- A complete program starts with `root = Stack(...)`. An edit-mode patch omits
121 `root` unless the root graph changes. The response contains only OpenUI Lang.
122- Every component exists in the active catalog and every argument matches its
123 positional schema.
124- No `Form`, `Input`, `Select`, `SelectItem`, `FormControl`, table, or chart is
125 used unless the caller supplied that custom component.
126- Every reference resolves and no declaration is orphaned.
127- Every `Query` or `Mutation` uses a real supplied tool and is referenced by
128 visible UI or a visible action.
129- Every `$variable` participates in visible UI, a query argument, or an action.
130- Every `@Each` loop variable stays inside its inline template expression.
131- No working dynamic list relies on `TemplateChildren` in the built-in Lynx
132 renderer.
133- If a parser is available, parsing finishes with a root, no validation errors,
134 no unresolved references, and no orphaned statements.