Setting Up Cursor with Claude: Complete Developer Guide

Cursor is an editor based on VS Code that integrates AI models directly into the development workflow. Claude, Anthropic’s model, is one of the providers that Cursor offers natively — and for many people, the one that performs best when writing and refactoring code.

This guide covers how to set it up, what changed in recent months, and the question that almost everyone asks before deciding.

Cursor or Claude Code? Which one should I choose?

It’s the most common doubt, and the short answer is that they don’t compete as much as it seems.

Cursor is an editor. You have the code in view, autocomplete as you type, and an agent that works on the open files. Visual context is the strong point: you see exactly what’s changing, line by line.

Claude Code is a terminal agent. It doesn’t have its own editor — it runs in your shell, on the entire repository. It’s stronger at long, autonomous tasks: migrations, refactors that touch twenty files, work you don’t want to supervise step by step.

In practice, many developers use both: Cursor for day-to-day work where you want to see the diff, Claude Code for big tasks that you launch and review at the end. You don’t have to choose.

If you already have a Claude subscription, you can also use Claude Code within Cursor’s integrated terminal. It’s the combination that most people end up adopting.

What Claude models are available in Cursor?

Cursor incorporates Anthropic’s models as they’re released. As of today, the catalog includes:

  • Claude Opus 5 — the most capable, for architecture and difficult problems
  • Claude Sonnet 5 — the balance between capability and speed; the default option for most work
  • Claude Fable 5
  • Claude 4.5 Haiku — the fastest and most economical, for mechanical tasks

Note: several of these models are hidden by default in the selector. If you don’t see the one you’re looking for, enable it in the model settings before assuming it’s not available.

If you’re coming from old guides: model identifiers like claude-3-sonnet-20240229 no longer exist. Models with dates in their names are retired, and a configuration that references them returns a 404 error. Always use Cursor’s selector instead of typing the ID by hand.

Do I need an Anthropic API key?

No. And this is where most outdated guides confuse people.

With a Cursor subscription, Claude models come included. You choose the model in the selector and you’re done — no API key, no extra configuration, no separate billing with Anthropic.

Your own API key is an option, not a requirement. It’s useful if you already have credits at Anthropic that you want to use, or if your organization requires billing consumption through its own account.

How to set up your own Anthropic API key?

  1. Create the key at console.anthropic.comAPI Keys section
  2. In Cursor, open Cursor Settings → Models
  3. Search for Anthropic, paste the key, and click Save

Important: the key is shown only once when created. Save it in a password manager, never in a repository file.

Three limitations worth knowing about beforehand

Using your own key has consequences that aren’t obvious:

  1. Cursor’s Zero Data Retention policy no longer applies. Your data is now governed by Anthropic’s privacy policy. If you chose Cursor for its data handling, this changes it.
  2. Autocomplete (Tab) still uses Cursor’s own models. The custom key only affects chat and the agent. Tab isn’t configurable.
  3. The key travels in every request through Cursor’s servers over encrypted connections, though it’s not stored permanently there.

How do you use Claude within Cursor?

The interface changed quite a bit compared to 2024 versions. Current shortcuts:

Shortcut What it does
Tab Accepts the autocomplete suggestion
Cmd/Ctrl + I Opens the Agent in the sidebar
Cmd/Ctrl + E Shows or hides the agent layout
Cmd/Ctrl + K Inline editing — select code and describe the change
Cmd/Ctrl + . Menu of modes (Agent, Plan, etc.)
Cmd/Ctrl + Shift + L Adds the selected code to context
Cmd/Ctrl + N New chat

All shortcuts are customizable from the keyboard settings.

Plan mode

It’s worth knowing because it’s the most useful thing added recently. Instead of writing code immediately, Plan mode asks questions, explores the repository, and generates an implementation plan that you can review and edit before a single line is written.

It’s useful for complex features, changes that touch multiple files, ambiguous requirements, and architectural decisions where you want to evaluate the strategy first. For quick changes, the regular Agent mode is enough.

The “Composer mode” that old guides mention was absorbed into the Agent. If you’re looking for Composer and can’t find it, it’s not broken — it was renamed.

How do you give Claude permanent instructions?

Repeating “use strict TypeScript” in every conversation is a waste of time. Cursor has two mechanisms for instructions to persist.

Project rules (.cursor/rules)

They are .mdc files with YAML frontmatter inside .cursor/rules/:

---
description: React component conventions
globs: ["src/components/**/*.tsx"]
alwaysApply: false
---

Use function components with hooks, never classes.
Props are typed with interfaces, not with `type`.
Each exported component has its test next to it.

The globs field limits the rule to files that match. With alwaysApply: true, the rule applies to the entire project.

The most common error: the extension has to be .mdc. A .md file inside .cursor/rules/ is silently ignored — no warning, no error. It’s the number one cause of “I configured the rules and nothing happens”.

.cursor/rules/
  react-patterns.mdc       # ✅ recognized
  api-guidelines.md        # ❌ ignored — wrong extension
  frontend/
    components.mdc         # ✅ can be organized into folders

AGENTS.md

If you don’t need conditional rules, an AGENTS.md in the project root is enough: plain markdown, no metadata or configuration. Cursor reads it the same way.

If you also use Claude Code, Cursor’s CLI also detects CLAUDE.md files in the root, so both tools can share the same context.

The .cursorrules file from old versions is obsolete. If you still have one, migrate it to .cursor/rules/.

How do you control what the model sees?

Two files, for different purposes:

  • .cursorignore — excludes files completely. The Agent, Tab, inline editing, and @ mentions can’t access them. This is where secrets, .env, credentials go.
  • .cursorindexingignore — excludes only from the search index. Files are still accessible to the AI, but don’t appear in repository searches. This is where generated files, vendored dependencies, builds go.

Both use .gitignore syntax. Cursor already ignores by default what’s in your .gitignore.

A surprising limitation: negation patterns (!) can’t re-include files within a folder you excluded with *. You have to explicitly exclude subfolders first and then de-ignore the specific file.

How do you write better prompts?

The difference between a useful result and a useless one is almost always in the prompt.

Be specific about the result, not the symptom:

✅ "Convert this function to async/await and add error handling
   with try/catch, propagating the original error"

❌ "Fix this"

Anchor the request in code that already exists:

✅ "Based on the pattern in `utils/validate.js`, create an
   equivalent function in `helpers/format.js`"

Mentioning specific files and using function and variable names that are already in the project gives the model much more than any abstract description.

Ask for the plan before the code when the change is large. It’s literally what Plan mode exists for.

Troubleshooting

The model I want doesn’t appear in the selector. It’s hidden by default. Enable it in model settings.

API key error. Check that you have available credits in your Anthropic account — a valid key with no balance fails the same way. If it persists, regenerate the key.

I set up rules and nothing changes. Check the extension: it has to be .mdc, not .md.

The agent doesn’t see a file. Check if it’s covered by .cursorignore — or by your .gitignore, which Cursor respects by default.

Slow responses. Try Haiku for mechanical tasks and save Opus for the hard stuff. A smaller context helps too.

Conclusion

The combination of Cursor and Claude changed quite a bit over the last year: models with dates in their names disappeared, .cursorrules became obsolete, Composer was absorbed into the Agent, and your own API key went from requirement to option.

What didn’t change is what matters: AI powers your judgment, it doesn’t replace it. Review and understand the generated code before sending it to production.


Do you use Cursor, Claude Code, or both? What rules do you have in your .cursor/rules? Tell us in the comments :backhand_index_pointing_down: