claude config set-g theme dark
claude config set-g preferredNotifChannel iterm2_with_bell
claude config set-g autoUpdates true
claude config set-g verbose true
claude config set-g includeCoAuthoredBy false
claude config set-g model "claude-3-5-sonnet-20241022"
claude config set-g enableAllProjectMcpServers true
claude config set-g enabledMcpjsonServers '["memory","github"]'
claude config set-g disabledMcpjsonServers '["filesystem"]'
Configuration Files
Claude Code offers four memory locations in a hierarchical structure:
Organization-wide instructions managed by IT/DevOps
Project memory
./CLAUDE.md
Team-shared instructions for the project
User memory
~/.claude/CLAUDE.md
Personal preferences for all projects
Project memory (local)
./CLAUDE.local.md
Personal project-specific preferences
All memory files are automatically loaded into Claude Code's context when launched. Files higher in the hierarchy take precedence.
Commands & Usage
Claude Commands
Command
Purpose
/add-dir
Add additional working directories
/agents
Manage custom AI subagents
/bug
Report bugs
/clear
Clear conversation history
/compact
Compact conversation
/config
View/modify configuration
/cost
Show token usage statistics
/doctor
Checks health of installation
/help
Get usage help
/init
Initialize project with CLAUDE.md
/login
Switch Anthropic accounts
/mcp
Manage MCP server connections
/memory
Edit CLAUDE.md memory files
/model
Select or change the AI model
/permissions
View or update tool permissions
/review
Request code review
/vim
Enter vim mode
Command Line Flags
Flag / Command
Description
-d, --debug
Enable debug mode
--verbose
Override verbose mode setting
-p, --print
Print response and exit
--output-format <format>
Output format (text, json, stream-json)
--allowedTools
Comma/space-separated list of allowed tools
--disallowedTools
List of denied tools
--mcp-config
Load MCP servers from JSON files
--permission-mode
Permission mode for the session
--model <model>
Model for the current session
--continue
Continue most recent conversation
--dangerously-skip-permissions
Bypass all permission checks
Cheat Sheet
# Basics
claude # Start interactive REPL
claude "explain this project"# Start REPL seeded with prompt
claude -p "summarize README.md"# Non-interactive print modecat logs.txt | claude -p "explain"# Pipe input to Claude# Update & Install
claude update
claude doctor
claude migrate-installer
# Config
claude config get <key>
claude config set <key> <val>
claude config add <key> <vals…>
claude config remove <key> <vals…>
claude config list
# MCP Management
claude mcp list
claude mcp add <name> <command>
claude mcp remove <name>
# Other useful flags
claude --add-dir ../apps ../lib
claude --allowedTools "Bash(git log:*)""Read"
claude --dangerously-skip-permissions
Interface & Input
Keyboard Shortcuts
Shortcut
Description
Ctrl+C
Cancel current input or generation
Ctrl+D
Exit Claude Code session
Ctrl+L
Clear terminal screen
Up/Down arrows
Navigate command history
Esc + Esc
Edit previous message
Multiline Input
Method
Shortcut
Quick escape
\ + Enter
macOS default
Option+Enter
Terminal setup
Shift+Enter
Control sequence
Ctrl+J
Vim Mode
Enable vim-style editing with /vim command or configure permanently via /config.
Vim Mode Switching
Command
Action
Esc
Enter NORMAL mode
i
Insert before cursor
a
Insert after cursor
o
Open line below
Vim Navigation
Command
Action
h/j/k/l
Move left/down/up/right
w/e/b
Word navigation
gg/G
Beginning/End of input
Vim Editing
Command
Action
x/dd/D
Delete character/line/end of line
cc/C
Change line
.
Repeat last change
Command History
Claude Code maintains command history for the current session:
History is stored per working directory
Cleared with /clear command
Use Up/Down arrows to navigate
Ctrl+R: Reverse search through history (if supported)
History expansion (!) is disabled by default
Advanced Features
Thinking Keywords
Gives Claude extra pre-answer planning time by adding ONE of these keywords to your prompt.
Planning the solution
Checking constraints & edge cases
Weighing alternatives/trade-offs
Breaking down steps
Examples:
claude -p "Think. Outline a plan to refactor the auth module."
claude -p "Think harder. Draft a migration plan from REST to gRPC."
claude -p "Ultrathink. Propose a step-by-step strategy to fix flaky payment tests."
Sub Agents
Sub‑Agents are purpose‑built helpers with their own prompts, tools, and isolated context windows.
Create your core agents
planner (read‑only): turns features/issues into small, testable tasks.
codegen (edit‑capable): implements tasks.
tester (read‑only or patch‑only): writes failing tests.
Role: Write a single, focused failing test for the specific scenario I describe.
Scope: Only create/modify tests under tests/. Do not change src/.
Output: A brief rationale + a unified diff or patch.
MCP Integration
Understanding MCP (Model Context Protocol)
MCP extends Claude's capabilities by connecting to external services, databases, APIs, and tools.
MCP Setup & Configuration
Basic MCP Commands:
claude mcp # Interactive MCP configuration
claude mcp list # List configured servers
claude mcp add <name> <cmd> # Add new server
claude mcp remove <name> # Remove server
Configuration File Location:
~/.claude.json - Global File
.mcp.json - Project-scoped servers
Popular MCP Servers:
Development Tools: git-mcp-server, github-mcp-server
PostToolUse: Runs immediately after a tool completes.
Notification: Runs when Claude needs permission or is idle.
UserPromptSubmit: Runs when user submits a prompt.
Stop: Runs when agent finishes responding.
SessionStart: Runs when starting a new session.
Security Considerations
USE AT YOUR OWN RISK: Claude Code hooks execute arbitrary shell commands on your system automatically. By using hooks, you acknowledge that you are solely responsible for the commands you configure.
Always review and understand any hook commands before adding them to your configuration.
Security & Permissions
Dangerous Mode
NEVER use in Production systems, shared machines, or any systems with important data. Only use with isolated environments like a Docker container.
claude --dangerously-skip-permissions
Security Best Practices
Keep ~/.claude.json private (chmod 600).
Prefer environment variables for API keys over plain-text.
Use --strict-mcp-config to only load MCP servers from specified config files.
Validate and sanitize inputs in hooks.
Always quote shell variables.
Automation & Integration
Automation & Scripting with Claude Code
GitHub Actions integration allows automated reviews and triage.
Auto PR Review (inline comments)
File: .github/workflows/claude-pr-auto-review.yml
name:AutoreviewPRson:pull_request:types: [opened, synchronize, reopened, ready_for_review]
jobs:auto-review:runs-on:ubuntu-lateststeps:-uses:actions/checkout@v4-name:ClaudePRreviewuses:anthropics/claude-code-action@mainwith:anthropic_api_key:${{secrets.ANTHROPIC_API_KEY}}direct_prompt:|
Review this pull request's diff for correctness, readability, testing, performance, and DX.
allowed_tools:>-
mcp__github__get_pull_request_diff,
mcp__github__create_pending_pull_request_review,
mcp__github__add_comment_to_pending_review,
mcp__github__submit_pending_pull_request_review
Now launch claude. Find more information from the Official Deepseek Docs.
Conclusion
Claude Code provides a powerful terminal-based interface for AI-assisted development. This guide covered installation, configuration, advanced features like Sub-Agents and Hooks, and integration with CI/CD pipelines. By following security best practices and optimizing prompts, developers can effectively leverage AI to enhance productivity and code quality.