Agent skill

CSS Modules

by MadAppGang in MadAppGang/claude-code

CSS Modules with Lightning CSS and PostCSS for component-scoped styling.

MITAuto-check passedFrontend & Design

Install CSS Modules

skills CLI
$ npx skills add MadAppGang/claude-code --skill css-modules -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install MadAppGang/claude-code css-modules --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/MadAppGang/claude-code.git skills-src && mkdir -p .claude/skills && cp -r skills-src/plugins/dev/skills/frontend/css-modules .claude/skills/css-modules && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
css-modules
GitHub stars
283
Token cost
~3.2k tokens
SKILL.md length
480 words
Files
1
Skills in repo
69
Repo updated
First seen
Licence
MIT

At a glance

CSS Modules with Lightning CSS and PostCSS for component-scoped styling.

  • Building complex animations
  • SKILL.md covers Overview, When to Use CSS Modules, Documentation Index and CSS Modules Fundamentals, plus 4 more sections
  • Calls npm and npx
  • Styling third-party components

What it does

CSS Modules is an agent skill from MadAppGang/claude-code. CSS Modules with Lightning CSS and PostCSS for component-scoped styling. Covers .module.css patterns, TypeScript integration, Vite configuration, and composition. Use when building complex animations, styling third-party components, or migrating legacy CSS.

Its SKILL.md is about 3.2k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Frontend & Design, covering CSS and styling. It works with Vite and TypeScript. The repository describes itself as: claude code plugins marketplace. The licence is MIT.

When your agent uses it

  • Building complex animations
  • Styling third-party components
  • Migrating legacy CSS

Example prompts

  • “/css-modules”

Requirements

  • Node.js

What it can do on your machine

Read from SKILL.md and the folder at commit 6097ad4. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • npm
    • npx

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Links to these hosts (documentation or services it may open):

    • github.com
    • lightningcss.dev
    • vite.dev

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

CSS Modules loads about 3.2k tokens when it runs. Until then it costs about 68 tokens; SKILL.md has 480 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~68
When it runs · the whole SKILL.md, loaded when a task matches
~3.2k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from MadAppGang/claude-code at commit 6097ad4, republished under its MIT licence (© MadAppGang). 480 words, ~3,183 tokens.

Download SKILL.mdSave it as .claude/skills/css-modules/SKILL.md (or your agent's skills folder).
name
css-modules
description
CSS Modules with Lightning CSS and PostCSS for component-scoped styling. Covers *.module.css patterns, TypeScript integration, Vite configuration, and composition. Use when building complex animations, styling third-party components, or migrating legacy CSS.

CSS Modules

Overview

CSS Modules provide locally-scoped CSS by automatically generating unique class names at build time. This prevents style conflicts and enables true component encapsulation.

When to Use CSS Modules

Use CaseCSS ModulesTailwind
Complex animationsBestGood
Third-party component stylingBestHarder
Legacy CSS migrationBestRefactor needed
Rapid prototypingSlowerBest
Design system utilitiesNot idealBest
Component encapsulationBestN/A
Team with CSS expertiseBestEither

Hybrid Approach: Use both together - Tailwind for utilities, CSS Modules for complex components.


Documentation Index

Vite Integration
TopicURLDescription
CSS Modules in Vitehttps://vite.dev/guide/features#css-modulesVite's built-in support
Lightning CSShttps://vite.dev/guide/features#lightning-cssFast CSS transforms
PostCSShttps://vite.dev/guide/features#postcssPostCSS configuration
Lightning CSS
TopicURLDescription
Documentationhttps://lightningcss.dev/docs.htmlOfficial docs
CSS Moduleshttps://lightningcss.dev/css-modules.htmlModule support
Transpilationhttps://lightningcss.dev/transpilation.htmlBrowser targeting
Bundlinghttps://lightningcss.dev/bundling.htmlCSS bundling
CSS Modules Spec
TypeScript Integration
TopicURLDescription
typed-css-moduleshttps://github.com/Quramy/typed-css-modulesGenerate .d.ts files
vite-plugin-css-modules-dtshttps://github.com/mrcjkb/vite-plugin-css-modules-dtsVite plugin

CSS Modules Fundamentals

File Naming Convention
src/
├── components/
│   ├── Button/
│   │   ├── Button.tsx
│   │   ├── Button.module.css      # CSS Module
│   │   └── Button.test.tsx
│   └── Card/
│       ├── Card.tsx
│       ├── Card.module.css        # CSS Module
│       └── index.ts

Files ending in .module.css are automatically processed as CSS Modules.

Basic Usage
css
/* Button.module.css */
.button {
  padding: 0.5rem 1rem;
  border-radius: 0.375rem;
  font-weight: 500;
  transition: background-color 150ms ease;
}

.primary {
  background-color: hsl(221, 83%, 53%);
  color: white;
}

.primary:hover {
  background-color: hsl(224, 76%, 48%);
}

.secondary {
  background-color: hsl(0, 0%, 96%);
  color: hsl(0, 0%, 9%);
}
tsx
// Button.tsx
import styles from './Button.module.css'

interface ButtonProps {
  variant?: 'primary' | 'secondary'
  children: React.ReactNode
}

export function Button({ variant = 'primary', children }: ButtonProps) {
  return (
    <button className={`${styles.button} ${styles[variant]}`}>
      {children}
    </button>
  )
}
Generated Class Names
html
<!-- Input -->
<button class="${styles.button} ${styles.primary}">

<!-- Output (generated) -->
<button class="Button_button_x7d9f Button_primary_a3k2j">
Local vs Global Scope
css
/* Local by default */
.button {
  /* Generates: Button_button_hash */
}

/* Explicit local */
:local(.button) {
  /* Same as above */
}

/* Global (escape hatch) */
:global(.external-library-class) {
  /* Kept as-is: .external-library-class */
}

/* Global within local */
.card :global(.markdown-body) {
  /* Scoped parent, global child */
}

Composition

composes Keyword

Share styles between classes:

css
/* base.module.css */
.flexCenter {
  display: flex;
  align-items: center;
  justify-content: center;
}

.interactive {
  cursor: pointer;
  transition: all 150ms ease;
}
css
/* Button.module.css */
.button {
  composes: flexCenter from './base.module.css';
  composes: interactive from './base.module.css';
  padding: 0.5rem 1rem;
}
Multiple Compositions
css
.primaryButton {
  composes: button;
  composes: primary from './colors.module.css';
  composes: rounded from './shapes.module.css';
}
Usage in React
tsx
// Composed class automatically includes all composed classes
<button className={styles.primaryButton}>
  {/* Renders: Button_primaryButton_x Button_button_y colors_primary_z shapes_rounded_w */}
</button>

Vite Configuration

Lightning CSS is 100x faster than PostCSS for transforms:

bash
npm install lightningcss browserslist
typescript
// vite.config.ts
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import browserslistToTargets from 'lightningcss/browserslist'
import browserslist from 'browserslist'

export default defineConfig({
  plugins: [react()],
  css: {
    transformer: 'lightningcss',
    lightningcss: {
      targets: browserslistToTargets(browserslist('>= 0.25%')),
      cssModules: {
        // Class name pattern
        pattern: '[name]__[local]_[hash:5]',
        // Or for production:
        // pattern: '[hash:8]'
      }
    }
  },
  build: {
    cssMinify: 'lightningcss'
  }
})
Class Name Patterns
PatternExample Output
[name]__[local]_[hash:5]Button__primary_a3k2j
[local]_[hash:8]primary_a3k2j9x1
[hash:8]a3k2j9x1 (production)
Lightning CSS Features (Included)

Lightning CSS automatically handles:

  • Vendor prefixing (replaces autoprefixer)
  • Modern syntax transpilation
  • Nesting
  • Custom media queries
  • Color functions (oklch, lab, lch)
PostCSS Configuration (When Needed)

For plugins Lightning CSS doesn't support:

javascript
// postcss.config.js
export default {
  plugins: {
    'postcss-import': {},
    'postcss-custom-media': {},
    // Don't use: autoprefixer (Lightning CSS handles this)
    // Don't use: postcss-nested (Lightning CSS handles this)
  }
}

Note: Use Lightning CSS for transforms, PostCSS only for unsupported plugins.


TypeScript Integration

Type Declarations

Without types, TypeScript doesn't know the shape of CSS modules:

typescript
// This would error without declarations
import styles from './Button.module.css'
styles.button  // TS error: Property 'button' does not exist
Show full SKILL.md (193 more words)Show less
Option 1: Wildcard Declaration (Simple)
typescript
// src/vite-env.d.ts or src/types/css-modules.d.ts
declare module '*.module.css' {
  const classes: { [key: string]: string }
  export default classes
}

Pros: No extra tooling Cons: No autocomplete, no type safety

bash
npm install -D vite-plugin-css-modules-dts
typescript
// vite.config.ts
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import cssModulesDts from 'vite-plugin-css-modules-dts'

export default defineConfig({
  plugins: [
    react(),
    cssModulesDts({
      // Generate .d.ts next to .module.css files
      outputDir: '.',
    })
  ]
})

Generated files:

typescript
// Button.module.css.d.ts (auto-generated)
declare const styles: {
  readonly button: string
  readonly primary: string
  readonly secondary: string
}
export default styles

Pros: Full autocomplete, type safety, catches typos Cons: Generated files in source (add to .gitignore)

Option 3: CLI Generation
bash
npm install -D typed-css-modules

# Generate declarations
npx tcm src --pattern '**/*.module.css'

# Watch mode
npx tcm src --pattern '**/*.module.css' --watch

Add to package.json:

json
{
  "scripts": {
    "css:types": "tcm src --pattern '**/*.module.css'",
    "css:types:watch": "tcm src --pattern '**/*.module.css' --watch"
  }
}

Patterns

Component-Scoped Styling
css
/* Card.module.css */
.card {
  border-radius: 0.5rem;
  background: white;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.header {
  padding: 1rem;
  border-bottom: 1px solid hsl(0, 0%, 90%);
}

.content {
  padding: 1.5rem;
}

.footer {
  padding: 1rem;
  background: hsl(0, 0%, 98%);
}
tsx
// Card.tsx
import styles from './Card.module.css'

export function Card({ children }: { children: React.ReactNode }) {
  return <div className={styles.card}>{children}</div>
}

Card.Header = ({ children }: { children: React.ReactNode }) => (
  <header className={styles.header}>{children}</header>
)

Card.Content = ({ children }: { children: React.ReactNode }) => (
  <div className={styles.content}>{children}</div>
)

Card.Footer = ({ children }: { children: React.ReactNode }) => (
  <footer className={styles.footer}>{children}</footer>
)
CSS Variables with Modules
css
/* theme.css (global) */
:root {
  --color-primary: hsl(221, 83%, 53%);
  --color-primary-dark: hsl(224, 76%, 48%);
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
}

/* Button.module.css */
.button {
  background-color: var(--color-primary);
  padding: var(--spacing-sm) var(--spacing-md);
}

.button:hover {
  background-color: var(--color-primary-dark);
}
Theming with CSS Variables
css
/* theme.module.css */
.light {
  --bg: white;
  --text: hsl(0, 0%, 9%);
  --border: hsl(0, 0%, 90%);
}

.dark {
  --bg: hsl(0, 0%, 9%);
  --text: hsl(0, 0%, 98%);
  --border: hsl(0, 0%, 20%);
}

/* Component.module.css */
.component {
  background-color: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
}
Complex Animations

CSS Modules excel at complex animations:

css
/* Modal.module.css */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  transition: opacity 200ms ease;
}

.overlayVisible {
  composes: overlay;
  opacity: 1;
}

.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.95);
  opacity: 0;
  transition: all 200ms cubic-bezier(0.16, 1, 0.3, 1);
}

.modalVisible {
  composes: modal;
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
}

@keyframes slideIn {
  from {
    transform: translate(-50%, -50%) translateY(20px) scale(0.95);
    opacity: 0;
  }
  to {
    transform: translate(-50%, -50%) translateY(0) scale(1);
    opacity: 1;
  }
}

.modalAnimated {
  animation: slideIn 300ms cubic-bezier(0.16, 1, 0.3, 1);
}

Hybrid Approach: CSS Modules + Tailwind

Use both together for maximum flexibility:

tsx
import styles from './ComplexCard.module.css'

function ComplexCard({ title, children }: Props) {
  return (
    // Tailwind for layout, CSS Module for complex styles
    <div className={`${styles.card} p-4 md:p-6`}>
      <h2 className={`${styles.title} text-lg font-semibold mb-2`}>
        {title}
      </h2>
      <div className={styles.animatedContent}>
        {children}
      </div>
    </div>
  )
}
When to Use Which
ScenarioApproach
Layout utilities (flex, grid, spacing)Tailwind
Responsive utilitiesTailwind
State variants (hover, focus)Tailwind
Complex animationsCSS Modules
Keyframe animationsCSS Modules
Third-party component overridesCSS Modules
Component state classesCSS Modules
Design system utilitiesTailwind
One-off complex stylesCSS Modules

Performance Benefits

Lightning CSS Advantages
FeatureSpeed Improvement
CSS parsing100x faster than PostCSS
Vendor prefixingBuilt-in, instant
MinificationFaster than cssnano
BundlingParallel processing
Dead Code Elimination

Vite automatically eliminates unused CSS:

  • CSS Modules are naturally tree-shaken (only imported classes included)
  • Lightning CSS removes unused selectors
Bundle Size Optimization
typescript
// vite.config.ts
export default defineConfig({
  build: {
    cssMinify: 'lightningcss',
    cssCodeSplit: true,  // Separate CSS per chunk
  }
})

  • tailwindcss - Utility-first CSS (complementary approach)
  • shadcn-ui - Component library using CSS variables
  • react-typescript - Component patterns with className
  • testing-frontend - Testing styled components

© MadAppGang, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in plugins/dev/skills/frontend/css-modules of MadAppGang/claude-code.

Open the folder on GitHubat commit 6097ad4

Compare with similar skills

CSS Modules next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

CSS Modules compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
CSS Modules this skillMadAppGang/claude-code283—~3.2kAutomated safety check: PassMIT
Cross Platform Tauri UIifer47/markeron1.2k—~2kAutomated safety check: PassMIT
Vuetify Skilldlogue/vite-vuetify-ts-starter1811 repos~1.9kAutomated safety check: PassMIT
Rasengan Configrasengan-dev/rasenganjs125—~1.1kAutomated safety check: PassMIT
Redesign My Landingpageinstructa/agent-skills139—~1.8kAutomated safety check: PassNone
Ink Tui Wizardnovuhq/novu40k—~1.9kAutomated safety check: PassMIT

Similar skills

  • Cross-platform UI styling for MarkerOn Tauri app (macOS WKWebView vs Windows WebView2).

    1.2k GitHub stars~2k tokensUpdated 8 days ago
    Frontend & DesignAuto-check passed
  • Vuetify Skilld

    logue/vite-vuetify-ts-starter

    Vue Material Component Framework. An agent skill from logue/vite-vuetify-ts-starter.

    181 GitHub starsUsed in 1 repo~1.9k tokens
    Frontend & DesignAuto-check passed
  • Rasengan Config

    rasengan-dev/rasenganjs

    Project configuration and rendering mode patterns for Rasengan.js.

    125 GitHub stars~1.1k tokensUpdated today
    Frontend & DesignAuto-check passed
  • Redesign My Landingpage

    instructa/agent-skills

    Build, critique, and iterate high-converting marketing or product landing pages using React + Vite + TypeScript + Tailwind and shadcn/ui components, with all icons sourced from Iconify.

    139 GitHub stars~1.8k tokensUpdated 9 days ago
    Frontend & DesignAuto-check passed
  • Ink Tui Wizard

    novuhq/novu

    Build terminal user interfaces (TUIs) using Ink (React for CLIs) and @inkjs/ui with a reactive, session-driven wizard pattern.

    40k GitHub stars~1.9k tokensUpdated today
    Frontend & DesignAuto-check passed
  • Design To Code

    MigoXLab/coderio

    Pixel-perfect Figma to React conversion using coderio. An agent skill from MigoXLab/coderio.

    114 GitHub starsUsed in 2 repos~1.2k tokens
    Frontend & DesignAuto-check passed

More from MadAppGang/claude-code

All 69 skills in this repo
  • API Spec Analyzer

    MadAppGang/claude-code

    Analyzes API documentation from OpenAPI specs to provide TypeScript interfaces, request/response formats, and implementation guidance.

    283 GitHub starsUsed in 1 repo~2.7k tokens
    Auto-check passed
  • Content Brief

    MadAppGang/claude-code

    Content brief template and creation methodology for SEO-optimized content.

    283 GitHub starsUsed in 1 repo~959 tokens
    Auto-check passed
  • Context Detection

    MadAppGang/claude-code

    A skill your agent uses when detecting project technology stack from files/configs/directory structure, auto-loading framework-specific skills, or analyzing multi-stack fullstack projects (e.g…

    283 GitHub stars~5.4k tokensUpdated 6 mo ago
    Auto-check passed
  • Content Optimizer

    MadAppGang/claude-code

    On-page SEO optimization techniques including keyword density, meta tags, heading structure, and readability.

    283 GitHub starsUsed in 1 repo~694 tokens
    Auto-check passed
  • Keyword Cluster Builder

    MadAppGang/claude-code

    Techniques for expanding seed keywords and clustering by topic and intent.

    283 GitHub starsUsed in 1 repo~674 tokens
    Auto-check passed
  • Serp Analysis

    MadAppGang/claude-code

    SERP analysis techniques for intent classification, feature identification, and competitive intelligence.

    283 GitHub starsUsed in 1 repo~1k tokens
    Auto-check passed

Works with

Questions about CSS Modules

What does CSS Modules do?

CSS Modules with Lightning CSS and PostCSS for component-scoped styling. CSS Modules is an agent skill from MadAppGang/claude-code. CSS Modules with Lightning CSS and PostCSS for component-scoped styling.

When should I use CSS Modules?

CSS Modules fits situations like: building complex animations; styling third-party components; migrating legacy CSS.

How do I install CSS Modules in Claude Code?

Run `npx skills add MadAppGang/claude-code --skill css-modules -a claude-code`. Or copy the skill folder (plugins/dev/skills/frontend/css-modules in MadAppGang/claude-code) into .claude/skills/css-modules in your project. Claude Code loads it when a task matches its description.

How do I install CSS Modules in Codex?

Run `npx skills add MadAppGang/claude-code --skill css-modules -a codex`. Or copy the skill folder (plugins/dev/skills/frontend/css-modules in MadAppGang/claude-code) into .agents/skills/css-modules in your project. Codex loads it when a task matches its description.

Can I use CSS Modules in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add MadAppGang/claude-code --skill css-modules -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/css-modules, .gemini/skills/css-modules, .github/skills/css-modules and .opencode/skills/css-modules in your project.

What does CSS Modules need to run?

Going by SKILL.md and its folder, CSS Modules needs the command-line tools its instructions call (npm and npx). Our summary lists: Node.js.

Does CSS Modules access the network?

SKILL.md names 3 domains. As links in the text: github.com, lightningcss.dev and vite.dev. This is read from the text; nothing was executed.

Is CSS Modules safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does CSS Modules use?

CSS Modules is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does CSS Modules use?

About 3.2k tokens (SKILL.md is roughly 13k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to CSS Modules?

Skills that share tags, products or a category with CSS Modules: Cross Platform Tauri UI (ifer47/markeron, 1.2k stars), Vuetify Skilld (logue/vite-vuetify-ts-starter, 181 stars), Rasengan Config (rasengan-dev/rasenganjs, 125 stars) and Redesign My Landingpage (instructa/agent-skills, 139 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains CSS Modules?

MadAppGang (a GitHub organization) maintains it in MadAppGang/claude-code, which has 283 GitHub stars. The repository holds 69 skills in this directory. The repository was last updated on March 15, 2026.

Source: MadAppGang/claude-code on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.