← All articles
Guide · 2026-11-16

Prompt Debugging Workflow: Version Control and Evaluation for Agent System Prompts

Published 2026-11-16 ·Mentions: Claude Code, Cursor
Prompt Debugging Workflow: Version Control and Evaluation for Agent System Prompts
Treat the system prompts you write for Claude Code and Cursor like code: check rule files into version control, run a fixed set of test tasks before and after each change, and trace failures by pattern, so every edit shows whether things got better or worse.

Conclusion: prompts are configuration, not inspiration

This guide is for people who already use Claude Code or Cursor every day and have started to feel that the agent is sometimes sharp and sometimes inexplicably off. The conclusion up front: treat system prompts as configuration files — write them into rule files in the repository, version them with Git, change one variable at a time, and run the same set of test tasks before deciding whether to keep a change.

The benefit is traceability: when results get worse you can roll back to the exact previous version, and when they improve you can say which rule caused it. Debugging without criteria and a test set is guesswork, no matter how many versions you try.

What you need

A code repository you already use, plus the rule files inside it: Claude Code uses CLAUDE.md in the project root or rule files under .claude/rules/, while Cursor uses .mdc rule files under .cursor/rules/. If neither exists yet, create a minimal version of each first.

Then prepare a fixed set of 5 to 10 test tasks covering what you ask the agent to do most often: fix a known bug, add an endpoint in the existing style, write tests for a function, or explain unfamiliar code. For each task, write down the input, the expected output, and the pass criteria, and store the set in the repository under docs/ or prompts-eval/. The test set itself belongs in version control too.

Steps: one iteration in four moves

Step 1: layer your rules. Put stable material in the main file — project structure, build and test commands, code style — and split locally scoped material into path rules: Claude Code's .claude/rules/ supports scoping by paths, and Cursor rule files scope by globs. Claude Code's documentation recommends keeping a single CLAUDE.md under 200 lines, and Cursor's recommends keeping a single rule under 500 lines. Split anything longer.

Step 2: run a baseline before changing anything. Run the test set with the current rules and record each result: pass, fail, or borderline. The baseline is the reference for every later comparison; without it you cannot tell whether a change is progress or a regression.

Step 3: change one variable at a time. Add one rule, rewrite one sentence, or adjust one constraint, then re-run the same test set. When each change maps to its own result, you know which sentence did the work. Change five things at once and even an improvement tells you nothing about what to keep.

Step 4: write it down, then commit. Record the change, which test items moved, and whether to keep or roll back, and commit the rule file together with that evaluation note. When the same correction comes up a second time, it belongs in the rule file instead of being repeated in chat.

Common problems, in troubleshooting order

If a rule has no effect, check the loading scope first: confirm the file is in the right place with the right name and format. Cursor project rules must be .mdc files — a plain .md file is ignored by the rules system. In Claude Code, run /context to see which memory files were loaded into the session and confirm your rules are actually in context.

If rules contradict each other, the symptom is the agent wavering between two approaches. Check in this order: whether the main rules and the path-scoped rules say opposite things, then whether personal and project rules conflict. Cursor applies rules in the order team rules, project rules, then user rules, with earlier sources taking precedence. Claude Code's documentation recommends reviewing instruction files regularly and removing outdated or contradictory entries, and running /doctor prompt-audit for a prompt audit when needed.

If results are unstable, do not touch the prompts yet. When the same prompt performs unevenly across tasks, the test task itself is usually unstable, or the model output simply varies. Run the same task three times and check whether the results agree before changing any rule. Changing a rule on the strength of one failure is the fastest way to break a good rule.

Things to watch

A rule file is a work brief for the agent, not a list of slogans. Write concrete, verifiable requirements — for example, "run npm test before committing" — instead of "test carefully". Vague rules are interpreted differently every time, which is the same as having no rule.

Pricing is described by model only: both Claude Code and Cursor offer free and paid subscription tiers, with exact tiers and prices as listed on their official sites; this guide does not cover them. The steps in this article were checked against the official pages on 2026-11-16. If platform rules change, the official pages apply.

Tools mentioned

Coding & Development · Paid — Anthropic agentic terminal coding tool capable of autonomous multi-file edits, testing, and Git workflows.
Coding & Development · Free tier + paid — AI-first code editor built on VS Code with fast multi-line Tab predictions and codebase-wide Agent.

Sources

  1. How Claude remembers your project
  2. Rules
  3. Prompt engineering overview

This article is compiled from the public sources above and does not reproduce the originals in full; see the official sources for details.

Sign in to Lumo

Sign in with a one-time code sent to your email — no password. Your saved tools will sync across your devices.

The code is only used to sign you in. We store just your email and saved list (privacy policy, in Chinese).

—

Signed in. Your saved tools sync across all your devices.

0saved
View saved tools

Send feedback

Found a mistake, missing something, or have a suggestion? Tell us.