Claude Code Cheatsheet (2026)
Tài liệu tổng hợp nhanh các lệnh, workflow và mẹo dùng [Claude Code Docs](https://code.claude.com/docs/en/commands) và CLI thực chiến.
1. Cài đặt
Install
npm install -g @anthropic-ai/claude-codeUpdate
claude updateKiểm tra cài đặt
claude doctor2. Chạy Claude Code
Interactive mode
claudeStart với prompt ban đầu
One-shot mode
Pipe dữ liệu vào Claude
3. Session Management
Continue phiên gần nhất
Continue + prompt mới
Resume bằng session ID
Export conversation
4. Slash Commands Quan Trọng
/help
/help/clear
/clear/compact
/compact/btw
/btw/init
/init/memory
/memory/permissions
/permissions/agents
/agents/mcp
/mcp/diff
/diff/doctor
/doctor/sandbox
/sandbox/security-review
/security-review6. Shell Mode
Chạy shell command trực tiếp
7. MCP (Model Context Protocol)
Kiểm tra danh sách MCP hiện có
Thêm MCP server qua HTTP
Xoá MCP server
Xác thực bằng API Key
Xác thực bằng username/password
8. CLAUDE.md Best Practices
CLAUDE.md là gì?
Nên chứa gì?
Project structure
Coding conventions
Useful commands
Workflow
9. Workflow Khuyên Dùng
Khi vào repo mới
Khi context dài
Khi Claude bắt đầu “ngu”
Với task lớn
Với refactor nguy hiểm
10. Tips Thực Chiến
1. Prompt tốt hơn
2. Luôn yêu cầu plan trước
3. Hạn chế hallucination
4. Force search trước khi edit
5. Với monorepo
11. Automation Examples
Git diff review
Generate commit message
Analyze logs
Generate release notes
12. Context Window Tips
13. Recommended Workflow
Small fix
Feature lớn
Safe refactor
14. Tài liệu chính thức
Cập nhật lần cuối