← Back to tutorials

Cursor AI Complete Tutorial: Mastering .cursorrules and Composer

Master Cursor's most powerful features for professional developers

Cursor AI Complete Tutorial: From Setup to Production Workflow

Cursor is VS Code rebuilt around AI — same editor bones (your extensions, keybindings, and themes import in one click), different center of gravity: the AI isn't a sidebar bolt-on, it's the primary way you change code. This tutorial covers the three interaction modes, project rules (the highest-leverage config most users skip), Agent mode discipline, and the workflow patterns that separate productive Cursor use from expensive flailing.

Setup

Download from cursor.com → import VS Code settings → sign in. Two settings worth changing immediately:

  • Privacy mode (Settings → General) if you work on proprietary code — controls whether code is retained for training.
  • Model selection (per-chat dropdown): default to a strong model for Composer/Agent work; completions always use Cursor's fast custom model regardless. Current frontier-model tradeoffs: model library.
  • The three interaction modes (and when each wins)

    1. Tab — autocomplete on steroids. Cursor's completion predicts multi-line edits, including *the next edit elsewhere in the file* (rename a variable, Tab through every usage). Just code; accept with Tab, partial-accept word-by-word with Cmd+→.

    2. Cmd+K — scoped inline edits. Select code → Cmd+K → instruction → diff appears in place. The right tool for "make this function async", "add error handling here", "convert to TypeScript". Fast because the scope is explicit — the selection *is* the context.

    3. Chat/Composer (Cmd+L / Cmd+I) — multi-file work. Chat answers questions with codebase context (@files, @folders, @codebase to control what it sees); Composer/Agent mode plans and executes multi-file changes, runs terminal commands, reads errors, and iterates until done.

    Rule of thumb: Tab for typing, Cmd+K for one place, Agent for one task across many places. Escalating a one-line fix to Agent mode is the most common money-waster.

    Project rules — configure once, benefit every request

    Modern Cursor uses .cursor/rules/ (directory of .mdc rule files, scoped by glob patterns) — the successor to the legacy single .cursorrules file (still honored). This is the single highest-leverage configuration:

    markdown
    
    description: Core conventions globs: ["/*.ts", "/*.tsx"]
  • TypeScript strict; no "any" — use "unknown" + narrowing
  • React: function components only; server components by default in app/
  • Tests: Vitest, colocated as *.test.ts; new logic needs a test
  • Errors: never swallow — log with context or rethrow typed
  • Style: match surrounding code; no new dependencies without asking
  • Check the rules directory into git — the whole team's AI now follows house style. Why it matters mechanically: explicit constraints in context dramatically reduce output variance (prompt sensitivity), and "no new dependencies without asking" kills the most common Agent failure mode.

    Agent mode discipline

    Agent mode is powerful exactly in proportion to how well you specify the task:

    text
    Add pagination to GET /api/orders.
    
  • Query params: page (default 1), limit (default 20, max 100)
  • Response: { items, total, page, pages }
  • Update the two existing callers in src/app/orders/
  • Add Vitest cases: default paging, limit cap, empty page
  • Done when: npm test passes
  • The pattern — scope, contract, affected files, acceptance test — is the same one that works for every coding agent. Three operating habits:

  • Review diffs file-by-file before accepting; AI errors are confidently wrong, and the checkpoint/restore feature is your undo for whole Agent runs.
  • Let it run the loop: allow test/build commands so it reads failures and fixes them — that self-correction loop is where Agent mode beats copy-pasting from a chatbot.
  • New chat per task: long mixed-topic threads degrade context quality; start clean, reference files explicitly.
  • Workflow patterns that compound

  • Understand-first on unfamiliar code: @codebase how does auth session refresh work? before changing anything — Cursor's codebase indexing makes it a genuinely good code-reading tool.
  • TDD inversion: have Cmd+K write the failing test from the spec, then Agent implement until green — the test becomes the acceptance criterion.
  • Docs into context: @docs (add a URL) when working against an SDK the model half-remembers; pasting current docs beats hallucinated APIs.
  • Terminal Cmd+K: describe the command you can't remember ("find files >10MB modified this week") — inline shell generation.
  • Where Cursor fits in 2026's tool landscape

    Cursor's lane is interactive, IDE-centric development — you watching and steering in a tight loop. For comparison shopping: Cursor vs GitHub Copilot (Copilot wins on multi-IDE/enterprise integration), Copilot's own advanced features, and Windsurf vs Devin vs SWE-agent for the more autonomous end of the spectrum.

    FAQ

    Is the subscription worth it over Copilot? If you live in VS Code and do multi-file AI edits daily, Cursor's Composer/context UX is currently ahead; if you need JetBrains/Neovim or enterprise IP indemnities, Copilot. Both have free tiers — run a real week on each.

    Does it send my code to the cloud? Yes for AI features (that's how it works); privacy mode governs retention. For stricter requirements, check current enterprise options before adopting.

    Biggest beginner mistake? Treating Agent mode as a slot machine — vague prompt, accept-all, repeat. Specification and diff review are the skill; the editor just removes the friction.


    *Last updated: June 2026. Cursor ships weekly; verify features against cursor.com/docs.*

    Also available in 中文.