Skip to content

Command Reference Cheatsheet

This cheatsheet provides a complete reference for all commands available in Cursor IDE and Claude Code, organized for quick lookup during development.

Essential Commands

  • @ - Reference symbols, files, folders
  • # - Quick file reference
  • / - Slash commands menu
  • Ctrl+Shift+P - Command palette
  • cursor - CLI command

The @ symbol provides powerful context references in Cursor:

SymbolDescriptionExample Usage
@filesReference specific files@main.js explain this file
@foldersInclude entire directories@src/components analyze structure
@codeReference code blocks@calculateTotal how does this work?
@symbolsReference functions/classes@UserAuth explain implementation
@definitionsGo to symbol definitions@getPriceDefinition show me
@docsReference documentation@ReactDocs useState hook
@gitGit history and changes@git recent commits
@linkReference URLs@link https://api.docs.com
@linter-errorsCurrent linting issues@linter-errors fix all
@past-chatsPrevious conversations@past-chats authentication discussion
@recent-changesRecent file modifications@recent-changes last hour
@webWeb search results@web React 19 features
@cursor-rulesProject rules@cursor-rules show current
CommandDescriptionUsage
/Reset ContextReset to default stateClear all context
/Generate Cursor RulesCreate project rulesAuto-generate from codebase
/Disable Iterate on LintsSkip linter fixesPrevent auto-fixing
/Add Open Files to ContextInclude all tabsReference all open editors
/Add Active Files to ContextInclude visible tabsOnly currently visible files

Essential Cursor commands accessible via command palette:

CommandDescription
Cursor SettingsOpen Cursor-specific settings
Cursor: New RuleCreate new project rule
Cursor: Toggle Privacy ModeEnable/disable privacy
Cursor: Export ChatSave conversation
Cursor: Import SettingsImport from VS Code
Cursor: Toggle Max ModeEnable advanced features
Cursor: Generate Commit MessageAI commit message
Cursor: Resolve ConflictsAI merge conflict resolution
Terminal window
# Basic Usage
cursor [options] [paths...] # Open files/folders
cursor . # Open current directory
cursor file.js # Open specific file
cursor folder/ # Open folder
cat file.txt | cursor - # Read from stdin
# File Operations
cursor -d --diff <file1> <file2> # Compare two files
cursor -m --merge <p1> <p2> <base> <result> # Three-way merge
cursor -g --goto file.js:10:5 # Go to line:column
cursor -a --add folder # Add folder to last window
cursor --remove folder # Remove folder from window
# Window Management
cursor -n --new-window # Force new window
cursor -r --reuse-window # Force reuse window
cursor -w --wait # Wait for files to close
# Configuration
cursor --locale <locale> # Set locale (e.g., en-US)
cursor --user-data-dir <dir> # Custom data directory
cursor --profile <name> # Use/create profile
cursor --add-mcp <json> # Add MCP server
# Extensions
cursor --extensions-dir <dir> # Set extensions directory
cursor --list-extensions # List installed extensions
cursor --show-versions # Show extension versions
cursor --install-extension <id> # Install extension
cursor --uninstall-extension <id> # Uninstall extension
cursor --update-extensions # Update all extensions
# Troubleshooting
cursor -v --version # Show version
cursor -h --help # Show help
cursor --verbose # Verbose output
cursor --log <level> # Set log level
cursor -s --status # Show diagnostics
cursor --disable-extensions # Disable all extensions
# Subcommands
cursor tunnel # Secure tunnel for remote access
cursor serve-web # Run web UI server
CommandPurposeExample
/add-dirAdd working directories/add-dir ../backend
/bugReport bugs to Anthropic/bug Claude won't stop
/clearClear conversation history/clear
/compactCompact with instructions/compact focus on auth logic
/configView/modify configuration/config
/costShow token usage stats/cost
/doctorCheck installation health/doctor
/helpGet usage help/help
/initInitialize CLAUDE.md/init
/loginSwitch accounts/login
/logoutSign out/logout
/mcpManage MCP servers/mcp
/memoryEdit CLAUDE.md files/memory
/modelSelect AI model/model
/permissionsUpdate permissions/permissions
/pr_commentsView PR comments/pr_comments
/reviewRequest code review/review
/statusView system status/status
/terminal-setupConfigure terminal/terminal-setup
/vimEnter vim mode/vim
Terminal window
# Interactive mode
claude # Start interactive REPL
claude "explain this project" # Start with initial prompt
# One-off queries
claude -p "explain this function" # Query and exit
cat logs.txt | claude -p "analyze errors" # Process piped content
# Session management
claude -c # Continue most recent
claude -c -p "check for bugs" # Continue in non-interactive mode
claude -r # Choose session to resume interactively
claude -r "abc123" # Resume specific session by ID
# Utility
claude update # Update to latest version
claude mcp # Configure MCP servers
FlagDescriptionExample
-p, —printOne-off query mode (non-interactive)claude -p "fix this bug"
-c, —continueContinue last conversationclaude -c
-r, —resumeResume specific sessionclaude -r or claude -r "session-id"
—modelSpecify modelclaude --model sonnet or claude --model claude-sonnet-4-20250514
—dangerously-skip-permissionsSkip all permission promptsclaude --dangerously-skip-permissions
—output-formatOutput format (text/json/stream-json)claude -p "query" --output-format json
—input-formatInput format (text/stream-json)claude -p --input-format stream-json
—verboseVerbose outputclaude --verbose
—add-dirAdd additional directoriesclaude --add-dir ../shared
—debugEnable debug modeclaude --debug
—mcp-debugDebug MCP connections (deprecated, use —debug)claude --mcp-debug
—max-turnsLimit agentic turns in non-interactive modeclaude -p "task" --max-turns 3
—permission-modeSet permission modeclaude --permission-mode plan
—session-idUse specific session IDclaude --session-id "uuid"
-v, —versionShow versionclaude --version
-h, —helpShow helpclaude --help

Create your own commands in .claude/commands/:

.claude/commands/optimize.md
Analyze this code for performance issues and suggest optimizations.
Consider time complexity, memory usage, and best practices.

Usage: /optimize in Claude Code

FeatureDescriptionExample
$ARGUMENTSPass parametersFix issue #$ARGUMENTS
NamespacingOrganize by directory/frontend/component
YAML FrontmatterAdd metadataallowed-tools: [Edit, View]
File ReferencesInclude filesReview @src/utils.js
Bash CommandsExecute inlineCurrent time: !date

Example with all features:

---
allowed-tools: [Edit, View, Bash]
description: Fix GitHub issue
argument-hint: issue-number
---
Fix GitHub issue #$ARGUMENTS:
1. Fetch issue details: !gh issue view $ARGUMENTS
2. Analyze the problem
3. Implement solution
4. Add tests
5. Create PR with fix

MCP servers expose additional commands:

Terminal window
# Format: /mcp__<server>__<command>
/mcp__github__create-pr
/mcp__puppeteer__screenshot
/mcp__postgres__query
# List available MCP commands
/mcp

Context Chaining

Combine multiple @ symbols for comprehensive context:

@UserAuth @DatabaseSchema @recent-changes
explain how authentication works with the database

Multi-file Operations

Reference multiple files efficiently:

@src/api/*.js @tests/*.test.js
ensure all API endpoints have corresponding tests

Git Integration

Advanced git operations:

@git diff HEAD~5
explain what changed in the last 5 commits
@git blame @calculatePrice
who last modified this function and why?

Piping and Automation

Terminal window
# Pipe logs for analysis
tail -f app.log | claude -p "monitor for errors"
# Automate code review
git diff | claude -p "review these changes"
# Process multiple files
find . -name "*.py" -exec claude -p "add type hints to {}" \;

Session Management

Terminal window
# Save session for later
claude > session-log.txt
# Resume with context
claude -r "abc123" "continue the refactoring"
# Chain sessions
claude -c -p "now add tests for those changes"

Headless Automation

Terminal window
# CI/CD integration
claude -p "fix linting errors" --dangerously-skip-permissions
# Scheduled tasks
0 * * * * claude -p "generate daily report" > report.md
# Git hooks
claude -p "review commit" --output-format json
  1. @codebase - Search entire project
  2. @web python async - Web search
  3. #main.py - Quick file reference
  4. /Generate Cursor Rules - Auto rules
  5. cursor . - Open project
  1. claude - Start session
  2. /clear - Fresh context
  3. /help - Get help
  4. claude -p “task” - Quick task
  5. /cost - Check usage
  • Terminal setup: /terminal-setup for iTerm2
  • Line breaks: Option+Enter by default
  • IDE launch: Cmd+Esc from editor
  • Terminal setup: Configure manually for Shift+Enter
  • IDE launch: Ctrl+Esc from editor
  • Path handling: Use forward slashes
  • Built-in support for all features
  • /terminal-setup configures automatically
  • Supports ANSI colors and formatting
ProblemSolution
@ symbols not workingCheck codebase indexing status
Commands not foundUpdate Cursor to latest version
Slow context loadingUse specific @ references
Rules not applyingCheck .cursor/rules directory
ProblemSolution
Command not recognizedRun /help to see available
Permission errorsCheck /permissions settings
MCP not workingUse --mcp-debug flag
Session lostUse claude -r to resume

Cursor Best Practices

  1. Use specific @ references - More precise = faster
  2. Combine @ symbols - Build comprehensive context
  3. Save chat exports - Keep important conversations
  4. Create project rules - Maintain consistency
  5. Master keyboard shortcuts - Speed up workflow

Claude Code Best Practices

  1. Clear often with /clear - Keep context focused
  2. Create custom commands - Automate repetitive tasks
  3. Use appropriate flags - Match tool to task
  4. Monitor costs with /cost - Stay within budget
  5. Leverage piping - Integrate with Unix tools