When Cursor agents will provide CORRECT code patching procedure

Where does the bug appear (feature/product)?

Cursor IDE

Describe the Bug

The agents cannot interpret any code patching request. Instead of using diff -Nur or similar operation, they are trying to write down the patch manually, which in 90% of the cases BREAKS the patched code! If a programming agent cannot create properly patches, then why do we need this tool? AND THAT IS REGARDLESS OF THE MODEL SELECTED!

Steps to Reproduce

Provide the agent with instructions to create a patch. Simple C++ with “Hello World” will do. Save the previous file in a folder “a”. Then copy the file from a to a new folder, “b”. Modify the C++ code in “b” and ask the agent to create patch. It never uses diff. It always writes the patch manually. For larger code files, it totally breaks the format. The only workaround it to provide the agent with a Markdown document about how to create patches. Every time! And at the corresponding token cost!

Expected Behavior

The agent should be able to use the standard practice in creating patches using diff. For instance:

diff -Nur file.orig file.new > file.patch

Operating System

Linux

Version Information

Version: 2.4.28
VSCode Version: 1.105.1
Commit: f3f5cec40024283013878b50c4f9be4002e0b580
Date: 2026-02-03T00:56:18.293Z
Build Type: Stable
Release Track: Default
Electron: 39.2.7
Chromium: 142.0.7444.235
Node.js: 22.21.1
V8: 14.2.231.21-electron.0
OS: Linux x64 5.14.0-611.20.1.el9_7.x86_64

For AI issues: which model did you use?

The problem appears regarding the model adopted.

Does this stop you from using Cursor

Yes - Cursor is unusable

Hey @Sofiatech_Discoverer

Have you considered creating a Cursor Skill that teaches the agent to always use diff -Nur instead of writing patch content manually?

Something like

---
name: generate-patches
description: Generate patch/diff files using the diff command. Never write patch content manually. Use when the user asks to create a patch, generate a diff, produce a .patch file, compare files or directories, or deliver changes in patch format.
---

# Generate Patches

**Never write patch content manually.** Hand-written patches break on hunk headers, line counts, and context lines. Always use `diff` via the shell.

## Decision Tree

1. **Is it a single file or a directory?**
   - Single file --> file-to-file diff
   - Directory --> directory-to-directory diff (`diff -Nur a/ b/`)

2. **Does the modified file already exist, or do you need to create it?**
   - Already exists --> diff the two versions directly (Step A)
   - Need to create it --> copy original, edit the copy, then diff (Step B)

## Step A: Diff Existing Files

\```bash
diff -Nur file.orig file.new > file.patch
diff -Nur a/ b/ > changes.patch
\```

## Step B: Edit-Then-Diff Workflow

\```bash
cp file.cpp file.orig
# make edits to file.cpp
diff -Nur file.orig file.cpp > file.patch
\```

## Verify Before Delivering

\```bash
patch -p0 --dry-run < file.patch
\```

If dry-run fails, fix the source edit and regenerate. Never hand-edit the patch.

## Applying Patches

\```bash
patch -p0 < file.patch        # apply
patch -R -p0 < file.patch     # reverse
\```

If we begin by teaching the agent the basic skills required to support the programming process, then the Cursor is not the appropriate tool for the job. Furthermore, we are not referring to some uncommon extra here. Not at all. We are referring to a basic tool that has been in use for over 20 years for maintaining code changes. Patch creation is a fundamental aspect of programming. One cannot every time uses git commits and rely on git to produces patches. That terminates the entire process of rapid code development and debugging. Following your reasoning of “help yourself for $400 a month,” I should begin teaching the agent how to use LTO, BOLT, extract compiler flags, linker, and memory management. Why does the agent provide even more sophisticated things, but we have to teach it the fundamentals? The fact that nobody else raised that issue is something I find deeply sad. Moreover, patching is not that easy to learn by example you provided. Strip levels are another topic that the agent cannot handle well, even after teaching! Also, the agent constantly brings to the chat the conception of fixing manually patches, even after being taught. Note that if I use latest Anthropic models directly, they in most cases know how to deal with the patching. But even if I select only those models to be used by the agent, the agent (again) fails in applying proper patching.

Note that what you specified DOES NOT WORK! Cursor agent DOES NOT RESPECT skills in .cursor sub-folder. Both are in the project folder:

.cursor/skills/make-and-apply-patches/SKILL.md
.cursor/skills/documentation-style/SKILL.md

None of them is respected by the agent in most recent cursor version.

Are we going to get any support or not? If you provide some feature, and advise the others to use it, make it at least available. The quality of the product support is low. And the same applies to the agntic part. An agent that can end up making patch based on FOLDERS, not on files, is worthless. We consider Cursor as a product that cannot facilitate any professional code writing.

Hi @Sofiatech_Discoverer,

I’ve been working with skills today, and they work pretty well! If you have trouble getting one to work, I suggest sharing it in the Help category so the community can try them out and hopefully assist you.