How to Master Cursor AI: Setup, Rules and Code Review

To learn the Cursor AI code editor, start with a small change you can explain and verify: open a trusted project, ask Agent to map the relevant code, make a bounded edit, then inspect the diff and run the project’s checks. That follows Cursor’s quickstart workflow. This tutorial develops that sequence with current shortcuts, scoped project rules and an HTTP helper whose failure cases you can check yourself.

Google · Preferred Sources

Don't miss new tech stories on Google

Add Tech Insider once in the Google app and our stories appear in your news suggestions.

Add Now

Install Cursor and choose a small working folder

Download the appropriate build using the official Cursor installation instructions, open the application and sign in. Select a project you own or have permission to work on. For Java and Kotlin projects, the JetBrains language extension guide covers language-tooling setup and licensing. For the first session, use a separate working branch or disposable copy and record any existing changes before asking Agent to edit.

PlatformPublished support and installerInstallation route
macOSmacOS 12 Monterey or later; Apple Silicon and IntelNative .dmg installer
WindowsWindows 10 or laterNative .exe installer
LinuxDebian/Ubuntu and RHEL/Fedora package instructions; portable AppImagePrefer apt or yum packages for updates, desktop icons and CLI tools

For the portable Linux route, download the AppImage from Cursor’s site. In a directory containing only that downloaded Cursor AppImage, the documented launch commands are:

chmod +x Cursor-*.AppImage
./Cursor-*.AppImage

Before working on sensitive code, review Cursor’s Agent security controls. Agent can edit ordinary workspace files without approval, and those changes save immediately to disk; configuration changes have additional approval handling. Keep terminal and external-tool permissions deliberate, and remember that a diff view can be showing changes already written.

Cursor supports workspace trust but leaves it disabled by default. Its security documentation recommends a basic text editor for untrusted repositories because restricted mode disables AI features. To enable the workspace-trust prompt, add this property to your existing user settings object:

"security.workspace.trust.enabled": true

Choose the model with its usage pool in view

The current Cursor plans and model prices distinguish the X Subscription’s weekly usage from legacy Cursor plans. Start by identifying which plan your account actually has. A larger included pool for Cursor models is a different purchase from credit for third-party models.

Individual planMonthly price before taxIncluded usage relative to PlusThird-party models
Free$0LimitedUnavailable
Plus$8Base allowanceUnavailable
Premium$304xAPI list price from prepaid credit
Super$10015xAPI list price from prepaid credit
Ultra$20050xAPI list price from prepaid credit

Cursor says the paid weekly pool is shared across its editor, CLI, Cloud Agents, Grok Bot and Grok apps. Third-party models on Premium and above draw prepaid credit from the first request. Set the monthly additional-usage limit before a lengthy task: that limit caps extra paid consumption even when credit remains in the account.

Plus excludes third-party models, personal API keys, Auto and Cloud Agents. Premium adds Cloud Agents and related services. Existing Hobby, Start, Pro, Pro+, Ultra and legacy Teams seats continue with their older monthly pools and on-demand billing. Read the account’s plan details before applying the weekly-plan table to an existing subscription.

Model and billing situationInput per million tokensCache read per million tokensOutput per million tokens
Composer 2.5, extra usage beyond the pool$0.50$0.20$2.50
Composer 2.5 Fast, extra usage beyond the pool$3$0.50$15
Claude Sonnet 5.5, third-party usage$2$0.10$10

Use one modest task to establish how much your chosen model consumes before opening several long-running sessions. Keep the first session focused on completing and reviewing a change.

Use the current shortcuts to supply precise context

Open Agent with Cmd+I on macOS or Ctrl+I on Windows and Linux. Ask it to identify the entry points and files for the change before requesting an implementation. For example:

Explain how this project fetches user data. Identify the request helper,
the code that consumes its result and the tests that cover failures.
Read the relevant files, cite their paths, and do not edit anything yet.

Compare the answer with the files it names. If it points at the wrong module, attach the exact selection or file and narrow the question. The current keyboard reference maps selection, Agent and completion actions as follows; customized keybindings can differ.

ActionmacOSWindows/Linux
Open or toggle the side panelCmd+ICtrl+I
Add selected code to ChatCmd+Shift+LCtrl+Shift+L
Add selection to a new chatCmd+L or Cmd+KCtrl+L or Ctrl+K
Accept a Tab suggestionTabTab
Accept the next suggested wordCmd+Right ArrowCtrl+Right Arrow
Open the command paletteCmd+Shift+PCtrl+Shift+P

For a local edit, select the function and send a specific request: preserve its public interface, add the missing error handling, and leave unrelated files alone. For a multi-file change, use Agent with the relevant files and a defined acceptance condition. Tab completion is useful while typing, but read the suggested expression before accepting it, especially when it adds data access or error handling.

Put project conventions in scoped rules

Current Cursor project rules live in .cursor/rules as .mdc files. Create one through Customize, Rules, Add Rule, or ask Agent to create it with /create-rule. Plain AGENTS.md is an alternative for straightforward instructions; a plain .md file inside the rules directory is ignored.

For the small JavaScript exercise below, create .cursor/rules/http-helpers.mdc with this scoped instruction. These are example project conventions, so adapt the file pattern and requirements to your repository:

---
description: HTTP helper validation and review conventions
globs: "**/*.mjs"
alwaysApply: false
---
- Preserve the public function name and argument contract.
- Check unsuccessful HTTP responses before parsing their bodies.
- Validate external data against the caller's required shape.
- Keep tests independent of external network services.
- Report changed files and the exact checks that ran.

With alwaysApply: false and a glob, Cursor attaches the rule when a matching file is in context. Setting alwaysApply: true includes it in every chat and ignores the glob. A referenced file is read when needed; its entire content is not automatically copied into the rule. Put requirements that must be present directly in the rule body.

The rules documentation says these instructions do not affect Cursor Tab or other AI features. They guide Agent rather than enforcing a security policy. Likewise, Cursor’s file-access control documentation says terminal commands and MCP tools can still read files matched by .cursorignore. Use operating-system access controls for actual secrets and permissions, and keep task context focused on the relevant source files.

Refactor an HTTP helper against explicit failure cases

Use a small request helper to practice an edit with a measurable result. In this author-supplied exercise, the application expects a user object with string id and name properties. The request must reject an empty identifier, an unsuccessful HTTP response, invalid JSON or an unexpected payload shape. The HTTP success check follows MDN’s Response.ok definition.

Ask Agent to implement those requirements in fetch-user.mjs, keeping a fetch function injectable for tests and passing through a cancellation signal. Compare its result with the following implementation. MDN defines success as an HTTP status from 200 to 299; parsing a response body alone is not the same check.

export async function fetchUserData(userId, { fetchImpl = fetch, signal } = {}) {
  if (typeof userId !== 'string' || userId.trim() === '') {
    throw new TypeError('userId must be a non-empty string');
  }
  const response = await fetchImpl(`/api/users/${encodeURIComponent(userId)}`, { signal });
  if (!response.ok) throw new Error(`HTTP ${response.status}`);
  const user = await response.json();
  if (!user || typeof user !== 'object' || Array.isArray(user) ||
      typeof user.id !== 'string' || typeof user.name !== 'string') {
    throw new TypeError('Invalid user response');
  }
  return user;
}

Save the following as fetch-user.test.mjs beside the helper. The response objects are local test doubles. The tests exercise the helper’s contract without contacting a live user service or using account credentials.

import test from 'node:test';
import assert from 'node:assert/strict';
import { fetchUserData } from './fetch-user.mjs';

test('returns a validated user and encodes the path', async () => {
  const expected = { id: 'a/b', name: 'Ada' };
  const result = await fetchUserData('a/b', { fetchImpl: async (url) => {
    assert.equal(url, '/api/users/a%2Fb');
    return { ok: true, status: 200, json: async () => expected };
  }});
  assert.deepEqual(result, expected);
});
test('rejects an empty ID before a request', async () => {
  await assert.rejects(() => fetchUserData(' ', { fetchImpl: async () => {
    assert.fail('request must not run');
  }}), /non-empty/);
});
test('rejects HTTP errors', async () => {
  await assert.rejects(() => fetchUserData('a', { fetchImpl: async () => ({
    ok: false, status: 404
  })}), /HTTP 404/);
});
test('rejects an unexpected response shape', async () => {
  await assert.rejects(() => fetchUserData('a', { fetchImpl: async () => ({
    ok: true, json: async () => ({ id: 7, name: 'Ada' })
  })}), /Invalid user response/);
});
test('preserves JSON parsing failure', async () => {
  await assert.rejects(() => fetchUserData('a', { fetchImpl: async () => ({
    ok: true, json: async () => { throw new SyntaxError('Invalid JSON'); }
  })}), SyntaxError);
});
test('passes cancellation and preserves network errors', async () => {
  const controller = new AbortController();
  controller.abort();
  await assert.rejects(() => fetchUserData('a', {
    signal: controller.signal,
    fetchImpl: async (_url, { signal }) => {
      assert.equal(signal, controller.signal);
      throw new Error('request aborted');
    }
  }), /request aborted/);
});

Run this in a development environment with Node’s built-in test runner:

node --test fetch-user.test.mjs

Read each failure against the requirement it protects. A change that fixes the HTTP error branch but accepts malformed user data is incomplete. Keep JSON and network failures visible to the caller so the application can decide how to display or retry them. When adapting this example, replace the payload validation with your actual API contract and run the application’s normal integration checks as well.

Review the files on disk and the staged change

After Agent finishes, inspect its file list and diff, then run the existing type checker, linter, tests or build appropriate to the repository. Ask for exact command results rather than accepting a summary that the code looks correct. A failed command should remain visible until its cause is understood.

Git’s diff command reference distinguishes unstaged changes from staged changes. From your existing repository, use:

git diff
git diff --check
git diff --cached

git diff compares the working files with the staging area. git diff --cached shows what is staged against the current commit. The --check option looks for whitespace errors and conflict markers; it does not replace application tests. Inspect newly created files as well as the displayed tracked-file diff before staging the intended change.

Keep the commit focused on the accepted task. For the helper exercise, review input validation, path encoding, HTTP handling, payload checks and cancellation separately. If Agent changes a dependency, configuration file or unrelated module, decide whether that change is required before including it in the same commit.

Expand to a planned feature after the small edit works

For a larger feature, use Shift+Tab in the Agent input to select Plan Mode, as the quickstart describes. Cursor researches the code, asks clarifying questions, proposes a plan and waits for approval before building. Give the plan a concrete file scope, expected behavior and verification path rather than asking for an entire feature without boundaries.

Plan an update to the user profile screen that handles request failure.
Find the existing loading and error-state patterns first.
List the files to change and the regression tests needed.
Preserve the API contract and existing authentication behavior.
Do not install dependencies or implement changes until the plan is approved.

Review the plan before implementation, then keep terminal permissions and external integrations aligned with the task. Cursor requires approval to connect an MCP service and ordinarily requires approval for its individual tool calls unless they have been pre-approved. A project convention is not a substitute for those controls.

Cloud Agents are available from Premium on the current plans and share the included pool described earlier. For longer-running repository work, read the Cursor cloud-agent overview, then decide where the work should run and what repository and service access it needs.

Repeat the same practical loop as the scope grows: identify the relevant code, state the desired behavior, supply concise project rules, review the saved changes, and check the result. The useful outcome of a Cursor session is a change you can explain and maintain, with its tests and execution history available for review.

Nadia Dubois

Nadia Dubois

AI, software and the business of tech

Nadia Dubois covers AI, software and the business of tech for Tech Insider: AI models and the products built on them, developer and productivity software, pricing, and the company decisions and regulation that shape the industry.

View all articles