tailwind — правило для Cursor: что делает и как установить
Задаёт стандарты вёрстки на Tailwind CSS и правила для компонентов UI. Срабатывает при редактировании стилей и разметки JSX или TSX.
.cursor/rules/tailwind.mdcЧто делает tailwind
Правило задаёт для Cursor требования к вёрстке интерфейсов на Tailwind CSS. Ассистент ориентируется на использование утилитарных классов вместо кастомных CSS-стилей, группирует повторяющиеся правила через директиву @apply и применяет подход mobile-first. В разметке рекомендуется строить сетки через Flexbox и Grid, а также подключать компоненты shadcn/ui, если они доступны в проекте.
Инструкция охватывает работу с типографикой, семантическими именами цветов и тёмной темой. При настройке окружения она требует оптимизировать размер бандла через очистку неиспользуемых стилей purge.
Инструкция не висит в контексте постоянно: флаг alwaysApply: false включает её только при редактировании файлов по маскам **/*.css, **/*.tsx, **/*.jsx или конфигураций tailwind.config.js и tailwind.config.ts.
Какие задачи решает
- настроить адаптивную вёрстку по принципу mobile-first
- заменить кастомные CSS-стили на утилитарные классы Tailwind
- внедрить семантические цвета и тёмную тему в компоненты
- сконфигурировать плагины и брейкпоинты в
tailwind.config.ts
Примеры запросов агенту
- Сверстай карточку профиля на Tailwind CSS с поддержкой тёмной темы.
- Вынеси повторяющиеся стили кнопок через директиву
@apply. - Настрой цветовую палитру и брейкпоинты в файле
tailwind.config.ts.
Как установить tailwind
Вручную: положить файлы
.cursor/rules/tailwind.mdcВо frontmatter: description, globs, alwaysApply
Вручную: положить файлы
.claude/rules/tailwind.mdПоле paths во frontmatter ограничивает файлы: globs из источника → paths
AGENTS.md
Codex читает AGENTS.md: вставьте текст правила туда
Вручную: положить файлы
.github/instructions/tailwind.instructions.mdПоле applyTo задаёт, к каким файлам применять: globs из источника → applyTo
Вручную: положить файлы
.devin/rules/tailwind.mdВручную: положить файлы
.clinerules/tailwind.mdПо шагам, с командами для каждой платформы: Cursor rules: файлы .mdc, четыре режима и замена .cursorrules
Вопросы о tailwind
Как установить tailwind в Cursor?
Создайте файл .cursor/rules/tailwind.mdc в корне проекта и скопируйте в него содержимое правила.
Для каких файлов активируется правило tailwind?
Правило срабатывает на файлы **/*.css, **/*.tsx, **/*.jsx, а также на конфигурации tailwind.config.js и tailwind.config.ts. Вне этих путей агент не подгружает инструкции, так как параметр alwaysApply отключён.
Какие библиотеки компонентов советует использовать это правило?
Инструкция рекомендует использовать готовые компоненты shadcn/ui, если они присутствуют в проекте.
Исходный текст
tailwind.mdc · CC0-1.0
--- description: "Tailwind CSS and UI component best practices for modern web applications" globs: **/*.css, **/*.tsx, **/*.jsx, tailwind.config.js, tailwind.config.ts alwaysApply: false --- # Tailwind CSS Best Practices ## Project Setup - Use proper Tailwind configuration - Configure theme extension properly - Set up proper purge configuration - Use proper plugin integration - Configure custom spacing and breakpoints - Set up proper color palette ## Component Styling - Use utility classes over custom CSS - Group related utilities with @apply when needed - Use proper responsive design utilities - Implement dark mode properly - Use proper state variants - Keep component styles consistent ## Layout - Use Flexbox and Grid utilities effectively - Implement proper spacing system - Use container queries when needed - Implement proper responsive breakpoints - Use proper padding and margin utilities - Implement proper alignment utilities ## Typography - Use proper font size utilities - Implement proper line height - Use proper font weight utilities - Configure custom fonts properly - Use proper text alignment - Implement proper text decoration ## Colors - Use semantic color naming - Implement proper color contrast - Use opacity utilities effectively - Configure custom colors properly - Use proper gradient utilities - Implement proper hover states ## Components - Use shadcn/ui components when available - Extend components properly - Keep component variants consistent - Implement proper animations - Use proper transition utilities - Keep accessibility in mind ## Responsive Design - Use mobile-first approach - Implement proper breakpoints - Use container queries effectively - Handle different screen sizes properly - Implement proper responsive typography - Use proper responsive spacing ## Performance - Use proper purge configuration - Minimize custom CSS - Use proper caching strategies - Implement proper code splitting - Optimize for production - Monitor bundle size ## Best Practices - Follow naming conventions - Keep styles organized - Use proper documentation - Implement proper testing - Follow accessibility guidelines - Use proper version control
© PatrickJS · CC0-1.0 · PatrickJS/awesome-cursorrules