Skip to main content
rule

react-components-creation-cursorrules-prompt-file — Cursor rule

Guides React component creation in Cursor by checking for duplicates, building v0.dev generation links, and standardising shadcn/ui imports.

Install into Cursor · Manually: put the files in place All methods and platforms ↓
.cursor/rules/react-components-creation-cursorrules-prompt-file.mdc
Open on GitHub

What react-components-creation-cursorrules-prompt-file does

This rule sets up a structured routine for creating TypeScript and Tailwind CSS UI components. Cursor inspects packages/ui/src/components and apps/spa/src/components first to avoid rebuilding components that already exist.

When a new component is needed, the assistant crafts a prompt outlining props, styling, and behavior. It URL-encodes this text into a clickable v0.dev link. Once generated, the code is adapted to project conventions, wiring shadcn/ui imports to @repo/ui/components/ui/ and local imports to @/components.

The workflow assumes a monorepo setup. Leaving placeholders like <ui_package_alias> and <app_package_alias> unedited breaks imports immediately.

What it helps with

  • detect existing UI components in monorepo packages before coding
  • compile detailed prompts and clickable links for v0.dev UI generation
  • align generated component imports with shadcn/ui and local project aliases

Example prompts for the agent

  • Create a date range picker component for our SPA app
  • Build an analytics summary card using TypeScript and Tailwind CSS

How to install react-components-creation-cursorrules-prompt-file

Manually: put the files in place

.cursor/rules/react-components-creation-cursorrules-prompt-file.mdc

Frontmatter: description, globs, alwaysApply

Step by step, with commands for each platform: Cursor rules: .mdc files, four modes and what replaced .cursorrules

Questions about react-components-creation-cursorrules-prompt-file

How to install react-components-creation-cursorrules-prompt-file in Cursor?

Save the rule file to .cursor/rules/react-components-creation-cursorrules-prompt-file.mdc.

Why does the rule generate a v0.dev URL?

It builds an encoded prompt link so you can draft UI on v0.dev before bringing the code back into your repository.

Which directories does this rule check for existing components?

It searches packages/ui/src/components and apps/spa/src/components before prompting for a new component.

Source text

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

Similar IDE rules

All IDE rules for Frontend and UI →

From the same set210

react-native-expo-cursorrules-prompt-file A Cursor rule that tells the agent how to write React Native code with Expo. Useful when you want new screens and components to follow one stack. ★ 41,024repo stars react-mobx-cursorrules-prompt-file Cursor rule for building React apps with MobX. It configures state stores, hook conventions, and strict MobX patterns for code generation. ★ 41,024repo stars react-graphql-apollo-client-cursorrules-prompt-file This rule guides React work with GraphQL and Apollo Client in Cursor. Use it when a project needs consistent patterns for operations, hooks, and error states. ★ 41,024repo stars react-formengine-ai-form-builder-cursorrules-prompt-file A Cursor rule that has the agent build React forms from a screenshot, PDF, HTML or text description and return a FormEngine JSON schema plus a runnable App.tsx. ★ 41,024repo stars react-chakra-ui-cursorrules-prompt-file A Cursor rule for React projects using Chakra UI, covering component style, theming, responsive layouts, accessibility, and project structure. ★ 41,024repo stars rails-cursorrules-prompt-file A Cursor rule file that tells the agent how to write Rails 8 code: generators, bin/dev, the Solid stack, Minitest and Hotwire. ★ 41,024repo stars r-cursorrules-prompt-file-best-practices Enforces R project structuring, tidyverse formatting standards, renv lockfiles, and package documentation guidelines in Cursor. ★ 41,024repo stars qwik-tailwind-cursorrules-prompt-file A Cursor rule that tells the agent how to write Qwik components with Tailwind CSS: lazy functions, signals, folder layout. Useful on a Qwik City project in TypeScript. ★ 41,024repo stars

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor