@rt-tools/agent-kit 0.33.1 → 0.34.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.
Files changed (63) hide show
  1. package/README.md +8 -7
  2. package/assets/agents/goal-critic.md +67 -0
  3. package/assets/agents/product-strategist.md +90 -0
  4. package/assets/agents/qa-engineer.md +3 -0
  5. package/assets/checks/check-specs.mjs +11 -2
  6. package/assets/checks/rt-kit-checks.config.mjs +6 -0
  7. package/assets/checks/spec-common.mjs +6 -3
  8. package/assets/checks/spec-scenarios.mjs +9 -1
  9. package/assets/checks/task-new.github.mjs +6 -0
  10. package/assets/defaults/project.sh +10 -81
  11. package/assets/defaults/push.sh +100 -0
  12. package/assets/docs/GLOSSARY.md +4 -0
  13. package/assets/hooks/browser-guard-no-other-drivers.sh +6 -3
  14. package/assets/hooks/claim-guard.sh +6 -6
  15. package/assets/hooks/dispatch.sh +56 -3
  16. package/assets/hooks/exam-guard.sh +1 -1
  17. package/assets/hooks/git-guard-delivery-body.sh +25 -3
  18. package/assets/hooks/git-guard-delivery-folder.sh +17 -1
  19. package/assets/hooks/git-guard-delivery-pipeline.sh +99 -0
  20. package/assets/hooks/git-guard-delivery.sh +17 -10
  21. package/assets/hooks/git-guard-main.sh +17 -4
  22. package/assets/hooks/git-guard-push-ahead.sh +89 -0
  23. package/assets/hooks/git-guard-push-marks.sh +99 -0
  24. package/assets/hooks/git-guard-push-tests.sh +101 -83
  25. package/assets/hooks/pre-push.sh +113 -0
  26. package/assets/hooks/push-set.sh +150 -0
  27. package/assets/hooks/push-sign.sh +433 -0
  28. package/assets/hooks/rerun-guard.sh +14 -6
  29. package/assets/hooks/turn-exit-guard.sh +2 -2
  30. package/assets/hooks/turn-exit-patterns.sh +4 -3
  31. package/assets/hooks/turn-exit-verdict.sh +18 -1
  32. package/assets/hooks/waiting-turn-guard.sh +2 -1
  33. package/assets/hooks/write-targets.sh +21 -0
  34. package/assets/patterns/git-workflow-commit.github.md +11 -0
  35. package/assets/patterns/git-workflow-pr-body.github.md +20 -3
  36. package/assets/patterns/git-workflow-pr.azure.md +30 -0
  37. package/assets/patterns/git-workflow-pr.github.md +57 -1
  38. package/assets/patterns/git-workflow-pr.gitlab.md +33 -0
  39. package/assets/patterns/mockups-measure.needs-mockups.md +19 -3
  40. package/assets/patterns/task-flow-close.md +27 -16
  41. package/assets/patterns/task-flow-start.md +3 -3
  42. package/assets/rules/browser-verification.md +4 -0
  43. package/assets/rules/deploy-flow.azure.md +5 -0
  44. package/assets/rules/deploy-flow.github.md +5 -0
  45. package/assets/rules/deploy-flow.gitlab.md +5 -0
  46. package/assets/rules/git-workflow.azure.md +15 -0
  47. package/assets/rules/git-workflow.github.md +15 -0
  48. package/assets/rules/git-workflow.gitlab.md +15 -0
  49. package/assets/rules/mockups.needs-mockups.md +13 -5
  50. package/assets/rules/task-flow.md +21 -16
  51. package/assets/samples/tasks/_template/plan.md +7 -0
  52. package/assets/skills/interface-review-annotate.needs-mockups.md +142 -0
  53. package/assets/skills/interface-review-icons.needs-app.md +136 -0
  54. package/assets/skills/interface-review-motion-states.needs-app.md +230 -0
  55. package/assets/skills/interface-review-motion.needs-app.md +209 -0
  56. package/assets/skills/interface-review-performance.needs-app.md +110 -0
  57. package/assets/skills/interface-review-principles.needs-app.md +263 -0
  58. package/assets/skills/interface-review-surfaces.needs-app.md +249 -0
  59. package/assets/skills/interface-review.needs-app.md +199 -0
  60. package/assets/skills/write-a-skill.md +16 -3
  61. package/assets/workflows/feature.js +33 -5
  62. package/assets/workflows/plan.js +71 -4
  63. package/package.json +1 -1
@@ -0,0 +1,209 @@
1
+ ---
2
+ name: interface-review-motion
3
+ description: Motion recipes for an interface review: interruptible transitions, staggered entrances, subtle exits, with CSS and Motion code. Load when a finding about an entrance, an exit or an interrupted animation is worded or fixed. Icon swaps and press feedback are in interface-review-motion-states.
4
+ ---
5
+
6
+ # Animations
7
+
8
+ Interruptible animations and enter/exit transitions. Contextual icon animations, scale on press and
9
+ skipping animation on page load are in `interface-review-motion-states`.
10
+
11
+ ## When to use
12
+
13
+ - A finding of `interface-review` is about an animation that cannot be interrupted, a jarring
14
+ entrance or a dramatic exit.
15
+
16
+ ## Interruptible Animations
17
+
18
+ Users change intent mid-interaction. If animations aren't interruptible, the interface feels broken.
19
+
20
+ ### CSS Transitions vs. Keyframes
21
+
22
+ | | CSS Transitions | CSS Keyframe Animations |
23
+ | --- | --- | --- |
24
+ | **Behavior** | Interpolate toward latest state | Run on a fixed timeline |
25
+ | **Interruptible** | Yes, retargets mid-animation | No, restarts from beginning |
26
+ | **Use for** | Interactive state changes (hover, toggle, open/close) | Staged sequences that run once (enter animations, loading) |
27
+ | **Duration** | Fixed; retargets the value mid-flight, not the timeline | Fixed timeline, restarts from the beginning |
28
+
29
+ ```css
30
+ /* Good: interruptible transition for a toggle */
31
+ .drawer {
32
+ transform: translateX(-100%);
33
+ transition: transform 200ms ease-out;
34
+ }
35
+ .drawer.open {
36
+ transform: translateX(0);
37
+ }
38
+
39
+ /* Clicking again mid-animation smoothly reverses, no jank */
40
+ ```
41
+
42
+ ```css
43
+ /* Bad: keyframe animation for interactive element */
44
+ .drawer.open {
45
+ animation: slideIn 200ms ease-out forwards;
46
+ }
47
+
48
+ /* Closing mid-animation snaps or restarts, feels broken */
49
+ ```
50
+
51
+ **Rule:** Always prefer CSS transitions for interactive elements. Reserve keyframes for one-shot
52
+ sequences.
53
+
54
+ ## Enter Animations: Split and Stagger
55
+
56
+ Use this pattern for infrequent staged entrances where sequence helps communicate hierarchy, such as
57
+ the first load of a page hero, success state, or empty state. Break a large container into semantic
58
+ chunks and animate each individually. Stagger only where the entrance is infrequent; anything the
59
+ user triggers often should animate as one container, or not at all.
60
+
61
+ ### Step by Step
62
+
63
+ 1. **Split** into logical groups (title, description, buttons)
64
+ 2. **Stagger** with ~100ms delay between groups
65
+ 3. **For titles**, consider splitting into individual words with ~80ms stagger
66
+ 4. **Combine** `opacity`, `blur`, and `translateY` for the enter effect
67
+
68
+ ### Code Example
69
+
70
+ ```tsx
71
+ // Motion (Framer Motion): staggered enter
72
+ function PageHeader() {
73
+ return (
74
+ <motion.div
75
+ initial="hidden"
76
+ animate="visible"
77
+ variants={{
78
+ visible: { transition: { staggerChildren: 0.1 } },
79
+ }}
80
+ >
81
+ <motion.h1
82
+ variants={{
83
+ hidden: { opacity: 0, y: 12, filter: "blur(4px)" },
84
+ visible: { opacity: 1, y: 0, filter: "blur(0px)" },
85
+ }}
86
+ >
87
+ Welcome
88
+ </motion.h1>
89
+
90
+ <motion.p
91
+ variants={{
92
+ hidden: { opacity: 0, y: 12, filter: "blur(4px)" },
93
+ visible: { opacity: 1, y: 0, filter: "blur(0px)" },
94
+ }}
95
+ >
96
+ A description of the page.
97
+ </motion.p>
98
+
99
+ <motion.div
100
+ variants={{
101
+ hidden: { opacity: 0, y: 12, filter: "blur(4px)" },
102
+ visible: { opacity: 1, y: 0, filter: "blur(0px)" },
103
+ }}
104
+ >
105
+ <Button>Get started</Button>
106
+ </motion.div>
107
+ </motion.div>
108
+ );
109
+ }
110
+ ```
111
+
112
+ ### CSS-Only Stagger
113
+
114
+ ```css
115
+ .stagger-item {
116
+ opacity: 0;
117
+ transform: translateY(12px);
118
+ filter: blur(4px);
119
+ animation: fadeInUp 400ms ease-out forwards;
120
+ }
121
+
122
+ .stagger-item:nth-child(1) { animation-delay: 0ms; }
123
+ .stagger-item:nth-child(2) { animation-delay: 100ms; }
124
+ .stagger-item:nth-child(3) { animation-delay: 200ms; }
125
+
126
+ @keyframes fadeInUp {
127
+ to {
128
+ opacity: 1;
129
+ transform: translateY(0);
130
+ filter: blur(0);
131
+ }
132
+ }
133
+ ```
134
+
135
+ ## Exit Animations
136
+
137
+ Exit animations should be softer and less attention-grabbing than enter animations. The user's focus
138
+ is moving to the next thing; don't fight for attention.
139
+
140
+ ### Subtle Exit (Recommended)
141
+
142
+ ```tsx
143
+ // Small fixed translateY: indicates direction without drama
144
+ <motion.div
145
+ exit={{
146
+ opacity: 0,
147
+ y: -12,
148
+ filter: "blur(4px)",
149
+ transition: { duration: 0.15, ease: "easeOut" },
150
+ }}
151
+ >
152
+ {content}
153
+ </motion.div>
154
+ ```
155
+
156
+ ### Full Exit (When Context Matters)
157
+
158
+ ```tsx
159
+ // Slide fully out: use when spatial context is important
160
+ // (e.g., a card returning to a list, a drawer closing)
161
+ <motion.div
162
+ exit={{
163
+ opacity: 0,
164
+ x: "-100%",
165
+ transition: { duration: 0.2, ease: "easeOut" },
166
+ }}
167
+ >
168
+ {content}
169
+ </motion.div>
170
+ ```
171
+
172
+ ### Good vs. Bad
173
+
174
+ ```css
175
+ /* Good: subtle exit */
176
+ .item-exit {
177
+ opacity: 0;
178
+ transform: translateY(-12px);
179
+ transition: opacity 150ms ease-out, transform 150ms ease-out;
180
+ }
181
+
182
+ /* Bad: dramatic exit that steals focus */
183
+ .item-exit {
184
+ opacity: 0;
185
+ transform: translateY(-100%) scale(0.5);
186
+ transition: all 400ms ease-out;
187
+ }
188
+
189
+ /* Sometimes correct: remove immediately when motion adds no context */
190
+ .item-exit {
191
+ display: none;
192
+ }
193
+ ```
194
+
195
+ **Key points:**
196
+ - Use a small fixed `translateY` (e.g., `-12px`) instead of the full container height
197
+ - Keep some directional movement to indicate where the element went
198
+ - Exit duration should be shorter than enter duration (150ms vs 300ms)
199
+ - Use a subtle exit when it preserves spatial context. Remove immediately when motion adds no
200
+ information, the interaction repeats frequently, or reduced motion is requested.
201
+
202
+ ## Scope
203
+
204
+ Everything in this section assumes the animation belongs. Whether it belongs at all — what it costs
205
+ the user at its trigger frequency, and whether it should be shortened, made one-sided, or deleted —
206
+ is a separate question, and the answer defaults to no.
207
+
208
+ Honoring `prefers-reduced-motion` is covered by the accessibility principles in
209
+ `interface-review-principles`; apply it to every animation in this section.
@@ -0,0 +1,110 @@
1
+ ---
2
+ name: interface-review-performance
3
+ description: Performance recipes for an interface review: transition only what changes instead of transition all, and will-change only for compositor properties on a seen stutter. Load when such a finding is worded or fixed. The animations are in interface-review-motion.
4
+ ---
5
+
6
+ # Performance
7
+
8
+ Transition specificity and GPU compositing hints.
9
+
10
+ ## When to use
11
+
12
+ - A finding of `interface-review` is about `transition: all`, an unintended transition on a
13
+ property nobody meant to animate, a first-frame stutter, or `will-change` on everything.
14
+
15
+ ## Transition Only What Changes
16
+
17
+ Never use `transition: all` or Tailwind's `transition-all`. Always specify the exact properties that
18
+ change. (Tailwind's bare `transition` maps to a curated default list of colors, opacity, shadow and
19
+ transforms, not to `all`; still prefer naming exactly what changes.)
20
+
21
+ ### Why
22
+
23
+ - `transition: all` forces the browser to watch every property for changes
24
+ - Causes unexpected transitions on properties you didn't intend to animate (colors, padding,
25
+ shadows)
26
+ - Prevents browser optimizations
27
+
28
+ ### CSS Example
29
+
30
+ ```css
31
+ /* Good: only transition what changes */
32
+ .button {
33
+ transition-property: scale, background-color;
34
+ transition-duration: 150ms;
35
+ transition-timing-function: ease-out;
36
+ }
37
+
38
+ /* Bad: transition everything */
39
+ .button {
40
+ transition: all 150ms ease-out;
41
+ }
42
+ ```
43
+
44
+ ### Tailwind
45
+
46
+ ```tsx
47
+ // Good: explicit properties
48
+ <button className="transition-[scale,background-color] duration-150 ease-out">
49
+
50
+ // Bad: transition all
51
+ <button className="transition-all duration-150 ease-out">
52
+ ```
53
+
54
+ ### Tailwind `transition-transform` Note
55
+
56
+ `transition-transform` in Tailwind maps to `transition-property: transform, translate, scale,
57
+ rotate`, so it covers all transform-related properties, not just `transform`. Use this when you're
58
+ only animating transforms. For multiple non-transform properties, use the bracket syntax:
59
+ `transition-[scale,opacity,filter]`.
60
+
61
+ ## Use `will-change` Sparingly
62
+
63
+ `will-change` hints the browser to pre-promote an element to its own GPU compositing layer. Without
64
+ it, the browser promotes the element only when the animation starts; that one-time layer promotion
65
+ can cause a micro-stutter on the first frame.
66
+
67
+ This particularly helps when an element is changing `scale`, `rotation`, or moving around with
68
+ `transform`. For other properties, it doesn't help much: the browser can't composite them on the GPU
69
+ anyway.
70
+
71
+ ### Rules
72
+
73
+ ```css
74
+ /* Good: specific property that benefits from GPU compositing */
75
+ .animated-card {
76
+ will-change: transform;
77
+ }
78
+
79
+ /* Good: multiple compositor-friendly properties */
80
+ .animated-card {
81
+ will-change: transform, opacity;
82
+ }
83
+
84
+ /* Bad: never use will-change: all */
85
+ .animated-card {
86
+ will-change: all;
87
+ }
88
+
89
+ /* Bad: properties that can't be GPU-composited anyway */
90
+ .animated-card {
91
+ will-change: background-color, padding;
92
+ }
93
+ ```
94
+
95
+ ### Useful Properties
96
+
97
+ | Property | GPU-compositable | Worth using `will-change` |
98
+ | --- | --- | --- |
99
+ | `transform` | Yes | Yes |
100
+ | `opacity` | Yes | Yes |
101
+ | `filter` (blur, brightness) | Yes | Yes |
102
+ | `clip-path` | Newer Chromium only | Rarely; not reliable cross-browser |
103
+ | `top`, `left`, `width`, `height` | No | No |
104
+ | `background`, `border`, `color` | No | No |
105
+
106
+ ### When to Skip
107
+
108
+ Modern browsers are already good at optimizing on their own. Only add `will-change` when you notice
109
+ first-frame stutter; Safari in particular benefits from it. Don't add it preemptively to every
110
+ animated element; each extra compositing layer costs memory.
@@ -0,0 +1,263 @@
1
+ ---
2
+ name: interface-review-principles
3
+ description: The rules an interface review judges by: accessibility, layout, writing, typography and UI polish, with exact values. Load during an interface review to judge a finding and word its fix. The run order and the report form are in interface-review.
4
+ ---
5
+
6
+ # The five domains of an interface review
7
+
8
+ ## When to use
9
+
10
+ - An interface review is running by `interface-review`, and a finding needs the rule it breaks.
11
+ - A fix is worded, and the exact value the principle prescribes is needed.
12
+
13
+ ## Accessibility
14
+
15
+ Accessibility is not a compliance checkbox bolted on at the end; it is the floor for interface
16
+ craft. Most of it is free if you use the platform: native elements ship with keyboard support, real
17
+ labels announce themselves, and a visible focus ring is one CSS rule. When unsure, prefer the
18
+ platform default over a custom rebuild, and remove ARIA rather than add it.
19
+
20
+ 1. **Native elements first.** The first rule of ARIA: don't use ARIA when a native element exists.
21
+ `<button>` for actions, `<a href>` for navigation (it must support Cmd/Ctrl/middle-click), never
22
+ `<div onClick>`. No ARIA is better than bad ARIA.
23
+ 2. **Visible focus rings.** Style `:focus-visible`, not bare `:focus`, so keyboard users get a ring
24
+ and mouse users usually don't. Prefer the browser's unmodified focus indicator. If the design
25
+ needs a custom ring, use a project focus token or another explicit color and verify the complete
26
+ indicator against every adjacent color it crosses; `currentColor` is acceptable only after the
27
+ same check. Use at least a `2px` solid perimeter or an equivalent visible area. Never use
28
+ `outline: none` without a verified replacement, and preserve system colors in forced-colors mode.
29
+ 3. **Full keyboard support.** Every pointer interaction needs a keyboard path, following the ARIA APG
30
+ patterns: Escape closes overlays, arrow keys move within composite widgets (tabs, menus,
31
+ listboxes), Tab moves between widgets, Enter and Space activate. Only `tabindex="0"` (join the
32
+ natural tab order) and `tabindex="-1"` (programmatic focus), never positive values, which break
33
+ the natural order. Composite widgets use roving tabindex: the active item is `0`, all others `-1`.
34
+ 4. **Trap and restore focus.** Modals set `inert` on the background content, move focus inside on
35
+ open, and return focus to the trigger on close. Add `overscroll-behavior: contain` so background
36
+ content doesn't scroll.
37
+ 5. **Minimum hit area.** WCAG 2.5.8's Level AA baseline is a 24×24 CSS-pixel target or one of its
38
+ defined spacing, equivalent-control, inline, user-agent, or essential exceptions. For easier
39
+ activation, aim for 44×44px in touch contexts and 40×40px in desktop interfaces when density
40
+ permits. Extend with a pseudo-element if the visible element should stay smaller. Never let
41
+ extended hit areas overlap.
42
+ 6. **Label and type every control.** Every input gets a `<label for>` or wrapping `<label>`; a
43
+ placeholder is never a label, and label and control share one hit target: no dead zones between a
44
+ checkbox and its text. Add `autocomplete` with a meaningful `name`, and the correct `type` and
45
+ `inputmode` for the keyboard. Never block paste; users paste passwords and one-time codes.
46
+ 7. **Accessible names everywhere.** Icon-only buttons need a descriptive `aria-label`. Visible label
47
+ text must appear in the accessible name. Decorative elements get `aria-hidden="true"`, never on a
48
+ focusable element.
49
+ 8. **Don't rely on color alone.** Status needs a redundant cue: icon, text, or underline alongside
50
+ the color. Determine which WCAG contrast requirement applies from the content and state, then
51
+ measure the rendered foreground/background pair. When contrast fails, report the pair and the
52
+ requirement it misses; do not change the project's colors unless asked.
53
+ 9. **Honor prefers-reduced-motion.** Wrap motion in `@media (prefers-reduced-motion: no-preference)`
54
+ so it is opt-in. Under reduced motion, replace slides and scales with opacity crossfades; kill
55
+ parallax and autoplay entirely. Independent of the preference: autoplaying media needs a visible
56
+ pause control, and toasts carrying actions or errors stay until dismissed.
57
+
58
+ ## Layout
59
+
60
+ Layout communicates before a single word is read: position, spacing, and alignment carry hierarchy
61
+ on their own, and generous space beats decoration. A good layout also survives stress: resize it,
62
+ translate it, mirror it for RTL, and it should still hold together.
63
+
64
+ 1. **Group with space, not lines.** Negative space is the primary grouping tool; background shapes
65
+ second; separator lines last, only where space alone can't carry the structure. The gap between
66
+ groups must be at least 2× the gap within a group (`8px` intra-group → `16px`+ inter-group), or
67
+ the grouping reads as noise.
68
+ 2. **Keep controls distinct from content.** Interactive elements must look interactive: a background
69
+ shape, a border, or a consistent placement zone. Never style a control identically to adjacent
70
+ static text.
71
+ 3. **Align to shared edges.** Pick alignment edges and stick to them; every stray edge reads as
72
+ noise. Use one project spacing step for each level of subordination (`16px` is a useful default).
73
+ Use logical properties (`padding-inline-start`, `margin-inline-end`) for direction-dependent
74
+ layout; reserve physical left/right for genuinely physical geometry.
75
+ 4. **Order by importance.** The most important content sits near the top and the leading edge;
76
+ reading order flows top-to-bottom, leading-to-trailing. Think in leading/trailing, not left/right.
77
+ 5. **Breathing room between targets.** Without an established density system, start with `12px`
78
+ between adjacent bordered or filled controls and `24px` of clearance around borderless text- and
79
+ icon-only controls. Compact layouts may use less when the hit areas above do not overlap and the
80
+ controls remain visually distinct.
81
+ 6. **Hold structure until it breaks.** Breakpoints come from the content, not device presets. Keep
82
+ the expanded layout as long as it genuinely fits and collapse late; prefer container queries for
83
+ component-level adaptation. Test the smallest and largest sizes first.
84
+ 7. **Plan for growth and clipping.** Plan for substantial and language-dependent string growth
85
+ rather than relying on a universal percentage: no fixed widths or heights on text containers, and
86
+ let rows wrap. Never park critical actions where resizing or scrolling clips them; keep them
87
+ reachable in the normal flow or stable chrome appropriate to the product.
88
+
89
+ ## Writing
90
+
91
+ Clear and brief beats clever, consistency beats variety, and the best error message is the
92
+ interaction redesigned so the error can't happen. Preserve intentional brand character when it
93
+ remains clear and appropriate to the stakes: treat a difference from generic plain language as a
94
+ finding only when it creates inconsistency, ambiguity, translation risk, or an inappropriate tone.
95
+
96
+ 1. **One voice, flexible tone.** The product has one voice, established by its existing system
97
+ rather than invented during a local edit. Keep terms consistent: if it's "Archive" in the menu,
98
+ it isn't "Move to storage" in the toast. Tone flexes with the stakes:
99
+
100
+ | Context | Tone |
101
+ | --- | --- |
102
+ | Success, onboarding, empty states | Warm, can be light |
103
+ | Routine actions, settings | Neutral, minimal |
104
+ | Errors, destructive confirmations | Calm, plain, zero playfulness |
105
+ | Data loss, security | Serious, explicit |
106
+
107
+ 2. **Plain words over clever ones.** Choose easily understood words and delete every word that isn't
108
+ needed. No idioms, colloquialisms, or humor that won't translate. Skip unnecessary gender:
109
+ "Subscribers can post recipes", not "each subscriber can post his or her recipes". Match the input
110
+ device: "tap" on touch, "click" with a pointer, "select" when both are possible. Never build
111
+ sentences by concatenating fragments around variables (`"You have " + n + " new messages"`); word
112
+ order changes per language, so use full templated strings with proper pluralization.
113
+ 3. **Verb-first buttons.** Button labels start with a verb naming the specific action: "Send", "Save
114
+ draft", "Delete project". Never "OK!", "Let's go!", or bare "Yes"/"No" on consequential actions.
115
+ Confirmation buttons repeat the consequence so the dialog is answerable without reading the body:
116
+ "Delete this project?" offers `Delete project` and `Cancel`, not `Yes` and `No`.
117
+ 4. **Links describe their destination.** Link text makes sense out of context; screen-reader users
118
+ navigate by a list of the page's links. "Read the billing docs", never "Click here" (which also
119
+ fails the device-verb rule on touch), and never a bare "Learn more" when several appear on one
120
+ page. Suffix each: "Learn more about exports".
121
+ 5. **One capitalization policy.** Pick title case or sentence case per element type (all buttons, all
122
+ headings) and apply it consistently; sentence case is the safer default: calmer, no per-word case
123
+ rules, localizes cleanly. "Save Changes" beside "Discard changes" reads as sloppiness.
124
+ 6. **Errors say how to fix, next to where it broke.** An error is an instruction, adjacent to the
125
+ failing field:
126
+
127
+ | Bad | Good |
128
+ | --- | --- |
129
+ | That password is too short | Choose a password with at least 8 characters |
130
+ | Invalid name | Use only letters for your name |
131
+ | Oops! Something went wrong. | Unable to save. Check your connection and try again. |
132
+
133
+ No blame, no "oops", no exclamation marks. Phrase hints positively ("Use only letters", not
134
+ "Don't use numbers or symbols") and show them before the mistake, not after. If the same error
135
+ keeps firing for many users, redesign the interaction instead of rewording it.
136
+ 7. **Empty states point forward.** An empty state says what this place is and how to fill it, with
137
+ one clear next action:
138
+
139
+ ```html
140
+ <!-- Bad: a shrug -->
141
+ <p>No results.</p>
142
+
143
+ <!-- Good: orientation plus a next step -->
144
+ <p class="font-medium">No projects yet</p>
145
+ <p class="text-sm text-zinc-500">Projects keep your tasks and files together.</p>
146
+ <button class="mt-4">Create a project</button>
147
+ ```
148
+
149
+ Search and filter empty states name the query and offer an exit: "No results for 'quarterly'.
150
+ Clear filters". Never park crucial persistent information in an empty state; it disappears the
151
+ moment content exists.
152
+
153
+ ## Typography
154
+
155
+ Good typography is mostly restraint. A sensible scale, comfortable spacing and enough contrast beat
156
+ any clever effect. A label, a table cell, a marketing headline and an article paragraph should not
157
+ share one set of rules.
158
+
159
+ 1. **Fewer fonts, sizes and weights.** Rarely use more than three fonts. Weight and size define
160
+ hierarchy, but overusing them hurts readability quickly. Pair for contrast, not similarity: a
161
+ serif headline with a sans body reads as deliberate, two near-identical sans-serifs read as a
162
+ mistake. Below `18px`, stay at weight `400`+; weights under `300` are display-only (`28px`+),
163
+ they disappear at text sizes.
164
+ 2. **Use a type scale with semantic names.** Define a small set of sizes and deviate from it as
165
+ little as possible. Hard-coded sizes without a system break down at scale. For solo projects,
166
+ default names like `text-sm` work fine as long as the usage rules are clear. On a team, name
167
+ sizes by use (`text-body-sm`), not by size, so the rules stay consistent.
168
+ 3. **Heading sizes descend with level.** Within a coherent page hierarchy, map heading levels to
169
+ descending steps of the type scale: a visually subordinate heading should not accidentally
170
+ overpower its parent. Adjacent levels may share a size toward the small end of the scale as long
171
+ as weight or spacing keeps them distinct. Pick semantic heading elements per the Accessibility
172
+ principles above; this section controls only their visual treatment.
173
+ 4. **Line-height by role.** Headings tighter, around `1.1`. Body copy `1.5` to `1.6`. Prefer unitless
174
+ values so line-height scales with the font size; fixed values like `24px` do not. Tight
175
+ line-height is for short text: anything that wraps to three or more lines needs at least `1.4`,
176
+ even in height-constrained rows.
177
+ 5. **Cap the measure.** Long lines make it hard for the eye to find the next line. Cap long-form text
178
+ around 60–75 characters per line. Any unit works: `65ch` measures characters directly, and a pixel
179
+ or rem cap is just as good: at a `16px` body size the range lands roughly between `560px` and
180
+ `680px` depending on the font, so Tailwind's `max-w-xl` or `max-w-2xl` fit. What matters is that a
181
+ cap exists and the resulting line length sits in range.
182
+ 6. **Wrap deliberately.** `text-wrap: balance` distributes text evenly across lines: use it on
183
+ headings. `text-wrap: pretty` avoids leaving a single short word on the final line: use it on
184
+ descriptions. Skip both in long-form text: browsers ignore `balance` past a few lines anyway, and
185
+ evening out a whole paragraph wastes space and makes it harder to read. `overflow-wrap:
186
+ break-word` where long words, links or IDs could escape the container. `white-space: nowrap` on
187
+ labels and badges where a line break looks broken.
188
+ 7. **Tabular numbers on changing values.** Digits have different widths by default, so timers,
189
+ counters and prices shift layout as they update. Apply `font-variant-numeric: tabular-nums` to any
190
+ value that changes.
191
+ 8. **Truncate without losing content.** Single line: `text-overflow: ellipsis` with `overflow:
192
+ hidden` and `white-space: nowrap`. Multiple lines: `line-clamp`. Truncation hides content, so if
193
+ the missing text matters, keep the full value reachable in a tooltip or expanded view.
194
+ 9. **Inputs at 16px on mobile.** iOS Safari zooms the whole page when an input's text is smaller than
195
+ `16px`. Keep input text at `16px` on mobile viewports (`text-base sm:text-sm`). Avoid the
196
+ `maximum-scale=1` viewport meta: Safari ignores it for pinch zoom, but every other browser honors
197
+ it and blocks zooming, which fails WCAG.
198
+
199
+ ## UI polish
200
+
201
+ Great interfaces rarely come from a single thing. It's usually a collection of small details that
202
+ compound into a great experience. This section assumes an animation belongs; deciding whether it
203
+ belongs at all, and what it costs the user at its trigger frequency, is a separate question worth
204
+ asking before reaching for the recipes in `interface-review-motion` and
205
+ `interface-review-motion-states`.
206
+
207
+ 1. **Concentric border radius.** Outer radius = inner radius + padding. Mismatched radii on nested
208
+ elements is the most common thing that makes interfaces feel off.
209
+ 2. **Optical over geometric alignment.** When geometric centering looks off, align optically.
210
+ Buttons with icons, play triangles, and asymmetric icons all need manual adjustment.
211
+ 3. **Shadows for elevation, borders for structure.** For buttons, cards, and containers whose border
212
+ exists only to create depth, prefer layered transparent `box-shadow` values. Keep borders that
213
+ communicate structure or state: dividers, layout separators, and selected or focus states.
214
+ 4. **Interruptible animations.** Use CSS transitions for interactive state changes: they can be
215
+ interrupted mid-animation. Reserve keyframes for staged sequences that run once.
216
+ 5. **Split and stagger enter animations.** For an infrequent staged entrance where sequence helps
217
+ communicate hierarchy, break content into semantic chunks and stagger them by ~100ms instead of
218
+ animating one container. Confirm the entrance is infrequent enough to earn a stagger; anything
219
+ the user triggers often should not stagger at all.
220
+ 6. **Subtle exit animations.** Use a small fixed `translateY` instead of full height. Exits should be
221
+ softer than enters. Use `ease-out` for both enter and exit transitions.
222
+ 7. **Contextual icon animations.** Animate icons with `opacity`, `scale`, and `blur` instead of
223
+ toggling visibility. Use exactly these values: scale from `0.25` to `1`, opacity from `0` to `1`,
224
+ blur from `4px` to `0px`. If the project has `motion` or `framer-motion` in `package.json`, match
225
+ that package's import path (or the established nearby imports when both exist) and use
226
+ `transition: { type: "spring", duration: 0.3, bounce: 0 }`; bounce must always be `0`. If no
227
+ motion library is installed, keep both icons in the DOM (one absolute-positioned) and cross-fade
228
+ with CSS transitions using `cubic-bezier(0.2, 0, 0, 1)`; this gives both enter and exit
229
+ animations without any dependency.
230
+ 8. **Image outlines.** Add a subtle `1px` outline with low opacity to images for consistent depth.
231
+ The color must be pure black in light mode (`oklch(0 0 0 / 0.1)`) and pure white in dark mode
232
+ (`oklch(1 0 0 / 0.1)`), never a near-black like slate, zinc, or any tinted neutral. A tinted
233
+ outline picks up the surface color underneath it and reads as dirt on the image edge.
234
+ 9. **Scale on press.** A subtle `scale(0.96)` on click gives buttons tactile feedback. Always use
235
+ `0.96`. Never use a value smaller than `0.95`: anything below feels exaggerated. Add a `static`
236
+ prop to disable it when motion would be distracting.
237
+ 10. **Skip animation on page load.** Use `initial={false}` on `AnimatePresence` to prevent enter
238
+ animations on first render. Verify it doesn't break intentional entrance animations.
239
+ 11. **Never use `transition: all`.** Always specify exact properties: `transition-property: scale,
240
+ opacity`. Tailwind's `transition-transform` covers `transform, translate, scale, rotate`.
241
+ 12. **Use `will-change` sparingly.** Only for `transform`, `opacity`, `filter`, the properties the
242
+ GPU can composite. Never use `will-change: all`. Only add when you notice first-frame stutter.
243
+ 13. **Match icon stroke to text weight.** An icon next to text carries the text's optical weight:
244
+ `1.5px` stroke beside regular (400) text, `2px` beside semibold (600). One stroke weight per icon
245
+ set; never mix libraries on one surface.
246
+ 14. **One SVG, recolored per state.** Icons use `currentColor` and get their states (hover, selected,
247
+ disabled) from CSS color and opacity, never from separate assets. Outline variant is the
248
+ default; fill variant marks the active state.
249
+
250
+ ### UI polish: common mistakes
251
+
252
+ | Mistake | Fix |
253
+ | --- | --- |
254
+ | Same border radius on closely nested parent and child | Calculate `outerRadius = innerRadius + padding` |
255
+ | Icons look off-center | Adjust optically with padding or fix SVG directly |
256
+ | Border used only to fake elevation | Use layered `box-shadow` with transparency; keep structural and state borders |
257
+ | Jarring staged entrance or contextual exit | Stagger infrequent entrances and keep context-preserving exits subtle |
258
+ | Stateful icon or toggle animates its default state on page load | Add `initial={false}` to that `AnimatePresence`; preserve intentional page entrances |
259
+ | `transition: all` on elements | Specify exact properties |
260
+ | First-frame animation stutter | Add `will-change: transform` (sparingly) |
261
+ | Hairline icon beside bold text | Match the stroke width to the text weight |
262
+ | Separate icon assets per state | One `currentColor` SVG, states via CSS |
263
+ | Filled icons everywhere | Outline as default, fill only for the active state |