iteration-manager

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Iteration Manager

迭代管理器

Supervises iterative testing, verification, and improvement of code.
用于监管代码的迭代测试、验证与改进工作。

Quick Commands

快捷命令

The iteration manager provides four commands. The
/iterate <n>
command runs n iterations of the test-improve cycle. The
/iterate stop
command stops the current iteration loop. The
/iterate status
command shows current iteration status. The
/iterate report
command generates a comprehensive report.
迭代管理器提供四个命令。
/iterate <n>
命令用于运行n轮测试-改进循环。
/iterate stop
命令用于停止当前迭代循环。
/iterate status
命令用于展示当前迭代状态。
/iterate report
命令用于生成完整的迭代报告。

Iteration Workflow

迭代工作流

┌─────────────────────────────────────────────────────────────┐
│                    ITERATION CYCLE                          │
├─────────────────────────────────────────────────────────────┤
│                                                             │
│  ┌──────────┐    ┌──────────┐    ┌──────────┐    ┌────────┐│
│  │  TEST    │───▶│ ANALYZE  │───▶│ SUGGEST  │───▶│ APPLY  ││
│  │          │    │          │    │          │    │        ││
│  └──────────┘    └──────────┘    └──────────┘    └────────┘│
│       │                                                   │ │
│       │              ┌──────────┐                         │ │
│       └──────────────│ VERIFY   │◀────────────────────────┘ │
│                      │          │                           │
│                      └──────────┘                           │
│                            │                                 │
│                      ┌─────▼─────┐                          │
│                      │ CONVERGE? │                          │
│                      └─────┬─────┘                          │
│                     YES    │    NO                           │
│                      ┌─────┴─────┐                          │
│                      ▼           ▼                          │
│                   [DONE]    [NEXT ITERATION]                │
│                                                             │
└─────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────┐
│                    ITERATION CYCLE                          │
├─────────────────────────────────────────────────────────────┤
│                                                             │
│  ┌──────────┐    ┌──────────┐    ┌──────────┐    ┌────────┐│
│  │  TEST    │───▶│ ANALYZE  │───▶│ SUGGEST  │───▶│ APPLY  ││
│  │          │    │          │    │          │    │        ││
│  └──────────┘    └──────────┘    └──────────┘    └────────┘│
│       │                                                   │ │
│       │              ┌──────────┐                         │ │
│       └──────────────│ VERIFY   │◀────────────────────────┘ │
│                      │          │                           │
│                      └──────────┘                           │
│                            │                                 │
│                      ┌─────▼─────┐                          │
│                      │ CONVERGE? │                          │
│                      └─────┬─────┘                          │
│                     YES    │    NO                           │
│                      ┌─────┴─────┐                          │
│                      ▼           ▼                          │
│                   [DONE]    [NEXT ITERATION]                │
│                                                             │
└─────────────────────────────────────────────────────────────┘

Iteration Process

迭代流程

Step 1: Execute Tests

步骤1:执行测试

bash
undefined
bash
undefined

Run all tests

Run all tests

pytest tests/ -v --tb=short
pytest tests/ -v --tb=short

Run with coverage

Run with coverage

pytest tests/ --cov=package --cov-report=term-missing
pytest tests/ --cov=package --cov-report=term-missing

Run specific test categories

Run specific test categories

pytest tests/ -m "not slow" # Skip slow tests
undefined
pytest tests/ -m "not slow" # Skip slow tests
undefined

Step 2: Analyze Results

步骤2:分析结果

Collect and analyze:
  • Test pass/fail rates
  • Coverage percentages
  • Error patterns
  • Performance metrics
收集并分析以下内容:
  • 测试通过率/失败率
  • 覆盖率百分比
  • 错误模式
  • 性能指标

Step 3: Generate Suggestions

步骤3:生成改进建议

Based on analysis, suggest improvements:
  • Bug fixes for failing tests
  • Code coverage improvements
  • Performance optimizations
  • Code style improvements
基于分析结果,给出改进建议:
  • 针对失败用例的Bug修复
  • 代码覆盖率提升
  • 性能优化
  • 代码风格改进

Step 4: Apply Changes

步骤4:应用变更

Implement suggested improvements and verify.
实现建议的改进内容并进行验证。

Step 5: Verify & Iterate

步骤5:验证与迭代

Compare with previous iteration and decide to continue or stop.
与上一轮迭代结果对比,决定是否继续迭代。

Quality Metrics

质量指标

Primary Metrics

核心指标

Primary metrics track the most important quality indicators. Test pass rate has a target of 100% with 40% weight. Code coverage has a target above 80% with 30% weight. Lint score has a target of 0 errors with 15% weight. Type check has a target of 0 errors with 15% weight.
核心指标追踪最重要的质量维度。测试通过率目标为100%,权重占40%。代码覆盖率目标高于80%,权重占30%。Lint得分目标为0错误,权重占15%。类型检查目标为0错误,权重占15%。

Secondary Metrics

次要指标

Secondary metrics provide additional quality signals. Test duration target is under 60 seconds. Code complexity target is under 10. Documentation coverage target is above 50%.
次要指标提供额外的质量参考信号。测试时长目标低于60秒。代码复杂度目标低于10。文档覆盖率目标高于50%。

Iteration Report Format

迭代报告格式

markdown
undefined
markdown
undefined

Iteration Report - Run #N

Iteration Report - Run #N

Summary

Summary

MetricPreviousCurrentChange
Pass Rate85%92%+7%
Coverage72%78%+6%
Errors52-3
MetricPreviousCurrentChange
Pass Rate85%92%+7%
Coverage72%78%+6%
Errors52-3

Issues Found

Issues Found

Critical

Critical

Major

Major

Minor

Minor

Improvements Applied

Improvements Applied

  1. Fixed [bug] in module X
  2. Added test for Y
  3. Refactored Z
  1. Fixed [bug] in module X
  2. Added test for Y
  3. Refactored Z

Next Iteration Focus

Next Iteration Focus

  • Address remaining coverage gaps
  • Fix failing edge case tests
  • Improve performance of slow tests
  • Address remaining coverage gaps
  • Fix failing edge case tests
  • Improve performance of slow tests

Convergence Check

Convergence Check

  • Score: 92/100
  • Trend: Improving
  • Recommendation: Continue iteration
undefined
  • Score: 92/100
  • Trend: Improving
  • Recommendation: Continue iteration
undefined

Convergence Detection

收敛检测

Stop iteration when:
  1. All tests pass AND coverage > 80%
  2. No new issues detected for 2 consecutive iterations
  3. Improvement rate < 1% for 3 consecutive iterations
  4. User-specified iteration count reached
满足以下条件时停止迭代:
  1. 所有测试通过且代码覆盖率>80%
  2. 连续2轮迭代未检测到新问题
  3. 连续3轮迭代的改进幅度<1%
  4. 达到用户指定的迭代次数

Usage Examples

使用示例

Basic Iteration

基础迭代

User: Run 5 iterations on the current project

Agent: Starting iteration cycle...

Iteration 1/5:
- Tests: 45/50 passed (90%)
- Coverage: 68%
- Errors: 3
- Applying fixes...

Iteration 2/5:
- Tests: 48/50 passed (96%)
- Coverage: 74%
- Errors: 1
- Applying fixes...

Iteration 3/5:
- Tests: 50/50 passed (100%)
- Coverage: 82%
- Errors: 0
- Convergence detected!

Final Report:
- Total iterations: 3
- Time: 5 minutes
- Improvements: 12 fixes applied
User: Run 5 iterations on the current project

Agent: Starting iteration cycle...

Iteration 1/5:
- Tests: 45/50 passed (90%)
- Coverage: 68%
- Errors: 3
- Applying fixes...

Iteration 2/5:
- Tests: 48/50 passed (96%)
- Coverage: 74%
- Errors: 1
- Applying fixes...

Iteration 3/5:
- Tests: 50/50 passed (100%)
- Coverage: 82%
- Errors: 0
- Convergence detected!

Final Report:
- Total iterations: 3
- Time: 5 minutes
- Improvements: 12 fixes applied

Focused Iteration

定向迭代

User: Iterate until test coverage reaches 90%

Agent: Starting coverage-focused iteration...

Iteration 1: Coverage 68% → 72%
Iteration 2: Coverage 72% → 78%
Iteration 3: Coverage 78% → 83%
Iteration 4: Coverage 83% → 88%
Iteration 5: Coverage 88% → 91%

Target reached! Coverage: 91%
User: Iterate until test coverage reaches 90%

Agent: Starting coverage-focused iteration...

Iteration 1: Coverage 68% → 72%
Iteration 2: Coverage 72% → 78%
Iteration 3: Coverage 78% → 83%
Iteration 4: Coverage 83% → 88%
Iteration 5: Coverage 88% → 91%

Target reached! Coverage: 91%

Stop and Resume

停止与恢复

User: /iterate stop

Agent: Iteration stopped at #3
- Current state saved
- Resume with /iterate resume

User: /iterate resume

Agent: Resuming from iteration #3...
User: /iterate stop

Agent: Iteration stopped at #3
- Current state saved
- Resume with /iterate resume

User: /iterate resume

Agent: Resuming from iteration #3...

Rules

规则

  • rules/testing-protocol.md - Testing execution protocol
  • rules/quality-metrics.md - Quality scoring system
  • rules/iteration-workflow.md - Detailed workflow
  • rules/testing-protocol.md - Testing execution protocol
  • rules/quality-metrics.md - Quality scoring system
  • rules/iteration-workflow.md - Detailed workflow

Integration with Other Skills

与其他技能的集成

The iteration manager integrates with other skills. The python-project-developer skill uses test patterns and ToolResult. The software-planner skill validates documentation requirements. The commit skill auto-commits improvements.
迭代管理器可与其他技能集成。python-project-developer技能会使用测试模式和ToolResult。software-planner技能会验证文档要求。commit技能会自动提交改进内容。

Best Practices

最佳实践

Five practices guide effective iteration. First, start with baseline by running initial tests to establish metrics. Second, focus on one area by prioritizing critical failures first. Third, track progress by comparing metrics across iterations. Fourth, know when to stop by avoiding over-optimization. Fifth, document changes by keeping track of what was improved.
五个最佳实践可指导高效迭代:第一,先运行初始测试建立指标基线。第二,优先处理严重故障,每次聚焦一个优化领域。第三,跨迭代对比指标,追踪进度。第四,明确停止时机,避免过度优化。第五,记录所有改进内容,做好变更文档。