devrites 1.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +24 -0
- package/.claude-plugin/plugin.json +43 -0
- package/CHANGELOG.md +391 -0
- package/LICENSE +56 -0
- package/NOTICE.md +18 -0
- package/README.md +582 -0
- package/SECURITY.md +193 -0
- package/bin/devrites.mjs +100 -0
- package/docs/architecture.md +272 -0
- package/docs/cli-mcp.md +57 -0
- package/docs/command-map.md +143 -0
- package/docs/flow.md +360 -0
- package/docs/release.md +29 -0
- package/docs/skills.md +214 -0
- package/docs/usage.md +325 -0
- package/install.sh +359 -0
- package/mcp/devrites-mcp.mjs +103 -0
- package/pack/.claude/agents/devrites-code-reviewer.md +50 -0
- package/pack/.claude/agents/devrites-doubt-reviewer.md +55 -0
- package/pack/.claude/agents/devrites-frontend-reviewer.md +52 -0
- package/pack/.claude/agents/devrites-performance-reviewer.md +47 -0
- package/pack/.claude/agents/devrites-plan-reviewer.md +79 -0
- package/pack/.claude/agents/devrites-security-auditor.md +53 -0
- package/pack/.claude/agents/devrites-simplifier-reviewer.md +75 -0
- package/pack/.claude/agents/devrites-slice-wright.md +181 -0
- package/pack/.claude/agents/devrites-spec-reviewer.md +72 -0
- package/pack/.claude/agents/devrites-strategy-reviewer.md +62 -0
- package/pack/.claude/agents/devrites-test-analyst.md +47 -0
- package/pack/.claude/hooks/devrites-a1-guard.sh +81 -0
- package/pack/.claude/hooks/devrites-allow.sh +44 -0
- package/pack/.claude/hooks/devrites-cursor.sh +28 -0
- package/pack/.claude/hooks/devrites-orient.sh +53 -0
- package/pack/.claude/hooks/devrites-redwatch.sh +39 -0
- package/pack/.claude/hooks/devrites-refresh-indexes.sh +127 -0
- package/pack/.claude/hooks/devrites-reviewer-readonly.sh +28 -0
- package/pack/.claude/hooks/devrites-statusline.sh +18 -0
- package/pack/.claude/hooks/devrites-stop-gate.sh +45 -0
- package/pack/.claude/hooks/devrites-wright-scope.sh +35 -0
- package/pack/.claude/hooks/hooks.json +52 -0
- package/pack/.claude/rules/README.md +48 -0
- package/pack/.claude/rules/afk-hitl.md +245 -0
- package/pack/.claude/rules/agents.md +98 -0
- package/pack/.claude/rules/anti-patterns.md +48 -0
- package/pack/.claude/rules/code-review.md +38 -0
- package/pack/.claude/rules/coding-style.md +55 -0
- package/pack/.claude/rules/context-hygiene.md +97 -0
- package/pack/.claude/rules/core.md +119 -0
- package/pack/.claude/rules/development-workflow.md +40 -0
- package/pack/.claude/rules/documentation.md +27 -0
- package/pack/.claude/rules/error-handling.md +33 -0
- package/pack/.claude/rules/git-workflow.md +35 -0
- package/pack/.claude/rules/hooks.md +38 -0
- package/pack/.claude/rules/patterns.md +45 -0
- package/pack/.claude/rules/performance.md +27 -0
- package/pack/.claude/rules/prose-style.md +101 -0
- package/pack/.claude/rules/security.md +63 -0
- package/pack/.claude/rules/testing.md +88 -0
- package/pack/.claude/rules/tooling.md +72 -0
- package/pack/.claude/settings.json +53 -0
- package/pack/.claude/skills/devrites-api-interface/SKILL.md +45 -0
- package/pack/.claude/skills/devrites-audit/SKILL.md +73 -0
- package/pack/.claude/skills/devrites-browser-proof/SKILL.md +38 -0
- package/pack/.claude/skills/devrites-debug-recovery/SKILL.md +50 -0
- package/pack/.claude/skills/devrites-debug-recovery/reference/build-the-loop.md +47 -0
- package/pack/.claude/skills/devrites-debug-recovery/reference/cleanup-and-classify.md +17 -0
- package/pack/.claude/skills/devrites-debug-recovery/reference/hypotheses.md +17 -0
- package/pack/.claude/skills/devrites-debug-recovery/reference/instrumentation.md +21 -0
- package/pack/.claude/skills/devrites-debug-recovery/reference/regression-test.md +31 -0
- package/pack/.claude/skills/devrites-doubt/SKILL.md +75 -0
- package/pack/.claude/skills/devrites-frontend-craft/SKILL.md +96 -0
- package/pack/.claude/skills/devrites-frontend-craft/reference/craft.md +59 -0
- package/pack/.claude/skills/devrites-frontend-craft/reference/design-references.md +116 -0
- package/pack/.claude/skills/devrites-frontend-craft/reference/fullstack.md +45 -0
- package/pack/.claude/skills/devrites-frontend-craft/reference/quality-standards.md +215 -0
- package/pack/.claude/skills/devrites-frontend-craft/reference/reuse-first.md +59 -0
- package/pack/.claude/skills/devrites-frontend-craft/reference/shape.md +60 -0
- package/pack/.claude/skills/devrites-interview/SKILL.md +81 -0
- package/pack/.claude/skills/devrites-lib/SKILL.md +76 -0
- package/pack/.claude/skills/devrites-lib/scripts/analyze.sh +78 -0
- package/pack/.claude/skills/devrites-lib/scripts/check-acceptance.sh +75 -0
- package/pack/.claude/skills/devrites-lib/scripts/close-out.sh +47 -0
- package/pack/.claude/skills/devrites-lib/scripts/conventions.py +273 -0
- package/pack/.claude/skills/devrites-lib/scripts/coverage.sh +51 -0
- package/pack/.claude/skills/devrites-lib/scripts/devrites.sh +69 -0
- package/pack/.claude/skills/devrites-lib/scripts/doctor.sh +92 -0
- package/pack/.claude/skills/devrites-lib/scripts/evidence-fresh.sh +63 -0
- package/pack/.claude/skills/devrites-lib/scripts/footprint.sh +45 -0
- package/pack/.claude/skills/devrites-lib/scripts/learnings.sh +74 -0
- package/pack/.claude/skills/devrites-lib/scripts/mutation-gate.sh +52 -0
- package/pack/.claude/skills/devrites-lib/scripts/package-existence.sh +68 -0
- package/pack/.claude/skills/devrites-lib/scripts/preamble.sh +76 -0
- package/pack/.claude/skills/devrites-lib/scripts/progress.sh +103 -0
- package/pack/.claude/skills/devrites-lib/scripts/readiness.sh +62 -0
- package/pack/.claude/skills/devrites-lib/scripts/reconcile.sh +123 -0
- package/pack/.claude/skills/devrites-lib/scripts/resolve.sh +279 -0
- package/pack/.claude/skills/devrites-lib/scripts/stuck.sh +67 -0
- package/pack/.claude/skills/devrites-lib/scripts/test-integrity.sh +87 -0
- package/pack/.claude/skills/devrites-lib/scripts/tick-afk.sh +52 -0
- package/pack/.claude/skills/devrites-prose-craft/SKILL.md +105 -0
- package/pack/.claude/skills/devrites-prose-craft/reference/banned-phrases.md +95 -0
- package/pack/.claude/skills/devrites-prose-craft/reference/examples.md +88 -0
- package/pack/.claude/skills/devrites-prose-craft/reference/structures.md +134 -0
- package/pack/.claude/skills/devrites-refresh-indexes/SKILL.md +54 -0
- package/pack/.claude/skills/devrites-source-driven/SKILL.md +36 -0
- package/pack/.claude/skills/devrites-ux-shape/SKILL.md +121 -0
- package/pack/.claude/skills/devrites-ux-shape/reference/brief-template.md +93 -0
- package/pack/.claude/skills/devrites-ux-shape/reference/visual-direction-probe.md +48 -0
- package/pack/.claude/skills/rite/SKILL.md +135 -0
- package/pack/.claude/skills/rite/reference/menu.md +32 -0
- package/pack/.claude/skills/rite-adopt/SKILL.md +83 -0
- package/pack/.claude/skills/rite-adopt/reference/adoption.md +58 -0
- package/pack/.claude/skills/rite-adopt/reference/anti-patterns.md +19 -0
- package/pack/.claude/skills/rite-autocomplete/SKILL.md +96 -0
- package/pack/.claude/skills/rite-autocomplete/reference/decision-policy.md +35 -0
- package/pack/.claude/skills/rite-autocomplete/reference/loop.md +54 -0
- package/pack/.claude/skills/rite-autocomplete/reference/stop-conditions.md +59 -0
- package/pack/.claude/skills/rite-build/SKILL.md +261 -0
- package/pack/.claude/skills/rite-build/reference/afk-discipline.md +145 -0
- package/pack/.claude/skills/rite-build/reference/anti-patterns.md +25 -0
- package/pack/.claude/skills/rite-build/reference/checkpoint-protocol.md +149 -0
- package/pack/.claude/skills/rite-build/reference/evidence-standard.md +32 -0
- package/pack/.claude/skills/rite-build/reference/frontend-trigger.md +39 -0
- package/pack/.claude/skills/rite-build/reference/one-slice-cycle.md +38 -0
- package/pack/.claude/skills/rite-build/reference/spec-drift-guard.md +43 -0
- package/pack/.claude/skills/rite-build/reference/tdd.md +26 -0
- package/pack/.claude/skills/rite-build/reference/wright-dispatch.md +115 -0
- package/pack/.claude/skills/rite-define/SKILL.md +157 -0
- package/pack/.claude/skills/rite-define/reference/anti-patterns.md +25 -0
- package/pack/.claude/skills/rite-define/reference/gates.md +152 -0
- package/pack/.claude/skills/rite-define/reference/plan-template.md +65 -0
- package/pack/.claude/skills/rite-doctor/SKILL.md +50 -0
- package/pack/.claude/skills/rite-frame/SKILL.md +116 -0
- package/pack/.claude/skills/rite-frame/reference/failure-modes.md +68 -0
- package/pack/.claude/skills/rite-handoff/SKILL.md +95 -0
- package/pack/.claude/skills/rite-handoff/reference/handoff-template.md +34 -0
- package/pack/.claude/skills/rite-learn/SKILL.md +82 -0
- package/pack/.claude/skills/rite-plan/SKILL.md +82 -0
- package/pack/.claude/skills/rite-plan/reference/anti-patterns.md +24 -0
- package/pack/.claude/skills/rite-plan/reference/dependency-graph.md +33 -0
- package/pack/.claude/skills/rite-plan/reference/replan-and-repair.md +42 -0
- package/pack/.claude/skills/rite-plan/reference/slicing.md +52 -0
- package/pack/.claude/skills/rite-plan/reference/task-breakdown.md +34 -0
- package/pack/.claude/skills/rite-polish/SKILL.md +90 -0
- package/pack/.claude/skills/rite-polish/reference/anti-ai-slop.md +177 -0
- package/pack/.claude/skills/rite-polish/reference/anti-patterns.md +27 -0
- package/pack/.claude/skills/rite-polish/reference/backend-polish.md +80 -0
- package/pack/.claude/skills/rite-polish/reference/browser-polish-evidence.md +31 -0
- package/pack/.claude/skills/rite-polish/reference/code.md +85 -0
- package/pack/.claude/skills/rite-polish/reference/design-system-discovery.md +35 -0
- package/pack/.claude/skills/rite-polish/reference/harden-checklist.md +109 -0
- package/pack/.claude/skills/rite-polish/reference/ui.md +136 -0
- package/pack/.claude/skills/rite-pressure-test/SKILL.md +43 -0
- package/pack/.claude/skills/rite-prototype/SKILL.md +87 -0
- package/pack/.claude/skills/rite-prove/SKILL.md +120 -0
- package/pack/.claude/skills/rite-prove/reference/anti-patterns.md +25 -0
- package/pack/.claude/skills/rite-prove/reference/browser-proof.md +26 -0
- package/pack/.claude/skills/rite-prove/reference/failure-triage.md +25 -0
- package/pack/.claude/skills/rite-prove/reference/proof-ladder.md +26 -0
- package/pack/.claude/skills/rite-prove/reference/test-command-discovery.md +30 -0
- package/pack/.claude/skills/rite-quick/SKILL.md +81 -0
- package/pack/.claude/skills/rite-resolve/SKILL.md +113 -0
- package/pack/.claude/skills/rite-resolve/reference/answer-protocol.md +114 -0
- package/pack/.claude/skills/rite-review/SKILL.md +170 -0
- package/pack/.claude/skills/rite-review/reference/anti-patterns.md +32 -0
- package/pack/.claude/skills/rite-review/reference/cognitive-load.md +90 -0
- package/pack/.claude/skills/rite-review/reference/feature-scoped-review.md +26 -0
- package/pack/.claude/skills/rite-review/reference/five-axis-review.md +46 -0
- package/pack/.claude/skills/rite-review/reference/nielsen-heuristics.md +130 -0
- package/pack/.claude/skills/rite-review/reference/parallel-dispatch.md +62 -0
- package/pack/.claude/skills/rite-review/reference/performance-review.md +28 -0
- package/pack/.claude/skills/rite-review/reference/security-review.md +32 -0
- package/pack/.claude/skills/rite-seal/SKILL.md +183 -0
- package/pack/.claude/skills/rite-seal/reference/anti-patterns.md +27 -0
- package/pack/.claude/skills/rite-seal/reference/conventions-ledger.md +63 -0
- package/pack/.claude/skills/rite-seal/reference/final-evidence.md +72 -0
- package/pack/.claude/skills/rite-seal/reference/go-no-go.md +37 -0
- package/pack/.claude/skills/rite-seal/reference/parallel-dispatch.md +69 -0
- package/pack/.claude/skills/rite-seal/reference/risk-and-rollback.md +30 -0
- package/pack/.claude/skills/rite-seal/reference/seal-template.md +36 -0
- package/pack/.claude/skills/rite-ship/SKILL.md +120 -0
- package/pack/.claude/skills/rite-ship/reference/anti-patterns.md +25 -0
- package/pack/.claude/skills/rite-ship/reference/close-out.md +31 -0
- package/pack/.claude/skills/rite-ship/reference/design-memory.md +120 -0
- package/pack/.claude/skills/rite-ship/reference/git-ship.md +42 -0
- package/pack/.claude/skills/rite-ship/reference/ship-template.md +33 -0
- package/pack/.claude/skills/rite-spec/SKILL.md +126 -0
- package/pack/.claude/skills/rite-spec/reference/acceptance-criteria.md +31 -0
- package/pack/.claude/skills/rite-spec/reference/anti-patterns.md +25 -0
- package/pack/.claude/skills/rite-spec/reference/interview-patterns.md +56 -0
- package/pack/.claude/skills/rite-spec/reference/investigation.md +64 -0
- package/pack/.claude/skills/rite-spec/reference/question-protocol.md +61 -0
- package/pack/.claude/skills/rite-spec/reference/references-intake.md +57 -0
- package/pack/.claude/skills/rite-spec/reference/spec-checklists.md +73 -0
- package/pack/.claude/skills/rite-spec/reference/spec-template.md +124 -0
- package/pack/.claude/skills/rite-spec/reference/state-workspace.md +159 -0
- package/pack/.claude/skills/rite-status/SKILL.md +101 -0
- package/pack/.claude/skills/rite-temper/SKILL.md +119 -0
- package/pack/.claude/skills/rite-temper/reference/anti-patterns.md +29 -0
- package/pack/.claude/skills/rite-temper/reference/review-dimensions.md +65 -0
- package/pack/.claude/skills/rite-temper/reference/scope-modes.md +53 -0
- package/pack/.claude/skills/rite-temper/reference/significance.md +46 -0
- package/pack/.claude/skills/rite-temper/reference/strategy-template.md +90 -0
- package/pack/.claude/skills/rite-vet/SKILL.md +155 -0
- package/pack/.claude/skills/rite-vet/reference/anti-patterns.md +29 -0
- package/pack/.claude/skills/rite-vet/reference/artifacts.md +135 -0
- package/pack/.claude/skills/rite-vet/reference/cross-model.md +41 -0
- package/pack/.claude/skills/rite-vet/reference/depth.md +53 -0
- package/pack/.claude/skills/rite-vet/reference/eng-lenses.md +48 -0
- package/pack/.claude/skills/rite-vet/reference/review-axes.md +167 -0
- package/pack/.claude/skills/rite-zoom-out/SKILL.md +75 -0
- package/package.json +68 -0
- package/scripts/build-release-tarball.sh +74 -0
- package/scripts/check-cross-refs.py +121 -0
- package/scripts/check-no-global-writes.sh +44 -0
- package/scripts/check-rule-uniqueness.sh +73 -0
- package/scripts/devrites-detect.sh +175 -0
- package/scripts/eval-runner.py +273 -0
- package/scripts/grade-feature.sh +104 -0
- package/scripts/install-lib.sh +83 -0
- package/scripts/pin.sh +166 -0
- package/scripts/render-eval-summary.py +48 -0
- package/scripts/run-evals.sh +149 -0
- package/scripts/run-outcome-evals.sh +49 -0
- package/scripts/scan-pack-security.py +209 -0
- package/scripts/scan-supply-chain-iocs.py +127 -0
- package/scripts/supply-chain-iocs.json +11 -0
- package/scripts/sync-version.sh +56 -0
- package/scripts/validate-frontmatter.py +149 -0
- package/scripts/validate-workflow-security.py +86 -0
- package/scripts/validate.sh +234 -0
- package/uninstall.sh +137 -0
- package/update.sh +196 -0
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: devrites-frontend-craft
|
|
3
|
+
description: Implement frontend at senior designer-engineer quality — every state covered, anti-AI-slop, WCAG 2.2 AA. Use when the user says "build the UI", "ship-quality frontend", "design system", "a11y", or `/rite-build` detects UI. Not for polishing a built feature or design exploration.
|
|
4
|
+
user-invocable: false
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# devrites-frontend-craft — UI like a senior designer-engineer
|
|
8
|
+
|
|
9
|
+
Build UI that belongs in *this* product, handles every state, and avoids generic-AI
|
|
10
|
+
tells. Integrated into the feature slice, not a separate design project.
|
|
11
|
+
|
|
12
|
+
## 1. Foundation discovery
|
|
13
|
+
Framework, routing, components, tokens, CSS methodology, icon set, existing UI patterns,
|
|
14
|
+
and any `PRODUCT.md` / `DESIGN.md` / design docs. Use the project's system — don't
|
|
15
|
+
import a new one. (Detail: `reference/design-references.md`.)
|
|
16
|
+
- **Load the design brief + references the spec gathered** —
|
|
17
|
+
`.devrites/work/<slug>/design-brief.md` (the UX/UI contract from `devrites-ux-shape` — the
|
|
18
|
+
primary build target) plus `references.md` + the saved files in `references/`
|
|
19
|
+
(screenshots, Figma, video, links). When present they are the **build target**: match the
|
|
20
|
+
direction, layout, spacing, states, and behavior they show (pull Figma context if a Figma
|
|
21
|
+
integration is available) — extract type / spacing / color-roles / layout / component
|
|
22
|
+
behavior to it deliberately, don't eyeball it
|
|
23
|
+
(`reference/design-references.md` — *Building to a supplied reference*). A reference that
|
|
24
|
+
conflicts with the design system is a question for the user, not a silent choice.
|
|
25
|
+
|
|
26
|
+
## Reuse first — search before you build
|
|
27
|
+
Before creating any new component, style, token, icon, hook, util, or helper, search the
|
|
28
|
+
project for an existing one and **reuse → extend → build new** — see
|
|
29
|
+
[reference/reuse-first.md](reference/reuse-first.md) for the search targets, the AHA
|
|
30
|
+
caveat, and the per-slice reuse record.
|
|
31
|
+
|
|
32
|
+
## 2. Register detection
|
|
33
|
+
- **Brand surface** — landing, marketing, portfolio, campaign: expressive type, larger
|
|
34
|
+
scale contrast, motion welcome.
|
|
35
|
+
- **Product surface** — dashboard, admin, settings, app UI, tools: system fonts
|
|
36
|
+
legitimate, one family often enough, fixed rem scale, tight ratio, density is fine.
|
|
37
|
+
|
|
38
|
+
## 3. Shape before code — build to the brief ([reference/shape.md](reference/shape.md))
|
|
39
|
+
The feature's **`design-brief.md`** is your target — `/rite-spec` shaped it up front
|
|
40
|
+
(`devrites-ux-shape`): design direction, key states, interaction model, the visual-direction
|
|
41
|
+
probe. **Read it first and refine it for this slice's surface; don't re-derive the design
|
|
42
|
+
from scratch.** Confirm the slice covers the brief's states for this surface (default,
|
|
43
|
+
loading, empty, error, success, disabled, long-content), its information hierarchy +
|
|
44
|
+
primary action, responsive behavior, a11y, and interaction model. **If a UI slice has no
|
|
45
|
+
`design-brief.md`** (a spec written before shaping), shape it now via `devrites-ux-shape`
|
|
46
|
+
before coding. **Ask before coding if the visual direction or UX flow is still ambiguous.**
|
|
47
|
+
|
|
48
|
+
## 4. Build ([reference/craft.md](reference/craft.md))
|
|
49
|
+
- Compose from existing components/tokens (reuse-first, above) before reaching for new code.
|
|
50
|
+
- Build the **smallest UI** the current slice needs — don't pre-build screens.
|
|
51
|
+
- Don't add a second component library or icon set without asking.
|
|
52
|
+
- Cover the states you shaped, not just the happy path.
|
|
53
|
+
- **Reduce cognitive load** — no wall of options: group, mark the recommended choice, use
|
|
54
|
+
progressive disclosure.
|
|
55
|
+
- **Copy in the product's voice**; shift tone by moment — success brief, error empathetic
|
|
56
|
+
+ actionable, loading reassuring, destructive serious. Never humor in errors. Empty
|
|
57
|
+
states say *why* + the next action.
|
|
58
|
+
- **First-use**: get the user to first value fast; onboarding proves worth, it doesn't
|
|
59
|
+
teach the whole product.
|
|
60
|
+
|
|
61
|
+
## 5. Verify & record (meet the bar)
|
|
62
|
+
- Hit the [2026 quality bar](reference/quality-standards.md): Core Web Vitals
|
|
63
|
+
(LCP ≤2.5s / INP ≤200ms / CLS ≤0.1), WCAG 2.2 AA (keyboard, visible focus, contrast,
|
|
64
|
+
≥24px targets / 44px touch, no drag-only), responsive at 320/768/1024/1440 — and run
|
|
65
|
+
its verification gate (no console errors, no axe violations, all states).
|
|
66
|
+
- Verify in the browser (`devrites-browser-proof`) — screenshots opened and described,
|
|
67
|
+
console clean, responsive + keyboard checked.
|
|
68
|
+
- **Every interactive element has an asserting test at the right level** — each field,
|
|
69
|
+
checkbox, radio, select, toggle, button, and actionable link gets a unit/component test for
|
|
70
|
+
what it *does* (validation, toggle, options, enabled/disabled, handler); critical journeys
|
|
71
|
+
get one E2E. Browser proof shows it renders; the asserting test proves it works. No element
|
|
72
|
+
ships unverified — `rules/testing.md` "Completeness"; inventory in `test-plan.md`.
|
|
73
|
+
- **Append build-time refinements** to `.devrites/work/<slug>/design-brief.md` — the
|
|
74
|
+
design-contract artifact `devrites-ux-shape` produced at spec; this skill refines it per
|
|
75
|
+
slice (the "Build-time refinements" section), it does not own or recreate it. `/rite-polish`
|
|
76
|
+
reads it in its UI phase and `/rite-seal` includes it in its artifact read list. Record
|
|
77
|
+
runtime evidence in `browser-evidence.md`.
|
|
78
|
+
|
|
79
|
+
## Fullstack (frontend + backend in one feature)
|
|
80
|
+
When the feature needs both sides, follow [reference/fullstack.md](reference/fullstack.md):
|
|
81
|
+
define the **API/data contract first** (`devrites-api-interface`), slice **vertically**
|
|
82
|
+
through the layers (DB → service → API → UI) one capability at a time, apply the
|
|
83
|
+
engineering rules to the backend and this craft to the frontend, map every contract error
|
|
84
|
+
to a real UI state, and **prove both layers** (contract tests + browser proof).
|
|
85
|
+
|
|
86
|
+
## Anti-AI-slop (banned defaults unless the project's system uses them)
|
|
87
|
+
Purple/blue gradients · gradient text · glassmorphism by default · cards-in-cards ·
|
|
88
|
+
identical card grids everywhere · rounded-square icon tile above every heading ·
|
|
89
|
+
gray-on-color text · hero-metric cliché · decorative bounce/elastic easing · random
|
|
90
|
+
Inter-for-everything · modal-first thinking. Full list + rationale:
|
|
91
|
+
`rite-polish/reference/anti-ai-slop.md`.
|
|
92
|
+
|
|
93
|
+
## Default vs departure
|
|
94
|
+
Preserve the existing identity (default, ~90%). Reject it only on an explicit signal (a
|
|
95
|
+
design doc naming *this* surface as the failure, or the user asking to rebuild). If
|
|
96
|
+
unsure, you're in default mode — the cost of a wrong departure is unrecoverable.
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# Craft — build the UI
|
|
2
|
+
|
|
3
|
+
With the shape decided and the system discovered, build the smallest correct UI for the
|
|
4
|
+
slice. Quality is in the details and the states, not in novelty. If the brief names a
|
|
5
|
+
supplied Figma / screenshot / image as the build target, extract to it first — type,
|
|
6
|
+
spacing, color roles, layout, component behavior (`design-references.md` — *Building to a
|
|
7
|
+
supplied reference*).
|
|
8
|
+
|
|
9
|
+
## Build order
|
|
10
|
+
1. **Structure** — semantic markup that expresses the hierarchy from the shape note.
|
|
11
|
+
2. **Compose from the system** — use existing shared components and tokens. If a needed
|
|
12
|
+
component doesn't exist, build it in the project's style (don't import a new library
|
|
13
|
+
without asking).
|
|
14
|
+
3. **State coverage** — wire up every state you shaped (loading/empty/error/success/
|
|
15
|
+
disabled/long-content), not just the populated happy path.
|
|
16
|
+
4. **Interaction** — feedback on every action; focus management; keyboard support;
|
|
17
|
+
sensible defaults (Enter submits, Esc closes, etc.).
|
|
18
|
+
5. **Responsive** — verify the reflow at the target viewports.
|
|
19
|
+
|
|
20
|
+
## Use the system, don't fight it
|
|
21
|
+
- Tokens for spacing/color/type — never hard-code a value a token covers.
|
|
22
|
+
- Match the nearest neighbor's patterns for forms, buttons, menus, toasts.
|
|
23
|
+
- One icon set (the project's). Consistent sizing/alignment.
|
|
24
|
+
|
|
25
|
+
## Smallest UI for the slice
|
|
26
|
+
Build what *this* slice needs. Don't scaffold future screens, settings, or variations
|
|
27
|
+
"while you're here" — that's scope creep and it dodges its own review.
|
|
28
|
+
|
|
29
|
+
## Quality tells (the difference between fine and crafted)
|
|
30
|
+
- The primary action is unmistakable.
|
|
31
|
+
- Empty states teach the next step; error states offer recovery.
|
|
32
|
+
- Spacing reads as deliberate; alignment holds at every breakpoint.
|
|
33
|
+
- Copy is in the product's voice, specific, and short.
|
|
34
|
+
- No console noise; no layout shift.
|
|
35
|
+
|
|
36
|
+
## Avoid the slop
|
|
37
|
+
Don't reach for the banned defaults (`rite-polish/reference/anti-ai-slop.md`). If the
|
|
38
|
+
project genuinely uses one, follow the project — consistency wins.
|
|
39
|
+
|
|
40
|
+
## Record
|
|
41
|
+
Append slice build-time refinements → `design-brief.md` (the brief `devrites-ux-shape`
|
|
42
|
+
produced at spec; refine it, don't recreate it). Then verify in the browser
|
|
43
|
+
(`devrites-browser-proof`) and record evidence before claiming the UI works.
|
|
44
|
+
|
|
45
|
+
## NEVER (craft)
|
|
46
|
+
|
|
47
|
+
- Never hard-code a value a token covers (color, spacing, type, radius,
|
|
48
|
+
shadow). If the token is missing, ask before adding one.
|
|
49
|
+
- Never import a new component library or icon set without asking — the
|
|
50
|
+
project has one already.
|
|
51
|
+
- Never ship only the populated state. The full state set (loading / empty
|
|
52
|
+
/ error / success / disabled / long-content) is the minimum.
|
|
53
|
+
- Never animate as decoration. Motion is feedback or a focus shift, not
|
|
54
|
+
jewellery.
|
|
55
|
+
- Never use raw `#000` / `#fff`, viewport queries for component-internal
|
|
56
|
+
reflows, or raw `z-index` numbers outside the semantic scale
|
|
57
|
+
(`quality-standards.md` — Numerical bar).
|
|
58
|
+
- Never write `console.log` or leave commented-out code in shipped UI.
|
|
59
|
+
- Never scaffold "future screens" — out of slice scope.
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
# Design references — discover, don't impose
|
|
2
|
+
|
|
3
|
+
What to read in the project before designing, and how register changes the rules.
|
|
4
|
+
|
|
5
|
+
## Discover these
|
|
6
|
+
| Thing | Where |
|
|
7
|
+
|---|---|
|
|
8
|
+
| Design docs | `PRODUCT.md`, `DESIGN.md`, `docs/design/*`, Storybook, READMEs |
|
|
9
|
+
| Tokens | `tailwind.config.*`, CSS custom properties, `theme.*`, token files |
|
|
10
|
+
| Shared components | components/ui dir, design-system package, what neighbors import |
|
|
11
|
+
| Type | families, weights, the size scale actually in use |
|
|
12
|
+
| Spacing | the spacing scale / tokens in use |
|
|
13
|
+
| Color roles | semantic names (primary/surface/muted/danger), not raw hex |
|
|
14
|
+
| Icons | the one icon library already imported |
|
|
15
|
+
| Patterns | how existing buttons/menus/dialogs/forms/toasts behave |
|
|
16
|
+
| Neighbors | the closest existing feature — match its flow shape |
|
|
17
|
+
|
|
18
|
+
## Register-specific rules
|
|
19
|
+
**Product surface** (dashboard/admin/app):
|
|
20
|
+
- System fonts are legitimate (`-apple-system, BlinkMacSystemFont, "Segoe UI",
|
|
21
|
+
system-ui, sans-serif`); Inter is a fine default for a reason.
|
|
22
|
+
- One family usually carries headings, body, labels, data.
|
|
23
|
+
- Fixed rem scale (not fluid `clamp()` headings); tighter ratio (1.125–1.2).
|
|
24
|
+
- Density is a feature; tables can run dense; prose still ~65–75ch.
|
|
25
|
+
|
|
26
|
+
**Brand surface** (landing/marketing/campaign):
|
|
27
|
+
- More expressive type and larger scale contrast are appropriate.
|
|
28
|
+
- Display/body pairing can be worth it; motion is welcome (still purposeful).
|
|
29
|
+
|
|
30
|
+
## The rule
|
|
31
|
+
Match what exists. A new token, font, or component library is a decision the user makes,
|
|
32
|
+
not a default you reach for. When the system is ambiguous, ask — don't invent the
|
|
33
|
+
project's intent. When a project `DESIGN.md` is present it is the **rolled-up design
|
|
34
|
+
memory** earlier features sealed (`../../rite-ship/reference/design-memory.md`) — the
|
|
35
|
+
inherited system to build *to*, ahead of re-deriving direction from scratch.
|
|
36
|
+
|
|
37
|
+
## Scene-sentence — commit before choosing theme / direction
|
|
38
|
+
Dark vs light is not a default, and neither is "playful", "serious", or "editorial".
|
|
39
|
+
Before picking any of those, write **one sentence** that fixes the physical scene:
|
|
40
|
+
|
|
41
|
+
> *who* uses this, *where*, under *what ambient light / device*, in *what mood*.
|
|
42
|
+
|
|
43
|
+
If that sentence doesn't make the answer feel inevitable, it isn't concrete enough —
|
|
44
|
+
add detail until it does. Then design *for that scene*, not for the category.
|
|
45
|
+
|
|
46
|
+
Examples:
|
|
47
|
+
- ❌ "An observability dashboard" → forces nothing; "dark blue tech" is the reflex.
|
|
48
|
+
- ✅ "An on-call SRE glancing at incident severity at 2am on a 27-inch monitor in a
|
|
49
|
+
dim room" → forces dark, high-contrast severity colours, scannable rows.
|
|
50
|
+
- ❌ "A finance app" → forces nothing; "navy + gold" is the reflex.
|
|
51
|
+
- ✅ "A self-employed designer reconciling last month's invoices at a kitchen table
|
|
52
|
+
in afternoon light, on a 13-inch laptop" → forces a calm light theme with one
|
|
53
|
+
committed accent for the running total.
|
|
54
|
+
|
|
55
|
+
Run the sentence, not the category. When the user supplies the brief, paraphrase the
|
|
56
|
+
sentence back to them as confirmation before designing.
|
|
57
|
+
|
|
58
|
+
## Named anchor references — steer with specifics, not adjectives
|
|
59
|
+
After the scene sentence, name **2-3 specific anchors** the surface should feel like —
|
|
60
|
+
real products, brands, or objects ("Linear's command bar", "a Teenage Engineering device",
|
|
61
|
+
"the Stripe dashboard"), **not adjectives** ("modern", "clean", "premium"). Adjectives are
|
|
62
|
+
unfalsifiable; a named anchor is checkable — you can hold the built UI next to it and ask
|
|
63
|
+
"does it read like that?" Anchors steer *direction*, not pixel-copying: take the relevant
|
|
64
|
+
trait (density, type voice, restraint), not the literal layout, and never the parts that
|
|
65
|
+
clash with this project's register or design system. The supplied `references/` files are
|
|
66
|
+
themselves anchors — name what trait each contributes. Record the anchors in
|
|
67
|
+
`design-brief.md`'s **Design direction** so build, polish, and seal share the same target.
|
|
68
|
+
|
|
69
|
+
## Building to a supplied reference (Figma / screenshot / image)
|
|
70
|
+
When the spec gathered a Figma frame, screenshot, or image and the brief names it the
|
|
71
|
+
**build target** (not just inspiration), the reference *is* the art direction and the code
|
|
72
|
+
is the implementation layer. This is the build-time counterpart to the shape-time
|
|
73
|
+
visual-direction probe (`../../devrites-ux-shape/reference/visual-direction-probe.md`):
|
|
74
|
+
the probe *chose* a lane; here you *match* the chosen target.
|
|
75
|
+
|
|
76
|
+
**Extract before you write** — read the reference deliberately, don't eyeball it:
|
|
77
|
+
- **Type** — family, the size steps actually used, weights, line-height, letter-spacing,
|
|
78
|
+
the heading→body ratio. Map each to the project's type scale (or flag a missing step).
|
|
79
|
+
- **Spacing & rhythm** — padding, gaps, section spacing; infer the underlying step and
|
|
80
|
+
round to the project's 4 pt scale rather than hard-coding the measured pixel.
|
|
81
|
+
- **Color** — the roles in play (surface / text / accent / border), not raw hex; bind to
|
|
82
|
+
existing tokens, propose a token only where one is genuinely missing.
|
|
83
|
+
- **Layout & hierarchy** — grid, what's seen 1st / 2nd / 3rd, the density and motion the
|
|
84
|
+
reference implies (cross-check against the brief's Calibration).
|
|
85
|
+
- **Component behavior** — the states the reference shows (and the ones it can't: hover,
|
|
86
|
+
focus, loading, empty, error — design those from the brief, the reference won't have them).
|
|
87
|
+
|
|
88
|
+
Then implement to match, in the project's system:
|
|
89
|
+
- **Match the target, fill the gaps from the brief.** A static reference shows one state;
|
|
90
|
+
ship the full state set (`quality-standards.md` — Focus & states).
|
|
91
|
+
- **A reference that conflicts with the design system is a question for the user**, not a
|
|
92
|
+
silent override — name the conflict (token, font, spacing, a second system) and ask.
|
|
93
|
+
- **Don't crop a multi-section reference into pieces** to "extract" a section — work from
|
|
94
|
+
the cleanest whole frame; if a region is unreadable, ask for a clearer asset rather than
|
|
95
|
+
guessing.
|
|
96
|
+
- **Fidelity is faithfulness, not pixel-tracing** — carry the reference's hierarchy, rhythm,
|
|
97
|
+
and voice; never copy a layout that clashes with this project's register or a11y floor.
|
|
98
|
+
- Record what the reference dictated (and any deviation + why) in the brief's
|
|
99
|
+
**Build-time refinements**, so polish and seal check the build against the same target.
|
|
100
|
+
|
|
101
|
+
## NEVER (design references)
|
|
102
|
+
|
|
103
|
+
- Never default to **Inter / DM Sans / Plus Jakarta / Fraunces / Newsreader**
|
|
104
|
+
because they're the "tasteful 2024 default". Use what the project uses.
|
|
105
|
+
- Never default to a **purple/blue gradient** when the project has a brand
|
|
106
|
+
palette.
|
|
107
|
+
- Never pick a tone (playful / serious / corporate / hand-drawn) that
|
|
108
|
+
contradicts the surface's **register** — brand vs product
|
|
109
|
+
(`devrites-frontend-craft/SKILL.md` §2).
|
|
110
|
+
- Never add a second design system to "modernize" without explicit user
|
|
111
|
+
approval. One design system per project; consistency beats local taste.
|
|
112
|
+
- Never invent a token. If a needed color/spacing/type slot doesn't exist,
|
|
113
|
+
ask whether to add it to the system.
|
|
114
|
+
- Never use a screenshot of another product as a target without checking
|
|
115
|
+
the *register* matches. A landing page reference is not a product UI
|
|
116
|
+
reference.
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Fullstack work (frontend + backend together)
|
|
2
|
+
|
|
3
|
+
Most UI features also need backend. Don't build the two sides blind to each other, and
|
|
4
|
+
don't build "all backend, then all frontend" — that hides integration risk until the end.
|
|
5
|
+
|
|
6
|
+
## Contract first
|
|
7
|
+
Define the **API / data contract** before either side codes against it — shape, field
|
|
8
|
+
types + units, status codes, **error bodies**, pagination, idempotency. Use
|
|
9
|
+
`devrites-api-interface`; doubt it with `devrites-doubt` before standing it. With the
|
|
10
|
+
contract fixed:
|
|
11
|
+
- the **backend** slice can land against it (consumer stubbed),
|
|
12
|
+
- the **frontend** slice can build against a mock or the real contract.
|
|
13
|
+
Neither side blocks the other, and the seam stays stable.
|
|
14
|
+
|
|
15
|
+
## Slice vertically through the layers
|
|
16
|
+
Each slice cuts **one capability** end-to-end — data/model → service → API → UI — and
|
|
17
|
+
leaves a **working, demoable path**. "Create item" is a slice (persist + endpoint +
|
|
18
|
+
minimal form); "all the models" is not. Order by dependency; the first slice is the
|
|
19
|
+
thinnest end-to-end path so integration surprises surface early and cheap.
|
|
20
|
+
|
|
21
|
+
## Apply the right discipline to each layer
|
|
22
|
+
- **Backend part** → the engineering rules: validate untrusted input at the boundary,
|
|
23
|
+
authz on every sensitive action, parameterized queries, fail closed, no secrets in
|
|
24
|
+
logs (`security.md`); fail-fast errors with meaningful messages (`error-handling.md`);
|
|
25
|
+
measure-first performance (no N+1) (`performance.md`).
|
|
26
|
+
- **Frontend part** → frontend craft: shape (all states), the design system, and the
|
|
27
|
+
2026 [quality-standards](quality-standards.md) (CWV, WCAG 2.2, responsive, motion).
|
|
28
|
+
- Map the API's error/edge responses to **real UI states** — every error the contract can
|
|
29
|
+
return needs a handled, helpful UI state, not a blank screen.
|
|
30
|
+
|
|
31
|
+
## Placement spans both sides
|
|
32
|
+
The investigation's placement analysis covers **where the backend logic lives** *and*
|
|
33
|
+
**where the UI component lives**, plus the contract that joins them — so each side is
|
|
34
|
+
correctly placed, not bolted on.
|
|
35
|
+
|
|
36
|
+
## Prove BOTH layers
|
|
37
|
+
A fullstack slice is proven only when both sides have evidence:
|
|
38
|
+
- backend/contract: tests for the endpoint + its error/edge cases (and a real
|
|
39
|
+
request/response observation);
|
|
40
|
+
- frontend: browser proof (states exercised, console clean, responsive, a11y).
|
|
41
|
+
If only one side is proven, the slice is **not** done.
|
|
42
|
+
|
|
43
|
+
## Keep them in sync
|
|
44
|
+
A change to the contract after both sides exist is a **Spec Drift Guard** event — it
|
|
45
|
+
affects FE and BE together. Stop, record it, re-plan the contract, then update both sides.
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
# Frontend quality standards (2026)
|
|
2
|
+
|
|
3
|
+
The measurable bar UI work is held to. Project conventions win where they're stricter;
|
|
4
|
+
these are the floor, not the ceiling.
|
|
5
|
+
|
|
6
|
+
## Performance — Core Web Vitals (field/p75 targets)
|
|
7
|
+
- **LCP** (Largest Contentful Paint) ≤ **2.5 s**
|
|
8
|
+
- **INP** (Interaction to Next Paint — the current responsiveness metric, replaced FID)
|
|
9
|
+
≤ **200 ms**
|
|
10
|
+
- **CLS** (Cumulative Layout Shift) ≤ **0.1**
|
|
11
|
+
- Keep an interactive page's shipped JS lean (a budget around **≤400 KB gzipped** is a
|
|
12
|
+
good default); lazy-load below-the-fold and heavy/optional code; minimize hydration;
|
|
13
|
+
size and reserve space for images/media to avoid layout shift.
|
|
14
|
+
|
|
15
|
+
## Accessibility — WCAG 2.2 AA
|
|
16
|
+
- **Semantic HTML first** — real `<button>`/`<nav>`/`<label>`/headings; ARIA only to fill
|
|
17
|
+
gaps semantics can't.
|
|
18
|
+
- **Keyboard**: every interactive element operable by keyboard; logical tab order; **focus
|
|
19
|
+
visible** with ≥ **3:1** contrast against its background (never remove the outline
|
|
20
|
+
without an equal replacement).
|
|
21
|
+
- **Contrast**: text ≥ **4.5:1** (≥ 3:1 for large text and UI/graphics).
|
|
22
|
+
- **Target size**: ≥ **24×24** CSS px (WCAG 2.2 AA, SC 2.5.8); prefer **44×44** for primary
|
|
23
|
+
touch targets.
|
|
24
|
+
- **No drag-only** interactions — provide a single-pointer alternative (SC 2.5.7).
|
|
25
|
+
- Labels/names on all controls; errors announced; respects `prefers-reduced-motion`.
|
|
26
|
+
- **Test** with keyboard, a screen reader, and an automated checker (e.g. axe) — early.
|
|
27
|
+
|
|
28
|
+
## Motion
|
|
29
|
+
- Purposeful only; UI feedback ~≤200 ms, transitions ~≤500 ms. Never animate to mask slow
|
|
30
|
+
loading. Honor `prefers-reduced-motion` (reduce/remove non-essential motion).
|
|
31
|
+
|
|
32
|
+
## Responsive
|
|
33
|
+
- Fluid layouts; no fixed widths that break. Verify at **320 / 768 / 1024 / 1440** px; no
|
|
34
|
+
horizontal scroll; survives **200% text zoom**.
|
|
35
|
+
|
|
36
|
+
## Design system
|
|
37
|
+
- Use the project's **tokens** (spacing/type/color roles) — never hard-code a value a
|
|
38
|
+
token covers. Compose from existing components; one icon set.
|
|
39
|
+
|
|
40
|
+
## Numerical bar (enforceable specifics)
|
|
41
|
+
|
|
42
|
+
These are the hard numbers that move "good UI" from opinion to checkable.
|
|
43
|
+
Project tokens win when stricter; these are the floor.
|
|
44
|
+
|
|
45
|
+
### Color
|
|
46
|
+
- **OKLCH-only** for new tokens — perceptually uniform, predictable lightness
|
|
47
|
+
steps across hues. Stop reaching for HSL; the lightness lies.
|
|
48
|
+
- Example: `oklch(0.62 0.18 264)` for a saturated primary.
|
|
49
|
+
- **Never `#000` / `#fff`** as raw values. Pure black/white are too harsh and
|
|
50
|
+
too clinical; use a near-black (`oklch(0.18 0 0)`) and near-white
|
|
51
|
+
(`oklch(0.98 0 0)`) or the project's surface tokens.
|
|
52
|
+
- Contrast follows WCAG 2.2 — text ≥ 4.5:1, UI/graphics ≥ 3:1. Verify
|
|
53
|
+
against the *rendered* background, not the theoretical one.
|
|
54
|
+
- **Tint neutrals toward the brand hue** — pure-grey neutrals look sterile.
|
|
55
|
+
Nudge every grey 0.005–0.01 chroma toward the brand colour — invisible at
|
|
56
|
+
a glance, but the surface stops feeling generic.
|
|
57
|
+
|
|
58
|
+
#### Color commitment — pick the strategy before the palette
|
|
59
|
+
Decide *how committed* the surface is to colour before opening the picker.
|
|
60
|
+
Four positions on a single axis; pick one, then design within it:
|
|
61
|
+
|
|
62
|
+
| Strategy | Rough coverage | Use for |
|
|
63
|
+
|---|---|---|
|
|
64
|
+
| **Restrained** | tinted neutrals + 1 accent ≤ ~10% of the surface | Most product UI; brand surfaces that want to look quiet. |
|
|
65
|
+
| **Committed** | one saturated colour carries 30–60% of the surface | Brand pages with a strong identity; product feature surfaces that need a hero colour. |
|
|
66
|
+
| **Multi-role** | 3–4 named colour roles, each used deliberately | Brand campaigns; product data-viz with distinct meanings. |
|
|
67
|
+
| **Saturated** | the surface *is* the colour — full-bleed colour ground | Brand heroes, campaign pages, splash moments. |
|
|
68
|
+
|
|
69
|
+
Two corollaries:
|
|
70
|
+
- The "one accent ≤ ~10%" rule belongs to **Restrained only.** Committed /
|
|
71
|
+
Multi-role / Saturated exceed it deliberately. Don't collapse every
|
|
72
|
+
surface back to Restrained by reflex.
|
|
73
|
+
- *Register* (brand vs product) doesn't pick the strategy by itself — brand
|
|
74
|
+
surfaces aren't always Saturated, product surfaces aren't always
|
|
75
|
+
Restrained. Pick from the scene, not the category.
|
|
76
|
+
|
|
77
|
+
### Calibration — density & motion
|
|
78
|
+
Colour commitment fixes *how much colour*; two more axes fix *how much space* and
|
|
79
|
+
*how much movement*. Set one position on each — from the **scene sentence**, the same
|
|
80
|
+
way colour is picked — and carry both in `design-brief.md` so the build targets a
|
|
81
|
+
calibration instead of re-deciding it per slice.
|
|
82
|
+
|
|
83
|
+
**Density** — information per viewport; drives which spacing steps dominate:
|
|
84
|
+
|
|
85
|
+
| Position | Feels like | Spacing steps that dominate | Use for |
|
|
86
|
+
|---|---|---|---|
|
|
87
|
+
| **Airy** | gallery / calm / room to breathe | `32 / 48 / 64 / 80 / 96` | brand pages, onboarding, focus moments, low-data surfaces |
|
|
88
|
+
| **Balanced** | most product UI | `16 / 20 / 24 / 32` | dashboards, forms, settings — the default |
|
|
89
|
+
| **Dense** | cockpit / data-rich / power tool | `4 / 8 / 12 / 16` | tables, monitors, terminals, pro tools lived in all day |
|
|
90
|
+
|
|
91
|
+
**Motion** — how much the surface moves; drives which motion classes (table below) are in play:
|
|
92
|
+
|
|
93
|
+
| Position | Feels like | Motion classes in play | Use for |
|
|
94
|
+
|---|---|---|---|
|
|
95
|
+
| **Minimal** | crisp, almost still | Instant + State | dense tools, regulated/trust surfaces, reduced-motion-leaning |
|
|
96
|
+
| **Standard** | responsive, purposeful | Instant + State + Layout | most product + brand UI — the default |
|
|
97
|
+
| **Expressive** | choreographed, scroll-aware | + Entrance, deliberate sequencing | brand heroes, launch/campaign moments, story scroll |
|
|
98
|
+
|
|
99
|
+
Corollaries (same shape as colour commitment):
|
|
100
|
+
- Pick from the **scene sentence**, not the category — "an on-call SRE at 2am" → Dense +
|
|
101
|
+
Minimal; "a launch hero in afternoon light" → Airy + Expressive. Register doesn't decide
|
|
102
|
+
it by itself.
|
|
103
|
+
- `prefers-reduced-motion` overrides Motion **downward at runtime** regardless of position —
|
|
104
|
+
an Expressive surface still ships a Minimal path.
|
|
105
|
+
- The position is a target, not a straitjacket: a surface may break density locally for
|
|
106
|
+
emphasis — name the exception in the brief, don't let the whole page drift off it.
|
|
107
|
+
|
|
108
|
+
### Spacing
|
|
109
|
+
- **4pt base scale** (`4 / 8 / 12 / 16 / 20 / 24 / 32 / 40 / 48 / 64 / 80 /
|
|
110
|
+
96`). Project tokens may use a multiplier; never hardcode in-between
|
|
111
|
+
values.
|
|
112
|
+
- Inline spacing rhythms in multiples of 4 px. Optical alignments may need a
|
|
113
|
+
1 – 2 px nudge — record the *why* in a comment.
|
|
114
|
+
|
|
115
|
+
### Typography scale
|
|
116
|
+
- **Brand surfaces**: fluid `clamp()` headings (e.g.,
|
|
117
|
+
`clamp(2rem, 1rem + 3vw, 3.5rem)`). Display/body pairing OK.
|
|
118
|
+
- **Product surfaces**: **fixed rem scale** (1.125 – 1.2 ratio). One family
|
|
119
|
+
usually carries headings, body, labels, data.
|
|
120
|
+
- Body line-height ~1.5; headings ~1.1 – 1.25. Prose width ~ 65–75 ch.
|
|
121
|
+
|
|
122
|
+
### Motion
|
|
123
|
+
| Class | Duration | Use |
|
|
124
|
+
|---|---|---|
|
|
125
|
+
| Instant | 100 – 150 ms | Hover/press, tooltip enter, color shifts |
|
|
126
|
+
| State | 200 – 300 ms | Toggle, focus ring, dropdown |
|
|
127
|
+
| Layout | 300 – 500 ms | Modal/drawer enter, route transitions |
|
|
128
|
+
| Entrance | 500 – 800 ms | Page entrance, hero animation |
|
|
129
|
+
|
|
130
|
+
- **Exit at ~75 % of enter.** A 300 ms enter pairs with a 225 ms exit.
|
|
131
|
+
- **Bounce / elastic easing banned** unless the project's design system
|
|
132
|
+
explicitly uses it.
|
|
133
|
+
- Honor `prefers-reduced-motion` — reduce or remove non-essential motion
|
|
134
|
+
entirely.
|
|
135
|
+
|
|
136
|
+
### Dark mode (three-axis compensation)
|
|
137
|
+
A token-flip dark mode is sterile. When the project ships dark, compensate
|
|
138
|
+
three axes from light:
|
|
139
|
+
- **Line-height** `+0.05 – 0.10` (text breathes more on dark surfaces).
|
|
140
|
+
- **Letter-spacing** `+0.01 – 0.02 em` (perceived spacing tightens on dark).
|
|
141
|
+
- **Weight** `+1 step` for very small or low-contrast text.
|
|
142
|
+
|
|
143
|
+
If the project has dark tokens already, follow them. If not and dark is in
|
|
144
|
+
scope, propose the compensation rather than ship a flat invert.
|
|
145
|
+
|
|
146
|
+
### Focus & states (8 required)
|
|
147
|
+
Every interactive element ships **8 visual/interaction states**:
|
|
148
|
+
`default`, `hover`, `active`, `focus-visible`, `disabled`, `loading`,
|
|
149
|
+
`selected`, and an error/invalid surface when relevant.
|
|
150
|
+
- `:focus-visible` ring: **2 – 3 px**, **≥ 3:1** contrast against the
|
|
151
|
+
background, **offset 2 px** so the focus is unambiguous on dense layouts.
|
|
152
|
+
|
|
153
|
+
### Container queries vs viewport queries
|
|
154
|
+
- **Component breakpoints** — use **container queries** (`@container`). The
|
|
155
|
+
same card adapts to its column whether the viewport is 320 or 1920.
|
|
156
|
+
- **Page-level layout** — use viewport queries
|
|
157
|
+
(`@media (min-width: ...)`) for sidebar collapses, header reflows.
|
|
158
|
+
- Mixing the two is normal; using only one is usually a code smell.
|
|
159
|
+
|
|
160
|
+
### Semantic z-index scale
|
|
161
|
+
Pick a scale per surface role; never use raw `z-index: 9999`. Suggested
|
|
162
|
+
floor:
|
|
163
|
+
|
|
164
|
+
| Role | z |
|
|
165
|
+
|---|---|
|
|
166
|
+
| Base content | `auto` / `0` |
|
|
167
|
+
| Sticky header | `50` |
|
|
168
|
+
| Dropdown / popover | `100` |
|
|
169
|
+
| Drawer / sheet | `200` |
|
|
170
|
+
| Modal | `300` |
|
|
171
|
+
| Toast | `400` |
|
|
172
|
+
| System dialog / debug overlay | `500` |
|
|
173
|
+
|
|
174
|
+
### Materiality (elevation & surface)
|
|
175
|
+
Depth is earned, not defaulted. Reach **down** this ladder in order; stop at the first
|
|
176
|
+
rung that carries the structure.
|
|
177
|
+
- **Hairline first.** A **1 px border / divider** (a hairline in a near-neutral token)
|
|
178
|
+
defines structure before any shadow does. Borders separate; shadows lift. Most "cards"
|
|
179
|
+
want a hairline, not elevation.
|
|
180
|
+
- **Elevation is a token scale, not an ad-hoc value.** When a surface genuinely lifts
|
|
181
|
+
(menu, popover, dragged item), use a **small shadow set from the design system** with one
|
|
182
|
+
consistent light source — never a one-off `box-shadow`. The elevation step and the
|
|
183
|
+
semantic z-index role move together.
|
|
184
|
+
- **Texture needs contrast.** Grain / noise / pattern earns its place only when it reads
|
|
185
|
+
against the surface. Invisible texture is bytes with no signal — drop it.
|
|
186
|
+
- **Asset-led material.** Rich material (photographic grain, real product imagery,
|
|
187
|
+
generated art) comes from a **real raster / generated asset**, not an SVG/CSS
|
|
188
|
+
approximation of one. Don't fake a photo with gradients; ship the asset or use a flat
|
|
189
|
+
token.
|
|
190
|
+
- **No decorative glass.** `backdrop-filter: blur(...)` is for a fixed/sticky surface over
|
|
191
|
+
moving content (a sticky header, a sheet over scroll), never a default panel look
|
|
192
|
+
(`rite-polish/reference/anti-ai-slop.md`).
|
|
193
|
+
|
|
194
|
+
### NEVER (UI numerical bar)
|
|
195
|
+
- Never ship a pure `#000` or `#fff` raw value.
|
|
196
|
+
- Never hard-code a spacing value the 4 pt scale or project tokens cover.
|
|
197
|
+
- Never use bounce/elastic easing without an explicit design-system reason.
|
|
198
|
+
- Never animate an exit at 100 % of enter duration (feels uncontrolled).
|
|
199
|
+
- Never use raw `z-index` numbers outside the semantic scale.
|
|
200
|
+
- Never use viewport queries for component-internal reflows when the
|
|
201
|
+
component is reused at different widths.
|
|
202
|
+
- Never ship dark mode as a flat token invert (compensate three axes).
|
|
203
|
+
- Never reach for a shadow where a 1 px hairline carries the structure.
|
|
204
|
+
- Never invent a one-off `box-shadow` outside the elevation token set.
|
|
205
|
+
- Never ship texture / grain that doesn't read against its surface.
|
|
206
|
+
|
|
207
|
+
## Verification gate (a UI slice isn't done until all pass)
|
|
208
|
+
- [ ] Renders with **no console errors/warnings**
|
|
209
|
+
- [ ] **Keyboard**: tab through reaches everything; focus visible; Esc/Enter behave
|
|
210
|
+
- [ ] **Screen reader** conveys content + structure
|
|
211
|
+
- [ ] **All states**: default / loading / empty / error / success / disabled
|
|
212
|
+
- [ ] **Responsive** at 320 / 768 / 1024 / 1440; no overflow; zoom-safe
|
|
213
|
+
- [ ] **No accessibility violations** (axe or equivalent)
|
|
214
|
+
- [ ] Meets the **CWV budget** above (measure, don't assume)
|
|
215
|
+
- [ ] Aligned to the **design system** (tokens, components, type, spacing)
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# Reuse first — frontend application
|
|
2
|
+
|
|
3
|
+
Frontend-specific application of the canonical reuse rule in
|
|
4
|
+
[`.claude/rules/coding-style.md`](../../../rules/coding-style.md#reuse-before-you-write)
|
|
5
|
+
(and the slightly longer treatment in `rules/patterns.md`). Same principle —
|
|
6
|
+
**reuse → extend → build new**, with the AHA caveat. This file walks it through for
|
|
7
|
+
components, styles, tokens, icons, hooks, utils, and helpers in a UI feature.
|
|
8
|
+
|
|
9
|
+
Consistency comes from **one source of truth**. Before creating any new component, style,
|
|
10
|
+
token, icon, hook, util, or helper for the feature, **search the project** for an
|
|
11
|
+
existing one that fits. Reuse it. Don't duplicate.
|
|
12
|
+
|
|
13
|
+
This applies to UI **and** non-UI code: utilities, helpers, types, validators, schemas,
|
|
14
|
+
formatters, hooks, query helpers — anything that might already exist.
|
|
15
|
+
|
|
16
|
+
## The decision (in order)
|
|
17
|
+
1. **Search first.** Use a code-intelligence index if available — codebase-memory-mcp first,
|
|
18
|
+
cross-checked with codegraph + graphify, else standard methods (LSP / Read/Grep/Glob); see
|
|
19
|
+
`../../../rules/tooling.md` — to find
|
|
20
|
+
similar definitions; fall back to grep/glob over `components/`, design tokens, hooks/,
|
|
21
|
+
utils/, lib/. Look for things doing the *same job*, not just the same name.
|
|
22
|
+
2. **Exact fit → REUSE.** Compose / import the existing thing. No copy, no fork.
|
|
23
|
+
3. **Close fit → EXTEND.** Add a variant/prop/option that the existing component or util
|
|
24
|
+
can carry without distortion. Adding a prop to a button is fine; adding ten props that
|
|
25
|
+
each branch the internals is not.
|
|
26
|
+
4. **No fit → BUILD NEW**, in the project's idiom. If a similar need is likely to recur,
|
|
27
|
+
propose adding it to the shared system (component library / utils module). If it's
|
|
28
|
+
truly one-off, build it locally — don't pre-abstract.
|
|
29
|
+
|
|
30
|
+
## When to *avoid* reuse (the AHA caveat)
|
|
31
|
+
Reuse is good; **forcing** it isn't. **Avoid Hasty Abstractions**: if making the existing
|
|
32
|
+
thing fit means warping its API or breaking its contract for one caller, **don't**.
|
|
33
|
+
Duplication is cheaper than the wrong abstraction. Build a sibling component/util and let
|
|
34
|
+
a real pattern emerge from two or three callers before consolidating.
|
|
35
|
+
|
|
36
|
+
## Record the decision (per slice)
|
|
37
|
+
On each slice, note what was reused / extended / created new — so the seal can see the
|
|
38
|
+
consistency story and reviewers can spot silent duplication.
|
|
39
|
+
|
|
40
|
+
```
|
|
41
|
+
Existing reused: <Button, useToast, formatCents>
|
|
42
|
+
Extended: <Card — added variant="elevated">
|
|
43
|
+
Created new: <ExportProgress (no prior equivalent; propose for shared lib)>
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Anti-patterns to name
|
|
47
|
+
- Silently re-implementing an existing component / hook / util because it was easier than
|
|
48
|
+
finding it. Search first.
|
|
49
|
+
- Copy-pasting a component from `components/` into the feature folder. That's a fork.
|
|
50
|
+
- Adding a second icon set / second toast library / second date util because the existing
|
|
51
|
+
one didn't quite fit — almost always extend the existing or ask first.
|
|
52
|
+
- Forcing reuse via 8 boolean props that branch the internals — that's an abstraction
|
|
53
|
+
collapsing under its own weight. Split it.
|
|
54
|
+
|
|
55
|
+
## Search hints
|
|
56
|
+
- **UI**: `components/ui/`, design-system package imports neighboring features use,
|
|
57
|
+
`tokens.*` / Tailwind config / theme files, icon barrel files, layout primitives.
|
|
58
|
+
- **Non-UI**: `lib/`, `utils/`, `helpers/`, `services/`, `validators/`, `schemas/`,
|
|
59
|
+
`hooks/`, language stdlib equivalents.
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# Shape before code
|
|
2
|
+
|
|
3
|
+
Decide what the UI *is* before how it looks. Aesthetics follow structure; structure
|
|
4
|
+
follows the user's goal. Skipping this is how you get pretty UI that doesn't work.
|
|
5
|
+
|
|
6
|
+
**The feature-level shape already exists.** `/rite-spec` ran `devrites-ux-shape` and wrote
|
|
7
|
+
`design-brief.md` (design direction, key states, interaction model). In `/rite-build` this
|
|
8
|
+
is a **per-slice refinement of that brief for the surface you're about to code** — confirm
|
|
9
|
+
the answers below against the brief and fill any slice-specific gaps; don't re-derive the
|
|
10
|
+
design. **Only shape from scratch here** when a UI slice has no `design-brief.md` (a spec
|
|
11
|
+
written before shaping) — then run `devrites-ux-shape` first, or answer these and write the
|
|
12
|
+
brief inline.
|
|
13
|
+
|
|
14
|
+
## Answer these before writing markup
|
|
15
|
+
1. **User goal** — what is the user here to accomplish? One sentence.
|
|
16
|
+
2. **Primary action** — the single most important thing on this surface. It must be
|
|
17
|
+
visually obvious. Everything else is secondary.
|
|
18
|
+
3. **Information hierarchy** — what must be seen first, second, third. Rank content;
|
|
19
|
+
the layout expresses the ranking.
|
|
20
|
+
4. **States** — design all of them, not just the happy path:
|
|
21
|
+
- default / populated
|
|
22
|
+
- loading (initial + subsequent)
|
|
23
|
+
- empty (with a clear next action — welcoming, not a dead end)
|
|
24
|
+
- error (what happened + how to recover)
|
|
25
|
+
- success
|
|
26
|
+
- disabled / read-only / no-permission
|
|
27
|
+
- long content / overflow / many items
|
|
28
|
+
5. **Responsive** — how it reflows from small (375) to large (1280). What collapses,
|
|
29
|
+
stacks, hides, or scrolls.
|
|
30
|
+
6. **Accessibility** — focus order, labels, contrast, keyboard operability, semantics.
|
|
31
|
+
7. **Interaction model** — what's inline vs. navigated vs. (rarely) a modal; optimistic
|
|
32
|
+
vs. pending; how feedback is given.
|
|
33
|
+
|
|
34
|
+
## Ask when ambiguous
|
|
35
|
+
If the visual direction or the UX flow isn't determined by the existing system + the
|
|
36
|
+
spec, ask the user (show 2–3 concrete options) before building. Guessing a flow is
|
|
37
|
+
expensive to undo once coded.
|
|
38
|
+
|
|
39
|
+
## Output
|
|
40
|
+
The answers live in the feature's `design-brief.md` (shaped at spec by `devrites-ux-shape`).
|
|
41
|
+
In build, append any slice-specific refinement to its **Build-time refinements** section;
|
|
42
|
+
if you shaped from scratch (no brief existed), write the brief now per
|
|
43
|
+
`../../devrites-ux-shape/reference/brief-template.md`. This drives the build and the polish
|
|
44
|
+
checklist.
|
|
45
|
+
|
|
46
|
+
## NEVER (shape)
|
|
47
|
+
|
|
48
|
+
- Never start coding markup without naming the **primary action** for the
|
|
49
|
+
surface.
|
|
50
|
+
- Never design only the populated/happy state. Empty / loading / error /
|
|
51
|
+
disabled / long-content are not optional.
|
|
52
|
+
- Never decide the visual direction by personal taste when the project has
|
|
53
|
+
an existing system. Discover first (`design-references.md`).
|
|
54
|
+
- Never invent a new flow when a neighboring feature already has one — match
|
|
55
|
+
the neighbor, then deviate only with a recorded reason.
|
|
56
|
+
- Never paper over an ambiguous spec with a "reasonable guess". Ask the user
|
|
57
|
+
with 2 – 3 concrete options.
|
|
58
|
+
- Never name a state for the *technical* condition (`isLoadingTrue`) when
|
|
59
|
+
the *user-facing* name (`Loading your invoices…`) tells the user what's
|
|
60
|
+
happening.
|