What is Claude Code?
Claude Code is Anthropic's official command-line interface that brings Claude directly into your terminal. It's not just a chatbot—it's an agentic coding assistant that can read, write, and execute code in your projects.
But here's the thing: most developers only scratch the surface. This guide will show you how to use Claude Code like a pro.
1. Effective Prompting Strategies
Start Broad, Then Narrow Down
Don't dive into implementation immediately. Build context first:
> give me an overview of this codebase
> explain the main architecture patterns used here
> what are the key data models?
> how is authentication handled?
Use Extended Thinking for Complex Problems
For challenging tasks—architectural decisions, complex bugs, or multi-step implementations—enable extended thinking with the ultrathink keyword:
> ultrathink: design a caching layer for our API that handles invalidation gracefully
Or toggle it globally with Alt+T (Linux/Windows) or Option+T (macOS). This gives Claude up to 31,999 tokens for internal reasoning.
Reference Files Strategically
Use @ mentions to include context without waiting for Claude to search:
> Explain the logic in @src/utils/auth.js
> What's the structure of @src/components?
> Compare @database/schema.sql with @docs/data-model.md
2. Plan Mode: Think Before You Code
Plan Mode is one of Claude Code's most powerful features. It creates a read-only research phase before any code changes, preserving your main conversation for implementation.
When to Use Plan Mode
- Multi-file refactoring
- Architectural decisions
- Exploring unfamiliar codebases
- Complex feature implementations
How to Activate
# During a session: Press Shift+Tab twice
# Start a new session in plan mode
claude --permission-mode plan
# Run headless
claude --permission-mode plan -p "Analyze authentication system"
3. Custom Slash Commands
Create reusable workflows that your entire team can share. Commands are just markdown files in your project.
Create a Project Command
# Create the commands directory
mkdir -p .claude/commands
# Create a security review command
cat > .claude/commands/security.md << 'EOF'
Review this code for security vulnerabilities:
1. Check for injection attacks (SQL, XSS, command injection)
2. Verify authentication and authorization patterns
3. Look for exposed secrets or credentials
4. Check for insecure data handling
EOF
Now use it with:
> /security
Commands with Arguments
Use $ARGUMENTS for flexible commands:
# .claude/commands/fix-issue.md
Find and fix issue #$ARGUMENTS. Follow these steps:
1. Understand the issue described in the ticket
2. Locate the relevant code in our codebase
3. Implement a solution that addresses the root cause
4. Add appropriate tests
Usage:
> /fix-issue 123
4. The Memory Hierarchy
Claude Code uses a 5-level memory system. Understanding it is key to effective context management.
- 1. Enterprise Policy - IT-managed settings (highest priority)
- 2. Project Memory -
CLAUDE.mdin project root - 3. Project Rules -
.claude/rules/for modular guidelines - 4. User Memory -
~/.claude/CLAUDE.mdacross all projects
Smart Project Structure
your-project/
├── CLAUDE.md # Team-shared architecture & standards
├── .claude/
│ ├── commands/ # Custom slash commands
│ ├── rules/
│ │ ├── code-style.md # Path-specific guidelines
│ │ ├── testing.md
│ │ └── security.md
│ └── CLAUDE.local.md # Your personal settings (gitignored)
└── .gitignore
Initialize Project Memory
Bootstrap a CLAUDE.md with context about your project:
> /init
5. Essential Keyboard Shortcuts
These shortcuts will dramatically speed up your workflow.
| Shortcut | Action |
|---|---|
Ctrl+C | Cancel current operation |
Ctrl+L | Clear terminal (keeps history) |
Ctrl+B | Background long-running tasks |
Shift+Tab | Toggle permission modes |
Alt+T / Option+T | Toggle extended thinking |
Alt+P / Option+P | Switch models without losing prompt |
Esc + Esc | Rewind code/conversation |
Ctrl+V / Cmd+V | Paste images from clipboard |
Quick Prefixes
| Prefix | Usage |
|---|---|
/ | Slash command (press ? to list all) |
! | Bash mode—runs directly without Claude |
@ | File/directory autocomplete |
! npm test to run tests directly without Claude processing the command. Useful for quick shell operations.6. Git & GitHub Workflows
Claude Code integrates seamlessly with your git workflow.
Common Patterns
# Debug and fix
> I'm seeing an error when I run npm test
> suggest a few ways to fix the @ts-ignore in user.ts
> update user.ts to add the null check you suggested
# Create pull requests
> summarize the changes I've made to the authentication module
> create a pr
> enhance the PR description with more context
Parallel Work with Git Worktrees
Work on multiple features simultaneously with isolated Claude sessions:
git worktree add ../project-feature-a -b feature-a
cd ../project-feature-a
claude
Each worktree gets its own session context.
7. Session Management
Name your sessions for easy retrieval and context switching.
# Name your current session
> /rename auth-refactor
# Resume later
claude --resume auth-refactor
# Quick access to most recent session
claude --continue
# Browse all sessions interactively
claude --resume
8. Subagents for Isolation
Delegate verbose or context-heavy tasks to subagents. They run independently and return only the results, keeping your main conversation clean.
> Use a subagent to run the test suite and report only failing tests with error messages
> Use a subagent to analyze the performance of the auth module
9. MCP Servers for External Tools
The Model Context Protocol (MCP) connects Claude to external tools and data sources.
# Add an HTTP server
claude mcp add --transport http github https://api.github.com/mcp/
# Add a local database connection
claude mcp add --transport stdio db -- npx -y @bytebase/dbhub --dsn "postgresql://..."
# List connected servers
claude mcp list
10. Cost & Token Management
Keep your usage efficient and avoid surprise bills.
Monitor Costs
> /cost
Shows real-time token and cost information for your session.
Reduce Token Usage
- Use Plan Mode for exploration (read-only, cheaper)
- Route heavy work to subagents with Haiku model
- Review loaded memory with
/memoryand optimize - Use fast models for simple tasks via
Alt+P
Key Takeaways
- Plan Before Implementing - Use Plan Mode for complex changes. It's cheaper and prevents wasted work.
- Layer Your Context - CLAUDE.md + rules + imports for clean, maintainable organization.
- Automate With Commands - Create custom slash commands for team workflows.
- Use Subagents Smartly - Isolate verbose operations and restrict tool access.
- Master The Shortcuts - Alt+T, Shift+Tab, Ctrl+B, Esc+Esc will save you hours.
- Name Your Sessions - Descriptive names make resuming work effortless.