astro-styling

Implements scoped CSS, Tailwind, UnoCSS, and Sass styling for Astro components.

1|Updated Jul 29, 2026
One-click install
npx skills add https://github.com/fusengine/kimi-code --skill astro-styling-fusengine
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: astro-styling
Source: https://github.com/fusengine/kimi-code/tree/main/plugins/astro-expert/skills/astro-styling
Command: npx skills add https://github.com/fusengine/kimi-code --skill astro-styling-fusengine

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Styling Astro components involves choosing between scoped <style> blocks, CSS Modules, Tailwind CSS, UnoCSS, and Sass, each with different scoping semantics and setup steps. This Skill guides correct selection and configuration of styling approaches for .astro files and co-located framework components. ## Core Features & Use Cases - Scoped and Global CSS: Apply component-scoped <style> blocks, :global() selectors, and is:global styles reserved for layouts, plus the class:list directive for conditional classes. - Utility Framework Setup: Configure Tailwind CSS v4 via @tailwindcss/vite or UnoCSS via @unocss/astro with presets, resets, and theme tokens. - Design Tokens and Preprocessors: Define CSS custom properties for theming and dark mode, and use Sass/SCSS through Vite with lang="scss". - Use Case: When building an Astro site with a React island, use scoped styles for .astro components, CSS Modules for the React component, and a global stylesheet with CSS variables imported once in the root layout. ## Quick Start Use the astro-styling skill to set up Tailwind CSS v4 in my Astro project and style my Card component with scoped CSS and class:list.

Frequently Asked Questions about astro-styling

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I style Astro components with scoped CSS?▼

Add a `<style>` block inside the `.astro` file and Astro automatically scopes it to the component using a unique data attribute. Use the `class:list` directive for conditional classes and `:global()` only when targeting child component elements.

How to set up Tailwind CSS v4 in an Astro project?▼

Install `tailwindcss` and `@tailwindcss/vite`, add the Vite plugin to `astro.config.mjs`, and create a global.css with `@import "tailwindcss"`. Import that stylesheet once in your root layout; no tailwind.config.js or content globs are needed.

UnoCSS vs Tailwind CSS for Astro projects?▼

UnoCSS offers faster builds, smaller bundles, and configurable presets via `@unocss/astro`, while Tailwind has a larger ecosystem. Both use similar utility class syntax, so the choice depends on build performance needs versus ecosystem maturity.

When should I use CSS Modules instead of scoped styles in Astro?▼

Use CSS Modules (`.module.css`) for framework components like React, Vue, or Svelte co-located with Astro, since scoped `<style>` blocks only work in `.astro` files. CSS Modules also suit styles shared across frameworks.

Can I use Sass or SCSS in Astro components?▼

Yes, install the `sass` package and add `lang="scss"` to the `<style>` tag in your `.astro` file. Vite handles compilation with no extra configuration, and you can organize partials with `@use` imports.

Where should global styles go in an Astro site?▼

Place global styles in the root layout, either by importing a CSS file or using `<style is:global>`. Avoid `is:global` in regular components, and define design tokens as CSS custom properties on `:root` for theming and dark mode.