$npx -y skills add fusengine/agents --skill astro-stylingUse when styling Astro components with scoped CSS, CSS Modules, Tailwind CSS, UnoCSS, or Sass. Covers class:list directive, global styles, CSS custom properties, and Vite-powered preprocessors.
| 1 | # Astro Styling |
| 2 | |
| 3 | ## Agent Workflow (MANDATORY) |
| 4 | |
| 5 | Before ANY implementation, use `TeamCreate` to spawn 3 agents: |
| 6 | |
| 7 | 1. **fuse-ai-pilot:explore-codebase** - Analyze existing styles, integrations, and patterns |
| 8 | 2. **fuse-ai-pilot:research-expert** - Verify latest Astro/Tailwind/UnoCSS docs via Context7/Exa |
| 9 | 3. **mcp__context7__query-docs** - Check integration compatibility with Astro 7 |
| 10 | |
| 11 | After implementation, run **fuse-ai-pilot:sniper** for validation. |
| 12 | |
| 13 | --- |
| 14 | |
| 15 | ## Overview |
| 16 | |
| 17 | ### When to Use |
| 18 | |
| 19 | - Styling `.astro` components with component-scoped CSS |
| 20 | - Setting up Tailwind CSS or UnoCSS in an Astro project |
| 21 | - Using CSS Modules for framework-agnostic scoping |
| 22 | - Applying global base styles (reset, fonts, variables) |
| 23 | - Using `class:list` for conditional class application |
| 24 | - Adding Sass/SCSS via Vite preprocessors |
| 25 | |
| 26 | ### Styling Options |
| 27 | |
| 28 | | Method | Scope | When to Use | |
| 29 | |--------|-------|-------------| |
| 30 | | `<style>` in `.astro` | Component | Default — scoped to component | |
| 31 | | `<style is:global>` | Global | Base styles, resets | |
| 32 | | CSS Modules `.module.css` | Component | Framework components (React, Vue) | |
| 33 | | Tailwind CSS | Utility | Rapid UI development | |
| 34 | | UnoCSS | Utility | Lightweight, configurable atomic CSS | |
| 35 | | Sass/SCSS | Component/Global | Advanced features, variables, mixins | |
| 36 | |
| 37 | --- |
| 38 | |
| 39 | ## Reference Guide |
| 40 | |
| 41 | ### Concepts |
| 42 | |
| 43 | | Topic | Reference | When to Consult | |
| 44 | |-------|-----------|-----------------| |
| 45 | | Scoped CSS | [scoped-css.md](references/scoped-css.md) | Component styling | |
| 46 | | CSS Modules | [css-modules.md](references/css-modules.md) | Framework components | |
| 47 | | Global styles | [global-styles.md](references/global-styles.md) | Resets, base styles | |
| 48 | | Tailwind | [tailwind.md](references/tailwind.md) | Utility-first CSS | |
| 49 | | UnoCSS | [unocss.md](references/unocss.md) | Atomic CSS engine | |
| 50 | | Sass/SCSS | [sass.md](references/sass.md) | Preprocessor features | |
| 51 | | CSS Variables | [css-variables.md](references/css-variables.md) | Design tokens, themes | |
| 52 | |
| 53 | ### Templates |
| 54 | |
| 55 | | Template | When to Use | |
| 56 | |----------|-------------| |
| 57 | | [scoped-component.md](references/templates/scoped-component.md) | Component with scoped + conditional classes | |
| 58 | | [tailwind-setup.md](references/templates/tailwind-setup.md) | Full Tailwind CSS project setup | |
| 59 | | [unocss-setup.md](references/templates/unocss-setup.md) | Full UnoCSS project setup | |
| 60 | |
| 61 | --- |
| 62 | |
| 63 | ## Best Practices |
| 64 | |
| 65 | 1. **Prefer scoped styles** — Use `<style>` in `.astro` files by default |
| 66 | 2. **Global styles in layouts** — Apply resets and base styles in root layout |
| 67 | 3. **CSS variables for themes** — Define design tokens as custom properties |
| 68 | 4. **Avoid `is:global` in components** — Reserve for layouts and global files |
| 69 | 5. **class:list over ternaries** — More readable conditional class logic |
| 70 | |
| 71 | --- |
| 72 | |
| 73 | ## Forbidden |
| 74 | |
| 75 | - Writing inline styles for layout/theme — use CSS classes instead |
| 76 | - Using `is:global` inside non-layout components |
| 77 | - Importing CSS in multiple components without CSS Modules |
| 78 | - Mixing Tailwind and custom class naming without a clear convention |