Agentic Research

A Deep Dive into Claude Code

2026/05/1010 min readBryan Chan閱讀中文原文
TopicsClaude CodeToolsTutorial

Introduction

Claude Code is Anthropic's command-line AI coding assistant. It runs directly in the terminal, but can point to any OpenAI API-compatible backend (DeepSeek, ModelStudio, Ollama, etc.), without having to use the Anthropic API.

  • Read and edit entire codebases
  • Execute shell commands
  • Manage Git workflows
  • Refactor across files

Installation

npm install -g @anthropic-ai/claude-code

Or via Homebrew:

brew install claude-code

Pointing to DeepSeek / ModelStudio

Create ~/.claude.json:

{
  "apiKey": "sk-your-deepseek-key",
  "baseURL": "https://api.deepseek.com/v1",
  "model": "deepseek-chat"
}

DeepSeek currently offers two versions: V4 Flash ($0.14/M input) and V4 Pro. For everyday use, V4 Flash is recommended; for complex tasks, V4 Pro.

Core Usage

Interactive Mode

claude

After entering the interactive REPL, you can chat directly, and Claude will read the codebase in the current directory.

Single Command

claude -p "Explain the logic of this function" --output-format text

-p is non-interactive mode, suitable for scripts and CI.

Specify Working Directory

claude --cwd ~/my-project

Practical Tips

1. CLAUDE.md Project Conventions

In the project root, create CLAUDE.md, and write a project introduction, tech stack, coding style, and common commands. Claude Code automatically reads it as a system prompt.

2. /compact to Free Up Context

When a conversation gets too long, use /compact to compress the history and retain key information.

3. Custom Slash Commands

Create a .md file under ~/.claude/commands/ to define custom commands, for example review.md, then invoke it with /review.

4. Git Integration

claude -p "generate a commit message for my staged changes"
claude -p "review the diff against main"

Comparison: Claude Code vs Cursor vs Aider

FeatureClaude CodeCursorAider
InterfaceTerminal CLIIDE GUITerminal CLI
BackendAny APIBuilt-in + APIAny API
GitNative integrationBasic supportNative integration
ContextEntire codebaseCurrent file + embeddingMap-based codebase
CostAPI billingSubscriptionAPI billing
Best forAutomation/CIEveryday codingPrecise editing

Real-World Case Study: Deploying an Agentic Research Website with Claude Code

The following is the actual usage workflow in this project:

  1. Start Claude Code: claude --cwd ~/Desktop/Best\ Agentics\ Website
  2. Feature Development: "Help me add a sidebar component that supports collapse/expand and a mobile drawer."
  3. Code Review: "Review the changes just made, focusing on responsive layout and accessibility."
  4. Testing: "Help me test the sidebar's behavior at different screen sizes."
  5. Deployment: After Claude Code generates the code, manually run npx vercel --prod

Recommended Reading