The Complete Guide to Claude Code: Installation, Workflows & Advanced Tips

A comprehensive guide to Claude Code covering installation, workflows, and advanced automation techniques.
This guide covers everything you need to know about Claude Code, Anthropic's agentic coding tool. It explains the core agentic loop mechanism, multi-platform installation options, the golden Explore→Plan→Code→Commit workflow, CLAUDE.md project configuration, context window management strategies, MCP external tool connections, and deterministic Hooks automation—helping developers maximize productivity.
Claude Code is an agentic coding tool developed by Anthropic that can directly access your codebase, edit files, execute commands, and seamlessly integrate with your existing development tools. Unlike traditional Claude AI chat, Claude Code eliminates the need to copy and paste code back and forth—it can autonomously complete tasks. This article systematically covers Claude Code's core concepts, installation methods, workflows, and advanced techniques to help you get started quickly and use the tool efficiently.
What Is Claude Code? How Does It Differ from Claude AI?
At its core, Claude Code is an AI Agent. An AI Agent is a software system that can interact with its environment and execute actions to accomplish specific goals. Its core mechanism places a large language model in a real-time loop, enabling it to call tools, access external services, and even coordinate other AI agents to achieve predetermined objectives.
Compared to regular Claude AI chat, Claude Code has three key differences:
- Direct file system access: It can read and understand your entire codebase, track down bugs, and explain feature implementations
- Terminal command execution: It can run build scripts, test suites, install dependencies, and decide next steps based on output
- Web search: When it needs the latest API documentation or reference materials, it can autonomously search the web
At the same time, three core concepts are essential to understand: context window (Claude's working memory, which has limited capacity), permission mechanism (by default, it asks for approval before executing commands or modifying files), and fallibility awareness (it may misinterpret intent, introduce new bugs, or over-engineer solutions).
Multi-Platform Installation and Usage
Claude Code supports terminal, VS Code, JetBrains IDEs, Claude Desktop app, and web-based access, covering all mainstream development environments.
Terminal installation (recommended, receives feature updates fastest):
- macOS/Linux/WSL: Use the one-line cURL installation command
- Also available via Homebrew (
brew install), but doesn't support auto-updates - Windows: Supports cURL commands for PowerShell and CMD, as well as WinGet
After installation, navigate to your project directory and run claude to start—it will automatically gain access to that directory and all subdirectories.

VS Code: Search for "Claude Code" in the Extensions panel and install the official Anthropic extension (look for the blue verified badge). After installation, open the Command Palette with Ctrl/Cmd + Shift + P and search for "Claude Code" to use it.
JetBrains IDEs: Install the Claude Code plugin from the JetBrains Marketplace, restart, and you'll see the Claude icon in the sidebar.
Desktop app and web: Claude Desktop supports running Claude Code in the background, ideal for multitasking scenarios; the web version is limited to GitHub repositories but supports multiple parallel sessions.
Selection guide: Use the terminal for the latest features; use IDE plugins for deep editor integration; use the desktop app for background execution; use the web version for remote collaboration.
Core Working Principle: The Agentic Loop and Tool Calls
Claude Code's workflow can be summarized as an Agentic Loop:
- Input prompt: You describe the task to Claude Code
- Gather context: Claude interacts with the model, returning text or tool call requests
- Execute actions: Edit files, run commands, etc.
- Verify results: Determine whether the goal has been achieved
- Iterate: If not achieved, re-execute until results are verifiable
Throughout the loop, you can add context, interrupt operations, or guide the model's direction at any time.
Tools are the backbone of agent work. Unlike traditional "text in → text out" AI, tools enable Claude Code to execute code at appropriate moments to advance tasks—such as read_file, search_web, etc. Claude Code uses semantic search to determine when to call which tool.
Permission modes can be toggled with Shift + Tab:
- Default mode: Requires confirmation for every file edit or command execution
- Auto Accept mode: Automatically accepts file edits but still requires confirmation for command execution
- Plan mode: Uses only read-only tools, compiles an action plan without executing any modifications
The Golden Workflow: Explore → Plan → Code → Commit
This is the most efficient methodology for using Claude Code, avoiding the common anti-pattern of directly asking AI to write code and then repeatedly correcting it.

Step 1: Explore
Use Plan mode to have Claude only read files and search for information without making any modifications. For example:
"I need to add WebP conversion to the image upload pipeline. Please analyze where in the pipeline this should be handled, whether new dependencies are needed, and propose an implementation approach."
Claude will read relevant files, search the web, and then provide a detailed action plan.
Step 2: Plan
This is the best time to course-correct—because no code has been written yet. Carefully review the plan, confirm it meets expectations, and request modifications or additions if necessary.
Step 3: Code
After approving the plan, Claude begins executing item by item. You can choose to auto-accept file edits or confirm each one individually. Claude will try to troubleshoot issues on its own, but sometimes you'll still need to intervene.

Key tips for improving code quality:
- Clearly define what "correct" means in the plan
- Install the Claude in Chrome extension so Claude can control the browser to test UI
- Include a test suite in your project so Claude can continuously verify code correctness
- If Claude repeatedly encounters the same issue, have it save the solution to
CLAUDE.md
Step 4: Commit
Before committing, run a sub-agent to perform a code review, then have Claude generate a commit message in your preferred style.
CLAUDE.md: The Project Manual for AI
CLAUDE.md is one of Claude Code's most practical features. It's a Markdown file placed in your project root that Claude automatically reads every time it starts—essentially an "onboarding handbook" for the project.
A typical CLAUDE.md includes:
- Tech stack description (e.g., Next.js 15 + Tailwind + Drizzle ORM)
- Common commands (dev server, tests, lint)
- Code style (indentation, export conventions, directory structure conventions)
- Architecture decisions (e.g., "prefer Server Actions over API Routes")
Memory file hierarchy:
- Project-level
CLAUDE.md: Placed in the project root, shared by the team, included in version control - User-level
CLAUDE.md: Placed in the config folder, personal preferences, applies across projects
Best practices: Don't rush to create a CLAUDE.md. Observe what you repeatedly need to correct Claude on, then gradually add rules. This keeps the file concise and contains only truly necessary information. You can use the /init command to have Claude auto-generate an initial version.
Context Management: Efficiently Using Limited Working Memory
The context window is Claude's working memory—every file read, command run, and message sent consumes space. Managing context well is key to using Claude Code efficiently.
Core commands:
/compact: Compresses the current conversation, summarizes important details, frees up space (suitable for mid-development on the same feature)/clear: Completely clears everything, starts from scratch (suitable when switching to a new feature)/context: View a detailed report of current context usage
Optimization tips:
- Be specific in prompts: Vague prompts force Claude to extensively explore the codebase, consuming more context
- Minimize MCP servers: Unused MCP tool definitions also consume context space
- Leverage sub-agents: Sub-agents have their own independent context windows, ideal for tasks where you "only need the answer, not the process"
- Consider using Skills: Similar to MCP but doesn't load all tool definitions into context by default
MCP: Connecting External Tools and Data Sources
Model Context Protocol (MCP) is an open standard that enables Claude Code to connect to external tools and data sources, significantly expanding its capabilities.

Common use cases:
- Connect to Linear to retrieve specific issue details from project management
- Use the Context7 MCP server to get the latest documentation for dependency libraries
- Find hundreds of different connectors in the MCP connector marketplace
Adding and managing:
- Use the
claude mcp addcommand to add servers - Two types: HTTP (remote services) and STDIO (local processes)
- Three scopes: Local (current project only), User (cross-project), Project (included in version control via
.mcp.json)
Important notes: MCP tool definitions consume context space. If tools exceed 10% of the context window, Claude Code automatically switches to tool search mode. If a tool has a CLI equivalent (e.g., gh, aws), using the CLI approach saves more context.
Hooks: Deterministic Automation Control
Hooks have one fundamental difference from all the features discussed above: they are deterministic and will always execute. You can tell Claude in CLAUDE.md to "run Prettier after every edit," but it may occasionally forget; a Hook guarantees execution every time, without exception.
Five event types:
UserPromptSubmit: Triggered when a prompt is submittedPreToolUse: Triggered before a tool call (can be used to block dangerous operations)PostToolUse: Triggered after a tool call (most commonly used for auto-formatting)Notification: Triggered when Claude sends a notificationStop: Triggered when Claude finishes a response
Typical use cases:
- Auto-formatting: PostToolUse Hook matching
edit/multi-edit, running the appropriate formatter based on file extension - Security guardrails: PreToolUse Hook blocking writes to production config directories, blocking
rm -rfcommands, blocking direct commits to the main branch (exit code 2 = block, exit code 0 = allow) - Team standards: Hooks configuration lives in
.claude/settings.json, can be included in version control, and is automatically shared among team members
Conclusion
Claude Code is not a simple chat window—it's a complete agentic development environment. Mastering it comes down to: understanding how the agentic loop works, following the "Explore → Plan → Code → Commit" golden workflow, providing persistent context with CLAUDE.md, carefully managing the context window, extending external capabilities through MCP, and implementing deterministic automation with Hooks. Combining all these elements together is what truly unlocks Claude Code's full potential and significantly boosts your daily development productivity.
Related articles

Code Refactoring and Culinary Evolution: How Software Thinking Explains Cultural Transmission
From Iraqi stew to Singaporean cuisine across centuries—using software refactoring concepts to decode cultural evolution, code reuse, and incremental change.

Kemeny's 'Man and the Computer': Why the BASIC Creator's Tech Prophecies Still Haven't Expired
Revisiting BASIC creator Kemeny's 1972 'Man and the Computer' — how his predictions about universal computing, human-machine symbiosis, and data monopoly resonate powerfully in today's AI era.

Code Refactoring and Culinary Evolution: How Software Thinking Explains Cultural Transmission
From Iraqi stew to Singaporean cuisine: a cross-century journey explored through software refactoring metaphors, revealing universal laws of complex system evolution.