TDD — /qa-full:tdd

Viết failing tests TRƯỚC khi code. Dùng cho các feature quan trọng như authentication, payment, core business logic.

Cú pháp

/qa-full:tdd "user authentication with Google OAuth"
/qa-full:tdd docs/prd/F05-editor.md
/qa-full:tdd "payment processing" --brainstorm

Quy tắc bắt buộc

  1. TUẦN TỰ 4 bước — không skip
  2. GỌI SKILL BẰNG SKILL TOOL khi nói “Invoke Skill”
  3. TẤT CẢ tests PHẢI FAIL ở Bước 2 (chưa có code)

4 Bước

1

Bước 1: Brainstorm test cases

1a. Nếu input là file .md → đọc PRD, trích requirements.1b. Gọi skill ck:scenario với feature description:
  • Output 12 dimensions, mỗi dimension 3-5 scenarios + severity
1c. Nếu có --brainstorm flag → gọi thêm skill ck:predict:
  • 5 persona debate test strategy:
    • Architect
    • Security
    • Performance
    • UX
    • Devil’s Advocate
1d. Hỏi user: “Còn edge case nào?”Output: Danh sách test cases với TC-IDs + severity.
2

Bước 2: Viết FAILING tests

Tạo test files — TẤT CẢ tests PHẢI FAIL (chưa có code).
# Chạy tests → xác nhận 100% FAIL
pnpm test
Nếu có test PASS mà chưa code → test SAI → fix test.Output: “14 tests created, all FAIL”
3

Bước 3: Hướng dẫn implement

Không tự code. Output cho user:
Failing tests sẵn sàng. Tiếp theo:
/cook "implement to make all tests pass"
Sau khi /cook xong: /qa-full:tdd:verify
4

Bước 4: Verify (user chạy riêng)

Sau khi dev /cook xong:
/qa-full:tdd:verify
Kiểm tra tất cả tests đã PASS, không có cheating (hardcoded values).

Khi nào dùng

Tình huốngNên dùng TDD?
Authentication / Authorization
Payment processing
Core business logic
CRUD đơn giảnKhông
UI stylingKhông
Config changesKhông

Ví dụ

/qa-full:tdd "user login with email + OTP verification"

→ Bước 1: 12 dimensions analyzed, 22 test cases generated
→ Bước 2: 22 tests written, all FAIL
→ Bước 3: Output: "Chạy /cook để implement"

User chạy: /cook "implement login with OTP"
User chạy: /qa-full:tdd:verify
→ 22/22 tests PASS, no cheating detected