converting-css-modules-to-tailwind
Skill2 starsChanged 7 months agoMITView on GitHub
Migrate CSS Modules (.module.css/.module.scss) to Tailwind utility classes. Handles styles object removal, className interpolation, composition, and global overrides. Use when the user says "/converting-css-modules-to-tailwind", "converting css modules to tailwind", or asks about converting css modules to tailwind.
2 other projects use a version of this, 2 of them edited.
Adopted by
Most recently taken up by
- ZeroTokenClaw/agents-skillsedited, first seen Sep 21, 2026
- matarpeles/skills-registry-demoedited, first seen May 5, 2026
Other versions2 projects use a version of this.
Word for word · 0
None found.
Edited · 2
- ZeroTokenClaw/agents-skills★ 199% same
- matarpeles/skills-registry-demo★ 099% same
Wrote their own version · 0
None found.
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository85 other files it gives its agents.
- accessibility-auditingSkill
- adding-analyticsSkill
- adding-api-docsSkill
- adding-authSkill
- adding-dockerSkill
- adding-e2e-testsSkill
- adding-error-trackingSkill
- adding-feature-flagsSkill
- adding-stripeSkill
- api-smoke-testingSkill
- architecture-decision-recordsSkill
- auditing-performanceSkill
- auditing-securitySkill
- auto-type-checkingSkill
- babysitting-prSkill
- best-of-n-solvingSkill
- building-skills-from-patternsSkill
- cavemanSkill
- codebase-onboardingSkill
- comparing-branches-visuallySkill
- converting-css-to-tailwindSkill
- creating-prSkill
- dark-mode-testingSkill
- database-designSkill
- design-an-interfaceSkill
- detecting-port-conflictsSkill
- domain-modelSkill
- edit-articleSkill
- exporting-to-pngSkill
- finding-dev-server-urlSkill
- fixing-broken-linksSkill
- form-testingSkill
- generating-imagesSkill
- git-guardrails-claude-codeSkill
- github-triageSkill
- grill-meSkill
- grinding-until-passSkill
- improve-codebase-architectureSkill
- incident-responseSkill
- kubernetes-deployingSkill
- migrate-to-shoehornSkill
- monitoring-terminal-errorsSkill
- network-request-auditingSkill
- obsidian-vaultSkill
- parallel-ci-triageSkill
- parallel-code-reviewSkill
- parallel-exploringSkill
- parallel-test-fixingSkill
- profiling-performanceSkill
- prompt-engineeringSkill
- python-tdd-with-uvSkill
- qaSkill
- react-native-patternsSkill
- recording-browser-flow-as-testSkill
- request-refactor-planSkill
- responsive-testingSkill
- reviewing-codeSkill
- saving-workspace-contextSkill
- scaffold-exercisesSkill
- screenshotting-changelogSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
9 rules. About 0 are common, 2 are distinctive, and 7 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
7
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 15
Read the .module.css file and the component that imports it.
- Very specific: line 88
Remove the import styles from './Xxx.module.css' line
- Very specific: line 89
Delete the .module.css / .module.scss file
- Very specific: line 90
If the component had a co-located index.ts barrel that re-exported styles, update it
- Distinctive: line 91
Search the codebase for any other imports of the deleted module
- Distinctive: line 92
Run the app and verify visually — check for regressions
- Very specific: line 97
Keep conditional logic in clsx() or template literals, not in CSS
- Very specific: line 98
If a module has pseudo-element styles (:before, :after with content), those need before: / after: prefixes plus content-['...'] in Tailwind
- Very specific: line 100
Don't create @apply classes to replicate what the module did — the goal is to eliminate the indirection
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Converting CSS Modules to Tailwind
Migrate a component from CSS Modules (.module.css / .module.scss) to Tailwind utility classes.
Workflow
1. Inventory the Module
Read the .module.css file and the component that imports it. Map every styles.xxx reference to the CSS rule it resolves to.
// Before
import styles from './Card.module.css';
<div className={styles.card}>
<h2 className={styles.title}>{title}</h2>
<p className={styles.body}>{children}</p>
</div>/* Card.module.css */
.card { display: flex; flex-direction: column; gap: 16px; padding: 24px; border-radius: 12px; background: white; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
.title { font-size: 20px; font-weight: 600; color: #111827; }
.body { font-size: 14px; color: #6b7280; line-height: 1.6; }2. Convert Each Class
Replace styles.xxx with equivalent Tailwind utilities:
// After
<div className="flex flex-col gap-4 p-6 rounded-xl bg-white shadow-sm">
<h2 className="text-xl font-semibold text-gray-900">{title}</h2>
<p className="text-sm text-gray-500 leading-relaxed">{children}</p>
</div>3. Handle CSS Modules Patterns
composes keyword:
.base { padding: 8px 16px; border-radius: 4px; }
.primary { composes: base; background: blue; color: white; }→ Flatten into a single set of utilities. If reuse is needed, extract a component, not a class.
Conditional classNames with clsx/classnames:
// Before
className={clsx(styles.button, isActive && styles.active)}
// After
className={clsx("px-4 py-2 rounded", isActive && "bg-blue-600 text-white")}Dynamic class selection:
// Before
className={styles[variant]}
// After — use a lookup object
const variantClasses = {
primary: "bg-blue-600 text-white hover:bg-blue-700",
secondary: "bg-gray-100 text-gray-900 hover:bg-gray-200",
danger: "bg-red-600 text-white hover:bg-red-700",
};
className={variantClasses[variant]}CSS Modules global overrides:
:global(.some-library-class) { ... }→ Move to globals.css with @layer components { } or use Tailwind's @apply in the global stylesheet.
SCSS features (nesting, variables, mixins):
- Nested selectors → flatten into utility classes on each element
- SCSS
$variables→ map totailwind.config.tstheme values - Mixins → replace with utility composition or extract components
4. Clean Up
- Remove the
import styles from './Xxx.module.css'line - Delete the
.module.css/.module.scssfile - If the component had a co-located
index.tsbarrel that re-exported styles, update it - Search the codebase for any other imports of the deleted module
- Run the app and verify visually — check for regressions
Rules
- Convert one component at a time — don't batch entire directories
- Keep conditional logic in
clsx()or template literals, not in CSS - If a module has pseudo-element styles (
:before,:afterwithcontent), those needbefore:/after:prefixes pluscontent-['...']in Tailwind - For
:nth-child,:first-of-type, etc. — check if Tailwind has a matching variant, otherwise keep a minimal CSS rule - Don't create
@applyclasses to replicate what the module did — the goal is to eliminate the indirection
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

