Basic Commands
Claude Code understands natural language, but knowing these patterns will make you more effective.
Starting Claude
Section titled “Starting Claude”# Start interactive mode in current directoryclaude
# Start with a specific taskclaude "explain this codebase"
# Print mode - get answer and exitclaude --print "what does main.py do"
# Use a specific modelclaude --model opusAsking Questions
Section titled “Asking Questions”Just type naturally. Claude understands context:
> what does this function do?> why is this test failing?> how does authentication work in this project?> what's the database schema?Making Changes
Section titled “Making Changes”Tell Claude what you want changed:
> fix the bug in the login function> add input validation to the API endpoint> refactor this class to use dependency injection> rename all instances of 'user_name' to 'username'Running Commands
Section titled “Running Commands”Claude can execute shell commands:
> run the tests> start the development server> install the requests package> check git statusClaude will show you the command and ask for permission before executing.
Reference Syntax
Section titled “Reference Syntax”File References with @
Section titled “File References with @”Use @ to reference files directly in your prompt:
@src/main.py explain this fileCompare @src/v1/api.py and @src/v2/api.py - what changed?Paths are relative to project root. Use @./ for current directory or @../ for parent.
Bash Commands with !
Section titled “Bash Commands with !”Start a line with ! to run shell commands. Output is added to context:
!git status!npm test!git diff HEAD~1The ! only works at the start of a line, not inline. After running a command, reference its output in your next prompt.
Two-step example:
!npm testThen:
Based on @src/api/routes.py fix the failing tests shown abovePlan Mode
Section titled “Plan Mode”For complex tasks, use plan mode by pressing Alt+M to cycle through modes until you reach plan mode:
> add a user registration featureClaude will:
- Ask clarifying questions
- Create a detailed plan
- Wait for your approval before executing
Key Slash Commands
Section titled “Key Slash Commands”| Command | Description |
|---|---|
/help | Show all available commands |
/model | Switch models |
/clear | Clear conversation history |
/compact | Summarize and compact the conversation |
/config | View or modify settings |
Conversation Management
Section titled “Conversation Management”> /clear # Start fresh> /compact # Summarize context to save tokensFile Operations
Section titled “File Operations”Claude can read and write files:
> show me the contents of config.py> create a new file called utils.py with helper functions> delete the temp files in the build directory> move the tests to a tests/ folderSearch
Section titled “Search”Claude can search your codebase:
> find all usages of the deprecated API> search for TODO comments> where is the database connection defined?> find all files that import the auth moduleGit Integration
Section titled “Git Integration”Claude understands Git:
> what changed in the last commit?> show me the diff for app.py> create a commit message for my changes> which files have I modified?Keyboard Shortcuts
Section titled “Keyboard Shortcuts”| Shortcut | Action |
|---|---|
| Ctrl+C | Cancel current operation |
| Ctrl+D | Exit Claude Code |
| ↑ / ↓ | Navigate command history |
| Tab | Auto-complete commands and paths |
| Shift+Tab | Toggle permission modes (default/auto-accept) |
| Alt+M | Cycle through modes (normal/plan) |
| Shift+Enter | Insert newline (multi-line input) |
| Esc Esc | Open rewind menu |
| Ctrl+O | Toggle transcript mode (show thinking) |
| Ctrl+B | Background current operation |