Css modules
Skill Syo-M/fable-frontend-skills/.claude/skills/css-modules
CSS Modules and styling conventions — design tokens, naming, variants, responsive design, layout, dark mode/theming. Use when styling or visually adjusting components, or editing any *.module.css, tokens, or global styles. For animations/transitions/motion use the `motion` skill instead. 日本語の依頼例:「スタイルを当てて」「見た目を整えて」「デザイン調整」「ダークモード」「レスポンシブ対応」「CSS書いて」。From its SKILL.md
npx -y skills add Syo-M/fable-frontend-skills --skill css-modulesAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 3 stars3 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
4.6 KB, 971 tokens by cl100k_base, as published. Nobody here has run it
CSS Modules
Files & naming
- One module per component, colocated:
UserCard.tsx+UserCard.module.css. - Class names: camelCase (
primaryButton, notprimary-button) — enablesstyles.primaryButtonwithout bracket access. - Name by role, not appearance:
.errorMessagenot.redText. The module scope already namespaces — no BEM prefixes needed. - Import as
styles:import styles from './UserCard.module.css'.
Design tokens — single source of truth
- All colors, spacing, radii, shadows, typography, z-index live as CSS custom properties in
src/styles/tokens.css, defined on:root. - Component modules consume tokens only — the semantic/component tier where tiers exist (see
design-system), never primitives like--blue-600. A raw hex/px value for a themable property in a component module is a bug. - Spacing on a scale (
--space-1…--space-8); z-index from a fixed ladder (--z-dropdown,--z-modal,--z-toast) — neverz-index: 9999. - Theming (dark mode) by redefining tokens — components never branch on theme themselves. Default to
prefers-color-scheme; add[data-theme]only when a user-facing toggle is required, set pre-paint by a tiny inline script (CSP nonce applies — seefrontend-security) to avoid a wrong-theme flash.
Variants & state
- Variants via data attributes, not class string concatenation:
<button className={styles.button} data-variant={variant} data-size={size}>
.button[data-variant='danger'] { background: var(--color-danger); }
- Boolean UI state the same way (
data-open,aria-expanded) — style off ARIA attributes when one exists:.menu[aria-expanded='true']. clsxhas exactly one job here: merging a consumer-passedclassNameprop with the base class. Enumerated variants and boolean state always go through data attributes, never conditional class lists; a component wanting 3+ conditional classes should be restructured into variants.
Layout & responsive
- Mobile-first: base styles, then
@media (min-width: …)upward. Breakpoints documented once intokens.csscomments (custom properties don't work in media queries — keep the canonical list there). - Prefer modern layout primitives: flex
gap/ grid over margin hacks;aspect-ratio; container queries for components that adapt to their container, media queries only for page-level layout. - Aspect-preserving media: give the box a defined
aspect-ratioand useobject-fit: contain/cover. Never size an image withmax-width/max-heightinside a flex item — the main-axis shrink sizes width independently of the height cap and stretches the image (a mixed-aspect-ratio thumbnail grid is where this bites). - Logical properties (
margin-inline,padding-block,inset-inline-start) over physical ones — free RTL support (the foundation thei18nskill builds on). - No fixed heights on text containers; min-height if needed.
Globals — the only allowed global CSS
src/styles/ contains exactly: tokens.css, reset.css, globals.css (base element styles: body, headings, links). Nothing else is global. No :global() in component modules except to target third-party library DOM you don't control — with a comment saying which library.
In Astro projects, the per-component styling primitive is the single-file scoped <style> block instead of *.module.css — see astro. The token/naming/variant rules here still apply.
Motion
- Animate
transformandopacityonly (compositor-friendly); never animatewidth/height/top/leftfor transitions. - Every significant animation (anything beyond a subtle hover/focus transition) respects
@media (prefers-reduced-motion: reduce)— same threshold as thea11yskill. - Durations/easings as tokens (
--duration-fast,--ease-out). - These are the invariants only — escalation (keyframes / WAAPI / animation libraries), View Transitions, entrance/exit animations, and scroll effects live in the
motionskill.
Enforcement
The token/var() and class-naming rules above are machine-enforced by Stylelint — see tooling for the exact rules and the shipped templates/stylelint.config.mjs.
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.
Gives 3 of the 12 instructions most css styling skills give in 971 tokens
Counted across 512 of the 512 authors here whose files we hold, read 2026-09-06
- Animate only transform and opacityhere, and in 32 of 512, across 30 files
- Respect prefers-reduced-motionhere, and in 21 of 512
- Support reduced motion preferencesin 16 of 512, across 6 files
- Use Tailwind CSS for stylingin 14 of 512, across 13 files
- Specify AnimatePresence mode explicitlyin 12 of 512, across 2 files
- Set initial states explicitlyin 12 of 512, across 2 files
- Use semantic HTML elementsin 11 of 512, across 10 files
- Use oklch for color valuesin 11 of 512, across 10 files
- Honor prefers-reduced-motion in animationsin 10 of 512
- Provide a reduced-motion fallback for animationsin 10 of 512, across 9 files
- Use property names in camelCasehere, and in 9 of 512, across 4 files
- Ensure UI animations stay under 300msin 9 of 512, across 6 files
Said here and by no other author read
- Colocate one module per component
- Name classes by role
Grouped from the skills themselves: near-identical wordings counted once, and counted by distinct author, so one author publishing three of these counts once. Length counted with cl100k_base; the agent that loads this file may tokenize it differently.