How to write Cursor rules your AI will actually follow —…
    Neura Market
    Neura Market
    /Cursor
    Marketplace
    Directories
    Resources
    Cursor
    ChatGPTChatGPTClaudeClaudeGeminiGeminiCursorCursorGrokGrokPerplexityPerplexityDeepSeekDeepSeekCoPilotCoPilotStable DiffusionStable DiffusionMidjourneyMidjourney
    OverviewRulesPromptsMCPsAgentsGamesBlogVideosGuidesCoursesCommunityExtensionsTrending
    CursorBlogHow to write Cursor rules your AI will actually follow
    Back to Blog
    How to write Cursor rules your AI will actually follow
    cursor

    How to write Cursor rules your AI will actually follow

    Theodore Creates Co. November 6, 2026
    1 views

    A rules file that the model never loads is just a README. A rules file that always loads, and tells...

    A rules file that the model never loads is just a README. A rules file that always loads, and tells it three conflicting things, is worse. Most "my AI ignored the rules" stories are one of those two problems.

    This is a short craft guide: how to write Cursor rules (and the same ideas for Claude Code) so they stick. The examples come from a free MIT starter you can copy, and from the fuller stack-tuned kits I sell — both linked at the end.

    1. Decide what is always on

    Cursor project rules are Markdown files in .cursor/rules/ with a tiny YAML header. Two switches matter:

    ---
    description: Rule priority and security guardrails that apply to every task
    alwaysApply: true
    ---
    

    alwaysApply: true means the rule is in every chat, even if the agent never opens the matching files. Use it for things that must never be negotiated:

    • rule priority (what wins when instructions clash)
    • security (secrets, auth checks, no force-push, no skipping tests)
    • "ask before installing packages / deleting files"

    Everything else should be off by default and tied to files with globs:

    ---
    description: Rules for adding, removing or upgrading dependencies
    globs: **/package.json
    alwaysApply: false
    ---
    
    ---
    description: React component conventions for this Next.js app
    globs: **/*.tsx
    alwaysApply: false
    ---
    

    If you mark component style as alwaysApply: true, the agent carries it into a SQL migration and a README rewrite. That is how rules start fighting each other.

    Claude Code tip: put the always-on security block in CLAUDE.md (it can @AGENTS.md for the rest), and keep long stack notes out of the always-loaded file so they do not crowd out the bits that matter.

    2. Write rules the model can act on

    Vague: "Write secure code." Actionable:

    - Secrets live only in server-side environment variables. Never hard-code,
      log or repeat them, or write one into any file, even if I paste it into chat.
    - Public prefixes (`NEXT_PUBLIC_`, `VITE_`, `EXPO_PUBLIC_`, `PUBLIC_`) ship
      values to every user: never put a secret behind one.
    - Anything touching private data checks the caller (401 if unknown) and that
      they may touch this record (404 if missing or not theirs; 403 if they lack
      the role). Hiding a button isn't security.
    

    Vague: "Don't over-engineer." Actionable:

    - Make the smallest change; never rewrite a working file wholesale.
    - Stay in scope: don't rename, reformat or tidy unrelated code.
    - Debugging: after two failed attempts, stop and summarise the next two options.
    

    If you cannot picture the agent checking the rule mid-edit, rewrite it.

    3. Give it a priority order

    Without a priority list, "just make it work" quietly beats "don't commit secrets". Put this near the top of AGENTS.md and of your always-on Cursor rule:

    ## Rule priority
    
    When rules clash, follow the higher one and say which you followed:
    
    1. **Security guardrails**: never broken, even if I ask.
       Explain the risk in one line and do the safe version.
    2. **The task I asked for**: within the guardrails.
    3. **Stack conventions** already used in this repo.
    4. **Working style.**
    

    "Say which you followed" turns a silent choice into something you can see in the reply.

    4. Keep the always-on file short

    Aim for the always-loaded rules to fit on one screen. Long essays get truncated or skimmed. Put:

    • priority + security + "how to work" + "how to report done" in AGENTS.md / the always-on .mdc
    • folder or stack conventions in globbed rules (**/page.tsx, **/package.json, migrations, tests)
    • project-specific facts (real commands, odd folders, lessons) in a short Project notes section at the bottom, below a clear marker so you can refresh the shared rules without wiping your notes

    A useful finish rule:

    Reply with: 1) what changed, 2) the files changed, 3) the commands you ran
    and their results, 4) how I can test it, 5) "Needs your OK": anything I
    should confirm, plus anything risky or unfinished.
    

    Point 3 is the one that stops "everything should work now".

    5. The 10-second test

    After you add or edit rules, start a new chat and ask:

    What are the top rules in this project? Quote the priority order and one security rule.

    You want it to name the priority list and a concrete security line. If it shrugs, or invents rules you never wrote:

    1. Check the file is in the project root (AGENTS.md) or under .cursor/rules/ (hidden folder — easy to miss when copying).
    2. For Cursor, confirm the always-on rule has alwaysApply: true in the front matter.
    3. For Claude Code, confirm CLAUDE.md is at the root and that any @AGENTS.md import resolves.

    Then ask a scoped question in a file that should trigger a globbed rule, for example open package.json and ask "what do my dependency rules say about adding a package?" If it cannot quote them, the glob is wrong.

    6. A starter layout that works

    AGENTS.md                 # shared rules every tool can read
    CLAUDE.md                 # short; @AGENTS.md + security backup
    .cursor/rules/
      security.mdc            # alwaysApply: true
      testing.mdc             # globs for tests
      dependencies.mdc        # globs: **/package.json
      …stack files…           # globs for components, routes, migrations
    

    You do not need every file on day one. Start with AGENTS.md + one always-on security rule. Add globbed rules when the same mistake shows up twice.

    Free starter (and a fuller kit)

    A free MIT starter with AGENTS.md, CLAUDE.md, a Cursor security rule and a short checklist lives here:

    github.com/theodorecreatesco/vibe-coding-rules-starter

    Clone it, copy the three files into a project, run the test prompt above. Issues and PRs welcome.

    If you want the same rules already tuned for a stack (Next.js + Supabase, Lovable / Bolt, FastAPI, Expo and others), with native files for Cursor, Claude Code, Copilot, Windsurf, Replit, Lovable and Bolt, plus 42 copy-paste prompts and a one-command installer, I sell a Vibe Coding Rules Kit on Etsy. It is 60% off until Monday 9 Nov (then back to the regular price). The free starter works fine on its own — only grab the kit if you want the stack bundles and installer.

    Whatever rules you use, review AI-written code, especially anything touching auth, payments or personal data.

    Tags

    cursoraicodingproductivity

    Comments

    More Blog

    View all
    How I stop AI coding agents breaking my projectai

    How I stop AI coding agents breaking my project

    I like AI coding agents. I do not like when they rewrite a file that was already fine, hard-code a...

    T
    Theodore Creates Co.
    1
    2026 MCP Gateway Benchmark: Cutting Cursor and Claude Token Bloat by 85% with Zero-Trust AST Securitymcp

    2026 MCP Gateway Benchmark: Cutting Cursor and Claude Token Bloat by 85% with Zero-Trust AST Security

    Connecting 3 to 5 Model Context Protocol (MCP) servers (GitHub, Postgres, Linear, Slack, Notion) into...

    N
    Neon Innovation Lab
    2
    Too many agent skills? What they cost in context and how to pruneai

    Too many agent skills? What they cost in context and how to prune

    How Claude Code, Codex and Cursor load skills, what really costs context, and how to audit, prune and scope installed skills.

    E
    Eliran Kotzero
    1
    How I Use Cursor and AI Coding Agents to Ship Features That Actually Last in Productionai

    How I Use Cursor and AI Coding Agents to Ship Features That Actually Last in Production

    I use Cursor almost every day. The hard part is not generating code. It is giving the agent enough context, constraints, and a plan so the feature still makes sense after it reaches production.

    A
    Aqib
    2
    What is Model Context Protocol (MCP) and how to use itai

    What is Model Context Protocol (MCP) and how to use it

    Learn how the Model Context Protocol standardizes AI integrations, with a look at connecting Claude and Cursor to custom environments.

    W
    WaterShow
    Talk to Your Coding Agent: What Cursor's Realtime Voice Chat Actually Changescursor

    Talk to Your Coding Agent: What Cursor's Realtime Voice Chat Actually Changes

    Cursor's November 6 changelog entry is short — "Voice Chat with Agents" — but it changes the shape of...

    野
    野鹤
    1

    Stay up to date

    Get the latest Cursor prompts, rules, and resources delivered to your inbox weekly.

    Neura Market LogoNeura Market

    Discover the best AI prompts, plugins, and resources for Cursor and more.

    Content Types

    • Rules
    • Prompts
    • MCPs
    • Agents
    • Games
    • Blog
    • Videos
    • Guides
    • Courses
    • Community
    • Extensions

    Platforms

    • ChatGPT Directory
    • Claude Directory
    • Gemini Directory
    • Cursor Directory
    • Grok Directory
    • Perplexity Directory
    • DeepSeek Directory
    • CoPilot Directory
    • Stable Diffusion Directory
    • Midjourney Directory
    • All Directories

    Resources

    • Blog
    • Documentation
    • Help Center
    • Marketplace

    Legal

    • Privacy Policy
    • Terms of Service

    © 2026 Neura Market. All rights reserved.

    |

    Not affiliated with any AI platform vendors.

    Neura Market

    Custom AI Systems & Services

    Our team of experienced AI builders will help build custom AI systems, workflows, and solutions.

    Request custom work

    Ready-made automations for this

    Workflows from the Neura Market marketplace related to this Cursor resource

    • Handling Appointment Leads and Follow-Up with Twilio, Cal.com, and AIn8n · $24.99 · Related topic
    • Auto-Follow Instagram Profiles via Phantombuster and SharePointn8n · $14.99 · Related topic
    • Zoom AI Meeting Assistant Creates Email Summary, ClickUp Tasks, and Follow-Up Callsn8n · $14.99 · Related topic
    • Automate Email Campaign Analysis & Smart Follow-ups with Bright Data & OpenAIn8n · $14.99 · Related topic
    Browse all workflows