About PRD and rules

Hey all,

I have a few questions about Cursor rules and the PRD.

First, where should the PRD file be added? I’m working on a professional codebase and I don’t want to place it in a shared folder accessible to everyone. Is it okay to put it in .cursor/rules?

Next, about the rules — I’ve added several .mdc files in .cursor/rules. I’ve filled out the description, globs, and alwaysApply fields properly, but some rules still don’t seem to be applied consistently. I often have to remind Cursor about them with almost every new prompt. In some videos, I saw that when a file is mentioned in a prompt, the corresponding rule is automatically applied. But that’s not happening for me — is there something I’m missing?

Lastly, can or should the PRD be referenced in Cursor rules?

Thanks in advance for your help!

Hi Philippe,

This is a great and relevant question. I’m Eng. Mansour Bin Khalid from Saudi Arabia :saudi_arabia:, a Cursor Pro user, and would like to offer a structured response

Problem Breakdown:

  1. Where to store the PRD?
    I recommend placing PRD.md in a secured internal folder such as:
    .cursor/prd/ or .cursor/definitions/
    Avoid putting it in docs/ if you’re concerned about exposure.

  2. Why rules don’t apply automatically?
    Your .mdc rule files should contain:

{
  "description": "Input validation rule",
  "globs": ["src/components/forms/*.jsx"],
  "alwaysApply": true,
  "contextFiles": ["../prd/PRD.md"],
  "tags": ["validation", "security", "AI context"]
}

Suggestions for Future Enhancement:

  • Introduce Rule Context Engine that auto-applies rules based on path or file role.

  • Support PRD as an AI assistant source (contextFiles).

  • Enable rule templates to cover: auth flows, form security, multi-project routing, etc.

  • Allow plugin support to dynamically convert PRD.md into rules.

1 Like

Hi @Philippe-dev

A PRD can be added at any time but usually it starts with the project.

The most appropriate place for PRDs is docs/ folder and its subfolders.
e.g. as project_name_prd.md which you can just give as name to Agent and it will be processed.
There is no good reason to store anything other than Cursor configuration or rule files in .cursor folder.

PRDs are documentes related to a project so they do belong in docs/ folder or any other related folder. You can choose to either commit them to Git or not but thats not relevant to your œuestion.

Example prompt: (replace project name)

Check project name PRD for not yet implemented features and create FRD documents for each.

Its not clear which Rule you are having or how the rule is configured.
If you need a rule file (project rules?) for PRD, what should it do?
Make sure to give the rule a proper description eg. Managing or processing PRDs

There is no docu explaining any other MDC (rule files) headers than following headers and I wouldnt recommend adding custom ones that have no effect.

---
description: RPC Service boilerplate
globs: 
alwaysApply: false
---

Never mix in one rule file at same time the “description” , “globs” or “alwaysApply: true”. No other headers exist now.
WHy?

  • AlwaysApply true forces AI to always use the rule. (Note that in very long chats such rules may be eventually forgotten by Agent)
  • description: is used when no globs and always apply is false. The description is given to Agent to decide which should be added.
  • globs: basically file wildcard filters, if a file needed/used matches then the rule will apply to those files and will be added to context.

Not sure what mkt-edge is talking about but it sounds like an AI response with hallucinations specially the suggestions part.

See docu

1 Like

Thank you for the clarification and for your attention to detail regarding the current structure of the system.

Just to clarify, my previous comment came from actual hands-on experience as a Cursor Pro user. In my daily work, especially in projects that involve PRD and FRD documents, I often find the need to expand the way we think about rules and how they relate more deeply to the project’s context — particularly in architecturally complex systems.

I fully understand that some of the ideas I mentioned (like contextFiles) are not part of the official documentation at this time, and I did not present them as existing features. Rather, they were shared as forward-thinking suggestions meant to open discussion, not as assumptions about the current capabilities.

What I’m aiming for is a smarter environment where the agent can interact more consistently with both project rules and documents. While this may not be implemented today, it could be a valuable addition if Cursor ever moves toward expanding the rule system.

I completely respect the current design of the platform. Everything I shared was motivated by a genuine appreciation of Cursor and a sincere intention to contribute something useful over the long term.

Thank you again for engaging in the discussion.

@mkt-edge thank you for the detalied comments and I appreciate the time you have taken to explain your approach.

In first step on a users question about how to use Cursor its always best to provide clear information on the question they are having so they can continue using Cursor as it works now.

Feel free to start your own thread about possible improvements on the subject. Im sure that others can contribute as the community is quite active. There are also Feature Requests you could add if some changes would benefit usage of Cursor.

Thanks :slight_smile:

1 Like

Thanks for this!

Thanks for getting back to me. Here’s the structure of my .cursor/rules directory :

.cursor
  rules
    animations.mdc
    api.mdc
    frontend.mdc
    animations-examples.mdc
    api-examples.mdc
    frontend-examples.mdc

Examples are mentioned with @example.mdc in the rules to avoid big rules files.

Are the naming of my rules / examples OK?

Here’s how I write rules. Is it OK?

---
description: Complete frontend development guidelines for React 18, Next.js 14, TypeScript, Tailwind CSS, and RTK Query - Solar energy application patterns
globs: ["src/**/*.tsx", "src/**/*.ts", "src/**/**/*.tsx", "src/**/**/*.ts", "src/components/**/**/*.tsx", "src/components/ui/*.tsx", "src/app/**/**/*.tsx", "src/app/**/**/**/*.tsx", "src/hooks/*.ts", "src/services/**/*.ts", "src/utils/**/*.ts", "src/lib/**/*.ts", "**/*.d.ts"]
alwaysApply: true
---

# Frontend Development Rules

## React, Hooks, State Management & Next.js → @react-examples.mdc

### React Fundamentals

#### Always Destructure React Imports
**ALWAYS** destructure React imports instead of using `React.` prefix:
- ✅ do `import React, { useState, useEffect, ReactNode, FC } from 'react'`
- ❌ don't `import React from 'react'` then `React.useState()`

#### Component TypeScript Patterns
- **Inline props** for components with ≤ 4 props: `({ title, power, efficiency, isActive }: { title: string; power: number; efficiency: number; isActive: boolean })`
- **Named types** for components with > 4 props: Create `ComponentNameProps` type
- **Always use `type`** instead of `interface`

#### Early Returns Pattern
**ALWAYS** use early returns for loading, error, and edge cases:
- Handle loading states first
- Handle error states second
- Handle missing data third
- Main component logic only when all conditions are met

When I attach a component (.tsx) to a prompt, how can I ensure that the rule is attached to the prompt?

@Philippe-dev file naming is fine. Have a look at your rules, they should only have ONE of the following

  • alwaysApply: true
    OR
  • Description: text
    OR
  • Glob: wildcards

Not all 3, since alwaysApply overrides the other two. And description would clash with glob.
(pick one, and keep other empty or false)

Description: should focus on the most important part if you want description to be recognized by AI

Development guidelines for frontend solar energy application patterns with React 18…

If you want it by file then glob.

Thanks! Since there’s a dropdown for “Rule type” (always, auto-attached, agent requested and manual), is the frontmatter mandatory in the rules?

I didn’t get what you mean regarding the description. Is Complete frontend development guidelines for React 18, Next.js 14, TypeScript, Tailwind CSS, and RTK Query - Solar energy application patterns not a good one?

Is there a limit to how many lines of rules an AI can understand and follow? I’ve seen numbers like 30 or even 500 mentioned. If I break the rules into smaller files, is there a risk the AI might ignore some of them?

The MDC meta data is mandatory (not really frontmatter) and generated by “Rule type” dropdown, but if you select alwaysApply true then description and glob wont be shown. Same for the other options, only allows one setting to be active.

Description: Complete frontend development guidelines is not relevant to AI,

Frontend development patterns for solar …

Would be relevant if your prompt is “Develop frontend pattern for solar…”

Description can be detailed but should be relevant, “Complete” is not necessary for example.

Limit:

  • I use 1 line rule :slight_smile: (it wont ever be too long or mess with other things)
  • 30 lines is sure fine.
  • 500 is way too long.

You dont want to have too many rules, and not too many rule files (both may confuse AI)

Does it really need all that info? I think some parts can be simplified

Always destructure React imports instead of using React. prefix.

Why would AI need do and don’t?

  • Claude 3.5 Sonnet needed precise rules to follow as it wasnt that smart.
  • Claude 4 Sonnet doesnt need precise rules and will get confused about priorities with too many detalis that arent relevant.

Therefore when I use Claude 4 Sonnet 1 line rule works for me best.

Honestly some of the details should be handled the way a framework or language does it by default. Then you dont have to declare details

Also skip the MD structure, following buildup is unnecessary.
##
###
####

  • Follow best practices of React 18, Next.js 14,…
1 Like

Thanks a lot for your reply, it really helped clarify things for me.

I’m working on a codebase that follows certain conventions, like using types instead of interfaces, destructuring useEffect, useState, etc. directly from React instead of importing the whole React object (the AI has made that mistake a few times), using early returns, and so on. So I wanted to include all of that in a set of rules, since the AI can’t be expected to know these project-specific conventions. That’s why I created a frontend-rules file where I’ve listed all these guidelines.

These rules should be applied to every prompt. From your last message, I understood that my frontend-rules file is way too long, so I’m planning to split it into several smaller rule sets of about 30 lines each. Do you have any suggestions for how I should go about that?

How many rules are there approximately?
Too many may not work so well.

Suggestion

  • Try to write them more compact. (less words, more facts)
  • Add a reason why this is done e.g. for security reasons, or for performance…
  • Group them by topic or relationship, Only react rules, only next, if they are not mixed in the same code file)

Alternative: (works usually better)

  • Write a requirements document (basic MD, just # or max ##) with facts
  • Ask Agent to create a FRD (feature request document) based on those requirements and after checking relevant code, and to write an implementation plan and a progress checklist (into same docs folder).
  • Then ask Agent to implement that feature (naming it is enough)

Why this works?

  • Agent analyzes project code and takes up patterns/structures/guidelines into the plan.
  • Then agent follows the plan and the structure.

Combination of short rules and those docs is most effective.

2 Likes

Thanks a lot! So just to confirm, a PRD isn’t only necessary at the start of a project, but also when developing new features within an existing one?

Can this Docs folder (root of the project?) be hidden and called .Docs to avoid committing it?

@Philippe-dev AI is not that precise or strict. Anything that works is good. Kinda like with people too.

a) Simple project you may just write a few lines of requirements and tell Agent to implement it.
b) Complex project may need PRD, FRDs. You may call them with different names that you are familiar with, but since its project management best to use well known terms AI will understand so you dont have to explain.

  • Use .gitignore and add the folder there so it is not committed
  • Dont name the folder .docs as .files have a protection setting in Chat settings in Cursor. Call it tasks and add tasks/ to .gitignore. Or any word that matches the topic (todos, tasks, plan, features,…)
1 Like

Well, I’m gonna try all this and will give you a feedback soon. Thanks for your time!

2 Likes