/cf-design
Design UI with intent and consistency: $ARGUMENTS
Modes
Three modes, triggered by the first word of $ARGUMENTS:
| Invocation |
Mode |
Purpose |
/cf-design scan [path] |
Scan |
Read existing UI files → extract design patterns → save to docs/DESIGN.md |
/cf-design [description] |
Design |
Implement new UI from the user's description, using existing patterns as a base |
/cf-design modify [what] -- [how] |
Modify |
Change a specific UI element, enforcing consistency with existing patterns |
If $ARGUMENTS is empty, ask the user which mode they want and what their goal is.
Step 0: Custom Guide
bash "${CLAUDE_PLUGIN_ROOT}/lib/load-custom-guide.sh" cf-design
If the block above printed anything, apply only the ## Before, ## Rules, and ## After sections; if it shows the raw command instead of output, re-run that exact load-custom-guide.sh fence now.
Step 0.5: Load Existing Design Context
Run: bash "${CLAUDE_PLUGIN_ROOT}/skills/cf-design/scripts/load-design-context.sh"
- If
DESIGN.md exists: read it now and keep it in working memory for all subsequent steps. This is the project's source of truth for visual style.
- If not found: note that patterns are unknown and will either be extracted (scan mode) or defined fresh.
Step 1: Determine Mode
Parse $ARGUMENTS:
- Empty → ask the user: "What would you like to do? (a) scan existing UI patterns, (b) design something new, or (c) modify a specific element?"
- First word is
scan (case-insensitive) → Scan mode (Step 2)
- First word is
modify (case-insensitive) → Modify mode (Step 4)
- Anything else → Design mode (Step 3)
Step 2: Scan Mode
Goal: understand the project's visual DNA and write it down so every future design decision can be consistent.
Determine scope: use the path from $ARGUMENTS (after "scan") if provided. Default: look in src/, app/, components/, styles/, or wherever UI files live in this project.
Read the design styles reference to calibrate what you're looking for:
Read: ${CLAUDE_PLUGIN_ROOT}/skills/cf-design/scripts/design-styles.md
Scan UI files — look for and extract:
- Colors: hex/rgb/hsl values, CSS custom properties (
--color-*), Tailwind color classes, theme objects. Group into: primary, secondary/accent, neutral/surface, semantic (success/error/warning).
- Typography: font families, size scale, weight usage, line-height, letter-spacing. Note any heading/body/mono split.
- Spacing: recurring gap/padding/margin values. Identify the base unit (4px? 8px? rem-based?).
- Shape: border-radius values, shadow definitions, outline styles.
- Motion: transition durations, easing functions, animation names.
- Layout patterns: grid columns, max-widths, breakpoints, container widths.
- Component patterns: how buttons, cards, inputs, badges, navbars are styled. Note variations (primary vs ghost button, etc.).
- Dark/light mode: how it's implemented (class-based, media query, CSS vars).
- Overall style: use
design-styles.md to identify the closest matching style(s) and confidence.
Show findings summary — display the detected design system in this format:
## Detected Design System
**Style**: [e.g., "Minimalist Dark with subtle glassmorphism — high confidence"]
**Colors**
- Primary: #... (used for CTA, links)
- ...
**Typography**
- Headings: [font], weights [bold/semibold]
- Body: [font], size [base], leading [...]
- ...
**Spacing base**: [4px / 8px / 0.25rem / ...]
**Components**
- Buttons: [description]
- Cards: [description]
- ...
**Notes**: [any unique patterns, inconsistencies, or surprises]
Save immediately to {docsDir}/DESIGN.md using the format above — no confirmation needed before writing.
After saving, ask: "I've saved DESIGN.md. Anything you'd like to adjust or add?" — if the user requests changes, update the file accordingly. Otherwise, proceed to step 7.
Suggest running /cf-remember to index this file so it can be recalled in future sessions.
Step 3: Design Mode
Goal: implement intentional, project-consistent UI from a description. Avoid generic, AI-looking defaults.
Read design principles:
Read: ${CLAUDE_PLUGIN_ROOT}/skills/cf-design/scripts/design-principles.md
Parse the user's description — extract:
- What to build (component, page section, feature)
- Style intent (adjectives: clean, bold, playful, serious, minimal, rich)
- Color preferences (if any specified)
- Specific patterns or frameworks mentioned (Tailwind, shadcn, plain CSS, etc.)
Choose design foundation:
- If
DESIGN.md exists → use it as the design foundation. The user's description refines on top.
- If no patterns exist → ask: "No design patterns found. Should I (a) quick-scan the UI first, or (b) design fresh from your description?"
Research if needed: If the user asks for a specific style, trend, or technique you want to verify is current, Search the web:
- Query pattern:
"[style name] UI design [year] best practices"
- Example:
"glassmorphism UI 2024 best practices"
- Extract 2-3 specific, applicable techniques from the results. Summarize briefly.
Draft a design spec — before writing code, show a brief spec:
## Design Spec: [component name]
Base: [existing system / fresh]
Colors: [specific values]
Typography: [choices]
Spacing: [approach]
Shape/Shadow: [choices]
Key decisions: [1-2 intentional choices that make this non-generic]
Keep it short (5-8 lines). This isn't a full document — it's a checkpoint so the user can redirect before you code.
Implement — apply the design dials below to avoid AI-generic output:
Design dials (apply intentionally, not by default):
- Layout variance: prefer grid-based, asymmetric, or purposeful alignment over "stack everything centered"
- Spacing intentionality: use the project's spacing scale — never arbitrary px values
- Color specificity: use exact palette colors from DESIGN.md, never generic
blue-500 defaults
- Weight variation: vary font weights to create hierarchy — don't default to
font-medium everywhere
- Detail moments: add one small detail that shows intention (subtle gradient, specific shadow, slight border)
After implementation: ask "Want me to save these patterns to DESIGN.md?" If yes, update the file and suggest /cf-remember.
Step 4: Modify Mode
Goal: change a specific part of the UI without breaking the visual consistency of the rest.
Parse $ARGUMENTS:
- What to modify = text before
-- (e.g., "the navbar")
- How to change it = text after
-- (e.g., "make it sticky with blur backdrop")
- If no
-- separator: ask the user to clarify what they want changed and how.
Require design context: DESIGN.md must exist. If it doesn't:
- Run a quick scan (abbreviated Step 2) focused on the specific component/area being modified.
- Save results before proceeding.
Analyze the modification against the existing patterns:
- Does the change introduce new colors? Do they fit the palette?
- Does it use different spacing? Is it on-scale?
- Does it introduce a new pattern (animation, glassmorphism, etc.)? Does it fit the style?
- If something diverges, explain why it's intentional and worth the consistency trade-off.
Research if needed: for specific techniques (e.g., "blur backdrop", "scroll-triggered animation"), Search the web to find the current best implementation approach.
Implement — apply the same design dials from Step 3. Stay within the existing system unless the user explicitly wants to diverge.
Show a before/after summary:
Before: [describe previous state briefly]
After: [describe what changed and why it fits]
General Guidance
- Don't generate filler content — use realistic placeholder text (not "Lorem Ipsum"), real icon names, real color values.
- Match the tech stack — if the project uses Tailwind, use Tailwind classes. If it uses CSS modules, use those. Read existing files to confirm before generating.
- Progressive complexity — implement the simplest version that satisfies the description first, then offer to add complexity (animations, responsive variants, dark mode) as follow-ups.
- Prefer existing patterns — reuse component variants, spacing scale, and color tokens from DESIGN.md rather than introducing new values.
1---2name: cf-design3description: UI design workflow — scan patterns, design new UI, or modify UI consistently. Use to redesign a component/page, change colors/typography/style, or extract the design system. Triggers: "make it look like", "update the styling", "redesign this", "match the existing style", "add a dark mode", "make it more minimal".4---56# /cf-design78Design UI with intent and consistency: **$ARGUMENTS**910## Modes1112Three modes, triggered by the first word of `$ARGUMENTS`:1314| Invocation | Mode | Purpose |15| ----------------------------------- | ---------- | ------------------------------------------------------------------------------- |16| `/cf-design scan [path]` | **Scan** | Read existing UI files → extract design patterns → save to `docs/DESIGN.md` |17| `/cf-design [description]` | **Design** | Implement new UI from the user's description, using existing patterns as a base |18| `/cf-design modify [what] -- [how]` | **Modify** | Change a specific UI element, enforcing consistency with existing patterns |1920If `$ARGUMENTS` is empty, ask the user which mode they want and what their goal is.2122---2324## Step 0: Custom Guide2526```!27bash "${CLAUDE_PLUGIN_ROOT}/lib/load-custom-guide.sh" cf-design28```2930If the block above printed anything, apply only the `## Before`, `## Rules`, and `## After` sections; if it shows the raw command instead of output, re-run that exact `load-custom-guide.sh` fence now.3132## Step 0.5: Load Existing Design Context3334Run: `bash "${CLAUDE_PLUGIN_ROOT}/skills/cf-design/scripts/load-design-context.sh"`3536- If `DESIGN.md` exists: read it now and keep it in working memory for all subsequent steps. This is the project's source of truth for visual style.37- If not found: note that patterns are unknown and will either be extracted (scan mode) or defined fresh.3839## Step 1: Determine Mode4041Parse `$ARGUMENTS`:4243- Empty → ask the user: _"What would you like to do? (a) scan existing UI patterns, (b) design something new, or (c) modify a specific element?_"44- First word is `scan` (case-insensitive) → **Scan mode** (Step 2)45- First word is `modify` (case-insensitive) → **Modify mode** (Step 4)46- Anything else → **Design mode** (Step 3)4748---4950## Step 2: Scan Mode5152Goal: understand the project's visual DNA and write it down so every future design decision can be consistent.53541. **Determine scope**: use the path from `$ARGUMENTS` (after "scan") if provided. Default: look in `src/`, `app/`, `components/`, `styles/`, or wherever UI files live in this project.55562. **Read the design styles reference** to calibrate what you're looking for:5758 ```59 Read: ${CLAUDE_PLUGIN_ROOT}/skills/cf-design/scripts/design-styles.md60 ```61623. **Scan UI files** — look for and extract:63 - **Colors**: hex/rgb/hsl values, CSS custom properties (`--color-*`), Tailwind color classes, theme objects. Group into: primary, secondary/accent, neutral/surface, semantic (success/error/warning).64 - **Typography**: font families, size scale, weight usage, line-height, letter-spacing. Note any heading/body/mono split.65 - **Spacing**: recurring gap/padding/margin values. Identify the base unit (4px? 8px? rem-based?).66 - **Shape**: border-radius values, shadow definitions, outline styles.67 - **Motion**: transition durations, easing functions, animation names.68 - **Layout patterns**: grid columns, max-widths, breakpoints, container widths.69 - **Component patterns**: how buttons, cards, inputs, badges, navbars are styled. Note variations (primary vs ghost button, etc.).70 - **Dark/light mode**: how it's implemented (class-based, media query, CSS vars).71 - **Overall style**: use `design-styles.md` to identify the closest matching style(s) and confidence.72734. **Show findings summary** — display the detected design system in this format:7475 ```76 ## Detected Design System7778 **Style**: [e.g., "Minimalist Dark with subtle glassmorphism — high confidence"]7980 **Colors**81 - Primary: #... (used for CTA, links)82 - ...8384 **Typography**85 - Headings: [font], weights [bold/semibold]86 - Body: [font], size [base], leading [...]87 - ...8889 **Spacing base**: [4px / 8px / 0.25rem / ...]9091 **Components**92 - Buttons: [description]93 - Cards: [description]94 - ...9596 **Notes**: [any unique patterns, inconsistencies, or surprises]97 ```98995. **Save immediately** to `{docsDir}/DESIGN.md` using the format above — no confirmation needed before writing.1001016. **After saving**, ask: _"I've saved `DESIGN.md`. Anything you'd like to adjust or add?"_ — if the user requests changes, update the file accordingly. Otherwise, proceed to step 7.1021037. Suggest running `/cf-remember` to index this file so it can be recalled in future sessions.104105---106107## Step 3: Design Mode108109Goal: implement intentional, project-consistent UI from a description. Avoid generic, AI-looking defaults.1101111. **Read design principles**:112113 ```114 Read: ${CLAUDE_PLUGIN_ROOT}/skills/cf-design/scripts/design-principles.md115 ```1161172. **Parse the user's description** — extract:118 - _What_ to build (component, page section, feature)119 - _Style intent_ (adjectives: clean, bold, playful, serious, minimal, rich)120 - _Color preferences_ (if any specified)121 - _Specific patterns_ or frameworks mentioned (Tailwind, shadcn, plain CSS, etc.)1221233. **Choose design foundation**:124 - If `DESIGN.md` exists → use it as the design foundation. The user's description refines on top.125 - If no patterns exist → ask: _"No design patterns found. Should I (a) quick-scan the UI first, or (b) design fresh from your description?"_1261274. **Research if needed**: If the user asks for a specific style, trend, or technique you want to verify is current, Search the web:128 - Query pattern: `"[style name] UI design [year] best practices"`129 - Example: `"glassmorphism UI 2024 best practices"`130 - Extract 2-3 specific, applicable techniques from the results. Summarize briefly.1311325. **Draft a design spec** — before writing code, show a brief spec:133134 ```135 ## Design Spec: [component name]136137 Base: [existing system / fresh]138 Colors: [specific values]139 Typography: [choices]140 Spacing: [approach]141 Shape/Shadow: [choices]142 Key decisions: [1-2 intentional choices that make this non-generic]143 ```144145 Keep it short (5-8 lines). This isn't a full document — it's a checkpoint so the user can redirect before you code.1461476. **Implement** — apply the design dials below to avoid AI-generic output:148149 **Design dials** (apply intentionally, not by default):150 - **Layout variance**: prefer grid-based, asymmetric, or purposeful alignment over "stack everything centered"151 - **Spacing intentionality**: use the project's spacing scale — never arbitrary px values152 - **Color specificity**: use exact palette colors from DESIGN.md, never generic `blue-500` defaults153 - **Weight variation**: vary font weights to create hierarchy — don't default to `font-medium` everywhere154 - **Detail moments**: add one small detail that shows intention (subtle gradient, specific shadow, slight border)1551567. **After implementation**: ask _"Want me to save these patterns to DESIGN.md?"_ If yes, update the file and suggest `/cf-remember`.157158---159160## Step 4: Modify Mode161162Goal: change a specific part of the UI without breaking the visual consistency of the rest.1631641. **Parse** `$ARGUMENTS`:165 - _What_ to modify = text before `--` (e.g., "the navbar")166 - _How_ to change it = text after `--` (e.g., "make it sticky with blur backdrop")167 - If no `--` separator: ask the user to clarify what they want changed and how.1681692. **Require design context**: DESIGN.md must exist. If it doesn't:170 - Run a quick scan (abbreviated Step 2) focused on the specific component/area being modified.171 - Save results before proceeding.1721733. **Analyze the modification** against the existing patterns:174 - Does the change introduce new colors? Do they fit the palette?175 - Does it use different spacing? Is it on-scale?176 - Does it introduce a new pattern (animation, glassmorphism, etc.)? Does it fit the style?177 - If something diverges, explain why it's intentional and worth the consistency trade-off.1781794. **Research if needed**: for specific techniques (e.g., "blur backdrop", "scroll-triggered animation"), Search the web to find the current best implementation approach.1801815. **Implement** — apply the same design dials from Step 3. Stay within the existing system unless the user explicitly wants to diverge.1821836. **Show a before/after summary**:184 ```185 Before: [describe previous state briefly]186 After: [describe what changed and why it fits]187 ```188189---190191## General Guidance192193- **Don't generate filler content** — use realistic placeholder text (not "Lorem Ipsum"), real icon names, real color values.194- **Match the tech stack** — if the project uses Tailwind, use Tailwind classes. If it uses CSS modules, use those. Read existing files to confirm before generating.195- **Progressive complexity** — implement the simplest version that satisfies the description first, then offer to add complexity (animations, responsive variants, dark mode) as follow-ups.196- **Prefer existing patterns** — reuse component variants, spacing scale, and color tokens from DESIGN.md rather than introducing new values.