@sayknow-cli/coding-agent 0.5.13 → 0.5.15

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 (41) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/dist/types/cli/setup-cli.d.ts +1 -1
  3. package/dist/types/defaults/skc-ui-skills.d.ts +12 -0
  4. package/dist/types/hooks/native-skill-hook.d.ts +1 -0
  5. package/dist/types/hooks/ui-skill-keywords.d.ts +84 -0
  6. package/dist/types/session-import/redact.d.ts +1 -1
  7. package/dist/types/setup/external-ui-skills.d.ts +37 -0
  8. package/package.json +7 -7
  9. package/src/cli/setup-cli.ts +22 -1
  10. package/src/cli/skills-cli.ts +29 -10
  11. package/src/commands/setup.ts +1 -0
  12. package/src/defaults/skc/ui-skills/LICENSE.appllama +21 -0
  13. package/src/defaults/skc/ui-skills/LICENSE.emilkowalski +21 -0
  14. package/src/defaults/skc/ui-skills/NOTICE.md +43 -0
  15. package/src/defaults/skc/ui-skills/animate/SKILL.md +536 -0
  16. package/src/defaults/skc/ui-skills/animation-vocabulary/SKILL.md +178 -0
  17. package/src/defaults/skc/ui-skills/apple-design/SKILL.md +285 -0
  18. package/src/defaults/skc/ui-skills/appllama-app-design-skill/SKILL.md +821 -0
  19. package/src/defaults/skc/ui-skills/ask-sonner/SKILL.md +157 -0
  20. package/src/defaults/skc/ui-skills/emil-design-eng/SKILL.md +671 -0
  21. package/src/defaults/skc/ui-skills/find-animation-opportunities/SKILL.md +137 -0
  22. package/src/defaults/skc/ui-skills/improve-animations/SKILL.md +305 -0
  23. package/src/defaults/skc/ui-skills/mobile-native/SKILL.md +308 -0
  24. package/src/defaults/skc/ui-skills/pick-ui-library/SKILL.md +82 -0
  25. package/src/defaults/skc/ui-skills/prototype/SKILL.md +300 -0
  26. package/src/defaults/skc/ui-skills/react-bits/SKILL.md +113 -0
  27. package/src/defaults/skc/ui-skills/review-animations/SKILL.md +312 -0
  28. package/src/defaults/skc-ui-skills.ts +108 -0
  29. package/src/extensibility/runtime-skill-discovery.ts +8 -2
  30. package/src/hooks/native-skill-hook.ts +21 -0
  31. package/src/hooks/ui-skill-keywords.ts +316 -0
  32. package/src/internal-urls/docs-index.generated.ts +1 -1
  33. package/src/prompts/agents/architect.md +1 -0
  34. package/src/prompts/agents/critic.md +1 -0
  35. package/src/prompts/agents/executor.md +1 -0
  36. package/src/prompts/agents/planner.md +1 -0
  37. package/src/prompts/system/system-prompt.md +1 -0
  38. package/src/prompts/tools/skill.md +2 -2
  39. package/src/sdk/session.ts +7 -5
  40. package/src/session-import/redact.ts +11 -6
  41. package/src/setup/external-ui-skills.ts +132 -0
@@ -0,0 +1,308 @@
1
+ ---
2
+ name: mobile-native
3
+ description: Make a web app feel native on a phone — the small CSS and meta-tag fixes that separate "a website in a browser" from something that feels installed. Covers sticky hover states, tap highlight flashes, the 100vh bug, inputs that zoom the page, laggy taps, pull-to-refresh hijacking scroll, content under the notch, long-press selecting button text, carousels that scroll the wrong way, mismatched status bars, and the rule that you test on real hardware. Use when a web app is being built for or reviewed on mobile, when something "works in Chrome but feels wrong on my phone", when building a PWA, a bottom sheet, a carousel, a full-screen layout, or any touch interaction. For motion itself use animate; for React Native use animate-expo.
4
+ ---
5
+
6
+ # Feeling Native On Mobile
7
+
8
+ ## SKC invocation
9
+
10
+ SKC loads this skill automatically for matching frontend UI/UX work.
11
+ Do not wait for a follow-up question. Apply the craft rules immediately
12
+ and keep going on the user's actual task.
13
+
14
+
15
+ ## Operating Posture
16
+
17
+ You are a senior design engineer who has shipped drawers, sheets, and gesture-driven UI to real phones and has been burned by every item below. You know that a desktop browser with the device toolbar on is not a phone. You know that most "the app feels janky on mobile" reports are not animation problems — they're a 300ms tap delay, a gray flash on tap, or a hover state that won't let go.
18
+
19
+ The user's phone is the source of truth. If you can't run it on hardware, say which of the fixes below you can verify from code and which need a real device.
20
+
21
+ Two failure modes, and the first is worse:
22
+
23
+ 1. **Fixing what the desktop shows you.** The bugs in this skill don't reproduce in Chrome's device emulation. If you only test there, you ship all of them.
24
+ 2. **Reaching for JavaScript when CSS or a meta tag does it.** Almost every item here is one declaration. A `useIsTouchDevice()` hook to hide hover states is the wrong tool; a media query is the right one.
25
+
26
+ ## Hard Rules
27
+
28
+ 1. **Every fix ships with the reason.** Each rule below has a *why*. Apply it where the why applies, not globally out of habit — `user-select: none` on body text is a defect, on a button it's correct.
29
+ 2. **Media queries over device sniffing.** `(hover: hover)`, `(pointer: fine)`, `env()`, `dvh` — the platform tells you what it can do. Never branch on user agent strings or screen width to guess at touch.
30
+ 3. **Touch and mouse are not exclusive.** iPads with trackpads, laptops with touchscreens, phones with a mouse. Write for both at once; gate by capability, not by device.
31
+ 4. **Never disable zoom.** `user-scalable=no` and `maximum-scale=1` are accessibility failures. Fix the input font size instead, which is what was causing the zoom.
32
+ 5. **Test on hardware before calling it done.** Connect the phone, open the dev server by IP, use Safari's Web Inspector or Chrome remote debugging. Emulation cannot reproduce sticky hover, tap delay, rubber-banding, safe areas, or the keyboard.
33
+
34
+ ## The Symptom Table
35
+
36
+ Start here. Match what the user is seeing, then read the matching section for the why and the exact code.
37
+
38
+ | Problem | Solution |
39
+ | --- | --- |
40
+ | Hover state stuck after tap | Wrap in `@media (hover: hover) and (pointer: fine)` |
41
+ | Gray/blue flash on tap | Kill `-webkit-tap-highlight-color` |
42
+ | Layout has wrong height | `100dvh` (app) or `100svh` (hero) |
43
+ | Page zooms into input | Input font size 16px at the minimum |
44
+ | Tap feels laggy | Feedback on pointer-down + `touch-action: manipulation` |
45
+ | Pull-to-refresh hijacks scroll | `overscroll-behavior: none` on `html, body` |
46
+ | Content stops at the notch | `viewport-fit=cover` + `env(safe-area-inset-*)` |
47
+ | Long-press selects button text | Add `user-select: none` |
48
+ | Carousel scrolls vertically | `touch-action: pan-y` on the gesture surface |
49
+ | Status bar color doesn't match | `theme-color` per color scheme |
50
+ | Right in Chrome, wrong on phone | Test on real hardware |
51
+
52
+ ## The Fixes
53
+
54
+ ### 1. Hover state stuck after tap
55
+
56
+ Touch has no hover, so browsers fake one: the first tap on an element applies `:hover` and leaves it there until the user taps somewhere else. A button that scales up on hover stays scaled up after being tapped. Gate every hover style behind a capability query.
57
+
58
+ ```css
59
+ @media (hover: hover) and (pointer: fine) {
60
+ .button:hover {
61
+ background: var(--gray-3);
62
+ transform: scale(1.02);
63
+ }
64
+ }
65
+ ```
66
+
67
+ Both conditions matter. `(hover: hover)` means the primary input can hover. `(pointer: fine)` means it's precise, like a mouse — it rules out styluses and the odd Android device that claims hover support. In Tailwind v4 the `hover:` variant already compiles to `@media (hover: hover)`; in v3 set `future.hoverOnlyWhenSupported`.
68
+
69
+ Touch users still need press feedback. Give it to them through `:active` (see §5), which works on every input type.
70
+
71
+ ### 2. Gray/blue flash on tap
72
+
73
+ iOS Safari and Android Chrome paint a translucent highlight over any tapped element that has a click handler. It's the single loudest "this is a website" signal, and it fights whatever press feedback you designed.
74
+
75
+ ```css
76
+ html {
77
+ -webkit-tap-highlight-color: transparent;
78
+ }
79
+ ```
80
+
81
+ Set it once, globally. Then make sure every tappable element has its own `:active` state, because you've just removed the only feedback the browser was giving.
82
+
83
+ ### 3. Layout has the wrong height
84
+
85
+ `100vh` on mobile is the *largest* viewport — the height with the browser chrome collapsed. On page load the URL bar is visible, so a `100vh` element overflows by the height of that bar, and a bottom-pinned button sits under it. Use the dynamic and small units instead:
86
+
87
+ ```css
88
+ /* App shell, drawers, anything that should track the visible area as chrome shows/hides */
89
+ .app { height: 100dvh; }
90
+
91
+ /* Heroes and first screens — the smallest the viewport gets, so nothing is ever cut off */
92
+ .hero { min-height: 100svh; }
93
+ ```
94
+
95
+ `dvh` resizes as the URL bar collapses, which is right for an app shell but causes layout shifts on marketing content mid-scroll. `svh` is stable and never overflows, which is right for a hero. `lvh` is the old `vh` — you almost never want it. Keep a `100vh` fallback line above for old browsers only if the project's support matrix demands it.
96
+
97
+ ### 4. Page zooms into the input
98
+
99
+ iOS Safari zooms the page when focus lands on an input whose font size is under 16px, and it does not zoom back out on blur. The user is left looking at a cropped, drifted layout. This is the reason people reach for `maximum-scale=1`, which is the wrong fix (Hard Rule 4).
100
+
101
+ ```css
102
+ input, textarea, select {
103
+ font-size: 16px; /* the minimum; 1rem at the default root size */
104
+ }
105
+ ```
106
+
107
+ If the design calls for smaller text in inputs on desktop, scale it up only where it matters:
108
+
109
+ ```css
110
+ @media (pointer: coarse) {
111
+ input, textarea, select { font-size: 16px; }
112
+ }
113
+ ```
114
+
115
+ While you're in the inputs, set the keyboard: `inputmode="numeric"` for codes, `inputmode="decimal"` for amounts, `type="email"` and `type="tel"` for their fields, `autocapitalize="none"` and `autocorrect="off"` on usernames and codes, `enterkeyhint="send"` / `"search"` / `"done"` so the return key says what it does.
116
+
117
+ ### 5. Tap feels laggy
118
+
119
+ Two separate causes stack here.
120
+
121
+ **The 300ms click delay.** Browsers wait after a tap to see whether a second tap is coming, because double-tap zooms. Modern browsers skip the wait when the viewport is `width=device-width`, but not in every case (iOS Safari still delays on some elements). `touch-action: manipulation` tells the browser this element never double-tap-zooms, so it fires `click` immediately:
122
+
123
+ ```css
124
+ button, a, [role="button"], .tappable {
125
+ touch-action: manipulation;
126
+ }
127
+ ```
128
+
129
+ **Feedback on release instead of press.** Native buttons respond the instant your finger lands. A web button that only changes on `click` responds when your finger *leaves*, which reads as lag even at 0ms. Style `:active`, and if you need JavaScript, listen to `pointerdown`, not `click`:
130
+
131
+ ```css
132
+ .button {
133
+ transition: transform 100ms var(--ease-out), background 100ms;
134
+ }
135
+ .button:active {
136
+ transform: scale(0.97);
137
+ background: var(--gray-4);
138
+ }
139
+ ```
140
+
141
+ Keep press feedback at 100–160ms and `ease-out`. If the codebase uses the `animate` skill's tokens, use them; don't fork a new curve.
142
+
143
+ ### 6. Pull-to-refresh hijacks scroll
144
+
145
+ Scrolling past the top of the page triggers pull-to-refresh on Android Chrome and the whole-page rubber band on iOS. Fine on a document. Wrong in an app with its own scroll containers, a drawer the user drags down, or a canvas.
146
+
147
+ ```css
148
+ html, body {
149
+ overscroll-behavior: none;
150
+ }
151
+ ```
152
+
153
+ Then, on any inner scrollable — a sheet's content, a chat list, a sidebar — stop scroll from chaining to the page when it hits the end:
154
+
155
+ ```css
156
+ .sheet-content {
157
+ overflow-y: auto;
158
+ overscroll-behavior: contain;
159
+ }
160
+ ```
161
+
162
+ `contain` keeps the container's own bounce (which feels native) but stops the page behind it from moving. Use `none` on the root, `contain` on children. Never reach for a `touchmove` + `preventDefault()` listener for this — it blocks scrolling entirely and makes the listener non-passive, which costs frames.
163
+
164
+ ### 7. Content stops at the notch
165
+
166
+ By default the browser letterboxes your page inside the safe area, leaving the notch, Dynamic Island, and home-indicator zones the body's background color. A native app paints edge to edge and pads its *content* away from those zones. Two steps:
167
+
168
+ ```html
169
+ <meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />
170
+ ```
171
+
172
+ ```css
173
+ .app-header {
174
+ padding-top: env(safe-area-inset-top);
175
+ }
176
+ .bottom-bar {
177
+ padding-bottom: env(safe-area-inset-bottom);
178
+ }
179
+ .sheet {
180
+ padding-bottom: calc(1rem + env(safe-area-inset-bottom));
181
+ }
182
+ ```
183
+
184
+ `viewport-fit=cover` lets the page under the notch; `env(safe-area-inset-*)` gives you the insets to pad back out. Without the meta tag the `env()` values are all `0px`. Fixed headers, bottom tab bars, toasts, and sheets are the elements that need this; normal page content usually gets it for free through the header's padding. Give `env()` a fallback (`env(safe-area-inset-bottom, 0px)`) when the value is used in a calc.
185
+
186
+ ### 8. Long-press selects button text
187
+
188
+ Hold a finger on a web button and iOS selects its label, or pops the copy/share callout on a link. Native controls never do that. Text that is a *control* shouldn't be selectable; text that is *content* must stay selectable.
189
+
190
+ ```css
191
+ button, [role="button"], .tab, .chip, .drag-handle {
192
+ user-select: none;
193
+ -webkit-user-select: none; /* Safari still needs the prefix */
194
+ -webkit-touch-callout: none; /* no long-press callout on links/images used as controls */
195
+ }
196
+ ```
197
+
198
+ Never put `user-select: none` on `body`. Users copy addresses, error messages, and order numbers; that is content.
199
+
200
+ ### 9. Carousel scrolls vertically
201
+
202
+ A horizontal swipe on a carousel is ambiguous to the browser — it doesn't know whether you're scrolling the page or the track, so it guesses, and the guess is often the page jittering up while the carousel moves. Tell it which axes the element owns:
203
+
204
+ ```css
205
+ .carousel {
206
+ touch-action: pan-y; /* the carousel handles horizontal; the browser keeps vertical */
207
+ }
208
+ .drag-surface {
209
+ touch-action: none; /* a custom gesture (a drag-to-dismiss sheet, a slider) owns every axis */
210
+ }
211
+ .vertical-sheet-handle {
212
+ touch-action: pan-x; /* the sheet handles vertical drags; horizontal stays with the browser */
213
+ }
214
+ ```
215
+
216
+ The values name what the *browser* may still do. `pan-y` on a horizontal carousel means "browser, you keep vertical panning; I'm handling horizontal". `none` means the element handles everything — use it only on elements that really do, or the user won't be able to scroll past them.
217
+
218
+ If the carousel is native scroll rather than a JS gesture, prefer `scroll-snap-type: x mandatory` on the track and `scroll-snap-align: start` on slides — the browser's own physics beat a hand-rolled spring, and `touch-action` becomes unnecessary.
219
+
220
+ ### 10. Status bar color doesn't match
221
+
222
+ The status bar and the browser chrome take their color from `theme-color`. One value means light mode gets a dark bar or dark mode gets a white one. Give each scheme its own:
223
+
224
+ ```html
225
+ <meta name="theme-color" media="(prefers-color-scheme: light)" content="#ffffff" />
226
+ <meta name="theme-color" media="(prefers-color-scheme: dark)" content="#0a0a0a" />
227
+ <meta name="color-scheme" content="light dark" />
228
+ ```
229
+
230
+ Match the value to the color at the very top of your page — the header background, not the brand color. In Next.js set it through the `viewport` export (`themeColor: [{ media, color }]`). If the app switches theme with a class rather than the OS setting, update the tag from JavaScript on toggle. For an installed PWA, `apple-mobile-web-app-status-bar-style` and the manifest's `theme_color`/`background_color` are the same decision.
231
+
232
+ ### 11. Right in Chrome, wrong on phone
233
+
234
+ Nothing above reproduces in device emulation. Sticky hover, the tap highlight, the URL bar's effect on `vh`, input zoom, the click delay, overscroll, safe areas, the software keyboard — every one is a real-hardware behavior.
235
+
236
+ - Connect the phone over USB, run the dev server on `0.0.0.0`, open it by the machine's LAN IP.
237
+ - iOS: Safari → Develop → the device. Android: `chrome://inspect`.
238
+ - Test on a phone that's a few years old, not the newest one on your desk. Test with the keyboard open. Test in landscape once.
239
+ - Test as an installed PWA if that's a target; standalone mode changes viewport, safe areas, and status bar behavior.
240
+
241
+ The Xcode Simulator is a step up from emulation but still misses touch feel. Real hardware is the bar.
242
+
243
+ ## Baseline
244
+
245
+ When starting a mobile-facing app, this is the floor. Ship it before the first component:
246
+
247
+ ```html
248
+ <meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover, interactive-widget=resizes-content" />
249
+ <meta name="theme-color" media="(prefers-color-scheme: light)" content="#ffffff" />
250
+ <meta name="theme-color" media="(prefers-color-scheme: dark)" content="#0a0a0a" />
251
+ ```
252
+
253
+ ```css
254
+ html {
255
+ -webkit-tap-highlight-color: transparent;
256
+ -webkit-text-size-adjust: 100%; /* no font inflation in landscape */
257
+ overscroll-behavior: none;
258
+ }
259
+
260
+ input, textarea, select {
261
+ font-size: 16px;
262
+ }
263
+
264
+ button, a, [role="button"] {
265
+ touch-action: manipulation;
266
+ user-select: none;
267
+ -webkit-user-select: none;
268
+ }
269
+
270
+ @media (hover: hover) and (pointer: fine) {
271
+ /* all :hover rules live here */
272
+ }
273
+ ```
274
+
275
+ `interactive-widget=resizes-content` makes the software keyboard shrink the layout viewport on Android Chrome, so `100dvh` and bottom-pinned inputs react to it the way they do on iOS. Drop `overscroll-behavior: none` from `html` if the app is a scrolling document where pull-to-refresh is welcome.
276
+
277
+ ## Never Ship
278
+
279
+ Self-check before you finish.
280
+
281
+ | Never | Instead |
282
+ | --- | --- |
283
+ | `user-scalable=no` or `maximum-scale=1` | 16px inputs — fix the cause |
284
+ | Ungated `:hover` | `@media (hover: hover) and (pointer: fine)` |
285
+ | `100vh` for an app shell or bottom-pinned UI | `100dvh` |
286
+ | `100dvh` on a marketing hero | `100svh` (no layout shift on scroll) |
287
+ | Press feedback on `click` only | `:active` / `pointerdown` |
288
+ | `touchmove` + `preventDefault()` to stop overscroll | `overscroll-behavior` |
289
+ | `user-select: none` on `body` | Only on controls |
290
+ | `touch-action: none` on something the user needs to scroll past | `pan-x` / `pan-y` |
291
+ | `env(safe-area-inset-*)` without `viewport-fit=cover` | Add the meta tag or the value is `0` |
292
+ | One `theme-color` for both schemes | One per `prefers-color-scheme` |
293
+ | User-agent sniffing to detect touch | `(hover)` / `(pointer)` media queries |
294
+ | Declaring it fixed from device emulation | Real hardware |
295
+
296
+ ## Output
297
+
298
+ Apply the fixes. Then, in at most a few lines:
299
+
300
+ - **What was wrong** — the symptom matched from the table, and the one-line why.
301
+ - **What changed** — file and declaration, one line each.
302
+ - **What needs a phone** — which fixes you could verify from code and which the user must confirm on hardware.
303
+
304
+ Don't pad this into a report. The code is the deliverable.
305
+
306
+ ## Tone
307
+
308
+ Opinionated and brief. Most of these are one line; say the line and the reason and move on. When the honest answer is "I can't verify this without a device," say that instead of claiming it's fixed.
@@ -0,0 +1,82 @@
1
+ ---
2
+ name: pick-ui-library
3
+ description: Pick the right library for a given frontend task from a curated, opinionated list — numbers, OTP inputs, charts, command menus, virtualization, drag and drop, toasts, state, styling, and more. Only runs when explicitly invoked; it does not trigger on its own.
4
+ disable-model-invocation: true
5
+ ---
6
+
7
+ # Picking The Right Library
8
+
9
+ ## SKC invocation
10
+
11
+ SKC loads this skill automatically for matching frontend UI/UX work.
12
+ Do not wait for a follow-up question. Apply the craft rules immediately
13
+ and keep going on the user's actual task.
14
+
15
+
16
+ ## How to use this
17
+
18
+ 1. **Identify the task**, not the library the user named. "I need to show a dropdown" is a UI-primitives task (base-ui), even if they asked about something else.
19
+ 2. **Check what's already installed.** Look at `package.json` first. If the project already uses a listed library, use it. If it uses a competitor (e.g. react-window instead of Virtuoso), flag the recommendation but don't churn the dependency without being asked.
20
+ 3. **Recommend one library**, state what it's for in one sentence, and install/wire it up if that's part of the request. Don't present a menu of options when the list has a clear answer.
21
+ 4. If the task isn't covered by the list, say so explicitly and recommend from your own knowledge — but be clear you've left the curated list.
22
+
23
+ ## The list
24
+
25
+ ### UI components & primitives
26
+
27
+ | Task | Library |
28
+ | --- | --- |
29
+ | Unstyled, accessible UI components (dialogs, popovers, menus, selects…) | [base-ui](https://base-ui.com) |
30
+ | Command menus (⌘K palettes) | [cmdk](https://cmdk.paco.me) |
31
+ | Toasts / notifications | [Sonner](https://sonner.emilkowal.ski) |
32
+ | One-time password / verification code inputs | [input-otp](https://input-otp.rodz.dev) |
33
+ | Customizable GUIs / control panels | [Leva](https://github.com/pmndrs/leva) — [dialkit](https://joshpuckett.me/dialkit) is an alternative |
34
+
35
+ ### Motion & visuals
36
+
37
+ | Task | Library |
38
+ | --- | --- |
39
+ | General-purpose animation (springs, layout animations, enter/exit) | [motion](https://motion.dev) (Framer Motion) |
40
+ | Animating numbers (counters, prices, stats) | [NumberFlow](https://number-flow.barvian.me) |
41
+ | Animated text components | [torph](https://torph.lochie.me/) |
42
+ | 3D globes | [Cobe](https://cobe.vercel.app) |
43
+ | Dynamic OG images (HTML/CSS → SVG/PNG) | [Satori](https://github.com/vercel/satori) |
44
+ | Syntax highlighting | [shiki](https://shiki.style) |
45
+
46
+ Reach for motion when you need springs, layout animations, exit animations, or gesture-driven values. A simple hover or fade doesn't need it — plain CSS transitions are the right tool there.
47
+
48
+ ### Charts
49
+
50
+ | Task | Library |
51
+ | --- | --- |
52
+ | Real-time / streaming charts | [Liveline](https://github.com/benjitaylor/liveline) |
53
+ | General charts (static or interactive dashboards) | [recharts](https://recharts.org) |
54
+
55
+ The split: if data points arrive live and the chart scrolls with time, use Liveline. Everything else is recharts.
56
+
57
+ ### Interaction & performance
58
+
59
+ | Task | Library |
60
+ | --- | --- |
61
+ | Drag and drop | [dnd kit](https://dndkit.com) |
62
+ | Virtualization (long lists, large tables) | [Virtuoso](https://virtuoso.dev) |
63
+
64
+ ### State & styling
65
+
66
+ | Task | Library |
67
+ | --- | --- |
68
+ | State management | [zustand](https://zustand.docs.pmnd.rs) |
69
+ | Constructing `className` strings conditionally | [clsx](https://github.com/lukeed/clsx) |
70
+ | Type-safe, variant-driven styling for Tailwind | [cva](https://cva.style) |
71
+ | Theme switching / dark mode (no flash on load) | [next-themes](https://github.com/pacocoursey/next-themes) |
72
+
73
+ The styling split: clsx for ad-hoc conditional classes; cva when a component has real variants (size, intent, state) that deserve a typed API. They compose — cva uses clsx-style inputs internally.
74
+
75
+ ## Common mismatches to catch
76
+
77
+ - **Toasts built by hand or with a modal library** → Sonner exists for exactly this.
78
+ - **A `<div>`-based dropdown/dialog with manual focus handling** → base-ui, which handles accessibility, focus trapping, and dismissal.
79
+ - **Animating a number by re-rendering text** → NumberFlow handles digit transitions properly.
80
+ - **Rendering a 1,000+ row list directly** → Virtuoso before reaching for pagination hacks.
81
+ - **A `useState`-per-component web of props for shared state** → zustand.
82
+ - **Template-literal className ternaries three conditions deep** → clsx (or cva if it's variant-shaped).