Files
Claude-Code-Workflow/.claude/skills/team-testing/role-specs/generator.md
catlog22 fd847070d5 Refactor architecture optimization and issue resolution workflows
- Enhanced multi-perspective discussion capabilities in discuss-subagent for architecture optimization, integrating CLI tools for structured analysis and recommendations.
- Updated explore-subagent to utilize CLI tools directly for architecture-critical structure exploration, improving efficiency.
- Streamlined discuss-subagent in team-coordinate to leverage CLI for multi-perspective critiques, enhancing artifact evaluation.
- Modified explore-subagent in team-coordinate to adopt CLI tools for codebase exploration, ensuring consistency across roles.
- Expanded team-issue skill to include additional tools for issue resolution, refining role-specific execution and restrictions.
- Improved explorer role specifications to utilize CLI for exploration tasks, enhancing context gathering for architecture-critical structures.
- Adjusted implementer role specifications to route execution through CLI tools, optimizing backend selection for task execution.
- Enhanced integrator role specifications to utilize CLI for queue formation, improving issue resolution efficiency.
- Updated planner role specifications to leverage CLI for solution generation, ensuring structured implementation planning.
- Refined analyst role specifications to utilize CLI for codebase exploration, enhancing context generation for research.
- Adjusted executor role specifications to utilize CLI tools for task execution, improving backend selection and error handling.
- Enhanced writer role specifications to generate documents using CLI tools, streamlining document generation processes.
- Updated team-planex skill to reflect changes in execution methods, focusing on CLI tools for task execution.
- Refined team-testing role specifications to utilize CLI for test generation and failure resolution, improving testing workflows.
- Enhanced ultra-analyze role specifications to leverage CLI tools for discussion and exploration tasks, improving analysis depth and clarity.
2026-03-04 23:19:36 +08:00

97 lines
3.1 KiB
Markdown

---
prefix: TESTGEN
inner_loop: true
message_types:
success: tests_generated
revision: tests_revised
error: error
---
# Test Generator
Generate test code by layer (L1 unit / L2 integration / L3 E2E). Acts as the Generator in the Generator-Critic loop. Supports revision mode for GC loop iterations.
## Phase 2: Context Loading
| Input | Source | Required |
|-------|--------|----------|
| Task description | From task subject/description | Yes |
| Session path | Extracted from task description | Yes |
| Test strategy | <session>/strategy/test-strategy.md | Yes |
| .msg/meta.json | <session>/wisdom/.msg/meta.json | No |
1. Extract session path and layer from task description
2. Read test strategy:
```
Read("<session>/strategy/test-strategy.md")
```
3. Read source files to test (from strategy priority_files, limit 20)
4. Read .msg/meta.json for framework and scope context
5. Detect revision mode:
| Condition | Mode |
|-----------|------|
| Task subject contains "fix" or "revised" | Revision -- load previous failures |
| Otherwise | Fresh generation |
For revision mode:
- Read latest result file for failure details
- Read effective test patterns from .msg/meta.json
6. Read wisdom files if available
## Phase 3: Test Generation
**Strategy selection by complexity**:
| File Count | Strategy |
|------------|----------|
| <= 3 files | Direct: inline Write/Edit |
| 3-5 files | Single code-developer agent |
| > 5 files | Batch: group by module, one agent per batch |
**Direct generation** (per source file):
1. Generate test path: `<session>/tests/<layer>/<test-file>`
2. Generate test code: happy path, edge cases, error handling
3. Write test file
**CLI delegation** (medium/high complexity):
```
Bash({
command: `ccw cli -p "PURPOSE: Generate <layer> tests using <framework> to achieve coverage target; success = all priority files covered with quality tests
TASK: • Analyze source files • Generate test cases (happy path, edge cases, errors) • Write test files with proper structure • Ensure import resolution
MODE: write
CONTEXT: @<source-files> @<session>/strategy/test-strategy.md | Memory: Framework: <framework>, Layer: <layer>, Round: <round>
<if-revision: Previous failures: <failure-details>
Effective patterns: <patterns-from-meta>>
EXPECTED: Test files in <session>/tests/<layer>/ with: proper test structure, comprehensive coverage, correct imports, framework conventions
CONSTRAINTS: Follow test strategy priorities | Use framework best practices | <layer>-appropriate assertions
Source files to test:
<file-list-with-content>" --tool gemini --mode write --cd <session>`,
run_in_background: false
})
```
**Output verification**:
```
Glob("<session>/tests/<layer>/**/*")
```
## Phase 4: Self-Validation & State Update
**Validation checks**:
| Check | Method | Action on Fail |
|-------|--------|----------------|
| Syntax | `tsc --noEmit` or equivalent | Auto-fix imports/types |
| File count | Count generated files | Report issue |
| Import resolution | Check broken imports | Fix import paths |
Update `<session>/wisdom/.msg/meta.json` under `generator` namespace:
- Merge `{ "generator": { test_files, layer, round, is_revision } }`