All skills
onmax avatar

/unocss

@de09c7b official
by Maxonmax/nuxt-skills715 stars
38

UnoCSS instant atomic CSS engine, superset of Tailwind CSS. Use when configuring UnoCSS, writing utility rules, shortcuts, or working with presets like Wind, Icons, Attributify.

Use this Skill: https://skilld.dev/gh/onmax/nuxt-skills/unocss

This session only. Nothing lands on disk.

referencescore-safelist.md

≈499 tokens on demand. Your agent reads this file only when SKILL.md points to it.

Safelist and Blocklist

Control which utilities are always included or excluded.

Safelist

Utilities always included, regardless of detection:

export default defineConfig({
  safelist: [
    'p-1', 'p-2', 'p-3',
    // Dynamic generation
    ...Array.from({ length: 4 }, (_, i) => `p-${i + 1}`),
  ],
})

Function Form

safelist: [
  'p-1',
  () => ['m-1', 'm-2'],
  (context) => {
    const colors = Object.keys(context.theme.colors || {})
    return colors.map(c => `bg-${c}-500`)
  },
]

Common Use Cases

safelist: [
  // Dynamic colors from CMS
  () => ['primary', 'secondary'].flatMap(c => [
    `bg-${c}`, `text-${c}`, `border-${c}`,
  ]),

  // Component variants
  () => {
    const variants = ['primary', 'danger']
    const sizes = ['sm', 'md', 'lg']
    return variants.flatMap(v => sizes.map(s => `btn-${v}-${s}`))
  },
]

Blocklist

Utilities never generated:

blocklist: [
  'p-1',           // Exact match
  /^p-[2-4]$/,     // Regex
]

With Messages

blocklist: [
  ['bg-red-500', { message: 'Use bg-red-600 instead' }],
  [/^text-xs$/, { message: 'Use text-sm for accessibility' }],
]

Safelist vs Blocklist

Feature Safelist Blocklist
Purpose Always include Always exclude
Strings ✅ ✅
Regex ❌ ✅
Functions ✅ ❌

Note: Blocklist wins if utility is in both.

Best Practice

Prefer static mappings over safelist:

// Better: UnoCSS extracts automatically
const sizes = {
  sm: 'text-sm p-2',
  md: 'text-base p-4',
}

// Avoid: Large safelist
safelist: ['text-sm', 'text-base', 'p-2', 'p-4']
<!-- Source references: - https://unocss.dev/config/safelist - https://unocss.dev/guide/extracting -->

Source: SKILL.md on GitHub

No alerts9d3 checks · Risk SAFE
  • Gen Agent Trust Hub9d

    The skill is a comprehensive documentation set for UnoCSS, providing guidance on configuration, rules, presets, and framework integrations. It is a legitimate resource for web development, although it involves standard development tasks like installing packages and analyzing project files which presents a standard attack surface.

  • Socket9d

    No alerts

  • Snyk9d

    Risk: LOW · No issues

Signed by skilld at de09c7b. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 2 days ago.

Activeupdated last week
Other metadata
metadata
{
  "author": "Anthony Fu",
  "version": "2026.1.28",
  "source": "Generated from https://github.com/unocss/unocss, scripts located at https://github.com/antfu/skills"
}

README badge

README badge for onmax/nuxt-skills/unocss