diff --git a/vi/01-slash-commands/README.md b/vi/01-slash-commands/README.md index cc62d3b..8851b59 100644 --- a/vi/01-slash-commands/README.md +++ b/vi/01-slash-commands/README.md @@ -18,7 +18,7 @@ Lệnh slash là các lối tắt để điều khiển hành vi của Claude tr ## Tham Khảo Lệnh Tích Hợp Sẵn -Lệnh tích hợp sẵn là các lối tắt cho các hành động phổ biến. Có **55+ lệnh tích hợp sẵn** và **5 skills được gói** sẵn. Gõ `/` trong Claude Code để xem danh sách đầy đủ, hoặc gõ `/` theo sau bởi bất kỳ chữ cái nào để lọc. +Lệnh tích hợp sẵn là các lối tắt cho các hành động phổ biến. Có **60+ lệnh tích hợp sẵn** và **5 skills được gói** sẵn. Gõ `/` trong Claude Code để xem danh sách đầy đủ, hoặc gõ `/` theo sau bởi bất kỳ chữ cái nào để lọc. | Lệnh | Mục Đích | |---------|---------| @@ -61,7 +61,7 @@ Lệnh tích hợp sẵn là các lối tắt cho các hành động phổ biế | `/permissions` | Xem/cập nhật quyền (bí danh: `/allowed-tools`) | | `/plan [description]` | Nhập chế độ lập kế hoạch | | `/plugin` | Quản lý plugins | -| `/pr-comments [PR]` | Lấy bình luận GitHub PR | +| `/powerup` | Khám phá tính năng thông qua các bài học tương tác với demo hoạt hình | | `/privacy-settings` | Cài đặt quyền riêng tư (chỉ Pro/Max) | | `/release-notes` | Xem changelog | | `/reload-plugins` | Tải lại các plugins hoạt động | @@ -76,12 +76,14 @@ Lệnh tích hợp sẵn là các lối tắt cho các hành động phổ biế | `/security-review` | Phân tích nhánh để tìm lỗ hổng bảo mật | | `/skills` | Liệt kê các skills có sẵn | | `/stats` | Trực quan hóa việc sử dụng hàng ngày, các phiên, chuỗi ngày | +| `/stickers` | Đặt sticker Claude Code | | `/status` | Hiển thị phiên bản, mô hình, tài khoản | | `/statusline` | Cấu hình dòng trạng thái | | `/tasks` | Liệt kê/quản lý các tác vụ nền | | `/terminal-setup` | Cấu hình terminal keybindings | | `/theme` | Thay đổi chủ đề màu | -| `/vim` | Bật/tắt các chế độ Vim/Normal | +| `/ultraplan ` | Soạn kế hoạch trong ultraplan session, xem trong trình duyệt | +| `/upgrade` | Mở trang nâng cấp cho tier cao hơn | | `/voice` | Bật/tắt nhập liệu giọng nói push-to-talk | ### Skills Được Gói Sẵn @@ -103,16 +105,23 @@ Những skills này được gửi kèm với Claude Code và được gọi nh | `/review` | Đã lỗi thời — được thay thế bởi plugin `code-review` | | `/output-style` | Đã lỗi thời kể từ v2.1.73 | | `/fork` | Đổi tên thành `/branch` (bí danh vẫn hoạt động, v2.1.77) | +| `/pr-comments` | Đã xóa trong v2.1.91 — hỏi Claude trực tiếp để xem bình luận PR | +| `/vim` | Đã xóa trong v2.1.92 — sử dụng /config → Editor mode | ### Thay Đổi Gần Đây -- `/fork` đổi tên thành `/branch` với `/fork` được giữ lại sebagai bí danh (v2.1.77) +- `/fork` đổi tên thành `/branch` với `/fork` được giữ lại làm bí danh (v2.1.77) - `/output-style` đã lỗi thời (v2.1.73) - `/review` đã lỗi thời thay vào đó là plugin `code-review` - Lệnh `/effort` được thêm với mức `max` yêu cầu Opus 4.6 - Lệnh `/voice` được thêm cho nhập liệu giọng nói push-to-talk - Lệnh `/schedule` được thêm để tạo/quản lý các tác vụ định kỳ - Lệnh `/color` được thêm để tùy chỉnh thanh prompt +- `/pr-comments` đã xóa trong v2.1.91 — hỏi Claude trực tiếp để xem bình luận PR +- `/vim` đã xóa trong v2.1.92 — sử dụng /config → Editor mode thay thế +- `/ultraplan` được thêm để xem và thực thi kế hoạch trong trình duyệt +- `/powerup` được thêm để học tính năng tương tác +- `/sandbox` được thêm để bật/tắt chế độ sandbox - Bộ chọn `/model` hiện hiển thị nhãn dễ đọc cho con người (ví dụ: "Sonnet 4.6") thay vì ID mô hình thô - `/resume` hỗ trợ bí danh `/continue` - MCP prompts có sẵn dưới dạng các lệnh `/mcp____` (xem [MCP Prompts dưới dạng Lệnh](#mcp-prompts-dưới-dạng-lệnh)) @@ -152,7 +161,7 @@ Skills cung cấp các tính năng bổ sung so với lệnh legacy: - **Thực thi tác nhân con**: Chạy skills trong các bối cảnh cô lập với `context: fork` - **Tiết lộ từng bước**: Tải các files bổ sung chỉ khi cần thiết -### Tạo Một Lệnh Tùy Chỉ dưới dạng Skill +### Tạo Một Lệnh Tùy Chỉnh dưới dạng Skill Tạo một thư mục với file `SKILL.md`: @@ -549,4 +558,8 @@ Nếu cả hai tồn tại với cùng tên, **skill sẽ được ưu tiên**. --- +**Cập Nhật Lần Cuối**: Tháng 4 năm 2026 +**Phiên Bản Claude Code**: 2.1+ +**Các Mô Hình Tương Thích**: Claude Sonnet 4.6, Claude Opus 4.6, Claude Haiku 4.5 + *Phần của series hướng dẫn [Claude How To](../)* diff --git a/vi/01-slash-commands/pr-slash-command.png b/vi/01-slash-commands/pr-slash-command.png new file mode 100644 index 0000000..789e5c2 Binary files /dev/null and b/vi/01-slash-commands/pr-slash-command.png differ diff --git a/vi/02-memory/README.md b/vi/02-memory/README.md index 269b1ba..e5351e4 100644 --- a/vi/02-memory/README.md +++ b/vi/02-memory/README.md @@ -1151,3 +1151,9 @@ Claude sẽ nhắc bạn chọn file bộ nhớ nào để cập nhật. ### Các Tính Năng Claude Liên Quan - [Bộ Nhớ Claude Web](https://claude.ai) - Tổng hợp tự động - [Tài Liệu Bộ Nhớ Chính Thức](https://code.claude.com/docs/en/memory) - Tài liệu Anthropic + +--- + +**Cập Nhật Lần Cuối**: Tháng 4 năm 2026 +**Phiên Bản Claude Code**: 2.1+ +**Các Mô Hình Tương Thích**: Claude Sonnet 4.6, Claude Opus 4.6, Claude Haiku 4.5 diff --git a/vi/02-memory/memory-ask-claude.png b/vi/02-memory/memory-ask-claude.png new file mode 100644 index 0000000..b202227 Binary files /dev/null and b/vi/02-memory/memory-ask-claude.png differ diff --git a/vi/02-memory/memory-saved.png b/vi/02-memory/memory-saved.png new file mode 100644 index 0000000..1c16eb7 Binary files /dev/null and b/vi/02-memory/memory-saved.png differ diff --git a/vi/03-skills/README.md b/vi/03-skills/README.md index ebec6b0..57ed6ee 100644 --- a/vi/03-skills/README.md +++ b/vi/03-skills/README.md @@ -802,3 +802,9 @@ Khi bạn bắt đầu xây dựng skills một cách nghiêm túc, hai điều - [Hướng Dẫn Bộ Nhớ](../02-memory/) - Bối cảnh liên tục - [MCP (Model Context Protocol)](../05-mcp/) - Dữ liệu bên ngoài thời gian thực - [Hướng Dẫn Hooks](../06-hooks/) - Tự động hóa dựa trên sự kiện + +--- + +**Cập Nhật Lần Cuối**: Tháng 4 năm 2026 +**Phiên Bản Claude Code**: 2.1+ +**Các Mô Hình Tương Thích**: Claude Sonnet 4.6, Claude Opus 4.6, Claude Haiku 4.5 diff --git a/vi/04-subagents/README.md b/vi/04-subagents/README.md index ed7247d..4e38d38 100644 --- a/vi/04-subagents/README.md +++ b/vi/04-subagents/README.md @@ -571,7 +571,9 @@ Lệnh này: Agent Teams điều phối nhiều phiên Claude Code hoạt động cùng nhau trên các tác vụ phức tạp. Không giống tác nhân con (được ủy quyền subtask và trả về kết quả), đồng nghiệp hoạt động độc lập với bối cảnh của riêng và giao tiếp trực tiếp qua hệ thống mailbox chia sẻ. -> **Lưu ý**: Agent Teams là thử nghiệm và yêu cầu Claude Code v2.1.32+. Bật trước khi sử dụng. +> **Tài Liệu Chính Thức**: [code.claude.com/docs/en/agent-teams](https://code.claude.com/docs/en/agent-teams) + +> **Lưu ý**: Agent Teams là thử nghiệm và bị tắt theo mặc định. Yêu cầu Claude Code v2.1.32+. Bật trước khi sử dụng. ### Subagents vs Agent Teams @@ -597,7 +599,7 @@ Hoặc trong `settings.json`: ```json { "env": { - "CLAUDE_EXPERIMENTAL_AGENT_TEAMS": "1" + "CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS": "1" } } ``` @@ -1136,6 +1138,6 @@ graph TD --- -*Cập nhật lần cuối: Tháng 3 năm 2026* - -*Hướng dẫn này bao gồm cấu hình tác nhân con hoàn chỉnh, các mẫu ủy quyền, và thực hành tốt nhất cho Claude Code.* +**Cập Nhật Lần Cuối**: Tháng 4 năm 2026 +**Phiên Bản Claude Code**: 2.1+ +**Các Mô Hình Tương Thích**: Claude Sonnet 4.6, Claude Opus 4.6, Claude Haiku 4.5 diff --git a/vi/05-mcp/README.md b/vi/05-mcp/README.md index 89551bd..1f5f381 100644 --- a/vi/05-mcp/README.md +++ b/vi/05-mcp/README.md @@ -1110,3 +1110,9 @@ export GITHUB_TOKEN="your_token" - [Code Execution with MCP](https://www.anthropic.com/engineering/code-execution-with-mcp) — Blog kỹ thuật Anthropic về giải quyết context bloat - [CLI Reference Claude Code](https://code.claude.com/docs/en/cli-reference) - [Tài Liệu API Claude](https://docs.anthropic.com) + +--- + +**Cập Nhật Lần Cuối**: Tháng 4 năm 2026 +**Phiên Bản Claude Code**: 2.1+ +**Các Mô Hình Tương Thích**: Claude Sonnet 4.6, Claude Opus 4.6, Claude Haiku 4.5 diff --git a/vi/06-hooks/README.md b/vi/06-hooks/README.md index fb53d5e..22d5778 100644 --- a/vi/06-hooks/README.md +++ b/vi/06-hooks/README.md @@ -826,3 +826,9 @@ Chỉnh sửa `~/.claude/settings.json` hoặc `.claude/settings.json` với c - **[Tài Liệu Hooks Chính Thức](https://code.claude.com/docs/en/hooks)** - Tham chiếu hooks hoàn chỉnh - **[CLI Reference](https://code.claude.com/docs/en/cli-reference)** - Tài liệu giao diện dòng lệnh - **[Hướng Dẫn Memory](../02-memory/)** - Cấu hình ngữ cảnh liên tục + +--- + +**Cập Nhật Lần Cuối**: Tháng 4 năm 2026 +**Phiên Bản Claude Code**: 2.1+ +**Các Mô Hình Tương Thích**: Claude Sonnet 4.6, Claude Opus 4.6, Claude Haiku 4.5 diff --git a/vi/07-plugins/README.md b/vi/07-plugins/README.md index e6f9aed..0dead1b 100644 --- a/vi/07-plugins/README.md +++ b/vi/07-plugins/README.md @@ -941,3 +941,9 @@ Các tính năng Claude Code sau hoạt động cùng với plugins: - [MCP Server Reference](https://modelcontextprotocol.io/) - [Hướng Dẫn Cấu Hình Subagent](../04-subagents/README.md) - [Hệ Thống Hook Reference](../06-hooks/README.md) + +--- + +**Cập Nhật Lần Cuối**: Tháng 4 năm 2026 +**Phiên Bản Claude Code**: 2.1+ +**Các Mô Hình Tương Thích**: Claude Sonnet 4.6, Claude Opus 4.6, Claude Haiku 4.5 diff --git a/vi/08-checkpoints/README.md b/vi/08-checkpoints/README.md index d1f079b..21294c3 100644 --- a/vi/08-checkpoints/README.md +++ b/vi/08-checkpoints/README.md @@ -297,3 +297,9 @@ Checkpoints cho phép bạn quay lại — nhưng làm thế nào bạn biết * - [Tài Liệu Checkpointing Chính Thức](https://code.claude.com/docs/en/checkpointing) - [Hướng Dẫn Tính Năng Nâng Cao](../09-advanced-features/) - Extended thinking và các khả năng khác + +--- + +**Cập Nhật Lần Cuối**: Tháng 4 năm 2026 +**Phiên Bản Claude Code**: 2.1+ +**Các Mô Hình Tương Thích**: Claude Sonnet 4.6, Claude Opus 4.6, Claude Haiku 4.5 diff --git a/vi/09-advanced-features/README.md b/vi/09-advanced-features/README.md index 817d597..825feef 100644 --- a/vi/09-advanced-features/README.md +++ b/vi/09-advanced-features/README.md @@ -1869,3 +1869,10 @@ For more information about Claude Code and related features: - [Official Remote Control Documentation](https://code.claude.com/docs/en/remote-control) - [Official Keybindings Documentation](https://code.claude.com/docs/en/keybindings) - [Official Desktop App Documentation](https://code.claude.com/docs/en/desktop) +- [Official Agent Teams Documentation](https://code.claude.com/docs/en/agent-teams) + +--- + +**Cập Nhật Lần Cuối**: Tháng 4 năm 2026 +**Phiên Bản Claude Code**: 2.1+ +**Các Mô Hình Tương Thích**: Claude Sonnet 4.6, Claude Opus 4.6, Claude Haiku 4.5 diff --git a/vi/10-cli/README.md b/vi/10-cli/README.md index 24aa71d..f721dd6 100644 --- a/vi/10-cli/README.md +++ b/vi/10-cli/README.md @@ -131,7 +131,7 @@ claude -p --model opus --fallback-model sonnet "analyze architecture" claude --model opusplan "design and implement the caching layer" ``` -## Tùy Chọn System Prompt / System Prompt Customization +## Tùy Chỉnh System Prompt / System Prompt Customization | Cờ | Mô Tả | Ví Dụ | |------|-------------|---------| @@ -139,6 +139,29 @@ claude --model opusplan "design and implement the caching layer" | `--system-prompt-file` | Tải prompt từ file (chế độ in) | `claude -p --system-prompt-file ./prompt.txt "query"` | | `--append-system-prompt` | Append vào prompt mặc định | `claude --append-system-prompt "Always use TypeScript"` | +### Ví Dụ System Prompt / System Prompt Examples + +```bash +# Complete custom persona +claude --system-prompt "You are a senior security engineer. Focus on vulnerabilities." + +# Append specific instructions +claude --append-system-prompt "Always include unit tests with code examples" + +# Load complex prompt from file +claude -p --system-prompt-file ./prompts/code-reviewer.txt "review main.py" +``` + +### So Sánh Các Cờ System Prompt / System Prompt Flags Comparison + +| Cờ | Hành Vi | Interactive | Print | +|------|----------|-------------|-------| +| `--system-prompt` | Thay thế toàn bộ system prompt | ✅ | ✅ | +| `--system-prompt-file` | Thay thế bằng prompt từ file | ❌ | ✅ | +| `--append-system-prompt` | Thêm vào system prompt mặc định | ✅ | ✅ | + +**Chỉ sử dụng `--system-prompt-file` trong chế độ in. Trong chế độ tương tác, sử dụng `--system-prompt` hoặc `--append-system-prompt`.** + ## Công Cụ & Quản Lý Quyền / Tool & Permission Management | Cờ | Mô Tả | Ví Dụ | @@ -175,10 +198,641 @@ claude --disallowedTools "Bash(rm -rf:*)" "Bash(git push --force:*)" | `--input-format` | Chỉ định định dạng đầu vào (chế độ in) | `text`, `stream-json` | `claude -p --input-format stream-json` | | `--verbose` | Bật ghi nhật chi tiết | | `claude --verbose` | | `--include-partial-messages` | Bao gồm các sự kiện streaming | Yêu cầu `stream-json` | `claude -p --output-format stream-json --include-partial-messages "query"` | +| `--json-schema` | Nhận JSON được validate theo schema | | `claude -p --json-schema '{"type":"object"}' "query"` | +| `--max-budget-usd` | Giới hạn chi phí tối đa cho chế độ in | | `claude -p --max-budget-usd 5.00 "query"` | + +### Ví Dụ Định Dạng Đầu Ra / Output Format Examples + +```bash +# Plain text (mặc định) +claude -p "explain this code" + +# JSON cho sử dụng lập trình +claude -p --output-format json "list all functions in main.py" + +# Streaming JSON để xử lý real-time +claude -p --output-format stream-json "generate a long report" + +# Structured output với schema validation +claude -p --json-schema '{"type":"object","properties":{"bugs":{"type":"array"}}}' \ + "find bugs in this code and return as JSON" +``` + +## Workspace & Thư Mục / Workspace & Directory + +| Cờ | Mô Tả | Ví Dụ | +|------|-------------|---------| +| `--add-dir` | Thêm thư mục làm việc bổ sung | `claude --add-dir ../apps ../lib` | +| `--setting-sources` | Nguồn cài đặt phân cách bằng dấu phẩy | `claude --setting-sources user,project` | +| `--settings` | Tải cài đặt từ file hoặc JSON | `claude --settings ./settings.json` | +| `--plugin-dir` | Tải plugins từ thư mục (có thể lặp lại) | `claude --plugin-dir ./my-plugin` | + +### Ví Dụ Đa Thư Mục / Multi-Directory Example + +```bash +# Làm việc trên nhiều thư mục project +claude --add-dir ../frontend ../backend ../shared "find all API endpoints" + +# Tải custom settings +claude --settings '{"model":"opus","verbose":true}' "complex task" +``` + +## Cấu Hình MCP / MCP Configuration + +| Cờ | Mô Tả | Ví Dụ | +|------|-------------|---------| +| `--mcp-config` | Tải MCP servers từ JSON | `claude --mcp-config ./mcp.json` | +| `--strict-mcp-config` | Chỉ sử dụng MCP config được chỉ định | `claude --strict-mcp-config --mcp-config ./mcp.json` | +| `--channels` | Đăng ký các plugin kênh MCP | `claude --channels discord,telegram` | + +### Ví Dụ MCP / MCP Examples + +```bash +# Tải GitHub MCP server +claude --mcp-config ./github-mcp.json "list open PRs" + +# Strict mode - chỉ servers được chỉ định +claude --strict-mcp-config --mcp-config ./production-mcp.json "deploy to staging" +``` + +## Quản Lý Session / Session Management + +| Cờ | Mô Tả | Ví Dụ | +|------|-------------|---------| +| `--session-id` | Sử dụng session ID cụ thể (UUID) | `claude --session-id "550e8400-..."` | +| `--fork-session` | Tạo session mới khi resume | `claude --resume abc123 --fork-session` | + +### Ví Dụ Session / Session Examples + +```bash +# Tiếp tục hội thoại cuối +claude -c + +# Resume named session +claude -r "feature-auth" "continue implementing login" + +# Fork session để thử nghiệm +claude --resume feature-auth --fork-session "try alternative approach" + +# Sử dụng specific session ID +claude --session-id "550e8400-e29b-41d4-a716-446655440000" "continue" +``` + +### Session Fork + +Tạo một nhánh từ session hiện có để thử nghiệm: + +```bash +# Fork một session để thử cách tiếp cận khác +claude --resume abc123 --fork-session "try alternative implementation" + +# Fork với custom message +claude -r "feature-auth" --fork-session "test with different architecture" +``` + +**Trường Hợp Sử Dụng:** +- Thử các implementation khác mà không mất session gốc +- Thử nghiệm với các cách tiếp cận khác nhau song song +- Tạo các nhánh từ công việc thành công cho các biến thể +- Test các thay đổi breaking mà không ảnh hưởng đến main session + +Session gốc vẫn không thay đổi, và fork trở thành một session độc lập mới. + +## Tính Năng Nâng Cao / Advanced Features + +| Cờ | Mô Tả | Ví Dụ | +|------|-------------|---------| +| `--chrome` | Bật tích hợp trình duyệt Chrome | `claude --chrome` | +| `--no-chrome` | Tắt tích hợp trình duyệt Chrome | `claude --no-chrome` | +| `--ide` | Tự động kết nối đến IDE nếu có | `claude --ide` | +| `--max-turns` | Giới hạn agentic turns (non-interactive) | `claude -p --max-turns 3 "query"` | +| `--debug` | Bật debug mode với filtering | `claude --debug "api,mcp"` | +| `--enable-lsp-logging` | Bật verbose LSP logging | `claude --enable-lsp-logging` | +| `--betas` | Beta headers cho API requests | `claude --betas interleaved-thinking` | +| `--plugin-dir` | Tải plugins từ thư mục (có thể lặp lại) | `claude --plugin-dir ./my-plugin` | +| `--enable-auto-mode` | Mở khóa chế độ quyền tự động | `claude --enable-auto-mode` | +| `--effort` | Đặt mức độ suy nghĩ | `claude --effort high` | +| `--bare` | Chế độ tối thiểu (bỏ qua hooks, skills, plugins, MCP, auto memory, CLAUDE.md) | `claude --bare` | +| `--channels` | Đăng ký các plugin kênh MCP | `claude --channels discord` | +| `--tmux` | Tạo tmux session cho worktree | `claude --tmux` | +| `--fork-session` | Tạo session ID mới khi resume | `claude --resume abc --fork-session` | +| `--max-budget-usd` | Chi phí tối đa (chế độ in) | `claude -p --max-budget-usd 5.00 "query"` | +| `--json-schema` | Validate JSON output | `claude -p --json-schema '{"type":"object"}' "q"` | + +### Ví Dụ Nâng Cao / Advanced Examples + +```bash +# Giới hạn autonomous actions +claude -p --max-turns 5 "refactor this module" + +# Debug API calls +claude --debug "api" "test query" + +# Bật IDE integration +claude --ide "help me with this file" +``` + +## Cấu Hình Agents / Agents Configuration + +Cờ `--agents` chấp nhận một JSON object định nghĩa custom subagents cho một session. + +### Agents JSON Format + +```json +{ + "agent-name": { + "description": "Required: when to invoke this agent", + "prompt": "Required: system prompt for the agent", + "tools": ["Optional", "array", "of", "tools"], + "model": "optional: sonnet|opus|haiku" + } +} +``` + +**Các Trường Bắt Buộc:** +- `description` - Mô tả tự nhiên khi nào sử dụng agent này +- `prompt` - System prompt định nghĩa role và hành vi của agent + +**Các Trường Tùy Chọn:** +- `tools` - Array của available tools (kế thừa tất cả nếu omit) + - Format: `["Read", "Grep", "Glob", "Bash"]` +- `model` - Model sử dụng: `sonnet`, `opus`, hoặc `haiku` + +### Complete Agents Example + +```json +{ + "code-reviewer": { + "description": "Expert code reviewer. Use proactively after code changes.", + "prompt": "You are a senior code reviewer. Focus on code quality, security, and best practices.", + "tools": ["Read", "Grep", "Glob", "Bash"], + "model": "sonnet" + }, + "debugger": { + "description": "Debugging specialist for errors and test failures.", + "prompt": "You are an expert debugger. Analyze errors, identify root causes, and provide fixes.", + "tools": ["Read", "Edit", "Bash", "Grep"], + "model": "opus" + }, + "documenter": { + "description": "Documentation specialist for generating guides.", + "prompt": "You are a technical writer. Create clear, comprehensive documentation.", + "tools": ["Read", "Write"], + "model": "haiku" + } +} +``` + +### Ví Dụ Lệnh Agents / Agents Command Examples + +```bash +# Define custom agents inline +claude --agents '{ + "security-auditor": { + "description": "Security specialist for vulnerability analysis", + "prompt": "You are a security expert. Find vulnerabilities and suggest fixes.", + "tools": ["Read", "Grep", "Glob"], + "model": "opus" + } +}' "audit this codebase for security issues" + +# Load agents from file +claude --agents "$(cat ~/.claude/agents.json)" "review the auth module" + +# Combine with other flags +claude -p --agents "$(cat agents.json)" --model sonnet "analyze performance" +``` + +### Agent Priority + +Khi nhiều agent definitions tồn tại, chúng được load theo thứ tự ưu tiên này: +1. **CLI-defined** (`--agents` flag) - Session-specific +2. **User-level** (`~/.claude/agents/`) - All projects +3. **Project-level** (`.claude/agents/`) - Current project + +CLI-defined agents override cả user và project agents cho session. + +--- + +## Các Trường Hợp Sử Dụng Giá Trị Cao / High-Value Use Cases + +### 1. Tích Hợp CI/CD + +Sử dụng Claude Code trong CI/CD pipelines để tự động review code, testing, và documentation. + +**GitHub Actions Example:** + +```yaml +name: AI Code Review + +on: [pull_request] + +jobs: + review: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Install Claude Code + run: npm install -g @anthropic-ai/claude-code + + - name: Run Code Review + env: + ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} + run: | + claude -p --output-format json \ + --max-turns 1 \ + "Review the changes in this PR for: + - Security vulnerabilities + - Performance issues + - Code quality + Output as JSON with 'issues' array" > review.json + + - name: Post Review Comment + uses: actions/github-script@v7 + with: + script: | + const fs = require('fs'); + const review = JSON.parse(fs.readFileSync('review.json', 'utf8')); + // Process and post review comments +``` + +**Jenkins Pipeline:** + +```groovy +pipeline { + agent any + stages { + stage('AI Review') { + steps { + sh ''' + claude -p --output-format json \ + --max-turns 3 \ + "Analyze test coverage and suggest missing tests" \ + > coverage-analysis.json + ''' + } + } + } +} +``` + +### 2. Script Piping + +Xử lý files, logs, và data thông qua Claude để phân tích. + +**Phân Tích Log:** + +```bash +# Analyze error logs +tail -1000 /var/log/app/error.log | claude -p "summarize these errors and suggest fixes" + +# Find patterns in access logs +cat access.log | claude -p "identify suspicious access patterns" + +# Analyze git history +git log --oneline -50 | claude -p "summarize recent development activity" +``` + +**Xử Lý Code:** + +```bash +# Review a specific file +cat src/auth.ts | claude -p "review this authentication code for security issues" + +# Generate documentation +cat src/api/*.ts | claude -p "generate API documentation in markdown" + +# Find TODOs and prioritize +grep -r "TODO" src/ | claude -p "prioritize these TODOs by importance" +``` + +### 3. Multi-Session Workflows + +Quản lý các project phức tạp với nhiều conversation threads. + +```bash +# Start a feature branch session +claude -r "feature-auth" "let's implement user authentication" + +# Later, continue the session +claude -r "feature-auth" "add password reset functionality" + +# Fork to try an alternative approach +claude --resume feature-auth --fork-session "try OAuth instead" + +# Switch between different feature sessions +claude -r "feature-payments" "continue with Stripe integration" +``` + +### 4. Custom Agent Configuration + +Định nghĩa specialized agents cho workflows của team bạn. + +```bash +# Save agents config to file +cat > ~/.claude/agents.json << 'EOF' +{ + "reviewer": { + "description": "Code reviewer for PR reviews", + "prompt": "Review code for quality, security, and maintainability.", + "model": "opus" + }, + "documenter": { + "description": "Documentation specialist", + "prompt": "Generate clear, comprehensive documentation.", + "model": "sonnet" + }, + "refactorer": { + "description": "Code refactoring expert", + "prompt": "Suggest and implement clean code refactoring.", + "tools": ["Read", "Edit", "Glob"] + } +} +EOF + +# Use agents in session +claude --agents "$(cat ~/.claude/agents.json)" "review the auth module" +``` + +### 5. Batch Processing + +Xử lý nhiều queries với settings nhất quán. + +```bash +# Process multiple files +for file in src/*.ts; do + echo "Processing $file..." + claude -p --model haiku "summarize this file: $(cat $file)" >> summaries.md +done + +# Batch code review +find src -name "*.py" -exec sh -c ' + echo "## $1" >> review.md + cat "$1" | claude -p "brief code review" >> review.md +' _ {} \; + +# Generate tests for all modules +for module in $(ls src/modules/); do + claude -p "generate unit tests for src/modules/$module" > "tests/$module.test.ts" +done +``` + +### 6. Phát Triển Có Nhận Thức Bảo Mật + +Sử dụng permission controls cho hoạt động an toàn. + +```bash +# Read-only security audit +claude --permission-mode plan \ + --tools "Read,Grep,Glob" \ + "audit this codebase for security vulnerabilities" + +# Block dangerous commands +claude --disallowedTools "Bash(rm:*)" "Bash(curl:*)" "Bash(wget:*)" \ + "help me clean up this project" + +# Restricted automation +claude -p --max-turns 2 \ + --allowedTools "Read" "Glob" \ + "find all hardcoded credentials" +``` + +### 7. JSON API Integration + +Sử dụng Claude như một programmable API cho các công cụ của bạn với `jq` parsing. + +```bash +# Get structured analysis +claude -p --output-format json \ + --json-schema '{"type":"object","properties":{"functions":{"type":"array"},"complexity":{"type":"string"}}}' \ + "analyze main.py and return function list with complexity rating" + +# Integrate with jq for processing +claude -p --output-format json "list all API endpoints" | jq '.endpoints[]' + +# Use in scripts +RESULT=$(claude -p --output-format json "is this code secure? answer with {secure: boolean, issues: []}" < code.py) +if echo "$RESULT" | jq -e '.secure == false' > /dev/null; then + echo "Security issues found!" + echo "$RESULT" | jq '.issues[]' +fi +``` + +### Ví Dụ jq Parsing + +Parse và xử lý JSON output của Claude bằng `jq`: + +```bash +# Extract specific fields +claude -p --output-format json "analyze this code" | jq '.result' + +# Filter array elements +claude -p --output-format json "list issues" | jq -r '.issues[] | select(.severity=="high")' + +# Extract multiple fields +claude -p --output-format json "describe the project" | jq -r '.{name, version, description}' + +# Convert to CSV +claude -p --output-format json "list functions" | jq -r '.functions[] | [.name, .lineCount] | @csv' + +# Conditional processing +claude -p --output-format json "check security" | jq 'if .vulnerabilities | length > 0 then "UNSAFE" else "SAFE" end' + +# Extract nested values +claude -p --output-format json "analyze performance" | jq '.metrics.cpu.usage' + +# Process entire array +claude -p --output-format json "find todos" | jq '.todos | length' + +# Transform output +claude -p --output-format json "list improvements" | jq 'map({title: .title, priority: .priority})' +``` + +--- + +## Các Mô Hình / Models + +Claude Code hỗ trợ nhiều mô hình với các capabilities khác nhau: + +| Mô Hình | ID | Context Window | Ghi Chú | +|-------|-----|----------------|---------| +| Opus 4.6 | `claude-opus-4-6` | 1M tokens | Most capable, adaptive effort levels | +| Sonnet 4.6 | `claude-sonnet-4-6` | 1M tokens | Balanced speed and capability | +| Haiku 4.5 | `claude-haiku-4-5` | 1M tokens | Fastest, best for quick tasks | + +### Chọn Mô Hình / Model Selection + +```bash +# Use short names +claude --model opus "complex architectural review" +claude --model sonnet "implement this feature" +claude --model haiku -p "format this JSON" + +# Use opusplan alias (Opus plans, Sonnet executes) +claude --model opusplan "design and implement the API" + +# Toggle fast mode during session +/fast +``` + +### Effort Levels (Opus 4.6) + +Opus 4.6 hỗ trợ adaptive reasoning với các effort levels: + +```bash +# Set effort level via CLI flag +claude --effort high "complex review" + +# Set effort level via slash command +/effort high + +# Set effort level via environment variable +export CLAUDE_CODE_EFFORT_LEVEL=high # low, medium, high, or max (Opus 4.6 only) +``` + +Từ khóa "ultrathink" trong prompts kích hoạt deep reasoning. Mức `max` effort chỉ dành cho Opus 4.6. + +--- + +## Các Biến Môi Trường Quan Trọng / Key Environment Variables + +| Biến | Mô Tả | +|----------|-------------| +| `ANTHROPIC_API_KEY` | API key cho authentication | +| `ANTHROPIC_MODEL` | Override default model | +| `ANTHROPIC_CUSTOM_MODEL_OPTION` | Custom model option for API | +| `ANTHROPIC_DEFAULT_OPUS_MODEL` | Override default Opus model ID | +| `ANTHROPIC_DEFAULT_SONNET_MODEL` | Override default Sonnet model ID | +| `ANTHROPIC_DEFAULT_HAIKU_MODEL` | Override default Haiku model ID | +| `MAX_THINKING_TOKENS` | Set extended thinking token budget | +| `CLAUDE_CODE_EFFORT_LEVEL` | Set effort level (`low`/`medium`/`high`/`max`) | +| `CLAUDE_CODE_SIMPLE` | Minimal mode, set by `--bare` flag | +| `CLAUDE_CODE_DISABLE_AUTO_MEMORY` | Disable automatic CLAUDE.md updates | +| `CLAUDE_CODE_DISABLE_BACKGROUND_TASKS` | Disable background task execution | +| `CLAUDE_CODE_DISABLE_CRON` | Disable scheduled/cron tasks | +| `CLAUDE_CODE_DISABLE_GIT_INSTRUCTIONS` | Disable git-related instructions | +| `CLAUDE_CODE_DISABLE_TERMINAL_TITLE` | Disable terminal title updates | +| `CLAUDE_CODE_DISABLE_1M_CONTEXT` | Disable 1M token context window | +| `CLAUDE_CODE_DISABLE_NONSTREAMING_FALLBACK` | Disable non-streaming fallback | +| `CLAUDE_CODE_ENABLE_TASKS` | Enable task list feature | +| `CLAUDE_CODE_TASK_LIST_ID` | Named task directory shared across sessions | +| `CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION` | Toggle prompt suggestions (`true`/`false`) | +| `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS` | Enable experimental agent teams | +| `CLAUDE_CODE_NEW_INIT` | Use new initialization flow | +| `CLAUDE_CODE_SUBAGENT_MODEL` | Model for subagent execution | +| `CLAUDE_CODE_PLUGIN_SEED_DIR` | Directory for plugin seed files | +| `CLAUDE_CODE_SUBPROCESS_ENV_SCRUB` | Env vars to scrub from subprocesses | +| `CLAUDE_AUTOCOMPACT_PCT_OVERRIDE` | Override auto-compaction percentage | +| `CLAUDE_STREAM_IDLE_TIMEOUT_MS` | Stream idle timeout in milliseconds | +| `SLASH_COMMAND_TOOL_CHAR_BUDGET` | Character budget for slash command tools | +| `ENABLE_TOOL_SEARCH` | Enable tool search capability | +| `MAX_MCP_OUTPUT_TOKENS` | Maximum tokens for MCP tool output | + +--- + +## Tham Chiếu Nhanh / Quick Reference + +### Các Lệnh Phổ Biến Nhất + +```bash +# Interactive session +claude + +# Quick question +claude -p "how do I..." + +# Continue conversation +claude -c + +# Process a file +cat file.py | claude -p "review this" + +# JSON output for scripts +claude -p --output-format json "query" +``` + +### Kết Hợp Cờ / Flag Combinations + +| Trường Hợp Sử Dụng | Lệnh | +|----------|---------| +| Quick code review | `cat file | claude -p "review"` | +| Structured output | `claude -p --output-format json "query"` | +| Safe exploration | `claude --permission-mode plan` | +| Autonomous with safety | `claude --enable-auto-mode --permission-mode auto` | +| CI/CD integration | `claude -p --max-turns 3 --output-format json` | +| Resume work | `claude -r "session-name"` | +| Custom model | `claude --model opus "complex task"` | +| Minimal mode | `claude --bare "quick query"` | +| Budget-capped run | `claude -p --max-budget-usd 2.00 "analyze code"` | + +--- + +## Xử Lý Sự Cố / Troubleshooting + +### Command Not Found + +**Vấn đề:** `claude: command not found` + +**Giải pháp:** +- Cài đặt Claude Code: `npm install -g @anthropic-ai/claude-code` +- Kiểm tra PATH bao gồm npm global bin directory +- Thử chạy với full path: `npx claude` + +### API Key Issues + +**Vấn đề:** Authentication failed + +**Giải pháp:** +- Đặt API key: `export ANTHROPIC_API_KEY=your-key` +- Kiểm tra key hợp lệ và có đủ credits +- Xác minh key permissions cho model được yêu cầu + +### Session Not Found + +**Vấn đề:** Cannot resume session + +**Giải pháp:** +- Liệt kê các sessions có sẵn để tìm đúng tên/ID +- Sessions có thể hết hạn sau một thời gian không hoạt động +- Sử dụng `-c` để tiếp tục session gần nhất + +### Output Format Issues + +**Vấn đề:** JSON output is malformed + +**Giải pháp:** +- Sử dụng `--json-schema` để enforce structure +- Thêm instructions JSON rõ ràng trong prompt +- Sử dụng `--output-format json` (không chỉ yêu cầu JSON trong prompt) + +### Permission Denied + +**Vấn đề:** Tool execution blocked + +**Giải pháp:** +- Kiểm tra `--permission-mode` setting +- Xem lại `--allowedTools` và `--disallowedTools` flags +- Sử dụng `--dangerously-skip-permissions` cho automation (cẩn thận) + +--- ## Tài Nguyên Thêm / Additional Resources -- [Tài Liệu CLI Chính Thức](https://code.claude.com/docs/en/cli-reference) -- [Tài Liệu MCP](../05-mcp/) - Cấu hình MCP servers -- [Slash Commands](../01-slash-commands/) - Các phím tắt có thể tái sử dụng -- [Plugins](../07-plugins/) - Các gói mở rộng có thể cài đặt +- **[Official CLI Reference](https://code.claude.com/docs/en/cli-reference)** - Complete command reference +- **[Headless Mode Documentation](https://code.claude.com/docs/en/headless)** - Automated execution +- **[Slash Commands](../01-slash-commands/)** - Custom shortcuts within Claude +- **[Memory Guide](../02-memory/)** - Persistent context via CLAUDE.md +- **[MCP Protocol](../05-mcp/)** - External tool integrations +- **[Advanced Features](../09-advanced-features/)** - Planning mode, extended thinking +- **[Hướng Dẫn Subagents](../04-subagents/)** - Thực thi tác vụ được ủy quyền + +--- + +*Phần của series hướng dẫn [Claude How To](../)* + +--- + +**Cập Nhật Lần Cuối**: Tháng 4 năm 2026 +**Phiên Bản Claude Code**: 2.1+ +**Các Mô Hình Tương Thích**: Claude Sonnet 4.6, Claude Opus 4.6, Claude Haiku 4.5 diff --git a/vi/CLAUDE.md b/vi/CLAUDE.md new file mode 100644 index 0000000..351cc55 --- /dev/null +++ b/vi/CLAUDE.md @@ -0,0 +1,158 @@ +# CLAUDE.md + +File này cung cấp hướng dẫn cho Claude Code (claude.ai/code) khi làm việc với code trong repository này. + +## Tổng Quan Dự Án + +Claude How To là một repository tutorial về các tính năng của Claude Code. Đây là **documentation-as-code** — sản phẩm chính là các file markdown được tổ chức thành các module học tập đánh số (01-10), không phải một ứng dụng thực thi. + +**Kiến trúc**: Mỗi module (01-10) bao phủ một tính năng cụ thể của Claude Code với các template copy-paste, sơ đồ Mermaid, và ví dụ. Hệ thống build xác thực chất lượng documentation và tạo ebook EPUB. + +## Các Lệnh Thường Dùng + +### Kiểm Tra Chất Lượng Pre-commit + +Tất cả documentation phải vượt qua bốn kiểm tra chất lượng trước khi commit (các kiểm tra này chạy tự động qua pre-commit hooks): + +```bash +# Cài đặt pre-commit hooks (chạy trên mỗi commit) +pre-commit install + +# Chạy tất cả các kiểm tra thủ công +pre-commit run --all-files +``` + +Bốn kiểm tra là: +1. **markdown-lint** — Cấu trúc và định dạng Markdown qua `markdownlint` +2. **cross-references** — Liên kết nội bộ, anchors, cú pháp code fence (Python script) +3. **mermaid-syntax** — Xác thực tất cả sơ đồ Mermaid parse đúng (Python script) +4. **link-check** — Các URL bên ngoài có thể truy cập được (Python script) +5. **build-epub** — EPUB tạo ra không có lỗi (khi có thay đổi `.md`) + +### Thiết Lập Môi Trường Phát Triển + +```bash +# Cài đặt uv (Python package manager) +pip install uv + +# Tạo virtual environment và cài đặt Python dependencies +uv venv +source .venv/bin/activate +uv pip install -r scripts/requirements-dev.txt + +# Cài đặt Node.js tools (markdown linter và Mermaid validator) +npm install -g markdownlint-cli +npm install -g @mermaid-js/mermaid-cli + +# Cài đặt pre-commit hooks +uv pip install pre-commit +pre-commit install +``` + +### Testing + +Các script Python trong `scripts/` có unit tests: + +```bash +# Chạy tất cả tests +pytest scripts/tests/ -v + +# Chạy với coverage +pytest scripts/tests/ -v --cov=scripts --cov-report=html + +# Chạy test cụ thể +pytest scripts/tests/test_build_epub.py -v +``` + +### Chất Lượng Code + +```bash +# Lint và format Python code +ruff check scripts/ +ruff format scripts/ + +# Security scan +bandit -c scripts/pyproject.toml -r scripts/ --exclude scripts/tests/ + +# Type checking +mypy scripts/ --ignore-missing-imports +``` + +### Build EPUB + +```bash +# Tạo ebook (render Mermaid diagrams qua Kroki.io API) +uv run scripts/build_epub.py + +# Với các tùy chọn +uv run scripts/build_epub.py --verbose --output custom-name.epub --max-concurrent 5 +``` + +## Cấu Trúc Thư Mục + +``` +├── 01-slash-commands/ # Các lối tắt do người dùng gọi +├── 02-memory/ # Ví dụ về bối cảnh liên tục +├── 03-skills/ # Các khả năng có thể tái sử dụng +├── 04-subagents/ # Các tác nhân AI chuyên dụng +├── 05-mcp/ # Ví dụ Model Context Protocol +├── 06-hooks/ # Tự động hóa dựa trên sự kiện +├── 07-plugins/ # Các tính năng được đóng gói +├── 08-checkpoints/ # Các snapshot của phiên +├── 09-advanced-features/ # Lập kế hoạch, suy nghĩ, background tasks +├── 10-cli/ # Tham chiếu CLI +├── scripts/ +│ ├── build_epub.py # EPUB generator (render Mermaid qua Kroki API) +│ ├── check_cross_references.py # Xác thực liên kết nội bộ +│ ├── check_links.py # Kiểm tra các URL bên ngoài +│ ├── check_mermaid.py # Xác thực cú pháp Mermaid +│ └── tests/ # Unit tests cho scripts +├── .pre-commit-config.yaml # Định nghĩa các kiểm tra chất lượng +└── README.md # Hướng dẫn chính (cũng là index của module) +``` + +## Hướng Dẫn Nội Dung + +### Cấu Trúc Module + +Mỗi thư mục đánh số tuân theo pattern: +- **README.md** — Tổng quan về tính năng với các ví dụ +- **Các file ví dụ** — Template copy-paste (`.md` cho commands, `.json` cho configs, `.sh` cho hooks) +- Các file được tổ chức theo độ phức tạp của tính năng và dependencies + +### Sơ Đồ Mermaid +- Tất cả sơ đồ phải parse thành công (được kiểm tra bởi pre-commit hook) +- EPUB build render sơ đồ qua Kroki.io API (cần internet) +- Sử dụng Mermaid cho flowcharts, sequence diagrams, và architecture visuals + +### Cross-References +- Sử dụng relative paths cho internal links (ví dụ: `(01-slash-commands/README.md)`) +- Code fences phải chỉ định ngôn ngữ (ví dụ: ` ```bash `, ` ```python `) +- Anchor links sử dụng format `#heading-name` + +### Link Validation +- Các URL bên ngoài phải có thể truy cập được (được kiểm tra bởi pre-commit hook) +- Tránh link đến nội dung tạm thời +- Sử dụng permalinks nếu có thể + +## Các Điểm Kiến Trúc Quan Trọng + +1. **Các thư mục đánh số thể hiện thứ tự học tập** — Prefix 01-10 thể hiện thứ tự được khuyến nghị để học các tính năng của Claude Code. Đánh số này có chủ đích; không tổ chức lại theo bảng chữ cái. + +2. **Scripts là các tiện ích, không phải sản phẩm** — Các script Python trong `scripts/` hỗ trợ chất lượng documentation và tạo EPUB. Nội dung thực tế nằm trong các thư mục module đánh số. + +3. **Pre-commit là người gác cổng** — Tất cả bốn kiểm tra chất lượng phải pass trước khi PR được chấp nhận. CI pipeline chạy các kiểm tra tương tự như lần thứ hai. + +4. **Mermaid rendering cần network** — EPUB build gọi Kroki.io API để render diagrams. Các lỗi build ở đây thường là vấn đề network hoặc cú pháp Mermaid không hợp lệ. + +5. **Đây là tutorial, không phải thư viện** — Khi thêm nội dung, tập trung vào giải thích rõ ràng, ví dụ copy-paste, và sơ đồ trực quan. Giá trị nằm ở việc dạy các khái niệm, không cung cấp code có thể tái sử dụng. + +## Commit Conventions + +Tuân theo format conventional commit: +- `feat(slash-commands): Add API documentation generator` +- `docs(memory): Improve personal preferences example` +- `fix(README): Correct table of contents link` +- `refactor(hooks): Simplify hook configuration examples` + +Scope nên khớp với tên thư mục khi áp dụng. diff --git a/vi/CODE_OF_CONDUCT.md b/vi/CODE_OF_CONDUCT.md index 9f1273f..48e2864 100644 --- a/vi/CODE_OF_CONDUCT.md +++ b/vi/CODE_OF_CONDUCT.md @@ -13,7 +13,7 @@ Các ví dụ về hành vi góp phần tạo ra một môi trường tích cự ### Tôn Trọng / Be Respectful - Sử dụng ngôn ngữ chào đón và bao gồm - Tôn trọng các ý kiến, quan điểm, và kinh nghiệm khác nhau -- Chấp nhận criticism mang tính xây dựng một cách khéo léo +- Chấp nhận phê bình mang tính xây dựng một cách khéo léo - Tôn trọng các khác biệt về văn hóa và ngôn ngữ - Công nhận và ăn mừng các nền tảng đa dạng @@ -34,7 +34,7 @@ Các ví dụ về hành vi góp phần tạo ra một môi trường tích cự ### Bao Gồm / Be Inclusive - Chào đón những người đóng góp mới - Giúp các người mới onboard vào dự án -- Cung cấp feedback mang tính xây dựng +- Cung cấp phản hồi mang tính xây dựng - Bao gồm những người có quan điểm khác nhau - Tạo không gian cho những tiếng nói nhỏ được nghe thấy @@ -53,7 +53,7 @@ Các hành vi sau được coi là quấy rối và không thể chấp nhận t - Các đe dọa bạo lực hoặc ngôn ngữ bạo lực được hướng đến một người khác - Kích động bạo lực hoặc ngôn ngữ bạo lực đối với bất kỳ cá nhân nào - Đe dọa có chủ đích -- Stalking hoặc theo dõi +- Quấy rối hoặc theo dõi (stalking) - Quấy rối qua liên lạc lặp đi lặp lại - Bất kỳ hành vi nào khác có thể được coi là không phù hợp @@ -72,11 +72,158 @@ Quy Tắc Ứng Xuất này áp dụng cho: - Kho chứa dự án và tài liệu - Các sự kiện và cuộc họp được tổ chức bởi hoặc đại diện cho dự án - Các không gian công cộng nơi các cá nhân đang đại diện cho dự án hoặc cộng đồng +- Các giao tiếp riêng tư khi chúng liên quan đến công việc dự án + +Quy Tắc Ứng Xuất này áp dụng cho tất cả các không gian của dự án, và nó cũng áp dụng khi một cá nhân đang đại diện cho dự án hoặc cộng đồng trong các không gian công cộng. Ví dụ về việc đại diện cho một dự án hoặc cộng đồng bao gồm sử dụng địa chỉ email chính thức của dự án, đăng qua tài khoản mạng xã hội chính thức, hoặc hành động như một đại diện được bổ nhiệm tại một sự kiện trực tuyến hoặc ngoại tuyến. ## Báo Cáo / Reporting -Nếu bạn witness hoặc là mục tiêu của hành vi quấy rối, vui lòng báo cáo cho: +Nếu bạn chứng kiến hoặc là mục tiêu của hành vi quấy rối, vui lòng báo cáo cho: - Người bảo trì dự án: [Contact Info] - Báo cáo vấn đề an toàn/đe dọa cho nền tảng phù hợp Chúng tôi sẽ điều tra và phản hồi tất cả các khiếu nại một cách bảo mật và nghiêm túc. + +### Trả Đũa / Retaliation + +- Hành động trả đũa ai đó vì đã báo cáo vi phạm +- Đối xử không công bằng với ai đó vì họ đã báo cáo hành vi không thể chấp nhận +- Đe dọa báo cáo ai đó để trả đũa + +## Thực Thi / Enforcement + +Người lãnh đạo cộng đồng chịu trách nhiệm làm rõ và thực thi các tiêu chuẩn về hành vi có thể chấp nhận và sẽ thực hiện các hành động khắc phục phù hợp và công bằng để đáp lại bất kỳ hành vi nào mà họ cho là không phù hợp, đe dọa, xúc phạm hoặc có hại. + +### Báo Cáo Vi Phạm / Reporting a Violation + +Nếu bạn trải nghiệm hoặc chứng kiến hành vi không thể chấp nhận, hoặc có bất kỳ mối quan ngại nào khác, vui lòng báo cáo bằng cách: + +1. **Email**: Liên hệ người bảo trì dự án tại [provide contact method if available] +2. **GitHub Issues**: Tính năng báo cáo riêng tư (nếu có sẵn trong cài đặt GitHub của bạn) +3. **Tin nhắn Trực tiếp**: Liên hệ người bảo trì dự án trực tiếp + +Vui lòng cung cấp: +- Thông tin liên hệ của bạn +- Tên của những người liên quan (nếu bạn cảm thấy thoải mái khi chia sẻ) +- Mô tả sự cố +- Ngữ cảnh và bất kỳ liên kết liên quan nào +- Cách sự cố ảnh hưởng đến bạn + +**Tất cả các báo cáo sẽ được giữ bảo mật.** + +### Điều Tra và Phản Hồi / Investigation and Response + +Người lãnh đạo cộng đồng sẽ: +- Xem xét và điều tra tất cả các khiếu nại một cách nhanh chóng và công bằng +- Duy trì bảo mật đối với người báo cáo +- Phản hồi với người báo cáo về tình trạng báo cáo của họ +- Thực hiện hành động phù hợp dựa trên kết quả điều tra + +Các hành động có thể bao gồm: +- Cảnh cáo riêng tư hoặc coaching +- Xin lỗi công khai (nếu người vi phạm đồng ý) +- Loại bỏ tạm thời hoặc vĩnh viễn khỏi các không gian cộng đồng +- Mất quyền đóng góp +- Chuyển vụ việc lên GitHub hoặc các nền tảng khác khi cần + +### Quy Trình Khiếu Nại / Appeal Process + +Nếu bạn tin rằng một quyết định được đưa ra do lỗi, bạn có thể khiếu nại bằng cách: +1. Cung cấp thông tin hoặc ngữ cảnh mới +2. Yêu cầu xem xét bởi nhiều người bảo trì +3. Theo dõi trong vòng 30 ngày kể từ quyết định ban đầu + +## Hướng Dẫn Không Đồng Ý Tôn Trọng / Guidelines for Respectful Disagreement + +Bất đồng là điều tự nhiên trong các cộng đồng kỹ thuật. Dưới đây là cách không đồng ý một cách tôn trọng: + +### Nên Làm / Do's +- ✅ Tập trung vào ý tưởng, không phải con người +- ✅ Đặt câu hỏi làm rõ +- ✅ Thừa nhận các điểm hợp lệ trong quan điểm đối lập +- ✅ Sử dụng câu "Tôi" ("Tôi không đồng ý vì...") +- ✅ Trích dẫn nguồn và bằng chứng +- ✅ Cảm ơn người khác vì quan điểm của họ + +### Không Nên / Don'ts +- ❌ Tấn công cá nhân +- ❌ Sử dụng ngôn ngữ coi thường ("Đó là ý tưởng ngu ngốc") +- ❌ Giả định ý định xấu +- ❌ Đưa ra các xung đột trong quá khứ không liên quan +- ❌ Leo thang giọng điệu hoặc trở nên thù địch +- ❌ Cố tình bóp méo quan điểm của người khác + +### Ví Dụ Không Đồng Ý Tôn Trọng / Example of Respectful Disagreement +``` +❌ Bad: "That's a dumb idea and you clearly don't understand the project." + +✅ Good: "I see your point, but I'm concerned this approach might +not scale well with larger projects. Have you considered the +performance implications shown in this benchmark? I'd love to +hear your thoughts on this." +``` + +## Xây Dựng Cầu Nối / Building Bridges + +Chúng tôi tin vào sức mạnh của đối thoại và hòa giải: + +- Nếu ai đó chỉ ra hành vi của bạn, hãy lắng nghe và suy ngẫm +- Sẵn sàng xin lỗi nếu bạn đã gây ra tổn thương +- Hỗ trợ người khác trong việc học hỏi và phát triển +- Nhận ra rằng mọi người đều mắc sai lầm +- Tập trung vào giải pháp, không phải đổ lỗi +- Giả định ý định tốt trong khi yêu cầu mọi người chịu trách nhiệm + +## Lợi Ích Của Việc Tuân Thủ Quy Tắc Ứng Xử / Benefits of Following This Code + +Bằng cách duy trì một cộng đồng tôn trọng và bao gồm, chúng tôi: +- Thu hút những người đóng góp đa dạng với các quan điểm khác nhau +- Tạo ra các giải pháp tốt hơn thông qua cộng tác +- Xây dựng các mối quan hệ mạnh mẽ hơn +- Làm cho dự án chào đón hơn đối với những người mới +- Sản xuất tài liệu và ví dụ chất lượng cao hơn +- Nuôi dưỡng một nền văn hóa học tập và phát triển + +## Các Cân Nhắc Đặc Biệt / Special Considerations + +### Cho Người Bảo Trì / For Maintainers +- Dẫn đầu bằng ví dụ trong việc tuân thủ Quy tắc này +- Phản hồi các báo cáo +- Minh bạch về các quyết định +- Giúp giải quyết xung đột công bằng +- Tạo một môi trường an toàn cho tất cả mọi người + +### Cho Người Đóng Góp / For Contributors +- Giả định ý định tốt từ những người bảo trì và những người đóng góp khác +- Cung cấp phản hồi xây dựng +- Hỗ trợ những người mới +- Giúp thực thi các tiêu chuẩn cộng đồng +- Chịu trách nhiệm về văn hóa cộng đồng + +### Cho Mọi Người / For Everyone +- Nhớ rằng có một con người đằng sau mọi tin nhắn +- Nghỉ ngơi nếu bạn đang cảm thấy thất vọng +- Liên hệ với người lãnh đạo cộng đồng nếu bạn cần hỗ trợ +- Giúp tạo ra cộng đồng bạn muốn tham gia + +## Ghi Nhận Đóng Góp / Attribution + +Bộ Quy Tắc Ứng Xử này được điều chỉnh từ: +- [Contributor Covenant](https://www.contributor-covenant.org/) +- [Mozilla Community Participation Guidelines](https://www.mozilla.org/en-US/about/governance/policies/participation/) +- [Python Community Code of Conduct](https://www.python.org/psf/conduct/) + +## Các Câu Hỏi? + +Nếu bạn có câu hỏi về Bộ Quy Tắc Ứng Xử này, vui lòng liên hệ với người bảo trì dự án. + +## Lịch Sử Phiên Bản / Version History + +- **Version 1.0** (January 2026) - Bộ Quy Tắc Ứng Xử Ban Đầu + +--- + +**Cảm ơn bạn đã giúp chúng tôi tạo ra một cộng đồng chào đón, bao trùm và tôn trọng!** 🌟 + +--- +**Cập Nhật Lần Cuối**: Tháng 4 năm 2026 diff --git a/vi/CONTRIBUTING.md b/vi/CONTRIBUTING.md index 26d6c02..39b98a4 100644 --- a/vi/CONTRIBUTING.md +++ b/vi/CONTRIBUTING.md @@ -97,3 +97,14 @@ pre-commit run --all-files ``` Các hooks chạy trên mỗi commit là: +- Kiểm tra markdown-lint +- Kiểm tra cross-references +- Kiểm tra mermaid-syntax +- Kiểm tra link-check + +--- + +Thank you for contributing! 🙏 + +--- +**Cập Nhật Lần Cuối**: Tháng 4 năm 2026 diff --git a/vi/LICENSE b/vi/LICENSE new file mode 100644 index 0000000..c7c5cba --- /dev/null +++ b/vi/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Bản quyền (c) 2024 luongnv89 + +Permission hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/vi/RELEASE_NOTES.md b/vi/RELEASE_NOTES.md new file mode 100644 index 0000000..6b3fb2d --- /dev/null +++ b/vi/RELEASE_NOTES.md @@ -0,0 +1,11 @@ +## v2.2.0 — 2026-03-26 + +### Sửa Lỗi / Bug Fixes + +- Xóa dead marketplace link đang fail CI link checks (3fdf0d6) +- Thêm `sandboxed` và `pycache` vào từ điển cSpell (dc64618) + +**Full Changelog**: https://github.com/luongnv89/claude-howto/compare/v2.1.0...v2.1.1 + +--- +**Cập Nhật Lần Cuối**: Tháng 4 năm 2026 diff --git a/vi/SECURITY.md b/vi/SECURITY.md index f4f2883..6fdfc9f 100644 --- a/vi/SECURITY.md +++ b/vi/SECURITY.md @@ -80,3 +80,11 @@ Chúng tôi sẽ: - Cung cấp timeline cho việc sửa - Thông báo khi bản vá đã được phát hành - Công khai thừa nhận báo cáo của bạn (nếu bạn muốn) + +--- + +Thank you for helping keep Claude How To secure! + +--- + +**Cập Nhật Lần Cuối**: Tháng 4 năm 2026 diff --git a/vi/STYLE_GUIDE.md b/vi/STYLE_GUIDE.md index c82864a..dfe18c7 100644 --- a/vi/STYLE_GUIDE.md +++ b/vi/STYLE_GUIDE.md @@ -268,3 +268,7 @@ Trước khi gửi PR: - [ ] Mermaid diagrams được test - [ ] Ví dụ code đã được xác minh - [ ] Tài liệu nhất quán với phần còn lại + +--- + +**Cập Nhật Lần Cuối**: Tháng 4 năm 2026 diff --git a/vi/claude-howto-logo.png b/vi/claude-howto-logo.png new file mode 100644 index 0000000..94d34a4 Binary files /dev/null and b/vi/claude-howto-logo.png differ diff --git a/vi/clean-code-rules.md b/vi/clean-code-rules.md new file mode 100644 index 0000000..beaff0f --- /dev/null +++ b/vi/clean-code-rules.md @@ -0,0 +1,112 @@ +# Clean Code Rules for AI Code Generation +# Quy Tắc Viết Code Sạch cho AI Tạo Code + +Các quy tắc này hướng dẫn việc tạo code để tạo ra code có thể bảo trì, chất lượng professional. + +## Đặt Tên Có Ý Nghĩa / Meaningful Names +- Sử dụng tên tiết lộ ý định giải thích tại sao một thứ tồn tại +- Tránh disinformation và các phân biệt vô nghĩa (ví dụ: `data`, `info`, `manager`) +- Sử dụng tên có thể phát âm và tìm kiếm được +- Tên Class: danh từ (ví dụ: `UserAccount`, `PaymentProcessor`) +- Tên Method: động từ (ví dụ: `calculateTotal`, `sendEmail`) +- Tránh mental mapping và encodings (Hungarian notation, prefixes) + +## Functions / Hàm +- Giữ functions nhỏ (< 20 dòng là lý tưởng) +- Làm một việc duy nhất - Nguyên tắc Đơn Trách Nhiệm +- Một level của abstraction per function +- Giới hạn arguments: 0-2 là lý tưởng, 3 tối đa, tránh flag arguments +- Không side effects - function nên làm điều tên nó nói +- Tách commands (thay đổi state) khỏi queries (trả về info) +- Ưu tiên exceptions hơn error codes + +## Comments / Comments +- Code nên tự giải thích - tránh comments khi có thể +- Comments tốt: thông tin pháp lý, cảnh báo, TODOs, tài liệu public API +- Comments xấu: redundant, misleading, hoặc giải thích bad code +- Không comment out code - xóa nó (version control preserves history) +- Nếu bạn cần một comment, cân nhắc refactoring code thay thế + +## Formatting +- Giữ files nhỏ và tập trung +- Vertical formatting: các concepts liên quan gần nhau, blank lines tách biệt concepts +- Horizontal formatting: giới hạn độ dài dòng (80-120 characters) +- Sử dụng indentation và team style nhất quán +- Nhóm các functions liên quan lại với nhau + +## Objects and Data Structures +- Objects: ẩn data đằng sau abstractions, expose behavior qua methods +- Data structures: expose data, có minimal behavior +- Law of Demeter: chỉ nói chuyện với immediate friends, tránh `a.getB().getC().doSomething()` +- Không expose internal structure qua getters/setters một cách mù quáng + +## Error Handling +- Sử dụng exceptions, không phải return codes hoặc error flags +- Viết `try-catch-finally` trước khi code có thể fail +- Cung cấp context trong exception messages +- Không return `null` - return empty collections hoặc sử dụng Optional/Maybe +- Không pass `null` như arguments + +## Classes +- Classes nhỏ: measured by responsibilities, không phải lines +- Single Responsibility Principle: một lý do để thay đổi +- High cohesion: class variables được sử dụng bởi nhiều methods +- Low coupling: minimal dependencies giữa các classes +- Open/Closed Principle: open for extension, closed for modification + +## Unit Tests +- Fast, Independent, Repeatable, Self-validating, Timely (F.I.R.S.T.) +- Một assert per test (hoặc một concept) +- Test code quality bằng với production code quality +- Test names có thể đọc được mô tả what đang being tested +- Arrange-Act-Assert pattern + +## Code Quality Principles +- **DRY (Don't Repeat Yourself)**: Không duplication +- **YAGNI (You Aren't Gonna Need It)**: Không build cho hypothetical futures +- **KISS (Keep It Simple)**: Tránh unnecessary complexity +- **Boy Scout Rule**: Leave code cleaner than you found it + +## Code Smells to Avoid / Mùi Code Cần Tránh +- Long functions hoặc classes +- Duplicate code +- Dead code (unused variables, functions, parameters) +- Feature envy (method more interested in other class) +- Inappropriate intimacy (classes knowing too much about each other) +- Long parameter lists +- Primitive obsession (overusing primitives thay vì small objects) +- Switch/case statements (cân nhắc polymorphism) +- Temporary fields (class variables only used sometimes) + +## Concurrency +- Giữ concurrent code tách biệt khỏi other code +- Giới hạn scope của synchronized/locked data +- Sử dụng thread-safe collections +- Giữ synchronized sections nhỏ +- Biết your execution models và primitives + +## System Design +- Tách construction khỏi use (dependency injection) +- Sử dụng factories, builders cho complex object creation +- Program to interfaces, not implementations +- Favor composition over inheritance +- Apply design patterns khi chúng simplify, không phải để khoe + +## Refactoring +- Refactor liên tục, không phải trong big batches +- Luôn có passing tests trước và sau +- Small steps: một change tại một thời điểm +- Common refactorings: Extract Method, Rename, Move, Inline + +## Documentation +- Self-documenting code > comments > external docs +- Public APIs cần clear documentation +- Include examples trong documentation +- Giữ docs close to code (lý tưởng là in code) + +--- + +**Core Philosophy**: Code được đọc 10x nhiều hơn được viết. Tối ưu cho readability và maintainability, không phải cleverness. + +--- +**Cập Nhật Lần Cuối**: Tháng 4 năm 2026 diff --git a/vi/resources.md b/vi/resources.md new file mode 100644 index 0000000..13b61d2 --- /dev/null +++ b/vi/resources.md @@ -0,0 +1,250 @@ + + + Claude How To + + +# Danh Sách Tài Nguyên Hữu Ích +# List of Good Resources + +## Tài Liệu Chính Thức / Official Documentation + +| Tài Nguyên | Mô Tả | Liên Kết | +|----------|-------------|------| +| Claude Code Docs | Tài liệu Claude Code chính thức | [code.claude.com/docs/en/overview](https://code.claude.com/docs/en/overview) | +| Anthropic Docs | Tài liệu Anthropic đầy đủ | [docs.anthropic.com](https://docs.anthropic.com) | +| MCP Protocol | Model Context Protocol specification | [modelcontextprotocol.io](https://modelcontextprotocol.io) | +| MCP Servers | Các MCP server implementations chính thức | [github.com/modelcontextprotocol/servers](https://github.com/modelcontextprotocol/servers) | +| Anthropic Cookbook | Code examples và tutorials | [github.com/anthropics/anthropic-cookbook](https://github.com/anthropics/anthropic-cookbook) | +| Claude Code Skills | Community skills repository | [github.com/anthropics/skills](https://github.com/anthropics/skills) | +| Agent Teams | Multi-agent coordination và collaboration | [code.claude.com/docs/en/agent-teams](https://code.claude.com/docs/en/agent-teams) | +| Scheduled Tasks | Recurring tasks với `/loop` và cron | [code.claude.com/docs/en/scheduled-tasks](https://code.claude.com/docs/en/scheduled-tasks) | +| Chrome Integration | Browser automation | [code.claude.com/docs/en/chrome](https://code.claude.com/docs/en/chrome) | +| Keybindings | Keyboard shortcut customization | [code.claude.com/docs/en/keybindings](https://code.claude.com/docs/en/keybindings) | +| Desktop App | Native desktop application | [code.claude.com/docs/en/desktop](https://code.claude.com/docs/en/desktop) | +| Remote Control | Remote session control | [code.claude.com/docs/en/remote-control](https://code.claude.com/docs/en/remote-control) | +| Auto Mode | Automatic permission management | [code.claude.com/docs/en/permissions](https://code.claude.com/docs/en/permissions) | +| Channels | Multi-channel communication | [code.claude.com/docs/en/channels](https://code.claude.com/docs/en/channels) | +| Voice Dictation | Voice input cho Claude Code | [code.claude.com/docs/en/voice-dictation](https://code.claude.com/docs/en/voice-dictation) | + +## Anthropic Engineering Blog + +| Bài Viết | Mô Tả | Liên Kết | +|---------|-------------|------| +| Code Execution with MCP | Cách giải quyết MCP context bloat sử dụng code execution — 98.7% token reduction | [anthropic.com/engineering/code-execution-with-mcp](https://www.anthropic.com/engineering/code-execution-with-mcp) | + +--- + +## Mastering Claude Code in 30 Minutes / Làm Chủ Claude Code trong 30 Phút + +_Video_: https://www.youtube.com/watch?v=6eBSHbLKuN0 + +_**Tất Cả Tips**_ +- **Khám Phá Các Tính Năng Nâng Cao và Shortcuts** + - Thường xuyên kiểm tra các tính năng code editing và context mới của Claude trong release notes. + - Học keyboard shortcuts để chuyển đổi giữa chat, file, và editor views nhanh chóng. + +- **Thiết Lập Hiệu Quả** + - Tạo các project-specific sessions với tên/mô tả rõ ràng để dễ dàng truy xuất. + - Pin các files hoặc folders được sử dụng nhiều nhất để Claude có thể truy cập bất cứ lúc nào. + - Thiết lập các integrations của Claude (ví dụ: GitHub, popular IDEs) để hợp lý hóa coding process của bạn. + +- **Codebase Q&A Hiệu Quả** + - Hỏi Claude các câu hỏi chi tiết về architecture, design patterns, và các modules cụ thể. + - Sử dụng file và line references trong câu hỏi của bạn (ví dụ: "What does the logic in `app/models/user.py` accomplish?"). + - Đối với large codebases, cung cấp summary hoặc manifest để giúp Claude tập trung. + - **Example prompt**: _"Can you explain the authentication flow implemented in src/auth/AuthService.ts:45-120? How does it integrate with the middleware in src/middleware/auth.ts?"_ + +- **Code Editing & Refactoring** + - Sử dụng inline comments hoặc requests trong code blocks để có được các edits tập trung ("Refactor this function for clarity"). + - Yêu cầu side-by-side before/after comparisons. + - Để Claude generate tests hoặc documentation sau các edits lớn để đảm bảo chất lượng. + - **Example prompt**: _"Refactor the getUserData function in api/users.js to use async/await instead of promises. Show me a before/after comparison and generate unit tests for the refactored version."_ + +- **Quản Lý Context** + - Giới hạn pasted code/context của bạn chỉ vào những gì liên quan cho task hiện tại. + - Sử dụng structured prompts ("Here's file A, here's function B, my question is X") cho best performance. + - Remove hoặc collapse các large files trong prompt window để tránh exceeding context limits. + - **Example prompt**: _"Here's the User model from models/User.js and the validateUser function from utils/validation.js. My question is: how can I add email validation while maintaining backward compatibility?"_ + +- **Tích Hợp Team Tools** + - Kết nối Claude sessions với repositories và documentation của team bạn. + - Sử dụng built-in templates hoặc tạo custom ones cho recurring engineering tasks. + - Cộng tác bằng cách chia sẻ session transcripts và prompts với teammates. + +- **Boosting Performance** + - Cung cấp cho Claude các instructions rõ ràng, goal-oriented (ví dụ: "Summarize this class in five bullet points"). + - Trim unnecessary comments và boilerplate từ context windows. + - Nếu output của Claude bị lệch, reset context hoặc rephrase questions cho better alignment. + - **Example prompt**: _"Summarize the DatabaseManager class in src/db/Manager.ts in five bullet points, focusing on its main responsibilities and key methods."_ + +- **Practical Use Examples / Ví Dụ Sử Dụng Thực Tế** + - Debugging: Paste errors và stack traces, sau đó hỏi về possible causes và fixes. + - Test Generation: Yêu cầu property-based, unit, hoặc integration tests cho complex logic. + - Code Reviews: Hỏi Claude để identify risky changes, edge cases, hoặc code smells. + - **Example prompts**: + - _"I'm getting this error: 'TypeError: Cannot read property 'map' of undefined at line 42 in components/UserList.jsx'. Here's the stack trace and the relevant code. What's causing this and how can I fix it?"_ + - _"Generate comprehensive unit tests for the PaymentProcessor class, including edge cases for failed transactions, timeouts, and invalid inputs."_ + - _"Review this pull request diff and identify potential security issues, performance bottlenecks, and code smells."_ + +- **Workflow Automation** + - Script các repetitive tasks (như formatting, clean-ups, và repetitive renaming) sử dụng Claude prompts. + - Sử dụng Claude để draft PR descriptions, release notes, hoặc documentation dựa trên code diffs. + - **Example prompt**: _"Based on the git diff, create a detailed PR description with a summary of changes, list of modified files, testing steps, and potential impacts. Also generate release notes for version 2.3.0."_ + +**Tip**: Để có kết quả tốt nhất, kết hợp một số practices này — bắt đầu bằng cách pinning các critical files và summarizing goals của bạn, sau đó sử dụng focused prompts và các công cụ refactoring của Claude để incrementally improve codebase và automation của bạn. + + +**Recommended workflow with Claude Code / Workflow được khuyến nghị với Claude Code** + +### Cho Repository Mới / For a New Repository + +1. **Initialize the Repo & Claude Integration** + - Thiết lập repository mới của bạn với essential structure: README, LICENSE, .gitignore, root configs. + - Tạo một file `CLAUDE.md` mô tả architecture, high-level goals, và coding guidelines. + - Cài đặt Claude Code và liên kết nó với repository của bạn để được code suggestions, test scaffolding, và workflow automation. + +2. **Sử Dụng Plan Mode và Specs** + - Sử dụng plan mode (`shift-tab` hoặc `/plan`) để draft một specification chi tiết trước khi implement features. + - Hỏi Claude để được architecture suggestions và initial project layout. + - Giữ một clear, goal-oriented prompt sequence — hỏi về component outlines, major modules, và responsibilities. + +3. **Phát Triển & Review Iterative** + - Implement core features trong small chunks, prompting Claude cho code generation, refactoring, và documentation. + - Yêu cầu unit tests và examples sau mỗi increment. + - Duy trì một running task list trong CLAUDE.md. + +4. **Tự Động Hóa CI/CD và Deployment** + - Sử dụng Claude để scaffold GitHub Actions, npm/yarn scripts, hoặc deployment workflows. + - Dễ dàng adapt pipelines bằng cách update CLAUDE.md của bạn và yêu cầu các commands/scripts tương ứng. + +```mermaid +graph TD + A[Start New Repository] --> B[Initialize Repository Structure] + B --> C[Create README, LICENSE, .gitignore] + C --> D[Create CLAUDE.md] + D --> E[Document Architecture & Guidelines] + E --> F[Install & Link Claude Code] + + F --> G[Enter Plan Mode] + G --> H[Draft Feature Specification] + H --> I[Get Architecture Suggestions] + I --> J[Define Components & Modules] + + J --> K[Implement Feature Chunk] + K --> L[Generate Code with Claude] + L --> M[Request Unit Tests] + M --> N[Review & Refactor] + N --> O{More Features?} + O -->|Yes| K + O -->|No| P[Update Task List in CLAUDE.md] + + P --> Q[Setup CI/CD Pipeline] + Q --> R[Scaffold GitHub Actions] + R --> S[Create Deployment Scripts] + S --> T[Test Automation] + T --> U[Repository Ready] + + style A fill:#e1f5ff + style G fill:#fff4e1 + style K fill:#f0ffe1 + style Q fill:#ffe1f5 + style U fill:#90EE90 +``` + +#### Cho Repository Hiện Có / For an Existing Repository + +1. **Repository & Context Setup** + - Thêm hoặc update `CLAUDE.md` để document repo structure, coding patterns, và key files. Đối với legacy repos, sử dụng `CLAUDE_LEGACY.md` covering frameworks, version maps, instructions, bugs, và upgrade notes. + - Pin hoặc highlight các main files Claude nên sử dụng cho context. + +2. **Contextual Code Q&A** + - Hỏi Claude cho code reviews, bug explanations, refactors, hoặc migration plans tham chiếu đến specific files/functions. + - Cung cấp cho Claude explicit boundaries (ví dụ: "modify only these files" hoặc "no new dependencies"). + +3. **Branch, Worktree, và Multi-Session Management** + - Sử dụng multiple git worktrees cho isolated features hoặc bug fixes và launch separate Claude sessions per worktree. + - Giữ terminal tabs/windows được tổ chức theo branch hoặc feature cho parallel workflows. + +4. **Team Tools và Automation** + - Đồng bộ các custom commands qua `.claude/commands/` cho cross-team consistency. + - Tự động hóa các repetitive tasks, PR creation, và code formatting via Claude's slash commands hoặc hooks. + - Chia sẻ sessions và context với team members cho collaborative troubleshooting và review. + +```mermaid +graph TD + A[Start with Existing Repository] --> B{Legacy Codebase?} + B -->|Yes| C[Create CLAUDE_LEGACY.md] + B -->|No| D[Create/Update CLAUDE.md] + C --> E[Document Frameworks & Version Maps] + D --> F[Document Structure & Patterns] + E --> G[Pin Key Files for Context] + F --> G + + G --> H[Identify Task Type] + H --> I{Task Category} + I -->|Bug Fix| J[Ask Claude for Bug Analysis] + I -->|Code Review| K[Request Code Review] + I -->|Refactor| L[Plan Refactoring Strategy] + I -->|Migration| M[Create Migration Plan] + + J --> N[Set Explicit Boundaries] + K --> N + L --> N + M --> N + + N --> O{Multiple Features?} + O -->|Yes| P[Create Git Worktrees] + O -->|No| Q[Work on Main Branch] + P --> R[Launch Separate Claude Sessions] + R --> S[Organize Terminal Tabs] + Q --> S + + S --> T[Setup Team Automation] + T --> U[Sync .claude/commands/] + U --> V[Configure Slash Commands] + V --> W[Setup Hooks for Automation] + W --> X[Share Session Context with Team] + + X --> Y{More Tasks?} + Y -->|Yes| H + Y -->|No| Z[Workflow Complete] + + style A fill:#e1f5ff + style C fill:#ffecec + style D fill:#fff4e1 + style P fill:#f0ffe1 + style T fill:#ffe1f5 + style Z fill:#90EE90 +``` + +**Tips**: +- Bắt đầu mỗi feature hoặc fix mới với một spec và plan mode prompt. +- Đối với legacy và complex repos, lưu detailed guidance trong CLAUDE.md/CLAUDE_LEGACY.md. +- Cung cấp clear, focused instructions và break down complex work thành multi-phase plans. +- Thường xuyên clean up sessions, prune context, và remove completed worktrees để tránh clutter. + +Các bước này capture các core recommendations cho smooth workflows với Claude Code trong cả new và existing codebases. + +--- + +## Tính Năng Mới & Khả Năng (March 2026) / New Features & Capabilities + +### Key Feature Resources / Tài Nguyên Tính Năng Chính + +| Tính Năng | Mô Tả | Tìm Hiểu Thêm | +|---------|-------------|------------| +| **Auto Memory** | Claude tự động học và nhớ preferences của bạn qua các phiên | [Memory Guide](02-memory/) | +| **Remote Control** | Điều khiển Claude Code sessions từ các external tools và scripts | [Advanced Features](09-advanced-features/) | +| **Web Sessions** | Truy cập Claude Code qua browser-based interfaces cho remote development | [CLI Reference](10-cli/) | +| **Desktop App** | Native desktop application cho Claude Code với enhanced UI | [Claude Code Docs](https://code.claude.com/docs/en/desktop) | +| **Extended Thinking** | Deep reasoning toggle qua `Alt+T`/`Option+T` hoặc `MAX_THINKING_TOKENS` env var | [Advanced Features](09-advanced-features/) | +| **Permission Modes** | Fine-grained control: default, acceptEdits, plan, auto, dontAsk, bypassPermissions | [Advanced Features](09-advanced-features/) | +| **7-Tier Memory** | Managed Policy, Project, Project Rules, User, User Rules, Local, Auto Memory | [Memory Guide](02-memory/) | +| **Hook Events** | 25 events: PreToolUse, PostToolUse, PostToolUseFailure, Stop, StopFailure, SubagentStart, SubagentStop, Notification, Elicitation, và nhiều hơn | [Hooks Guide](06-hooks/) | +| **Agent Teams** | Phối hợp nhiều agents làm việc cùng nhau trên các complex tasks | [Subagents Guide](04-subagents/) | +| **Scheduled Tasks** | Thiết lập recurring tasks với `/loop` và cron tools | [Advanced Features](09-advanced-features/) | +| **Chrome Integration** | Browser automation với headless Chromium | [Advanced Features](09-advanced-features/) | +| **Keyboard Customization** | Tùy chỉnh keybindings bao gồm chord sequences | [Advanced Features](09-advanced-features/) | + +--- +**Cập Nhật Lần Cuối**: Tháng 4 năm 2026