chore(claude): add component-css-modules-migration skill#1035
Conversation
Captures the two-commit, byte-for-byte-snapshot pattern executed in PR #1034 (ButtonGroup) so the same procedure can be applied mechanically to the remaining components in the CSS Modules migration. The skill enforces a hard scope rule: the migration commit is a pure styling refactor — no bundled a11y refinements, type tightening, consumer updates, or CSS correctness fixes. The visual regression tests are credible only because the migration commit changes nothing visible.
|
Storybook Preview Deployed✅ Preview URL: https://click-5c4zj052s-clickhouse.vercel.app Built from commit: |
|
|
||
| The reason this rule exists: the visual regression test is credible *only* because the migration commit changed nothing visible. If you bundle in a "small" a11y improvement, snapshots regenerate, and the "byte-for-byte" guarantee evaporates. The rule also makes the migration mechanical — there are no judgment calls about which improvements to include. | ||
|
|
||
| The only collateral change you may need: a narrow TypeScript widening (e.g. `HTMLAttributes<HTMLButtonElement>` → `ButtonHTMLAttributes<HTMLButtonElement>`) when the new test stories need a prop like `disabled` to typecheck. That's pure TS, no runtime effect — include it in the baseline commit and call it out. |
There was a problem hiding this comment.
Might want to make sure we include examples of the widening for other types than just Button
There was a problem hiding this comment.
I'll be sure to update the skill as I go. I'll maybe babysit it a bit for the next few migrations.
Why?
Captures the two-commit, byte-for-byte-snapshot pattern executed in #1034 (an example CSS Modules migration, ButtonGroup) so the same procedure can be applied mechanically to the remaining components in the migration list.
The skill lives at
.claude/skills/component-css-modules-migration/SKILL.mdand is committed to the repo so every contributor (and every Claude session) picks it up automatically.What's in the skill
cva/cnwhile all snapshots stay byte-for-byte identical. A prep commit for tooling fixes goes first if needed.yarn test:visual:update(Docker-backed, so-chromium-linux.pngfiles work on any host OS). Never cherry-pick PNGs from prior PRs.theme.click.*reference, match the original selectors exactly (no "improvements"), match cascade order, BEM naming perstylelint.config.js.role="button"), drop transient props, preserveclassNamepassthrough viacn()on both wrapper and per-option levels, preserveforwardRefif the original has it.patchbump with bodymigration of <Name> from styled-components to css modules. no behavior change.— no extra words. Scales mechanically across dozens of migration PRs.--update-snapshotsmode requirement, spread-after-className clobbering variants, missingforwardRef, cherry-picking PNGs, pinning versions down instead of bumping up.Tickets?
N/A
Contribution checklist?
buildcommand runs locally (nothing insrc/changed)Preview?
N/A — the change is a single markdown file under
.claude/skills/.