Skip to content

refactor(design): fewer, truer rules — MUST only for observable defects - #501

Merged
chaxus merged 6 commits into
mainfrom
feat/design-lessons
Oct 29, 2026
Merged

chaxus merged 6 commits into
mainfrom
feat/design-lessons

Conversation

@chaxus

@chaxus chaxus commented Oct 29, 2026 •

Copy link
Copy Markdown
Owner

What

A review of the whole design standard, prompted by studying pbakaus/impeccable and Motionsites-AI/claude-skill. Direction: keep rules that prevent a defect a user can observe; turn taste and process into starting points an agent may depart from with a reason; fix values that had drifted between copies.

Please review manually; not for auto-merge. Two commits: the first adds lessons from impeccable, the second trims them back after evaluation and fixes drift.

Guide (design/DESIGN.md + Chinese translation, npm guide and plugin copies synced)

  • MUST is only for an observable defect; SHOULD is a starting point, depart from it whenever the work is better for it, and say why.
  • Modes: tools and documents spend expression on precision; a persuading page may commit to one signature idea.
  • Type: leading ≥ 1.5, text a reader needs ≥ 12px, more space above a heading than below (checked on the docs site); text-wrap: balance / pretty; theme browser surfaces (selection, caret, scrollbars, tabular numerals).
  • Decoration is one line: it has to do a job. (The impeccable-style refusal list was removed: a taste list limits agents more than it prevents defects.)
  • Motion: never animate layout properties (was: only transform and opacity); controls don't bounce, a persuading page may spend one expressive moment.
  • Modal rule added under Interaction (the adapter linked to "navigation-layer rules" that did not exist).
  • Process: the written brief is for pages being built or restructured, not every edit; rank findings P0–P3; write fixes as values.

Adapter (packages/ranui/docs/adapters/DESIGN.md, rewritten)

  • Corrected values: radius xs 4 · sm 8 · md 12 · lg 16 · xl 24; link blue-800 (dark #5b9dff); primary hover/active #2a2a2e/#3f3f46 (dark #d4d4d8/#b4b4bb); dark bg-elevated #18181b; added --ran-color-focus.
  • Removed rules owned by CODING.md (hidden, hold what you build, pointer events, closed-root tests), orphan lines, the r-conversation section and the stale "nine rules" count.
  • Kept every rule with a real bug behind it (palette transitions on theme switch, non-flipping fallbacks, undefined var(), z-index on the host, overlay shadow tier, overlay re-measure, wrapper raised only while painting).
  • Process MUSTs → SHOULD. ease-spring / ease-bouncy are a host's expressive choice, never a component default.

Checks

  • verify:design is unchanged from main (9 rules). The gradient-text and overshoot-easing rules added in the first commit were removed: both were taste.
  • design-checklist.spec.ts: measure, leading, minimum text size and heading spacing on 11 key pages at 320px and 1280px.
  • docs.design-tokens.test.ts: now also compares documented values with tokens.less / dark.less in all eight design-system pages (it only checked names, which is how gray-alpha and the focus ring drifted).

Docs site

  • Public design-system and design-guides pages, all eight languages: gray-alpha, dark overrides, focus ring, spacing (24–32px between regions) and motion ranges corrected; intro points at the real sources.
  • Themed ::selection and caret; inline code floors at 12px; playground copy button 12px.
  • CODING.md / CLAUDE.md: dead "DESIGN.md §n" references replaced with anchors; #d9d9d9 advice corrected.

Third commit

  • Reasoned exceptions: a line that breaks a static rule on purpose carries design-ok: <rule> <reason>; no reason, no exception (unit-tested).
  • spacing-scale: the library names its steps as tokens (consumers retune them); elsewhere a step written as 8px is fine. Docs spacing debt drops from 51 to 35.
  • From Don't Make Me Think: count how hard each choice is, not the clicks; self-evident before self-explanatory; clickable looks clickable at rest; accept input as people type it and ask only what the task needs; watch three people try the task.
  • Removed: the home page kickers (they repeated their headings); overshooting easing in checkbox and r-glass; restated rules on the design-guides page in all eight languages (now an explainer that links to the guide and adapter).
  • docs.interface-guidance.test.ts follows the adapter's new spacing section (it failed CI on the second commit).

Later commits

  • Review fixes: restored .search__input:focus-visible (a replacement had broken it); design-ok covers only its own line and needs a worded reason; the value-drift test also checks dark values, every pair in a row, shadows and inline figures (each kind mutation-tested); shift diagnostics name SVG nodes correctly; Windows CRLF fix in a test.
  • From baoyu-design (ideas only, rewritten; its methodology derives from a product system prompt): compare two or three directions in one place before committing; no invented filler content; mixed-script typography; the design skill asks for a reference and asks before adding material. CJK running text on the docs site now has 1.75 leading (was 1.65).
  • The intermittent pages do not shift failure (/ranui/select/, 0.092; 2 of the last 6 runs, also on main) now reports what moved when it fails.

Verification

  • pnpm verify:design (ranui, docs): 9 rules, no new violations; baselines equal main.
  • pnpm verify:docs (design sync, plugin, generated docs, check:langs) and pnpm verify:links: pass.
  • docs.design-tokens.test.ts: 11 passed (fails on main's pages: it caught 11 drifted values per locale).
  • New typography test: 22 passed on Chromium against a docs build from the first commit; the second commit changed no CSS.
  • ranui unit tests: 1763 passed (first commit).
  • Third commit: ranui unit 1774 passed, SSR 77, tsc clean; docs unit 252; full docs build with anchor checks over 1316 pages; 140 docs browser tests on Chromium; home page viewed after removing the kickers.
  • Not independently reviewed by a second agent.

🤖 Generated with Claude Code

…ypography

Studied pbakaus/impeccable (and Motionsites-AI/claude-skill) and kept what
holds up against our own guide.

Guide (design/DESIGN.md, Chinese translation, npm guide, agent plugin copy):
- Name the surface's mode: tools and documents spend expression on
  precision; a persuading page commits to one signature idea.
- Leading at least 1.5, text a reader needs at least 12px, more space
  above a heading than below; balanced headings and pretty paragraphs.
- Browser surfaces (selection, caret, focus, scrollbars, tabular numerals)
  carry the design.
- "Defaults to refuse": a label that repeats its heading, nested cards,
  icon-tile grids, gradient text, glow, decorative glass, ghost cards,
  motion that reports nothing; generic marketing copy.
- Rank findings P0-P3 and write fixes as values, not adjectives.

Checks:
- verify:design gains gradient-text and overshoot-easing (the latter
  enforces the guide's existing "decelerate without overshoot"). Existing
  overshoot in checkbox and r-glass is recorded in the baseline.
- design-checklist.spec checks measure, leading, minimum text size and
  heading spacing on the key pages at 320px and 1280px.

Docs site: themed selection and caret; inline code and the playground's
copy button no longer drop below 12px.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Deploying ran with  Cloudflare Pages  Cloudflare Pages

Latest commit: 490713a
Status: ✅  Deploy successful!
Preview URL: https://5e4737a7.ran-4ty.pages.dev
Branch Preview URL: https://feat-design-lessons.ran-4ty.pages.dev

View logs

The standards had grown more rules than the defects behind them, and the
same rule was restated in several places that no longer agreed.

- Guide: MUST is only for a defect a user can observe; SHOULD is a starting
  point to depart from with a reason. The brief is written down only for
  pages being built or restructured. Animation bans layout properties
  rather than everything but transform and opacity. A modal rule replaces
  the adapter's dead "navigation-layer" link. The "defaults to refuse" list
  becomes one line: decoration has to do a job.
- verify:design: drop gradient-text and overshoot-easing; both were taste,
  and contrast is already a MUST.
- Adapter: correct radius (xs 4, sm 8, xl 24), link (blue-800, dark
  #5b9dff), primary hover/active and dark bg-elevated; drop rules owned by
  CODING.md and orphan lines; process MUSTs become SHOULD; spring and bouncy
  are a host's expressive choice, never a component default.
- CODING.md / CLAUDE.md: replace dead "DESIGN.md §n" references.
- Public design-system and design-guides pages, all eight languages:
  correct gray-alpha, dark overrides, focus ring, spacing and motion values.
  A new test compares the documented values with the theme files.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chaxus chaxus changed the title feat(design): lessons from impeccable — modes, refusals and checked typography refactor(design): fewer, truer rules — MUST only for observable defects Oct 29, 2026
chaxus and others added 4 commits October 29, 2026 11:15
- verify:design: a line that breaks a rule on purpose says so with
  `design-ok: <rule> <reason>`; a missing reason does not count.
  spacing-scale asks the library to name its steps as tokens and everyone
  else only to stay on the 4px scale (the docs baseline drops by 16).
- Guide: from Don't Make Me Think, count how hard each choice is rather
  than how many clicks; self-evident before self-explanatory; anything
  clickable looks clickable at rest; accept input as people type it and ask
  only what the task needs; watch three people try the task and fix the
  worst problem with the smallest change.
- Home page: drop the three kickers that repeated their headings.
- checkbox and r-glass settle on the standard curve instead of overshooting.
- design-guides page, all eight languages: an explainer that links to the
  guide and the adapter instead of restating them (266 to ~165 lines).
- The interface-guidance test follows the adapter's new spacing section.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- docs.interface-guidance read the adapter's spacing section by splitting on
  "\n## ranui spacing\n", which a Windows checkout (CRLF) never matches.
- "pages do not shift while they load" fails on Linux CI for /ranui/select/
  at 0.092, on main since #500 as well, but measures 0.001 locally in every
  order tried. The failure message now lists each shift's elements and
  movement, so the next run says where to look.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ift coverage

From an independent review of this PR:
- docs.css: inserting the selection and caret rules also replaced
  `.search__input:focus-visible {`, leaving a stray descendant selector and
  a duplicate global block. Restored.
- design-ok exceptions: a trailing comment no longer excuses the next line
  (the line above counts only when it holds nothing but a comment), and the
  reason must start with a word, so "design-ok: spacing-scale -" fails.
- The value-drift test now also compares dark values in token rows, every
  token/value pair in a row (the spacing table), light and dark shadows,
  and inline "`--ran-x` (value)" figures; a mutation of each kind is caught.
- The shift report names SVG nodes by their class attribute.
- Adapter: copy's line height is `--ran-line-height` (1.5715), not "1.55".
- Guide: one list again under Visual language; Chinese says 小标签.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…d scripts

Ideas from JimLiu/baoyu-design's design workflow, rewritten in our words
(its methodology is derived from a product system prompt, so no text is
copied):

- Guide: compare two or three directions side by side in one place before
  committing to a new page; don't fill space with invented sections, stats
  or icons; for mixed scripts put Latin first with a CJK or Arabic fallback,
  mark `lang`, give CJK running text 1.7–1.8 leading, pair a Latin serif
  with a CJK serif.
- Design skill: ask for a reference when the direction is open; ask before
  adding sections, pages or copy the request did not include.
- Docs site: Chinese, Japanese and Korean running text gets 1.75 leading
  (was 1.65, the Latin value); headings and English pages are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chaxus
chaxus merged commit 17fd848 into main Oct 29, 2026
24 checks passed
@chaxus
chaxus deleted the feat/design-lessons branch October 29, 2026 05:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant