home / skills / madappgang / claude-code / ui-style-format

This skill helps you create, validate, and parse UI design style definitions with reference image support.

npx playbooks add skill madappgang/claude-code --skill ui-style-format

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

Files (1)
SKILL.md
4.6 KB
---
name: ui-style-format
version: 1.0.0
description: |
  UI design style file format specification with reference image support.
  Defines the schema for .claude/design-style.md and .claude/design-references/.
  Use when creating, validating, or parsing project design styles.
---

# UI Style Format Specification

## Overview

The UI Style system provides a standardized way to define project design preferences
that the `ui` agent uses during design reviews. It supports both text-based style
definitions and visual reference images.

## File Structure

```
{project}/
  .claude/
    design-style.md              # Main style configuration
    design-references/           # Visual reference images
      {image}.png                # PNG or JPG screenshots
      MANIFEST.md                # Optional metadata
```

## design-style.md Schema

### Required Sections

| Section | Purpose |
|---------|---------|
| Header | Version, dates, base reference |
| Reference Images | Links to visual references (v2.0+) |
| Brand Colors | Color palette with light/dark modes |
| Typography | Fonts and type scale |
| Spacing | Base unit and scale |
| Component Patterns | Button, input, card styles |
| Design Rules | DO and DON'T guidelines |

### Optional Sections

| Section | Purpose |
|---------|---------|
| Reference URLs | External style guides |
| Style History | Change log |
| MANIFEST.md | Detailed image descriptions |

## Reference Images Integration

### Storage Location

All reference images MUST be stored in `.claude/design-references/`.

### Supported Formats

| Format | Extension | Recommended Use |
|--------|-----------|-----------------|
| PNG | .png | Screenshots, UI components |
| JPEG | .jpg, .jpeg | Photos, complex imagery |
| WebP | .webp | Modern alternative to PNG/JPEG |

### Image Table Format

In the style file, reference images are listed in a table:

```markdown
## Reference Images

| Image | Description | Captured | Mode |
|-------|-------------|----------|------|
| hero-section.png | Homepage hero | 2026-01-08 | light |
```

### Usage Guidelines Section

Each image should have usage notes:

```markdown
### Usage Guidelines

- **hero-section.png**: Reference for hero layout, gradient, CTA placement
```

## Parsing the Style File

### Section Extraction

1. Read `.claude/design-style.md` with Read tool
2. Split by `## ` headers
3. Parse tables using Markdown table regex
4. Extract key-value pairs from tables

### Reference Image Resolution

```
Image Name -> .claude/design-references/{image_name}
```

Example:
```
hero-section.png -> .claude/design-references/hero-section.png
```

### Validation Checklist

Before using a style file, validate:

1. File exists at `.claude/design-style.md`
2. Required sections present
3. Referenced images exist in `.claude/design-references/`
4. Colors are valid hex codes
5. Spacing values are numbers

## Integration with ui Agent

### Style-Aware Review Flow

When the ui agent performs a review:

1. **Load Style**: Read `.claude/design-style.md`
2. **Load References**: List `.claude/design-references/`
3. **Match Components**: Find relevant reference images for review target
4. **Comparative Analysis**: Pass reference image + target to Gemini
5. **Validate Tokens**: Check colors, typography, spacing against style

### Gemini Prompt with References

```
Compare this implementation screenshot against the project design reference.

**Reference Image**: .claude/design-references/hero-section.png
**Implementation**: screenshots/current-hero.png

**Style Tokens** (from .claude/design-style.md):
- Primary Color: #2563EB
- Font: Inter 16px
- Spacing: 4px base

**Validate**:
1. Layout matches reference
2. Colors match defined palette
3. Typography follows scale
4. Spacing uses defined tokens
```

## Version Compatibility

| Version | Features |
|---------|----------|
| 1.x | Text-only style (legacy) |
| 2.x | Reference images + text style |

Version 2.x is backward compatible - the ui agent handles missing
`## Reference Images` section gracefully.

## Best Practices

### Capturing Reference Images

1. **Consistent viewport**: Use same browser width (e.g., 1440px)
2. **Clean state**: No modals, tooltips unless intentional
3. **Both modes**: Capture light and dark variants
4. **Component isolation**: Crop to relevant area

### Writing Usage Guidelines

Be specific about what each image demonstrates:

**Good**: "Reference for button padding (12px), border-radius (8px), and hover state"
**Bad**: "Button reference"

### Updating Styles

When UI changes:

1. Capture new screenshot
2. Replace old image (same name) or add new
3. Update Reference Images table
4. Add entry to Style History

Overview

This skill defines a file format and workflow for project UI design styles, combining text-based tokens and visual reference images. It standardizes where to store a design-style.md file and a design-references directory so the ui agent can load, validate, and use style tokens and screenshots during reviews.

How this skill works

The skill inspects a .claude/design-style.md document and the .claude/design-references/ folder. It parses top-level Markdown sections, reads reference-image tables and usage notes, resolves image file paths, and validates required tokens (colors, typography, spacing, components). It also provides a checklist and instructions for pairing reference images with implementation screenshots for comparative analysis.

When to use it

  • When establishing a project-wide design token and reference repository for reviews
  • When validating a UI implementation against project style rules and reference screenshots
  • When parsing or ingesting design-style.md to populate an automated review pipeline
  • When preparing or updating visual references for a design system or feature
  • When running style-aware comparisons between implementation screenshots and references

Best practices

  • Keep .claude/design-style.md organized with clear ## headers and a Reference Images table
  • Store all visual assets in .claude/design-references/ and use consistent file names
  • Capture reference images at a consistent viewport and clean UI state (e.g., 1440px)
  • Include explicit usage notes per image describing padding, radii, states, and intent
  • Validate colors as hex codes and spacing as numeric tokens before running reviews

Example use cases

  • Automated UI review: compare a new hero implementation screenshot to hero-section.png and validate tokens
  • Onboarding a new project: create design-style.md with brand colors, typography, spacing, and sample images
  • CI check: fail a build if referenced images are missing or required sections are absent
  • Design updates: swap a reference screenshot, update the table, and log the change in Style History
  • Component validation: confirm buttons follow defined padding, border-radius, and color tokens

FAQ

What image formats are supported?

PNG and JPEG are supported; WebP is allowed as a modern alternative. Store them in .claude/design-references/.

What sections are required in the style file?

Header, Reference Images (v2+), Brand Colors, Typography, Spacing, Component Patterns, and Design Rules are required.