Nested skills vs nested agents.md files vs nested rules ( .mdc ) files

There is a use case where for certain set of files located under a folder ( monorepo structure) if read or edited , must follow some conventions that might or might not be applicable for that task explicitly but we still want cursor to take that into context so that those are followed. So that new code generated does not have issues.

Eg: a vague example could be if the user asks to render a button that is related to the save action , always render a confirmation modal flow as well , now the user won’t ask this every time but when he does for files / flows within that directory we don’t want to miss out on this.

Also this list could grow in future as well won’t be limited to 3 or 5 such conventions.

Wanted to understand that while cursor reads and edits files located within a folder , and if we use the nested skills approach as mentioned here : Agent Skills | Cursor Docs , then is it 100% sure that they will get picked up always.

So should we create n skills inside the directory for n number of things which we want to ensure are not missed if they are applicable.

or

Should we create nested agent.md files for these folders individually which can then refer to skills in detail for implementation only and only if the points mentioned in the agent.md file are relevant to the work being done by cursor as asked by the user.

Also wanted to know if there is some concept of nested rules specifically or not in cursor ( could not find any such article URL ).

@Colin could you please also share your thoughts once wrt this ?

Short version: skills are picked by the agent based on their description, so they aren’t a guarantee. For conventions that should kick in whenever files in a folder are touched, a glob-scoped project rule or a nested AGENTS.md is the better fit.

  1. Glob-scoped rule (the closest thing to “nested rules”): add an .mdc file to .cursor/rules with alwaysApply: false and globs: packages/checkout/**. Per the docs it’s auto-attached whenever a matching file is in context, no relevance call by the agent. You can also organize rules into subfolders inside .cursor/rules.
  2. Nested AGENTS.md: drop one in the folder and it’s applied automatically when working with files in that directory or its children. It’s combined with parent AGENTS.md files, and the more specific one wins.
  3. Nested skills: a .cursor/skills/ folder inside apps/web/ (or the paths field) only controls where a skill is surfaced. The agent still decides from the description whether to load it, so it’s better for longer implementation detail than for must-follow conventions.

For your case I’d keep the short must-follow list (e.g. “save buttons always get a confirmation modal”) in a glob rule or nested AGENTS.md, and have it point to a skill for the detailed how-to as the list grows. Nothing gets you a literal 100% since it’s still the model following instructions, so keep each rule short and specific.

Rule types, globs, and nested AGENTS.md: Rules | Cursor Docs
How skill scoping works: Agent Skills | Cursor Docs

Hey @Divansh_Mahajan! @jakehandy’s answer is spot on: go with nested AGENTS.md files (short “when X, always do Y” lines that point to a skill for the details) rather than one skill per convention, since skills aren’t guaranteed to load.

A few additions:

  • Nested rules exist too. A .cursor/rules/ folder inside any subfolder is scoped to that folder. Use alwaysApply: true or globs (matched relative to that folder) there, since description-only rules aren’t folder-scoped.
  • Add a pointer in your root AGENTS.md, e.g. “Before creating or editing anything under packages/checkout/, read packages/checkout/AGENTS.md.” Nested files load once the agent starts working in that folder, so this gets them in before its first change.
  • Added new nested files? Run Developer: Reload Window from the Command Palette so Cursor picks them up.
  • Nothing is 100%. Start a fresh chat per task (long, summarized chats are the weak spot), and back must-never-miss conventions with a lint rule or test.

+1 to nested AGENTS.md with short “when X, always do Y” lines. One thing to watch as that list grows: the conventions go stale before they go missing. Someone renames the modal component or moves the folder, and the AGENTS.md line still points at the old path, so the agent follows it confidently and gets it wrong.

What helped us: keep each line naming the exact file or component it depends on, and do a quick grep in CI that fails if a path mentioned in any AGENTS.md no longer exists. Cheap, and it catches most of the drift.

Thanks @mohitjain for the reply , will use the nested agent.md file approach then if code present inside one folder and if present at multiple locations then rule approach with glob patterns.

Also regarding the point that one must back must-never-miss conventions with a lint rule or test , this might not be possible always as not every developer in the team might be aware about these conventions while coding in the files for those modules and hence these can’t be done upfront for new files / flows added and lint rule and tests need to be deterministic and here turning conventions into deterministic tests is not possible.

Thanks @jakehandy for the reply , will use the nested Agent.md file approach then if code present inside one folder and if present at multiple locations then rule approach with glob patterns.

Also regarding the point that one must back must-never-miss conventions with a lint rule or test , this might not be possible always as not every developer in the team might be aware about these conventions while coding in the files for those modules and hence these can’t be done upfront for new files / flows added and lint rule and tests need to be deterministic and here turning conventions into deterministic tests is not possible.

I’d keep these as behavioral requirements in a shared model, linked to the relevant flows and code components. For your save example, define the expected behavior: opening the modal writes nothing, cancel leaves data unchanged, confirm saves.

Before editing, have the agent read the linked requirements. For new flows, identifying which requirements apply becomes part of the task. Then review the implementation against them in a separate pass. That gives you a concrete check even where a convention can’t be expressed as a lint rule.