Driver FixRecommendedSound, Wi-Fi or graphics acting up? Check drivers firstFind missing or outdated drivers fast.Check DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix Now×
Skip to content
World desk5 min

The React Developer’s Guide to Cursor Rules: Make AI Follow Your Coding Style

Set up focused Cursor Project Rules for a React codebase, with a practical .mdc example, activation choices, migration steps, and troubleshooting checks.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

For a React project, put reusable, project-specific guidance in .cursor/rules as one or more .mdc files. Make each rule concrete and scope React conventions to the files where they apply. Cursor now labels the root-level .cursorrules file as legacy and recommends Project Rules for new setups. Rules guide the model; they do not guarantee every generated change will follow your conventions.

Where Cursor rules go in a React project

Cursor Project Rules are version-controlled instructions for a codebase. Add them under .cursor/rules at the project root; each rule is an MDC file, which combines frontmatter metadata with the instruction text. Committing the files lets teammates share the same repository-specific guidance. See Cursor’s Rules documentation and Rules help page for the current product details.

Create the directory if it does not exist, then add a file such as react-components.mdc. The exact conventions below are an example, not a React standard mandated by Cursor. Adjust the glob and instructions to fit your project.

---
description: React component conventions
globs: "src/**/*.{tsx,jsx}"
alwaysApply: false
---

- Use the component and prop patterns already established in nearby files.
- Keep components focused; move reusable non-UI logic into the project’s existing hooks or utilities.
- Use semantic HTML and preserve keyboard accessibility.
- Follow the repository’s existing TypeScript, styling, and test conventions.
- Before adding a dependency or changing architecture, explain why it is needed.
- When editing a component, inspect a nearby example and follow its naming and export style.

Cursor’s documentation also uses MDC frontmatter in its rule examples and recommends concrete examples or references to project files. The sample’s glob only makes sense if your React files are under src and use JSX or TSX; change it to match your repository.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Sale
HUION Keydial Mini Bluetooth Programmable Keypad with Dial 18 Shortcut Keys
  • Bluetooth 5.0: Compared to the previous version, the Huion Keydial Mini keyboard is upgraded to support Bluetooth connection bringing you cable-free convenience. Never worry about annoying drop-offs or lag up to a 10m range.
  • Easy-to-use Dial Controller: Change Adobe Photoshop brush size and navigate timelines with a simple turn of the Dial. It can be set up to 3 different functions and easily switch between them.
  • 18 Programmable Keys: The 18 buttons on Keydial Mini all can be customized to any shortcut in the way you want, making even the most complicated shortcuts available in one tap. Custom shortcuts need to be set in the Huion driver
  • Anti-ghosting Performance: Featuring new anti-ghosting technology of up to 5 keys, the Keydial Mini keypad offers you more shortcut key customization and reliable multi-key input.
  • Setting Preview Function: Set up one button to "Setting Preview", then press it, and a popup will display the current function setting of each button and dial. And you can customize the names of each button whatever you want. No need to memorize shortcuts anymore.

Choose how each rule is activated

Project Rules can be configured to apply in different ways. Choose based on who needs the guidance and when it is relevant, rather than making every instruction global.

Rule type When it applies Useful for
Always Apply Included across the project’s work Short conventions that matter in nearly every task, such as a repository-wide instruction to follow existing patterns.
Auto Attached Attached when files match the rule’s pattern React component guidance limited to JSX or TSX files, or test guidance limited to test files.
Agent Requested Available for the agent to select when relevant Instructions that apply to a task or area only occasionally. Cursor’s help page says an intelligently applied rule needs a description.
Manually invoked Included when explicitly called Guidance you want to use only when you request it.

Cursor’s documentation describes the rule types and metadata fields including description, globs, and alwaysApply. Check the active-rules display in your installed version to confirm which guidance is in context: the reviewed Cursor pages differ in how precisely they describe coverage across product features such as Agent and inline editing.

Write conventions Cursor can act on

“Write clean React” does not tell an agent how to recognize your team’s style. Prefer observable instructions, grounded in the repository, that describe what to inspect or do. Cursor summarizes the principle this way: “Good rules are focused, actionable, and scoped.” See its Rules documentation.

  • Point to an established pattern: Ask Cursor to inspect a nearby component and follow its naming, props, and export style.
  • Describe a decision: Say where reusable non-UI logic belongs according to your project’s existing hooks or utilities, rather than asking for “clean architecture.”
  • Make quality requirements visible: Name practices such as semantic HTML and keyboard accessibility instead of relying on a broad request for “accessible” code.
  • Set a boundary: Ask for a reason before introducing a dependency or changing architecture.
  • Use examples when wording is not enough: Reference representative files or show a small before-and-after pattern that reflects how your team works.

Keep each instruction focused on one expectation. A rule should guide code generation, not attempt to replace code review or encode every possible project decision.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Scope and organize rules without overloading them

Use Always Apply for concise guidance that matters across the repository. Attach React-specific instructions to relevant component files so they do not burden unrelated work. If testing, styling, accessibility, and data fetching have distinct conventions, separate them into focused rules when that makes them easier to understand and maintain.

Cursor supports nested rules, although its help page says a flat directory is simpler to organize. Its documentation recommends keeping a rule under 500 lines as a target; this is organizational advice, not a published performance threshold. Avoid turning the rule directory into a collection of overlapping instructions: give each rule a clear purpose and check that its scope matches the files it describes.

Rank #2
PCsensor 6 Key Mini Keypad Wireless USB Mechanical Gaming Macro Keyboard Customized Programmable OSU Keypad with RGB Led for PC Gaming OSU Office Work HID
  • USB-Type-C: Fast network delivers pro-grade performance with flexibility and freedom from cords. More wider range of applications. This keyboard is programmable, it support Macro function. And it can be set as any hot key or short cut that meet your need.
  • 6 Key Mini Keyboard: The mini gaming keyboard is compatible with Windows, Linux, Mac OS, Android and iOS system. Please set up in Windows or Mac OS firstly, then you can freely use it in different device.
  • Programmable Macro Keyboard: Custom mini keypad is widely used in video games, office work, PPT, sheet music page turning, equipment image capture, factory machine control, piano keyboard test and other occasions.
  • Our 6 key mini keypad is built for durability: ABS construction and keys that can endure up to 50 million strokes. Mechanical switches make every word you type bouncy
  • Type C to USB Nylon Braided Cable: You can use it connect the keyboard to your computer. Also charge the keyboard by using this cable.

Project Rules are distinct from two other instruction options:

  • User Rules express preferences in your Cursor environment across projects; they are not a substitute for conventions the team should share in the repository.
  • AGENTS.md is described by Cursor as a plain-Markdown alternative for agent instructions. It differs from Cursor-specific MDC Project Rules in format and setup.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Migrate from the legacy .cursorrules file

Cursor identifies .cursorrules as legacy and recommends Project Rules for new setups. To carry existing guidance forward, create a rule in .cursor/rules, copy in the useful instructions, and choose an activation type that preserves how the old file was used.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  1. Create a new .mdc file under .cursor/rules.
  2. Copy the instructions from the root .cursorrules file and add the appropriate MDC frontmatter.
  3. If the old file was intended to apply everywhere, set the new rule to Always Apply. If its contents only concern React files or a specific task, choose a matching or selective activation type instead.
  4. Check that the new rule appears as active, then try it on a representative React edit. After verifying the replacement, remove the old root-level file.

Cursor’s migration guidance supports creating a Project Rule, copying the old instructions, choosing Always Apply to preserve always-on behavior, and removing the legacy file. Trying a representative edit is a practical check for your repository, not a guarantee of how another project will behave.

Troubleshoot a rule that seems ignored

Cursor’s Rules FAQ specifically advises checking the rule type and file pattern: “For Agent Requested, make sure a description is defined. For Auto Attached, ensure the file pattern matches the referenced files.” Use these checks when a React instruction does not appear to take effect.

  • Confirm the file and location: The rule should be a recognized .mdc file in the project’s .cursor/rules directory.
  • Check the frontmatter: Make sure the metadata is valid and the activation settings match your intent.
  • Verify file matching: Test whether the globs pattern actually matches the file you are editing, including its directory and extension.
  • Check selective activation: An Agent Requested rule needs a description, while a manually invoked rule must be explicitly requested.
  • Inspect active rules: Confirm in your installed Cursor version that the intended rule is included for the editing surface you are using.
  • Refine the failing instruction: When a specific behavior recurs, add a concrete instruction or a useful example instead of piling on broad slogans.

Cursor rules put persistent guidance into model context; they are not deterministic enforcement. Use your formatter, linter, type checker, and tests for constraints the repository must enforce. A rule can tell the agent to follow existing TypeScript or test conventions, but the appropriate project tools are what check those requirements.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.