designer/generating-css/SKILL.md
Generate production CSS from design tokens using Tailwind CSS or vanilla CSS. Maps tokens to Tailwind theme config and establishes CSS architecture.
npx skillsauth add 7a336e6e/skills generating-cssInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
4 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Transform design tokens into usable CSS — either as a Tailwind theme configuration or as vanilla CSS custom properties with utility classes. The output should be production-ready, connected to the token system, and free of redundant or dead styles.
designing-ui-system).CSS flows through four layers, each building on the previous:
Tokens → Utilities → Components → Layouts
Extend the Tailwind theme — do not override defaults wholesale. This preserves useful defaults while adding project-specific tokens:
// tailwind.config.ts
import type { Config } from 'tailwindcss';
export default {
content: ['./src/**/*.{ts,tsx,html}'],
darkMode: 'class',
theme: {
extend: {
colors: {
// Map token names to HSL values from the design system
primary: {
50: 'hsl(var(--color-primary-50) / <alpha-value>)',
100: 'hsl(var(--color-primary-100) / <alpha-value>)',
200: 'hsl(var(--color-primary-200) / <alpha-value>)',
300: 'hsl(var(--color-primary-300) / <alpha-value>)',
400: 'hsl(var(--color-primary-400) / <alpha-value>)',
500: 'hsl(var(--color-primary-500) / <alpha-value>)',
600: 'hsl(var(--color-primary-600) / <alpha-value>)',
700: 'hsl(var(--color-primary-700) / <alpha-value>)',
800: 'hsl(var(--color-primary-800) / <alpha-value>)',
900: 'hsl(var(--color-primary-900) / <alpha-value>)',
},
// Repeat for secondary, neutral, semantic colors
},
fontFamily: {
sans: ['Source Sans 3', 'system-ui', 'sans-serif'],
heading: ['Fraunces', 'Georgia', 'serif'],
},
fontSize: {
xs: ['0.75rem', { lineHeight: '1.6' }],
sm: ['0.875rem', { lineHeight: '1.5' }],
base: ['1rem', { lineHeight: '1.6' }],
lg: ['1.25rem', { lineHeight: '1.4' }],
xl: ['1.563rem', { lineHeight: '1.3' }],
'2xl': ['1.953rem', { lineHeight: '1.2' }],
},
spacing: {
// Extend with project tokens if Tailwind defaults don't match
'4.5': '1.125rem', // 18px, if needed
},
borderRadius: {
sm: '4px',
md: '8px',
lg: '16px',
},
boxShadow: {
// Use brand-hue-tinted shadows, not pure black
subtle: '0 1px 3px hsl(var(--color-primary-900) / 0.08)',
medium: '0 4px 12px hsl(var(--color-primary-900) / 0.12)',
strong: '0 8px 24px hsl(var(--color-primary-900) / 0.16)',
},
},
},
plugins: [],
} satisfies Config;
Even with Tailwind, define tokens as CSS custom properties so they can be consumed by non-Tailwind contexts (third-party components, canvas rendering, emails):
/* tokens.css — imported before Tailwind layers */
:root {
--color-primary-50: 262 50% 95%;
--color-primary-100: 262 52% 90%;
/* ... full palette ... */
--color-surface: var(--color-neutral-50);
--color-on-surface: var(--color-neutral-900);
}
.dark {
--color-surface: var(--color-neutral-900);
--color-on-surface: var(--color-neutral-50);
/* Reduce saturation for dark mode primary */
--color-primary-500: 262 55% 60%;
}
Only extract a component class when the same combination of utilities appears 3+ times AND the instances are semantically the same component:
/* components.css */
@layer components {
.btn-primary {
@apply inline-flex items-center justify-center rounded-md px-4 py-2
bg-primary-600 text-white font-medium text-sm
hover:bg-primary-700 focus-visible:outline-2
focus-visible:outline-offset-2 focus-visible:outline-primary-600
transition-colors;
}
}
Three buttons with the same style = extract. A button and a link that happen to share some padding = don't extract.
Use the class strategy (not media) for dark mode in Tailwind. This allows programmatic toggling:
<!-- Toggle class on <html> or <body> -->
<html class="dark">
/* Tailwind handles dark: variants automatically */
/* For CSS custom properties, use the .dark selector */
.dark {
--color-surface: 262 8% 10%;
--color-on-surface: 262 7% 90%;
}
Dark mode rules:
For project-specific responsive patterns that Tailwind doesn't cover, add custom utilities:
@layer utilities {
.text-fluid-lg {
font-size: clamp(1.25rem, 1rem + 1vw, 1.563rem);
}
.container-prose {
max-width: 65ch;
margin-inline: auto;
padding-inline: var(--space-4);
}
}
theme.extend so default utilities remain available.hsl() wrapper in custom properties so Tailwind's opacity modifier syntax works..mt-4 { margin-top: 1rem; } alongside Tailwind, something has gone wrong.@apply for everything. Extracting every element into an @apply class defeats the purpose of utility-first CSS — you end up maintaining a parallel stylesheet with none of the benefits.!important. If specificity conflicts exist, fix the cascade order or layer structure instead. The only acceptable !important is inside utility definitions (which Tailwind handles internally).theme (without extend). This removes useful defaults like auto, full, screen, and fractional spacing values.@apply with responsive or state variants (@apply hover:bg-blue-500). This doesn't work as expected and creates brittle CSS. Apply state styles as separate declarations or use utilities in markup.!important hacks.tailwind.config.ts (or .js) with theme extensions mapped to design tokens.tokens.css with CSS custom properties for all design tokens.components.css (if needed) with extracted component classes using @layer components.designer/designing-ui-system/SKILL.md — provides the design tokens that this skill consumes.../../frontend/scaffolding-frontend/SKILL.md — provides the project structure where these CSS files live.development
Implement features using the Red-Green-Refactor cycle to ensure testability and correctness from the start.
data-ai
Manage the `tasks.md` ledger with strict locking and collision avoidance protocols to allow multiple agents to work in parallel safely.
development
The git-workflow skill defines branching conventions, commit message formats, and pull request standards that all agents must follow for consistent version control.
development
The environment-config skill standardizes how agents manage environment variables, secrets, and application configuration across local development and deployed environments.