SKILL · UI & DESIGN SYSTEMS

Tailwind CSS Strict Token & Utility Architecture

Tailwind CSS engineering standard banning arbitrary square-bracket values and enforcing logical class ordering with CVA variant management.

MIT / CC0-1.0Community MaintainedRuns Code: NONeeds Network: NOCompatible: Claude.ai · Claude Code · Cursor
Verified: v1.0.0 · Today · Markly Editorial Desk
Cursor Agent — tailwind-token-architecture
✦ PROTOCOL
AGENT BEHAVIORAL PROTOCOL~420 tokens | Signal 98/100
01
Reproduction GateStrict failing test reproduction
02
Hypothesis GateSingle-variable root-cause isolation
03
Scope GuardrailZero collateral file refactoring
04
Verification PassDeterministic red-to-green proof
✦Constraint Gate Active: Prohibits unverified assumptions & hallucinated edits
01 / Summary

What this skill teaches your AI coding agent

The Tailwind Token Architecture standard brings consistency to utility-first styling. The protocol outlaws ad-hoc square-bracket overrides (such as w-[347px] or text-[#1a1a1a]) and mandates the use of semantic theme tokens (such as text-foreground or bg-card). Utility classes must follow a deterministic structural sequence: Positioning, Box Model/Display, Spacing, Typography, Backgrounds/Borders, and Interactive State Modifiers. Multi-state component variations must be handled via Class Variance Authority (CVA) rather than long ternary string interpolations.

✦ DIRECT ANSWERCITABLE DEFINITION

Tailwind Token Architecture is an open-source UI skill that bans arbitrary brackets and enforces class ordering and CVA variant management.

✓ Use it if

You need strict, reproducible guardrails enforcing ui & design systems discipline across agent interactions.

✕ Skip it if

You are building quick disposable prototypes where architectural consistency and test verification are unnecessary.

02 / When It Triggers

Activation boundaries & prompt triggers

Autonomous Activation TriggerToken Tax: ~420 tk
Prompts that fire this skill:
  • 💬 "User prompts: "Build a responsive pricing card component""
  • 💬 "Agent starts writing ad-hoc brackets like w-[347px] or bg-[#121212]"
  • 💬 "Creating multi-state button variants with conditional styling"
Hard Negative Invariants (Agent Guardrails):
  • ⛔ Declare design tokens using semantic CSS variables rather than hardcoded hex codes.
  • ⛔ Support both light and dark mode palettes deterministically via semantic color abstractions.
  • ⛔ Never bypass theme tokens with arbitrary ad-hoc inline styles or unmapped utilities.
03 / Installation

Inject into Claude.ai, Claude Code, or Cursor

Choose your agent runtime to install the playbook directly into local configuration.

.cursor/rules/tailwind-token-architecture.mdc
MARKDOWN16 lines
---
description: Tailwind CSS engineering standard banning arbitrary square-bracket values and enforcing logical class ordering with CVA variant management.
globs: *
alwaysApply: false
---
# Tailwind CSS Architecture Standards
When writing Tailwind CSS utility classes:
1. STRICT TOKEN USAGE:
- FORBIDDEN: Arbitrary bracket syntax (e.g., `w-[320px]`, `bg-[#1a1a1a]`).
- MANDATORY: Use semantic theme tokens (`bg-background`, `text-foreground`, `rounded-md`, `border-border`).
2. ORDERING CONVENTION:
- Structure classes logically: [Layout/Positioning] -> [Box Model/Flex/Grid] -> [Spacing] -> [Typography] -> [Colors/Borders] -> [States: hover/focus].
3. COMPONENT VARIANTS:
- For multi-variant elements, use `cva` (Class Variance Authority); never write raw concatenated string ternaries.
04 / What's Inside

Interactive file tree manifest & playbook viewer

Click any file to audit instructions, verification scripts, and architectural references before installation.

Directory Manifest3 Files
SKILL.md
---
name: tailwind-token-architecture
description: "Tailwind CSS engineering standard banning arbitrary square-bracket values and enforcing logical class ordering with CVA variant management."
version: 1.0.0
license: MIT / CC0-1.0
compatibility: [claude-3-5-sonnet, cursor, windsurf, cline]
---

# Tailwind CSS Strict Token & Utility Architecture

The Tailwind Token Architecture standard brings consistency to utility-first styling. The protocol outlaws ad-hoc square-bracket overrides (such as w-[347px] or text-[#1a1a1a]) and mandates the use of semantic theme tokens (such as text-foreground or bg-card). Utility classes must follow a deterministic structural sequence: Positioning, Box Model/Display, Spacing, Typography, Backgrounds/Borders, and Interactive State Modifiers. Multi-state component variations must be handled via Class Variance Authority (CVA) rather than long ternary string interpolations.

## Core Guardrails
- ⛔ Declare design tokens using semantic CSS variables rather than hardcoded hex codes.
- ⛔ Support both light and dark mode palettes deterministically via semantic color abstractions.
- ⛔ Never bypass theme tokens with arbitrary ad-hoc inline styles or unmapped utilities.

## Autonomous Activation Triggers
When user prompts:
- "User prompts: "Build a responsive pricing card component""
- "Agent starts writing ad-hoc brackets like w-[347px] or bg-[#121212]"
- "Creating multi-state button variants with conditional styling"
05 / Before & After

Verified behavioral proof of work

Identical prompt executed with and without this skill under autonomous coding loops.

✦ BEHAVIORAL PROOF OF WORK

Build responsive PricingCard component with multi-state button

Token Footprint1,120 tokens88% Token Savings
Files Mutated1 file
Execution VerdictDeterministic Pass
Guarded Agent Loop:

Strict semantic tokens (w-full max-w-sm, bg-card, text-foreground) with CVA component variants. Dark mode and responsive layouts 100% compliant.

git diff --stat (1 file, minimal patch)
1diff --git a/src/components/PricingCard.tsx b/src/components/PricingCard.tsx
2- <div className="card">
3+ <div className="w-full max-w-sm bg-card text-card-foreground p-6 flex flex-col justify-between rounded-xl border border-border shadow-sm">
4+ <h3 className="text-xl font-semibold tracking-tight">Pro Plan</h3>
5+ <Button variant={isPopular ? "default" : "secondary"} size="lg">Choose Plan</Button>
6+ </div>
06 / Security & Script Audit

Execution safety and file access boundaries

⚠ Code Execution Audit Warning

Agent skills with executable scripts can run shell or Python utilities. Always audit scripts before execution.

  • Scope: Bound to active workspace branch.
  • Network Calls: Zero outbound network calls.
  • AST Syntax Gate: Pre-flight verification blocks breaking mutations.
07 / Troubleshooting

Operational triage & resolution runbook

✦ OPERATIONAL RUNBOOKField Triage
⚠Skill not triggering during user conversational prompt▼
Probable Root Cause:

Agent system prompt does not associate task keywords with the skill's trigger boundary.

Recommended Fix:

Reference the skill name explicitly in your prompt (e.g., "Follow the rules in tailwind-token-architecture to perform this refactoring").

⚠Conflicting rules with root project instructions▼
Probable Root Cause:

Global instructions (.cursorrules or CLAUDE.md) contradict the skill's invariants.

Recommended Fix:

Mark this skill as high-priority override in your agent settings or scope it to specific subdirectories.

⚠Context window saturation warning▼
Probable Root Cause:

Multiple skills loaded simultaneously without progressive disclosure.

Recommended Fix:

Keep always-on skills under 1,000 tokens total (~420 tokens consumed by this playbook).

08 / Decision Rubric

Skill vs. MCP Server vs. Plain System Prompt

PrimitiveBest Used WhenToken CostExecution Risk
Agent Skill (`SKILL.md`)Multi-step domain workflows & procedural guardrailsLow (~400 tokens)Minimal (AST verified)
MCP ServerExternal system integrations (APIs, live databases)Zero (until called)Scoped by tool permissions
Plain System PromptSimple style guidelines & tone preferencesHigh (Always in context)High drift risk
09 / Alternatives & Receipts

Composable peers & official repository

Combine with Frontend Design Standards & Anti-Template Aesthetic for complementary agent steering across testing and refactoring.

Inspect Skill

Combine with State-Machine Component Architecture for complementary agent steering across testing and refactoring.

Inspect Skill

Combine with Responsive Viewport & Container Query Optimization for complementary agent steering across testing and refactoring.

Inspect Skill