สร้าง Verification Loop ใน Claude Code ด้วย Skills — เปลี่ยนการตรวจสอบด้วยมือให้เป็นระบบอัตโนมัติ
โดย Nokka (นก-กา) | 25 กรกฎาคม 2026
บทความนี้เขียนโดย AI (DeepSeek V4 Pro) ผ่าน Hermes Agent ภายใต้การควบคุมของ Nokka (นก-กา)
คุณเคยเจอ pattern นี้ไหม — สั่ง Claude Code แก้โค้ด → มันทำงานเสร็จ → คุณตรวจ → เจอจุดเล็กๆ ที่ต้องแก้ → แก้เอง → สั่งใหม่ → วนซ้ำ
Anthropic เพิ่งเผยแพร่บทความ "Building verification loops in Claude Code with skills" [1] — อธิบายวิธีเปลี่ยน manual checks พวกนี้ให้เป็นระบบอัตโนมัติที่ Claude ตรวจสอบและแก้ไขงานตัวเองได้ โดยคุณไม่ต้องนั่งเฝ้า
Verification Loop คืออะไร
Verification loop คือวงจรที่ AI agent ตรวจสอบงานตัวเอง — รัน tests, linters, หรือ custom checks — แล้วแก้ไขสิ่งที่ fail ก่อนส่งมอบ
แนวคิดนี้ไม่ใหม่ — แต่สิ่งที่ Anthropic ทำคือการทำให้มัน encode เป็น skill ได้ — เพื่อให้ทุก session ใช้ checks ชุดเดียวกันโดยอัตโนมัติ แทนที่จะต้องให้คนจำว่าต้องตรวจอะไรบ้าง
"A verification loop is a repeating cycle where an AI agent checks its own work — running tests, linters, or custom checks — and fixes what fails before moving on." [1]
Built-in Verification Loops — สิ่งที่ Claude Code มีให้อยู่แล้ว
ก่อนจะสร้าง custom loop — Anthropic แนะนำให้เข้าใจสิ่งที่ Claude Code มีในตัวก่อน [1]:
| ฟีเจอร์ | ทำงานยังไง |
|---|---|
/verify skill |
build, run, และ observe การเปลี่ยนแปลงในแอปพลิเคชัน |
| Toolchain | Claude จับ error codes และ warnings จาก linter, type checker, test runner — แนะนำให้ใส่ build/test commands ใน CLAUDE.md |
| Code Review (research preview) | multi-agent service ที่รัน automated review บน PR — แก้เองหรือ comment @claude เพื่อให้ agent แก้ |
| GitHub Actions | ใช้ verification skill เดียวกันรันบนทุก push หรือ PR |
| Spec validation | skill ที่ตรวจสอบทุก change เทียบกับ markdown spec ใน repo |
| Rubrics (Claude Managed Agents, beta) | grader agent ตรวจผลลัพธ์เทียบกับ rubric — ถ้า fail → loop กลับไปแก้ใหม่ |
วิธีเขียน Verification Loop ของตัวเอง
Anthropic แนะนำ 3 ขั้นตอน [1]:
ขั้นที่ 1: เขียนสิ่งที่คุณตรวจด้วยมือทุกครั้ง
ถามตัวเองว่า — ทุกครั้งที่ Claude ส่งงานมา คุณตรวจอะไรซ้ำๆ?
- "ตรวจว่า migration ไม่ drop column โดยไม่มี backfill step"
- "ตรวจว่า API response มี field
errorเมื่อ status ไม่ใช่ 200" - "ตรวจว่า component ใหม่มี test coverage ≥ 80%"
เขียนเป็น plain English — เหมือนอธิบายให้เพื่อนร่วมทีมใหม่ฟัง
ขั้นที่ 2: ถาม Claude ก่อน
ถ้ายังนึกไม่ออกว่าจะเขียน check ยังไง — ถาม Claude:
"What are the best practices for verifying frontend changes in this project?"
Claude จะเสนอ checks มาให้ — คุณแก้เฉพาะจุดที่ต่างจาก standard — เพราะจุดที่ต่างนั่นแหละคือสิ่งที่คุณต้อง capture
ขั้นที่ 3: Encode เป็น Skill
ใช้ skill-creator plugin ให้ Claude สัมภาษณ์คุณ:
/skill-creator Create a skill for verifying frontend changes end-to-end. Interview me about my workflow.
Enter fullscreen mode Exit fullscreen mode
Claude จะถามคำถามเพื่อเข้าใจ workflow ของคุณ — แล้วสร้าง SKILL.md ให้
ตัวอย่างจาก Anthropic — 3 Verification Loops ที่ใช้จริง
Anthropic แชร์ 3 verification loops ที่ทีมภายในใช้ [1]:
1. Frontend Verification Loop
# SKILL.md — Frontend Verification
## Verification Loop
1. Run `npm run build` — fail if build errors
2. Run `npm run lint` — fail if lint errors
3. Run `npm run test` — fail if test failures
4. Start dev server and check:
- No console errors in browser
- All new routes render without crash
- Responsive at 3 breakpoints (mobile, tablet, desktop)
5. If any check fails → fix → re-run from step 1
Enter fullscreen mode Exit fullscreen mode
2. API Migration Safety Loop
# SKILL.md — Migration Safety
## Verification Loop
1. Check every migration file:
- No `DROP COLUMN` without a prior backfill migration
- No `DROP TABLE` without a deprecation notice in CHANGELOG
- All `ADD COLUMN` have DEFAULT or are nullable
2. Run `rails db:migrate:down VERSION=...` — verify reversible
3. If any check fails → reject the migration → ask developer to fix
Enter fullscreen mode Exit fullscreen mode
3. Documentation Sync Loop
# SKILL.md — Docs Sync
## Verification Loop
1. For every changed API endpoint:
- Check that OpenAPI spec is updated
- Check that README example matches new behavior
- Check that CHANGELOG has an entry
2. If any check fails → update the docs → re-check
Enter fullscreen mode Exit fullscreen mode
ทำไมถึงสำคัญ — มากกว่าแค่ประหยัดเวลา
Verification loop ไม่ใช่แค่ automation — มันคือการเปลี่ยน tacit knowledge (สิ่งที่คุณรู้ว่าต้องตรวจ แต่ไม่ได้เขียนไว้) ให้เป็น explicit system (สิ่งที่ Claude ทำได้เอง)
Anthropic บอกว่า:
"Anything you keep having to enforce by hand as a manual check qualifies for capture as a loop." [1]
นี่คือหลักการเดียวกับที่ Nokka ใช้กับ Veritas — Nokka Loop คือ verification loop สำหรับบทความ — NCQS คือ automated check, Veritas คือ grader agent, และการวน 3 รอบคือ feedback loop
เริ่มต้นวันนี้
- คิดถึง manual check ที่คุณทำซ้ำๆ — อะไรที่คุณตรวจทุกครั้งหลัง Claude ทำงานเสร็จ
- เขียนเป็น plain English — 3-5 ข้อ
-
ใช้
/skill-creator— ให้ Claude สัมภาษณ์คุณและสร้าง SKILL.md - ทดสอบ — สั่ง Claude ทำงานแล้วดูว่ามันตรวจสอบตัวเองได้ไหม
- ปรับ — loop ไม่จำเป็นต้องสมบูรณ์ตั้งแต่ครั้งแรก — ปรับไปเรื่อยๆ
ในมุมมองของผม — verification loop คือสิ่งที่แยก "AI ที่ช่วยเขียนโค้ด" ออกจาก "AI ที่ทำงานแทนคุณได้จริง" — เพราะการเขียนโค้ดเป็นแค่ครึ่งเดียวของงาน — การตรวจสอบว่ามันถูกต้องคืออีกครึ่ง
ติดตามบทความเกี่ยวกับ AI, Claude Code, และเครื่องมือสำหรับนักพัฒนาได้ที่ Nokka on dev.to — กด Follow ที่โปรไฟล์เพื่อรับอัปเดตทุกครั้งที่มีบทความใหม่
อ้างอิง
[1] Anthropic, "Building verification loops in Claude Code with skills," Claude Blog, 22 กรกฎาคม 2026. https://claude.com/blog/building-verification-loops-in-claude-code-with-skills
0 Comments
Log in to join the conversation.No comments yet. Be the first to share your thoughts.