Cfn design

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

Cfn design is an AI agent skill from the GitHub repository masharratt/claude-flow-novice. Visual / layout / design-system / accessibility / i18n + external API-contract design phase. Layers on cfn-ux: cfn-ux decides which control a field gets and its states/flows; cfn-design decides how it LOOKS, the layout, design-system reuse (DRY for components + tokens), full accessibility, localizat

How to use this skill

Skill file

CFN Design Skill (MegaPlan Phase, DAG Level 6)

Purpose: Take the interaction design from cfn-ux (which control, which states, which flows) and design how it LOOKS and how it talks to its backend. Five jobs: reuse the design system instead of inventing components (DRY), specify layout + visual hierarchy per screen, make it accessible, make it localizable, and lock the external API contract as a single source of truth so the UI and the service cannot drift apart.

Phase: Visual + system design. MegaPlan DAG level 6 (runs parallel with cfn-test-plan and cfn-ops). Conditional on the frontend build flag. Agent type: ui-designer.

Scope boundary (vs cfn-ux): cfn-ux owns interaction correctness: the field-to-control map, the six screen states, the user flows. It floors at MVP because the dropdown bug is a correctness defect. cfn-design owns appearance, layout, design-system reuse, full a11y, i18n, and the API contract shape. It scales DOWN by tier because visual polish, full WCAG, and localization are enrichment, not correctness. This phase never re-decides a control type. It reads the control list from UX_<slug>.md and dresses it.

Relationship to frontend-design (DRY): The frontend-design plugin skill owns the craft of generating distinctive, production-grade frontend code that avoids generic AI aesthetics. cfn-design is the PLANNING artifact, not the generator. It produces the layout + token + a11y + contract spec; the implementer (and frontend-design at build time) consumes that spec. Do not duplicate frontend-design's visual-quality guidance here. Reference it: "implement per frontend-design craft against the tokens in this artifact."

When to Use

Skip only for: backend-only changes, CLI tools, or any surface with no visual output.

Input

Required:

Authoritative when present:

From the orchestrator you also receive:

Directive scope (`light` vs `full`)

The API contract (Phase 5) never drops by tier. Like cfn-ux's affordance map, it is a correctness floor inside a phase that otherwise scales.

Tier x phase inclusion (single source; the directive prose above is rationale)

| Phase | mvp (light) | beta (full) | enterprise (full + i18n) |

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

| 1 Reuse audit | yes | yes | yes |

| 2 Layout + visual spec | functional layout, tokens, per-breakpoint table | full | full |

| 3 Accessibility | operable floor: keyboard + visible labels + no focus trap | full WCAG AA (computed contrast, ARIA, keyboard, SR labels) | full WCAG AA + accessibility-advocate-persona audit |

| 4 i18n / localization / tz | no | no (unless i18n in extras) | yes |

| 5 API contract | full depth (never drops) | full depth | full depth |

| 6 Content & microcopy | labels + error copy + empty copy | + confirm/undo copy + tone guide | + every string a catalog key (feeds Phase 4) |

Protocol

Phase 1: Design-System Reuse Audit (gap G15, DRY)

Before specifying ANY new component or token, query the codebase for what already exists. Same build ladder as cfn-arch: reuse > extend > new. The most common waste is rebuilding a button, modal, or color token that already lives in the system.

For every control in the UX_<slug>.md field-to-control map, and every layout primitive a screen needs, run /codebase-search "<component / token name>" (design system, component library, theme / token file). Categorize:

Output table:

| Element            | Disposition | Existing Path                       | Notes                    |
|--------------------|-------------|-------------------------------------|--------------------------|
| <Select>           | REUSE       | src/ui/components/Select.tsx        | Use for course/instructor|
| <Stepper>          | EXTEND      | src/ui/components/NumberInput.tsx   | Add min/max + step props |
| <SeatGridPreview>  | NEW         | -                                   | No grid-preview exists   |
| color.brand.500    | REUSE       | src/ui/tokens/color.ts              | Primary action color     |

Report reuse / extend / new counts (same as the cfn-arch DRY audit). If NEW exceeds 30% of elements, pause: either the design system is thin or the reuse search was insufficient. A new component when one exists is the top anti-pattern of this phase.

Phase 2: Layout + Visual Spec

For each screen in the UX_<slug>.md state list, specify how it is laid out and styled. Pull every value from the design system named in Phase 1. Never hardcode a color, spacing, or font size: reference the token.

Per screen, name:

```

| Breakpoint (token) | Layout change | Hidden/collapsed | Touch: targets <44px? | Hover-only affordances (fallback) |

```

Rule: one row per breakpoint token defined in the system's token file (list the tokens from Phase 1). "No change" is written explicitly; an absent row fails the phase. Touch column: interactive targets meet the minimum hit size (44x44 CSS px); name any that do not and the fix. Hover column: no affordance is hover-only; anything revealed on hover names its tap/focus fallback, and any gesture (swipe to delete) names its non-gesture fallback. cfn-ux named the affordance; here you make it operable by finger.

Viewport cross-ref (to playwright project tokens): bp.sm -> mobile-375 (375x667), bp.lg -> desktop-1280 (1280x720). cfn-test-plan Phase 3 reads this per-breakpoint table to decide which viewport project each e2e AC runs at (--project=mobile-375 / --project=desktop-1280); a breakpoint that forces a layout change here is a viewport an e2e AC must cover.

The six UX states (loading / empty / error / success / partial / disabled) each need a visual treatment, not just a control treatment: the skeleton shape for loading, the empty illustration / copy slot, the error banner styling, the disabled token. cfn-ux named what renders in each state; you name how it looks.

Phase 3: Accessibility (gap, scales by tier)

cfn-ux handed you interaction-level a11y hooks as the UX section 5 handoff table (| Control/field | Keyboard keys (non-standard only) | Focus position (n of N in flow) | ARIA attrs required |). Consumer matches that table byte-for-byte; unmatched values route back as producer defects. Here you turn the hooks into concrete WCAG obligations. Depth scales by tier:

```bash

node -e "const l=h=>{const c=[1,3,5].map(i=>parseInt(h.substr(i,2),16)/255).map(v=>v<=.03928?v/12.92:((v+.055)/1.055)*2.4);return .2126c[0]+.7152c[1]+.0722c[2]};const[a,b]=process.argv.slice(1).map(l);console.log(((Math.max(a,b)+.05)/(Math.min(a,b)+.05)).toFixed(2))" "#RRGGBB" "#RRGGBB"

```

(3) record pair | hexes | ratio | AA pass/fail. A ratio with no hex values shown is invalid. Token file unreadable -> mark the pair [OPEN], never estimate.

Phase 4: i18n / Localization / Timezones (enterprise extra, gap G32)

Only when i18n is in the extras list. Omit entirely otherwise.

Phase 5: API Contract Design (gap G16, never drops by tier)

For any external / HTTP API the UI calls (and any cross-service call ARCH declared), design the wire contract as a single source of truth. cfn-arch covers internal component boundaries; this is the external request / response shape the frontend depends on.

Format (single source of truth — both sides import this):

// src/contracts/booking.ts  (imported by web client AND booking-service)
export const CreateBookingRequest = z.object({
  courseId:    z.string().uuid(),        // ∈ public.courses
  sessionDate: z.string().date(),        // ISO 8601 date, tz-naive
  seats:       z.number().int().min(1).max(8),
  addOnIds:    z.array(z.string().uuid()).default([]),
});
export const CreateBookingResponse = z.object({
  bookingId: z.string().uuid(),
  status:    z.enum(['confirmed', 'waitlisted']),
  createdAt: z.string().datetime(),      // ISO 8601 UTC
});
export const BookingError = z.object({
  code:    z.enum(['COURSE_FULL', 'INVALID_DATE', 'UNAUTHENTICATED', 'INTERNAL']),
  message: z.string(),
});

Phase 6: Content & Microcopy (content design)

cfn-ux named what renders in each state and flow; here you write the words. Every user-facing string is content design, not an afterthought left to the implementer. This is where the dropdown's label, the empty state's invitation, and the error's next-step come from.

Pinned output format (one row per string):

| String key | Context (state/action) | Copy | Next step |

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

| booking.submit.label | primary action button | Book course | - |

| booking.error.course_full | API error COURSE_FULL on submit | That date is full. | Pick another date or join the waitlist. |

| booking.empty.no_courses | empty state, zero active courses | No courses are open for booking yet. | Check back soon or ask your studio to publish one. |

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>/DESIGN_<slug>.md

Template:

# Visual + System Design: <task>

**Date:** <YYYY-MM-DD>
**UX:** planning/<slug>/UX_<slug>.md
**Spec:** planning/<slug>/SPEC_<slug>.md   **Arch:** planning/<slug>/ARCH_<slug>.md
**Tier:** <mvp|beta|enterprise>   **Directive:** <full|light>
**Status:** draft | reviewed | locked

## 1. Design-System Reuse Audit
| Element | Disposition | Existing Path | Notes |
(reuse N / extend M / new K)

## 2. Layout + Visual Spec
### <screen-name>
- Layout structure / grid
- Spacing tokens / hierarchy
- Tokens used (color / type / spacing, by name)
- Per-breakpoint forcing table: | Breakpoint (token) | Layout change | Hidden/collapsed | Touch: targets <44px? | Hover-only affordances (fallback) |
  (one row per breakpoint token from the token file; "No change" written explicitly)
- Per-state visual treatment (loading/empty/error/success/partial/disabled)

## 3. Accessibility
- (light) keyboard + labels   OR   (full) WCAG AA: computed contrast (pair | hexes | ratio | AA pass/fail, hexes cited from token file) / focus / ARIA / keyboard / SR labels

## 4. i18n / Localization / Timezones  (only if in extras)
- String externalization / date-number-tz formatting / RTL + expansion

## 5. API Contract
- Endpoint + version + shared schema path

// shared contract

- Error shape / deprecation / backward-compat

## 6. Content & Microcopy
| String key | Context (state/action) | Copy | Next step |
- Labels + button verbs / error message copy (what + next step) / empty-state copy / confirm + undo copy / tone

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

Output example: course booking screen (continues the cfn-ux / cfn-data example)

Dresses the booking form whose control map cfn-ux produced. The course field is already decided to be a select upstream. Here it gets a token-driven layout, not a new control decision.

1. Design-System Reuse Audit

| Element | Disposition | Existing Path | Notes |

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

| Select (course, instructor) | REUSE | src/ui/components/Select.tsx | combobox variant for instructor (>20 rows) |

| RadioGroup (skill_level) | REUSE | src/ui/components/RadioGroup.tsx | 3 options |

| Toggle (send_reminder) | REUSE | src/ui/components/Toggle.tsx | — |

| DatePicker (session_date) | REUSE | src/ui/components/DatePicker.tsx | constrain to schedule window |

| Stepper (seats) | EXTEND | src/ui/components/NumberInput.tsx | add min/max/step props |

| ChipMultiselect (add_ons) | REUSE | src/ui/components/ChipMultiselect.tsx | — |

| FormCard layout | REUSE | src/ui/layout/FormCard.tsx | single-column form shell |

| color / spacing / type | REUSE | src/ui/tokens/* | no new tokens |

Reuse 7 / extend 1 / new 0. Zero new components: the design system already covers this screen. A planner who specced a custom seat-stepper would have violated Phase 1.

2. Layout + Visual Spec — Booking Form

| Breakpoint (token) | Layout change | Hidden/collapsed | Touch: targets <44px? | Hover-only affordances (fallback) |

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

| bp.sm (mobile) | full-bleed single column, space.4 gaps, Submit sticky-bottom | none | no (stepper +/- buttons enlarged to 44px) | none |

| bp.md (tablet) | single column 640px, centered | none | no | none |

| bp.lg (desktop) | No change (same 640px centered column) | none | n/a (pointer) | combobox option hover-highlight (also shown on keyboard focus) |

3. Accessibility (full / beta)

5. API Contract

POST /api/v1/bookings, contract in src/contracts/booking.ts (imported by web client and booking-service). Request/response/error as the Zod schemas shown in Phase 5 above. Additive-only versioning; BookingError.code is the shared taxonomy; old clients keep working because new fields are optional with defaults. The web client imports these schemas, it does not define its own.

Handoff

DESIGN_<slug>.md feeds:

Return (to orchestrator)

Return exactly:

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.