Practical Linux, Windows Server and cloud guides for IT pros.

How to Use Claude Code and Cursor Together

A practical guide for using Claude Code and Cursor together, with copy-paste setup files, shared rules, custom commands, review prompts, and a safer git handoff workflow.

Filed under

,

Published

Written by

Last updated

Claude Code and Cursor work best together when they have different jobs. Use Cursor as the editor you live in. Use Claude Code as the terminal agent for repo-wide reading, planning, edits, tests, and review. The trick is to give both tools the same project rules, then keep a clean handoff between them.

This is the practical version of the workflow. It gives you the setup files, project rules, review commands, and daily command sequence I would use on a real repository.

TL;DR

  • Use Cursor for navigation, inline edits, chat, and visual review.
  • Use Claude Code for multi-file tasks, test runs, refactors, and terminal-based workflows.
  • Put shared instructions in CLAUDE.md and mirror the important parts into .cursor/rules/.
  • Create one Claude Code review command and one Cursor review command so both tools can check the same diff.
  • Only let one AI tool actively edit at a time, then use git to inspect the handoff.

Start here: if you already have Claude Code and Cursor installed, jump straight to the starter kit. If you are new to Claude Code, read Claude Code: Practical Guide first.

Quick Reference

TaskUseCommand or file
Install Claude CodeTerminalnpm install -g @anthropic-ai/claude-code
Check Claude CodeTerminalclaude doctor
Open repo in CursorTerminalcursor .
Shared Claude contextRepo fileCLAUDE.md
Shared Cursor contextRepo file.cursor/rules/project-conventions.mdc
Claude reusable promptRepo file.claude/commands/review-diff.md
Cursor reusable promptRepo file.cursor/commands/review-claude-diff.md
Handoff checkGitgit diff --check

The Simple Split: Who Does What?

  • Cursor: daily editor, file navigation, small edits, inline fixes, UI review, and reading the diff visually.
  • Claude Code: repo exploration, multi-file implementation, test execution, command-line debugging, refactoring, and structured review.
  • Git: the contract between them. If it is not visible in the diff, it did not happen.

This avoids the usual AI-tool mess where Cursor and Claude both rewrite the same area without a clear owner. Let one tool change the code, then let the other review it.

Prerequisites

Use these commands in Bash, Zsh, Git Bash, or WSL. Claude Code requires Node.js, and both tools become more predictable when your repository is already under git.

node --version
npm --version
git --version

Install and Check Claude Code

Anthropic’s standard install path is the npm package below. The official docs also recommend running claude doctor after installation to check the setup.

npm install -g @anthropic-ai/claude-code
claude doctor
claude

If claude doctor reports a permissions problem, fix the Node/npm global install path rather than using sudo npm install -g. That keeps your developer environment cleaner and avoids root-owned files in your npm directory.

Install the Cursor Shell Command

Cursor’s shell command is installed from inside Cursor, not npm. Open the Command Palette with Cmd/Ctrl + Shift + P, search for Install ‘cursor’ to shell, and run it. After that, these commands should work from your terminal:

cursor .
cursor --new-window .
cursor --wait README.md

If cursor . fails, reopen your terminal after installing the shell command, then try again.

Starter Kit: Shared Rules and Commands

Run this from the root of a project you want to use with both tools. It creates the folders used by Claude Code project commands and Cursor project rules/commands.

mkdir -p .claude/commands .cursor/rules .cursor/commands
touch CLAUDE.md
touch .cursor/rules/project-conventions.mdc

Create CLAUDE.md

Claude Code reads project memory from CLAUDE.md. Keep it short, concrete, and useful. This starter file is deliberately boring because boring rules get followed.

cat > CLAUDE.md <<'EOF'
# Project Instructions
 
## Working style
- Read the existing code before editing.
- Make a short plan before changing more than one file.
- Keep changes scoped to the requested task.
- Do not rewrite unrelated code.
- Prefer the project's existing patterns over new abstractions.
 
## Verification
- Run the smallest useful test first.
- If a change touches shared behaviour, run the broader test suite.
- Report any command that fails and include the relevant error.
 
## Git safety
- Show the diff before summarising work.
- Never discard local changes that you did not make.
EOF

Create a Cursor Project Rule

Cursor project rules live in .cursor/rules and use the .mdc format. This mirrors the important parts of CLAUDE.md so Cursor and Claude Code do not give different advice.

cat > .cursor/rules/project-conventions.mdc <<'EOF'
---
description: Project-wide engineering conventions
globs:
alwaysApply: true
---
 
- Follow the conventions in CLAUDE.md.
- Prefer small, reviewable edits.
- When changing behaviour, update or add tests.
- Explain risky migrations, schema changes, or deployment changes before editing.
- If Claude Code made the diff, review it as if it came from another developer.
EOF

Create a Claude Code Review Command

Claude Code project slash commands live in .claude/commands. This gives you a reusable /review-diff prompt inside Claude Code.

cat > .claude/commands/review-diff.md <<'EOF'
Review the current git diff as a senior engineer.
 
Focus on:
- Bugs and regressions
- Missing tests
- Security or data-loss risks
- Unnecessary complexity
 
Return findings first, ordered by severity, with file references.
EOF

Create a Cursor Review Command

Cursor custom commands live in .cursor/commands. This gives Cursor a matching review workflow for checking changes after Claude Code edits the repo.

cat > .cursor/commands/review-claude-diff.md <<'EOF'
Review the current git diff produced by Claude Code.
 
Check for:
- Unrelated edits
- Broken types or imports
- Missing tests
- Over-broad refactors
- UI or copy changes that do not match the request
 
Suggest the smallest safe fix for each issue.
EOF

Daily Workflow

Start with a branch, open the repository in Cursor, then start Claude Code from the same project root.

git checkout -b ai/short-task-name
cursor .
claude

In Claude Code, paste a task prompt with guardrails. This format keeps Claude from jumping straight into a broad edit before it has read the project.

Read CLAUDE.md, package.json, and the files relevant to this task.
 
Task:
<describe the change here>
 
Before editing:
1. Summarise the existing implementation.
2. Give me the smallest safe plan.
3. Tell me which tests you expect to run.
 
After editing:
1. Show the changed files.
2. Run the relevant checks.
3. Summarise any remaining risk.

Once Claude has made changes, stop and inspect. Do not immediately ask Cursor to keep editing the same area. First review the git diff.

git status --short
git diff --stat
git diff --check
npm test
npm run lint

Review the Handoff in Cursor

  • Open the Source Control view in Cursor.
  • Read the diff file by file.
  • Use your /review-claude-diff command in Cursor chat.
  • Ask Cursor for targeted fixes only after you understand the diff.
  • If Cursor changes anything, rerun the same tests before committing.

This is where Cursor is strongest: you can inspect the actual files, jump around the codebase, and make precise corrections without turning the whole task into another broad agent run.

Commit Only After the Checks Pass

Use patch staging so you can reject stray edits. This is one of the easiest ways to keep AI-assisted work from becoming noisy.

git add -p
git commit -m "Implement focused AI-assisted change"

When to Use Cursor Instead of Claude Code

  • A one-file edit where you already know the location.
  • Small UI copy or styling changes that benefit from seeing the file in context.
  • Inline fixes while reading code.
  • Explaining a local function, component, or error inside the editor.

When to Use Claude Code Instead of Cursor

  • A change spans several files and you need the repo mapped first.
  • You want the agent to run commands, tests, and searches repeatedly.
  • You need a structured review of a diff.
  • You want a reusable terminal workflow with project slash commands.

Rules That Keep the Workflow Clean

  • One AI editor at a time: Claude edits, Cursor reviews, or Cursor edits, Claude reviews.
  • Never skip git status before and after an agent run.
  • Keep CLAUDE.md and Cursor rules short enough that a developer would actually read them.
  • Prefer explicit test commands over vague instructions like “make sure it works”.
  • Do not ask either tool to commit code until you have inspected the diff yourself.

Related Reading

For a broader Claude Code introduction, read Claude Code: Practical Guide. If you are setting up a fresh Windows workstation for this workflow, start with Windows 11 Developer Setup.

Authoritative Sources

Leave a Reply

Your email address will not be published. Required fields are marked *

Find more on the site

Keep reading by topic.

If this post was useful, the fastest way to keep going is to pick the topic you work in most often.

Want another useful post?

Browse the latest posts, or support TurboGeek if the site saves you time regularly.

Translate »