Skip to main content
Glama
README.md
# Clean-Design

One MCP server for design work. It routes to skills, opens a preview in the browser, lets you click or draw on regions to give feedback, and audits UI code and the rendered page.

It ships with a general taste skill, `clean-design`: a minimalist default, hard bans on AI slop that can be allowed with a reason, evidence-based review, and a phased workflow for large projects.

```
npx clean-design init
```

## What you get

| Area | Tools |
|---|---|
| Skills | `skills_list`, `skills_route`, `skills_load` |
| Preview | `preview_open`, `preview_screenshot`, `preview_console`, `preview_resize` |
| Region feedback | `region_pick`, `region_annotate`, `region_read`, `region_resolve` |
| Tokens | `tokens_generate`, `tokens_export`, `tokens_check_contrast` |
| Audit | `audit_code`, `audit_rendered`, `audit_report` |
| Workflow | `project_start`, `decision_log`, `decisions_read`, `phase_gate` |

One browser is started on the first preview call and shared by preview, feedback and audits.

## Install

Requirements: Node 20 or newer.

```
npx clean-design init
```

This finds the MCP clients installed on your machine and, for each one, registers the server and copies the `clean-design` skill into its skills folder. Supported clients: Claude Code, Factory Droid, Mistral Vibe, Codex CLI, Cursor.

To set up one client only:

```
npx clean-design init claude-code
```

Restart the client afterwards. Ask it to "use the clean-design skill" or to call any of the tools.

### Manual setup

If you prefer to add the server by hand, use a stdio entry:

```json
{
  "mcpServers": {
    "clean-design": {
      "command": "npx",
      "args": ["-y", "clean-design-mcp", "server"]
    }
  }
}
```

## Region feedback

Two ways to point at something on the page.

**Click to pick.** `region_pick` adds a small review bar to the page. Click an element, type a note, press Enter. Repeat for every element you want to change, then press Esc or Done. The agent receives each note with a selector, the visible text and the position on screen.

**Draw.** `region_annotate` adds a drawing layer. Draw a box around a region or an arrow to point at it, then press Esc or Done. The agent receives the shapes with their coordinates.

The agent reads open notes with `region_read` and marks them resolved with `region_resolve`.

## The clean-design skill

The skill lives in [`skills/clean-design`](skills/clean-design/SKILL.md) and follows the [Agent Skills](https://agentskills.io) specification. Its reference files cover:

| File | Contents |
|---|---|
| `bans.md` | The banned patterns, what to do instead, how to allow one |
| `motion.md` | Motion budgets by frequency, durations, easing, reduced motion |
| `typography.md` | Type scale, line length, pairing |
| `color.md` | OKLCH palettes, contrast, dark mode |
| `layout.md` | Spacing scale, grids, width, cards |
| `copy.md` | Interface text, buttons, errors, empty states |
| `review.md` | Review with evidence, severity, fix order |
| `large-projects.md` | The five phases and their gates |
| `mcp-tools.md` | Every tool the server exposes |

### Bans apply unless allowed

The bans are hard by default. If your project uses a banned value on purpose, record it in `clean-design.json` with a reason:

```json
{
  "allow": [
    { "rule": "ban-inter-only", "reason": "Inter is the brand font since 2021." }
  ]
}
```

The audit then reports the hit as "allowed with reason" instead of a finding. An optional `value` limits an allowance to one font or one color.

### Large projects

`project_start` begins a project and returns five phases: Discover, Direction, Build, Review, Handoff. Each phase has checks. `phase_gate` records that the checks were met and names the next phase. It refuses to advance while a check is open, and tells you which ones.

Every decision is logged with `decision_log` and read back with `decisions_read`.

## Configuration

`clean-design.json` in the project root. The server finds it by walking up from the working directory.

```json
{
  "preview": { "headless": false, "viewport": { "width": 1280, "height": 800 } },
  "allow": [],
  "skills": { "dirs": [] },
  "audit": { "ignore": [] }
}
```

| Key | Meaning |
|---|---|
| `preview.headless` | Run the browser without a window. Default `false` |
| `preview.viewport` | Initial viewport size |
| `allow` | Rules that may be broken on purpose, each with a reason |
| `skills.dirs` | Extra folders to index, next to the bundled and client skills |
| `audit.ignore` | Paths to skip, relative to the project root |

The environment variable `CLEAN_DESIGN_HEADLESS=1` also turns the window off.

## Demo

[`demo/`](demo/) is a small page built with the generated tokens.

![The demo page](demo/preview-desktop.png)

To audit it with the server, run `audit_rendered` with the target `demo/src/index.html`. It reports zero findings at 1280px and at 320px.

## Development

```
npm install
npx playwright install chromium
npm test
```

`npm test` builds the project and runs 29 tests: color and token math, the static scanner and its allow-list, the phase gates, the rendered audits, both region feedback modes in a real browser, and the MCP server end to end over stdio.

## Status and limits

- The server indexes skills from the well-known client folders (`~/.claude/skills`, `~/.factory/skills`, `~/.vibe/skills`, `~/.codex/skills`, `~/.cursor/skills`, `~/.agents/skills`). It does not edit the client's own skill list.
- The static scan is a pattern match on source files. It can match a value inside a comment or a string, and it does not resolve CSS variables. The rendered audit is the stronger check, because it reads what the browser computed.
- The rendered audit currently checks text contrast, horizontal overflow and single-font use. It does not yet check focus rings, zoom at 200%, touch target sizes or missing alternative text.
- The following are documented as integrations but are **not wired up** in this version: Handmade, Standby.Design, Design Token Bridge, Design System MCP, shadcn/ui, Storybook MCP and Penpot. Storybook and Penpot run as separate services inside a project and cannot be embedded in this server.

## License

MIT. See [LICENSE](LICENSE). Credits for the ideas and the software this builds on are in [CREDITS.md](CREDITS.md).