diff options
| author | Jesse Vincent <jesse@fsck.com> | 2025-11-28 14:51:08 -0800 |
|---|---|---|
| committer | Jesse Vincent <jesse@fsck.com> | 2025-12-17 16:44:50 -0800 |
| commit | 51a171cd141fac5f1d391c32b310b637f17c9a7b (patch) | |
| tree | ae51afe3f3be901bf7cb2e3c16d1cfcac1e95b6a /tests/claude-code/test-subagent-driven-development.sh | |
| parent | 466332f69824a913c9e88838a80551b83fa0d6cc (diff) | |
Add Claude Code skills test framework
Created automated test suite for testing superpowers skills using
Claude Code CLI in headless mode.
New files:
- tests/claude-code/run-skill-tests.sh - Main test runner
- tests/claude-code/test-helpers.sh - Helper functions for testing
- tests/claude-code/test-subagent-driven-development.sh - First test
- tests/claude-code/README.md - Documentation
Test framework features:
- Run Claude Code with prompts and capture output
- Assertion helpers (contains, not_contains, count, order)
- Test project creation helpers
- Timeout support (default 5 minutes)
- Verbose mode for debugging
- Specific test selection
First test verifies subagent-driven-development skill:
- Skill loading
- Workflow ordering (spec compliance before code quality)
- Self-review requirements
- Plan reading efficiency (read once)
- Spec compliance reviewer skepticism
- Review loops
- Task context provision
Run with: cd tests/claude-code && ./run-skill-tests.sh
Diffstat (limited to 'tests/claude-code/test-subagent-driven-development.sh')
| -rwxr-xr-x | tests/claude-code/test-subagent-driven-development.sh | 139 |
1 files changed, 139 insertions, 0 deletions
diff --git a/tests/claude-code/test-subagent-driven-development.sh b/tests/claude-code/test-subagent-driven-development.sh new file mode 100755 index 0000000..8edea06 --- /dev/null +++ b/tests/claude-code/test-subagent-driven-development.sh @@ -0,0 +1,139 @@ +#!/usr/bin/env bash +# Test: subagent-driven-development skill +# Verifies that the skill is loaded and follows correct workflow +set -euo pipefail + +SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" +source "$SCRIPT_DIR/test-helpers.sh" + +echo "=== Test: subagent-driven-development skill ===" +echo "" + +# Test 1: Verify skill can be loaded +echo "Test 1: Skill loading..." + +output=$(run_claude "What is the subagent-driven-development skill? Describe its key steps briefly." 30) + +if assert_contains "$output" "subagent-driven-development" "Skill is recognized"; then + : # 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..." + +output=$(run_claude "In the subagent-driven-development skill, what comes first: spec compliance review or code quality review? Be specific about the order." 30) + +if assert_order "$output" "spec.*compliance" "code.*quality" "Spec compliance before code quality"; then + : # pass +else + exit 1 +fi + +echo "" + +# Test 3: Verify self-review is mentioned +echo "Test 3: Self-review requirement..." + +output=$(run_claude "Does the subagent-driven-development skill require implementers to do self-review? What should they check?" 30) + +if assert_contains "$output" "self-review\|self review" "Mentions self-review"; then + : # pass +else + exit 1 +fi + +if assert_contains "$output" "completeness\|Completeness" "Checks completeness"; then + : # pass +else + exit 1 +fi + +echo "" + +# Test 4: Verify plan is read once +echo "Test 4: Plan reading efficiency..." + +output=$(run_claude "In subagent-driven-development, how many times should the controller read the plan file? When does this happen?" 30) + +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..." + +output=$(run_claude "What is the spec compliance reviewer's attitude toward the implementer's report in subagent-driven-development?" 30) + +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..." + +output=$(run_claude "In subagent-driven-development, what happens if a reviewer finds issues? Is it a one-time review or a loop?" 30) + +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..." + +output=$(run_claude "In subagent-driven-development, how does the controller provide task information to the implementer subagent? Does it make them read a file or provide it directly?" 30) + +if assert_contains "$output" "provide.*directly\|full.*text\|paste\|include.*prompt" "Provides text directly"; then + : # pass +else + exit 1 +fi + +if assert_not_contains "$output" "read.*file\|open.*file" "Doesn't make subagent read file"; then + : # pass +else + exit 1 +fi + +echo "" + +echo "=== All subagent-driven-development skill tests passed ===" |
