SDUI Flow Assistant
Use this skill to make complete, safe SDUI flow updates in the sduit codebase.
Load Context
Read these files first:
- •
apps/web/src/types/journey.ts - •
apps/web/src/lib/voiceAgent/elementRegistry.ts - •
apps/web/src/lib/voiceAgent/screenTemplates.ts - •
apps/web/src/services/screenImport.ts - •
apps/web/src/services/screenExport.ts - •
apps/web/src/lib/voiceAgent/journeyRuntime.ts - •
server/routes/mobile.ts - •
server/utils/moduleNormalize.ts - •
apps/web/src/components/voiceAgent/JourneyBuilder.tsx - •
apps/web/src/components/voiceAgent/PromptEditor.tsx - •
server/routes/journeys.ts - •
server/storage.ts
For iOS compatibility rules and the complete SDUI data contract, load:
- •
SDUI_PROTOCOL.md(REQUIRED — defines the iOS data contract)
For architecture details and rollout strategy, load:
- •
references/sduit-flow-architecture.md - •
references/ai-editing-integration.md
Workflow
- •Clarify the requested flow outcome.
- •Identify scope:
systemPrompt, agentprompt,screenPrompts, screen structure, and event wiring. - •Preserve IDs when editing existing flows unless the user requests a new object.
- •Update prompts and screens together so behavior and UI stay synchronized.
- •Validate before apply:
- •
node skills/sduit-sdui-flow-assistant/scripts/validate_flow_bundle.mjs <path/to/journey.json>
- •
- •Create a rollback point before destructive edits:
- •
node skills/sduit-sdui-flow-assistant/scripts/flow_snapshot.mjs snapshot <path/to/journey.json> [label]
- •
- •Apply changes only after preview/review; if regression appears, restore:
- •
node skills/sduit-sdui-flow-assistant/scripts/flow_snapshot.mjs restore <path/to/journey.json> <snapshot-path>
- •
Guardrails
- •Follow
SDUI_PROTOCOL.md— it defines the complete iOS data contract. - •Element data goes under
"state"(not"data"). Everystatemust include"id". - •State references MUST use braces:
"{$moduleData.key}". - •Event
conditionsmust always be present (use[]for no conditions). - •Arrays in module state must be native arrays, never comma-joined strings.
- •Only use element types listed in
SDUI_PROTOCOL.md. Made-up types crash iOS. - •Keep
screenPromptskeys aligned withagent.screens[].id. - •Keep
trigger_eventreferences aligned with real event IDs defined on screens/elements. - •Keep navigation actions pointing to valid targets (
next-screen,prev-screen, or real screen IDs/URLs). - •Keep
startingAgentIdvalid and handoff targets resolvable. - •Use
apps/web/src/lib/voiceAgent/screenUtils.tsbehavior as the source of truth for placeholder deeplinks. - •Prefer additive, reversible edits over destructive rewrites.
Implementation Guidance For In-Product AI Editing
When asked to add AI editing in the app, follow this baseline:
- •Generate proposal first (no immediate save).
- •Show structured preview (prompt diff + screen diff + rendered screen preview).
- •Run validation gate before apply.
- •Save with explicit
changeNotes. - •Offer one-click rollback via existing journey version endpoints.
Use references/ai-editing-integration.md for the concrete phased design.