A Deep Dive into Claude Code
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
| Feature | Claude Code | Cursor | Aider |
|---|---|---|---|
| Interface | Terminal CLI | IDE GUI | Terminal CLI |
| Backend | Any API | Built-in + API | Any API |
| Git | Native integration | Basic support | Native integration |
| Context | Entire codebase | Current file + embedding | Map-based codebase |
| Cost | API billing | Subscription | API billing |
| Best for | Automation/CI | Everyday coding | Precise editing |
Real-World Case Study: Deploying an Agentic Research Website with Claude Code
The following is the actual usage workflow in this project:
- Start Claude Code:
claude --cwd ~/Desktop/Best\ Agentics\ Website - Feature Development: "Help me add a sidebar component that supports collapse/expand and a mobile drawer."
- Code Review: "Review the changes just made, focusing on responsive layout and accessibility."
- Testing: "Help me test the sidebar's behavior at different screen sizes."
- Deployment: After Claude Code generates the code, manually run
npx vercel --prod
Recommended Reading
- Claude Code Dual-Model Configuration Guide, switching between DeepSeek and ModelStudio
- Junze Zhiku Slash Command System, CC integration commands
More in Tools
- PaddleOCR in Practice: Extracting Hong Kong Stock Annual Report Financial Data in 83 Seconds
- Webb-Site: The Essential Hidden Treasure for Hong Kong Stock Research, a One-Click Tool to Get Annual Report PDFs for All Listed Companies
- Academic Research Skills Deep Technical Breakdown: How 45+ Agents Collaborate to Complete the Full Workflow from Literature Review to Peer Review
- AI Engineering from Scratch Deep Dive: 435 Lessons × 20 Stages