---
title: "VB-05 Tận dụng “Commands & Hooks” để tăng hiệu suất!"
url: "https://zuey.me/articles/vb-05-tan-dung-commands-hooks-de-tang-hieu-suat?lang=vi"
locale: vi
access: members
full_text: false
published_at: "2025-07-29T03:26:10.000Z"
tags: ["Claude Code", "Vibe Coding", "AI", "SaaS", "Startup"]
translations:
  en: "https://zuey.me/articles/vb-05-tan-dung-commands-hooks-de-tang-hieu-suat.md?lang=en"
  zh: "https://zuey.me/articles/vb-05-tan-dung-commands-hooks-de-tang-hieu-suat.md?lang=zh"
  ko: "https://zuey.me/articles/vb-05-tan-dung-commands-hooks-de-tang-hieu-suat.md?lang=ko"
  ja: "https://zuey.me/articles/vb-05-tan-dung-commands-hooks-de-tang-hieu-suat.md?lang=ja"
---
# VB-05 Tận dụng “Commands & Hooks” để tăng hiệu suất!

> Commands & Hooks trong Claude Code: đóng gói những prompt hay dùng thành lệnh /, cài hook để CC tự báo qua Telegram hay tự “nói” khi xong việc. Kèm full danh sách commands mình đang xài hằng ngày 😁

Bài thứ 05 của series “Vibe Coding cùng Claude Code” đây! Bài này thú thiệt là mình hơi lười nên xin phép chỉ list ra những commands & hooks mình hay dùng mà thôi 😅

(Tuy nhiên cuối bài cũng có một số link repo mình sưu tầm được khá hữu ích cho ae dùng Claude Code, check thử nha!)

![VB-05 Tận dụng “Commands & Hooks” để tăng hiệu suất!](https://media.zuey.me/blog/2025/ec820e22-cleanshot-2025-08-21-at-17-39-29.png)

> **INFO:** **TL;DR:** **Commands** là những mẫu prompt đóng gói sẵn, gọi nhanh bằng `/`. **Hooks** là luật tự động kiểu “mỗi khi làm X thì phải làm Y”, chạy theo sự kiện của Claude Code — không thương lượng, không “quên”.

### Commands là gì?

Là cách gửi nhanh những mẫu prompt tạo sẵn của bạn.

Khác với `CLAUDE.md` hay `agents/*.md` vốn là “**System Prompt**”, thì commands là “**User Prompt**”, nó có “sức nặng” hơn nhiều và sẽ được ưu tiên xử lý hơn.

Ví dụ trong quá trình làm việc có những mẫu prompt mà bạn cứ phải viết đi viết lại nhiều lần, thì giờ bạn có thể đóng gói nó vào một command và gọi ra bằng `/` một cách nhanh chóng.

### Cách tạo Commands

Rất đơn giản, tạo file Markdown trong folder `~/.claude/commands` với cấu trúc như sau:

```markdown
---
description: Mô tả command này
---

Viết prompt của bạn ở đây

$ARGUMENTS
```

`$ARGUMENTS` chính là phần nội dung bạn gõ theo sau command, sẽ được chèn vào đúng vị trí đó (VD: `/fix Lỗi ngôn ngữ mặc định`).

#### Có 2 loại scope cho command

| Scope | Vị trí file .md | Dùng ở đâu |
| --- | --- | --- |
| Project commands | `.claude/commands` của dự án | Chỉ trong dự án đó |
| Global commands | `~/.claude/commands` | Mọi nơi! |

#### Pro tip: dùng Commands để triệu hồi Subagents

Trong bài “Subagents” đầu tiên mình có đề cập đến việc “Commands” là cách tốt nhất để summon Subagents khi cần thiết. Vì vậy chúng ta có thể tạo những workflow chi tiết, rõ ràng trong mỗi command để tuỳ biến theo ý mình, phù hợp với từng đặc thù nhiệm vụ khác nhau.

Ví dụ: `fix-ci.md`

```markdown
---
description: Đọc, phân tích, debug và sửa failed tests của Github Actions
---

Đọc, phân tích, debug và sửa failed tests của Github Actions:

$ARGUMENTS

Quy trình:
- Sử dụng "debugger" agent để đọc và phân tích logs của Github Actions
- Sử dụng "planner" agent để lên kế hoạch thực hiện các bản sửa lỗi
- Sử dụng "tester" agent để kiểm thử các bản sửa lỗi, đảm bảo các test suite đều vượt qua
```

---

### Danh sách commands mình đang dùng

Bài này thì mình hơi lười, mà cũng không còn gì nhiều để nói về “Commands”, nên xin phép chỉ share danh sách những command mình tạo để dùng trong Claude Code.

Mình cũng để toàn bộ command files trong [repo này](https://github.com/mrgoonie/claude-code-setup), cùng với toàn bộ setup Subagents mà mình đã optimize và đang sử dụng, anh em nào cần thì cứ xỉa về dùng thoải mái.

(Nếu có feedback hoặc ý tưởng improve gì thì cứ contribute trực tiếp vào repo luôn nha!)

*Thật ra mình cũng “được inspired” (cách nói fancy của “đi xỉa”) từ repo của người khác mà thôi, một trong những repo mình thấy khá hữu ích cho những ai dùng Claude Code đó là* [*https://github.com/mrgoonie/claude-code-setup*](https://github.com/mrgoonie/claude-code-setup) *— mọi người check thử nghen!*

| Command | Dùng để | Tự sửa code? |
| --- | --- | --- |
| `/ask` | Hỏi mọi thứ về codebase, kiến trúc | Không |
| `/plan` | Lên kế hoạch chi tiết với `planner-researcher` | Không, chỉ report |
| `/cook` | Implement tính năng / sửa lỗi phức tạp với cả đội agents | Có |
| `/fix` | Sửa nhanh lỗi vặt | Có |
| `/fix-test` | Chạy test local, sửa tới khi pass | Có |
| `/fix-ci` | Đọc logs Github Actions, lên kế hoạch sửa | Hỏi xác nhận trước |
| `/test` | Chạy test local và báo cáo | Không |
| `/refactor` | Refactor có kế hoạch, có ràng buộc | Hỏi xác nhận trước |
| `/debug` | Tìm nguyên nhân cốt lõi của lỗi | Không |
| `/watzup` | Tổng hợp những thay đổi gần đây | Không |

#### /ask

Dùng command này để hỏi mọi thứ về codebase.

**Xem nội dung command /ask**

```markdown
---
description: Answer technical and architectural questions.
---
## Context
- Technical question or architecture challenge: $ARGUMENTS
- Relevant system documentation and design artifacts will be referenced using @ file syntax.
- Current system constraints, scale requirements, and business context will be considered.

## Your Role
You are a Senior Systems Architect providing expert consultation and architectural guidance. You focus on high-level design, strategic decisions, and architectural patterns rather than implementation details. You orchestrate four specialized architectural advisors:
1. **Systems Designer** – evaluates system boundaries, interfaces, and component interactions.
2. **Technology Strategist** – recommends technology stacks, frameworks, and architectural patterns.
3. **Scalability Consultant** – assesses performance, reliability, and growth considerations.
4. **Risk Analyst** – identifies potential issues, trade-offs, and mitigation strategies.

## Process
1. **Problem Understanding**: Analyze the technical question and gather architectural context.
2. **Expert Consultation**:
   - Systems Designer: Define system boundaries, data flows, and component relationships
   - Technology Strategist: Evaluate technology choices, patterns, and industry best practices
   - Scalability Consultant: Assess non-functional requirements and scalability implications
   - Risk Analyst: Identify architectural risks, dependencies, and decision trade-offs
3. **Architecture Synthesis**: Combine insights to provide comprehensive architectural guidance.
4. **Strategic Validation**: Ensure recommendations align with business goals and technical constraints.

## Output Format
1. **Architecture Analysis** – comprehensive breakdown of the technical challenge and context.
2. **Design Recommendations** – high-level architectural solutions with rationale and alternatives.
3. **Technology Guidance** – strategic technology choices with pros/cons analysis.
4. **Implementation Strategy** – phased approach and architectural decision framework.
5. **Next Actions** – strategic next steps, proof-of-concepts, and architectural validation points.

## Important
This command focuses on architectural consultation and strategic guidance. Do not start implementing anything.
```

#### /plan

Triệu hồi subagent “planner-researcher” để lên một kế hoạch chi tiết cho việc implement tính năng hoặc sửa lỗi nào đó phức tạp. **Chỉ REPORT, KHÔNG thực thi.**

---

*Phần còn lại dành cho thành viên có quyền đọc toàn bài (Knowledges, Kết hợp, Cộng đồng) — see plans at https://zuey.me/pricing*
