Vanilla extract

From oyi77/1ai-skills · View interactive version

Vanilla extract is an AI agent skill from the GitHub repository oyi77/1ai-skills. Use when vanilla Extract zero-runtime CSS-in-JS — type-safe styles, Sprinkles, Recipes, themes.

How to use this skill

Skill file

Overview

Vanilla Extract is a zero-runtime CSS-in-JS library. Styles are written in TypeScript and compiled to static CSS at build time — no runtime overhead, full type safety, and excellent performance.

Capabilities

When to Use

Trigger phrases:

When NOT to Use

Pseudo Code

The vanilla-extract workflow follows a standard pipeline pattern.

Core flow:

# vanilla-extract primary flow
input = prepare(raw_data)
result = process(input, config={extract, recipes, runtime, safe, sprinkles})
validate(result)
deliver(result)

Error handling:

on error:
  log(error_details)
  retry_with_backoff(max=3)
  if still_failing: alert_and_escalate()

Core Workflow

# vanilla-extract primary flow
input = prepare(raw_data)
result = process(input, config={extract, recipes, runtime, safe, sprinkles})
validate(result)
deliver(result)

Error Handling

on error:
  log(error_details)
  retry_with_backoff(max=3)
  if still_failing: alert_and_escalate()

Basic Styles

// styles.css.ts
import { style } from "@vanilla-extract/css"

export const container = style({
  padding: "24px",
  borderRadius: "8px",
  backgroundColor: "#f8fafc",
  ":hover": { backgroundColor: "#f1f5f9" },
  "@media": {
    "(max-width: 768px)": { padding: "16px" },
  },
})

Theme

// theme.css.ts
import { createTheme, createThemeContract } from "@vanilla-extract/css"

export const vars = createThemeContract({
  color: { primary: null, background: null, text: null },
  space: { sm: null, md: null, lg: null },
})

export const lightTheme = createTheme(vars, {
  color: { primary: "#3b82f6", background: "#ffffff", text: "#1f2937" },
  space: { sm: "8px", md: "16px", lg: "24px" },
})

export const darkTheme = createTheme(vars, {
  color: { primary: "#60a5fa", background: "#111827", text: "#f9fafb" },
  space: { sm: "8px", md: "16px", lg: "24px" },
})

Recipes (Variants)

// button.css.ts
import { recipe } from "@vanilla-extract/recipes"

export const button = recipe({
  base: {
    padding: "8px 16px",
    borderRadius: "6px",
    fontWeight: 600,
  },
  variants: {
    variant: {
      primary: { backgroundColor: "#3b82f6", color: "white" },
      outline: { border: "1px solid #3b82f6", color: "#3b82f6" },
    },
    size: {
      sm: { fontSize: "14px", padding: "4px 8px" },
      md: { fontSize: "16px" },
      lg: { fontSize: "18px", padding: "12px 24px" },
    },
  },
  defaultVariants: { variant: "primary", size: "md" },
})

Sprinkles (Utility Props)

// sprinkles.css.ts
import { defineProperties, createSprinkles } from "@vanilla-extract/sprinkles"

const responsiveProperties = defineProperties({
  conditions: {
    mobile: {},
    tablet: { "@media": "(min-width: 768px)" },
    desktop: { "@media": "(min-width: 1024px)" },
  },
  defaultCondition: "mobile",
  properties: {
    display: ["none", "flex", "block"],
    padding: { sm: "8px", md: "16px", lg: "24px" },
    gap: { sm: "8px", md: "16px", lg: "24px" },
  },
})

export const sprinkles = createSprinkles(responsiveProperties)

Common Patterns

How to Use

  1. Define content goal (traffic, engagement, conversion, brand awareness)
  2. Research target audience pain points and search intent
  3. Generate content using appropriate AI tools
  4. Edit and humanize output for authenticity
  5. Optimize for target platform (SEO, hashtags, format)
  6. Schedule and distribute across channels
  7. Measure performance and iterate

Red Flags

Verification

Process

  1. Analyze the task requirements
  2. Apply domain expertise
  3. Verify output quality

Anti-Rationalization Table

| Rationalization | Reality |

|---|---|

| "Good enough content works" | Quality content drives engagement. Mediocre content gets ignored. |

| "I will optimize later" | SEO and distribution need optimization from the start. |

| "Templates are good enough" | Templates are a starting point. Custom content outperforms generic. |

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.