Windsurf rules for Tailwind CSS v4: tool-sorted classes, mobile-first grids, class-based dark mode via @custom-variant, and typed variant maps with complete class names.
.devin/rules/tailwind-css-for-windsurf.md. Downloaded files need to be placed in that repository path.---
trigger: glob
globs: "**/*"
---
Apply these rules when styling with Tailwind CSS (v4 unless the project is still on v3).
## Class organization
- Let `prettier-plugin-tailwindcss` order classes (set `tailwindStylesheet` to the CSS entry file in v4). Do not hand-sort.
- Keep class names complete in source; Tailwind cannot detect names built by concatenation.
## Responsive design
```html
<div class="grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4">
```
- Mobile first: unprefixed classes apply everywhere; `sm:`/`lg:`/`xl:` apply from that width up.
## Dark mode
```html
<div class="bg-white text-gray-900 dark:bg-gray-900 dark:text-white">
```
- `dark:` follows the OS preference by default. For a manual toggle, add `@custom-variant dark (&:where(.dark, .dark *));` to the CSS entry file and toggle `dark` on `<html>`.
## Component variants
```tsx
import type { ButtonHTMLAttributes } from 'react';
const variants = {
primary: 'bg-blue-600 text-white hover:bg-blue-700',
secondary: 'bg-gray-200 text-gray-900 hover:bg-gray-300',
danger: 'bg-red-600 text-white hover:bg-red-700',
} as const;
type ButtonProps = ButtonHTMLAttributes<HTMLButtonElement> & {
variant?: keyof typeof variants;
};
export function Button({ variant = 'primary', className = '', type = 'button', ...props }: ButtonProps) {
return (
<button
type={type}
className={`rounded px-4 py-2 font-medium focus-visible:outline-2 focus-visible:outline-offset-2 ${variants[variant]} ${className}`}
{...props}
/>
);
}
```
- Map variants to complete class strings (as above) and type the variant prop from the map's keys.
- Check text contrast for each variant; the 600 shades used here give stronger contrast with white text than 500.
- When callers can pass conflicting classes, merge with `tailwind-merge` instead of string concatenation.
Cursor rules for Tailwind CSS v4: automatic class sorting, mobile-first breakpoints, CVA variants with merging, class-based dark mode via @custom-variant, and CSS-first @theme configuration.
Cursor rules for React with TypeScript: typed function components, React 19 ref-as-prop, hooks discipline, state ownership, error boundaries and measured performance work.
CLAUDE.md rules for React 19 with TypeScript covering typed components, derived state, compiler-aware memoization, useId-based accessibility and review checks.
Windsurf
frontend
Illustrative input and expected result. This example is a verification guide, not a recorded model run.
Content reviewed .
A Windsurf React project on Tailwind v4 has an untyped Button whose variant prop accepts any string (undefined classes at run time) and a dark-mode toggle that stopped working after the v4 upgrade.
Fix src/components/Button.tsx and src/styles/app.css following the Tailwind CSS rule.
A Button typed with variant: keyof typeof variants, native button props passed through, type defaulting to button and a focus-visible style; app.css gains @custom-variant dark for the toggle; class sorting delegated to the Prettier plugin.
Windsurf's rules documentation (docs.windsurf.com/windsurf/cascade/memories) now redirects to Devin documentation, which describes rules for the Devin Local agent in Devin Desktop. Current rules live in .devin/rules/*.md with a trigger setting, and the legacy Windsurf files (.windsurf/rules/*.md, .windsurf/global_rules.md and .windsurfrules) are still imported by default. AGENTS.md files are read as always-on rules.
.devin/rules/tailwind-css-for-windsurf.mdStarting point, not a tested configuration for your repository. Applied when files matching globs are involved (trigger: glob). Review the instructions, adapt the file paths and run your project's existing checks.
---
trigger: glob
globs: "**/*"
---
Apply these rules when styling with Tailwind CSS (v4 unless the project is still on v3).
## Class organization
- Let `prettier-plugin-tailwindcss` order classes (set `tailwindStylesheet` to the CSS entry file in v4). Do not hand-sort.
- Keep class names complete in source; Tailwind cannot detect names built by concatenation.
## Responsive design
```html
<div class="grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4">
```
- Mobile first: unprefixed classes apply everywhere; `sm:`/`lg:`/`xl:` apply from that width up.
## Dark mode
```html
<div class="bg-white text-gray-900 dark:bg-gray-900 dark:text-white">
```
- `dark:` follows the OS preference by default. For a manual toggle, add `@custom-variant dark (&:where(.dark, .dark *));` to the CSS entry file and toggle `dark` on `<html>`.
## Component variants
```tsx
import type { ButtonHTMLAttributes } from 'react';
const variants = {
primary: 'bg-blue-600 text-white hover:bg-blue-700',
secondary: 'bg-gray-200 text-gray-900 hover:bg-gray-300',
danger: 'bg-red-600 text-white hover:bg-red-700',
} as const;
type ButtonProps = ButtonHTMLAttributes<HTMLButtonElement> & {
variant?: keyof typeof variants;
};
export function Button({ variant = 'primary', className = '', type = 'button', ...props }: ButtonProps) {
return (
<button
type={type}
className={`rounded px-4 py-2 font-medium focus-visible:outline-2 focus-visible:outline-offset-2 ${variants[variant]} ${className}`}
{...props}
/>
);
}
```
- Map variants to complete class strings (as above) and type the variant prop from the map's keys.
- Check text contrast for each variant; the 600 shades used here give stronger contrast with white text than 500.
- When callers can pass conflicting classes, merge with `tailwind-merge` instead of string concatenation.
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.
The docs recommend keeping rules short and specific. The current docs say AGENTS.md, AGENTS.local.md and AGENT.md are read as always-on rules, including files in subdirectories. Use .devin/rules/ when you need glob, model-decision or manual triggers.
Documentation checked 2026-11-05: Devin docs: Local customizations (redirect target of Windsurf memories docs)Windsurf docs: Cascade memories (redirects)
Cursor rules for Tailwind CSS v4: automatic class sorting, mobile-first breakpoints, CVA variants with merging, class-based dark mode via @custom-variant, and CSS-first @theme configuration.
Cursor rules for React with TypeScript: typed function components, React 19 ref-as-prop, hooks discipline, state ownership, error boundaries and measured performance work.
CLAUDE.md rules for React 19 with TypeScript covering typed components, derived state, compiler-aware memoization, useId-based accessibility and review checks.