UnoCSS
БесплатноБез исполняемых скриптовНе проверенUnoCSS atomic CSS engine for on-demand utility classes. Use when setting up utility-first CSS, configuring presets (wind3/wind4, icons, typography), or…
от laurigates★ 61 звезда на GitHubОб этом скилле
UnoCSS
UnoCSS is an instant on-demand atomic CSS engine. It generates only the CSS for utility classes you actually use — no parsing, no AST, no scanning. 5x faster than Tailwind CSS JIT with ~6kb min+brotli and zero dependencies.
When to Use This Skill
| Use this skill when... | Use something else when... |
|---|---|
| Setting up utility-first CSS | Transpiling/minifying CSS (use Lightning CSS) |
| Configuring UnoCSS presets and rules | Linting CSS rules (use Stylelint) |
| Integrating with Vite/Nuxt/Astro | Need Tailwind-specific plugins ecosystem |
| Generating atomic CSS from class names | Writing traditional CSS architectures (BEM, etc.) |
| Using pure CSS icons via presets | Need CSS-in-JS runtime (use styled-components, etc.) |
| Replacing Tailwind CSS with faster alternative |
Core Expertise
- Instant generation: No parsing or AST — direct regex-based class extraction
- Preset-driven: All utilities come from presets, fully customizable
- Framework-agnostic: Vite, Webpack, PostCSS, Nuxt, Astro, Svelte, CLI
- Extensible: Custom rules, variants, shortcuts, extractors, transformers
- Inspector: Built-in dev tool for debugging generated utilities
Installation
# Vite project (most common)
npm add -D unocss
# Bun
bun add -d unocss
# Standalone CLI
npm add -D @unocss/cli
Vite Integration
Basic Setup
// vite.config.ts
import UnoCSS from 'unocss/vite'
import { defineConfig } from 'vite'
export default defineConfig({
plugins: [UnoCSS()]
})
// main.ts - import the virtual stylesheet
import 'virtual:uno.css'
Configuration File
// uno.config.ts
import { defineConfig, presetWind3 } from 'unocss'
export default defineConfig({
presets: [presetWind3()]
})
With Lightning CSS (Recommended Combo)
// vite.config.ts
import UnoCSS from 'unocss/vite'
import browserslist from 'browserslist'
import { browserslistToTargets } from 'lightningcss'
export default defineConfig({
plugins: [UnoCSS()],
css: {
transformer: 'lightningcss',
lightningcss: {
targets: browserslistToTargets(browserslist('>= 0.25%'))
}
},
build: {
cssMinify: 'lightningcss'
}
})
Plugin Modes
| Mode | Use Case | Setup |
|---|---|---|
| Global (default) | Standard apps | import 'virtual:uno.css' in entry |
| Vue-scoped | Vue component isolation | Injects into <style scoped> blocks |
| Shadow DOM | Web Components | Add @unocss-placeholder in component styles |
| Per-module (experimental) | Module-scoped CSS | CSS sheet per module |
| Dist-chunk (experimental) | Multi-page apps | CSS sheet per code chunk |
Framework-Specific Plugin Order
| Framework | UnoCSS Plugin Position |
|---|---|
| React (Babel) | Before @vitejs/plugin-react |
| Svelte/SvelteKit | Before Svelte plugin |
| Vue | Any position (works with default) |
| Solid/Preact | Check docs for ordering |
CLI Usage
# Generate CSS from source files
unocss "src/**/*.{html,tsx,vue}" -o dist/uno.css
# Multiple glob patterns
unocss "src/**/*.tsx" "pages/**/*.vue" -o dist/uno.css
# Minified output
unocss "src/**/*.tsx" -o dist/uno.css --minify
# Output to stdout (pipe-friendly)
unocss "src/**/*.tsx" --stdout
# Watch mode for development
unocss "src/**/*.tsx" -o dist/uno.css --watch
# With specific config file
unocss "src/**/*.tsx" -o dist/uno.css --config uno.config.ts
# Include preflight styles
unocss "src/**/*.tsx" -o dist/uno.css --preflights
# Use specific preset without config
unocss "src/**/*.tsx" -o dist/uno.css --preset wind4
Configuration
Presets
// uno.config.ts
import {
defineConfig,
presetWind3, // Tailwind CSS v3 compatible utilities
presetIcons, // Pure CSS icons from Iconify
presetAttributify, // Attributify mode (utilities as HTML attributes)
presetTypography, // Typography prose classes
presetWebFonts, // Web font loading
presetMini, // Minimal preset (subset of wind)
} from 'unocss'
export default defineConfig({
presets: [
presetWind3(),
presetIcons({
scale: 1.2,
cdn: 'https://esm.sh/'
}),
presetAttributify(),
presetTypography(),
presetWebFonts({
provider: 'google',
fonts: { sans: 'Inter', mono: 'Fira Code' }
})
]
})
Wind3 vs Wind4
| Preset | Compatibility | Notes |
|---|---|---|
presetWind3() |
Tailwind CSS v3 | Stable, widely used |
presetWind4() |
Tailwind CSS v4 | Newer, CSS-first config |
Custom Rules
// uno.config.ts
export default defineConfig({
rules: [
// Static rule
['custom-padding', { padding: '1rem' }],
// Dynamic rule
[/^m-(\d+)$/, ([, d]) => ({ margin: `${Number(d) / 4}rem` })],
]
})
Shortcuts
// uno.config.ts
export default defineConfig({
shortc
Установить UnoCSS в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Bash(unocss *)ReadEditWriteGrepGlobTodoWriteFAQ
Что делает скилл UnoCSS?
UnoCSS atomic CSS engine for on-demand utility classes. Use when setting up utility-first CSS, configuring presets (wind3/wind4, icons, typography), or integrating with Vite.
Как установить скилл UnoCSS?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл UnoCSS запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
frontend-design
Guidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making…
от Anthropicwebapp-testing
Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing…
от Anthropicbrand-guidelines
Applies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand…
от Anthropicweb-artifacts-builder
Suite of tools for creating elaborate, multi-component claude.ai HTML artifacts using modern frontend web technologies (React, Tailwind CSS, shadcn/ui). Use…
от Anthropic