@rt-tools/agent-kit 0.32.0 → 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 (75) 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/board.github.mjs +27 -0
  6. package/assets/checks/check-specs.mjs +11 -2
  7. package/assets/checks/rt-kit-checks.config.mjs +6 -0
  8. package/assets/checks/spec-common.mjs +6 -3
  9. package/assets/checks/spec-scenarios.mjs +9 -1
  10. package/assets/checks/task-new.github.mjs +6 -0
  11. package/assets/checks/tree-assignment.mjs +11 -3
  12. package/assets/defaults/project.sh +10 -81
  13. package/assets/defaults/push.sh +100 -0
  14. package/assets/docs/GLOSSARY.md +4 -0
  15. package/assets/hooks/browser-guard-no-other-drivers.sh +6 -3
  16. package/assets/hooks/claim-guard.sh +6 -6
  17. package/assets/hooks/dispatch.sh +56 -3
  18. package/assets/hooks/exam-guard.sh +1 -1
  19. package/assets/hooks/git-guard-delivery-body.sh +25 -3
  20. package/assets/hooks/git-guard-delivery-folder.sh +17 -1
  21. package/assets/hooks/git-guard-delivery-merged.sh +65 -0
  22. package/assets/hooks/git-guard-delivery-pipeline.sh +99 -0
  23. package/assets/hooks/git-guard-delivery.sh +22 -8
  24. package/assets/hooks/git-guard-main.sh +17 -4
  25. package/assets/hooks/git-guard-push-ahead.sh +89 -0
  26. package/assets/hooks/git-guard-push-marks.sh +99 -0
  27. package/assets/hooks/git-guard-push-tests.sh +101 -83
  28. package/assets/hooks/git-guard-tree-assignment.sh +1 -1
  29. package/assets/hooks/grill-gate-options.sh +50 -0
  30. package/assets/hooks/grill-gate.sh +9 -1
  31. package/assets/hooks/pre-push.sh +113 -0
  32. package/assets/hooks/push-set.sh +150 -0
  33. package/assets/hooks/push-sign.sh +433 -0
  34. package/assets/hooks/rerun-guard.sh +14 -6
  35. package/assets/hooks/turn-exit-guard.sh +2 -2
  36. package/assets/hooks/turn-exit-patterns.sh +4 -3
  37. package/assets/hooks/turn-exit-verdict.sh +18 -1
  38. package/assets/hooks/waiting-turn-guard.sh +2 -1
  39. package/assets/hooks/write-targets.sh +21 -0
  40. package/assets/patterns/dependencies-upgrade.md +5 -1
  41. package/assets/patterns/git-workflow-commit.github.md +14 -0
  42. package/assets/patterns/git-workflow-pr-body.github.md +20 -3
  43. package/assets/patterns/git-workflow-pr.azure.md +30 -0
  44. package/assets/patterns/git-workflow-pr.github.md +57 -1
  45. package/assets/patterns/git-workflow-pr.gitlab.md +33 -0
  46. package/assets/patterns/mockups-measure.needs-mockups.md +19 -3
  47. package/assets/patterns/reuse-first-extend.md +5 -0
  48. package/assets/patterns/task-flow-close.md +27 -16
  49. package/assets/patterns/task-flow-start.md +5 -4
  50. package/assets/pitfalls/task-flow.md +4 -0
  51. package/assets/rules/browser-verification.md +4 -0
  52. package/assets/rules/dependencies.md +3 -1
  53. package/assets/rules/deploy-flow.azure.md +5 -0
  54. package/assets/rules/deploy-flow.github.md +5 -0
  55. package/assets/rules/deploy-flow.gitlab.md +5 -0
  56. package/assets/rules/git-workflow.azure.md +15 -0
  57. package/assets/rules/git-workflow.github.md +15 -0
  58. package/assets/rules/git-workflow.gitlab.md +15 -0
  59. package/assets/rules/mockups.needs-mockups.md +13 -5
  60. package/assets/rules/reuse-first.md +3 -0
  61. package/assets/rules/task-flow.md +21 -16
  62. package/assets/rules/testing.md +5 -0
  63. package/assets/samples/tasks/_template/plan.md +7 -0
  64. package/assets/skills/interface-review-annotate.needs-mockups.md +142 -0
  65. package/assets/skills/interface-review-icons.needs-app.md +136 -0
  66. package/assets/skills/interface-review-motion-states.needs-app.md +230 -0
  67. package/assets/skills/interface-review-motion.needs-app.md +209 -0
  68. package/assets/skills/interface-review-performance.needs-app.md +110 -0
  69. package/assets/skills/interface-review-principles.needs-app.md +263 -0
  70. package/assets/skills/interface-review-surfaces.needs-app.md +249 -0
  71. package/assets/skills/interface-review.needs-app.md +199 -0
  72. package/assets/skills/write-a-skill.md +16 -3
  73. package/assets/workflows/feature.js +33 -5
  74. package/assets/workflows/plan.js +71 -4
  75. package/package.json +1 -1
@@ -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 |
@@ -0,0 +1,249 @@
1
+ ---
2
+ name: interface-review-surfaces
3
+ description: Surface recipes for an interface review: concentric radii, optical alignment, shadows instead of depth borders, image outlines, with CSS and Tailwind code. Load when such a finding is worded or fixed. The rules are in interface-review-principles.
4
+ ---
5
+
6
+ # Surfaces
7
+
8
+ Border radius, optical alignment, shadows, and image outlines.
9
+
10
+ ## When to use
11
+
12
+ - A finding of `interface-review` is about nested radii, an off-center icon, a border used for
13
+ depth or an image edge, and the fix needs code.
14
+
15
+ ## Concentric Border Radius
16
+
17
+ When nesting rounded elements, the outer radius must equal the inner radius plus the padding between
18
+ them:
19
+
20
+ ```
21
+ outerRadius = innerRadius + padding
22
+ ```
23
+
24
+ This rule is most useful when nested surfaces are close together. If padding is larger than `24px`,
25
+ treat the layers as separate surfaces and choose each radius independently instead of forcing strict
26
+ concentric math.
27
+
28
+ ### Example
29
+
30
+ ```css
31
+ /* Good: concentric radii */
32
+ .card {
33
+ border-radius: 20px; /* 12 + 8 */
34
+ padding: 8px;
35
+ }
36
+ .card-inner {
37
+ border-radius: 12px;
38
+ }
39
+
40
+ /* Bad: same radius on both */
41
+ .card {
42
+ border-radius: 12px;
43
+ padding: 8px;
44
+ }
45
+ .card-inner {
46
+ border-radius: 12px;
47
+ }
48
+ ```
49
+
50
+ ### Tailwind Example
51
+
52
+ ```tsx
53
+ // Good: outer radius accounts for padding
54
+ <div className="rounded-2xl p-2"> {/* 16px radius, 8px padding */}
55
+ <div className="rounded-lg"> {/* 8px radius = 16 - 8 ✓ */}
56
+ ...
57
+ </div>
58
+ </div>
59
+
60
+ // Bad: same radius on both
61
+ <div className="rounded-xl p-2">
62
+ <div className="rounded-xl"> {/* same radius, looks off */}
63
+ ...
64
+ </div>
65
+ </div>
66
+ ```
67
+
68
+ Mismatched border radii on closely nested surfaces is a common source of visual tension. Calculate
69
+ concentrically when the layers share a visible, even inset; preserve an established component token
70
+ when the layers are independent or the padding is intentionally asymmetric.
71
+
72
+ ## Optical Alignment
73
+
74
+ When geometric centering looks off, align optically instead.
75
+
76
+ ### Buttons with Text + Icon
77
+
78
+ When an icon makes otherwise symmetric padding look unbalanced, use slightly less padding on the
79
+ icon side. A useful starting point is: `icon-side padding = text-side padding - 2px`.
80
+
81
+ ```css
82
+ /* Good: less padding on icon side */
83
+ .button-with-icon {
84
+ padding-inline-start: 16px;
85
+ padding-inline-end: 14px; /* trailing icon side = text side - 2px */
86
+ }
87
+
88
+ /* Bad: equal padding looks like icon is pushed too far right */
89
+ .button-with-icon {
90
+ padding-inline: 16px;
91
+ }
92
+ ```
93
+
94
+ ```tsx
95
+ // Tailwind
96
+ <button className="ps-4 pe-3.5 flex items-center gap-2">
97
+ <span>Continue</span>
98
+ <ArrowRightIcon />
99
+ </button>
100
+ ```
101
+
102
+ ### Play Button Triangles
103
+
104
+ Play icons are triangular and their geometric center is not their visual center. Shift slightly
105
+ right:
106
+
107
+ ```css
108
+ /* Good: optically centered */
109
+ .play-button svg {
110
+ transform: translateX(2px); /* physical correction to the glyph itself */
111
+ }
112
+
113
+ /* Bad: geometrically centered but looks off */
114
+ .play-button svg {
115
+ /* no adjustment */
116
+ }
117
+ ```
118
+
119
+ ### Asymmetric Icons (Stars, Arrows, Carets)
120
+
121
+ Some icons have uneven visual weight. The best fix is adjusting the SVG directly so no extra
122
+ margin/padding is needed in the component code.
123
+
124
+ ```tsx
125
+ // Best: fix in the SVG itself
126
+ // Adjust the viewBox or path to visually center the icon
127
+
128
+ // Fallback: adjust with margin
129
+ <span className="translate-x-px">
130
+ <StarIcon />
131
+ </span>
132
+ ```
133
+
134
+ ## Shadows Instead of Borders
135
+
136
+ For **buttons, cards, and containers** that use a border for depth or elevation, prefer replacing it
137
+ with a subtle `box-shadow`. Shadows adapt to any background since they use transparency; solid
138
+ borders don't. This also helps when using images or multiple colors as backgrounds: solid border
139
+ colors don't work well on backgrounds other than the ones they were designed for.
140
+
141
+ **Do not apply this to dividers** (`border-b`, `border-t`, side borders) or any border whose purpose
142
+ is layout separation rather than element depth. Those should stay as borders.
143
+
144
+ ### Shadow as Border (Light Mode)
145
+
146
+ The shadow is comprised of three layers. The first acts as a 1px border ring, the second adds subtle
147
+ lift, and the third provides ambient depth:
148
+
149
+ ```css
150
+ :root {
151
+ --shadow-border:
152
+ 0px 0px 0px 1px oklch(0 0 0 / 0.06),
153
+ 0px 1px 2px -1px oklch(0 0 0 / 0.06),
154
+ 0px 2px 4px 0px oklch(0 0 0 / 0.04);
155
+ --shadow-border-hover:
156
+ 0px 0px 0px 1px oklch(0 0 0 / 0.08),
157
+ 0px 1px 2px -1px oklch(0 0 0 / 0.08),
158
+ 0px 2px 4px 0px oklch(0 0 0 / 0.06);
159
+ }
160
+ ```
161
+
162
+ ### Shadow as Border (Dark Mode)
163
+
164
+ In dark mode, simplify to a single white ring, since layered depth shadows aren't visible on dark
165
+ backgrounds:
166
+
167
+ ```css
168
+ /* Dark mode: adapt to whatever setup the project uses
169
+ (prefers-color-scheme, class, data attribute, etc.) */
170
+ --shadow-border: 0 0 0 1px oklch(1 0 0 / 0.08);
171
+ --shadow-border-hover: 0 0 0 1px oklch(1 0 0 / 0.13);
172
+ ```
173
+
174
+ ### Usage with Hover Transition
175
+
176
+ Apply the variable and add `transition-[box-shadow]` for a smooth hover:
177
+
178
+ ```css
179
+ .card {
180
+ box-shadow: var(--shadow-border);
181
+ transition-property: box-shadow;
182
+ transition-duration: 150ms;
183
+ transition-timing-function: ease-out;
184
+ }
185
+
186
+ .card:hover {
187
+ box-shadow: var(--shadow-border-hover);
188
+ }
189
+ ```
190
+
191
+ ### When to Use Shadows vs. Borders
192
+
193
+ | Use shadows | Use borders |
194
+ | --- | --- |
195
+ | Cards, containers with depth | Dividers between list items |
196
+ | Buttons with bordered styles | Table cell boundaries |
197
+ | Elevated elements (dropdowns, modals) | Form input outlines (for accessibility) |
198
+ | Elements on varied backgrounds | Hairline separators in dense UI |
199
+ | Hover/focus states for lift effect | |
200
+
201
+ ## Image Outlines
202
+
203
+ Add a subtle `1px` outline with low opacity to images. This creates consistent depth, especially in
204
+ design systems where other elements use borders or shadows.
205
+
206
+ ### Color rules (non-negotiable)
207
+
208
+ - **Light mode**: pure black, `oklch(0 0 0 / 0.1)`.
209
+ - **Dark mode**: pure white, `oklch(1 0 0 / 0.1)`.
210
+ - Never use a near-black or near-white from the project palette (e.g. slate-900, zinc-900,
211
+ `#0a0a0a`, `#111827`, `#f5f5f7`). Tinted outlines pick up the surrounding surface color and read
212
+ as dirt on the image edge.
213
+ - Never match the outline to the project's accent or ink color. The outline is a neutral separator,
214
+ not a themed element.
215
+
216
+ ### Light Mode
217
+
218
+ ```css
219
+ img {
220
+ outline: 1px solid oklch(0 0 0 / 0.1);
221
+ outline-offset: -1px; /* draw the ring just inside the image edge */
222
+ }
223
+ ```
224
+
225
+ ### Dark Mode
226
+
227
+ ```css
228
+ img {
229
+ outline: 1px solid oklch(1 0 0 / 0.1);
230
+ outline-offset: -1px;
231
+ }
232
+ ```
233
+
234
+ ### Tailwind with Dark Mode
235
+
236
+ ```tsx
237
+ <img
238
+ className="outline outline-1 -outline-offset-1 outline-black/10 dark:outline-white/10"
239
+ src={src}
240
+ alt={alt}
241
+ />
242
+ ```
243
+
244
+ Use `outline-black/10` and `outline-white/10` specifically, not `outline-slate-*`, `outline-zinc-*`,
245
+ `outline-neutral-*`, or any tinted scale.
246
+
247
+ **Why outline instead of border?** `outline` never affects layout (no added width or height at any
248
+ offset), and `outline-offset: -1px` draws the ring just inside the image edge so it hugs the corner
249
+ radius instead of sitting outside it.