Back to materials

Setup fundamentals

Table of Contents

1. Overview

Cursor is an AI code editor. It uses large language models to help you generate, edit, and understand code.

Key features:

FeatureDescriptionShortcut
TabMulti-line autocomplete that predicts your next editTab
Inline EditSelect code and describe changesCmd+K / Ctrl+K
AgentBuild features and make changes across multiple filesCmd+I / Ctrl+I
PlanCreate step-by-step plans before implementingCmd+P / Ctrl+P
AskAsk questions about your codebaseUser assignable
DebugDiagnose and fix bugs using runtime tracesUser assignable
Agent ReviewReview all changes against main branch for issuesUser assignable
MultitaskDelegate work to parallel background subagentsUser assignable

Learn more: Cursor Concepts

2. Install Cursor

  1. Download Cursor and run the installer
  2. Create a GitHub account if you don't have one
  3. Enable two-factor authentication (2FA) in your GitHub account settings

3. Cursor setup

Getting started

First launch

When you open Cursor for the first time:

  1. Create a new folder for your project (or open an existing one)
  2. Press Cmd+I (macOS) or Ctrl+I (Windows) to open Agent mode
  3. Try a simple prompt like "Create a hello world HTML file"

You're now using Cursor. The sections below explain additional setup and tools as you need them.

GitHub integration

Connecting your GitHub account lets you push code to repositories and collaborate with others. Sign in once and Cursor will remember your credentials.

  1. Press Cmd+Shift+P (macOS) or Ctrl+Shift+P (Windows)
  2. Type "GitHub: Sign in" and press Enter
  3. Authorize Cursor in the browser popup

Once signed in, you can ask the agent to commit and push changes for you. It writes descriptive commit messages automatically. You can also use the Source Control tab in the left sidebar for manual control.

Docs: Cursor GitHub Integration

Configuration (optional)

These settings improve your workflow but aren't required to get started.

Enable autosave

Add this to your User Settings JSON (Cmd+Shift+P > "Preferences: Open User Settings (JSON)"):

"files.autoSave": "afterDelay",
"files.autoSaveDelay": 1000

This removes the need to manually save. Changes appear in git status automatically.

Install CLI command

Open any folder from the terminal with the cursor command:

  1. Open command palette: Cmd+Shift+P (macOS) or Ctrl+Shift+P (Windows)

  2. Search: "Shell Command: Install 'cursor' command in PATH"

  3. Open any folder from terminal:

    cursor .
    

Project structure

your-project/
├── .cursor/
│   └── rules/
│       └── project.md    # Your project rules
├── .cursorignore         # Files agent should ignore
└── ...

Sample .cursorignore

node_modules/
dist/
build/

Docs: Cursor Rules

Using the agent

Context symbols

Use @ symbols in prompts to give the agent more context:

  • @file - browse files or folders
  • @<filename> - include specific file/folder
  • @docs - include external documentation
  • @git - reference git changes and diffs
  • @browser - open an embedded browser tab for testing and debugging
  • @terminals - browse terminal windows

Run modes

Go to Cursor Settings > Agents and configure Run mode:

OptionBehavior
AllowlistTools run automatically only when they match your allowlist. Everything else asks for approval.
Allowlist (with Sandbox)Tools auto-run in a sandbox when possible. If sandbox is unavailable, falls back to your allowlist or asks. Recommended default.
Auto (with Sandbox)Tools auto-run in a sandbox by default, with fewer prompts.
Run Everything (Unsandboxed)Only recommended in isolated environments (e.g. VMs or containers).

Three layers govern agent network access: Fetch Domain Allowlist in Cursor Settings (local IDE, user-scoped), .cursor/sandbox.json at the repo root (committed, authoritative for sandboxed + cloud agents), and a per-user cloud-agent global allowlist.

Keyboard shortcuts

ActionmacOSWindows
Toggle left sidebarCmd+BCtrl+B
Toggle Agent modeCmd+ICtrl+I
Toggle Plan modeCmd+PCtrl+P
Cycle agent modesCmd+.Ctrl+.
Cycle agent modes from chat inputCmd+.Ctrl+.
Cycle reasoning effort for selected modelCmd+Shift+/Ctrl+Shift+/
Toggle Agent/Editor viewCmd+ECtrl+E

4. Terminal basics

The terminal is an application for executing text commands instead of using a graphical interface. The shell is the program that interprets your commands (bash, zsh, etc.). On macOS, use the built-in Terminal app. On Windows, use Git Bash (installed with Git).

Commands:

CommandDescription
pwdPrint current directory path
lsList files in current directory
cd folderChange to specified directory
cd ..Move up one directory level
cd ~Change to home directory
mkdir folderCreate a new directory
cat fileDisplay file contents

Keyboard shortcuts:

KeyAction
TabCycle through options
RightAutocomplete suggestion
UpPrevious command
Ctrl+CCancel current command

5. Package managers

A package manager is a tool that installs and updates software from the command line. Instead of downloading installers from websites, you run a single command.

  1. Install a package manager:
  2. Restart your terminal
  3. Install git:
macOSWindows
Git comes pre-installed. Run git --version to verify.scoop install git

6. Git basics

Git is version control software that tracks changes to your code. It allows you to create commits (saved states), revert to previous versions, upload to hosting platforms like GitHub, and merge work from multiple branches.

Key concepts

TermMeaning
RepositoryA folder tracked by Git that contains your project and its history
Working directoryCurrent state of files in your repository
Unstaged changesModified files not yet selected for commit
Staged changesChanges selected to be included in the next commit
CommitA saved snapshot of staged changes

Staging allows you to commit specific changes while leaving others uncommitted. Use git add <file> to stage individual files, or git add . to stage everything.

First time setup

Run these once to configure your identity:

git config --global user.name "Your Name"
git config --global user.email "your@email.com"

Essential commands

CommandDescription
git initInitialize a new repository
git clone <url>Download an existing repository
git statusShow modified files
git add .Stage all changes for commit
git commit -m "msg"Save staged changes with a message
git pushUpload commits to remote repository
git log --onelineList commit history
git log --oneline --graphList commit history as a tree

Inspecting agent changes

When the agent makes changes, use these commands to see what happened:

git status                    # Show what files changed
git log --oneline -5         # View recent commit history
git show HEAD -- path/to/file # View the latest committed version of a file

Undo commands

Discard uncommitted changes:

CommandDescription
git restore .Discard unstaged changes only (keeps staged changes)
git checkout HEAD -- <file>Restore a single file to its last committed state
git reset --hardDiscard all changes (both staged and unstaged)

Undo commits:

CommandDescription
git reset --soft HEAD~1Undo last commit, keep changes staged
git reset --hard HEAD~1Undo last commit, discard changes

Optional: Git GUI

A dedicated Git GUI makes it easier to browse many commits at once in a larger view.

AppInstallNotes
Sourcetreebrew install --cask sourcetreeFree, polished. macOS + Windows

Docs: Git

7. Troubleshooting

ProblemSolution
Cursor features not workingTry running git init, then close and reopen folder
GitHub authentication failsRe-run "GitHub: Sign in" from command palette (Cmd+Shift+P)
Agent can't see my filesVerify .cursorignore is not excluding them
New packages not workingRun npm install manually after adding dependencies

8. Reference

Tools

Documentation