Le Duy Khuong

Chuỗi: claude-code-20-p3 · Phần 2

Năng suất & công cụ dev

Verification — checkpoint và verify

Checkpoint trạng thái; verify sau thay đổi; eval-driven workflow.

2026-03-146 phút đọcVI

Phần 2 của 540% hoàn thành

Verification — checkpoint và verify

English title: Verification — Checkpoint and Verify

Bài 12 trong chuỗi 20 bài về Claude Code. Làm xong một bước thì đóng dấu (checkpoint); verify trước khi sang bước tiếp để không tích lũy lỗi. Bài này giải thích checkpoint, verify, và eval-driven workflow.


Mở đầu: Làm xong một bước — đóng dấu; verify trước khi sang bước tiếp

Agent vừa implement feature X. Thay vì làm tiếp feature Y ngay, bạn chạy verify: build + test (và nếu có: lint, typecheck). Pass thì checkpoint (lưu snapshot trạng thái) và compact nếu cần; fail thì sửa trước. Workflow eval-driven = verify là gate: không qua bước tiếp nếu verify fail.


1. Đi sâu: Checkpoint và verify

Checkpoint: Lưu snapshot trạng thái tại điểm quan trọng — file list, test output, (optional) diff. Dùng để rollback hoặc so sánh sau. Tạo checkpoint sau phase/task hoàn thành, trước thay đổi lớn.

Verify: Chạy bộ kiểm tra (test, lint, build) sau khi code thay đổi. Fail thì dừng hoặc retry; pass thì cho phép compact/checkpoint/next task. Verify tối thiểu: build + test; mở rộng: lint, e2e. Có thể tích hợp hook PostToolUse (sau mỗi lần agent sửa file) hoặc command /verify.

Eval-driven workflow: Pipeline: plan → implement → verify → (pass) checkpoint/compact → next task. Verify bắt buộc trước merge/phase complete; skip có chủ đích (WIP) phải ghi chú.


2. Khái niệm

  • Checkpoint: Snapshot state (code, test result). Format: file list, test output; tên checkpoint (vd. feature-x-done).
  • Verify: Script/command chạy build, test, (optional) lint. Pass/fail; tích hợp hook hoặc command.
  • Gate: Verify làm điều kiện để sang bước tiếp; chỉ compact sau verify pass (tránh compact khi code đang fail).

3. Workflow

  1. Sau khi implement task: chạy verify (build + test). Fail → sửa, chạy lại.
  2. Pass → checkpoint (optional), compact (optional tại breakpoint). Tiếp tục task tiếp.
  3. Hook hoặc command: PostToolUse gọi verify script; hoặc user gõ /verify sau mỗi phase.

Bài 13 nói TDD với Claude Code — RED-GREEN-REFACTOR, coverage, tích hợp TDD vào workflow.


Bài tiếp: TDD với Claude Code (bài 13).

LDK

Le Duy Khuong

AI Transformation & Digital Strategy. Writing about agentic systems, engineering leadership, and building in public.