Get the FREE Ultimate OpenClaw Setup Guide →

unocss

npx machina-cli add skill antfu/skills/unocss --openclaw
Files (1)
SKILL.md
4.1 KB

UnoCSS is an instant atomic CSS engine designed to be flexible and extensible. The core is un-opinionated - all CSS utilities are provided via presets. It's a superset of Tailwind CSS, so you can reuse your Tailwind knowledge for basic syntax usage.

Important: Before writing UnoCSS code, agents should check for uno.config.* or unocss.config.* files in the project root to understand what presets, rules, and shortcuts are available. If the project setup is unclear, avoid using attributify mode and other advanced features - stick to basic class usage.

The skill is based on UnoCSS 66.x, generated at 2026-01-28.

Core

TopicDescriptionReference
ConfigurationConfig file setup and all configuration optionscore-config
RulesStatic and dynamic rules for generating CSS utilitiescore-rules
ShortcutsCombine multiple rules into single shorthandscore-shortcuts
ThemeTheming system for colors, breakpoints, and design tokenscore-theme
VariantsApply variations like hover:, dark:, responsive to rulescore-variants
ExtractingHow UnoCSS extracts utilities from source codecore-extracting
Safelist & BlocklistForce include or exclude specific utilitiescore-safelist
Layers & PreflightsCSS layer ordering and raw CSS injectioncore-layers

Presets

Main Presets

TopicDescriptionReference
Preset Wind3Tailwind CSS v3 / Windi CSS compatible preset (most common)preset-wind3
Preset Wind4Tailwind CSS v4 compatible preset with modern CSS featurespreset-wind4
Preset MiniMinimal preset with essential utilities for custom buildspreset-mini

Feature Presets

TopicDescriptionReference
Preset IconsPure CSS icons using Iconify with any icon setpreset-icons
Preset AttributifyGroup utilities in HTML attributes instead of classpreset-attributify
Preset TypographyProse classes for typographic defaultspreset-typography
Preset Web FontsEasy Google Fonts and other web fonts integrationpreset-web-fonts
Preset TagifyUse utilities as HTML tag namespreset-tagify
Preset Rem to PxConvert rem units to px for utilitiespreset-rem-to-px

Transformers

TopicDescriptionReference
Variant GroupShorthand for grouping utilities with common prefixestransformer-variant-group
DirectivesCSS directives: @apply, @screen, theme(), icon()transformer-directives
Compile ClassCompile multiple classes into one hashed classtransformer-compile-class
Attributify JSXSupport valueless attributify in JSX/TSXtransformer-attributify-jsx

Integrations

TopicDescriptionReference
Vite IntegrationSetting up UnoCSS with Vite and framework-specific tipsintegrations-vite
Nuxt IntegrationUnoCSS module for Nuxt applicationsintegrations-nuxt

Source

git clone https://github.com/antfu/skills/blob/main/skills/unocss/SKILL.mdView on GitHub

Overview

UnoCSS is an instant atomic CSS engine designed to be flexible and extensible. The core is un-opinionated, with utilities provided via presets such as Wind, Icons, and Attributify, allowing you to tailor utilities to your project. It is a superset of Tailwind CSS, so you can reuse Tailwind syntax while benefiting from UnoCSSs extensibility.

How This Skill Works

UnoCSS generates CSS utilities from rules supplied by presets and any custom rules or shortcuts you define. Start by checking for uno.config.* or unocss.config.* in the project root to see which presets and rules are available. The system is unopinionated by design; presets supply utilities, theming, and variants, while you compose your own rules and shortcuts as needed.

When to Use It

  • Starting a new UI project and leveraging Tailwind-like syntax via Wind presets.
  • Building a design system with tokens, themes, and layer order using core features.
  • Prototyping interfaces quickly with Iconify-based icons through preset-icons.
  • Creating reusable UI blocks by defining shortcuts that combine multiple utilities.
  • Using Attributify mode when your project styles via HTML attributes, not just class names.

Quick Start

  1. Step 1: Install UnoCSS and create a config file (uno.config.ts) enabling a preset like Wind3 or Wind4.
  2. Step 2: Use basic utilities in your HTML (e.g., class='p-4 bg-blue-500 text-white') or add a simple shortcut in the config.
  3. Step 3: Start the dev server and verify generated CSS, adjusting presets and rules as needed.

Best Practices

  • Check for uno.config.* or unocss.config.* in the project root before coding to understand presets and rules.
  • Prefer built-in presets (Wind, Icons, Attributify, Typography) to keep maintenance simple.
  • Define a few concise shortcuts to replace long class strings and improve consistency.
  • Use variants (hover:, focus:, responsive) to manage state and breakpoints instead of duplicating rules.
  • If you are unsure about Attributify, disable attributify mode and stick to traditional class-based usage.

Example Use Cases

  • Prototype a responsive card layout with Wind presets using simple width, padding, and color utilities.
  • Define a btn shortcut to style buttons with padding, rounded corners, and hover color changes.
  • Render a navigation bar with preset-icons for icons and hover states.
  • Apply Typography presets to establish a readable typographic scale across headings and body text.
  • Style components with Attributify attributes like p='4' m='2' and bg='blue-500' to test attribute-based styling.

Frequently Asked Questions

Add this skill to your agents
Sponsor this space

Reach thousands of developers