Skill library

Agent skill Frontend

Unocss

Build or refine reusable components for a web interface.

  • UI components

Install the skill

Installation method

Run the command from your project root with Node.js and npm.

npx skills@latest add antfu/skills --skill unocss --agent claude-code --yes

Check this file in your project.claude/skills/unocss/SKILL.md

Other ways to install
  • Choose an assistant interactively

    npx skills@latest add antfu/skills --skill unocss

    Select your assistant and choose the project installation scope.

    Official instructions

The tested Skills CLI 1.10.0 requires Node.js 22.20 or later. Use the existing UnoCSS integration and read the active config. The publisher skill references UnoCSS 66.10.5, which the Vite fixture used with presetWind3.

View operation manual

What this skill helps with

  • Build or refine reusable components for a web interface.

Good for

  • Component implementation
Skill name
unocss
Scenario
Fix a TypeScript status badge missing production styles
Deliverable
A production style fix with a generated shortcut and both runtime badge colors checked.
Skill name
unocss
Repository
antfu/skills

Define a component task with an observable result

A request with an unclear outcome

Construct a background class from arbitrary pieces and trust the dev server.

The extractor may never see a complete generated utility or the file containing the shortcut.

A workflow with observable results

  1. Locate the active preset and scanned file
  2. Expose the shortcut and runtime class
  3. Verify generated CSS and both rendered states

UnoCSS operation manual

Keep a readable shortcut and ensure its exact utilities survive UnoCSS source extraction.

Replace the bracketed details with your own project and target.

  1. Locate the active preset and scanned file

    Trace the Vite plugin, CSS import and exact source extension.

    Prompt · Step 1
    Use unocss to inspect [missing status badge]. Locate `uno.config.*`, active presets and its Vite plugin/CSS import. Identify the exact file with the shortcut or class map and whether its extension is extracted. Reproduce the missing class by checking production CSS before changing anything.
  2. Expose the shortcut and runtime class

    Use a scanned literal map or a deliberately bounded safelist.

    Prompt · Step 2
    Use unocss to implement [approved status badge fix]. Define a shortcut with existing preset utilities. If it is referenced from a plain `.ts` file that the current pipeline skips, use the documented `// @unocss-include` or scoped config. Prefer explicit full state classes and use safelist only for exact allowed generated names that can't appear literally.
  3. Verify generated CSS and both rendered states

    Build once and observe the real state switch.

    • The generated CSS contains the shortcut and required color utility.
    • Both interactive states show actual expected colors and layout.
    Prompt · Step 3
    Use unocss to run [project production build] and check that the shortcut and each expected color utility exist in the CSS output. In [local badge preview], change the state and read the computed layout and background for each case. Record which file was included and which utility, if any, is in the safelist.

Find the relevant rule

Point the assistant to the installed Skill and a specific issue.

A class only referenced in TypeScript disappearsReference
Command or reference
references/core-extracting.md
Examples
Include that file with the documented comment or content configuration.
A generated color is absent at runtimeReference
Command or reference
references/core-safelist.md
Examples
Use a scanned literal mapping or safelist only the known exact utility names.

UnoCSS troubleshooting

Does Vite extract plain `.ts` and `.js` by default?

The verified UnoCSS setup excluded plain `.ts` from its default pipeline. The fixture's shortcut appeared after adding `// @unocss-include` to the source, while the safelisted utility emitted independently.