# Building Verification Loops in Claude Code with Skills

> Source: <https://dev.to/sarantoon/building-verification-loops-in-claude-code-with-skills-2a60>
> Published: 2026-07-25 05:35:57+00:00

*โดย 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 คือวงจรที่ 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]

ก่อนจะสร้าง 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 กลับไปแก้ใหม่ |

Anthropic แนะนำ 3 ขั้นตอน [1]:

ถามตัวเองว่า — ทุกครั้งที่ Claude ส่งงานมา คุณตรวจอะไรซ้ำๆ?

`error`

เมื่อ status ไม่ใช่ 200"เขียนเป็น plain English — เหมือนอธิบายให้เพื่อนร่วมทีมใหม่ฟัง

ถ้ายังนึกไม่ออกว่าจะเขียน check ยังไง — ถาม Claude:

"What are the best practices for verifying frontend changes in this project?"

Claude จะเสนอ checks มาให้ — คุณแก้เฉพาะจุดที่ต่างจาก standard — เพราะจุดที่ต่างนั่นแหละคือสิ่งที่คุณต้อง capture

ใช้ skill-creator plugin ให้ Claude สัมภาษณ์คุณ:

```
/skill-creator Create a skill for verifying frontend changes end-to-end. Interview me about my workflow.
```

Claude จะถามคำถามเพื่อเข้าใจ workflow ของคุณ — แล้วสร้าง SKILL.md ให้

Anthropic แชร์ 3 verification loops ที่ทีมภายในใช้ [1]:

```
# 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
# 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
# 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
```

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

`/skill-creator`

ในมุมมองของผม — 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](https://claude.com/blog/building-verification-loops-in-claude-code-with-skills)
