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 doctorChỉnh cấu hình settings.json
2. Chạy Claude Code
Interactive mode
Start 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
/clear
/compact
/btw
/init
/memory
/permissions
/agents
/mcp
Thêm MCP server
Xoá MCP server
Kiểm tra MCP server
/diff
/doctor
/sandbox
/security-review
6. 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
Atlassian MCP — API Token (HTTP transport)
Windows PowerShell — base64
Kiểm tra
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
TrướcMở rộng Claude Code — Skills, Hooks, Subagents và MCPTiếp theoSo sánh OpenCode và Claude Code: Nên chọn AI Coding Agent nào?
Cập nhật lần cuối