react-components-creation-cursorrules-prompt-file — правило для Cursor
Организует создание компонентов React в Cursor: ищет дубликаты в репозитории, готовит ссылку для генерации через v0.dev и адаптирует импорты shadcn/ui под структуру проекта.
.cursor/rules/react-components-creation-cursorrules-prompt-file.mdcЧто делает react-components-creation-cursorrules-prompt-file
Правило задаёт пошаговый процесс работы с интерфейсными элементами на TypeScript и Tailwind CSS. Сначала Cursor инспектирует каталоги packages/ui/src/components и apps/spa/src/components, чтобы не создавать дубликаты уже написанного кода.
Если подходящего компонента нет, агент составляет детальное описание со всеми пропсами, типами и стилями. Затем он кодирует этот текст в URL и выводит кликабельную ссылку на v0.dev. После генерации код переносится в репозиторий: базовые компоненты shadcn/ui импортируются из @repo/ui/components/ui/, а внутренние части приложения — из @/components.
Шаблон рассчитан на структуру монорепозитория. Без ручной замены плейсхолдеров <ui_package_alias> и <app_package_alias> на реальные пути сборка упадёт из-за сломанных импортов.
Какие задачи решает
- найти готовый компонент в
packages/uiилиapps/spaперед написанием нового - составить подробное описание для генерации разметки в v0.dev
- привязать импорты shadcn/ui и локальных компонентов к единым путям проекта
Примеры запросов агенту
- Создай компонент календаря с выбором диапазона дат для
apps/spa - Сделай карточку профиля пользователя на Tailwind CSS и TypeScript, проверь существующие компоненты
Как установить react-components-creation-cursorrules-prompt-file
Вручную: положить файлы
.cursor/rules/react-components-creation-cursorrules-prompt-file.mdcВо frontmatter: description, globs, alwaysApply
Вручную: положить файлы
.claude/rules/react-components-creation-cursorrules-prompt-file.mdПоле paths во frontmatter ограничивает файлы: globs из источника → paths
AGENTS.md
Codex читает AGENTS.md: вставьте текст правила туда
Вручную: положить файлы
.github/instructions/react-components-creation-cursorrules-prompt-file.instructions.mdПоле applyTo задаёт, к каким файлам применять: globs из источника → applyTo
Вручную: положить файлы
.devin/rules/react-components-creation-cursorrules-prompt-file.mdВручную: положить файлы
.clinerules/react-components-creation-cursorrules-prompt-file.mdПо шагам, с командами для каждой платформы: Cursor rules: файлы .mdc, четыре режима и замена .cursorrules
Вопросы о react-components-creation-cursorrules-prompt-file
Как установить react-components-creation-cursorrules-prompt-file в Cursor?
Создайте файл правила по пути .cursor/rules/react-components-creation-cursorrules-prompt-file.mdc.
Зачем правило создаёт ссылку на v0.dev?
Оно упаковывает промпт с пропсами и Tailwind-стилями в URL-адрес, чтобы вы могли сгенерировать прототип в интерфейсе v0.dev в один клик.
Какие папки проверяются перед генерацией компонента?
Cursor проверяет наличие похожих компонентов в packages/ui/src/components и apps/spa/src/components.
Исходный текст
react-components-creation-cursorrules-prompt-file.mdc · CC0-1.0
---
description: "Cursor rules for React component creation and development."
globs: **/*
alwaysApply: false
---
# Cursor Rules
## Whenever you need a React component
1. Carefully consider the component's purpose, functionality, and design
2. Think slowly, step by step, and outline your reasoning
3. Check if a similar component already exists in any of the following locations
1. packages/ui/src/components
2. apps/spa/src/components
4. If it doesn't exist, generate a detailed prompt for the component, including:
- Component name and purpose
- Desired props and their types
- Any specific styling or behavior requirements
- Mention of using Tailwind CSS for styling
- Request for TypeScript usage
5. URL encode the prompt.
6. Create a clickable link in this format:
[ComponentName](https://v0.dev/chat?q={encoded_prompt})
7. After generating, adapt the component to fit our project structure:
- Import
- common shadcn/ui components from <ui_package_alias>@repo/ui/components/ui/</ui_package_alias>
- app specific components from <app_package_alias>@/components</app_package_alias>
- Ensure it follows our existing component patterns
- Add any necessary custom logic or state management
Example prompt template:
"Create a React component named {ComponentName} using TypeScript and Tailwind CSS. It should {description of functionality}. Props should include {list of props with types}. The component should {any specific styling or behavior notes}. Please provide the full component code."
Remember to replace placeholders like <ui_package_path> and <app_package_alias> with the actual values used in your project.
© PatrickJS · CC0-1.0 · PatrickJS/awesome-cursorrules