Test — Chạy và tạo tests
Chạy test suite, đo coverage, UI testing qua browser, và verify implementations.Cập nhật bộ claudekit mới:
/test-gen đã bỏ, thay bằng /qa-full:tdd:verify (TDD tests + verify), /verify (confirm fix), /run (run command), /test-flakiness (detect flaky tests). Xem cấu trúc skill mới để biết đầy đủ.Cú pháp
Luồng hoạt động bên trong
/test — Chạy tests
1
Bước 1: Pre-flight Checks
Chạy typecheck (
tsc --noEmit) + lint (eslint) để bắt lỗi cú pháp trước.2
Bước 2: Execute Test Suites
Tự động detect test framework (Jest/Vitest/Mocha/pytest/go test) và chạy.
Hỗ trợ: unit tests, integration tests, e2e tests.
3
Bước 3: Coverage Analysis
Đo coverage: lines, branches, functions, statements.
So sánh với target (mặc định 80%).
4
Bước 4: Analyze Failures
Nếu có failing tests → phân tích root cause.
Kích hoạt
ck-debug nếu cần investigation sâu.5
Bước 5: UI Tests (nếu có frontend)
Kích hoạt
ck:chrome-devtools cho:- Screenshots, responsive checks
- Accessibility audits
- Console error collection
6
Bước 6: Report
Tổng hợp kết quả thành QA report cấu trúc.
/verify — Confirm fix without regression
1
Bước 1: Typecheck
Chạy
tsc --noEmit để xác nhận no type errors.2
Bước 2: Lint
Chạy
eslint để xác nhận no lint violations.3
Bước 3: Build
Chạy build command để xác nhận compiles.
4
Bước 4: Tests
Chạy test suite — so sánh before/after.
5
Bước 5: Report
Tổng hợp verification report: status + changes.
Ví dụ thực tế
- /test output
- /verify output
- /test-flakiness output
So sánh: /test vs /verify vs /qa-full:tdd:verify
So sánh với chat trực tiếp
Khi nào dùng / không dùng
Test Framework hỗ trợ
- Vitest (Unit)
- React Testing Library
- Playwright (E2E)
Kết hợp với QA
Coverage Thresholds
- KHÔNG BAO GIỜ bỏ qua failing tests — fix root cause, không dùng mocks/cheats/tricks
- Tất cả critical paths phải có test coverage
- Validate happy path VÀ error scenarios
- Tests phải isolation — không phụ thuộc lẫn nhau
- Tests phải deterministic và reproducible
- Flaky tests PHẢI fix trước merge — không accept flakiness
Chi tiết lệnh Test (Accordion)
/test — Run full test suite + coverage
/test — Run full test suite + coverage
Prefix: Steps:
/testChạy tất cả tests + typecheck + lint + coverage analysis:- Typecheck (
tsc --noEmit) - Lint (
eslint) - Test execution (Jest/Vitest/pytest auto-detect)
- Coverage measurement
- Failure analysis (if any)
/verify — Confirm fix without regression
/verify — Confirm fix without regression
Prefix: Output:
/verifyTypecheck + lint + build + test, so sánh before/after:- Typecheck: PASS/FAIL
- Lint: PASS/FAIL
- Build: PASS/FAIL
- Tests: X pass, Y fail (compared to before)
- Regression: detected or none
/fix hoặc manual code changes, xác nhận không gây regression./test-flakiness — Detect flaky tests
/test-flakiness — Detect flaky tests
Prefix: Output:
/test-flakinessChạy tests múl lần (default 3 runs) để detect tests không stable:- Flaky tests list
- Failure pattern (fail 2/3 runs, timeout, race condition, etc.)
- Recommendation to stabilize
/run — Run arbitrary command + report
/run — Run arbitrary command + report
Prefix: Output: Command output + exit code + timing.Khi dùng: Custom commands, non-standard test runners, CI step verification.
/run "command"Chạy command bất kỳ (npm script, make target, shell) + capture output:/qa-full:tdd:verify — TDD: write tests, then verify
/qa-full:tdd:verify — TDD: write tests, then verify
Prefix: Workflow:
/qa-full:tdd:verify hoặc /cook --tddTest-driven development: write tests first, implement code, verify pass:- Generate test cases từ requirements
- Tests fail (red)
- Implement code to make tests pass (green)
- Verify tất cả tests PASS