Cook — Implement tính năng
Implement tính năng đầy đủ end-to-end: plan (nếu chưa có) → code → test → review → docs → commit.Cú pháp
Luồng hoạt động bên trong
Khi bạn gõ/cook "platform listing page", đây là 7 bước xảy ra:
Bước 1: Intent Detection
Phân tích input để detect mode:
- Có path tới
plan.md? → modecode(execute plan) - Chứa “fast”, “quick”? → mode
fast - Chứa “trust me”, “auto”? → mode
auto - Liệt kê 3+ features? → mode
parallel - Mặc định → mode
interactive(có review gates)
Bước 2: Research (skip nếu fast/code mode)
Spawn
researcher agents song song để tìm hiểu codebase.
Dùng /scout hoặc /scout:ext tìm files liên quan.
Review Gate: Hỏi user approve findings trước khi plan.Bước 3: Plan
planner subagent tổng hợp research và tạo plan.
Nếu có UI work → spawn ui-ux-designer subagent.
Review Gate: Hỏi user approve plan trước khi code.Bước 4: Implement
coder subagent viết code theo plan.
Chạy typecheck + compile để đảm bảo không lỗi cú pháp.
Review Gate: Hỏi user approve code trước khi test.Bước 5: Test (skip nếu --no-test)
tester subagent viết và chạy tests.
Nếu fail → debugger subagent tìm root cause → fix → re-test.
Gate: 100% tests phải PASS mới tiếp.Bước 6: Code Review
code-reviewer subagent review code. Nếu có critical issues → fix → re-test.
Auto-approve nếu score >= 9.5 và 0 critical (chỉ auto mode).Hard Gate: KHÔNG được viết code nếu chưa có plan và chưa được review. Dù task có đơn giản đến đâu, phải plan trước.
Ví dụ thực tế
- Input
- Output — Files tạo ra
4 Chế độ Cook
- /cook (interactive — mặc định)
- /cook:auto
- /cook:auto:fast
- /cook:auto:parallel
Implement đầy đủ với review gates ở mỗi bước. User approve trước khi tiếp.Thời gian: 5-15 phút.
Tốt cho: Feature quan trọng, cần kiểm soát chặt.
So sánh với chat trực tiếp
| Tiêu chí | /cook | Chat trực tiếp |
|---|---|---|
| Planning | Bắt buộc plan trước (Hard Gate) | Có thể code thẳng, bỏ plan |
| Testing | Bắt buộc viết tests, 100% PASS mới tiếp | Có thể bỏ qua tests |
| Code Review | Bắt buộc code-reviewer subagent | Không có review tự động |
| Documentation | Tự động cập nhật docs | Phải nhắc thủ công |
| Anti-rationalization | Chặn lý do bỏ qua: “quá đơn giản”, “tôi biết cách rồi” | Không có cơ chế chặn |
| Agents | 7+ agents phối hợp | 1 Claude instance |
| Finalize | 3 subagents: project-manager + docs-manager + git-manager | Phải làm thủ công |
Khi nào dùng / không dùng
| Dùng | Không dùng |
|---|---|
| Implement tính năng mới | Sửa bug (dùng /fix) |
Task có plan sẵn từ /plan | Chỉ muốn hỏi kiến trúc (dùng /plan) |
| Cần output đầy đủ: code + test + review | Thay đổi 1-2 dòng config |
| Feature cần nhiều files | Chạy tests (dùng /test) |
Sub-commands
| Sub-command | Mô tả | Khi nào dùng |
|---|---|---|
/cook "task" | Implement interactive (có review gates) | Feature quan trọng |
/cook:auto "task" | Auto-approve, không hỏi | Feature rõ ràng, tin tưởng |
/cook:auto:fast "task" | Nhanh nhất, skip research | Task nhỏ, fix styling |
/cook:auto:parallel "task" | Parallel fullstack agents | Nhiều modules độc lập |
Bảng mode chi tiết
| Mode | Research | Testing | Review Gates | Phase Progression |
|---|---|---|---|---|
| interactive | Có | Có | User approve mỗi bước | Tuần tự |
| auto | Có | Có | Auto nếu score >= 9.5 | Liên tục |
| fast | Không | Có | User approve mỗi bước | Tuần tự |
| parallel | Tùy chọn | Có | User approve mỗi bước | Song song |
| no-test | Có | Không | User approve mỗi bước | Tuần tự |
| code | Không | Có | User approve mỗi bước | Theo plan |
Workflow khuyên dùng
Lưu ý & Best Practices
Sai lầm phổ biến:
- Dùng
/cook:autocho task phức tạp → bỏ qua review gates, code sai hướng - Skip plan (“code luôn cho nhanh”) → implement sai, phải rewrite
- Không đọc plan trước khi cook → implement thiếu hoặc thừa
- Bỏ test phase → bugs lọt vào staging, QC reject
Tips từ team:
/cook --interactive(default) cho mọi feature quan trọng/cook:auto:fastchỉ cho task nhỏ, rõ ràng, ít rủi ro (typo fix, config change)- Luôn đọc và confirm plan trước khi approve implementation
- Nếu cook bị stuck →
/clearrồi/cook path/to/plan.mdđể resume
Bắt buộc Subagents (MANDATORY)
| Phase | Subagent | Bắt buộc? |
|---|---|---|
| Research | researcher | Tùy mode |
| Scout | ck:scout | Tùy mode |
| Plan | planner | Tùy mode |
| UI Work | ui-ux-designer | Nếu có frontend |
| Testing | tester, debugger | PHẢI spawn |
| Review | code-reviewer | PHẢI spawn |
| Finalize | project-manager, docs-manager, git-manager | PHẢI spawn cả 3 |