Skip to content

content: add CSS variables as consistency constraints guide#66

Merged
wilsonwangdev merged 1 commit into
mainfrom
content/css-variable-consistency
May 7, 2026
Merged

content: add CSS variables as consistency constraints guide#66
wilsonwangdev merged 1 commit into
mainfrom
content/css-variable-consistency

Conversation

@wilsonwangdev
Copy link
Copy Markdown
Owner

Document why ad-hoc spacing/color/border values drift across agent-assisted iteration, and how a variable-driven design system turns consistency from a memory problem into a constraint the code enforces.

Changes

Guide contents

  • The drift problem: why bare values produce oscillation across sessions.
  • The constraint pattern: declare the vocabulary once (--space-*, --border-width-*, etc.), forbid bare numbers.
  • What belongs under variables: spacing, color (named by role), radii, border widths, typography steps, transition durations.
  • Brand-constant parallel: the same principle applies to keeping brand/tagline/URLs in one place (e.g., package.json).
  • Typography baseline: GitHub Markdown CSS as a reference point, with a roughly ±15% deviation budget.
  • Incremental adoption path and a minimal review surface.

Why

Content-page UX work this cycle spent several iterations oscillating on spacing because each adjustment was a bare number. The lesson was captured in session memory (feedback_content_page_ux.md) but had not yet become shareable handbook content. Formalizing it here turns the memory into Layer 1 guidance.

Sources

Per the traceability rule: all external claims link to primary sources — GitHub Markdown CSS, MDN on CSS Custom Properties, W3C Design Tokens Community Group.

Tested

npm run build succeeds — 28 pages generated (2 new). Both language pages appear in sitemap.md.

Document why ad-hoc spacing/color/border values drift across iterations
and how a variable-driven design system turns consistency into a
constraint the code enforces. The guide was prompted by multiple rounds
of spacing oscillation on this site's content pages, which memory
captured but the handbook did not yet carry as shareable guidance.

Layer 1 content: universal principles with a reference to GitHub
Markdown CSS as a typography baseline, CSS Custom Properties (MDN),
and the W3C Design Tokens Community Group. No project-specific file
paths or scripts appear in the narrative.

Also mark the item completed in ROADMAP under Next.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented May 7, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
agent-master-handbook Ready Ready Preview, Comment May 7, 2026 3:26pm

@wilsonwangdev wilsonwangdev merged commit e6b6d38 into main May 7, 2026
3 checks passed
@wilsonwangdev wilsonwangdev deleted the content/css-variable-consistency branch May 7, 2026 15:30
wilsonwangdev added a commit that referenced this pull request May 7, 2026
…ules (#67)

Add three rules to AGENTS.md Quality Baseline that encode the
content-page UX lessons captured in session memory
(`feedback_content_page_ux.md`).

## Changes
Three new bullets in the Quality Baseline section:

- Spacing, border-width, and colors must reference `--space-*`,
`--border-*`, and color tokens. Bare `rem`/`px` literals for margin,
padding, gap, or border-width are a review finding. Points at the new
`content/guides/css-variable-consistency/` guide for rationale.
- Adding or changing a divider-style border requires auditing all
existing dividers in the file as a set. Mixed widths (1px vs 2px) or
mixed color tokens (`--border` vs `--border-bright`) count as
inconsistency.
- Dark-theme pages must inline critical `background`/`color` CSS in
`<head>` with a light-mode media-query fallback to prevent FOUC.

## Why
The frontend-interaction-review skill's new Visual consistency group (PR
#65) already encodes these rules. Mirroring them in the Quality Baseline
makes them discoverable during pre-work without requiring the agent to
open the skill file first — most pre-work checks live in AGENTS.md
today.

## Relation to other open PRs
- PR #65 adds the skill-level version of the same rules.
- PR #66 adds the Layer 1 rationale guide.
- This PR (#?) adds the project-specific baseline enforcement. Each
lives in a different file; no rebase coordination needed.

## Tested
`npm run build` succeeds — 26 pages generated. The added guide reference
(`content/guides/css-variable-consistency/en.md`) is correct relative to
merged state once PR #66 lands.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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