tailwind-best-practices

Enforce Tailwind CSS v4 syntax and prevent outdated v3 patterns in generated code.

Updated Mar 11, 2026
One-click install
npx skills add https://github.com/sckroll/nextjs-mariadb-sample --skill tailwind-best-practices-sckroll
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tailwind-best-practices
Source: https://github.com/sckroll/nextjs-mariadb-sample/tree/main/.agents/skills/tailwind-best-practices
Command: npx skills add https://github.com/sckroll/nextjs-mariadb-sample --skill tailwind-best-practices-sckroll

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill prevents AI agents from generating outdated Tailwind CSS v3 code, ensuring adherence to modern v4 syntax, configuration, and utility patterns.

Core Features & Use Cases

  • Enforces Tailwind v4 Syntax: Guides AI to use correct directives, configuration, and utility classes for the latest version.
  • Prevents Common Anti-Patterns: Avoids deprecated features and promotes efficient, modern CSS practices.
  • Use Case: When generating UI components with Tailwind, ensure the AI uses the new @import "tailwindcss" instead of @tailwind directives and the slash modifier for opacity (e.g., bg-red-500/50).

Quick Start

Use the tailwind-best-practices skill to ensure all generated Tailwind CSS code follows v4 syntax and patterns.

Frequently Asked Questions about tailwind-best-practices

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I configure Tailwind CSS using the new CSS-first approach?

Tailwind CSS v4 uses a CSS-first configuration approach with the @theme directive, replacing the old JavaScript configuration file. You define design tokens directly in your CSS to modernize styling setups.

What is the correct Tailwind v4 syntax for importing styles instead of directives?

Tailwind v4 requires using the @import "tailwindcss" syntax instead of the deprecated @tailwind directives. This modern import method ensures correct stylesheet generation and prevents outdated v3 anti-patterns.

How do I apply opacity modifiers to utility classes in Tailwind CSS v4?

Tailwind CSS v4 applies opacity using the slash modifier syntax, such as bg-red-500/50. This modern utility pattern replaces verbose class lists for color transparency adjustments.

Why does my AI generated code still use outdated Tailwind CSS v3 syntax?

AI agents often default to outdated Tailwind CSS v3 syntax unless guided by best practices. Enforcing v4 standards prevents deprecated directives and verbose class lists during UI component generation.

Can I use Tailwind CSS v4 best practices for existing frontend web development projects?

Yes, applying Tailwind CSS v4 best practices modernizes existing frontend web development projects by transitioning to CSS-first configuration and modern utility patterns, preventing deprecated v3 features.

What are the limitations of migrating to Tailwind CSS v4 syntax?

Migrating to Tailwind CSS v4 syntax requires abandoning deprecated @tailwind directives and JavaScript configurations. Limitations include updating existing utility patterns and preventing AI agents from generating outdated v3 code.