skills/brand-css-generator/SKILL.md
Generate CSS custom property overrides and complete design branches from brand profiles, ensuring WCAG AA compliance and design coherence. Use when "generating brand CSS", "creating design tokens", "brand theming", or "CSS from brand profile".
npx skillsauth add paolomoz/skills brand-css-generatorInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
| Category | Trigger | Complexity | Source | |----------|---------|------------|--------| | brand-design | "brand CSS", "design tokens", "brand theme", "CSS overrides" | High | 5 projects |
Generate production-ready CSS from a BrandProfile — either as a lightweight custom property override sheet or as a full design branch with atomic file generation, responsive breakpoints, and WCAG AA contrast enforcement. The skill bridges the gap between brand identity and implementable design code.
You need two inputs to generate brand CSS:
cssTokenHints (from a design pipeline)If no BrandProfile exists, run brand-extractor first. Do not attempt to generate CSS from vague descriptions — the profile ensures consistency across all generated files.
Use this mode when theming an existing site or generating design tokens. The output is a single CSS string with :root { } custom properties.
Function signature:
generateBrandCssOverrides(
profile: BrandProfile,
briefContent: string,
design: DesignOption
): Promise<string>
Output format — a :root block organized into named sections:
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');
:root {
/* Brand Colors: primary, dark, light, secondary, accent, background, surface, text, text-muted */
--color-primary: #635BFF;
--color-secondary: #0A2540;
--color-accent: #00D4AA;
/* Typography: font families (heading, body, mono), sizes (base through 3xl), line-heights */
--font-heading: 'Inter', system-ui, sans-serif;
--font-size-base: 1rem;
/* Spacing: xs (0.25rem) through 2xl (8rem) */
/* Layout: container-max, border-radius, border-radius-lg */
/* Shadows: sm, md, lg */
}
Rules for Mode A:
@import for Google Fonts (if used) MUST appear BEFORE the :root block — browsers ignore @import after any other rulessystem-ui as the final fallback in all font stacksUse this mode when generating a complete themed version of a site with per-block CSS files, responsive breakpoints, and a design critique pass.
Step 2B-1: Generate atomic CSS files
Create the following file structure:
design-branch/
styles.css # Global overrides and custom properties
fonts.css # @import rules for web fonts
hero.css # Hero/banner block styles
features.css # Feature grid/list block styles
testimonials.css # Testimonial block styles
cta.css # Call-to-action block styles
footer.css # Footer block styles
[block-name].css # One file per content block
Step 2B-2: Maintain reference integrity
This is critical — the generated CSS must work as an override layer, not a replacement.
.hero-title, your override targets .hero-title, not a new .brand-hero-titleStep 2B-3: Responsive breakpoints
All block CSS files must include three mobile-first breakpoint tiers: default (< 600px), tablet (600px+), and desktop (900px+). Each tier adjusts font sizes, padding, and grid columns. Use var() references to spacing and typography tokens rather than hardcoded values.
For every text-color / background-color pair, compute the contrast ratio using relative luminance: (L1 + 0.05) / (L2 + 0.05). Required ratios: normal text >= 4.5:1, large text (>= 18px or >= 14px bold) >= 3.0:1, UI components >= 3.0:1. If a pair fails, adjust the text color darker or the background lighter until it passes. Document every adjustment in a CSS comment showing the original ratio, the adjusted value, and the passing ratio.
After generating CSS, apply these mandatory sanitization rules. These address recurring production issues discovered across multiple projects.
| Rule | What to do | Why |
|------|-----------|-----|
| Strip @font-face from fonts.css | Keep only @import rules in fonts.css — remove any @font-face declarations | @font-face with local paths breaks on deploy; @import from Google Fonts/CDN is reliable |
| Remove vertical margin on sections | Delete margin-top and margin-bottom from any section-level container | Section spacing is controlled by the layout system, not individual sections — adding margin causes double-spacing |
| Fix z-index: -1 on hero images | Change to z-index: 0 | Negative z-index pushes images behind the page background, making them invisible |
| Remove opacity: 0 on lazy images | Delete any opacity: 0 rule on img or picture elements | Lazy-load libraries manage opacity transitions; a CSS opacity: 0 permanently hides images if JS fails |
| No layout property animations | Never use transition or animation on width, height, top, left, margin, padding | Layout animations cause reflow jank; use transform and opacity only |
| No bounce/elastic easing | Never use cubic-bezier curves that overshoot (values > 1.0 in p2/p4) | Bounce easing causes elements to visually overlap neighbors during animation |
| No !important | Never use !important in generated CSS | Specificity wars are unsustainable; use proper selector specificity instead |
| Google Fonts import position | @import must be the very first rule in the file, before any selectors | Browsers silently ignore @import after other rules |
After generating all files, review the complete output for these common design coherence issues:
CTA Hierarchy: There should be exactly one primary CTA style and one secondary. If three or more button styles exist with similar visual weight, the hierarchy is broken. Fix by increasing contrast between primary and secondary.
Spacing Monotony: If more than 3 consecutive sections use the same padding value, the rhythm is monotonous. Alternate between at least 2 spacing values (e.g., --space-lg and --space-xl).
Color Overuse: If the primary brand color appears in more than 40% of elements, the design lacks hierarchy. Reserve primary color for CTAs and key headings; use neutrals and the surface color for everything else.
Typography Hierarchy: There must be clear visual distinction between at least 4 levels: page title, section heading, body text, and caption/meta. If any two adjacent levels are within 2px of each other, increase the size difference.
Whitespace Ratio: At least 30% of the viewport should be whitespace (background color showing through). If content is wall-to-wall, increase padding and reduce element widths.
For Mode A, return the CSS string directly. For Mode B, write all files to the target directory and provide a summary listing each file, the number of custom properties, breakpoints used, WCAG AA pass/fail status, and which sanitization rules were applied.
| Problem | Cause | Fix |
|---------|-------|-----|
| Fonts not loading | @import placed after :root block | Move all @import rules to the very top of the file |
| Colors look washed out | WCAG adjustment pushed colors too far toward neutral | Use a darker background instead of lightening the text color |
| Hero image invisible | z-index: -1 in generated CSS | Sanitization rule should catch this; verify it was applied |
| Buttons all look the same | Missing CTA hierarchy pass | Ensure primary uses brand color fill and secondary uses outline/ghost variant |
| Double spacing between sections | Vertical margin on section containers | Sanitization rule should strip these; verify |
| Animations are janky | Animating layout properties | Replace with transform: translateX() / opacity transitions |
development
Generate artistic infographics from any topic. Runs the Sumi pipeline (analyze → structure → craft prompt → generate image) entirely within Claude Code. Use when "generate infographic", "create infographic", "sumi", "make an infographic about", or "visualize topic".
tools
Implement Server-Sent Events streaming from Cloudflare Workers to browser clients with reconnection, state persistence, and progress tracking. Use when building "SSE streaming", "real-time updates", "server push", or "event streaming".
development
Audit websites by cross-referencing query indexes, sitemaps, and navigation to identify content gaps, stale pages, missing metadata, and quality issues. Use when "auditing a website", "finding content gaps", "site quality audit", or "content inventory analysis".
data-ai
Track user session context across multi-turn interactions using browser sessionStorage and server-side KV caching with TTL. Use when implementing "session tracking", "conversation context", "multi-turn sessions", or "user journey tracking".