๐Ÿ“Š We use cookies & analytics to improve your experience. Learn more
Latest

Cursor Mastery โ€” The AI-First Code Editor Module 3 ยท Lesson 9 of 15

0% Exit to course

Module 3 ยท Files, tools and your own data Lesson 9 of 15

Project-wide edits with a reviewable diff โ€” Cursor's own feature

Learning objective

The agent can change several files in one instruction and show you the result as a diff before it is applied. That combination โ€” reach and review โ€” is the feature. Take away either half and it is either useless or dangerous.

The concept

Because the jobs that take the longest are the boring mechanical ones โ€” a rename, a new field, a moved function โ€” and they are exactly the jobs an assistant with project-wide reach does best. The review step is what keeps it safe, and it is not optional.

Write the request as a specification: what changes, what the constraints are, what must not change. Then read the diff, file by file, before accepting anything. Run the tests. Commit with a message that says why. If the diff is larger than you expected, stop and undo.

Here is the shape of it, in the form you will actually use:

Plain text
// Before asking the agent for anything, write the specification.
//
// CHANGE:     rename "phone" to "phoneNumber" everywhere it is a field.
// CONSTRAINTS: 
//   - do not rename the database column (a migration is out of scope)
//   - keep the API response key as "phone" so existing clients still work
//   - update every test that references it
// REVIEW:     list every file changed, and flag any place where the rename
//             was ambiguous โ€” for example a local variable called phone
//             that is NOT the field.

// The last line is the important one. Ambiguity is where an agent silently
// makes a decision you did not ask for and cannot easily find afterwards.

Common mistakes

The mistake is accepting a fifty-file diff because the tests passed. Tests cover what they cover; an unintended rename in a file nobody tests will surface in production, not in your build.

Worked example

One instruction adds a field end to end: the schema, the form, the validation, the response and the test. You then read the diff rather than hunting for the places you forgot.

Your practice task

Do one real cross-cutting change through the agent: rename a field that appears in five files, review the diff, run the tests, and commit. Then count how many places you would have missed by hand.

Do this before moving on. Reading a solution teaches the shape of it; typing it teaches you.

Key takeaway

Because the jobs that take the longest are the boring mechanical ones โ€” a rename, a new field, a moved function โ€” and they are exactly the jobs an assistant with project-wide reach does best.

Create free account or sign in

Almost there

15 lessons left of 15

Finish every lesson to unlock the certificate. Each one ends in a practice task โ€” do them and the final project brief writes itself.