2025-11-28 14:51:08 -08:00
#!/usr/bin/env bash
# Test: subagent-driven-development skill
# Verifies that the skill is loaded and follows correct workflow
2026-05-06 12:29:59 -07:00
#
# No drill coverage: this test asks the agent to *describe* SDD (string-
# matches its verbal explanation against expected keywords like
# "self-review", "skeptical", "worktree", "Step 1", "loop"). Drill scenarios
# test behavior (real subagent dispatch, plan-following, review loops),
# not description-recall. Kept by design.
2025-11-28 14:51:08 -08:00
set -euo pipefail
SCRIPT_DIR = " $( cd " $( dirname " $0 " ) " && pwd ) "
source " $SCRIPT_DIR /test-helpers.sh "
2026-05-12 10:24:45 -07:00
CLAUDE_PROMPT_TIMEOUT = " ${ CLAUDE_PROMPT_TIMEOUT :- 90 } "
2025-11-28 14:51:08 -08:00
echo "=== Test: subagent-driven-development skill ==="
echo ""
# Test 1: Verify skill can be loaded
echo "Test 1: Skill loading..."
2026-05-12 10:24:45 -07:00
output = $( run_claude "What is the subagent-driven-development skill? Describe its key steps briefly." " $CLAUDE_PROMPT_TIMEOUT " )
2025-11-28 14:51:08 -08:00
2026-01-29 14:34:38 -08:00
if assert_contains " $output " "subagent-driven-development\|Subagent-Driven Development\|Subagent Driven" "Skill is recognized" ; then
2025-11-28 14:51:08 -08:00
: # pass
else
exit 1
fi
if assert_contains " $output " "Load Plan\|read.*plan\|extract.*tasks" "Mentions loading plan" ; then
: # pass
else
exit 1
fi
echo ""
# Test 2: Verify skill describes correct workflow order
echo "Test 2: Workflow ordering..."
2026-05-12 10:24:45 -07:00
output = $( run_claude " In the subagent-driven-development skill, what comes first: spec compliance review or code quality review? Answer using exactly this structure:
First: <review type>
Second: <review type>" " $CLAUDE_PROMPT_TIMEOUT " )
2025-11-28 14:51:08 -08:00
2026-05-12 10:24:45 -07:00
if assert_order " $output " "First:.*spec.*compliance" "Second:.*code.*quality" "Spec compliance before code quality" ; then
2025-11-28 14:51:08 -08:00
: # pass
else
exit 1
fi
echo ""
# Test 3: Verify self-review is mentioned
echo "Test 3: Self-review requirement..."
2026-05-12 10:24:45 -07:00
output = $( run_claude " Does the subagent-driven-development skill require implementers to self-review before handoff, and can self-review replace the external reviews? Answer using exactly this structure:
Self-review required: <yes or no>
Self-review replaces external review: <yes or no>" " $CLAUDE_PROMPT_TIMEOUT " )
2025-11-28 14:51:08 -08:00
2026-05-12 10:24:45 -07:00
if assert_contains " $output " "Self-review required:.*yes" "Mentions self-review" ; then
2025-11-28 14:51:08 -08:00
: # pass
else
exit 1
fi
2026-05-12 10:24:45 -07:00
if assert_contains " $output " "Self-review replaces external review:.*no" "Self-review does not replace external review" ; then
2025-11-28 14:51:08 -08:00
: # pass
else
exit 1
fi
echo ""
# Test 4: Verify plan is read once
echo "Test 4: Plan reading efficiency..."
2026-05-12 10:24:45 -07:00
output = $( run_claude "In subagent-driven-development, how many times should the controller read the plan file? When does this happen?" " $CLAUDE_PROMPT_TIMEOUT " )
2025-11-28 14:51:08 -08:00
if assert_contains " $output " "once\|one time\|single" "Read plan once" ; then
: # pass
else
exit 1
fi
if assert_contains " $output " "Step 1\|beginning\|start\|Load Plan" "Read at beginning" ; then
: # pass
else
exit 1
fi
echo ""
# Test 5: Verify spec compliance reviewer is skeptical
echo "Test 5: Spec compliance reviewer mindset..."
2026-05-12 10:24:45 -07:00
output = $( run_claude "What is the spec compliance reviewer's attitude toward the implementer's report in subagent-driven-development?" " $CLAUDE_PROMPT_TIMEOUT " )
2025-11-28 14:51:08 -08:00
if assert_contains " $output " "not trust\|don't trust\|skeptical\|verify.*independently\|suspiciously" "Reviewer is skeptical" ; then
: # pass
else
exit 1
fi
if assert_contains " $output " "read.*code\|inspect.*code\|verify.*code" "Reviewer reads code" ; then
: # pass
else
exit 1
fi
echo ""
# Test 6: Verify review loops
echo "Test 6: Review loop requirements..."
2026-05-12 10:24:45 -07:00
output = $( run_claude "In subagent-driven-development, what happens if a reviewer finds issues? Is it a one-time review or a loop?" " $CLAUDE_PROMPT_TIMEOUT " )
2025-11-28 14:51:08 -08:00
if assert_contains " $output " "loop\|again\|repeat\|until.*approved\|until.*compliant" "Review loops mentioned" ; then
: # pass
else
exit 1
fi
if assert_contains " $output " "implementer.*fix\|fix.*issues" "Implementer fixes issues" ; then
: # pass
else
exit 1
fi
echo ""
# Test 7: Verify full task text is provided
echo "Test 7: Task context provision..."
2026-05-12 10:24:45 -07:00
output = $( run_claude " In subagent-driven-development, how does the controller provide task information to the implementer subagent? Answer using exactly this structure:
Controller provides: <directly or by file>
Implementer must read plan file: <yes or no>" " $CLAUDE_PROMPT_TIMEOUT " )
2025-11-28 14:51:08 -08:00
if assert_contains " $output " "provide.*directly\|full.*text\|paste\|include.*prompt" "Provides text directly" ; then
: # pass
else
exit 1
fi
2026-05-12 10:24:45 -07:00
if assert_contains " $output " "Implementer must read plan file:.*no" "Doesn't make subagent read file" ; then
2025-11-28 14:51:08 -08:00
: # pass
else
exit 1
fi
echo ""
2026-01-29 14:39:50 -08:00
# Test 8: Verify worktree requirement
echo "Test 8: Worktree requirement..."
2026-05-12 10:24:45 -07:00
output = $( run_claude "What workflow skills are required before using subagent-driven-development? List any prerequisites or required skills." " $CLAUDE_PROMPT_TIMEOUT " )
2026-01-29 14:39:50 -08:00
if assert_contains " $output " "using-git-worktrees\|worktree" "Mentions worktree requirement" ; then
: # pass
else
exit 1
fi
echo ""
2026-01-29 14:41:39 -08:00
# Test 9: Verify main branch warning
echo "Test 9: Main branch red flag..."
2026-05-12 10:24:45 -07:00
output = $( run_claude "In subagent-driven-development, is it okay to start implementation directly on the main branch?" " $CLAUDE_PROMPT_TIMEOUT " )
2026-01-29 14:41:39 -08:00
2026-01-29 15:12:50 -08:00
if assert_contains " $output " "worktree\|feature.*branch\|not.*main\|never.*main\|avoid.*main\|don't.*main\|consent\|permission" "Warns against main branch" ; then
2026-01-29 14:41:39 -08:00
: # pass
else
exit 1
fi
echo ""
2025-11-28 14:51:08 -08:00
echo "=== All subagent-driven-development skill tests passed ==="