بنقرة واحدة
verify-phase
通过目标回溯分析验证阶段目标达成。检查代码库是否真正交付了阶段承诺的内容,而非仅仅完成任务。
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
通过目标回溯分析验证阶段目标达成。检查代码库是否真正交付了阶段承诺的内容,而非仅仅完成任务。
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
将已发布版本(v1.0、v1.1、v2.0)标记为完成。在 MILESTONES.md 中创建历史记录,执行 PROJECT.md 演进审查,重组 ROADMAP.md,并在 git 中打标签。
编排并行调试代理以调查 UAT 差距并查找根本原因。按差距生成调试代理,收集诊断结果,更新 UAT.md。
以适当的深度级别执行发现。生成 DISCOVERY.md 用于指导 PLAN.md 的创建。支持快速验证、标准和深度模式。
提取下游代理所需的实施决策。分析阶段以识别灰色地带,与用户讨论,并为研究和计划捕获决策。
使用波次并行执行阶段中的所有计划。编排器将计划执行委托给子代理,管理波次和检查点。
执行阶段提示(PLAN.md)并创建结果摘要(SUMMARY.md)。处理任务执行并集成 git。
| name | verify-phase |
| description | 通过目标回溯分析验证阶段目标达成。检查代码库是否真正交付了阶段承诺的内容,而非仅仅完成任务。 |
<core_principle> Task completion ≠ Goal achievement
A task "create chat component" can be marked complete when the component is a placeholder. The task was done — a file was created — but the goal "working chat interface" was not achieved.
Goal-backward verification starts from the outcome and works backwards:
Then verify each level against the actual codebase. </core_principle>
<required_reading> ../../instructions/verification-patterns.instructions.md @.gsd/templates/verification-report.md </required_reading>
**Gather all verification context:**# Phase directory (match both zero-padded and unpadded)
PADDED_PHASE=$(printf "%02d" ${PHASE_ARG} 2>/dev/null || echo "${PHASE_ARG}")
PHASE_DIR=$(ls -d .gsd/phases/${PADDED_PHASE}-* .gsd/phases/${PHASE_ARG}-* 2>/dev/null | head -1)
# Phase goal from ROADMAP
grep -A 5 "Phase ${PHASE_NUM}" .gsd/ROADMAP.md
# Requirements mapped to this phase
grep -E "^| ${PHASE_NUM}" .gsd/REQUIREMENTS.md 2>/dev/null
# All SUMMARY files (claims to verify)
ls "$PHASE_DIR"/*-SUMMARY.md 2>/dev/null
# All PLAN files (for must_haves in frontmatter)
ls "$PHASE_DIR"/*-PLAN.md 2>/dev/null
Extract phase goal: Parse ROADMAP.md for this phase's goal/description. This is the outcome to verify, not the tasks.
Extract requirements: If REQUIREMENTS.md exists, find requirements mapped to this phase. These become additional verification targets.
**Determine what must be verified.**Option A: Must-haves in PLAN frontmatter
Check if any PLAN.md has must_haves in frontmatter:
grep -l "must_haves:" "$PHASE_DIR"/*-PLAN.md 2>/dev/null
If found, extract and use:
must_haves:
truths:
- "User can see existing messages"
- "User can send a message"
artifacts:
- path: "src/components/Chat.tsx"
provides: "Message list rendering"
key_links:
- from: "Chat.tsx"
to: "api/chat"
via: "fetch in useEffect"
Option B: Derive from phase goal
If no must_haves in frontmatter, derive using goal-backward process:
State the goal: Take phase goal from ROADMAP.md
Derive truths: Ask "What must be TRUE for this goal to be achieved?"
Derive artifacts: For each truth, ask "What must EXIST?"
src/components/Chat.tsx, not "chat component"Derive key links: For each artifact, ask "What must be CONNECTED?"
Document derived must-haves before proceeding to verification.
A truth is achievable if the supporting artifacts exist, are substantive, and are wired correctly.
Verification status:
For each truth:
Example:
Truth: "User can see existing messages"
Supporting artifacts:
If Chat.tsx is a stub → Truth FAILED If /api/chat GET returns hardcoded [] → Truth FAILED If Chat.tsx exists, is substantive, calls API, renders response → Truth VERIFIED
**For each required artifact, verify three levels:**check_exists() {
local path="$1"
if [ -f "$path" ]; then
echo "EXISTS"
elif [ -d "$path" ]; then
echo "EXISTS (directory)"
else
echo "MISSING"
fi
}
If MISSING → artifact fails, record and continue to next artifact.
Check that the file has real implementation, not a stub.
Line count check:
check_length() {
local path="$1"
local min_lines="$2"
local lines=$(wc -l < "$path" 2>/dev/null || echo 0)
[ "$lines" -ge "$min_lines" ] && echo "SUBSTANTIVE ($lines lines)" || echo "THIN ($lines lines)"
}
Minimum lines by type:
Stub pattern check:
check_stubs() {
local path="$1"
# Universal stub patterns
local stubs=$(grep -c -E "TODO|FIXME|placeholder|not implemented|coming soon" "$path" 2>/dev/null || echo 0)
# Empty returns
local empty=$(grep -c -E "return null|return undefined|return \{\}|return \[\]" "$path" 2>/dev/null || echo 0)
# Placeholder content
local placeholder=$(grep -c -E "will be here|placeholder|lorem ipsum" "$path" 2>/dev/null || echo 0)
local total=$((stubs + empty + placeholder))
[ "$total" -gt 0 ] && echo "STUB_PATTERNS ($total found)" || echo "NO_STUBS"
}
Export check (for components/hooks):
check_exports() {
local path="$1"
grep -E "^export (default )?(function|const|class)" "$path" && echo "HAS_EXPORTS" || echo "NO_EXPORTS"
}
Combine level 2 results:
Check that the artifact is connected to the system.
Import check (is it used?):
check_imported() {
local artifact_name="$1"
local search_path="${2:-src/}"
# Find imports of this artifact
local imports=$(grep -r "import.*$artifact_name" "$search_path" --include="*.ts" --include="*.tsx" 2>/dev/null | wc -l)
[ "$imports" -gt 0 ] && echo "IMPORTED ($imports times)" || echo "NOT_IMPORTED"
}
Usage check (is it called?):
check_used() {
local artifact_name="$1"
local search_path="${2:-src/}"
# Find usages (function calls, component renders, etc.)
local uses=$(grep -r "$artifact_name" "$search_path" --include="*.ts" --include="*.tsx" 2>/dev/null | grep -v "import" | wc -l)
[ "$uses" -gt 0 ] && echo "USED ($uses times)" || echo "NOT_USED"
}
Combine level 3 results:
| Exists | Substantive | Wired | Status |
|---|---|---|---|
| ✓ | ✓ | ✓ | ✓ VERIFIED |
| ✓ | ✓ | ✗ | ⚠️ ORPHANED |
| ✓ | ✗ | - | ✗ STUB |
| ✗ | - | - | ✗ MISSING |
Record status and evidence for each artifact.
**Verify key links between artifacts.**Key links are critical connections. If broken, the goal fails even with all artifacts present.
Check if component actually calls the API:
verify_component_api_link() {
local component="$1"
local api_path="$2"
# Check for fetch/axios call to the API
local has_call=$(grep -E "fetch\(['\"].*$api_path|axios\.(get|post).*$api_path" "$component" 2>/dev/null)
if [ -n "$has_call" ]; then
# Check if response is used
local uses_response=$(grep -A 5 "fetch\|axios" "$component" | grep -E "await|\.then|setData|setState" 2>/dev/null)
if [ -n "$uses_response" ]; then
echo "WIRED: $component → $api_path (call + response handling)"
else
echo "PARTIAL: $component → $api_path (call exists but response not used)"
fi
else
echo "NOT_WIRED: $component → $api_path (no call found)"
fi
}
Check if API route queries database:
verify_api_db_link() {
local route="$1"
local model="$2"
# Check for Prisma/DB call
local has_query=$(grep -E "prisma\.$model|db\.$model|$model\.(find|create|update|delete)" "$route" 2>/dev/null)
if [ -n "$has_query" ]; then
# Check if result is returned
local returns_result=$(grep -E "return.*json.*\w+|res\.json\(\w+" "$route" 2>/dev/null)
if [ -n "$returns_result" ]; then
echo "WIRED: $route → database ($model)"
else
echo "PARTIAL: $route → database (query exists but result not returned)"
fi
else
echo "NOT_WIRED: $route → database (no query for $model)"
fi
}
Check if form submission does something:
verify_form_handler_link() {
local component="$1"
# Find onSubmit handler
local has_handler=$(grep -E "onSubmit=\{|handleSubmit" "$component" 2>/dev/null)
if [ -n "$has_handler" ]; then
# Check if handler has real implementation
local handler_content=$(grep -A 10 "onSubmit.*=" "$component" | grep -E "fetch|axios|mutate|dispatch" 2>/dev/null)
if [ -n "$handler_content" ]; then
echo "WIRED: form → handler (has API call)"
else
# Check for stub patterns
local is_stub=$(grep -A 5 "onSubmit" "$component" | grep -E "console\.log|preventDefault\(\)$|\{\}" 2>/dev/null)
if [ -n "$is_stub" ]; then
echo "STUB: form → handler (only logs or empty)"
else
echo "PARTIAL: form → handler (exists but unclear implementation)"
fi
fi
else
echo "NOT_WIRED: form → handler (no onSubmit found)"
fi
}
Check if state is actually rendered:
verify_state_render_link() {
local component="$1"
local state_var="$2"
# Check if state variable exists
local has_state=$(grep -E "useState.*$state_var|\[$state_var," "$component" 2>/dev/null)
if [ -n "$has_state" ]; then
# Check if state is used in JSX
local renders_state=$(grep -E "\{.*$state_var.*\}|\{$state_var\." "$component" 2>/dev/null)
if [ -n "$renders_state" ]; then
echo "WIRED: state → render ($state_var displayed)"
else
echo "NOT_WIRED: state → render ($state_var exists but not displayed)"
fi
else
echo "N/A: state → render (no state var $state_var)"
fi
}
For each key link in must_haves:
# Find requirements mapped to this phase
grep -E "Phase ${PHASE_NUM}" .gsd/REQUIREMENTS.md 2>/dev/null
For each requirement:
Requirement status:
Identify files modified in this phase:
# Extract files from SUMMARY.md
grep -E "^\- \`" "$PHASE_DIR"/*-SUMMARY.md | sed 's/.*`\([^`]*\)`.*/\1/' | sort -u
Run anti-pattern detection:
scan_antipatterns() {
local files="$@"
echo "## Anti-Patterns Found"
echo ""
for file in $files; do
[ -f "$file" ] || continue
# TODO/FIXME comments
grep -n -E "TODO|FIXME|XXX|HACK" "$file" 2>/dev/null | while read line; do
echo "| $file | $(echo $line | cut -d: -f1) | TODO/FIXME | ⚠️ Warning |"
done
# Placeholder content
grep -n -E "placeholder|coming soon|will be here" "$file" -i 2>/dev/null | while read line; do
echo "| $file | $(echo $line | cut -d: -f1) | Placeholder | 🛑 Blocker |"
done
# Empty implementations
grep -n -E "return null|return \{\}|return \[\]|=> \{\}" "$file" 2>/dev/null | while read line; do
echo "| $file | $(echo $line | cut -d: -f1) | Empty return | ⚠️ Warning |"
done
# Console.log only implementations
grep -n -B 2 -A 2 "console\.log" "$file" 2>/dev/null | grep -E "^\s*(const|function|=>)" | while read line; do
echo "| $file | - | Log-only function | ⚠️ Warning |"
done
done
}
Categorize findings:
Some things can't be verified programmatically:
Always needs human:
Needs human if uncertain:
Format for human verification:
## Human Verification Required
### 1. {Test Name}
**Test:** {What to do}
**Expected:** {What should happen}
**Why human:** {Why can't verify programmatically}
**Calculate overall verification status.**
Status: passed
Status: gaps_found
Status: human_needed
Calculate score:
score = (verified_truths / total_truths)
**If gaps_found, recommend fix plans.**
Group related gaps into fix plans:
Identify gap clusters:
Generate plan recommendations:
### {phase}-{next}-PLAN.md: {Fix Name}
**Objective:** {What this fixes}
**Tasks:**
1. {Task to fix gap 1}
- Files: {files to modify}
- Action: {specific fix}
- Verify: {how to confirm fix}
2. {Task to fix gap 2}
- Files: {files to modify}
- Action: {specific fix}
- Verify: {how to confirm fix}
3. Re-verify phase goal
- Run verification again
- Confirm all must-haves pass
**Estimated scope:** {Small / Medium}
Keep plans focused:
Order by dependency:
REPORT_PATH="$PHASE_DIR/${PHASE_NUM}-VERIFICATION.md"
Fill template sections:
See ~/.gsd/templates/verification-report.md for complete template.
**Return results to execute-phase orchestrator.**Return format:
## Verification Complete
**Status:** {passed | gaps_found | human_needed}
**Score:** {N}/{M} must-haves verified
**Report:** .gsd/phases/{phase_dir}/{phase}-VERIFICATION.md
{If passed:}
All must-haves verified. Phase goal achieved. Ready to proceed.
{If gaps_found:}
### Gaps Found
{N} critical gaps blocking goal achievement:
1. {Gap 1 summary}
2. {Gap 2 summary}
### Recommended Fixes
{N} fix plans recommended:
1. {phase}-{next}-PLAN.md: {name}
2. {phase}-{next+1}-PLAN.md: {name}
{If human_needed:}
### Human Verification Required
{N} items need human testing:
1. {Item 1}
2. {Item 2}
Automated checks passed. Awaiting human verification.
The orchestrator will:
passed: Continue to update_roadmapgaps_found: Create and execute fix plans, then re-verifyhuman_needed: Present items to user, collect responses
<success_criteria>