Files
ai-proj-helper/skills-req/req-retro-plugin/skills/SKILL.md
John Qiu de25f096e7 feat(sync): add install-skills.sh + install metadata to all 62 plugins
- Add install_name, install_type, dir_category fields to all 62 plugin.json files
  to resolve name-mapping and skill-vs-command routing issues
- Add install-skills.sh: idempotent cross-machine skill sync script
  - Routes skill→~/.claude/skills/<name>/, command→~/.claude/commands/<name>.md
  - rsync full skills/ directory (preserves multi-file skills like dev-test, req-deploy)
  - State file ~/.claude/.installed-skills.json tracks installed versions
  - Conflict detection: warns before overwriting locally modified files
  - --dry-run, --category, --force, --cleanup, --list flags
- Add 9 new plugins migrated from local ~/.claude (agent-swarm, ai-chat,
  defect-analysis, executing-plans, finishing-branch, frontend-design,
  req-audit, req-lookback, req-retro)
- Add update-plugin-meta.py helper used to bulk-update plugin.json
- Fix siyuan SKILL.md: remove hardcoded server credentials, use env vars

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-20 23:55:26 +09:30

151 lines
4.0 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
name: req-retro
description: 复盘总结。自动采集数据、计算质量评分、跨需求模式识别、技能自动进化。可独立调用或由 /req done 自动触发。
---
# 复盘总结 (retro)
自动采集需求全生命周期数据,计算质量评分,识别跨需求模式,沉淀经验。
## 执行流程
### 1. 数据采集
| 数据 | 来源 | 方式 |
|------|------|------|
| 各阶段时间 | ai-proj | `mcp__ai-proj__get_requirement_history` |
| 任务完成情况 | ai-proj | `mcp__ai-proj__get_requirement_tasks` |
| CR 发现数 | CR 任务文档 | 从【代码评审】任务文档中提取缺陷计数 |
| 测试结果 | test 任务文档 | 从【测试】任务文档中提取通过/失败数 |
| audit 缺陷数 | 本次 audit 结果 | 从 audit 报告中提取 |
| git 统计 | git | `git log --stat` 提交数、变更行数 |
### 2. 质量评分Quality Score
```
QS = lookback_pass_rate × 0.3
+ audit_defect_score × 0.3
+ cr_density_score × 0.2
+ test_pass_rate × 0.2
audit_defect_score:
0 缺陷 = 100
每个低级 -5
每个中级 -20
每个高级 -60
致命 = 0
cr_density_score:
100 - (发现数 / 变更行数 × 1000)
下限 0上限 100
```
### 3. 历史趋势对比
读取 `memory/retro_metrics.md` 的明细数据:
```
本次 vs 近 10 次平均:
总耗时: 5h 44min vs avg 8h 12min (↓ 30% 改善)
质量分: 92 vs avg 85 (↑ 8% 提升)
缺陷数: 2 vs avg 3.2 (↓ 37% 改善)
变更行: 279 vs avg 450 (↓ 38%)
```
首次执行时显示:"首次复盘,无历史数据可对比。"
### 4. 跨需求模式识别
读取 retro_metrics.md 全部明细AI 分析三类模式:
**耗时模式**
- 按需求类型(前端/后端/混合/技能)分组统计平均耗时
- 识别异常:某次耗时是同类平均的 2 倍以上 → 标注原因
**缺陷热区**
- 统计各文件在多次需求中的 audit 发现频率
- 同一文件 3 次以上出现 → 标记为热区
**改进验证**
- 对比引入某流程/技能前后的质量分趋势
- 例:"引入 defect-analysis 后 5 次需求平均质量分从 72 → 88"
### 5. 自动更新技能
当模式识别发现高频缺陷类型时:
```
AI: "近 5 次需求中 3 次 audit 发现了 {缺陷类型}。
建议在 dev-review 的 CR 检查清单中增加:'{新检查项}'。"
用户确认?(y/n)
```
用户确认 → 自动在 `~/.claude/skills/dev-review/SKILL.md` 检查清单末尾追加该检查项。
### 6. 更新 retro_metrics.md
追加一行到明细:
```
| REQ-xxx | 2026-04-18 | 5h44m | 92 | 2 | 279 | 3 | frontend |
```
更新汇总:重新计算近 10 次平均值和趋势箭头(↑↓→)。
超过 30 条明细 → 最早的移入 `retro_metrics_archive.md`
### 7. 生成文档
输出 `04-生命周期总结.md`,附加到【复盘】任务:
```markdown
# 生命周期总结 - REQ-xxx
## 质量评分: 92/100
## 时间线
| 阶段 | 进入时间 | 耗时 |
|------|---------|------|
| 创建 | 04-18 11:14 | - |
| PRD | 04-18 11:18 | 4min |
| 评审 | 04-18 11:19 | 1min |
| 开发 | 04-18 12:00 | 41min |
| 部署 | 04-18 16:58 | 4h58min |
| 总耗时 | | 5h 44min |
## 质量指标
| 指标 | 本次 | 近10次均 | 对比 |
|------|------|---------|------|
| 质量分 | 92 | 85 | ↑ |
| audit 缺陷 | 2(低) | 3.2 | ↓ |
| CR 发现 | 0 | 1.5 | ↓ |
| 测试通过率 | 100% | 95% | ↑ |
## git 统计
| 提交数 | 变更文件 | +行 | -行 |
|--------|---------|-----|-----|
| 3 | 1 | 279 | 2 |
## 模式识别
- {耗时/热区/改进 分析结果}
## 经验教训(写入 memory
- {AI 提取的非显然教训}
## 技能更新
- {已更新/无更新}
```
### 8. 写入 memory
将有价值的经验写入 memory
- 类型:`feedback``project`
- 只写非显然的、可指导未来工作的教训
- 用户确认后写入
## 任务关联
- linkRole: `documentation`
- 任务标题: `【复盘】生命周期总结: {需求标题}`
- 04-生命周期总结.md 附加到任务文档