Scan and fix Tailwind anti-patterns across the movemental codebase, enforcing DESIGN.md token-first design.
Target: $ARGUMENTS
If no target is provided, scan src/components/ and src/app/(site)/.
Before Starting
- Read
src/app/globals.css — load the token inventory (@theme inline + :root).
- Read
docs/design/DESIGN.md — the authoritative design spec.
- Read
docs/build/prompts/stitch-to-react-migration.md §7 — the Stitch→DESIGN.md translation table.
Scan Checklist
1. HARDCODED COLORS (Critical)
Search for Tailwind color utilities that bypass semantic tokens:
Banned patterns:
bg-white, bg-black → bg-card / bg-inverse-surface
text-white → text-inverse-foreground (only in midnight sections) or text-primary-foreground
text-black → text-foreground
bg-blue-*, text-blue-* → bg-primary / text-primary
bg-gray-*, text-gray-*, bg-slate-*, text-slate-* → semantic tokens
- Arbitrary hex:
bg-[#...], text-[#...], border-[#...]
- Inline rgb/hsl in className or style props
Movemental translation table (from migration prompt §7):
| Anti-pattern |
Replace with |
bg-white, bg-[#ffffff] |
bg-card (on cards) or bg-popover |
bg-[#f7f9fb] |
bg-background |
bg-[#f0f4f7] |
bg-section or bg-muted |
bg-[#e1e9ee] |
bg-elevated or bg-secondary |
bg-[#0053db], bg-blue-600 |
bg-primary |
bg-[#101820], bg-black |
bg-inverse-surface |
text-[#2a3439] |
text-foreground |
text-[#566166], text-gray-500 |
text-muted-foreground |
text-white (on dark sections) |
text-inverse-foreground |
Allowed exceptions:
src/components/ui/* (shadcn primitives — do not touch)
src/app/globals.css (token definitions)
- SVG
fill/stroke using currentColor
- Opacity modifiers on semantic tokens:
bg-primary/10, text-inverse-foreground/55
2. BORDER VIOLATIONS (Critical — DESIGN.md §3.1)
Search for decorative borders used for section separation:
border-b, border-t, divide-y, divide-x between sections → remove and use tonal stacking
- Allowed:
border-border on form inputs, border-primary for accent on quotes/callouts
3. SHADOW VIOLATIONS (High)
shadow-sm, shadow-md, shadow-lg, shadow-xl, shadow-2xl → remove or replace with shadow-ambient
- Only
shadow-ambient (defined in globals.css) or tonal stacking (Ghost Lift)
4. ARBITRARY VALUES (High)
w-[, h-[, p-[, m-[, gap-[ with pixel/rem values → use Tailwind spacing scale
rounded-[ → use rounded-md (matches --radius: 0.375rem)
text-[ with size values → use standard Tailwind scale or Display/Eyebrow primitives
shadow-[ → use shadow-ambient token
Allowed: clamp() for responsive type, calc() for layout math, values in globals.css.
5. RAW HTML INSTEAD OF PRIMITIVES (Medium)
Search for patterns that should use movemental primitives:
<section with manual bg/padding → <Section variant="..."> primitive
<div with max-w-* + mx-auto + px-* → <Container> primitive
- Large bold headings with manual tracking →
<Display size="..."> primitive
- Uppercase small labels →
<Eyebrow> primitive
- Long-form text blocks →
<Prose> primitive
- Cards with shadow + rounded →
<SurfaceCard tone="..."> primitive
- Raw
<button → <Button> from shadcn
6. DARK MODE VIOLATIONS (Medium)
- No
dark: prefixes should exist — movemental is light-primary only
class="dark" on any element → remove (midnight is via Section variant, not class toggle)
text-white outside a variant="midnight" context → text-inverse-foreground inside midnight, or text-primary-foreground on primary backgrounds
7. TAILWIND V4 BEST PRACTICES (Low)
aspect-[4/5] → aspect-4/5 (canonical Tailwind v4)
bg-gradient-to-* → bg-linear-to-* (Tailwind v4)
- Duplicate utility classes
- Conflicting utilities (
p-4 p-6, flex block)
className concatenation without cn() utility
Fixing Protocol
- Fix at the source layer — If a needed token doesn't exist, add it to
globals.css @theme inline first.
- Never modify
src/components/ui/* — These are shadcn primitives.
- Batch similar fixes — If the same anti-pattern appears in multiple files, fix all instances.
- Verify after fixing — Run
pnpm typecheck after changes.
Output Format
## Tailwind Cleanup Report
### Summary
- Files scanned: X
- Violations found: X (Critical: X, High: X, Medium: X, Low: X)
- Auto-fixed: X
- Manual review needed: X
### Violations by Category
#### 1. HARDCODED COLORS — X violations
| File | Line | Violation | Fix |
|------|------|-----------|-----|
#### 2. BORDER VIOLATIONS — X violations
...
[Continue for all categories]
### Files Modified
- path/to/file.tsx — X fixes applied
Rules
- Always scan before fixing. Present the full report first, then apply fixes.
- Group fixes by file to minimize edits.
- Do not touch
src/components/ui/*, globals.css definitions, or Stitch source files in docs/build/stitch/.
- This is a light-primary site. There is NO global dark mode. Midnight is regional via
<Section variant="midnight">.
1---2name: tailwind-cleanup3description: Scan and fix Tailwind anti-patterns for movemental — hardcoded colors, arbitrary values, raw HTML bypassing shadcn/primitives, border violations, and non-semantic tokens. Enforces DESIGN.md token-first design.4---56Scan and fix Tailwind anti-patterns across the movemental codebase, enforcing DESIGN.md token-first design.78Target: $ARGUMENTS910If no target is provided, scan `src/components/` and `src/app/(site)/`.1112## Before Starting13141. Read `src/app/globals.css` — load the token inventory (`@theme inline` + `:root`).152. Read `docs/design/DESIGN.md` — the authoritative design spec.163. Read `docs/build/prompts/stitch-to-react-migration.md` §7 — the Stitch→DESIGN.md translation table.1718## Scan Checklist1920### 1. HARDCODED COLORS (Critical)2122Search for Tailwind color utilities that bypass semantic tokens:2324**Banned patterns:**25- `bg-white`, `bg-black` → `bg-card` / `bg-inverse-surface`26- `text-white` → `text-inverse-foreground` (only in midnight sections) or `text-primary-foreground`27- `text-black` → `text-foreground`28- `bg-blue-*`, `text-blue-*` → `bg-primary` / `text-primary`29- `bg-gray-*`, `text-gray-*`, `bg-slate-*`, `text-slate-*` → semantic tokens30- Arbitrary hex: `bg-[#...]`, `text-[#...]`, `border-[#...]`31- Inline rgb/hsl in className or style props3233**Movemental translation table (from migration prompt §7):**3435| Anti-pattern | Replace with |36|---|---|37| `bg-white`, `bg-[#ffffff]` | `bg-card` (on cards) or `bg-popover` |38| `bg-[#f7f9fb]` | `bg-background` |39| `bg-[#f0f4f7]` | `bg-section` or `bg-muted` |40| `bg-[#e1e9ee]` | `bg-elevated` or `bg-secondary` |41| `bg-[#0053db]`, `bg-blue-600` | `bg-primary` |42| `bg-[#101820]`, `bg-black` | `bg-inverse-surface` |43| `text-[#2a3439]` | `text-foreground` |44| `text-[#566166]`, `text-gray-500` | `text-muted-foreground` |45| `text-white` (on dark sections) | `text-inverse-foreground` |4647**Allowed exceptions:**48- `src/components/ui/*` (shadcn primitives — do not touch)49- `src/app/globals.css` (token definitions)50- SVG `fill`/`stroke` using `currentColor`51- Opacity modifiers on semantic tokens: `bg-primary/10`, `text-inverse-foreground/55`5253### 2. BORDER VIOLATIONS (Critical — DESIGN.md §3.1)5455Search for decorative borders used for section separation:56- `border-b`, `border-t`, `divide-y`, `divide-x` between sections → **remove** and use tonal stacking57- Allowed: `border-border` on form inputs, `border-primary` for accent on quotes/callouts5859### 3. SHADOW VIOLATIONS (High)6061- `shadow-sm`, `shadow-md`, `shadow-lg`, `shadow-xl`, `shadow-2xl` → **remove** or replace with `shadow-ambient`62- Only `shadow-ambient` (defined in globals.css) or tonal stacking (Ghost Lift)6364### 4. ARBITRARY VALUES (High)6566- `w-[`, `h-[`, `p-[`, `m-[`, `gap-[` with pixel/rem values → use Tailwind spacing scale67- `rounded-[` → use `rounded-md` (matches `--radius: 0.375rem`)68- `text-[` with size values → use standard Tailwind scale or Display/Eyebrow primitives69- `shadow-[` → use `shadow-ambient` token7071**Allowed:** `clamp()` for responsive type, `calc()` for layout math, values in `globals.css`.7273### 5. RAW HTML INSTEAD OF PRIMITIVES (Medium)7475Search for patterns that should use movemental primitives:76- `<section` with manual bg/padding → `<Section variant="...">` primitive77- `<div` with `max-w-*` + `mx-auto` + `px-*` → `<Container>` primitive78- Large bold headings with manual tracking → `<Display size="...">` primitive79- Uppercase small labels → `<Eyebrow>` primitive80- Long-form text blocks → `<Prose>` primitive81- Cards with shadow + rounded → `<SurfaceCard tone="...">` primitive82- Raw `<button` → `<Button>` from shadcn8384### 6. DARK MODE VIOLATIONS (Medium)8586- No `dark:` prefixes should exist — movemental is light-primary only87- `class="dark"` on any element → remove (midnight is via Section variant, not class toggle)88- `text-white` outside a `variant="midnight"` context → `text-inverse-foreground` inside midnight, or `text-primary-foreground` on primary backgrounds8990### 7. TAILWIND V4 BEST PRACTICES (Low)9192- `aspect-[4/5]` → `aspect-4/5` (canonical Tailwind v4)93- `bg-gradient-to-*` → `bg-linear-to-*` (Tailwind v4)94- Duplicate utility classes95- Conflicting utilities (`p-4 p-6`, `flex block`)96- `className` concatenation without `cn()` utility9798## Fixing Protocol991001. **Fix at the source layer** — If a needed token doesn't exist, add it to `globals.css` `@theme inline` first.1012. **Never modify `src/components/ui/*`** — These are shadcn primitives.1023. **Batch similar fixes** — If the same anti-pattern appears in multiple files, fix all instances.1034. **Verify after fixing** — Run `pnpm typecheck` after changes.104105## Output Format106107```108## Tailwind Cleanup Report109110### Summary111- Files scanned: X112- Violations found: X (Critical: X, High: X, Medium: X, Low: X)113- Auto-fixed: X114- Manual review needed: X115116### Violations by Category117118#### 1. HARDCODED COLORS — X violations119| File | Line | Violation | Fix |120|------|------|-----------|-----|121122#### 2. BORDER VIOLATIONS — X violations123...124125[Continue for all categories]126127### Files Modified128- path/to/file.tsx — X fixes applied129```130131## Rules132133- Always scan before fixing. Present the full report first, then apply fixes.134- Group fixes by file to minimize edits.135- Do not touch `src/components/ui/*`, `globals.css` definitions, or Stitch source files in `docs/build/stitch/`.136- This is a light-primary site. There is NO global dark mode. Midnight is regional via `<Section variant="midnight">`.