docs(skill): codify prop spread order and local CSS var patterns#1042
Merged
Conversation
Spreading {...props} before hardcoded attributes (aria-disabled,
tabIndex, onClick) silently overrides consumer-passed values. The
styled-components version of these components put {...props} last,
so the migration must preserve that order. TypeScript doesn't catch
the regression because HTMLAttributes<...> admits those props.
Caught post-merge on CardPrimary (#1038) and CardHorizontal (#1039).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
When a component has color/theme variants that cross many states (default, hover, active, disabled) and many properties (background, title, stroke, description), writing one state rule per variant blows up the file. The pattern adopted in CardHorizontal (#1039) aliases the long global tokens to short local custom properties inside each color modifier block, then writes the state rules once on the base class referencing the short names — the cascade resolves the right value. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Contributor
Storybook Preview Deployed✅ Preview URL: https://click-7mfzk174m-clickhouse.vercel.app Built from commit: |
hoorayimhelping
approved these changes
May 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two refinements to the CSS Modules migration skill, each in its own commit for easy review:
Prop spread order rule — codifies that
{...props}must keep its original position relative to hardcoded attributes (aria-disabled,tabIndex,onClick). Reversing the order silently strips consumer overrides, and TypeScript doesn't catch it becauseHTMLAttributes<...>admits those props. Caught post-merge on CardPrimary (chore(CardPrimary): migrate to CSS Modules with visual regression baseline #1038) and CardHorizontal (chore(CardHorizontal): migrate to CSS Modules with visual regression baseline #1039).Local CSS variable aliasing pattern — codifies the pattern adopted in CardHorizontal (chore(CardHorizontal): migrate to CSS Modules with visual regression baseline #1039) where color/theme variants alias long global tokens (
--click-card-horizontal-default-color-background-hover) to short local custom properties (--card-bg-hover) inside the variant block, then write state rules once on the base class. Avoids exploding the CSS module into one state rule per variant.Test plan
Note
Low Risk
Documentation-only change to an internal migration skill; no runtime or library code is modified.
Overview
Updates the component CSS Modules migration skill (
.claude/skills/component-css-modules-migration/SKILL.md) with two procedural rules learned from post-merge fixes on CardPrimary and CardHorizontal.Commit 2 (TSX): Migrators must keep
{...props}in the same position relative to hardcoded attributes as in the styled-components JSX—typically hardcoded attrs first, then spread, thenclassName={cn(...)}last. Reversing spread order can silently override consumer props liketabIndexwithout TypeScript errors.Commit 2 (CSS module): For theme/color variants that fan out across many states, alias long design tokens to local custom properties inside each variant class and write
:hover/:active/ disabled rules once on the base class via those short vars (pattern documented withCardHorizontal.module.cssas the reference).Common pitfalls: Adds a bullet mirroring the prop-spread-order failure mode, with PR references #1038 and #1039.
Reviewed by Cursor Bugbot for commit 971c5af. Bugbot is set up for automated code reviews on this repo. Configure here.