From da57cccf9638eb9d1b058fcd658d325b9b9aba09 Mon Sep 17 00:00:00 2001 From: John Qiu Date: Tue, 21 Apr 2026 10:55:13 +0930 Subject: [PATCH] chore(marketplace): update req-retro karpathy-score dimension, req-test-gate gate-0b docs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - req-retro: 新增 karpathy_score × 0.20 维度,QS 公式扩展为 5 维 - req-test-gate: Gate 0B 新增 check-surgical.sh Ratchet 文档 Co-Authored-By: Claude Sonnet 4.6 --- skills-req/req-retro-plugin/skills/SKILL.md | 44 ++++++++++++++++--- .../req-test-gate-plugin/skills/SKILL.md | 20 +++++++-- 2 files changed, 53 insertions(+), 11 deletions(-) diff --git a/skills-req/req-retro-plugin/skills/SKILL.md b/skills-req/req-retro-plugin/skills/SKILL.md index 05953c1..42132a5 100644 --- a/skills-req/req-retro-plugin/skills/SKILL.md +++ b/skills-req/req-retro-plugin/skills/SKILL.md @@ -23,10 +23,11 @@ description: 复盘总结。自动采集数据、计算质量评分、跨需求 ### 2. 质量评分(Quality Score) ``` -QS = lookback_pass_rate × 0.3 - + audit_defect_score × 0.3 - + cr_density_score × 0.2 - + test_pass_rate × 0.2 +QS = lookback_pass_rate × 0.25 + + audit_defect_score × 0.25 + + cr_density_score × 0.15 + + test_pass_rate × 0.15 + + karpathy_score × 0.20 ← Karpathy 四原则执行质量 audit_defect_score: 0 缺陷 = 100 @@ -38,8 +39,26 @@ audit_defect_score: cr_density_score: 100 - (发现数 / 变更行数 × 1000) 下限 0,上限 100 + +karpathy_score(四原则执行质量,各 25 分,共 100): + Think Before PRD (25): + PRD 无返工 → 25 | 因需求误解返工 1 次 → 15 | ≥2 次 → 0 + Simplicity (25): + CR 第六视角无 Scope 违规 → 25 | 1 个 Low → 20 | ≥1 个 Medium+ → 10 | High+ → 0 + Surgical (25): + check-surgical.sh PASS + CR 无顺手改 → 25 | 警告但未阻塞 → 15 | FAIL → 0 + Goal-Driven (25): + dev-coding 有验证脚本记录(VP-Steps 先于代码执行)→ 25 | 事后补写 → 15 | 无 → 0 ``` +**Karpathy 数据来源**(按优先级): +1. dev-coding 任务文档中是否有「验证脚本」节 +2. CR 报告第六视角的发现数和严重度 +3. `git log` 中是否有 check-surgical.sh baseline 更新提交(说明有过违规) +4. PRD 任务文档的版本数(> 1 说明有返工) + +**无数据时**:各维度默认 20 分(中性),在报告中标注 `(无记录,按中性计算)` + ### 3. 历史趋势对比 读取 `memory/retro_metrics.md` 的明细数据: @@ -87,10 +106,12 @@ AI: "近 5 次需求中 3 次 audit 发现了 {缺陷类型}。 追加一行到明细: ``` -| REQ-xxx | 2026-04-18 | 5h44m | 92 | 2 | 279 | 3 | frontend | +| REQ-xxx | 2026-04-18 | 5h44m | 92 | 2 | 279 | 3 | frontend | 85 | ``` -更新汇总:重新计算近 10 次平均值和趋势箭头(↑↓→)。 +列说明:`REQ | date | time | QS | audit_defects | changed_lines | cr_findings | type | karpathy_score` + +更新汇总:重新计算近 10 次平均值和趋势箭头(↑↓→),包含 karpathy_score 趋势。 超过 30 条明细 → 最早的移入 `retro_metrics_archive.md`。 @@ -116,10 +137,19 @@ AI: "近 5 次需求中 3 次 audit 发现了 {缺陷类型}。 ## 质量指标 | 指标 | 本次 | 近10次均 | 对比 | |------|------|---------|------| -| 质量分 | 92 | 85 | ↑ | +| 质量分 (QS) | 92 | 85 | ↑ | | audit 缺陷 | 2(低) | 3.2 | ↓ | | CR 发现 | 0 | 1.5 | ↓ | | 测试通过率 | 100% | 95% | ↑ | +| Karpathy 分 | 85 | 78 | ↑ | + +## Karpathy 四原则评分 +| 原则 | 得分 | 说明 | +|------|------|------| +| Think Before PRD | 25/25 | PRD 无返工 | +| Simplicity | 20/25 | CR 第六视角发现 1 个 Low | +| Surgical | 25/25 | check-surgical.sh PASS | +| Goal-Driven | 15/25 | 验证脚本为事后补写 | ## git 统计 | 提交数 | 变更文件 | +行 | -行 | diff --git a/skills-req/req-test-gate-plugin/skills/SKILL.md b/skills-req/req-test-gate-plugin/skills/SKILL.md index 6043989..7969dd6 100644 --- a/skills-req/req-test-gate-plugin/skills/SKILL.md +++ b/skills-req/req-test-gate-plugin/skills/SKILL.md @@ -87,12 +87,24 @@ done **报告格式**: ``` ### 约定检查 (Gate 0B) -| 脚本 | 结果 | 详情 | -|------|------|------| -| check-architecture.sh | ✅ PASS | 5 rules, all within baseline | -| check-modal-safety.sh | ✅ PASS | 0 violations | +| 脚本 | 类型 | 结果 | 详情 | +|------|------|------|------| +| check-architecture.sh | Ratchet | ✅ PASS | 5 rules, all within baseline | +| check-modal-safety.sh | Hard wall | ✅ PASS | 0 violations | +| check-surgical.sh | Ratchet | ✅ PASS | 0 format-only violations (baseline=0) | ``` +**本项目已建立的约定检查脚本**: + +| 脚本 | 类型 | 检测内容 | 来源 | +|------|------|---------|------| +| `check-architecture.sh` | Ratchet | Handler 直接引用 database/ 层 | 分层架构规范 | +| `check-modal-safety.sh` | Hard wall | Modal.success 后立即操作 UI | REQ-20260416 | +| `check-surgical.sh` | Ratchet | PR diff 中疑似仅注释/格式变更的文件 | Karpathy Surgical(REQ-20260421-0003)| + +> `check-surgical.sh` 使用 Ratchet 模式:`.surgical-baseline.json` 记录基线,违规数只能降不能升。 +> 首次无基线时仅告警,不阻塞。运行 `./scripts/check-surgical.sh baseline` 建立基线。 + > 这样 Harness 建立的约定脚本会在每次 `/req test` 时自动运行,无需手动执行 `/harness report`。 ---