How do I get the LLMs to do what I want?

I have a list of very specific rules, specification like instructions how my modular monolith needs to be build. File structure, convention etc, some implementation examples for certain classes etc.

Most of the the time, but not always, when using the planning mode, it gets the things right and creates a decent plan. If it does so, it almost always fails to create all the things it planned. For example today it missed to create the whole presentation layer, despite it having it planned…

It NEVER did test driven development, it almost never verifies its code is working in between steps, despite it is instructed to do so in the rules.

What am I doing wrong? For me AI works nice when I create single classes, but for bigger things it is just unreliable and I have to go after it like a very junior developer, so not a lot time saving here.

I don’t have either of these problems.

  • Are your rules unambiguous or can they be interpreted in different ways?
  • Is the model definitely reading all of your rules (if they’re not in User Rules), and not just some of them?
  • Which models you use?
  • How you prompt them?

You may try Agent Compass but it won’t help with project-specific rules.

Hey, thanks for the request. These details will help us figure it out:

  • Where are your rules stored, in .cursorrules or in .cursor/rules/RULE.md?
  • Which models are you using for the Agent?
  • How big are your rules files, about how many lines?
  • Can you share an example of a TDD rule that’s being ignored?

Based on the docs, here are a few tips to improve reliability:

  1. Rules size: Keep them under 500 lines. If it’s bigger, split it into a few separate rules.
  2. Be specific: Instead of “do TDD”, give a clear example with code:
    Before writing code:
    1. Create a test in test/[feature].test.ts
    2. Run npm test to check it
    3. Only then write the implementation
    
  3. Structure: Use .cursor/rules/ instead of .cursorrules for better control. You can set “Always Apply” vs “Apply Intelligently”.

Also check out Hooks to control the agent’s steps: Hooks | Cursor Docs

Share the info above and we can help more precisely.

If you’re using MCP servers - those are probably exploding your context - get rid of them all, or use a smarter MCP server which does context-compression, so the agent only learns how to use tools, when it needs to use the tools (e.g. mcp-link )

I got Claude to tell me how to make it obey the rules, and it converted everything to an html-like structured XML format - HTML/XML has infinitely richer methods than text/markdown for marking things with priorities and importance - it’s never let me down for a year since!

I use ONLY the “User Rules” - nothing else - but I do have a rule telling it to read the project readme.md at the start of every new session, which it always does, and those files prime it with whatever other rules/info it needs for the folder it’s in.

Mine start with this:-


@Agent: IMPORTANT: Read all these rules right now.

<html><head><title>Rules the Agent must always follow</title></head><body>
<h1>Rules the Agent must always follow</h1>
<!-- version 2025-08-08 12:00 -->

<dl>
  <dt id="dt_tags_are_the_rule_conditions"> When trying to understand these conditions and rules: </dt>
  <dd>
    <ol>
      <li> as you work, stay mindful of all the conditions defined in this context; conditions are the ones defined with &lt;dt&gt; tags. </li>
      <li> when a &lt;dt&gt; condition applies to what you are doing, follow all the rules inside the conditions' rule-set. </li>
      <li> the rule-sets are &lt;ol&gt; lists in the conditions' &lt;dd&gt; definition, and each rule is defined inside its own &lt;li&gt; tag </li>
      <li> we use HTML syntax for rules, to avoid ambiguity and uncertainty. be mindful of the hierarchical meaning of HTML tags </li>
      <li> in html, a &lt;dt&gt; defines a term (in our case, the condition), a &lt;dd&gt; defines what to do when that condition is matched, the &lt;ol&gt; helps you distinguish each new rules, and each &lt;li&gt; ... &lt;/li&gt; item defines each rule to apply when the condition is matched. </li>
      <li> the structure of this first rule does itself conform to our rule structure! </li>
    </ol>
  </dd>


  <dt id="rule_for_referencing_other_rules"> When following a rule that references another rule: </dt>
  <dd>
    <ol>
      <li> Reference rules using either their id prefixed with # or their exact <dt> text in quotes: e.g., `see #new_file_creation_rule` or `see: "When creating new files:"` </li>
    </ol>
  </dd>

(lots of critical proprietary stuff comes next :slight_smile:
it is 525 lines long.

Hey, thank you for all your answer. I’m running this version:

Version: 2.3.29 (user setup)
VSCode Version: 1.105.1
Commit: 4ca9b38c6c97d4243bf0c61e51426667cb964bd0
Date: 2026-01-08T00:34:49.798Z
Electron: 37.7.0
Chromium: 138.0.7204.251
Node.js: 22.20.0
V8: 13.8.258.32-electron.0
OS: Windows_NT x64 10.0.26100

The models I use the most a Grok for coding and Opus for planning.

This is my TDD rule (.cursor/rules/tdd.mdc). I’m aware that we can or should use now .cursor/rules/<name>/rule.mdc (Rules | Cursor Docs) but this simply does not work for me. Even when I create a new rule via the Cursor Settings UI, it will just create a new *.mdc file.

---
description: Test Driven Development
alwaysApply: true
globs:
---

# Test Driven Development

- When you write new code or make changes and fixing bugs, you MUST create the tests first
- Make sure your test reflect the requirements and are accurate
- When your implementation is done the tests SHOULD pass
- If they don't make them pass, your implementation is very likely wrong then
- When you fix bugs, you MUST create first a test that proves the problem and fails, then fix it.

When I go to the project rules, the Cursor editor takes some time to load them, I have 18 mdc file and none of them is huge. The longest one has 183 lines.

Why does it show Applies to subdirectory: cursor/rules?

Edit: When re-open the folder in WSL2 it still shows Applies to subdirectory: cursor/rules but at the same time it duplicates the entries in the list of rules and shows them on time with and one time without the message. This looks like a bug.

Thanks for the detailed info. Replying point by point:

  1. Duplicate rules in the UI with “Applies to subdirectory”

This is a known UI issue, the bug is already being worked on: [Bug] Settings: Project Rules show duplicate entries in v2.0

Good news, it’s only a visual issue. The rules are applied correctly. The duplicates don’t affect context.

  1. The agent ignores TDD rules

Sadly, this is a known instability with alwaysApply: true even in the .mdc format. Confirmed here: Rules not being applied as expected

Working workarounds:

  • Explicit mention: At the start of each chat, type @tdd.mdc to make sure the rule is included
  • User Rules: Copy the critical TDD instructions into Settings > Rules > User Rules (global, always applied)
  • Concrete examples: Instead of “you MUST create tests first”, give a step by step example:
    Before implementing:
    1. Create test file: tests/[feature].test.ts
    2. Run: npm test (should fail)
    3. Write implementation
    4. Run: npm test (should pass)
    
  • Structured format: Try Chris Drake’s approach from that topic, use HTML or XML style markup for a clearer rule hierarchy
  1. The agent doesn’t follow the full plan

Can you share an example plan where tasks were skipped? That’ll help spot the pattern. Also please include:

  • Request ID from the problematic chat (Chat menu > Copy Request ID)
  • Which models you used for planning and execution
  • Project size (number of files)
  1. Issue with the RULE.md format

You’re right, the docs recommend .cursor/rules/<name>/RULE.md, but in version 2.3.29 the UI creates .mdc files directly. That’s a legacy format that still works. The new structure was fixed in recent versions, so it might be worth updating to the latest.

Try the workarounds above and let me know if they help. I’m especially interested in the Request ID where the agent ignores the TDD rules.

1 Like

Thank you for the quick reply, I’m about to run out of credits on my private account, so I’ll get you the data you have asked for next week when I’m back at work. I’ll have to work on presentations and training material but I should have some time for AI, so I’ll try to get what you’ve asked for. Thanks again!

1 Like