Tailwind CSS Best Practices

February 20, 2026 ยท View on GitHub

License: MIT Skills

Stop your AI agent from generating Tailwind CSS v3 code. 12 rules for Tailwind v4 syntax, CSS-first config with @theme, modern utility patterns, and the anti-patterns every agent produces.

AI coding assistants (Cursor, Claude Code, Copilot, Codex) are trained on Tailwind v3 data. They generate tailwind.config.js, @tailwind directives, bg-opacity-50, and other patterns that don't exist in Tailwind CSS v4. This plugin fixes that.

Install

Cursor / Claude Code / Windsurf

npx skills add ofershap/tailwind-best-practices

Or copy skills/ into your .cursor/skills/ or .claude/skills/ directory.

What's Included

TypeNameDescription
Skilltailwind-best-practices12 rules covering @import, @theme, opacity, gradients, container queries, @utility, and more
Rulebest-practicesAlways-on behavioral rule that enforces v4 patterns on every file
Command/auditScan your codebase for Tailwind v3 anti-patterns

What Agents Get Wrong

AI agents consistently produce these outdated Tailwind patterns:

What the agent writesWhat v4 actually uses
tailwind.config.js with JS objectsCSS-first @theme { } in your stylesheet
@tailwind base; @tailwind components;@import "tailwindcss";
bg-opacity-50, text-opacity-25bg-red-500/50, text-white/80
bg-gradient-to-rbg-linear-to-r, bg-linear-45
!flex, !bg-red-500flex!, bg-red-500!
bg-[--brand-color]bg-(--brand-color)
grid-cols-[max-content,auto]grid-cols-[max-content_auto]

If this helped your workflow, a star helps others find it.

Author

Made by ofershap

LinkedIn GitHub

License

MIT