Skip to content
←INDEX / Prompt library
TUTORIAL/Claude Code / Codex/Intermediate

AI Agent Definition-of-Done Self-Check Spec

A Definition of Done template you can paste into any coding agent, turning 'what counts as done' into a checklist the agent must self-verify item by item: behavior meets acceptance criteria, tests/lint/typecheck/build all pass (or it states why they didn't run), risky changes come with a rollback plan, and a final 'verification story' is delivered. Puts an end to agents claiming 'done' while everything is actually broken.

SakuyaPromptCraft editor · Updated 2026-06-08
TutorialClaude Code / CodexIntermediate
01PROMPT
Before you report this task as done, you MUST self-verify against the Definition of Done below. Treat "done" as a claim you have to prove, not a feeling. If you cannot satisfy a check, do NOT silently skip it — state exactly which check failed and why.

## The task
{{TASK_DESCRIPTION}}

## Acceptance criteria (the change is correct only if ALL hold)
{{ACCEPTANCE_CRITERIA}}

## Out of scope — do NOT touch
{{OUT_OF_SCOPE}}

## Definition of Done checklist — go through every item and mark ✅ / ❌ with evidence
1. **Behavior** — The change satisfies every acceptance criterion above. For each criterion, say in one line how the code now satisfies it.
2. **Scope discipline** — You touched only what was needed; nothing in the out-of-scope list changed. List the files you modified and confirm none are out of scope.
3. **Tests** — Run the project's test command (`{{TEST_COMMAND}}`). Paste the real, unedited result (pass/fail counts). If you could not run it, say so explicitly and why — never claim it passed without running it.
4. **Lint / typecheck / build** — Run `{{QUALITY_COMMANDS}}`. Paste the actual output. Any new error you introduced must be fixed, not suppressed.
5. **New coverage** — If you added or changed behavior, you added or updated at least one test that would FAIL on the old code and PASS on the new code. Name it. If you intentionally didn't, justify it.
6. **Edge cases** — List the edge / error cases relevant to this change (empty input, null, concurrency, failure path, etc.) and confirm each is handled or explicitly out of scope.
7. **Conventions** — The new code matches existing patterns, naming, and error-handling style in the surrounding files (don't invent a new style).
8. **Rollback / risk** — If this change is risky (touches data, auth, money, migrations, shared infra), describe how to revert it (single commit? feature flag?). If low-risk, say so.
9. **No placeholders** — Confirm there are no `TODO`, `pass`, `...`, stubbed functions, or commented-out "will do later" left in the diff.

## Final output — the verification story
End with a short paragraph a human reviewer can read in 30 seconds: what you changed, why it's correct, what you ran to prove it, and any check that is ❌ with the honest reason. Do not say "done" anywhere unless items 1–9 are all ✅ or have a stated, accepted reason.

Swap the variables inside the [ ] brackets for your own content, then paste into Claude Code / Codex.

◆ Open in toolClaude (paste it)
RUNTRY IT
▶ TRY IT ON-SITE

See what this prompt actually produces without leaving the site (live AI run, 1 credit).

SKILLINSTALL AS SKILL
INSTALL AS SKILLClaude Code Agent Skill

Don't just copy-paste — download and drop it at ~/.claude/skills/agent-definition-of-done-self-gate-spec/SKILL.md and every future session can use it automatically.

macOS / Linux
mkdir -p ~/.claude/skills/agent-definition-of-done-self-gate-spec && mv ~/Downloads/SKILL.md ~/.claude/skills/agent-definition-of-done-self-gate-spec/SKILL.md
Windows PowerShell
New-Item -ItemType Directory -Force "$env:USERPROFILE\.claude\skills\agent-definition-of-done-self-gate-spec" | Out-Null; Move-Item "$env:USERPROFILE\Downloads\SKILL.md" "$env:USERPROFILE\.claude\skills\agent-definition-of-done-self-gate-spec\SKILL.md"
02CONTEXT / Why it works

Where to use it: append this to the end of any moderately important coding task (bug fix, new feature, API change), or trim it down and put it into CLAUDE.md / AGENTS.md as a standing rule that applies every time. Why it works: (1) it turns 'done' from a feeling into a claim that requires evidence, directly targeting agents' most common failure mode of false completion; (2) it demands pasting 'real, unedited test/build output,' blocking the agent from fabricating green checkmarks; (3) an explicit out-of-scope list plus a scope-discipline self-check keeps it from casually touching unrelated files; (4) the 'verification story' lets a human reviewer understand what happened in 30 seconds. Tip: fill TEST_COMMAND / QUALITY_COMMANDS with your project's real commands (e.g. pnpm test, tsc --noEmit, next build) so the agent has something to actually run. This Definition of Done concept works for Claude Code, Codex, or any agent that can execute commands.

03SAMPLE / Expected result

## Definition of Done 1. Behavior ✅ — 三條驗收標準逐條對應到 auth.ts L40-58。 2. Scope ✅ — 只改 auth.ts / auth.test.ts,未碰 out-of-scope 的 db/。 3. Tests ✅ — `pnpm test`:`Test Files 12 passed | Tests 84 passed`(原文貼上)。 4. Lint/typecheck/build ✅ — `tsc --noEmit` exit 0;`next build` 成功。 5. New coverage ✅ — 新增 `returns JSON on 401`,在舊 code 會 fail。 6. Edge cases ✅ — 空 body / 過期 token / 並發重送 已處理。 7. Conventions ✅ — 沿用既有 `errJson()` helper。 8. Rollback ✅ — 單一 commit,可直接 revert。 9. No placeholders ✅。 Verification story:把 401 從回 HTML 改成回結構化 JSON,新增對應測試證明新舊行為差異,型別/建置全綠,單一 commit 可回滾。

A description of the intended result. Check this entry's testing notes and try the prompt with your own inputs.

04VARIABLES
01[TASK_DESCRIPTION]

這次要做的任務,一兩句講清楚目標

02[ACCEPTANCE_CRITERIA]

具體驗收標準,越可驗證越好(例如:『/login 401 時回 JSON 而非 HTML』『清單空時顯示空狀態而非崩潰』)

03[OUT_OF_SCOPE]

明確不准動的範圍(哪些檔案/模組/行為不能改),用來防止 agent 順手改壞別的地方

04[TEST_COMMAND]

專案的測試指令,如 pnpm test / npm run test / pytest

05[QUALITY_COMMANDS]

lint / typecheck / build 指令,如 tsc --noEmit、eslint .、next build

05RESOLVER · 變數代入器0 / 5

填下面的欄位,上方 prompt 會即時替換 [方括號] 內容。填好後按「複製組好的 prompt」直接丟進工具。

修飾
Assembled · 填剩餘變數…
Before you report this task as done, you MUST self-verify against the Definition of Done below. Treat "done" as a claim you have to prove, not a feeling. If you cannot satisfy a check, do NOT silently skip it — state exactly which check failed and why.

## The task
{{TASK_DESCRIPTION}}

## Acceptance criteria (the change is correct only if ALL hold)
{{ACCEPTANCE_CRITERIA}}

## Out of scope — do NOT touch
{{OUT_OF_SCOPE}}

## Definition of Done checklist — go through every item and mark ✅ / ❌ with evidence
1. **Behavior** — The change satisfies every acceptance criterion above. For each criterion, say in one line how the code now satisfies it.
2. **Scope discipline** — You touched only what was needed; nothing in the out-of-scope list changed. List the files you modified and confirm none are out of scope.
3. **Tests** — Run the project's test command (`{{TEST_COMMAND}}`). Paste the real, unedited result (pass/fail counts). If you could not run it, say so explicitly and why — never claim it passed without running it.
4. **Lint / typecheck / build** — Run `{{QUALITY_COMMANDS}}`. Paste the actual output. Any new error you introduced must be fixed, not suppressed.
5. **New coverage** — If you added or changed behavior, you added or updated at least one test that would FAIL on the old code and PASS on the new code. Name it. If you intentionally didn't, justify it.
6. **Edge cases** — List the edge / error cases relevant to this change (empty input, null, concurrency, failure path, etc.) and confirm each is handled or explicitly out of scope.
7. **Conventions** — The new code matches existing patterns, naming, and error-handling style in the surrounding files (don't invent a new style).
8. **Rollback / risk** — If this change is risky (touches data, auth, money, migrations, shared infra), describe how to revert it (single commit? feature flag?). If low-risk, say so.
9. **No placeholders** — Confirm there are no `TODO`, `pass`, `...`, stubbed functions, or commented-out "will do later" left in the diff.

## Final output — the verification story
End with a short paragraph a human reviewer can read in 30 seconds: what you changed, why it's correct, what you ran to prove it, and any check that is ❌ with the honest reason. Do not say "done" anywhere unless items 1–9 are all ✅ or have a stated, accepted reason.
RELATED
PRO01
TUTORIALSuno v5.5FEATURED
r/SunoAI (anonymous studio engineer)2026-06-12

Suno Engineer's Mindset: 4 Steps to a Song That Doesn't Sound Like AI

5.0(1)

A studio engineer's breakdown of Suno's fatal weaknesses (fried vocals, high-frequency artifacts), plus a 4-step DAW workflow and a Suno Studio cleanup prompt.

Advanced
Read

Free02
TUTORIALClaude 4.5 SonnetFEATURED
r/ClaudeAI2026-05-14

5 Claude Weekly Workflows That Stuck After 6 Months

Proposal generator / meeting processor / content repurposer / Friday review / shutdown reset — out of 40 I tried, only these 5 survived, each saving 30+ minutes per run.

Intermediate
Read

PRO03
TUTORIALClaude 4.5 SonnetFEATURED
r/PromptEngineering2026-05-14

7 Cross-Model A/B-Tested Prompt Techniques (Not Vibes)

Written after six months of A/B testing 200+ prompts on Claude, GPT-4, and Gemini with human raters. Covers persona + constraint stacking, anti-examples, role-reversal QA, cognitive scaffolds, emotional priming, uncertainty CoT, and steelman-first.

Advanced
Read

Free04
TUTORIALChatGPTFEATURED
r/ChatGPTPromptGenius2026-05-14

5 trust-checking one-liner prompts (no role-play)

After a year of role-play system prompts and 14-step frameworks, here's the takeaway: the thing that actually moved the needle on quality was 5 one-line prompts. No roles, no markdown, no "you are an expert."

Beginner
Read

COMMENTS · 討論區0 則
登入 後可留言。還沒帳號?註冊
目前沒有留言。第一個說說你的經驗。