Files
ai-for-dummies/.agents/skills/design-tokens/SKILL.md
T
Marcos Paulo aae4d42229 docs: add .agents workspace and the Astro refactor plan
Adds the agent-facing workspace and a 20-task plan for migrating the site
to Astro. Nothing here implements the refactor; these are briefs, rules and
templates that the task agents read.

- .agents/ holds context, rules, checklists, skills, specialist agents,
  component/page/config templates and gate scripts. It is vendor-neutral so
  MiniMax, Gemini and Codex can all read it; CLAUDE.md just points at
  AGENTS.md.
- .husky/ plus .lintstagedrc.json wire the three gate tiers. gate.sh locks on
  the shared git-common-dir so parallel worktrees serialise, and guards the
  assertion count in scripts/verify.mjs against a coverage drop.
- plans/astro-refactor/ carries the phase graph, per-task briefs and the
  model-routing recommendation.

These files must be tracked before fanning out: a worktree only checks out
tracked files, so an untracked plan is invisible to every agent working in one.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-05 01:18:27 +00:00

71 lines
2.7 KiB
Markdown

---
name: design-tokens
description: Extract, name, and enforce the design token layer for the ai-for-dummies site. Use when touching any colour, font size, spacing value, or breakpoint, when consolidating the three drifted palettes, or when a check-tokens failure needs resolving.
---
# Design tokens
## Before anything
Read [`../../context/design-system.md`](../../context/design-system.md). This
site has **three drifting palettes** and a **broken `@font-face`**. Both are
traps. If you have not read that file, you will "preserve the styles" by
copying a bug.
## Extracting
```bash
python3 - <<'PY'
import re
files=['styles.css','chapters.css','landing.css','rules/styles.css','skills/styles.css',
'skills-review/styles.css','hands-on/starter/styles.css','hands-on/rules/styles.css']
seen={}
for f in files:
for m in re.finditer(r'--([a-z-]+):\s*([^;}]+)', open(f).read()):
seen.setdefault(m.group(1),{}).setdefault(m.group(2).strip(),[]).append(f)
for k,v in sorted(seen.items()):
print(f"--{k}:")
for val,fs in v.items(): print(f" {val:12} <- {', '.join(fs)}")
PY
```
Re-run this after any consolidation. Every token should print exactly one value.
## Consolidating a drifted token
1. List every value and where it is used (above).
2. Compute the perceptual delta. Sub-perceptual (a few units per channel) →
canonicalize freely. Visible (`--blue`: `#527f9f` vs `#215675`) → screenshot
both, get a human decision, record it in the task file.
3. Pick the canonical value. Prefer the one used on the most-visited surface.
4. Replace, then screenshot every affected page at 560/800/1100/1600 px.
5. Attach before/after images to the task report. "It looked fine to me" is not
evidence.
## Naming
Semantic, matching the existing vocabulary — `--ink`, `--paper`, `--muted`,
`--line`, `--accent`, `--gold`, `--blue`, `--deep`. Never numeric scales. New
surfaces extend semantically: `--surface-lab`, `--ink-inverse`.
## Type scale and breakpoints
Collapse the 14 ad-hoc `clamp()` triples to named steps and the 16 breakpoints
to five, per [`../../rules/theming.md`](../../rules/theming.md). When collapsing
a breakpoint, **screenshot at the old value** — that is where the regression is.
## Enforcing
```bash
node .agents/scripts/check-tokens.mjs # fails on raw hex outside tokens.css
```
Wire it into `npm run verify`. A rule nobody checks is a suggestion.
## The font decision
Do not self-host Manrope/DM Mono as part of a refactor task. The intended fonts
have never rendered, so adopting them is a visual redesign. Default to matching
what renders today (Arial / generic monospace) and delete the dead `@font-face`.
If a human wants the real fonts, that is its own task with its own screenshots.