Tool này là gì?
Claude Code là CLI tool của Anthropic — chạy trong terminal (zsh/bash), kết nối với Claude (Opus 4.7, Sonnet 4.5). Nó hiểu cả codebase, đọc/sửa nhiều file, chạy command, debug, commit, mở PR — không cần IDE.
2025, Claude Code trở thành "agent coding standard" cho dev senior — đặc biệt cho task headless / automated: refactor lớn, generate documentation, migrate codebase. Nhiều team CI/CD đã hook Claude Code vào pipeline thay vì script tay.
Cho PM: nếu bạn quen terminal, Claude Code là tool mạnh nhất để build internal tool nhanh và automate workflow code-heavy mà không phải mở IDE.
Khi nào nên dùng
- Refactor codebase lớn: "rename function X → Y trong toàn repo, update test, đảm bảo build pass" — chạy 1 command, AI làm hết.
- Headless automation: CI job dùng Claude Code review PR, gen release note, update changelog.
- Migrate stack: Vue 2 → Vue 3, JS → TS, REST → GraphQL — Claude Code chia thành sub-task và xử lý từng file.
- Build internal tool nhanh từ terminal: không cần IDE setup, vẫn ship được.
- Code review trước commit: "review diff stage hiện tại, flag security risk" — chạy như precommit hook.
Khi nào KHÔNG nên dùng
- Bạn không quen terminal — Cursor có GUI dễ tiếp cận hơn.
- Task code 1 dòng nhỏ — overkill, dùng Claude web đủ.
- Cần collab realtime nhiều người cùng file — Claude Code là solo-mode.
- Project có IDE-specific feature (Xcode iOS, Android Studio) — Claude Code không hiểu sâu IDE-bound flow.
Workflow tiêu biểu
flowchart LR
A[Mở terminal trong
repo] --> B[Chạy 'claude']
B --> C[Mô tả task]
C --> D[Claude index codebase
+ propose plan]
D --> E{Plan OK?}
E -->|Edit| F[Refine task]
E -->|OK| G[Auto-execute
edit nhiều file]
F --> C
G --> H[Run test / build]
H --> I{Pass?}
I -->|Fail| J[Auto-debug]
I -->|Pass| K[Commit + PR]
J --> G
Killer feature: Claude Code có thể chạy command (npm test, git diff, curl) và đọc output, tự debug. Không chỉ "edit file" — nó "làm việc" như 1 junior dev autonomous.
Prompt mẫu
(Trong terminal, sau khi 'claude' khởi động)
Task: Migrate toàn bộ component class-based React sang
function + hooks.
Quy tắc:
1. Mỗi component giữ nguyên props interface
2. Lifecycle method (componentDidMount, etc.) chuyển sang
useEffect tương ứng
3. Update test (jest), giữ snapshot pass
4. Commit từng component thành 1 commit riêng,
message format: 'refactor(comp): convert X to hooks'
Không touch business logic. Báo cáo file nào không
migrate được + lý do.
Generate API documentation:
1. Đọc mọi file trong src/api/
2. Extract endpoint (method + path + params + response)
3. Generate file docs/API.md (OpenAPI-style markdown)
4. Add example curl cho mỗi endpoint
5. Diff vs version cũ, list endpoint mới / removed
Mẹo nâng cao
Kết hợp với công cụ khác
flowchart LR
A[Cursor
daily edit] -->|task lớn| B[Claude Code
headless agent]
B --> C[Git commit + PR]
C --> D[GitHub Actions
+ Claude Code review]
D --> E[Merge production]
Cursor (IDE) + Claude Code (CLI) là combo phổ biến — Cursor cho daily edit có feel UI, Claude Code cho task headless automated.
So với alternatives
| So với | Mạnh hơn ở | Yếu hơn ở |
|---|---|---|
| Cursor | Headless / CI-friendly, không cần GUI, automate được | Cursor có UI dễ tiếp cận hơn cho non-dev |
| GitHub Copilot Workspace | Multi-step reasoning sâu hơn, tool ecosystem mạnh hơn (MCP) | Copilot Workspace tích hợp GitHub PR sâu hơn |
| Aider (open source) | Model Claude mạnh hơn baseline, skill/MCP framework | Aider miễn phí + open source, customize sâu hơn |
Tài nguyên thêm
- Official: anthropic.com/claude-code
- Docs: docs.claude.com/claude-code
- Best-practice: blog "Claude Code best practices" của Anthropic engineering.