Cfn ux

From masharratt/claude-flow-novice · View interactive version

Cfn ux is an AI agent skill from the GitHub repository masharratt/claude-flow-novice. MUST BE USED for the interaction-design phase of any frontend build. Owns the full interaction experience: derives every UI control from its data binding (field-to-control derivation), per-field interaction (defaults, autofocus, validation timing), enumerates UI + edge states, maps single-task flows

How to use this skill

Skill file

CFN UX Skill (MegaPlan Phase, DAG Level 5)

Purpose: Turn the data model into interaction design. For every field, derive the correct control from its binding so the implementer cannot guess. For every screen, enumerate all states so nothing ships happy-state-only. For every task, map the flow including the error path. This phase exists to kill one class of bug: a free-text input wired to a field that is actually backed by a database list (should be a dropdown). The affordance map is the deterministic core — it removes the judgment call.

Phase: UX interaction design. MegaPlan DAG level 5 (runs parallel with cfn-arch). Conditional on the frontend build flag. Agent type: ui-designer.

Scope boundary (cohesion split): This phase owns interaction behavior — controls, states, per-field interaction, flows, journeys, feedback/undo, role-based visibility. It does NOT own:

It floors at MVP because broken interaction (wrong control, no error path, dead-end journey) is a correctness defect, not polish.

When to Use

Skip only for: backend-only changes, CLI-only tools, or tasks with no user-facing surface.

Input

Required:

Optional but authoritative when present:

If DATA_<slug>.md is absent (no db flag), infer bindings from SPEC and mark each inferred binding [OPEN] for user confirmation. Never silently assume a field is free-text.

From the orchestrator you also receive:

Directive scope (`light` vs `full`)

light reduces breadth, never the affordance map or the wireframe. The map is the reason this phase floors at MVP; the wireframe is the visual confirmation of it, floored for the same reason — both catch a wrong path, and a wrong path is a correctness defect at any tier.

Protocol

Phase 1: Field → Control Derivation (the deterministic core)

This is the payload that kills the dropdown bug. For EVERY field in the data model, read its binding from DATA_<slug>.md and emit a row. The control is not a choice — it falls out of the binding via this map.

Input contract (DATA section 2, 8 columns, pinned):

| Field | Type | Binding kind | Source table/enum | Required | Options/rows (count or est.) | Range/length | UI access |
| course_id | uuid | FK | public.courses | yes | 12 rows | - | editable |
| status | text | enum | enrollment_status | yes | 4 values | - | readonly |
| notes | text | free-text | - | no | - | <=500 chars | editable |

Consumer matches this table byte-for-byte; unmatched values route back as producer defects.

Derivation map (one row per token of the closed nine-token vocabulary):

| Binding kind (token from DATA) | Control | Validation |

|---|---|---|

| FK | select / combobox (combobox with search if >20 rows) | value ∈ table |

| enum | select, or radio group if <=4 options | value ∈ enum |

| lookup | select | value ∈ table |

| boolean | toggle / checkbox | - |

| date | date picker | range / min-max |

| timestamp | datetime picker | range / min-max |

| free-text | input (short) / textarea (long) | length, pattern |

| numeric | stepper / slider / number input | min / max, step |

| multi-FK | tag / chip multiselect | each value ∈ table |

The Binding kind cell in DATA is matched byte-for-byte against this column. An unmatched token is a cfn-data defect; route back, do not interpret.

Tie-breakers (mechanical, no judgment call):

Rules:

Emit one row per field. No field is exempt. A field with no binding listed is an [OPEN] item, not a free-text default.

Per-field interaction (extend each row). Control type is necessary, not sufficient. For every field also name:

A field with a control but no validation timing is [OPEN] — the implementer would guess when the error fires.

Phase 2: State Enumeration

For every screen / surface, enumerate these states and name what renders in each. No screen ships with only the happy (success) state.

| State | Must name |

|---|---|

| loading | what placeholder / skeleton / spinner shows while data is in flight |

| empty | what renders when the data set is legitimately empty (zero rows) |

| error | what shows on fetch / submit failure, and the retry affordance |

| success | the populated happy state |

| partial | what shows when some data loaded and some failed (lists, dashboards) |

| disabled | which controls are non-interactive and the condition that disables them |

A screen that only specifies the success state fails this phase. Loading, empty, and error are mandatory for any screen that fetches data.

Edge states (beyond the happy six). For any screen behind auth or editing shared data, also name what renders for:

| Edge state | Must name |

|---|---|

| session expired | what happens when the token dies mid-screen (redirect to login preserving intent, or inline re-auth) — never a silent failed save |

| concurrent edit / stale data | what shows when the row changed underneath the user (conflict prompt, reload, last-write-wins warning) |

| timeout / slow network | when the loading state escalates (e.g. "still working" after 10s, cancel affordance) |

| offline | whether the screen degrades, queues, or blocks when the network is gone |

light (mvp) requires the happy six; edge states required at full for any screen that mutates shared/persistent data.

Phase 3: Flows, Journeys, Feedback & Visibility

3a — Single-task flow. For each task in the spec, map entry → action → result → error path. Name affordances explicitly:

Emit each flow as a row of the task-flow table (pinned shape, used in 3a and 3b):

| Task | Entry | Action | Result | Error path | Disabled-when |

Cover the primary flow for every task. Under full, also map secondary flows (edit, delete, cancel) and the recovery flow (what the user does after an error).

3b — Cross-screen journey. A task that spans more than one screen is a journey, not a flow. For each, map:

3c — Confirmation, feedback & undo. For every action that mutates data:

A mutating action with no success feedback fails this phase.

3d — Role-based visibility. Consume cfn-arch Step 6 AuthZ matrix (operation × role, cells from {allow, deny-role, deny-state}). Consumer matches that table byte-for-byte; unmatched values route back as producer defects. For each role, name per restricted affordance: hidden (not in DOM) vs disabled (visible, inert, with reason). Derivation: deny-role (user can never do it) -> hidden (not in DOM). deny-state (could do it after upgrade/state change) -> disabled + reason text. The matrix cell decides; no other criterion. cfn-ux decides what is seen; cfn-arch decides what is allowed — never re-implement the permission check here.

light (mvp): 3a + 3c success feedback only. full: all of 3a-3d.

Phase 4: Analytics / Telemetry Events (extra — gap G26, only when in extras)

When analytics_events is in the orchestrator's extras list, name the user events to track. One row per event: event name, trigger (which affordance / state transition fires it), and the properties captured. Example: course_selected | onChange of course combobox | {course_id, source: 'booking_form'}. Omit this phase entirely when not in extras.

Phase 5: Accessibility Hooks (interaction-level only)

Flag the interaction-level a11y obligations and hand them to cfn-design (which owns the full WCAG audit). You name, you do not audit:

Emit the hooks as the handoff table (pinned shape; see template section 5):

| Control/field | Keyboard keys (non-standard only) | Focus position (n of N in flow) | ARIA attrs required |

Rule: one row per control from the section-1 map; standard controls may say "native"; a section-1 control missing here is a gap, not an implied default.

This is a handoff table, not a compliance pass. cfn-design consumes it verbatim; unmatched values route back as producer defects.

Phase 6: Low-Fidelity Wireframe (floored at every tier; the visual wrong-path catch)

Render this interaction design as a low-fidelity, grayscale, self-contained HTML wireframe and publish it with the Artifact tool, so the user SEES the screen structure and flow before the pipeline spends a single downstream level on it. This is the visual twin of the spec's §1b Interaction Intent walk: §1b confirms intent in words before the schema locks; the wireframe confirms structure in a picture before cfn-design, cfn-test-plan, cfn-ops, and write-plan build on it. You own it because you own the structure — the control map (Phase 1), the screen states (Phase 2), and the flows/journeys (Phase 3) ARE the wireframe. cfn-design's visual layer (tokens, color, exact grid) is deliberately absent; low-fi is the point.

Draw from what you already produced — do not invent new structure here:

Low-fidelity is a hard contract (anti-scope-creep). The wireframe communicates structure and flow, never appearance:

Emitting a colored, image-laden, or token-styled mockup is a Phase-6 defect (see Anti-Patterns): it drags the user into aesthetics when the decision on the table is structure, and it duplicates cfn-design.

Publish + record. Publish the HTML via the Artifact tool (one page, per-screen sections). Record the reference in the ## 6. Wireframe section of the output artifact using this exact machine-detectable line:

wireframe: <artifact-url-or-path>

Degrade, never block. If the Artifact publish fails, write the same HTML to planning/<slug>/wireframe_<slug>.html and record wireframe: planning/<slug>/wireframe_<slug>.html. If there are zero renderable screens, record _skipped: no renderable screens_ instead — that is not a defect. Never stall on wireframe production; the approval gate that CAN stall is the orchestrator's, not this phase's.

Approval is the orchestrator's, at the L5→L6 barrier. You emit the wireframe and return its reference as a BLOCKING item. cfn-megaplan surfaces Approve / Revise before spawning L6, so a wrong structure is caught before design/test-plan/ops run on it. On Revise, you are re-spawned in patch mode with the user's note — you adjust the structure (a control, a screen, a flow) and re-render. A revision that would change an FR, an AC, or the schema is not a wireframe tweak: it routes back to cfn-spec/cfn-data, not here.

Output

Artifact location. Every artifact of one plan lives in that plan's own directory, planning/<slug>/. Under /cfn-megaplan, /cfn-megaplan-lite, or /cfn-spa-plan the orchestrator hands you the exact path plus a Plan dir: line — write there, and read the input paths it gives you verbatim. Invoked standalone, read with $HOME/.claude/skills/cfn-megaplan/lib/plan-paths.sh resolve <slug> <basename> (per-plan dir first, legacy flat planning/ second) and write to planning/<slug>/. Never split one plan across two locations.

Write to: planning/<slug>/UX_<slug>.md

Template:

# UX Interaction Design: <task>

**Date:** <YYYY-MM-DD>
**Spec:** planning/<slug>/SPEC_<slug>.md
**Data:** planning/<slug>/DATA_<slug>.md (or "inferred — no DATA artifact")
**Tier:** <mvp|beta|enterprise>   **Directive:** <full|light>
**Status:** draft | reviewed | locked

## 1. Field → Control Map
Input: DATA section 2 field-bindings table (8 columns). Consumer matches it byte-for-byte; unmatched binding tokens route back as cfn-data defects.
| Field | Binding (from DATA) | Control | Value source | Validation | Default | Autofocus | Validate-when | Help |

## 2. Screen States
### <screen-name>
| State | Renders |
(happy six; + edge states — session-expired / stale / timeout / offline — at full for mutating screens)

## 3a. Flows
| Task | Entry | Action | Result | Error path | Disabled-when |
Affordances: <clickable>, <disabled-when>

## 3b. Journeys  (multi-screen tasks)
### <journey-name>
steps + progress | forward/back | save+resume | entry/exit (route map: ARCH Step 3) | first-run/onboarding
Per-step rows in the 3a table: | Task | Entry | Action | Result | Error path | Disabled-when |

## 3c. Feedback & Undo
| Action | Success feedback | Destructive confirm? | Undo window |

## 3d. Role Visibility  (consumes ARCH Step 6 AuthZ)
| Affordance | Role | Hidden | Disabled (+reason) |

## 4. Analytics Events  (only if in extras)
| Event | Trigger | Properties |

## 5. Accessibility Hooks (handoff table - cfn-design consumes verbatim)
| Control/field | Keyboard keys (non-standard only) | Focus position (n of N in flow) | ARIA attrs required |
| course (combobox) | ArrowUp/Down, Enter, Esc | 1 of 9 | role=combobox, aria-expanded, aria-controls |
(one row per control from the section-1 map; standard controls may say "native"; a section-1 control missing here is a gap, not an implied default. Consumer matches this table byte-for-byte; unmatched values route back as producer defects.)

## 6. Wireframe
wireframe: <artifact-url-or-path>
(exact machine-detectable line; or `_skipped: no renderable screens_`. Low-fi grayscale, one page per screen, drawn from sections 1-3. Orchestrator surfaces Approve/Revise at the L5→L6 barrier before design/test-plan/ops run.)

## Open Items
- [OPEN] <decisions needing user input>

Output example: course booking form

This example directly illustrates the bug this phase prevents. The course field is backed by a courses table, so it is a dropdown, never a text input.

1. Field → Control Map (all 9 template columns; one fully-populated row per binding kind where feasible)

| Field | Binding (from DATA) | Control | Value source | Validation | Default | Autofocus | Validate-when | Help |

|---|---|---|---|---|---|---|---|---|

| course | FK → public.courses (12 rows) | select | SELECT id, name FROM courses WHERE active | value ∈ courses | empty | yes (sole autofocus) | on-change (gates rest of form) | none |

| instructor | FK → public.instructors (40 rows) | combobox + search | SELECT id, name FROM instructors | value ∈ instructors | empty | no | on-blur | none |

| session_date | date | date picker | — | within course schedule window | empty | no | on-blur | "sessions run within the course schedule window" |

| skill_level | enum (beginner/intermediate/advanced) | radio group (3) | enum skill_level | value ∈ enum | beginner | no | on-change | none |

| send_reminder | boolean | toggle (takes effect immediately) | — | — | off | no | on-change | none |

| seats | numeric range 1-8 | stepper (bounded, <=20 steps) | course.capacity | 1 ≤ n ≤ capacity | 1 | no | on-change | "1 to course capacity" |

| notes | free-text (<=500 chars, multi-sentence) | textarea | — | ≤ 500 chars | empty | no | on-blur | "max 500 chars" |

| add_ons | multi-FK → public.add_ons | chip multiselect | SELECT id, name FROM add_ons | each ∈ add_ons | none selected | no | on-change | none |

The course row is the whole point: a planner who wrote "course: text input" would have shipped the bug. The binding forces select. (lookup and timestamp bindings do not occur on this form; when present they get the same fully-populated row.)

2. Screen States — Booking Form

| State | Renders |

|---|---|

| loading | skeleton form; course/instructor selects show spinner while options fetch |

| empty | if no active courses: "No courses available" + disabled Submit |

| error | options fetch failed: inline error banner + Retry button; form inputs disabled |

| success | populated form, all controls interactive, Submit enabled when valid |

| partial | courses loaded but add-ons failed: form usable, add-ons section shows its own retry |

| disabled | Submit disabled until course selected, date in window, seats ≤ capacity |

3. Flow — Book a course (task-flow table)

| Task | Entry | Action | Result | Error path | Disabled-when |

|---|---|---|---|---|---|

| Book a course | open booking form | select course, pick date, set seats, Submit | booking created, confirmation shown | submit fails: keep form state, show error banner, re-enable Submit for retry | Submit: no course OR date outside window OR seats > capacity |

Affordances: course/instructor/date/seats interactive; Submit disabled-when (no course OR date outside window OR seats > capacity).

Handoff

UX_<slug>.md feeds three consumers plus the orchestrator gate:

Return (to orchestrator)

Return exactly:

Review Mode (audit implemented code)

Invoked as cfn-ux --review <path-to-ui-component(s)> (optionally --data planning/<slug>/DATA_<slug>.md or --schema <migration|model>). Runs the affordance map BACKWARD: instead of deriving controls from a data model to write a spec, it reads shipped UI, recovers each field's real control + real binding, and flags every mismatch. This is the post-hoc catch for the dropdown-as-textbox bug that already shipped.

No planning artifacts required here. Code is the input.

Steps

  1. Enumerate fields. Parse the target form / screen. For every user-editable field emit: file:line, field name, rendered control (<input type=text>, <select>, <textarea>, checkbox, date-picker, etc.).
  2. Recover the real binding. For each field, determine what it is actually backed by — read it, do not guess:
  1. Apply the affordance map (same table as forward mode) → expected control.
  2. Diff. rendered vs expected. Every mismatch = finding. The load-bearing one: FK / lookup / enum field rendered as a free-text <input>.
  3. State audit. Does the component handle loading / empty / error / disabled for any async-backed control? Each missing state = finding.
  4. Flow audit. Error path rendered on submit failure? Disable conditions wired (submit gated until a required select is chosen)? Missing = finding.

Output

Write planning/<slug>/AUDIT_UX_<slug>.md. Findings table — each row verifiable against the cited line:

| file:line | field | rendered | expected | binding | severity | fix |
|-----------|-------|----------|----------|---------|----------|-----|
| BookingForm.tsx:42 | course | <input type=text> | <select> | FK -> public.courses | HIGH | replace with select sourced from courses |
| BookingForm.tsx:55 | status | <input> | radio/select | enum(active,closed) | HIGH | enum -> select |
| BookingForm.tsx:- | (form) | no error state | error banner on submit fail | - | MED | add error path |

Severity: HIGH = wrong control on a constrained field (invalid data enterable) or missing error path; MED = missing non-error state; LOW = suboptimal control (raw select where >20 rows wants type-ahead). Empty findings table = PASS, state it explicitly.

Pairs with cfn-data --review: run that first so bindings come from the real schema, not inference. The reverse trio for shipped work is cfn-data --review -> cfn-ux --review -> cfn-arch --review.

Anti-Patterns

Related

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.