Best way to use Claude code
Claude Code is an agentic coding tool designed for the terminal and IDEs, enabling developers to pair-program with an AI that can edit files, run comm...
Author’s note: How do I get the most out of Claude code?
Executive Summary
Claude Code is an agentic coding tool designed for the terminal and IDEs, enabling developers to pair-program with an AI that can edit files, run commands, and interact with version control systems like git. To maximize its effectiveness, users should adopt core workflows such as explicitly planning tasks before implementation, employing test-first development cycles, and using it for codebase Q&A and git operations. A key feature is its memory system, centered around a CLAUDE.md file, which grounds the AI in the specific context of a project, including build commands, coding standards, and architectural notes. Claude Code offers both a full-featured CLI and an integrated VS Code extension, each with distinct advantages. It is built with safety and enterprise needs in mind, featuring granular permissions, a sandboxed execution environment, and the ability to set organization-wide policies. Extensibility is a major strength, achieved through the Model Context Protocol (MCP), which allows Claude Code to connect to hundreds of external tools and data sources, making it a highly scriptable and automatable assistant for tasks ranging from local development to CI/CD pipelines.
Introduction To Claude Code
Claude Code is an agentic coding assistant developed by Anthropic, designed to operate within a developer’s terminal and Integrated Development Environment (IDE). Its primary purpose is to function as an AI pair-programmer, assisting with a wide range of development tasks. These tasks include directly editing files, running shell commands, interacting with version control systems like Git, managing GitHub workflows (such as creating pull requests and reviewing code), and integrating with a vast ecosystem of external tools and data sources through the Model Context Protocol (MCP). The tool is built on a design philosophy of being low-level, flexible, scriptable, and enterprise-ready, allowing it to be seamlessly incorporated into workflows from local development on a laptop to automated tasks in a Continuous Integration (CI) pipeline. For enterprise deployment, it can be used via the Claude API or hosted on cloud platforms like AWS or GCP.
Workflow Optimization Tips
To maximize efficiency with Claude Code, adopt several key workflow patterns. First, always course-correct early by using the ‘Explore → Plan → Implement’ workflow; have Claude read relevant files and propose a step-by-step plan for your review before it writes any code. For complex, multi-step tasks like cleaning up linting errors, instruct Claude to create a Markdown checklist and work through it item by item. A powerful technique for real-time analysis is to pipe data directly into Claude’s headless mode; for example, you can use tail -f app.log | claude -p "Slack me if you see any anomalies..." to monitor logs. To get the best of both the CLI and IDE, run the CLI in the VS Code integrated terminal and use claude --resume to share conversations between them, working around the feature limitations of the extension. Ground all interactions by providing project-specific context, commands, and standards in a CLAUDE.md file, and use the # key during a session to quickly add new instructions to it. For larger-scale work, run multiple Claude sessions for parallel tasks (using git worktrees to isolate branches) and leverage headless mode (claude -p) to automate batch tasks and integrate Claude into CI/CD pipelines for issue triage or code reviews.
Bottom Line Summary
To get the most out of Claude Code, consistently apply a few core principles. Ground Claude in your project’s specifics using CLAUDE.md and modular rules.12 Always plan before you code, asking Claude to outline steps before implementation.1 Iterate against a stable set of tests or clear visual targets to ensure correctness.1 Maintain control by managing permissions and using sandboxing for safety.34 Finally, scale your productivity by integrating external tools via MCP and utilizing multi-session or headless workflows to automate tasks from your local machine to your CI pipeline.15 These patterns are key to achieving faster, safer, and higher-quality results with Claude Code.6
Comprehensive Blog Post Markdown
Mastering Claude Code: A Guide to Agentic Coding
Claude Code is an agentic coding tool that runs in your terminal and IDE, edits files, runs commands, works with git/GitHub, and integrates external tools via the Model Context Protocol (MCP).6 It’s designed to be flexible, scriptable, and enterprise-ready, so you can pair-program with Claude from local development to CI automation.6
This guide covers the core strategies and features to help you get the most out of Claude Code, including installation, daily workflows, memory management, IDE vs. CLI usage, safety controls, and advanced automation techniques.
Install and Start Fast
You can install Claude Code via a native installer, Homebrew, or npm. Once installed, simply run claude in your project directory. You will be prompted to sign in on your first use.6 The tool is designed to update itself automatically. For advanced configuration and troubleshooting, refer to the official documentation.6
Core Daily Workflows
Adopting structured workflows can significantly improve Claude’s performance and reliability.
1) Explore → Plan → Implement → Commit
For complex tasks, guide Claude through a deliberate process. First, ask it to read relevant files, documentation, or URLs to gather context. Crucially, instruct it not to write code until it has proposed a step-by-step plan and you have approved it.1 This explicit planning phase improves reasoning. Once the plan is solid, have Claude implement it, verify the results, and finally, commit the changes or open a pull request.1
Example Prompt:
Please explore the logging subsystem (read the logging module, config, and recent commits), think hard, then propose a step-by-step plan to add structured JSON logs. Do not edit code yet.2) Test-First Iteration
A powerful pattern is to have Claude write tests based on expected inputs and outputs. First, confirm that these new tests fail as expected. Commit the failing tests. Then, instruct Claude to implement the feature code until the tests pass, with the explicit rule that it must not modify the tests themselves.17 Once all tests are green, you can commit the implementation.1
3) Codebase Q&A and Git Ops
Treat Claude as a new teammate. You can ask it high-level questions about the repository, such as “How does logging work?” and it will read the necessary files and git history to provide an answer.1 It can also handle many routine git operations, like writing commit messages, fixing build failures or lint warnings, triaging issues, creating pull requests, and even resolving straightforward code review comments.1
4) GitHub Review & Automation
Claude Code can be integrated directly into your GitHub workflow. Use the /install-github-app command or set up a GitHub Action to enable automated code reviews and issue triage.38 You can configure a custom GitHub App with minimal repository permissions (read-write for Contents, Issues, and Pull Requests) to get started.8
Use Memory to Ground Claude in Your Project
CLAUDE.md and Rules
Claude’s effectiveness is greatly enhanced by providing it with context. It automatically loads memory files when it starts. The hierarchy is important: enterprise policy files load first, followed by user-level ~/.claude/CLAUDE.md, and finally project-level ./CLAUDE.md.2 You can also create modular rules with path scoping under .claude/rules/.2
To quickly edit these files, use the /memory command.2 You can also import other files using @path/to/import syntax (up to 5 levels deep).2
What to capture in CLAUDE.md:
- Build, test, and lint commands1
- Coding standards and style guides1
- High-level architectural notes1
- Repository etiquette and known quirks1
To quickly update memory during a session, press # to add instructions to the most relevant CLAUDE.md file, ensuring future actions remain aligned.1
IDE vs. CLI
Claude Code can be used in the terminal (CLI) or via an extension for VS Code and Cursor.4 The VS Code extension provides a convenient panel and editor integration, while the CLI exposes the full power of slash commands and shell-based workflows.4
Feature Comparison
| Feature | CLI | VS Code Extension |
|---|---|---|
| Slash commands | Full set | Subset (type / to see available) |
| MCP server config | Yes | No (configure via CLI) |
| Checkpoints | Yes | Coming soon |
! bash shortcut, tab completion | Yes | No |
Source: Based on Claude Code documentation.4
Tips:
- In VS Code, use the Command Palette to open Claude Code views. Use
Alt+Kto insert @-mentions with line numbers.4 - Edits proposed by Claude appear as diffs that you can accept or reject.4
- You can run the CLI in VS Code’s integrated terminal and connect it to the UI with
/ide. Conversations are shared and can be resumed withclaude --resume.4
Permissions and Controls
Safety is a core principle. Claude will always ask for permission before editing files or running commands.34 You can view and toggle these permissions using the /permissions command.3 For safer autonomous execution of commands, you can enable a sandboxed bash tool with filesystem and network isolation using the /sandbox command.3
Slash Commands You’ll Use Often
/init: Bootstrap aCLAUDE.mdfile for your project.3/plan: Enter the explicit planning mode.3/memory: View and edit memory files.3/model: Switch the underlying AI model for the current session.3/context&/cost: See context usage and token statistics.3/install-github-app,/review: Commands for GitHub workflows.3/mcp: Manage Model Context Protocol connections and view available tools.3
Integrate External Tools via MCP
The Model Context Protocol (MCP) allows Claude Code to connect to hundreds of external tools, APIs, and data sources.5 MCP servers can expose tools, resources, and even new slash commands to Claude.5 You can configure servers at the project, user, or local scope, and enterprises can set allow/deny policies.5 For servers requiring authentication, the /mcp command can handle OAuth flows.5
Example Project-scoped MCP config (.mcp.json):
{ "mcp": { "servers": { "github": { "command": "node", "args": ["server.js"], "scope": "project" } } }}Prompting Patterns for Better Code
- Multi-Window Tasks: For large tasks, use the first session to scaffold the project (e.g., create tests, scripts, and a todo list). Then, tackle the todos in subsequent, fresh sessions.7
- Immutable Tests: Create tests first and instruct Claude that it is unacceptable to modify them. This prevents regressions.7
- Provide Verification Tools: For autonomous tasks, give Claude access to verification tools, like a Playwright MCP server for UI testing.7
- Be Explicit: Request richer implementations and use phrases like “think hard” when asking for a plan to encourage deeper reasoning.17
Multi-Claude and Headless Automation
You can run multiple Claude Code sessions simultaneously for separate tasks, such as parallel refactors. Using git worktrees can help isolate branches and prevent conflicts.1 For automation, headless mode (claude -p "prompt") lets you pipe tasks to Claude in scripts or CI/CD pipelines, with JSON output available for automated checks.16 This is perfect for using GitHub Actions to triage issues or provide subjective code reviews that go beyond what linters can do.18
Bottom Line
To get the most out of Claude Code, consistently apply a few core principles. Ground Claude in your project’s specifics using CLAUDE.md and modular rules.12 Always plan before you code, asking Claude to outline steps before implementation.1 Iterate against a stable set of tests or clear visual targets to ensure correctness.1 Maintain control by managing permissions and using sandboxing for safety.34 Finally, scale your productivity by integrating external tools via MCP and utilizing multi-session or headless workflows to automate tasks from your local machine to your CI pipeline.15 These patterns are key to achieving faster, safer, and higher-quality results with Claude Code.6
References
Footnotes
-
Anthropic Engineering. “Claude Code: Best practices for agentic coding.” Anthropic, Apr 18, 2025. https://www.anthropic.com/engineering/claude-code-best-practices ↩ ↩2 ↩3 ↩4 ↩5 ↩6 ↩7 ↩8 ↩9 ↩10 ↩11 ↩12 ↩13 ↩14 ↩15 ↩16 ↩17 ↩18 ↩19 ↩20 ↩21 ↩22 ↩23
-
Anthropic. “Manage Claude’s memory.” Claude Code Docs, accessed Jan 11, 2026. https://code.claude.com/docs/en/memory ↩ ↩2 ↩3 ↩4 ↩5 ↩6
-
Anthropic. “Slash commands.” Claude Code Docs, accessed Jan 10, 2026. https://code.claude.com/docs/en/slash-commands ↩ ↩2 ↩3 ↩4 ↩5 ↩6 ↩7 ↩8 ↩9 ↩10 ↩11 ↩12 ↩13
-
Anthropic. “Use Claude Code in VS Code.” Claude Code Docs, accessed Jan 11, 2026. https://code.claude.com/docs/en/vs-code ↩ ↩2 ↩3 ↩4 ↩5 ↩6 ↩7 ↩8 ↩9
-
Anthropic. “Connect Claude Code to tools via MCP.” Claude Code Docs, accessed Jan 11, 2026. https://code.claude.com/docs/en/mcp ↩ ↩2 ↩3 ↩4 ↩5 ↩6
-
Anthropic. “Claude Code overview.” Claude Code Docs, accessed Jan 11, 2026. https://code.claude.com/docs/en/overview ↩ ↩2 ↩3 ↩4 ↩5 ↩6 ↩7
-
Anthropic. “Prompting best practices.” Claude Platform Docs, accessed Jan 11, 2026. https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/claude-4-best-practices ↩ ↩2 ↩3 ↩4 ↩5
-
Anthropic. “Setup Guide — Using a Custom GitHub App.” Claude Code Action (GitHub), accessed Jan 11, 2026. https://github.com/anthropics/claude-code-action/blob/main/docs/setup.md ↩ ↩2 ↩3
Other Ideas