Agent skill

using-panda-css

Panda CSS type safety rules for token references. Use when styling with css(), cva(), or token paths.

Stars 163
Forks 31

Install this agent skill to your Project

npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/data/using-panda-css

SKILL.md

Using Panda CSS

CRITICAL: Token Type Safety

Panda CSS's css() and cva() functions are NOT type-safe for token references due to the AnyString escape hatch.

The Problem

typescript
// styled-system/types/style-props.d.ts
type AnyString = (string & {})
maxWidth?: ConditionalValue<... | AnyString>  // ❌ Accepts ANY string!

FORBIDDEN - String Literals

typescript
// These compile but are NOT type-safe:
css({ maxWidth: 'sizes.container.wide' }) // ❌ AnyString escape hatch
css({ paddingInline: '4' }) // ❌ Would accept 'INVALID' too

REQUIRED - token() Function

typescript
import { token } from '../styled-system/tokens'

css({ maxWidth: token('sizes.container.wide') }) // ✅ Type-safe
css({ paddingInline: token('spacing.4') }) // ✅ Type-safe
// css({ color: token('colors.INVALID.500') })       // ❌ TypeScript error!

Rule

If a string looks like a token path (contains . and starts with a token category like sizes, spacing, colors, fontSizes), it MUST use token().

Only exceptions: literal CSS values like '100%', 'auto', 'bold', numeric values.

Expand your agent's capabilities with these related and highly-rated skills.

Didn't find tool you were looking for?

Be as detailed as possible for better results