All 5 AI packs for $39 →
← ToolTier Library
Copilot instructions · Free

Copilot instructions for Tailwind CSS v4

A free .github/instructions/tailwind.instructions.md for GitHub Copilot: Tailwind v4 setup, @theme tokens, the renamed v4 utilities and what code review should flag, applied only to styling files.

Install
.github/instructions/tailwind.instructions.md
Last tested
GitHub Copilot / Tailwind CSS 4.3 docs · 2026-11-12

These are the same Tailwind v4 rules as our Cursor rule, in GitHub Copilot's path-specific format: a NAME.instructions.md file in .github/instructions/ with an applyTo glob. Here applyTo covers CSS, TSX, JSX, HTML, Vue, Svelte and Astro files, so the Tailwind guidance stays out of requests about your API or database code.

Per GitHub's docs, checked on November 12, 2026, path-specific instructions on GitHub.com are used by Copilot cloud agent and Copilot code review, and VS Code's docs describe the same applyTo files for agent sessions in the editor. The last section is written for code review, so pull requests that reintroduce v3 syntax, a tailwind.config file or interpolated class names get flagged. Add excludeAgent: "code-review" or "cloud-agent" if you want only one of them to read it.

Class-name changes come from Tailwind's v3-to-v4 upgrade guide, checked the same day (latest release v4.3.5). Fill in the [bracketed] version and stylesheet path. For the repo-wide file, start with our free copilot-instructions.md for Next.js, and see our free code review instructions for how Copilot should word its review comments.

tailwind.instructions.md
---
applyTo: "**/*.css,**/*.tsx,**/*.jsx,**/*.html,**/*.vue,**/*.svelte,**/*.astro"
---

# Tailwind CSS v4 instructions

This repo uses Tailwind CSS [4.x], configured in CSS in `[src/app/globals.css]`. There is no `tailwind.config.js`. Repository-wide rules in `.github/copilot-instructions.md` still apply. If anything here disagrees with tailwindcss.com/docs for the installed version, the docs win.

## Setup
- Tailwind loads with `@import "tailwindcss";`. Never add `@tailwind base/components/utilities` directives.
- Don't create `tailwind.config.js`, add `postcss-import` or `autoprefixer`, or add Sass, Less or Stylus.
- Plugins load in CSS with `@plugin "<package>";`.

## Tokens
- Design tokens are CSS variables in `@theme { }`: `--color-*`, `--font-*`, `--breakpoint-*`, `--radius-*`, `--shadow-*`. Reuse them; don't hard-code colors that already exist as tokens.
- In custom CSS, use `var(--color-…)` and `--spacing(n)`. Don't use `theme()` in new code.

## Class names (v4, not v3)
- Opacity modifiers (`bg-black/50`), never `bg-opacity-*` or `text-opacity-*`.
- `shadow-xs`, `rounded-xs`, `blur-xs` for the old `-sm` sizes; `shadow-sm`, `rounded-sm`, `blur-sm` for the old bare ones.
- `outline-hidden` for the old `outline-none`; `ring-3` for the old default `ring`; `shrink-*` and `grow-*`; `bg-linear-to-*` for gradients.
- Always give `border`, `divide` and `ring` an explicit color; they default to `currentColor`.
- CSS variable shorthand uses parentheses: `bg-(--brand)`. Important is a suffix: `flex!`.
- Write complete class names. Map props to full strings; never build classes with string interpolation.

## Custom CSS
- Custom utilities with `@utility name { }`, custom variants with `@custom-variant`. Don't rely on `@layer utilities` or `@layer components` for classes that need variants.
- In CSS modules or component `<style>` blocks, add `@reference "[path/to/globals.css]";` before `@apply`.

## When reviewing a pull request
- Flag any v3 syntax listed above, new `tailwind.config.*` files, dynamically built class names, and hard-coded colors that duplicate a token. Suggest the v4 replacement.
Works with: GitHub Copilot
GitHub CopilotTailwind CSSCustom instructions

← More free rules, templates and prompts

+ Your logo here