DEV Community

naoki_JPN
naoki_JPN

Posted on • Originally published at zenn.dev

Practical Tips and Tricks for Claude Code: Mastering AI-Powered Development

Introduction

Claude Code represents a new generation of AI-powered development assistants. Unlike earlier tools focused on completing individual lines of code, Claude Code is fully agentic—designed to handle entire features, functions, and complex bugs simultaneously.

Boris Cherny, a technical staff member at Anthropic and creator of Claude Code, shares practical insights on how to leverage this powerful tool effectively in real-world development workflows. Whether you're new to Claude Code or looking to maximize its potential, these tips and tricks will transform how you approach development tasks.

What sets Claude Code apart is its integration with your existing workflow. You don't need to abandon your IDE or terminal environment. Claude Code works seamlessly with VS Code, Xcode, JetBrains IDEs, and any terminal setup, whether local or remote via SSH.

Claude Code in Action

Getting Started: Essential Setup and Configuration

Initial Setup Steps

When first launching Claude Code, Boris recommends taking time to properly configure your environment:

Terminal Configuration: Run terminal setup to enable shift-enter for new lines, making multi-line input more natural without awkward backslash escapes.

Theme Selection: Use /theme to configure your preferred appearance (light, dark, or custom themes).

GitHub Integration: Execute /install for the new GitHub App integration, allowing you to mention Claude Code directly in GitHub issues and pull requests.

Tool Customization: Configure allowed tools to prevent repetitive permission prompts for tools you use frequently.

Accessibility Features: Enable dictation on macOS through system settings under accessibility. This allows you to speak prompts directly using the dictation key—a powerful feature for hands-free development when typing feels tedious.

Configuration Philosophy

Claude Code is intentionally designed as a power tool without guardrails that funnel you toward a specific workflow. This flexibility means you need to establish your own patterns. The good news is that setup time invested upfront pays dividends in productivity.

The Foundation: Code-Based Question and Answering

Why Start with Q&A

Boris's primary recommendation: Start with code-based question and answering. Don't jump immediately to code generation or editing—begin by asking questions about your codebase.

This approach revolutionizes technical onboarding. At Anthropic, this method reduced new hire technical onboarding from 2-3 weeks to 2-3 days. Instead of bombarding senior engineers with questions, new developers can ask Claude Code directly about the codebase.

How Claude Code Explores Your Code

Unlike simple text search, Claude Code performs deep analysis:

  • Usage Analysis: Ask how a piece of code is used throughout the codebase. Claude Code finds and contextualizes actual usage examples rather than just text matches.

  • Instantiation Patterns: Inquire about how to properly instantiate classes or use APIs. Claude Code identifies real examples from your codebase showing correct usage.

  • Git History Analysis: Ask why functions have particular signatures or arguments. Claude Code examines git history to understand how features evolved, what issues were addressed, and why decisions were made.

  • GitHub Issue Context: Cross-reference code with GitHub issues for deeper understanding of context and decision-making.

  • Commit Understanding: Retrieve detailed commit messages and surrounding context to understand the "why" behind code decisions.

Privacy and Performance Benefits

An important advantage: Claude Code performs no indexing. Your code remains entirely local—it's never uploaded to remote databases or used for model training. There's no setup latency. Start Claude Code, begin asking questions immediately. This architectural choice prioritizes both security and responsiveness.

Progressing to Code Editing

Understanding Agentic Code Editing

Once comfortable with Q&A, the next step is code editing. Claude Code is given a minimal set of tools:

  • File editing capabilities
  • Bash command execution
  • File searching

What's remarkable is how these simple tools combine effectively. You don't specify which tools to use—you simply describe what you want, and Claude Code sequences the tools intelligently to accomplish your goals.

The Planning Pattern

Before Claude Code writes significant code, ask it to brainstorm and create plans. This practice prevents wasted effort:

  • Request Planning First: "Before writing code, make a plan. Let me review it before you proceed."
  • Iterative Refinement: Discuss and refine the approach
  • Approval Before Implementation: Only after agreement does Claude Code write code

This might seem like extra steps, but it prevents the common scenario where Claude Code builds something incorrect that requires rework.

Common Effective Incantations

Certain prompting patterns become standard:

"Commit and push for me": This seemingly simple request causes Claude Code to:

  • Examine code changes
  • Look at git history to understand commit conventions
  • Create appropriately formatted commits
  • Push to the current branch
  • Create a pull request on GitHub

All without explicit instruction—Claude Code figures this out because the underlying model is capable of understanding developer intent.

Claude Code Workflow

Integrating Your Team's Tools

Tool Categories

As you advance, teaching Claude Code about your team's tools becomes crucial. Two primary categories exist:

CLIs and Scripts: Tell Claude Code about custom command-line tools. Use help flags to let it discover how to use them. For frequently-used tools, document them in your Claude.md file (covered below).

MCP (Model Context Protocol) Servers: Claude Code integrates with MCP servers, giving it access to standardized tool interfaces your team already uses.

The Power of Tool Integration

When Claude Code understands your team's tools, it becomes exponentially more powerful. New engineers joining the codebase can access all tools immediately through Claude Code, eliminating individual setup friction.

Common tool integration patterns:

  • Testing frameworks and runners
  • Deployment and DevOps tools
  • Code analysis and linting tools
  • Custom build systems
  • Monitoring and logging systems

Feedback Loops and Iteration

The Critical Pattern: Verify Before Acting

A powerful workflow pattern:

  1. Claude Code makes a plan
  2. You verify the plan
  3. Claude Code gets approval
  4. Implementation begins

Automated Iteration with Feedback Tools

Where Claude Code truly excels is when you provide feedback mechanisms:

  • Unit Tests: If Claude Code can run unit tests, it can verify its work and iterate automatically
  • Screenshot Testing: Provide screenshot capabilities (via tools like Puppeteer for web, simulators for mobile), and Claude Code will iterate on implementations until they match requirements
  • UI Feedback: For any visual component, tools that provide visual feedback enable automatic iteration

The pattern: Give Claude Code a way to check its work. It will iterate automatically, improving results with each feedback cycle. This often produces near-perfect results after 2-3 iterations.

Workflow Recommendations by Task Type

  • Exploration + Planning: Before code changes, discuss and plan
  • Testing-Driven Development: Enable unit test running for automatic iteration
  • Visual Development: Use screenshots and visual feedback tools for UI development
  • Rapid Iteration: Set up feedback mechanisms for automated refinement

Context Management: The Claude.md System

Understanding Claude.md

As you work deeper with Claude Code, providing context becomes crucial. The Claude.md file system handles this elegantly:

Project-Level Claude.md: Place in your project root (same directory where you run Claude Code). Automatically included in every session.

Local Claude.md: For personal preferences not shared with the team. Keep in .gitignore.

Nested Claude.md Files: Place in subdirectories. Claude Code automatically includes relevant ones when working in those directories.

What Goes in Claude.md

Keep Claude.md concise—it uses context, so excessive documentation wastes tokens. Include:

  • Common bash commands: Frequently-used commands specific to your project
  • Style guides: Link or summarize coding standards
  • Core files: List important files developers should know about
  • Architecture notes: Key architectural decisions
  • Tool documentation: How to use project-specific tools

Anthropic's internal Claude.md for their main codebase includes common commands, style guidelines, and critical files—nothing verbose.

Context Hierarchy

Claude Code respects a hierarchy of context sources:

  1. Project Config: Project-specific settings checked into version control
  2. User Config: Personal settings and preferences
  3. Enterprise Policies: Organization-wide settings applied automatically

Practical Context Management Scenarios

Shared Context: Write Claude.md once, share with your team. Network effects mean one person's effort benefits everyone.

Memory Files: Use /remember to teach Claude Code about patterns it missed. The # symbol lets you save to specific memory files.

Tool Documentation: For tools you use frequently, document how to use them in Claude.md rather than explaining each time.

Permissions Management: Use enterprise policies to pre-approve common commands across your organization, or block dangerous operations universally.

Advanced Features and Keyboard Shortcuts

Essential Keyboard Shortcuts

Terminal interfaces make some features hard to discover. Key shortcuts include:

Shift+Tab: Enter auto-accept edit mode. Bash commands still require approval, but file edits are automatically accepted. Useful when Claude Code is on a roll with test iteration.

# (pound sign): Teach Claude Code something. For example, "# Remember to use the async/await pattern in this codebase." Claude Code incorporates this into memory.

! (exclamation): Drop into bash mode to run a command directly. Output enters the context window, so Claude Code sees both command and results on the next turn. Useful for long-running processes.

Escape: Stop Claude Code at any time. Never corrupts the session. Use for course-correcting mid-task.

Escape Escape (double press): Jump back in conversation history.

Control+R: View full output of Claude Code's current reasoning, matching what Claude Code sees in its context window.

Resume Flag: After closing, run claude code --resume or --continue to resume the previous session.

Claude Code Advanced Features

The Claude Code SDK: Programmatic Access

For advanced users and automation scenarios, the Claude Code SDK provides programmatic access to the same capabilities available in the CLI.

SDK Basics

The SDK can be invoked with:

  • Custom prompts
  • Specified allowed tools
  • Output format options (JSON, streaming JSON, etc.)

Unix Philosophy Integration

Think of Claude Code as a "super-intelligent Unix utility." You can:

claude-code -p "Analyze this data" --tools allow-cmd-execution
Enter fullscreen mode Exit fullscreen mode

Pipe data in and out:

git status | claude-code -p "What changes matter here?"
jq '.data' large-file.json | claude-code -p "Find issues"
Enter fullscreen mode Exit fullscreen mode

The possibilities are nearly endless:

  • Fetch large logs and ask Claude Code for insights
  • Process data from GCP buckets
  • Analyze outputs from monitoring systems
  • Transform data formats automatically

Advanced Multi-Session Patterns

For advanced users, the most productive setup involves multiple Claude Code sessions running in parallel:

  • SSH Sessions: Run Claude Code in remote servers via SSH
  • TMux Tunnels: Manage multiple terminals within a single session
  • Git Worktrees: Use git worktrees for isolation while running multiple Claude Code instances
  • Multiple Checkouts: Clone the same repository multiple times for parallel work

While Anthropic is actively improving parallel session support, power users are already leveraging these patterns to manage significant parallel workloads.

Common Implementation Challenges

When asked about the hardest implementation challenges, Boris highlights the complexity of managing bash command safety:

The Challenge: Bash commands can change system state unexpectedly and require careful handling. Yet requiring approval for every command destroys productivity.

The Solution: Claude Code implements:

  • Read-only command detection
  • Static analysis to identify safely-combinable commands
  • Complex tiered permission systems
  • User-configurable safety levels
  • Enterprise-wide policy enforcement

This approach scales across different coding environments, from Docker containers to bare metal systems.

Multimodal Capabilities

An often-overlooked feature: Claude Code is fully multimodal. You can provide images through:

  • Drag and drop: Drop images directly into the chat
  • File paths: Reference images on your filesystem
  • Copy and paste: Paste images directly

Common use cases:

  • Provide design mockups: Drop a UI mockup image, ask Claude Code to implement it
  • Get iteration feedback: Screenshot results, compare with mockups, request refinements
  • Visual debugging: Share application screenshots for Claude Code to analyze

Integration with Your Existing Tools

Recommended Setup Progression

  1. Start Simple: Master code-base Q&A before moving to editing
  2. Setup Tools Gradually: Add your team's tools incrementally
  3. Build Context: Create project Claude.md incrementally
  4. Leverage Memory: Use /remember to teach Claude Code team-specific patterns
  5. Automate Gradually: Set up feedback loops for iterative improvement

Onboarding Your Team

If introducing Claude Code to your team:

  1. Start everyone with code-base Q&A
  2. Don't jump straight to code generation
  3. Let people experience the tool's capabilities organically
  4. Share useful Claude.md content and memory tips
  5. Build patterns together as a team

Current Usage at Anthropic

As evidence of Claude Code's effectiveness, about 80% of technical staff at Anthropic use Claude Code daily. This includes:

  • Software engineers across all teams
  • Research scientists working with notebooks and scripts
  • DevOps engineers automating infrastructure
  • Data scientists building analysis pipelines
  • System engineers maintaining tooling

The breadth of usage demonstrates Claude Code's versatility and effectiveness across different technical domains.

Key Takeaways

  • Start with Q&A: Before code generation, master question-answering about your codebase
  • Plan Before Implementation: Ask Claude Code to brainstorm and plan before writing significant code
  • Setup Matters: Invest in proper configuration and Claude.md for dramatically better results
  • Context is King: The more context you provide, the smarter Claude Code's decisions
  • Feedback Loops: Provide ways for Claude Code to verify its work, and it will iterate automatically
  • Tool Integration: Teaching Claude Code about your team's tools multiplies its effectiveness
  • Keyboard Shortcuts: Master key shortcuts for faster, more natural interaction
  • No Indexing: Your code stays local and private, never uploaded or used for model training
  • Multi-Modal: Leverage image support for design-driven development and visual feedback
  • Parallel Workflows: Advanced users can run multiple Claude Code sessions for parallel work

Claude Code isn't just an incremental improvement—it's a transformative tool that fundamentally changes how developers approach their work. By mastering these practical tips and tricks, you'll unlock dramatically improved productivity and code quality.

Top comments (0)