Repository navigation
Description
Summary
/testgen is available as a phase in sequant run but is never auto-recommended. Neither /spec nor /solve suggest it, making it effectively invisible to users.
Related
- bug: Quality loop never triggers - QA verdict not parsed #218 - Quality loop never triggers (QA verdict not parsed) - another
sequant runimprovement
Current State
| Skill | Mentions testgen? | Behavior |
|---|---|---|
/spec |
Listed as available phase | No guidance on when to recommend |
/solve |
No | Never suggests it |
sequant run |
Opt-in only | Requires --testgen or explicit --phases |
The Gap
/spec's phase selection logic has rules for:
- UI/Frontend → Add
testphase - Complex refactors → Enable quality loop
- Security-sensitive → Add
security-reviewphase
Missing: No guidance for when to add testgen
Proposed Changes
1. Update /spec phase selection logic
Add to phase selection:
- **New features with testable ACs** → Add `testgen` phase after spec
- **Refactors needing regression tests** → Add `testgen` phaseWhen to recommend testgen:
- ACs have verification method = Unit Test or Integration Test
- Issue is a new feature (not a bug fix)
- Project has test framework detected
2. Update /solve to suggest testgen
Include testgen in workflow recommendations when appropriate:
/spec 123
/testgen 123 # When ACs need automated tests
/exec 123
/qa 123
3. Have sequant run auto-detect from spec output
If spec outputs **Phases:** spec → testgen → exec → qa, the CLI already parses this. Just need spec to actually recommend it.
Token Usage Optimization
Concern
Adding another phase increases token usage.
Mitigation: Use haiku for testgen
/testgen is highly mechanical:
- Parse spec output for verification criteria
- Generate templated test stubs
- Write files
This is perfect for haiku. Options:
Option A: Run entire testgen phase with haiku
- Configure
sequant runto use--model haikufor testgen phase - Requires SDK support for per-phase model selection
Option B: Refactor testgen to use haiku sub-agents internally ✅ Recommended
- Main skill orchestrates, haiku generates stubs
- Pattern already established in
/qaand/spec
Task(subagent_type="general-purpose", model="haiku",
prompt="Parse this /spec comment and extract verification criteria: ...")
Task(subagent_type="general-purpose", model="haiku",
prompt="Generate Jest test stub for AC-1: ...")
Option C: Make testgen a haiku skill by default
- Less granular but simplest
- Tradeoff: less capable if complex test logic needed
Recommendation
Option B - matches existing patterns in /qa and /spec, gives control over which parts use haiku.
Acceptance Criteria
- AC-1:
/specrecommendstestgenphase when ACs have Unit/Integration test verification methods - AC-2:
/solveincludes testgen in workflow recommendations when appropriate - AC-3:
sequant runexecutes testgen when spec recommends it (already works via phase parsing) - AC-4:
/testgenuses haiku sub-agents for stub generation to minimize token cost - AC-5: Documentation updated to reflect auto-detection behavior
Labels
enhancement, workflow, optimization
Activity
admarble commentedon Feb 1, 2026
📋 Implementation Plan for #217
Acceptance Criteria with Verification
/specrecommendstestgenphase when ACs have Unit/Integration test verification methods/solveincludes testgen in workflow recommendations when appropriatesequant runexecutes testgen when spec recommends it/testgenuses haiku sub-agents for stub generationAC Quality Check
/spec: when ACs have Unit/Integration Test verification OR new feature with >2 AC itemsVerification Criteria Details
AC-1 Test Scenario:
/specgenerates recommended workflowtestgen(e.g.,spec → testgen → exec → qa)AC-4 Test Scenario:
/testgeninvoked with verification criteriamodel="haiku"for mechanical generationImplementation Phases
Phase 1: Update
/specPhase Selection Logic.claude/skills/spec/SKILL.md(lines 557-562)testgenphase"Phase 2: Update
/solveWorkflow Recommendations.claude/skills/solve/SKILL.mdspec → testgen → exec → qaPhase 3: Optimize
/testgenwith Haiku Sub-Agents.claude/skills/testgen/SKILL.mdTask(subagent_type="general-purpose", model="haiku", ...)Phase 4: Update Documentation
--phasesflagFiles to Modify
.claude/skills/spec/SKILL.md.claude/skills/solve/SKILL.md.claude/skills/testgen/SKILL.mdConflict Analysis
✅ No conflicts detected - Changes are isolated to skill markdown files
src/commands/run.tsbut feat: Auto-include testgen phase when appropriate + haiku optimization #217 only modifies skill SKILL.md filesAssumptions to Validate
solve-comment-parser.tsalready supports testgen in PHASE_PATTERN regexRecommended Workflow
Open Questions
feat(#217): Auto-include testgen phase when appropriate
admarble commentedon Feb 1, 2026
Implementation Progress Update
AC Coverage Summary
/specrecommends testgen when ACs have Unit/Integration tests.claude/skills/spec/SKILL.md:562-620/solveincludes testgen in recommendations.claude/skills/solve/SKILL.md:50-54, 356-360sequant runexecutes testgen when spec recommends/testgenuses haiku sub-agents.claude/skills/testgen/SKILL.md:42-154docs/concepts/workflow-phases.mdFiles Changed
.claude/skills/spec/SKILL.md.claude/skills/solve/SKILL.md.claude/skills/testgen/SKILL.mddocs/concepts/workflow-phases.mdTest/Build Results
npm test: 914 passed, 10 failed (pre-existing failures unrelated to changes)npm run build: ✅ PassedQuality Plan Alignment
PR Status
Created: #231
Self-Evaluation
Generated with Claude Code
admarble commentedon Feb 1, 2026
QA Review for Issue #217
AC Coverage
/specrecommendstestgenwhen ACs have Unit/Integration tests.claude/skills/spec/SKILL.md:562-620- Detection logic table and conditions added/solveincludes testgen in workflow recommendations.claude/skills/solve/SKILL.md:50-54, 356-360---testgenflag added, workflow examples updatedsequant runexecutes testgen when spec recommends/testgenuses haiku sub-agents.claude/skills/testgen/SKILL.md:42-154- Complete token optimization section with sub-agent patternsdocs/concepts/workflow-phases.md- Workflow diagram, label detection table, and auto-detection sectionbug,fix,docslabelsCoverage: 7/7 AC items fully met
Original ACs: 5/5 met
Derived ACs: 2/2 met
CI Status
build (18.x)build (20.x)build (22.x)typecheckvalidate-skillsvalidate-pluginCI Summary: 6 passed, 0 pending, 0 failed
Quality Metrics
any)Test Coverage Analysis
.claude/skills/spec/SKILL.md.claude/skills/solve/SKILL.md.claude/skills/testgen/SKILL.mddocs/concepts/workflow-phases.mdCoverage: No TypeScript/JavaScript source files changed - only Markdown skill configurations and documentation.
Code Review
Strengths:
/spec(lines 566-580)/testgenwith cost savings example (~90% token reduction)/solveIssues:
Suggestions:
Skill Command Verification
Skill files changed: 3
.claude/skills/spec/SKILL.md.claude/skills/solve/SKILL.md.claude/skills/testgen/SKILL.mdCommands Verified:
gh issue view <issue> --json labels --jq '.labels[].name'→ ✅labelsis valid JSON fieldgrep -E "jest|vitest|mocha" package.json→ ✅ Works correctlyVerification Status: Passed
Self-Evaluation
gh --helpVerdict: READY_FOR_MERGE
All 7 acceptance criteria (5 original + 2 derived) are fully met. Implementation:
/spec/solvewith--testgenflag and workflow examples/testgenCI passes (6/6 checks). No type issues, no deleted tests, minimal scope (4 files, +252 net lines).
Documentation
docs/concepts/workflow-phases.md- workflow diagram and auto-detection)Next Steps
/testgenmanually on a test issue to verify runtime behaviorsequant runexecutions to confirm testgen auto-detection works in practiceGenerated with Claude Code
feat(#217): Auto-include testgen phase when appropriate (#231)
test: Add unit tests for solve-comment-parser
docs: Add testgen auto-detection to changelog and what-weve-built
admarble commentedon Feb 2, 2026
✅ Implementation Complete
Merged
ea499b8Post-Merge Follow-up
solve-comment-parser.ts(35 tests) →9cd2ab67af277aSummary
All 7 ACs (5 original + 2 derived) implemented:
/specauto-recommends testgen when ACs have Unit/Integration tests/solveincludes--testgenflag in workflow analysis/testgenuses haiku sub-agents (~90% token savings)docs/concepts/workflow-phases.mdClosed via PR #231
docs: Add QA caching and testgen auto-detection to changelog and what…