1 tailwind rules available
One Claude rule matches tailwind: a Tailwind CSS expert rule focused on design consistency. Tailwind v4 moved configuration into CSS, so Claude Code must look at the project before editing any config file; the file is scoped to markup and CSS.
Claude Code loads persistent project instructions from CLAUDE.md files and from Markdown rules in .claude/rules/. Rules can be scoped to file paths with a paths frontmatter field, and CLAUDE.md can import other files with @path syntax. The rules in this directory are written as plain instruction prompts: in Claude Code, save them as CLAUDE.md or .claude/rules/ content; in Claude.ai or the Claude API, use the same text as project instructions or a system prompt instead.
.claude/rules/tailwind.mdStarting point, not a tested configuration for your repository. Loaded when Claude Code works with files matching paths. Review the instructions, adapt the file paths and run your project's existing checks.
---
paths:
- "**/*.css"
- "**/*.html"
- "**/*.tsx"
- "**/*.jsx"
- "**/*.vue"
- "**/*.svelte"
---
# Tailwind CSS instructions for Claude Code
## Focus for this project
- Report whether the project uses Tailwind v4 (CSS @theme) or v3 (tailwind.config.js) before editing configuration.
- Add new colors as theme tokens and use the generated utilities; do not scatter hex values in class names.
- Check the class list renders by running the dev server or build, not by inspection alone.
## Tailwind CSS conventions
- Identify the Tailwind version first. v4 projects import Tailwind with @import "tailwindcss"; and define design tokens with @theme in CSS; v3 projects use tailwind.config.js. Edit the one the project actually uses.
- Write complete class names in source. Tailwind detects classes as plain text, so interpolated names such as bg-${color}-500 are not generated; map values to full class strings instead.
- Use theme tokens instead of arbitrary values like text-[#3b82f6] unless the value is genuinely one-off.
- Style mobile first and add sm:/md:/lg: variants for larger screens; keep focus-visible styles on interactive elements.
## Before you finish
- Run the CSS build or dev server, a visual check of the changed component at a mobile and a desktop width, and the lint script and report the actual output. If you cannot run them, say so and list the exact commands instead of saying they pass.
- Summarize which of the rules above affected the change.
- You have shell access: run the checks yourself instead of asking the user to, unless a command needs credentials or would deploy.
Create your own Claude rules for Tailwind CSS and share with the community.
Ask for a small change to one matching file. Check the tool's loaded context or instruction view, inspect the diff for the requested convention, and run the relevant build or test. A well-formatted file does not guarantee the model follows every instruction.
Imports with @path can nest up to four hops deep, according to the docs. Claude Code can read AGENTS.md as project instructions without extra configuration, but by default only when there is no CLAUDE.md in the working directory or above it. The docs list this behavior for version 2.1.277 and later and describe a setting (claude-md-and-agents-md) that loads both files. If you maintain AGENTS.md for other tools, you can also import it from CLAUDE.md with @AGENTS.md.
Documentation checked 2026-11-05: Claude Code docs: Manage Claude's memory
Illustrative input and expected result. This example is a verification guide, not a recorded model run.
You ask Claude Code to add a brand color and use it on buttons, and want it added in the right place for the installed Tailwind version.
Add a brand color #0f766e and use it for the primary Button background and focus ring.
A --color-brand token in @theme (v4) or a colors.brand entry (v3), Button using bg-brand and a focus-visible ring utility, and evidence from the build or dev server that the classes were generated.
Content reviewed 2026-11-05. Confirm instruction activation in your installed client before relying on it.