test-subagent-driven-development.sh 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. #!/usr/bin/env bash
  2. # Test: subagent-driven-development skill
  3. # Verifies that the skill is loaded and follows correct workflow
  4. #
  5. # No drill coverage: this test asks the agent to *describe* SDD (string-
  6. # matches its verbal explanation against expected keywords like
  7. # "self-review", "skeptical", "worktree", "Step 1", "loop"). Drill scenarios
  8. # test behavior (real subagent dispatch, plan-following, review loops),
  9. # not description-recall. Kept by design.
  10. set -euo pipefail
  11. SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
  12. source "$SCRIPT_DIR/test-helpers.sh"
  13. echo "=== Test: subagent-driven-development skill ==="
  14. echo ""
  15. # Test 1: Verify skill can be loaded
  16. echo "Test 1: Skill loading..."
  17. output=$(run_claude "What is the subagent-driven-development skill? Describe its key steps briefly." 30)
  18. if assert_contains "$output" "subagent-driven-development\|Subagent-Driven Development\|Subagent Driven" "Skill is recognized"; then
  19. : # pass
  20. else
  21. exit 1
  22. fi
  23. if assert_contains "$output" "Load Plan\|read.*plan\|extract.*tasks" "Mentions loading plan"; then
  24. : # pass
  25. else
  26. exit 1
  27. fi
  28. echo ""
  29. # Test 2: Verify skill describes correct workflow order
  30. echo "Test 2: Workflow ordering..."
  31. 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)
  32. if assert_order "$output" "spec.*compliance" "code.*quality" "Spec compliance before code quality"; then
  33. : # pass
  34. else
  35. exit 1
  36. fi
  37. echo ""
  38. # Test 3: Verify self-review is mentioned
  39. echo "Test 3: Self-review requirement..."
  40. output=$(run_claude "Does the subagent-driven-development skill require implementers to do self-review? What should they check?" 30)
  41. if assert_contains "$output" "self-review\|self review" "Mentions self-review"; then
  42. : # pass
  43. else
  44. exit 1
  45. fi
  46. if assert_contains "$output" "completeness\|Completeness" "Checks completeness"; then
  47. : # pass
  48. else
  49. exit 1
  50. fi
  51. echo ""
  52. # Test 4: Verify plan is read once
  53. echo "Test 4: Plan reading efficiency..."
  54. output=$(run_claude "In subagent-driven-development, how many times should the controller read the plan file? When does this happen?" 30)
  55. if assert_contains "$output" "once\|one time\|single" "Read plan once"; then
  56. : # pass
  57. else
  58. exit 1
  59. fi
  60. if assert_contains "$output" "Step 1\|beginning\|start\|Load Plan" "Read at beginning"; then
  61. : # pass
  62. else
  63. exit 1
  64. fi
  65. echo ""
  66. # Test 5: Verify spec compliance reviewer is skeptical
  67. echo "Test 5: Spec compliance reviewer mindset..."
  68. output=$(run_claude "What is the spec compliance reviewer's attitude toward the implementer's report in subagent-driven-development?" 30)
  69. if assert_contains "$output" "not trust\|don't trust\|skeptical\|verify.*independently\|suspiciously" "Reviewer is skeptical"; then
  70. : # pass
  71. else
  72. exit 1
  73. fi
  74. if assert_contains "$output" "read.*code\|inspect.*code\|verify.*code" "Reviewer reads code"; then
  75. : # pass
  76. else
  77. exit 1
  78. fi
  79. echo ""
  80. # Test 6: Verify review loops
  81. echo "Test 6: Review loop requirements..."
  82. output=$(run_claude "In subagent-driven-development, what happens if a reviewer finds issues? Is it a one-time review or a loop?" 30)
  83. if assert_contains "$output" "loop\|again\|repeat\|until.*approved\|until.*compliant" "Review loops mentioned"; then
  84. : # pass
  85. else
  86. exit 1
  87. fi
  88. if assert_contains "$output" "implementer.*fix\|fix.*issues" "Implementer fixes issues"; then
  89. : # pass
  90. else
  91. exit 1
  92. fi
  93. echo ""
  94. # Test 7: Verify full task text is provided
  95. echo "Test 7: Task context provision..."
  96. 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)
  97. if assert_contains "$output" "provide.*directly\|full.*text\|paste\|include.*prompt" "Provides text directly"; then
  98. : # pass
  99. else
  100. exit 1
  101. fi
  102. if assert_not_contains "$output" "read.*file\|open.*file" "Doesn't make subagent read file"; then
  103. : # pass
  104. else
  105. exit 1
  106. fi
  107. echo ""
  108. # Test 8: Verify worktree requirement
  109. echo "Test 8: Worktree requirement..."
  110. output=$(run_claude "What workflow skills are required before using subagent-driven-development? List any prerequisites or required skills." 30)
  111. if assert_contains "$output" "using-git-worktrees\|worktree" "Mentions worktree requirement"; then
  112. : # pass
  113. else
  114. exit 1
  115. fi
  116. echo ""
  117. # Test 9: Verify main branch warning
  118. echo "Test 9: Main branch red flag..."
  119. output=$(run_claude "In subagent-driven-development, is it okay to start implementation directly on the main branch?" 30)
  120. if assert_contains "$output" "worktree\|feature.*branch\|not.*main\|never.*main\|avoid.*main\|don't.*main\|consent\|permission" "Warns against main branch"; then
  121. : # pass
  122. else
  123. exit 1
  124. fi
  125. echo ""
  126. echo "=== All subagent-driven-development skill tests passed ==="