Plan Mode instructs Claude to create a plan by analyzing the codebase with read-only operations, perfect for exploring codebases, planning complex changes, or reviewing code safely.
Turn on Plan Mode during a sessionYou can switch into Plan Mode during a session using Shift+Tab to cycle through permission modes.If you are in Normal Mode, Shift+Tab will first switch into Auto-Accept Mode, indicated by ⏵⏵ accept edits on at the bottom of the terminal. A subsequent Shift+Tab will switch into Plan Mode, indicated by ⏸ plan mode on.Start a new session in Plan ModeTo start a new session in Plan Mode, use the --permission-mode plan flag:
Copy
Ask AI
claude --permission-mode plan
Run “headless” queries in Plan ModeYou can also run a query in Plan Mode directly with -p (i.e., in “headless mode”):
Copy
Ask AI
claude --permission-mode plan -p "Analyze the authentication system and suggest improvements"
Suppose you’re working on complex architectural decisions, challenging bugs, or planning multi-step implementations that require deep reasoning.
Extended thinking is disabled by default in Claude Code. You can enable it on-demand by using Tab to toggle Thinking on, or by using prompts like “think” or “think hard”. You can also enable it permanently by setting the MAX_THINKING_TOKENS environment variable in your settings.
1
Provide context and ask Claude to think
Copy
Ask AI
> I need to implement a new authentication system using OAuth2 for our API. Think deeply about the best approach for implementing this in our codebase.
Claude will gather relevant information from your codebase and
use extended thinking, which will be visible in the interface.
2
Refine the thinking with follow-up prompts
Copy
Ask AI
> think about potential security vulnerabilities in this approach
Copy
Ask AI
> think hard about edge cases we should handle
Tips to get the most value out of extended thinking:Extended thinking is most valuable for complex tasks such as:
Planning complex architectural changes
Debugging intricate issues
Creating implementation plans for new features
Understanding complex codebases
Evaluating tradeoffs between different approaches
Use Tab to toggle Thinking on and off during a session.The way you prompt for thinking results in varying levels of thinking depth:
“think” triggers basic extended thinking
intensifying phrases such as “keep hard”, “think more”, “think a lot”, or “think longer” triggers deeper thinking
Suppose you’ve been working on a task with Claude Code and need to continue where you left off in a later session.Claude Code provides two options for resuming previous conversations:
--continue to automatically continue the most recent conversation
--resume to display a conversation picker
1
Continue the most recent conversation
Copy
Ask AI
claude --continue
This immediately resumes your most recent conversation without any prompts.
2
Continue in non-interactive mode
Copy
Ask AI
claude --continue --print "Continue with my task"
Use --print with --continue to resume the most recent conversation in non-interactive mode, perfect for scripts or automation.
3
Show conversation picker
Copy
Ask AI
claude --resume
This displays an interactive conversation selector with a clean list view showing:
Session summary (or initial prompt)
Metadata: time elapsed, message count, and git branch
Use arrow keys to navigate and press Enter to select a conversation. Press Esc to exit.
Tips:
Conversation history is stored locally on your machine
Use --continue for quick access to your most recent conversation
Use --resume when you need to select a specific past conversation
When resuming, you’ll see the entire conversation history before continuing
The resumed conversation starts with the same model and configuration as the original
How it works:
Conversation Storage: All conversations are automatically saved locally with their full message history
Message Deserialization: When resuming, the entire message history is restored to maintain context
Tool State: Tool usage and results from the previous conversation are preserved
Context Restoration: The conversation resumes with all previous context intact
Examples:
Copy
Ask AI
# Continue most recent conversationclaude --continue# Continue most recent conversation with a specific promptclaude --continue --print "Show me our progress"# Show conversation pickerclaude --resume# Continue most recent conversation in non-interactive modeclaude --continue --print "Run the tests again"
Run parallel Claude Code sessions with Git worktrees
Suppose you need to work on multiple tasks simultaneously with complete code isolation between Claude Code instances.
1
Understand Git worktrees
Git worktrees allow you to check out multiple branches from the same
repository into separate directories. Each worktree has its own working
directory with isolated files, while sharing the same Git history. Learn
more in the official Git worktree
documentation.
2
Create a new worktree
Copy
Ask AI
# Create a new worktree with a new branch git worktree add ../project-feature-a -b feature-a# Or create a worktree with an existing branchgit worktree add ../project-bugfix bugfix-123
This creates a new directory with a separate working copy of your repository.
3
Run Claude Code in each worktree
Copy
Ask AI
# Navigate to your worktree cd ../project-feature-a# Run Claude Code in this isolated environmentclaude
4
Run Claude in another worktree
Copy
Ask AI
cd ../project-bugfixclaude
5
Manage your worktrees
Copy
Ask AI
# List all worktreesgit worktree list# Remove a worktree when donegit worktree remove ../project-feature-a
Tips:
Each worktree has its own independent file state, making it perfect for parallel Claude Code sessions
Changes made in one worktree won’t affect others, preventing Claude instances from interfering with each other
All worktrees share the same Git history and remote connections
For long-running tasks, you can have Claude working in one worktree while you continue development in another
Use descriptive directory names to easily identify which task each worktree is for
Remember to initialize your development environment in each new worktree according to your project’s setup. Depending on your stack, this might include:
Suppose you want to use Claude Code as a linter or code reviewer.Add Claude to your build script:
Copy
Ask AI
// package.json{ ... "scripts": { ... "lint:claude": "claude -p 'you are a linter. please look at the changes vs. main and report any issues related to typos. report the filename and line number on one line, and a description of the issue on the second line. do not return any other text.'" }}
Tips:
Use Claude for automated code review in your CI/CD pipeline
Customize the prompt to check for specific issues relevant to your project
Consider creating multiple scripts for different types of verification
Suppose you need Claude’s output in a specific format, especially when integrating Claude Code into scripts or other tools.
1
Use text format (default)
Copy
Ask AI
cat data.txt | claude -p 'summarize this data' --output-format text > summary.txt
This outputs just Claude’s plain text response (default behavior).
2
Use JSON format
Copy
Ask AI
cat code.py | claude -p 'analyze this code for bugs' --output-format json > analysis.json
This outputs a JSON array of messages with metadata including cost and duration.
3
Use streaming JSON format
Copy
Ask AI
cat log.txt | claude -p 'parse this log file for errors' --output-format stream-json
This outputs a series of JSON objects in real-time as Claude processes the request. Each message is a valid JSON object, but the entire output is not valid JSON if concatenated.
Tips:
Use --output-format text for simple integrations where you just need Claude’s response
Use --output-format json when you need the full conversation log
Use --output-format stream-json for real-time output of each conversation turn
Claude Code supports custom slash commands that you can create to quickly execute specific prompts or tasks.For more details, see the Slash commands reference page.
Suppose you want to create reusable slash commands for your project that all team members can use.
1
Create a commands directory in your project
Copy
Ask AI
mkdir -p .claude/commands
2
Create a Markdown file for each command
Copy
Ask AI
echo "Analyze the performance of this code and suggest three specific optimizations:" > .claude/commands/optimize.md
3
Use your custom command in Claude Code
Copy
Ask AI
> /optimize
Tips:
Command names are derived from the filename (e.g., optimize.md becomes /optimize)
You can organize commands in subdirectories (e.g., .claude/commands/frontend/component.md creates /component with “(project:frontend)” shown in the description)
Project commands are available to everyone who clones the repository
The Markdown file content becomes the prompt sent to Claude when the command is invoked
Suppose you want to create flexible slash commands that can accept additional input from users.
1
Create a command file with the $ARGUMENTS placeholder
Copy
Ask AI
echo 'Find and fix issue #$ARGUMENTS. Follow these steps: 1.Understand the issue described in the ticket 2. Locate the relevant code inour codebase 3. Implement a solution that addresses the root cause 4. Addappropriate tests 5. Prepare a concise PR description' >.claude/commands/fix-issue.md
2
Use the command with an issue number
In your Claude session, use the command with arguments.
Copy
Ask AI
> /fix-issue 123
This will replace $ARGUMENTS with “123” in the prompt.
Tips:
The $ARGUMENTS placeholder is replaced with any text that follows the command
You can position $ARGUMENTS anywhere in your command template
Other useful applications: generating test cases for specific functions, creating documentation for components, reviewing code in particular files, or translating content to specified languages
> how do I configure Claude Code for Amazon Bedrock?
Copy
Ask AI
> what are the limitations of Claude Code?
Claude provides documentation-based answers to these questions. For executable examples and hands-on demonstrations, refer to the specific workflow sections above.
Tips:
Claude always has access to the latest Claude Code documentation, regardless of the version you’re using
Ask specific questions to get detailed answers
Claude can explain complex features like MCP integration, enterprise configurations, and advanced workflows