home / skills / d-oit / do-novelist-ai / frontend-design-system

frontend-design-system skill

/.claude/skills/frontend-design-system

This skill helps you build and refactor React/Tailwind UI using the design system for accessible, distinctive, product-ready interfaces.

npx playbooks add skill d-oit/do-novelist-ai --skill frontend-design-system

Review the files below or copy the command above to add this skill to your agents.

Files (1)
SKILL.md
8.1 KB
---
name: frontend-design-system
description: >
  Design and refactor React/Tailwind frontends using the project design system.
  Use this Skill when working on UI components, pages, layouts, or UX improvements
  and you want distinctive, accessible, non-generic designs that avoid AI slop.
allowed-tools: Read, Grep, Glob
---

# Frontend Design System Skill

## Purpose

This Skill packages opinionated guidance for building and refactoring frontend UI so that output:
- Uses the existing design system instead of ad-hoc styles.
- Avoids generic “AI slop” UI and looks intentional and product-ready.
- Meets accessibility, responsiveness, and basic performance expectations.

Use this Skill whenever the user:
- Asks for React/Tailwind components, HTML/CSS layouts, or UI redesigns.
- Mentions design, UX, responsiveness, accessibility, or “make this look better”.
- Wants to refactor messy or inconsistent frontend code.

## Tech stack assumptions

Unless the user clearly states otherwise, assume:
- Framework: React function components (with hooks, TypeScript when present).
- Styling: Tailwind CSS with design tokens (CSS variables, theme config).
- Layout: Mobile-first, using flexbox and grid.
- Routing: Next.js or React Router style (do not invent routes unless requested).

If the project uses a different stack (e.g. Svelte, Vue, plain HTML/CSS), keep the same design principles and adapt syntax.

## Design system rules

When generating or editing UI, always:

1. **Use design tokens and theme**
   - Use semantic classes and variables for color (primary, secondary, accent, danger, surface, background, border, text).
   - Use the project spacing scale (e.g. `gap-2/3/4/6`, `p-4/6`, etc.) instead of arbitrary values.
   - Use only the established radii and shadows (e.g. `rounded-sm`, `rounded-md`, `shadow-sm`, `shadow-md`).

2. **Typography hierarchy**
   - Keep a clear hierarchy: page title, section title, body, caption.
   - Limit to 1–2 font stacks; never introduce new fonts unless the user asks.
   - Ensure line height and spacing are readable on mobile and desktop.

3. **Consistent component patterns**
   - Buttons: primary, secondary, subtle, destructive variants with consistent paddings and icon spacing.
   - Cards: shared padding, radius, shadow, header/body/footer patterns.
   - Forms: aligned labels, consistent input heights, clear error/help text styling.

If the repo has existing tokens/components, inspect them first (using Read/Grep/Glob) and align with those patterns.

## Anti–AI slop guardrails

Treat “AI slop” as any UI that is obviously default, generic, or visually incoherent.

**Never:**
- Use arbitrary rainbow gradients, neon glows, or random color mixes by default.
- Spam shadows, borders, and animations without purpose.
- Produce layouts that are just centered blobs of identical cards with no hierarchy.
- Fill UI with meaningless placeholder content or fake stats unless explicitly requested.

**Always:**
- Provide a clear visual hierarchy: one primary action, visible section grouping, obvious reading order.
- Use asymmetry and whitespace to create structure, not clutter.
- Limit motion: subtle hover and focus states, and respect `prefers-reduced-motion`.

Before finalizing any UI, mentally run a quick anti-slop checklist:
- Does this look like a bland, default template?
- Are color, typography, spacing, and radii consistent?
- Is there a clear primary action and purpose in each section?

If the answer is “yes, it looks generic” or “no, the hierarchy is unclear”, refactor the design.

## Accessibility requirements

For all generated UI:

- Use semantic HTML elements (`<header>`, `<main>`, `<section>`, `<nav>`, `<button>`, `<form>`, `<label>`, `<ul>`, `<li>`, etc.).
- Keep headings in logical order (`h1` then `h2`, `h3`, …).
- All interactive elements:
  - Are keyboard-focusable.
  - Have visible focus states that meet contrast requirements.
  - Have accessible names (visible text or `aria-label`).
- Ensure text and UI elements meet WCAG 2.1 AA contrast.
- For forms:
  - Every input has a `<label>` or `aria-label`.
  - Error states are communicated visually and via text near the field.

If the user asks for something that breaks basic accessibility (e.g. invisible focus), comply only if they are explicit and briefly warn about the trade-off.

## Responsive layout patterns

Default to mobile-first CSS and then enhance for larger breakpoints.

Prefer these patterns when the user does not specify a layout:

1. **Dashboard**
   - Left nav, main content, optional right sidebar.
   - Sticky header in main area with title and primary actions.

2. **Landing / marketing**
   - Hero (headline, supporting text, primary CTA, optional secondary CTA).
   - Supporting sections: features, use cases, social proof, footer.

3. **List + filters**
   - Filters/search controls in a header or left panel.
   - List or grid of items with clear empty/loading states.

4. **Detail + sidebar**
   - Main detail content (record, document, form).
   - Sidebar for metadata, secondary actions, or related content.

Choose the pattern that best fits the user’s described use case and note the choice briefly when answering.

## Code quality expectations

- Keep components focused; extract subcomponents when markup becomes repetitive or complex.
- Avoid deeply nested `div` structures; use meaningful wrappers and utility classes.
- Match existing project conventions:
  - File/folder structure.
  - Naming for components, props, hooks.
  - Import paths and alias usage.
- Remove unused imports, dead code, and commented-out sections from final output.
- Where helpful, add concise comments or JSDoc for complex props or layout logic.

## Workflow when this Skill is active

When a request matches this Skill (frontend, UI, UX, layout, React, Tailwind):

1. **Understand the context**
   - Restate the goal: what page/feature, who uses it, what the user is trying to do.
   - If key constraints are missing (data shape, breakpoints, brand rules), ask for them or make clearly marked assumptions.

2. **Scan existing code and design system**
   - Use Read/Grep/Glob to find:
     - Layout shells, shared components, and existing tokens.
     - Current patterns for buttons, forms, and typography.
   - Align new work with what already exists.

3. **Propose structure first**
   - Outline sections, components, and state responsibilities in prose or comments.
   - Select a layout pattern and explain it briefly.

4. **Implement the UI**
   - Write React/Tailwind or HTML/CSS following all rules above.
   - Include loading/empty/error states where appropriate.
   - Ensure responsiveness and accessibility from the start, not as an afterthought.

5. **Review and refine**
   - Re-run the anti-slop checklist.
   - Tighten inconsistent spacing, colors, and typography.
   - Remove unnecessary elements and complexity.

6. **Explain extension points**
   - Mention how to:
     - Add more variants.
     - Integrate with existing state/data fetching.
     - Reuse subcomponents in other screens.

## Examples

These examples are illustrative of process and expectations. When generating new UI, follow the same level of structure and attention to detail, not the exact content.

### Example: Improve an existing form screen

- Analyze the current form component and identify:
  - Inconsistent paddings and gaps.
  - Missing labels or help text.
  - Poor mobile layout (overflow, cramped fields).
- Propose:
  - A two-column layout on desktop, single-column on mobile.
  - Clear grouping of related fields with section headings.
  - Consistent button placement for primary/secondary actions.
- Implement:
  - Error and success message styling.
  - Accessible labels and focus handling.

### Example: New dashboard widget

- Given a requirement for a small dashboard card:
  - Select the shared card pattern.
  - Show title, key metric, optional trend badge, and subtle description.
- Implement:
  - A reusable `<MetricCard>` component using existing design tokens.
  - Responsive behavior: single column on mobile, grid on larger screens.

## Version history

- v1.0.0 (2025-11-23): Initial version for React/Tailwind, anti–AI slop design guardrails, and accessibility defaults.

Overview

This skill helps design and refactor React + Tailwind frontends to use an existing project design system, producing distinctive, accessible, product-ready UI instead of generic AI output. It focuses on consistent tokens, clear visual hierarchy, responsiveness, and measurable accessibility improvements. Use it when you want components, pages, or layouts that align with your design language and coding conventions.

How this skill works

I inspect the codebase for existing tokens, shared components, and patterns (buttons, cards, forms), then propose a layout pattern (dashboard, landing, list, or detail) before implementing. Implementations are React function components (TypeScript when present) with Tailwind utility classes mapped to semantic tokens, mobile-first breakpoints, and accessible markup. I include loading/empty/error states, concise comments, and extension points for reuse and data integration.

When to use it

  • Creating or refactoring React/Tailwind UI components or pages
  • Improving accessibility, responsiveness, or visual hierarchy
  • Converting ad-hoc styles into design-system-compliant code
  • Standardizing buttons, cards, forms, and typography across an app
  • Fixing messy or inconsistent frontend code that looks generic or unfinished

Best practices

  • Always use semantic design tokens for color, spacing, radii, and shadows rather than arbitrary values
  • Follow a clear typography hierarchy and limit font stacks to existing project choices
  • Implement one clear primary action per view and use whitespace and asymmetry to establish hierarchy
  • Ensure semantic HTML, logical heading order, keyboard-focusable controls, and WCAG 2.1 AA contrast
  • Keep components focused and extract subcomponents when markup repeats; remove unused imports and dead code

Example use cases

  • Refactor an admin dashboard to use shared card and header patterns with a left nav and sticky title bar
  • Redesign a form screen: single-column mobile, 2-column desktop, labeled inputs, and clear error states
  • Create a reusable MetricCard component showing a title, metric, trend badge, and description using tokens
  • Convert a list + filters page to a layout with a filter panel, responsive grid, and clear empty/loading states
  • Polish a landing hero with primary and secondary CTAs, consistent spacing, and accessible markup

FAQ

What assumptions do you make about the tech stack?

I default to React function components with Tailwind and TypeScript when present, mobile-first layout, and Next.js/React Router-style routing unless you tell me otherwise.

Will you change project tokens or fonts?

No—I'll reuse existing tokens and font stacks. I only introduce new design tokens or fonts if you explicitly request it, and I note the trade-offs.