unocss
Configure and use UnoCSS atomic CSS
UnoCSS is an instant atomic CSS engine that provides a flexible, extensible alternative to Tailwind CSS. This skill helps developers configure UnoCSS, write custom utility rules, and leverage presets like Wind, Icons, and Attributify.
Download the skill ZIP
Upload in Claude
Go to Settings → Capabilities → Skills → Upload skill
Toggle on and start using
Test it
Using "unocss". How do I configure a custom color palette in UnoCSS?
Expected outcome:
Define your colors in the theme.colors section of your uno.config.ts:
export default defineConfig({
theme: {
colors: {
primary: {
50: '#f0f9ff',
100: '#e0f2fe',
500: '#0ea5e9',
900: '#0c4a6e',
},
brand: '#ff4400',
}
}
});
Usage in HTML:
<div class="text-primary-500 bg-primary-100 text-brand">Colored element</div>
Using "unocss". How do I create a custom utility shortcut?
Expected outcome:
Add shortcuts to your configuration:
export default defineConfig({
shortcuts: [
['btn', 'px-4 py-2 rounded-lg font-semibold cursor-pointer transition-colors'],
['btn-primary', 'btn bg-blue-500 text-white hover:bg-blue-600'],
['card', 'bg-white rounded-xl shadow-lg p-6'],
]
});
Usage:
<button class="btn btn-primary">Click me</button>
<div class="card">Card content</div>
Security Audit
SafeDocumentation-only skill providing reference material for UnoCSS configuration. All static findings are false positives - patterns detected in markdown documentation code blocks are not executable code. This skill contains no code that performs network requests, filesystem operations, or external command execution.
Quality Score
What You Can Build
Configure UnoCSS for a new project
Set up a complete UnoCSS configuration with presets, custom rules, and theme customization for a new web project.
Create custom utility rules
Define custom CSS utility rules and shortcuts to extend UnoCSS with project-specific styling patterns.
Choose and configure presets
Select and configure the appropriate UnoCSS presets for a project, such as Wind3 for Tailwind compatibility or Icons for icon libraries.
Try These Prompts
Help me configure UnoCSS in my project. I want to set up a basic configuration with the Wind3 preset, custom shortcuts for common patterns, and a custom theme with my brand colors.
Show me how to create a custom static or dynamic utility rule in UnoCSS. I need to create utilities for specific design requirements that are not covered by the default presets.
How do I integrate UnoCSS with my [Vite/Nuxt] project? What configuration options do I need and how do I ensure hot module replacement works correctly?
Explain how to use UnoCSS transformers like @apply directives, variant groups, and attributify mode. When should I use each feature and what are the performance implications?
Best Practices
- Use the uno.config.ts file format for best IDE support, TypeScript hints, and hot module replacement
- Start with a preset (like presetWind3 for Tailwind compatibility) and add customizations progressively
- Define custom shortcuts for frequently used class combinations to keep HTML clean and maintainable
- Use the safelist option sparingly - prefer extracting utilities from source code when possible
Avoid
- Avoid putting too many utility classes directly in HTML - use shortcuts and custom rules instead
- Do not use the full safelist as a replacement for proper utility extraction configuration
- Avoid deeply nested custom rules that could conflict with preset utilities - test combinations
- Do not ignore the extracting configuration - proper extraction significantly reduces CSS bundle size
Frequently Asked Questions
What is the difference between UnoCSS and Tailwind CSS?
Which preset should I choose for my project?
How does UnoCSS handle purging and tree-shaking?
Can I use UnoCSS with React, Vue, or other frameworks?
How do I create custom responsive variants?
What are transformers and when should I use them?
Developer Details
File structure