AGENT SKILL

tailwind-v4

Implements maintainable styling with Tailwind CSS v4. Use when writing styles in v4 projects — CSS-first configuration via `@theme` blocks (never `tailwind.config.ts/js`), mobile-first breakpoints, full class names (no string interpolation), and no arbitrary `p-[13px]`-style values.

License 许可
MIT
最近更新
2026-05-27
Stars
★ 0
Forks
0

01 前言 Front Matter

name
tailwind-v4
vendor
tailwind
description
Implements maintainable styling with Tailwind CSS v4. Use when writing styles in v4 projects — CSS-first configuration via `@theme` blocks (never `tailwind.config.ts/js`), mobile-first breakpoints, full class names (no string interpolation), and no arbitrary `p-[13px]`-style values.

03 SKILL.md 正文

Skill: Tailwind CSS v4

Policy Capsule

  • Configure the theme via CSS-first @theme blocks; never use tailwind.config.ts or tailwind.config.js in v4 projects.
  • Prefer atomic utility classes (flex, p-4, text-lg) over hand-written CSS classes.
  • Use mobile-first breakpoints (sm:, md:, lg:, xl:); never write desktop-first overrides.
  • Define hover:, focus-visible:, and active: states explicitly on every interactive element.
  • Arbitrary values (p-[13px]) are prohibited — map one-off values to a @theme CSS variable instead.
  • Never build utility classes by string interpolation (e.g. text-${color}); always use full literal class names so the compiler detects them.
  • Adhere to the design system's spacing, color, and typography tokens defined in @theme variables.
  • For repeated UI patterns, extract a component or a CSS @apply block — do not let class strings bloat in JSX.

Rules for implementing high-performance, maintainable styling using the latest Tailwind CSS specification.

1. Core Principles

  • CSS-First Configuration: Use CSS variables for theme customization within the @theme block. NEVER use tailwind.config.ts or tailwind.config.js in v4 projects.
  • Modern Syntax: Leverage the new @theme directive, fluid design utilities, and lightning-fast compilation.
  • Token Consistency: Strictly adhere to the design system's spacing, color, and typography tokens defined in the CSS variables.

2. Technical Standards

  • Utility Usage: Prefer atomic utility classes (flex, p-4, text-lg) over custom CSS classes.
  • Responsive Design: Use mobile-first breakpoints (sm:, md:, lg:, xl:).
  • Interactive States: Explicitly define hover:, focus-visible:, and active: states for all interactive elements to ensure a premium feel.
  • Arbitrary Values: STRICTLY PROHIBITED (p-[13px]) unless explicitly required by a one-off legacy asset. Always map unique values to a temporary CSS variable in the @theme block instead.

3. Best Practices

  • Class Ordering: Use the standard Tailwind class ordering (Layout -> Box Model -> Typography -> Visual -> Misc).
  • Component Patterns: For repeated UI patterns (e.g., buttons), use a dedicated component or a reusable @apply block in a CSS file to avoid class-string bloat.
  • Dynamic Classes: Never use string interpolation to create utility classes (e.g., text-${color}). Always use full class names to ensure the compiler detects them.

04 同仓库更多 Skills

chrisbarrantes
chrisbarrantes/mandrel

no-capsule-skill

Fixture without a Policy Capsule section.

★ 0
chrisbarrantes
chrisbarrantes/mandrel

backend-security-patterns

Combined backend protocols for authentication (Clerk JWT verification) and PII-safe observability. Use when handling auth on the server, verifying Clerk webhooks via `svix`, scoping metadata via `publicMetadata`/ `privateMetadata`, or sanitizing logs to keep emails, tokens, and request bodies out of telemetry.

★ 0
chrisbarrantes
chrisbarrantes/mandrel

vitest

Writes fast, isolated unit and integration tests with Vitest. Use when each test must run on file-save without shared state — `vi.mock()` for external deps, `vi.spyOn()` for call monitoring, AAA structure, and edge-case coverage for null/undefined/boundary inputs.

★ 0
chrisbarrantes
chrisbarrantes/mandrel

playwright

Robust E2E browser testing with Playwright. Use when writing browser-driven tests — leverage auto-waiting (no `waitForTimeout`), prefer user-visible locators (`getByRole`, `getByText`, `getByLabel`) over CSS/XPath, reuse `storageState` for auth, and enable trace-on-first-retry for CI debugging.

★ 0
chrisbarrantes
chrisbarrantes/mandrel

playwright-bdd

Wires Gherkin `.feature` files to Playwright via the `playwright-bdd` library. Use when running BDD scenarios on a Playwright runtime — pairs with the `gherkin-authoring` skill (scenario prose) and the `playwright` skill (browser conventions). Drives execution by tag expression with trace-first debugging and Playwright-native sharding.

★ 0
chrisbarrantes
chrisbarrantes/mandrel

lighthouse-baseline

Codifies the capture-and-check baseline pattern for long-running quality signals (Lighthouse scores, bundle size, p95 latency, runtime memory). Use when wiring a new metric that needs a baseline file, paired :capture / :check npm scripts, a tolerance-bounded gate, and a weekly refresh cadence — the goal is a hard CI signal that ratchets only with intent.

★ 0