test-subagent-driven-development.sh 4.4 KB

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