Provides reference files and non-negotiable facts for using PikaCSS, a build-time atomic CSS-in-JS engine. Covers setup, bundler integration, configuration, plugins, and troubleshooting.
Ships in PikaCSS. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
PikaCSS is an instant on-demand atomic CSS-in-JS engine. It transforms statically analyzable pika() calls into class-name literals at build time, emits the matching atomic CSS, and generates TypeScript declarations for the compile-time globals.
Load the smallest relevant reference instead of guessing from memory:
| File | When to read |
|---|---|
references/build-options.md | Supported hosts, adapter bootstrap options, canonical project config, scan/output settings, generated state, prepare/init, reports, or HMR |
references/customizations.md | Variables, theming, keyframes, preflights, selectors, shortcuts, shortcut array composition, __layer, __important, CSS value fallbacks, or typed config fragments |
references/plugin-reset.md | Choosing and configuring a reset style |
references/plugin-icons.md | Icon shortcuts, Iconify collections, Node versus neutral adapters, processor metadata, or icon troubleshooting |
references/plugin-fonts.md | Google Fonts, @font-face, @import, font families, or providers |
references/plugin-typography.md | Prose shortcuts and --pk-prose-* variables |
references/plugin-design-tokens.md | Inline or file-backed design tokens, W3C token JSON, design.md, themes, aliases, pruning, or runtime adapters |
references/plugin-development.md | Creating plugins, lifecycle hooks, diagnostics, engine APIs, config augmentation, external file dependencies, or testing |
engines.node as >=22.19.0. The platform-neutral packages (@pikacss/core, @pikacss/plugin-icons, @pikacss/plugin-design-tokens) declare none on purpose.^7.0.0 || ^8.0.0).pika is a generated compile-time global. Never import it.js, mjs, cjs, jsx, ts, mts, cts, tsx) and Vue SFCs. Do not claim Svelte, Astro, or plain HTML source transforms are supported.pika.config.{ts,mts,js,mjs} in the project root; zero files is valid, multiple files are an error. Generated <stateDir>/pika.gen.ts must be included in generic TypeScript projects.const className = pika({ display: 'flex', color: 'red' })
is transformed into a plain literal such as:
const className = 'pk-a1b2 pk-c3d4'
The generated CSS contains the corresponding atomic rules. No PikaCSS runtime is shipped to the browser.
pnpm add -D @pikacss/unplugin-pikacss
pnpm add -D @pikacss/nuxt-pikacss
pnpm add -D @pikacss/plugin-reset
pnpm add -D @pikacss/plugin-icons
pnpm add -D @pikacss/plugin-fonts
pnpm add -D @pikacss/plugin-typography
pnpm add -D @pikacss/plugin-design-tokens
pnpm add -D @pikacss/eslint-config
Normal consumers should import defineConfig and authoring types from the directly installed outer package. Install @pikacss/core directly only for low-level Engine/plugin development.
// vite.config.ts
import pikacss from '@pikacss/unplugin-pikacss/vite'
import { defineConfig } from 'vite'
export default defineConfig({
plugins: [pikacss()],
})
The Vite adapter uses enforce: 'pre', so [vue(), pikacss()] is supported even though listing PikaCSS first remains clearer.
| Family | Bundler | Import path |
|---|---|---|
| Rollup | Vite | @pikacss/unplugin-pikacss/vite |
| Rollup | Rollup | @pikacss/unplugin-pikacss/rollup |
| Rollup | Rolldown | @pikacss/unplugin-pikacss/rolldown |
| Webpack | Webpack | @pikacss/unplugin-pikacss/webpack |
| Webpack | Rspack | @pikacss/unplugin-pikacss/rspack |
Other Unplugin hosts, including esbuild, are unsupported and have no public PikaCSS adapter entry point.
Each subpath exports a plugin factory. Add pikacss() to the target bundler's plugin array. Read references/build-options.md before recommending non-default options.
// nuxt.config.ts
export default defineNuxtConfig({
modules: ['@pikacss/nuxt-pikacss'],
})
Do not also add @pikacss/unplugin-pikacss/vite. The Nuxt module owns the Vite wiring. With single-entry authoring it imports that entry's sole configured logical cssModule through a generated Nuxt plugin/template; explicit multi-entry authoring does not auto-import CSS.
The default whole-project state root is .pikacss/:
.pikacss/pika.gen.ts is always generated authoring TypeScript..pikacss/previews/ holds host-bound rich-hover assets where needed..pikacss/runs/<runId>/... holds invocation-owned runtime CSS.There is no per-Typegen enable/path option. Configure stateDir in defineConfig() only when the entire generated-state root must move.
For non-Nuxt applications, import the configured logical CSS module:
import 'pika.css'
Generic TypeScript projects must include/reference .pikacss/pika.gen.ts. Before standalone typecheck/ESLint/editor workflows, run:
pikacss prepare
Use pikacss init to conservatively scaffold a canonical config when desired.
Project config is authored with defineConfig() from the directly installed outer package. Auto-discovery recognizes exactly pika.config.{ts,mts,js,mjs}; zero candidates is valid and multiple candidates are an error.
import { defineConfig } from '@pikacss/unplugin-pikacss'
import { icons } from '@pikacss/plugin-icons/node'
import { reset } from '@pikacss/plugin-reset'
export default defineConfig({
fnName: 'pika',
cssModule: 'pika.css',
transformedFormat: 'string',
engine: {
prefix: 'pk-',
plugins: [reset(), icons()],
},
})
Project-level fields include fnName, cssModule, transformedFormat, scan, report, and stateDir; Engine-specific semantics remain under engine.
Use [primaryValue, fallbackValues[]]. Fallback declarations are emitted first, then the primary value:
pika({
color: ['oklch(0.7 0.15 220)', ['rgb(0 120 255)', 'blue']],
})
Do not use a flat array such as ['red', 'blue']; that is not the fallback tuple shape.
The configured base pika(...) call uses the owning entry's transformedFormat ('string' by default, or 'array'). There are no per-call output-format variants.
Built-in pseudo selectors use a $ prefix; CSS at-rules are written directly. Named aliases must be registered under selectors.definitions.
pika({
color: 'red',
'$:hover': { opacity: '0.8' },
'$::before': { content: '""' },
'@media (min-width: 768px)': { fontSize: '1.2rem' },
'@dark': { color: 'white' }, // custom alias; register it first
})
selectors: {
definitions: [
{ name: '@dark', value: 'html.dark $' },
],
}
Inside a selector definition, $ is replaced by the generated atomic class selector.
pika('flex-center', 'card', {
__layer: 'components',
__important: true,
gap: '1rem',
})
StyleItems or inside shortcut definition value: StyleItem[].__layer selects a configured layer.__important applies !important to the definition.| Plugin | Package | Important adapter rule | Reference |
|---|---|---|---|
| Reset | @pikacss/plugin-reset | No runtime split | references/plugin-reset.md |
| Icons | @pikacss/plugin-icons | Use /node for local Iconify packages and autoInstall; neutral entry supports custom/CDN sources | references/plugin-icons.md |
| Fonts | @pikacss/plugin-fonts | No runtime split | references/plugin-fonts.md |
| Typography | @pikacss/plugin-typography | No runtime split | references/plugin-typography.md |
| Design Tokens | @pikacss/plugin-design-tokens | Use /node for JSON/Markdown file paths; neutral entry supports inline tokens | references/plugin-design-tokens.md |
Each plugin factory belongs in plugins. Its module import also activates the corresponding EngineConfig augmentation.
@pikacss/core exposes two public define helpers:
defineEngineConfig(config) — low-level/nested EngineConfig typing helper; do not use it as the pika.config.* default-export rootdefineEnginePlugin(plugin)Project files use defineConfig() from the directly installed outer package, with Engine settings under engine.
For reusable styles, preflights, selectors, shortcuts, variables, or keyframes, use plain object literals with satisfies or explicit type annotations.
// eslint.config.mjs
import pikacss from '@pikacss/eslint-config'
export default [await pikacss()]
The default export is an async configured flat-config factory. It loads the same canonical PikaCSS project config as the build integration, so configured compile-time roots are derived from project entries instead of duplicated in ESLint options.
| Symptom | Likely cause | Fix |
|---|---|---|
| Config not detected | Wrong name, duplicate configs, or wrong directory | Keep one supported config file at the project root |
| Styles not applied | Missing logical CSS-module import | Outside Nuxt, import the owning entry's configured cssModule (pika.css is only the single-entry default) |
Cannot find name 'pika' | Generated declarations absent from the TS program | Generate pika.gen.ts and include it, or write it under src |
pika is not defined survives into output | Build adapter is missing, disabled, or not scanning the file | Verify the correct bundler adapter and supported extension; update old integrations |
| Vue transform ordering issue | Old Vite integration | Current Vite adapter uses enforce: 'pre'; update before changing plugin order |
| Dynamic argument build error | Argument cannot be statically evaluated | Replace runtime values with CSS variables, variant maps, or shortcuts |
| Local icon collection is ignored | Neutral icons entry used | Import icons from @pikacss/plugin-icons/node |
| Design-token file source is ignored | Neutral design-tokens entry used | Import designTokens from @pikacss/plugin-design-tokens/node |
| Plugin config types missing | Augmenting package was never imported | Import and call the plugin factory in pika.config.* |
| Plugin hook not firing | Factory not called or wrong hook name | Use plugins: [myPlugin()] and exact lifecycle hook names |
| External plugin data does not trigger reload | Initialization dependency was not registered | Register it from configureEngine(configurator) through configurator.runtime.addConfigDependency(path) before Engine finalization |
Read references/plugin-development.md before implementing a plugin. Current essentials:
defineEnginePlugin({ ... }); there is no setup() wrapper.'pre' → default → 'post'.EnginePluginContext; use context.onDiagnostic for structured warnings/errors.configureRawConfig for defaults and raw config composition.configureEngine receives an owner-bound EngineConfigurator; use configurator.runtime for existing Engine runtime APIs, configurator.onDiagnostic for structured diagnostics, and configurator.pika / configurator.typegen for owner-bound initialization capabilities.EngineConfig with TypeScript module augmentation.createEngine(config, { onDiagnostic }) and assert diagnostics as data rather than spying on console.@pikacss/unplugin-pikacss or @pikacss/nuxt-pikacss). Install @pikacss/core directly only for low-level Engine/plugin development.cssModule; pika.css is the single-entry default.pika.gen.ts exists and is included by TypeScript./node entries.configureEngine through configurator.runtime.addConfigDependency(...); use the separate directory-membership capability when direct member create/delete/rename determines semantics.createEngine tests for normal behavior, diagnostics, and hook ordering.references/build-options.md (opens in a new tab)references/customizations.md (opens in a new tab)references/plugin-design-tokens.md (opens in a new tab)references/plugin-development.md (opens in a new tab)references/plugin-fonts.md (opens in a new tab)references/plugin-icons.md (opens in a new tab)references/plugin-reset.md (opens in a new tab)references/plugin-typography.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
Other plugins' skills for the same job
/pikacss:pikacss-usefrom PikaCSS
npx claudepluginhub pikacss/pikacss --plugin pikacss