tailwind-react-firebase-cursorrules-prompt-file — правило для Cursor
Правило для Cursor задаёт, как писать мобильное веб-приложение на Tailwind, React и Firebase: сначала мобильная вёрстка, потом остальное.
.cursor/rules/tailwind-react-firebase-cursorrules-prompt-file.mdcЧто делает tailwind-react-firebase-cursorrules-prompt-file
Файл подключается как правило Cursor и описывает набор соглашений для проекта. Внутри — мобильная вёрстка в первую очередь, адаптивные префиксы Tailwind (sm:, md:, lg:, xl:), единая дизайн-система с токенами в tailwind.config.js. Отдельно прописаны доступность (контраст, семантическая разметка, навигация с клавиатуры) и размер интерактивных элементов не меньше 44x44 пикселей.
По производительности правило советует React.lazy() и Suspense для разбиения кода, виртуализацию длинных списков через react-window, оптимизацию изображений. Для Firebase — правила безопасности, офлайн-персистентность SDK и запросы с минимумом операций чтения и записи. Формы — через Formik или react-hook-form с валидацией и понятными сообщениями об ошибках.
Есть и неочевидный пункт: при создании файла не конфликтовать с существующими .tsx и .jsx. То есть правило подразумевает, что в проекте уже есть оба типа файлов, и это повод проверить структуру до подключения. В конце файла лежит готовый промпт для языковой модели — про фичу учёта приёма лекарств с отчётами о приверженности лечению. К вашему проекту он отношения не имеет, но показывает, как автор оформляет запросы к модели.
Какие задачи решает
- задать единые правила вёрстки для проекта на Tailwind и React
- проверить доступность интерфейса: контраст, клавиатура, семантика
- разбить бандл через
React.lazy()иSuspense - настроить безопасность и офлайн-режим в Firebase
- выбрать библиотеку для форм и валидации
Примеры запросов агенту
- Проверь мой компонент по правилам из
.cursor/rules/tailwind-react-firebase-cursorrules-prompt-file.mdc - Сделай разметку карточки товара мобильной в первую очередь, как описано в правиле
- Перепиши этот список на виртуализацию через
react-window
Как установить tailwind-react-firebase-cursorrules-prompt-file
Вручную: положить файлы
.cursor/rules/tailwind-react-firebase-cursorrules-prompt-file.mdcВо frontmatter: description, globs, alwaysApply
Вручную: положить файлы
.claude/rules/tailwind-react-firebase-cursorrules-prompt-file.mdПоле paths во frontmatter ограничивает файлы: globs из источника → paths
AGENTS.md
Codex читает AGENTS.md: вставьте текст правила туда
Вручную: положить файлы
.github/instructions/tailwind-react-firebase-cursorrules-prompt-file.instructions.mdПоле applyTo задаёт, к каким файлам применять: globs из источника → applyTo
Вручную: положить файлы
.devin/rules/tailwind-react-firebase-cursorrules-prompt-file.mdВручную: положить файлы
.clinerules/tailwind-react-firebase-cursorrules-prompt-file.mdПо шагам, с командами для каждой платформы: Cursor rules: файлы .mdc, четыре режима и замена .cursorrules
Вопросы о tailwind-react-firebase-cursorrules-prompt-file
Как установить tailwind-react-firebase-cursorrules-prompt-file в Cursor?
Создайте файл .cursor/rules/tailwind-react-firebase-cursorrules-prompt-file.mdc в корне проекта и вставьте в него содержимое правила. Cursor подхватит его автоматически.
Что делает это правило?
Описывает соглашения для мобильного веб-приложения на Tailwind, React и Firebase: адаптивная вёрстка, дизайн-токены, доступность, производительность, работа с формами и запросами к Firebase.
Нужно ли что-то настраивать заранее?
Правило рассчитано на проект, где уже есть и .tsx, и .jsx файлы, иначе пункт про конфликты между ними смысла не имеет. Также понадобится tailwind.config.js для кастомных токенов.
Исходный текст
tailwind-react-firebase-cursorrules-prompt-file.mdc · CC0-1.0
--- description: "Cursor rules for Tailwind development with React and Firebase integration." globs: **/* alwaysApply: false --- Here are some best practices and rules to follow for creating a high-quality, mobile-first web app with excellent UI/UX using Tailwind, React, and Firebase: Mobile-First Design: Always design and implement for mobile screens first, then scale up to larger screens. Use Tailwind's responsive prefixes (sm:, md:, lg:, xl:) to adjust layouts for different screen sizes. Consistent Design System: Create a design system with consistent colors, typography, spacing, and component styles. Utilize Tailwind's configuration file (tailwind.config.js) to define your custom design tokens. Performance Optimization: Use React.lazy() and Suspense for code-splitting and lazy-loading components. Implement virtualization for long lists using libraries like react-window. Optimize images and use next/image for automatic image optimization in Next.js. Responsive Typography: Use Tailwind's text utilities with responsive prefixes to adjust font sizes across different screens. Consider using a fluid typography system for seamless scaling. Accessibility: Ensure proper color contrast ratios using Tailwind's text-* and bg-* classes. Use semantic HTML elements and ARIA attributes where necessary. Implement keyboard navigation support. Touch-Friendly UI: Make interactive elements (buttons, links) at least 44x44 pixels for easy tapping. Implement touch gestures for common actions (swipe, pinch-to-zoom) where appropriate. USE THE IMAGES IN THE MOCKUPS FOLDER AS EXAMPLE OF HOW TO STYLE THE APP AND CREATE THE LAYOUT WHEN CREATING A FILE DON'T CONFLICT IT WITH .TSX AND .JSX FILES Firebase Best Practices: Implement proper security rules in Firebase. Use Firebase SDK's offline persistence for better performance and offline support. Optimize queries to minimize read/write operations. Error Handling and Feedback: Implement proper error boundaries in React. Provide clear feedback for user actions (loading states, success/error messages). Animation and Transitions: Use subtle animations to enhance UX (e.g., page transitions, micro-interactions). Utilize Tailwind's transition utilities or consider libraries like Framer Motion. Form Handling: Use libraries like Formik or react-hook-form for efficient form management. Implement proper form validation with clear error messages. Code Organization: Follow a consistent folder structure (e.g., components, hooks, pages, services). Use custom hooks to encapsulate and reuse logic. Native-like Features: Implement pull-to-refresh for content updates. Use smooth scrolling and momentum scrolling. Consider using libraries like react-spring for physics-based animations. Here’s a concise prompt for a language model to help you with the logic for creating AI-powered medication insights in your app: Prompt: Design a feature for a pill management app that tracks user interactions with medications (Take/Skip) and generates monthly adherence reports. The app should: User Interface: Display pills for "Morning," "Afternoon," and "Night" with buttons for "Take" and "Skip." Show a confirmation modal for user actions. Data Collection: Log user interactions (pill ID, action, timestamp, notes) in a database. Monthly Report: Aggregate data to calculate total pills scheduled vs. taken, adherence percentage, and trends (e.g., frequently skipped pills). AI Insights: Use basic statistical analysis to generate personalized suggestions based on user feedback (e.g., side effects, missed doses). Dashboard: Create a section for users to view their monthly reports, including adherence percentage, trends, and AI-generated suggestions. This prompt provides a clear and structured request for assistance in developing the feature, focusing on key components and functionality.
© PatrickJS · CC0-1.0 · PatrickJS/awesome-cursorrules