Cursor

Cursor — User Guide

AI-first editor; VS Code fork.

Visit website VPN may be required Freemium Sign-up required
Strengths
  • Composer mode: describe requirements at once and automatically modify multiple related files
  • Understand the entire codebase context, not just the current file
  • Agent mode: autonomously perform multi-step tasks (create files, run commands, fix errors)
  • Fully compatible with VS Code, plug-ins and shortcut keys are seamlessly migrated
  • Supports GPT-4, Claude 3.5 and other underlying models and can be switched
Best for
  • Large-scale project reconstruction: modify multiple related files at one time to maintain logical consistency
  • New feature development: from requirement description to complete implementation, including test files
  • Understand unfamiliar code bases: quickly get started with other people's projects and ask "what does this function do?"
  • Full stack development: Modify the front and back ends at the same time to keep the interface consistent
  • Bug fix: Paste error message, automatically locate and fix it

Composer multi-file programming

Composer is Cursor's most powerful feature and can accomplish complex tasks across multiple files.

Scenario

Add user authentication function (involving multiple files)

Prompt example
I need to add JWT user authentication functionality to this Express.js
project, including:


1. User registration interface POST /api/auth/register


2. User login interface POST /api/auth/login, returns JWT token


3. Middleware: Verify JWT token and protect routes that require login


4. Add password hash storage in the User model




Please modify all related files, including routes, middleware, and models.
Output / what to expect

Cursor Composer automatically:

  • Modify models/User.js: add bcrypt password hashing

  • Create routes/auth.js: registration and login routes

  • Create middleware/auth.js: JWT verification middleware

  • Modify app.js: register new route

  • Update package.json: add jsonwebtoken, bcryptjs dependencies

All file modifications remain logically consistent and can be run directly.

Tips

Press Ctrl+I (Mac: Cmd+I) to open it in Composer, describe the requirements and press Enter to execute.

Scenario

Migrate JavaScript projects to TypeScript

Prompt example
Please migrate this project from JavaScript to TypeScript:


1. Add type annotations to all functions


2. Create the necessary interface and type definitions


3. Update tsconfig.json configuration


4. Fix all types of errors




Keep existing functionality as is, just add a type system.
Output / what to expect

Composer will scan the entire project, in batches:

  • Rename .js files to .ts

  • Add function parameters and return value types

  • Create types/index.ts to uniformly manage type definitions

-Configuration tsconfig.json

  • Fix type conflict
Tips

For large projects, it is recommended to migrate in modules. Composer only processes one directory at a time.

Chat conversational programming

Cursor Chat (Ctrl+L) enables code Q&A without leaving the editor.

Scenario

Understand complex legacy code

Prompt example
@codebase




What is the data flow for this project? From the time the user logs in to seeing
the homepage data,


What files and functions are passed through? Please describe it in the form
of a flow chart.
Output / what to expect

Cursor will analyze the entire code base and output:

  1. Login process: LoginPageauthService.login()JWT storage

  2. Route guard: PrivateRoute check token

  3. Data acquisition: useEffectapi.getDashboard() → Redux store

  4. Rendering: Dashboard component reads data from store

Each step is labeled with the specific file name and line number.

Tips

Use `@codebase` to let Cursor analyze the entire project, and `@filename` to reference a specific file.

Scenario

Generate unit tests

Prompt example
@utils/dateHelper.js




Please generate complete unit tests for all functions in this file, using the
Jest framework.


Requirements cover: normal conditions, boundary values, error conditions.
Output / what to expect

Generate a complete test file utils/dateHelper.test.js, including:

  • Multiple test cases for each function

  • Boundary value testing (empty string, null, invalid date)

  • Error handling testing

  • Test coverage reaches 90%+

Tips

After generation, run `npm test` to check the coverage and let Cursor supplement the uncovered branches.

Agent autonomous execution mode

In Agent mode, Cursor can independently execute commands, create files, repair errors, and complete complete tasks.

Scenario

Build a React project from scratch

Prompt example
Help me build a React + TypeScript + Tailwind CSS project. The requirements
are:


1. Use Vite as a build tool


2. Configure ESLint and Prettier


3. Create a sample Todo List component


4. Configure all dependencies to ensure they can run directly
Output / what to expect

Agent will automatically execute:

  1. npm create vite@latest Create project

  2. npm install tailwindcss to install dependencies

  3. Configure tailwind.config.js

  4. Create the TodoList.tsx sample component

  5. Run npm run dev to verify that it can start normally

The entire process requires no manual operation and takes about 2-3 minutes to complete.

Tips

Agent mode requires Cursor Pro, select "Agent" mode in Composer to enable it.

Compared with similar tools

ToolStrengthBest forPricing
Cursor This toolMulti-file Composer, Agent autonomous execution, understanding of the entire code baseLarge-scale project reconstruction, new feature development, full-stack developmentFree version (limited)/Pro $20/month
GitHub CopilotIDE has the most mature integration, smoothest completion, and enterprise-level securityDaily coding completion, enterprise teamIndividual $10/month
WindsurfAn AI IDE similar to Cursor, Cascade is powerfulUsers who need an alternative to CursorFree version / Pro $15/month
VS Code + CopilotThe most stable and richest plug-in ecosystemUsers who do not want to change editors and already subscribe to CopilotCopilot $10/month

Sources & references: