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-extracting.md

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

Extracting

UnoCSS searches for utility usages in your codebase and generates CSS on-demand.

Content Sources

Pipeline Extraction (Vite/Webpack)

Most efficient - extracts from build tool pipeline.

Default file types: .jsx, .tsx, .vue, .md, .html, .svelte, .astro, .marko

Not included by default: .js, .ts

export default defineConfig({
  content: {
    pipeline: {
      include: [
        /\.(vue|svelte|[jt]sx|mdx?|astro|html)($|\?)/,
        'src/**/*.{js,ts}', // Add js/ts
      ],
    },
  },
})

Filesystem Extraction

For files not in build pipeline:

export default defineConfig({
  content: {
    filesystem: [
      'src/**/*.php',
      'public/*.html',
    ],
  },
})

Inline Text Extraction

export default defineConfig({
  content: {
    inline: [
      '<div class="p-4 text-red">Some text</div>',
      async () => (await fetch('https://example.com')).text(),
    ],
  },
})

Magic Comments

@unocss-include

Force scan a file:

// @unocss-include
export const classes = {
  active: 'bg-primary text-white',
}

@unocss-ignore

Skip entire file:

// @unocss-ignore

@unocss-skip-start / @unocss-skip-end

Skip specific blocks:

<p class="text-green">Extracted</p>
<!-- @unocss-skip-start -->
<p class="text-red">NOT extracted</p>
<!-- @unocss-skip-end -->

Limitations

UnoCSS works at build time - dynamic classes don't work:

<!-- Won't work! -->
<div class="p-${size}"></div>

Solutions

1. Safelist - Pre-generate known values:

safelist: ['p-1', 'p-2', 'p-3', 'p-4']

2. Static mapping - List combinations statically:

const colors = {
  red: 'text-red border-red',
  blue: 'text-blue border-blue',
}

3. Runtime - Use @unocss/runtime for true runtime generation.

Custom Extractors

extractors: [
  {
    name: 'my-extractor',
    extract({ code }) {
      return code.match(/class:[\w-]+/g) || []
    },
  },
]
<!-- Source references: - 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