plugins/cc10x/skills/frontend-patterns/SKILL.md
Use when frontend UI work needs accessibility, responsive layout, loading/error states, performance guardrails, or DESIGN.md authoring from screenshots, existing UI, user preferences, or chosen visual inspiration under an approved visual direction.
npx skillsauth add romiluz13/cc10x frontend-patternsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
User interfaces exist to help users accomplish tasks. Every UI decision should make the user's task easier or the interface more accessible.
Core principle: Design for user success, not aesthetic preference.
This skill is advisory in v10. Explicit user instructions, CLAUDE.md, repo standards, and approved plans override every suggestion here.
Read only the references needed for the current UI task:
references/ui-state-and-feedback.md for loading/error/empty/success ordering, skeleton vs spinner, and mutation feedbackreferences/accessibility-and-forms.md for WCAG-oriented checks, keyboard/focus, labels, form patterns, and mobile usabilityreferences/performance-and-layout.md for responsive checks, motion, overflow, URL state, performance guardrails, and light/dark mode checksreferences/design-md-authoring.md for creating or updating a spec-aligned project-local DESIGN.md from screenshots, existing UI, user preferences, or a selected inspiration stylereferences/design-md-inspiration-index.md only when the user asks for a style reference, brand-like direction, moodboard, or DESIGN.md-style examplesUse this skill to add:
Do not use this skill to override an explicit visual direction, component contract, or approved workflow.
Every frontend deliverable should include:
Focus on working code over explanations. Include usage examples in comments.
NO UI DESIGN BEFORE USER FLOW IS UNDERSTOOD
If you haven't mapped what the user is trying to accomplish, you cannot design UI.
Before writing any UI code, commit to answers for:
Key insight: Bold maximalism and refined minimalism both work. The enemy is indecision and generic defaults.
Read references/design-md-authoring.md before creating or updating a spec-aligned project-local DESIGN.md, especially when the user provides screenshots, existing UI, visual preferences, or asks the agent to preserve a design direction.
When inspiration is needed, read references/design-md-inspiration-index.md to choose a style family. Treat inspiration as input to the project's own design contract, not as an instruction to copy another company's UI.
Read references/ui-state-and-feedback.md before finalizing loading, error,
empty, success, or mutation states. Keep the state order explicit; do not invent
UI states ad hoc.
| Rule | Do | Don't |
|------|-----|-------|
| Reduced motion | Honor prefers-reduced-motion | Ignore user preferences |
| Properties | Animate transform/opacity only | Animate width/height/top/left |
| Transitions | List properties explicitly | Use transition: all |
| Duration | 150-300ms for micro-interactions | Too fast (<100ms) or slow (>500ms) |
| Interruptible | Allow animation cancellation | Lock UI during animation |
/* CORRECT: Compositor-friendly, respects preferences */
@media (prefers-reduced-motion: no-preference) {
.card { transition: transform 200ms ease-out, opacity 200ms ease-out; }
.card:hover { transform: translateY(-2px); opacity: 0.95; }
}
Read references/accessibility-and-forms.md when the task touches keyboard
navigation, forms, labels, focus, contrast, or touch ergonomics.
Every UI must have explicit success criteria:
Read references/performance-and-layout.md for responsive checks, motion rules,
overflow handling, URL state, touch/mobile, and color-mode validation.
ALWAYS answer before designing/reviewing:
Before any UI work, map the flow:
User Flow: Create Account
1. User lands on signup page
2. User enters email
3. User enters password
4. User confirms password
5. System validates inputs (inline)
6. User clicks submit
7. System processes (loading state)
8. Success: User sees confirmation + redirect
9. Error: User sees error + can retry
For each step, identify:
| Check | Criteria | Example Issue | |-------|----------|---------------| | Task completion | Can user complete goal? | Button doesn't work | | Discoverability | Can user find what they need? | Hidden navigation | | Feedback | Does user know what's happening? | No loading state | | Error handling | Can user recover from errors? | No error message | | Efficiency | Can user complete task quickly? | Too many steps |
Severity levels:
| Check | Good | Bad | |-------|------|-----| | Hierarchy | Clear visual priority | Everything same size | | Spacing | Consistent rhythm | Random gaps | | Alignment | Elements aligned to grid | Misaligned elements | | Interactive states | Hover/active/focus distinct | No state changes | | Feedback | Clear response to actions | Silent interactions |
When creating frontends, avoid generic AI aesthetics:
cursor-pointer to ALL clickable elementsscale transforms that shift layoutMake creative choices that feel designed for the specific context. No two designs should look the same.
Move beyond safe, centered layouts:
| Technique | Effect | When to Use | |-----------|--------|-------------| | Asymmetry | Dynamic tension, visual interest | Hero sections, feature highlights | | Overlap | Depth, connection between elements | Cards, images, testimonials | | Diagonal flow | Energy, movement | Landing pages, marketing | | Grid-breaking | Emphasis, surprise | Key CTAs, focal points | | Generous negative space | Luxury, breathing room | Premium products, editorial | | Controlled density | Information-rich, productive | Dashboards, data-heavy UIs |
Rule: Match spatial composition to the aesthetic direction chosen in Design Thinking. Minimalist = negative space. Maximalist = controlled density.
// Primary action button with all states
<button
type="button"
onClick={handleAction}
disabled={isLoading || isDisabled}
aria-busy={isLoading}
aria-disabled={isDisabled}
className={cn(
'btn-primary',
isLoading && 'btn-loading'
)}
>
{isLoading ? (
<>
<Spinner aria-hidden />
<span>Processing...</span>
</>
) : (
'Submit'
)}
</button>
<form onSubmit={handleSubmit} noValidate>
<div className="form-field">
<label htmlFor="email">
Email <span aria-hidden>*</span>
<span className="sr-only">(required)</span>
</label>
<input
id="email"
type="email"
value={email}
onChange={handleChange}
aria-invalid={errors.email ? 'true' : undefined}
aria-describedby={errors.email ? 'email-error' : 'email-hint'}
required
/>
<span id="email-hint" className="hint">
We'll never share your email
</span>
{errors.email && (
<span id="email-error" role="alert" className="error">
{errors.email}
</span>
)}
</div>
</form>
function DataList({ isLoading, data, error }) {
if (isLoading) {
return (
<div aria-live="polite" aria-busy="true">
<Spinner />
<span>Loading items...</span>
</div>
);
}
if (error) {
return (
<div role="alert" className="error-state">
<p>Failed to load items: {error.message}</p>
<button onClick={retry}>Try again</button>
</div>
);
}
if (!data?.length) {
return (
<div className="empty-state">
<p>No items found</p>
<button onClick={createNew}>Create your first item</button>
</div>
);
}
return <ul>{data.map(item => <Item key={item.id} {...item} />)}</ul>;
}
// Inline error with recovery action
<div role="alert" className="error-banner">
<Icon name="error" aria-hidden />
<div>
<p className="error-title">Upload failed</p>
<p className="error-detail">File too large. Maximum size is 10MB.</p>
</div>
<button onClick={selectFile}>Choose different file</button>
</div>
If you find yourself:
STOP. Go back to user flow.
| Excuse | Reality | |--------|---------| | "Most users don't use keyboard" | Some users ONLY use keyboard. | | "We'll add accessibility later" | Retrofitting is 10x harder. | | "Error states are edge cases" | Errors happen. Handle them. | | "Loading is fast, no need for state" | Network varies. Show state. | | "It looks better without labels" | Unlabeled inputs are inaccessible. | | "Users can figure it out" | If it's confusing, fix it. |
| Anti-pattern | Why It's Wrong | Fix |
|--------------|----------------|-----|
| user-scalable=no | Blocks accessibility zoom | Remove it |
| maximum-scale=1 | Blocks accessibility zoom | Remove it |
| transition: all | Performance + unexpected effects | List properties explicitly |
| outline-none without replacement | Removes focus indicator | Add focus-visible:ring-* |
| <div onClick> | Not keyboard accessible | Use <button> or <a> |
| Images without width/height | Causes layout shift (CLS) | Add explicit dimensions |
| Form inputs without labels | Inaccessible | Add <label> or aria-label |
| Icon buttons without aria-label | Unnamed to screen readers | Add aria-label |
| Emoji icons (🚀 ✨ 💫) | Unprofessional, inconsistent | Use SVG icons |
| Hardcoded date/number formats | Breaks internationalization | Use Intl.DateTimeFormat |
| autoFocus everywhere | Disorienting, mobile issues | Use sparingly, desktop only |
## Frontend Review: [Component/Feature]
### User Flow
[Step-by-step what user is trying to do]
### Success Criteria
- [ ] User can complete [task]
- [ ] User can recover from errors
- [ ] All users can access (keyboard, screen reader)
- [ ] Interface feels responsive
### UX Issues
| Severity | Issue | Location | Impact | Fix |
|----------|-------|----------|--------|-----|
| BLOCKS | [Issue] | `file:line` | [Impact] | [Fix] |
### Accessibility Issues
| WCAG | Issue | Location | Fix |
|------|-------|----------|-----|
| 1.4.3 | [Issue] | `file:line` | [Fix] |
### Visual Issues
| Issue | Location | Fix |
|-------|----------|-----|
| [Issue] | `file:line` | [Fix] |
### Recommendations
1. [Most critical fix]
2. [Second fix]
Before completing ANY UI component:
references/ui-state-and-feedback.mdBefore completing frontend work:
prefers-reduced-motion respectedcursor-pointer on all clickable elementstransition: all in codebasetools
Safe cc10x upgrade that preserves local modifications. Stashes diffs, pulls upstream, rebuilds cache, rebases patches. Use this skill when: updating cc10x, upgrading, pulling latest cc10x, syncing plugin, refreshing cache, or checking for new versions. Triggers: update cc10x, upgrade cc10x, pull cc10x, sync plugin, refresh cc10x, check for updates, new version, update plugin, upgrade plugin.
development
Use when a BUILD phase completes, a commit is staged, or a PR is about to be created, and the diff has not yet been reflected in documentation. Also use when the user says "update docs", "sync docs", "document this", or asks whether documentation is up to date.
development
Use when a bug, flaky test, or runtime/build failure needs root-cause tracing and a nearby duplicate-pattern scan before any fix.
development
THE ONLY ENTRY POINT FOR CC10X. Activate this skill for build, debug, review, and plan requests. Use when the user asks to implement, fix, review, plan, test, refactor, or continue code work. Trigger keywords: build, implement, create, write, add, review, audit, debug, fix, error, bug, broken, plan, design, architect, spec, brainstorm, test, refactor, optimize, update, change, research, cc10x, c10x. CRITICAL: Route and execute immediately. Do not stop at describing capabilities.