Files
claude-howto/vi/01-slash-commands
Thiên Toán a70777e9bc Add Vietnamese (Tiếng Việt) Localization (#42)
* feat(i18n): add Vietnamese localization infrastructure

Add comprehensive infrastructure for Vietnamese translation of the
claude-howto documentation:

Features:
- Parallel vi/ directory structure for Vietnamese content
- Modified build_epub.py with --lang flag for Vietnamese EPUB
- Vietnamese-specific pre-commit hooks for quality checks
- Translation support files (glossary, style guide, queue tracker)
- sync_translations.py script to detect outdated translations

Infrastructure:
- vi/ directory with all 10 module subdirectories
- TRANSLATION_NOTES.md: comprehensive glossary and style guide
- TRANSLATION_QUEUE.md: progress tracking for 66+ files
- vi/README.md: Vietnamese landing page

EPUB Build:
- Added --lang CLI flag (en/vi) to build_epub.py
- Language-specific metadata (title, subtitle)
- Automatic root path adjustment for vi/ directory
- Dynamic output filename (claude-howto-guide-vi.epub)

Quality Assurance:
- Vietnamese markdown linting
- Vietnamese cross-reference checking
- Vietnamese Mermaid syntax validation
- Vietnamese link checking
- Vietnamese EPUB build validation

Ready for translation work to begin.

* feat(vi): translate INDEX.md to Vietnamese

Complete Vietnamese translation of INDEX.md - the comprehensive
index of all example files in the repository.

Translation follows vi/TRANSLATION_NOTES.md guidelines:
- Technical terms kept per glossary (slash command → "lệnh slash")
- File paths and code blocks preserved in English
- Table structure and formatting maintained
- All 882 lines translated

Content includes:
- Complete file tree (10 modules, 100+ files)
- Feature coverage matrix
- Quick start guides by use case
- Learning path progression
- Search by keyword sections

Progress: 1/5 core documents completed

* feat(vi): translate CATALOG.md to Vietnamese

Complete Vietnamese translation of CATALOG.md - the quick reference
guide to all Claude Code features.

Translation follows vi/TRANSLATION_NOTES.md guidelines:
- Technical terms kept per glossary (slash command → "lệnh slash")
- All command names preserved (/help, /optimize, etc.)
- Code blocks, JSON examples, and bash commands unchanged
- All tables and formatting maintained
- 517 lines translated with complete feature coverage

Content includes:
- Summary statistics (99 built-in + 43 examples = 117 total)
- Complete built-in commands reference (55+ commands)
- Custom commands examples (8 commands)
- Permission modes (6 modes)
- Subagents (6 built-in + 10 custom)
- Skills (5 bundled + 4 custom)
- Plugins (3 complete plugins)
- MCP servers (1 built-in + 8 common servers)
- Hooks (25 events + 7 example hooks)
- Memory files (7 types)
- New features (March 2026) - 17 new features
- Installation priority guide
- Complete one-command installation

Progress: 2/5 core documents completed

* docs(vi): translate learning roadmap to Vietnamese

- Add complete Vietnamese translation of LEARNING-ROADMAP.md (747 lines)
- Include self-assessment quiz for level determination
- Translate three learning levels: Beginner, Intermediate, Advanced
- Translate all milestones (1A, 1B, 2A, 2B, 3A, 3B) with hands-on exercises
- Preserve Mermaid diagram for learning path visualization
- Maintain progress tracking checklists and learning tips

* docs(vi): translate quick reference guide to Vietnamese

- Add complete Vietnamese translation of QUICK_REFERENCE.md (507 lines)
- Include installation quick commands for all features
- Translate feature cheat sheet with usage examples
- Translate common use cases (code review, documentation, DevOps, etc.)
- Preserve all code snippets, commands, and file paths in English
- Maintain file locations reference diagram
- Include learning path and new features (March 2026) sections
- Keep tips & tricks, feature matrix, and checklist intact

* docs(vi): translate module 01 - slash commands to Vietnamese

- Add complete Vietnamese translation of 01-slash-commands/README.md (553 lines)
- Translate slash commands overview and architecture
- Include 55+ built-in commands reference table with Vietnamese descriptions
- Translate bundled skills section (5 skills)
- Document custom commands (now skills) migration path
- Include frontmatter reference, arguments, and dynamic context sections
- Preserve all command names, code examples, and Mermaid diagrams
- Translate 8 available commands in folder with usage examples
- Include installation, troubleshooting, and best practices sections

* docs(vi): update translation queue progress - Module 01 README done

- Mark 01-slash-commands/README.md as completed (2026-04-02)
- Update Module 01 progress: 1/9 files (11%)
- Update overall progress: 6/66 files (9%)
- Update Priority 2 progress: 1/31 files (3%)
- Add recent completion note to queue header

* docs(vi): translate slash command - commit to Vietnamese

- Translate commit.md slash command to Vietnamese
- Keep all git commands and technical syntax intact
- Translate instructions and descriptions
- Maintain conventional commits format documentation

* docs(vi): translate slash command - doc-refactor to Vietnamese

- Translate doc-refactor.md slash command to Vietnamese
- Keep all technical terms and file paths intact
- Translate documentation refactoring instructions
- Maintain structure and numbering

* docs(vi): translate slash command - generate-api-docs to Vietnamese

- Translate generate-api-docs.md slash command to Vietnamese
- Keep all technical terms and file paths intact
- Translate API documentation generation instructions
- Maintain output format specifications

* docs(vi): translate slash command - optimize to Vietnamese

- Translate optimize.md slash command to Vietnamese
- Keep all technical terms and code concepts intact
- Translate code optimization instructions
- Maintain issue priority and response format

* docs(vi): translate slash command - pr to Vietnamese

- Translate pr.md slash command to Vietnamese
- Keep all commands and technical syntax intact
- Translate PR preparation checklist instructions
- Maintain conventional commits format documentation

* docs(vi): translate slash command - push-all to Vietnamese

- Translate push-all.md slash command to Vietnamese (153 lines)
- Keep all git commands and technical syntax intact
- Translate comprehensive workflow with safety checks
- Maintain API key validation patterns and error handling
- Preserve when to use/avoid sections and alternatives

* docs(vi): translate slash command - setup-ci-cd to Vietnamese

- Translate setup-ci-cd.md slash command to Vietnamese
- Keep all tool names and technical terms intact
- Translate CI/CD pipeline implementation instructions
- Maintain pre-commit hooks and GitHub Actions sections

* docs(vi): translate slash command - unit-test-expand to Vietnamese

- Translate unit-test-expand.md slash command to Vietnamese
- Keep all framework names and technical terms intact
- Translate test coverage expansion instructions
- Maintain testing frameworks and scenario sections

* docs(vi): update translation queue - Module 01 complete (100%)

- Mark all 9 Module 01 files as completed (2026-04-02)
- Update Module 01 progress: 9/9 files (100%) 
- Update overall progress: 14/66 files (21%)
- Update Priority 2 progress: 9/31 files (29%)
- Update header with Module 01 completion milestone

Module 01: Slash Commands - All files translated:
 README.md (overview, built-in commands, skills)
 commit.md (git commit with context)
 doc-refactor.md (documentation restructuring)
 generate-api-docs.md (API documentation generator)
 optimize.md (code optimization analysis)
 pr.md (pull request preparation)
 push-all.md (stage, commit, push with safety)
 setup-ci-cd.md (CI/CD pipeline implementation)
 unit-test-expand.md (test coverage expansion)

* docs(vi): translate module 02 - memory guide to Vietnamese

- Add complete Vietnamese translation of 02-memory/README.md (1162 lines)
- Translate memory system overview and architecture
- Include quick reference for memory commands (/init, /memory, #)
- Document complete memory hierarchy (8 levels with precedence)
- Translate auto memory section with architecture diagrams
- Include practical examples (project, directory-specific, personal memory)
- Add best practices, installation instructions, and troubleshooting
- Preserve all code examples, file paths, and technical terms
- Maintain Mermaid diagrams and tables

* docs(vi): translate example project CLAUDE.md to Vietnamese

- Translate project-CLAUDE.md example memory file
- Keep all technical terms, commands, and code style intact
- Translate descriptions and explanations
- Maintain project configuration structure

* docs(vi): translate example personal CLAUDE.md to Vietnamese

- Translate personal-CLAUDE.md example memory file
- Keep all technical terms, tools, and preferences intact
- Translate descriptions and explanations
- Maintain personal preferences structure

* docs(vi): translate example directory-specific CLAUDE.md to Vietnamese

- Translate directory-api-CLAUDE.md example memory file
- Keep all technical terms, API standards, and code examples intact
- Translate descriptions and explanations
- Maintain API module standards structure

* docs(vi): update translation queue - Module 02 complete (100%)

- Mark all 4 Module 02 files as completed (2026-04-02)
- Update Module 02 progress: 4/4 files (100%) 
- Update overall progress: 18/66 files (27%)
- Update Priority 2 progress: 13/31 files (42%)
- Update header with Module 02 completion milestone

Module 02: Memory - All files translated:
 README.md (1162 lines - comprehensive memory guide)
 project-CLAUDE.md (example project memory)
 personal-CLAUDE.md (example personal preferences)
 directory-api-CLAUDE.md (example directory-specific rules)

* docs(vi): translate module 03 - skills guide to Vietnamese

- Add complete Vietnamese translation of 03-skills/README.md (805 lines)
- Translate Agent Skills overview and architecture
- Include progressive disclosure loading mechanism (3 levels)
- Document skill types, locations, and automatic discovery
- Translate skill creation process and SKILL.md format
- Include required and optional frontmatter fields
- Document skill content types (reference vs task)
- Translate controlling skill invocation and string substitutions
- Include dynamic context injection with shell commands
- Document running skills in subagents with context: fork
- Translate 6 practical examples with directory structures
- Add supporting files, management, and best practices sections
- Preserve all code examples, YAML frontmatter, and Mermaid diagrams
- Maintain tables, troubleshooting guides, and security considerations

* docs(vi): translate skill - blog-draft to Vietnamese

- Translate blog-draft/SKILL.md to Vietnamese (275 lines)
- Keep all workflow steps and technical structure intact
- Translate instructions and descriptions
- Maintain version tracking and file structure
- Preserve all markdown formatting and code examples

* docs(vi): translate skill - brand-voice to Vietnamese

- Translate brand-voice/SKILL.md to Vietnamese (73 lines)
- Keep brand identity, tone, and vocabulary intact
- Translate writing guidelines and examples
- Maintain preferred/avoided terms sections
- Preserve good/bad examples with explanations

* docs(vi): translate skill - claude-md to Vietnamese

- Translate claude-md/SKILL.md to Vietnamese (213 lines)
- Keep all golden rules and core principles intact
- Translate execution flow and content strategy
- Maintain WHAT/WHY/HOW structure
- Preserve quality constraints and validation checklist
- Keep anti-patterns and output format sections

* docs(vi): translate skill - code-review to Vietnamese

- Translate code-review/SKILL.md to Vietnamese (71 lines)
- Keep all review categories and template intact
- Translate security, performance, quality, maintainability sections
- Maintain review template structure
- Preserve version history

* docs(vi): translate skill - refactor to Vietnamese

- Translate refactor/SKILL.md to Vietnamese (427 lines)
- Keep all Martin Fowler refactoring methodology intact
- Translate 6-phase workflow with detailed steps
- Maintain core principles and safety rules
- Preserve code smell catalog and refactoring techniques
- Keep quick start example with before/after code
- Maintain version history and references sections

* docs(vi): update translation queue - Module 03 complete (100%)

- Mark all 6 Module 03 files as completed (2026-04-02)
- Update Module 03 progress: 6/6 files (100%) 
- Update overall progress: 24/66 files (36%)
- Update Priority 2 progress: 19/31 files (61%)
- Update header with Module 03 completion milestone

Module 03: Skills - All files translated:
 README.md (805 lines - comprehensive skills guide)
 blog-draft/SKILL.md (275 lines - blog post creation workflow)
 brand-voice/SKILL.md (73 lines - brand voice consistency)
 claude-md/SKILL.md (213 lines - CLAUDE.md best practices)
 code-review/SKILL.md (71 lines - comprehensive code review)
 refactor/SKILL.md (427 lines - Fowler refactoring methodology)

* docs(vi): translate Module 04 Subagents README

Complete Vietnamese translation of subagents reference guide:
- Configuration and built-in subagents (general-purpose, Plan, Explore, Bash, statusline-setup, Claude Code Guide)
- Agent management with /agents command
- Automatic delegation vs explicit invocation
- Resumable agents and chaining
- Persistent memory across agent sessions
- Background subagents for parallel work
- Worktree isolation for safe experimentation
- Agent Teams (experimental feature)
- Best practices and usage patterns

* docs(vi): complete Module 04 Subagents translation

Translate all 6 subagent example definitions:
- code-reviewer.md: Expert code review specialist
- debugger.md: Root cause analysis and debugging
- documentation-writer.md: Technical documentation creation
- implementation-agent.md: Full-stack feature implementation
- secure-reviewer.md: Security-focused code review
- test-engineer.md: Comprehensive test coverage

Update translation queue progress:
- Module 04: 7/7 files (100%) 
- Overall: 31/66 files (47%)
- Next: Module 05 (MCP)

* docs(vi): complete Module 05 MCP translation

Translate comprehensive MCP (Model Context Protocol) guide:
- Overview and architecture diagrams
- Installation methods (HTTP, Stdio, SSE, WebSocket)
- OAuth 2.0 authentication support
- MCP tool search and dynamic updates
- Elicitation and prompt slash commands
- Configuration management (local, project, user scopes)
- Practical examples (GitHub, Database, Filesystem, Slack MCPs)
- MCP vs Memory decision matrix
- Code execution approach for solving context bloat
- MCPorter runtime reference
- Security best practices and troubleshooting

Translate 4 MCP configuration JSON examples:
- filesystem-mcp.json: File operations
- github-mcp.json: GitHub integration
- database-mcp.json: SQL queries
- multi-mcp.json: Multiple servers configuration

Update translation queue progress:
- Module 05: 5/5 files (100%) 
- Overall: 36/66 files (55%)
- Next: Module 06 (Hooks)

* docs(vi): complete Module 06 Hooks translation

Translate comprehensive Hooks guide:
- Overview and architecture
- Configuration structure (user, project, local scopes)
- Four hook types: command, HTTP, prompt, agent
- 25 hook events with matcher patterns
- Component-scoped hooks and subagent frontmatter
- JSON input/output format and exit codes
- Environment variables and best practices
- Security considerations and debugging
- Installation instructions

Copy 9 hook example files (code, no translation needed):
- format-code.sh: Auto-format code after write/edit
- log-bash.sh: Bash command logging
- notify-team.sh: Team notifications
- pre-commit.sh: Pre-commit validation
- security-scan.sh: Security scanning
- validate-prompt.sh: Prompt validation
- context-tracker.py: Token usage tracking
- context-tracker-tiktoken.py: Accurate token counting

Update translation queue progress:
- Module 06: 9/9 files (100%) 
- Overall: 45/67 files (67%)
- Next: Module 07 (Plugins)

* docs(vi): complete Module 07 Plugins translation

Translate comprehensive Plugins guide:
- Overview and architecture diagrams
- Plugin loading process and lifecycle
- Plugin types (Official, Community, Organization, Personal)
- Plugin definition structure and manifest
- Plugin structure example with all directories
- LSP server configuration and examples
- Plugin options (v2.1.83+) with userConfig
- Persistent plugin data via CLAUDE_PLUGIN_DATA
- Inline plugins via settings (v2.1.80+)
- Standalone vs Plugin approach comparison
- Practical examples (PR Review, DevOps, Documentation plugins)
- Plugin marketplace and distribution
- Marketplace configuration and definition schema
- Plugin source types and distribution methods
- Plugin CLI commands and installation methods
- Plugin features comparison table
- Testing, hot-reload, and managed settings
- Plugin security restrictions
- Publishing workflow and best practices
- Complete troubleshooting guide

Copy all plugin subdirectories (code, no translation needed):
- devops-automation/: Deployment workflows, incident management
- documentation/: API docs, README generation, templates
- pr-review/: Pull request review automation

Update translation queue progress:
- Module 07: 10+/10+ files (100%) 
- Overall: 55+/67 files (82%)
- Next: Module 08-10 (Checkpoints, Advanced Features, CLI)

* docs(vi): complete Modules 08-10 translation

Module 08: Checkpoints and Rewind (2 files)
- Overview and architecture
- Access methods (keyboard shortcut, slash command)
- Five rewind options (restore code+conversation, conversation, code, summarize, cancel)
- Automatic checkpoints and retention policies
- Use cases and practical examples
- Integration with git and best practices

Module 09: Advanced Features (3 files)
- Planning Mode: Two-phase implementation approach
- Extended Thinking: Deep reasoning for complex problems
- Auto Mode: Background safety classifier
- Background Tasks, Scheduled Tasks
- Permission Modes (default, acceptEdits, plan, auto, dontAsk, bypassPermissions)
- Print Mode, Session Management
- Voice Dictation, Channels, Remote Control
- Web Sessions, Desktop App, Task List
- Git Worktrees, Sandboxing, Managed Settings

Module 10: CLI Reference (1 file)
- CLI commands reference
- Core flags and options
- Interactive vs Print Mode
- Model selection and configuration
- System prompt customization
- Tool & permission management
- Output formats and scripting

Update translation queue progress:
- Modules 08-10: 6/6 files (100%) 
- All Modules 01-10: 61+/61+ files (100%) 
- Overall: 61+/67 files (91%)
- Remaining: Supporting docs (6 files)

* docs(vi): complete supporting documentation translation

Translate all 5 supporting documents:
- CONTRIBUTING.md: Contribution guidelines
- SECURITY.md: Security policy and vulnerability reporting
- CODE_OF_CONDUCT.md: Community standards and harassment policy
- STYLE_GUIDE.md: Documentation formatting conventions
- CHANGELOG.md: Version history (v2.2.0, v2.1.1, v2.1.0, v2.0.0)

Update translation queue to 100% completion:
- All Modules 01-10: 61+ files (100%) 
- Supporting Docs: 5/5 files (100%) 
- Overall: 67+/67 files (100%) 
- Status: HOÀN THÀNH 

* fix(vi): fix mermaid syntax and broken cross-references in Vietnamese translation

Fix invalid `#` comment in mermaid block (use `%%` instead) and update
cross-reference script to support Unicode/Vietnamese diacritics in anchor
generation. Fix broken anchor links across vi/ documentation files.

* fix(vi): remove inline mermaid comment causing parse error

Inline %% comments on node definition lines are not supported by the
mermaid parser. The surrounding HTML comment already explains this is
an incorrect example.
2026-04-06 21:34:18 +02:00
..

Claude How To

Lệnh Slash

Tổng Quan

Lệnh slash là các lối tắt để điều khiển hành vi của Claude trong một phiên tương tác. Chúng có một số loại:

  • Lệnh được tích hợp sẵn: Được cung cấp bởi Claude Code (/help, /clear, /model)
  • Skills: Các lệnh do người dùng định nghĩa được tạo dưới dạng file SKILL.md (/optimize, /pr)
  • Lệnh plugin: Các lệnh từ plugins đã cài đặt (/frontend-design:frontend-design)
  • MCP prompts: Các lệnh từ MCP servers (/mcp__github__list_prs)

Lưu ý: Lệnh slash tùy chỉnh đã được hợp nhất vào skills. Files trong .claude/commands/ vẫn hoạt động, nhưng skills (.claude/skills/) hiện là cách tiếp cận được khuyến nghị. Cả hai đều tạo ra các lối tắt /command-name. Xem Hướng Dẫn Skills để có tài liệu tham khảo đầy đủ.

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ẵn5 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
/add-dir <path> Thêm thư mục làm việc
/agents Quản lý cấu hình tác nhân
/branch [name] Phân nhánh cuộc hội thoại vào phiên mới (bí danh: /fork). Lưu ý: /fork đã đổi tên thành /branch trong v2.1.77
/btw <question> Câu hỏi phụ không thêm vào lịch sử
/chrome Cấu hình tích hợp trình duyệt Chrome
/clear Xóa cuộc hội thoại (bí danh: /reset, /new)
/color [color|default] Đặt màu thanh prompt
/compact [instructions] Nén cuộc hội thoại với hướng dẫn tập trung tùy chọn
/config Mở Cài Đặt (bí danh: /settings)
/context Trực quan hóa việc sử dụng bối cảnh dưới dạng lưới màu
/copy [N] Sao chép phản hồi trợ lý vào clipboard; w ghi vào file
/cost Hiển thị thống kê sử dụng token
/desktop Tiếp tục trong ứng dụng Desktop (bí danh: /app)
/diff Trình xem diff tương tác cho các thay đổi chưa commit
/doctor Chẩn đoán tình trạng cài đặt
/effort [low|medium|high|max|auto] Đặt mức nỗ lực. max yêu cầu Opus 4.6
/exit Thoát khỏi REPL (bí danh: /quit)
/export [filename] Xuất cuộc hội thoại hiện tại sang file hoặc clipboard
/extra-usage Cấu hình sử dụng thêm cho giới hạn tốc độ
/fast [on|off] Bật/tắt chế độ nhanh
/feedback Gửi phản hồi (bí danh: /bug)
/help Hiển thị trợ giúp
/hooks Xem cấu hình hooks
/ide Quản lý tích hợp IDE
/init Khởi tạo CLAUDE.md. Đặt CLAUDE_CODE_NEW_INIT=true cho quy trình tương tác
/insights Tạo báo cáo phân tích phiên
/install-github-app Thiết lập ứng dụng GitHub Actions
/install-slack-app Cài đặt ứng dụng Slack
/keybindings Mở cấu hình keybindings
/login Chuyển đổi tài khoản Anthropic
/logout Đăng xuất khỏi tài khoản Anthropic của bạn
/mcp Quản lý MCP servers và OAuth
/memory Chỉnh sửa CLAUDE.md, bật/tắt auto-memory
/mobile Mã QR cho ứng dụng di động (bí danh: /ios, /android)
/model [model] Chọn mô hình với mũi tên trái/phải cho nỗ lực
/passes Chia sẻ tuần miễn phí Claude Code
/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
/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
/remote-control Điều khiển từ xa từ claude.ai (bí danh: /rc)
/remote-env Cấu hình môi trường từ xa mặc định
/rename [name] Đổi tên phiên
/resume [session] Tiếp tục cuộc hội thoại (bí danh: /continue)
/review Đã lỗi thời — cài đặt plugin code-review thay thế
/rewind Quay lại cuộc hội thoại và/hoặc code (bí danh: /checkpoint)
/sandbox Bật/tắt chế độ sandbox
/schedule [description] Tạo/quản lý các tác vụ định kỳ
/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
/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
/voice Bật/tắt nhập liệu giọng nói push-to-talk

Skills Được Gói Sẵn

Những skills này được gửi kèm với Claude Code và được gọi như lệnh slash:

Skill Mục Đích
/batch <instruction> Điều phối các thay đổi song song quy mô lớn sử dụng worktrees
/claude-api Tải tài liệu tham khảo Claude API cho ngôn ngữ dự án
/debug [description] Bật ghi log debug
/loop [interval] <prompt> Chạy prompt lặp lại trên khoảng thời gian
/simplify [focus] Review các file đã thay đổi để kiểm tra chất lượng code

Lệnh Đã Lỗi Thời

Lệnh Trạng Thái
/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)

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)
  • /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
  • 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__<server>__<prompt> (xem MCP Prompts dưới dạng Lệnh)

Lệnh Tùy Chỉnh (Hiện Là Skills)

Lệnh slash tùy chỉnh đã được hợp nhất vào skills. Cả hai cách tiếp cận đều tạo ra các lệnh bạn có thể gọi với /command-name:

Cách Tiếp Cận Vị Trí Trạng Thái
Skills (Khuyến Nghị) .claude/skills/<name>/SKILL.md Tiêu chuẩn hiện tại
Lệnh Legacy .claude/commands/<name>.md Vẫn hoạt động

Nếu một skill và một lệnh chia sẻ cùng tên, skill sẽ được ưu tiên. Ví dụ, khi cả .claude/commands/review.md.claude/skills/review/SKILL.md tồn tại, phiên bản skill sẽ được sử dụng.

Đường Dẫn Chuyển Đổi

Files .claude/commands/ hiện tại của bạn tiếp tục hoạt động mà không cần thay đổi. Để chuyển đổi sang skills:

Trước (Lệnh):

.claude/commands/optimize.md

Sau (Skill):

.claude/skills/optimize/SKILL.md

Tại Sao Skills?

Skills cung cấp các tính năng bổ sung so với lệnh legacy:

  • Cấu trúc thư mục: Gói scripts, templates, và files tham khảo
  • Tự động gọi: Claude có thể kích hoạt skills tự động khi có liên quan
  • Kiểm soát gọi: Chọn liệu người dùng, Claude, hoặc cả hai có thể gọi
  • 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 thư mục với file SKILL.md:

mkdir -p .claude/skills/my-command

File: .claude/skills/my-command/SKILL.md

---
name: my-command
description: Lệnh này làm gì và khi nào sử dụng
---

# My Command

Hướng dẫn cho Claude để theo khi lệnh này được gọi.

1. Bước đầu tiên
2. Bước thứ hai
3. Bước thứ ba

Tham Khảo Frontmatter

Trường Mục Đích Mặc Định
name Tên lệnh (trở thành /name) Tên thư mục
description Mô tả ngắn (giúp Claude biết khi nào sử dụng) Đoạn đầu tiên
argument-hint Các đối số mong đợi cho tự động hoàn thành Không có
allowed-tools Các công cụ lệnh có thể sử dụng mà không cần quyền Kế thừa
model Mô hình cụ thể để sử dụng Kế thừa
disable-model-invocation Nếu true, chỉ người dùng có thể gọi (không phải Claude) false
user-invocable Nếu false, ẩn từ menu / true
context Đặt thành fork để chạy trong tác nhân con cô lập Không có
agent Loại tác nhân khi sử dụng context: fork general-purpose
hooks Hooks theo phạm vi skill (PreToolUse, PostToolUse, Stop) Không có

Đối Số

Lệnh có thể nhận đối số:

Tất cả đối số với $ARGUMENTS:

---
name: fix-issue
description: Fix a GitHub issue by number
---

Fix issue #$ARGUMENTS following our coding standards

Cách sử dụng: /fix-issue 123$ARGUMENTS trở thành "123"

Đối số riêng lẻ với $0, $1, v.v.:

---
name: review-pr
description: Review a PR with priority
---

Review PR #$0 with priority $1

Cách sử dụng: /review-pr 456 high$0="456", $1="high"

Bối Cảnh Động Với Lệnh Shell

Thực thi các lệnh bash trước prompt sử dụng !command``:

---
name: commit
description: Create a git commit with context
allowed-tools: Bash(git *)
---

## Context

- Current git status: !`git status`
- Current git diff: !`git diff HEAD`
- Current branch: !`git branch --show-current`
- Recent commits: !`git log --oneline -5`

## Your task

Based on the above changes, create a single git commit.

Tham Chiếu File

Bao gồm nội dung file sử dụng @:

Review the implementation in @src/utils/helpers.js
Compare @src/old-version.js with @src/new-version.js

Lệnh Plugin

Plugins có thể cung cấp các lệnh tùy chỉnh:

/plugin-name:command-name

Hoặc đơn giản là /command-name khi không có xung đột tên.

Ví dụ:

/frontend-design:frontend-design
/commit-commands:commit

MCP Prompts dưới dạng Lệnh

MCP servers có thể expose prompts dưới dạng lệnh slash:

/mcp__<server-name>__<prompt-name> [arguments]

Ví dụ:

/mcp__github__list_prs
/mcp__github__pr_review 456
/mcp__jira__create_issue "Bug title" high

Cú Pháp Quyền MCP

Kiểm soát quyền truy cập MCP server trong quyền:

  • mcp__github - Truy cập toàn bộ MCP server GitHub
  • mcp__github__* - Truy cập wildcard cho tất cả công cụ
  • mcp__github__get_issue - Truy cập công cụ cụ thể

Kiến Trúc Lệnh

graph TD
    A["User Input: /command-name"] --> B{"Command Type?"}
    B -->|Built-in| C["Execute Built-in"]
    B -->|Skill| D["Load SKILL.md"]
    B -->|Plugin| E["Load Plugin Command"]
    B -->|MCP| F["Execute MCP Prompt"]

    D --> G["Parse Frontmatter"]
    G --> H["Substitute Variables"]
    H --> I["Execute Shell Commands"]
    I --> J["Send to Claude"]
    J --> K["Return Results"]

Vòng Đời Lệnh

sequenceDiagram
    participant User
    participant Claude as Claude Code
    participant FS as File System
    participant CLI as Shell/Bash

    User->>Claude: Types /optimize
    Claude->>FS: Searches .claude/skills/ and .claude/commands/
    FS-->>Claude: Returns optimize/SKILL.md
    Claude->>Claude: Parses frontmatter
    Claude->>CLI: Executes !`command` substitutions
    CLI-->>Claude: Command outputs
    Claude->>Claude: Substitutes $ARGUMENTS
    Claude->>User: Processes prompt
    Claude->>User: Returns results

Các Lệnh Có Sẵn trong Thư Mục Này

Các lệnh ví dụ này có thể được cài đặt dưới dạng skills hoặc lệnh legacy.

1. /optimize - Tối Ưu Hóa Code

Phân tích code để tìm các vấn đề hiệu suất, rò rỉ bộ nhớ, và cơ hội tối ưu hóa.

Cách sử dụng:

/optimize
[Paste your code]

2. /pr - Chuẩn Bị Pull Request

Hướng dẫn qua danh sách kiểm tra chuẩn bị PR bao gồm linting, testing, và định dạng commit.

Cách sử dụng:

/pr

Ảnh chụp màn hình: /pr

3. /generate-api-docs - Trình Tạo Tài Liệu API

Tạo tài liệu API toàn diện từ mã nguồn.

Cách sử dụng:

/generate-api-docs

4. /commit - Git Commit với Bối Cảnh

Tạo một git commit với bối cảnh động từ kho chứa của bạn.

Cách sử dụng:

/commit [optional message]

5. /push-all - Stage, Commit, và Push

Stage tất cả thay đổi, tạo commit, và push đến remote với các kiểm tra an toàn.

Cách sử dụng:

/push-all

Kiểm tra an toàn:

  • Bí mật: .env*, *.key, *.pem, credentials.json
  • API Keys: Phát hiện các khóa thực so với placeholder
  • Files lớn: >10MB mà không có Git LFS
  • Build artifacts: node_modules/, dist/, __pycache__/

6. /doc-refactor - Cấu Trúc Lại Tài Liệu

Cấu trúc lại tài liệu dự án để rõ ràng và dễ truy cập.

Cách sử dụng:

/doc-refactor

7. /setup-ci-cd - Thiết Lập Pipeline CI/CD

Triển khai pre-commit hooks và GitHub Actions để đảm bảo chất lượng.

Cách sử dụng:

/setup-ci-cd

8. /unit-test-expand - Mở Rộng Phủ Vùng Test

Tăng vùng phủ test bằng cách nhắm vào các nhánh chưa được test và các trường hợp ngoại lệ.

Cách sử dụng:

/unit-test-expand

Cài Đặt

Dưới dạng Skills (Khuyến Nghị)

Sao chép vào thư mục skills của bạn:

# Tạo thư mục skills
mkdir -p .claude/skills

# Với mỗi file lệnh, tạo một thư mục skill
for cmd in optimize pr commit; do
  mkdir -p .claude/skills/$cmd
  cp 01-slash-commands/$cmd.md .claude/skills/$cmd/SKILL.md
done

Dưới dạng Lệnh Legacy

Sao chép vào thư mục lệnh của bạn:

# Phạm vi dự án (đội)
mkdir -p .claude/commands
cp 01-slash-commands/*.md .claude/commands/

# Sử dụng cá nhân
mkdir -p ~/.claude/commands
cp 01-slash-commands/*.md ~/.claude/commands/

Tạo Lệnh Riêng Của Bạn

Mẫu Skill (Khuyến Nghị)

Tạo .claude/skills/my-command/SKILL.md:

---
name: my-command
description: Lệnh này làm gì. Sử dụng khi [điều kiện kích hoạt].
argument-hint: [đối số-tùy-chọn]
allowed-tools: Bash(npm *), Read, Grep
---

# Command Title

## Context

- Current branch: !`git branch --show-current`
- Related files: @package.json

## Instructions

1. Bước đầu tiên
2. Bước thứ hai với đối số: $ARGUMENTS
3. Bước thứ ba

## Output Format

- Cách định dạng phản hồi
- Những gì cần bao gồm

Lệnh Chỉ Người Dùng (Không Tự Động Gọi)

Đối với các lệnh có tác dụng phụ mà Claude không nên kích hoạt tự động:

---
name: deploy
description: Deploy to production
disable-model-invocation: true
allowed-tools: Bash(npm *), Bash(git *)
---

Deploy the application to production:

1. Run tests
2. Build application
3. Push to deployment target
4. Verify deployment

Thực Hành Tốt Nhất

Nên Không Nên
Sử dụng tên rõ ràng, hướng hành động Tạo lệnh cho tác vụ một lần
Bao gồm description với điều kiện kích hoạt Xây dựng logic phức tạp trong lệnh
Giữ lệnh tập trung vào một tác vụ Hardcode thông tin nhạy cảm
Sử dụng disable-model-invocation cho tác dụng phụ Bỏ qua trường description
Sử dụng tiền tố ! cho bối cảnh động Giả sử Claude biết trạng thái hiện tại
Sắp xếp các files liên quan trong thư mục skill Đặt mọi thứ trong một file

Xử Lý Sự Cố

Không Tìm Thấy Lệnh

Giải pháp:

  • Kiểm tra file có trong .claude/skills/<name>/SKILL.md hoặc .claude/commands/<name>.md
  • Xác minh trường name trong frontmatter khớp với tên lệnh mong đợi
  • Khởi động lại phiên Claude Code
  • Chạy /help để xem các lệnh có sẵn

Lệnh Không Thực Thi Như Mong Đợi

Giải pháp:

  • Thêm hướng dẫn cụ thể hơn
  • Bao gồm các ví dụ trong file skill
  • Kiểm tra allowed-tools nếu sử dụng các lệnh bash
  • Thử với các đầu vào đơn giản trước

Xung Đột Skill vs Lệnh

Nếu cả hai tồn tại với cùng tên, skill sẽ được ưu tiên. Xóa một hoặc đổi tên nó.

Hướng Dẫn Liên Quan

  • Skills - Tài liệu tham khảo đầy đủ cho skills (khả năng tự động gọi)
  • Bộ Nhớ - Bối cảnh liên tục với CLAUDE.md
  • Tác Nhân Con - Các tác nhân AI được ủy quyền
  • Plugins - Bộ sưu tập lệnh được gói
  • Hooks - Tự động hóa dựa trên sự kiện

Tài Nguyên Thêm


Phần của series hướng dẫn Claude How To