Cursor · Module 02 of 6

Coding

Generate code that fits your repo, debug with Debug mode and the built-in browser, and refactor in steps you can review.

3 lessons9 techniques

Code generation

Point Agent at an example to copy, build from a screenshot or mockup, and use tests as the target.

3 techniques →

Debugging

Give Agent the full error, let it read the browser's console and network activity, and use Debug mode for bugs you can't explain.

3 techniques →

Refactoring

Keep tests fixed while Agent works in small steps, try risky changes in a worktree, and split big changes into reviewable pull requests.

3 techniques →
Check yourself

How well do you code with Cursor?

Five coding situations covering tests, bugs, worktrees and big diffs. Pick what you'd do, and you'll see the reason right away. No sign-up.

Take the quiz
Coding with Cursor

Give the agent a way to check itself

All three lessons here share one idea from Cursor's own course: agents do their best work when they can tell whether they're right. Tests, a type checker, a linter and the built-in browser all give that signal. A request without one leaves you as the only check, however good the model is.

Pick the method by the job

For new code, point at one good example and list exactly what you need, or write the tests first. For bugs, give the exact error and trigger, and move to Debug mode if the cause isn't visible. For refactors, keep tests fixed and take one step at a time, using a worktree if the change might not work out.

Frequently asked
How is coding in Cursor different from using ChatGPT?

Agent works in your project. It searches your files, makes edits and runs your tests, so you review a diff rather than copying code between windows.

How do I get better generated code from Cursor?

Name the target file, @-mention one existing example to copy, list the exact behavior you need, and give a command that proves it works.

How do I debug with Cursor?

Paste the full error, say when it happens and what should happen instead. If that doesn't lead to a fix, switch to Debug mode, which adds logging and asks you to reproduce the bug so it can work from real data.

How should I refactor with Cursor?

Commit first, mention the code and its tests, tell Agent not to modify the tests, and ask for one structural step at a time. Run the tests after each step.