claude-everything-workflow 0.2.4 → 0.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/plugin.json +1 -1
- package/.codex-plugin/plugin.json +1 -1
- package/AGENTS.md +4 -4
- package/commands/pr.md +2 -2
- package/hooks/check-code-size.js +1 -1
- package/package.json +1 -1
- package/rules/02-implementation.md +27 -0
- package/rules/05-git-workflow.md +2 -1
- package/rules/08-specialty-rules-index.md +1 -1
- package/rules/09-first-principles-adversarial-testing.md +1 -2
- package/scripts/verify/metadata-checks.js +56 -3
- package/skills/spec-gate/SKILL.md +9 -21
- package/skills/spec-gate/references/spec-template.md +23 -0
- package/skills/systematic-debugging/SKILL.md +6 -6
- package/skills/systematic-debugging/references/debugging-methods.md +30 -0
- package/skills/systematic-debugging/references/diagnostic-scenarios.md +1 -1
- package/rules/02-code-size.md +0 -7
- package/rules/03-architecture.md +0 -12
- package/rules/04-error-handling.md +0 -5
- package/rules/06-comments.md +0 -4
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claude-everything-workflow",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.5",
|
|
4
4
|
"description": "Evidence-based engineering workflows: implement, debug, review and verify.",
|
|
5
5
|
"author": { "name": "xu91102" },
|
|
6
6
|
"homepage": "https://github.com/xu91102/claude-everything-Workflow",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claude-everything-workflow",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.5",
|
|
4
4
|
"description": "Evidence-based engineering workflows: implement, debug, review and verify.",
|
|
5
5
|
"author": { "name": "xu91102" },
|
|
6
6
|
"homepage": "https://github.com/xu91102/claude-everything-Workflow",
|
package/AGENTS.md
CHANGED
|
@@ -6,6 +6,9 @@
|
|
|
6
6
|
- 默认使用日常中文。必须使用专业术语、错误码或英文缩写时,紧跟一句解释它对用户意味着什么。
|
|
7
7
|
- 解释变更、故障或排查结果时,简单说明;明确区分已确认事实、推测和阻塞项。
|
|
8
8
|
- 除非用户要求,不贴大段原始日志、命令或实现细节;只保留支持结论所需的最小证据。
|
|
9
|
+
- 同一事实只说一次;简单任务短答,复杂任务按需展开。进展只报告新发现、阻塞和关键决定,不逐条播报工具操作。
|
|
10
|
+
- 精简不改变含义或技术原文,有歧义时完整说明。
|
|
11
|
+
- 工具结果优先读取相关片段,大结果只展示摘要并保留原文入口、实际退出码和关键错误,不凭截断结果判定成功。
|
|
9
12
|
|
|
10
13
|
> 规则按需读取,不要默认全量加载 `rules/` 或 `rules/common/`。
|
|
11
14
|
|
|
@@ -21,11 +24,8 @@
|
|
|
21
24
|
| 规则文件 | 内容与触发场景 |
|
|
22
25
|
| -------------------------------------------- | ------------------------------------------------------ |
|
|
23
26
|
| `01-base.md` | 执行原则、最小实现决策阶梯、流程边界;实现或审查前读取 |
|
|
24
|
-
| `02-
|
|
25
|
-
| `03-architecture.md` | 既有架构、局部性、重构兼容、跨平台脚本 |
|
|
26
|
-
| `04-error-handling.md` | 错误责任、不吞错、显式降级与异步处理 |
|
|
27
|
+
| `02-implementation.md` | 架构与兼容、错误处理、代码规模、注释 |
|
|
27
28
|
| `05-git-workflow.md` | Worktree 分支开发、提交格式、PR 授权边界 |
|
|
28
|
-
| `06-comments.md` | 项目注释惯例与非显然约束 |
|
|
29
29
|
| `07-forbidden.md` | 禁止事项:代码、安全、提交禁止项 |
|
|
30
30
|
| `08-specialty-rules-index.md` | 专项规则触发矩阵,按需跳转到 `rules/common/` 专项规则 |
|
|
31
31
|
| `09-first-principles-adversarial-testing.md` | 第一性原则与对抗性测试,复杂/高风险任务按需加载 |
|
package/commands/pr.md
CHANGED
|
@@ -36,7 +36,7 @@ description: 提交、推送和创建 Pull Request 的标准工作流
|
|
|
36
36
|
5. 修复可安全修复的失败项,并重跑相关验证。
|
|
37
37
|
6. 只暂存本次任务相关文件。
|
|
38
38
|
7. 使用 conventional commit 提交。
|
|
39
|
-
8.
|
|
39
|
+
8. 按 `rules/05-git-workflow.md` 的授权边界执行推送与创建 PR。
|
|
40
40
|
9. 创建 PR 后报告链接、验证结果、风险点和未运行检查。
|
|
41
41
|
|
|
42
42
|
若当前工作来自 tracker ticket,在 commit/PR 描述中加入不会误触发关闭的 ticket reference
|
|
@@ -84,4 +84,4 @@ pnpm --filter <pkg> build
|
|
|
84
84
|
- 不要跳过失败检查直接提交,除非用户明确授权。
|
|
85
85
|
- 不要把无关文件混入提交。
|
|
86
86
|
- 不要在受保护分支直接提交。
|
|
87
|
-
-
|
|
87
|
+
- Git/PR 操作的授权边界统一见 `rules/05-git-workflow.md`。
|
package/hooks/check-code-size.js
CHANGED
package/package.json
CHANGED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# 实现规范
|
|
2
|
+
|
|
3
|
+
## 架构与兼容
|
|
4
|
+
|
|
5
|
+
- 遵循目标项目的目录、分层和依赖方向;仅调整影响当前需求的职责与耦合。
|
|
6
|
+
- 抽象应隐藏细节、减少调用方复杂度;不为假设的复用增加接口或透传层。
|
|
7
|
+
- 修改共享逻辑前检查相关调用方,在共同根因位置修复,避免只修报告中的单一路径。
|
|
8
|
+
- 复杂度相近时,优先边界行为正确、维护成本低的方案。
|
|
9
|
+
- 实现、测试和类型保持局部性;跨域共用目录只承接已出现的稳定复用。
|
|
10
|
+
- 状态变化显式,遵循项目更新惯例;保留公共接口和既有工作流,破坏性变更需用户批准。
|
|
11
|
+
- 重构增量、可验证、可回退,正常与边界路径有相称验证。
|
|
12
|
+
|
|
13
|
+
## 错误处理
|
|
14
|
+
|
|
15
|
+
- 错误必须保留原因和必要上下文,不吞错、不把失败伪装为成功。
|
|
16
|
+
- 沿用目标项目已有的错误边界、中间件或调用方处理约定;每个错误有明确处理责任,避免逐层重复捕获和提示。
|
|
17
|
+
- 降级、重试与批量部分失败应显式区分;异步拒绝必须有处理方。
|
|
18
|
+
|
|
19
|
+
## 代码规模
|
|
20
|
+
|
|
21
|
+
没有项目约束时,用函数约 80 行、参数 5 个、嵌套 4 层作为职责审查提示。超限先判断职责和可读性,
|
|
22
|
+
不为满足数值拆出透传层,也不机械压缩代码;文件和行长由 Hook 提示,不在规则中重复维护。
|
|
23
|
+
|
|
24
|
+
## 注释
|
|
25
|
+
|
|
26
|
+
沿用项目文档惯例。注释说明不明显的原因、约束、兼容性处理、复杂算法或外部契约;
|
|
27
|
+
公共 API 按项目要求提供文档。自解释代码不补逐句说明,不重复类型已表达的参数和返回值。
|
package/rules/05-git-workflow.md
CHANGED
|
@@ -27,5 +27,6 @@
|
|
|
27
27
|
## PR 授权边界
|
|
28
28
|
|
|
29
29
|
- 不在 `main`、`master`、`prod` 等受保护分支直接提交。
|
|
30
|
-
-
|
|
30
|
+
- 用户明确要求推送分支或创建 PR 时,可在同一任务与授权范围内直接执行,无需重复确认。未获明确授权、授权不清,或范围/风险发生实质变化时,先向用户确认。
|
|
31
|
+
- 创建 PR 的授权不覆盖合并 PR 或发布;合并和发布必须分别获得用户对该动作的明确授权,同一范围内已有授权不重复索要。
|
|
31
32
|
- 用户要求提交、推送、创建 PR 时,读取 `commands/pr.md` 和 `rules/common/pr-automation.md`;后者只维护 PR 的 CI、制品和描述,不重复本文件的 Git 与授权规则。
|
|
@@ -339,7 +339,7 @@ function runCommand(command, args, { allowFailure = false, ...options } = {}) {
|
|
|
339
339
|
return result;
|
|
340
340
|
}
|
|
341
341
|
|
|
342
|
-
function releaseScenario({ exactPublished = false, publishFails = false, tagAt }) {
|
|
342
|
+
function releaseScenario({ exactPublished = false, publishFails = false, lookupFails = false, tagAt }) {
|
|
343
343
|
const tempRoot = fs.mkdtempSync(path.join(os.tmpdir(), "cew-release-"));
|
|
344
344
|
const repository = path.join(tempRoot, "repository");
|
|
345
345
|
const remote = path.join(tempRoot, "remote.git");
|
|
@@ -375,9 +375,15 @@ function releaseScenario({ exactPublished = false, publishFails = false, tagAt }
|
|
|
375
375
|
const currentCommit = git(["-C", repository, "rev-parse", "HEAD"]).stdout.trim();
|
|
376
376
|
git(["-C", repository, "remote", "add", "origin", remote]);
|
|
377
377
|
|
|
378
|
+
let taggedCommit = "";
|
|
378
379
|
if (tagAt) {
|
|
379
|
-
|
|
380
|
-
|
|
380
|
+
taggedCommit = tagAt === "current" ? currentCommit : firstCommit;
|
|
381
|
+
if (tagAt === "unrelated") {
|
|
382
|
+
taggedCommit = git([
|
|
383
|
+
"-C", repository, "commit-tree", `${currentCommit}^{tree}`, "-m", "unrelated release",
|
|
384
|
+
]).stdout.trim();
|
|
385
|
+
}
|
|
386
|
+
git(["-C", repository, "tag", "-a", "v0.2.2", taggedCommit, "-m", "test tag"]);
|
|
381
387
|
git(["-C", repository, "push", "origin", "v0.2.2"]);
|
|
382
388
|
}
|
|
383
389
|
|
|
@@ -388,6 +394,10 @@ function releaseScenario({ exactPublished = false, publishFails = false, tagAt }
|
|
|
388
394
|
const args = process.argv.slice(2);
|
|
389
395
|
fs.appendFileSync(process.env.NPM_CALL_LOG, JSON.stringify(args) + "\\n");
|
|
390
396
|
if (args[0] === "view" && args[1].includes("@0.2.2")) {
|
|
397
|
+
if (process.env.LOOKUP_FAILS === "true") {
|
|
398
|
+
process.stderr.write("npm error code E503\\n");
|
|
399
|
+
process.exit(1);
|
|
400
|
+
}
|
|
391
401
|
if (process.env.EXACT_PUBLISHED === "true") {
|
|
392
402
|
process.stdout.write("0.2.2\\n");
|
|
393
403
|
process.exit(0);
|
|
@@ -424,6 +434,7 @@ process.exit(2);
|
|
|
424
434
|
GITHUB_SHA: currentCommit,
|
|
425
435
|
NPM_CALL_LOG: npmLog,
|
|
426
436
|
PUBLISH_FAILS: String(publishFails),
|
|
437
|
+
LOOKUP_FAILS: String(lookupFails),
|
|
427
438
|
},
|
|
428
439
|
},
|
|
429
440
|
);
|
|
@@ -443,6 +454,7 @@ process.exit(2);
|
|
|
443
454
|
calls,
|
|
444
455
|
currentCommit,
|
|
445
456
|
firstCommit,
|
|
457
|
+
taggedCommit,
|
|
446
458
|
localTag: localTag.status === 0 ? localTag.stdout.trim() : "",
|
|
447
459
|
remoteTag: remoteTag.status === 0 ? remoteTag.stdout.trim() : "",
|
|
448
460
|
result,
|
|
@@ -494,6 +506,16 @@ function checkReleaseRecoveryBehavior() {
|
|
|
494
506
|
fail("release script must publish when the correct tag already exists");
|
|
495
507
|
}
|
|
496
508
|
|
|
509
|
+
const publishedBeforeCurrent = releaseScenario({ exactPublished: true, tagAt: "previous" });
|
|
510
|
+
if (
|
|
511
|
+
publishedBeforeCurrent.result.status !== 0 ||
|
|
512
|
+
publishedBeforeCurrent.calls.some(([command]) => command === "publish") ||
|
|
513
|
+
publishedBeforeCurrent.localTag !== publishedBeforeCurrent.firstCommit ||
|
|
514
|
+
publishedBeforeCurrent.remoteTag !== publishedBeforeCurrent.firstCommit
|
|
515
|
+
) {
|
|
516
|
+
fail("release script must skip a published version tagged at an ancestor without moving its tag");
|
|
517
|
+
}
|
|
518
|
+
|
|
497
519
|
const mismatchedTag = releaseScenario({ tagAt: "previous" });
|
|
498
520
|
if (
|
|
499
521
|
mismatchedTag.result.status === 0 ||
|
|
@@ -502,6 +524,37 @@ function checkReleaseRecoveryBehavior() {
|
|
|
502
524
|
) {
|
|
503
525
|
fail("release script must reject a tag that points to another commit");
|
|
504
526
|
}
|
|
527
|
+
|
|
528
|
+
const alreadyReleased = releaseScenario({ exactPublished: true, tagAt: "current" });
|
|
529
|
+
if (
|
|
530
|
+
alreadyReleased.result.status !== 0 ||
|
|
531
|
+
alreadyReleased.calls.some(([command]) => command === "publish") ||
|
|
532
|
+
alreadyReleased.localTag !== alreadyReleased.currentCommit ||
|
|
533
|
+
alreadyReleased.remoteTag !== alreadyReleased.currentCommit
|
|
534
|
+
) {
|
|
535
|
+
fail("release script must keep a completed release unchanged on retry");
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
const unrelatedTag = releaseScenario({ exactPublished: true, tagAt: "unrelated" });
|
|
539
|
+
if (
|
|
540
|
+
unrelatedTag.result.status === 0 ||
|
|
541
|
+
unrelatedTag.calls.some(([command]) => command === "publish") ||
|
|
542
|
+
unrelatedTag.localTag !== unrelatedTag.taggedCommit ||
|
|
543
|
+
unrelatedTag.remoteTag !== unrelatedTag.taggedCommit
|
|
544
|
+
) {
|
|
545
|
+
fail("release script must reject a published version tagged outside the current history");
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
const failedLookup = releaseScenario({ exactPublished: true, lookupFails: true, tagAt: "previous" });
|
|
549
|
+
if (
|
|
550
|
+
failedLookup.result.status === 0 ||
|
|
551
|
+
!failedLookup.result.stderr.includes("E503") ||
|
|
552
|
+
failedLookup.calls.some(([command]) => command === "publish") ||
|
|
553
|
+
failedLookup.localTag !== failedLookup.firstCommit ||
|
|
554
|
+
failedLookup.remoteTag !== failedLookup.firstCommit
|
|
555
|
+
) {
|
|
556
|
+
fail("release script must fail a registry lookup error without publishing or moving its tag");
|
|
557
|
+
}
|
|
505
558
|
}
|
|
506
559
|
|
|
507
560
|
function checkGitHubWorkflows() {
|
|
@@ -62,27 +62,15 @@ Save to `docs/superpowers/specs/YYYY-MM-DD-<topic>-design.md` unless the user pr
|
|
|
62
62
|
|
|
63
63
|
## Spec Schema
|
|
64
64
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
8. `Implementation Decisions` — modules, interfaces, public contracts, schemas, interactions, and migration decisions.
|
|
75
|
-
9. `架构设计`.
|
|
76
|
-
10. `组件与文件`.
|
|
77
|
-
11. `数据流 / 接口`.
|
|
78
|
-
12. `错误处理`.
|
|
79
|
-
13. `测试策略` — testing decisions, highest available seam, precedents, normal and adversarial cases.
|
|
80
|
-
14. `验收标准`.
|
|
81
|
-
15. `风险与取舍`.
|
|
82
|
-
16. `回滚`.
|
|
83
|
-
17. `开放问题` — only non-blocking questions; write `无` when empty.
|
|
84
|
-
|
|
85
|
-
Do not include implementation snippets that will become stale. Do not present an unresolved branch as a settled decision.
|
|
65
|
+
Keep the document proportional to the decisions needed for implementation and review. Always cover the
|
|
66
|
+
problem, intended behavior and scope, constraints, resolved implementation decisions, test seams and
|
|
67
|
+
repeatable acceptance checks, and relevant risks or recovery. Combine related sections and omit sections
|
|
68
|
+
that add no decision or evidence; do not fill a fixed set of empty headings.
|
|
69
|
+
|
|
70
|
+
For complex or high-risk designs, read [references/spec-template.md](references/spec-template.md).
|
|
71
|
+
Public-contract, authorization or persistent-data changes must cover compatibility, failure behavior,
|
|
72
|
+
migration and rollback where relevant, even when headings are combined. Keep user approval and the
|
|
73
|
+
outcome contract below. Do not include stale implementation snippets or present an unresolved choice as settled.
|
|
86
74
|
|
|
87
75
|
## Self-Review
|
|
88
76
|
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Detailed Spec Reference
|
|
2
|
+
|
|
3
|
+
Read for complex or high-risk designs. This is a section menu, not a requirement to generate every
|
|
4
|
+
heading. Keep material decisions and evidence together; combine or omit sections that do not affect
|
|
5
|
+
implementation or review. The main Skill owns applicability, unresolved decisions, approval and outcomes.
|
|
6
|
+
|
|
7
|
+
Useful sections:
|
|
8
|
+
|
|
9
|
+
- `背景`、`目标`、`非目标`:problem, intended result and scope boundaries.
|
|
10
|
+
- `需求`:observable behavior, constraints, compatibility and useful User Stories.
|
|
11
|
+
- `现有上下文`:verified code facts, domain terms, ADRs, patterns and test precedents.
|
|
12
|
+
- `方案对比`、`推荐方案`:real alternatives, trade-offs and the resolved choice.
|
|
13
|
+
- `Implementation Decisions`:modules, interfaces, public contracts, schemas and migration decisions.
|
|
14
|
+
- `架构设计`、`组件与文件`、`数据流 / 接口`:boundaries and interactions that affect the implementation.
|
|
15
|
+
- `错误处理`:normal and adversarial behavior, retries, partial failure and recovery where relevant.
|
|
16
|
+
- `测试策略`、`验收标准`:highest available test seams and repeatable automated or manual checks.
|
|
17
|
+
- `风险与取舍`、`回滚`:impact, compatibility, migration, rollout and recovery.
|
|
18
|
+
- `开放问题`:only non-blocking questions; omit when none remain.
|
|
19
|
+
|
|
20
|
+
For public contracts, retain compatibility and consumer impact. For authentication or authorization,
|
|
21
|
+
retain trust boundaries, permissions and denial behavior. For persistent data or schemas, retain
|
|
22
|
+
migration ordering, partial failure, backup/recovery and rollback limits. A shorter document must still
|
|
23
|
+
make these consequential decisions explicit; user-owned decisions must already be resolved or delegated.
|
|
@@ -10,7 +10,7 @@ description: Diagnose bugs, recurring or flaky failures, slowness, and performan
|
|
|
10
10
|
- 已确认失败原因正确的预期 TDD RED:回到实现的 GREEN,不加载完整诊断参考。
|
|
11
11
|
- 原因已由错误信息和调用链证实的普通失败:最小修复并重跑对应验证,不制造多个假设。
|
|
12
12
|
- 根因不明、修复后仍重复失败、flaky 或性能回归:进入下方证据闭环,同时读取
|
|
13
|
-
|
|
13
|
+
[调试方法参考](references/debugging-methods.md),按当前证据选择复现、最小化和回归方法;执行流程与退出条件由本文定义。
|
|
14
14
|
|
|
15
15
|
所有路径都保留原始症状和修复后的验证证据。不能把非目标错误当作预期 RED,也不能跳过真实失败。
|
|
16
16
|
|
|
@@ -23,13 +23,13 @@ description: Diagnose bugs, recurring or flaky failures, slowness, and performan
|
|
|
23
23
|
区分报错位置、直接原因和上游触发条件,不能仅凭错误名称认定根因。
|
|
24
24
|
3. **选择取证路径。** 可复现时建立命中原症状的反馈并缩小场景;偶发问题记录样本数、失败率和条件,
|
|
25
25
|
不以一次成功认定修复,也不强求秒级运行或固定复现率。无法重现时,继续关联已有 trace、日志、请求、
|
|
26
|
-
|
|
26
|
+
时间线及代码路径,并用局部实验或定向观测检验解释;局部实验不冒充原场景复现。
|
|
27
27
|
4. **提出并检验假设。** 按现有证据选择有区分价值的假设,不凑固定数量。每个待检验假设写清依据、
|
|
28
28
|
可推翻它的预测和最小实验;一次改变一个变量。执行后记录实际结果,标记支持、排除或仍未确定。
|
|
29
29
|
展示假设是进度更新,不能在仍有可执行调查时以“可能原因”列表结束。
|
|
30
30
|
5. **确认后修复。** 进入根因修复前,说明触发条件如何沿调用链造成原症状,并提供能区分主要竞争解释的
|
|
31
31
|
运行证据或对照实验。只有代码猜测、错误消失或重试成功不足以确认。证据不足时继续取证;用户要求先止损时,
|
|
32
|
-
|
|
32
|
+
将措施标为缓解,不宣称根因已修复。确认后执行最小修复和原始场景回归,方法见调试方法参考。
|
|
33
33
|
尚未找到合适测试入口时,记录验证缺口并检查更完整的调用场景;缺少测试入口本身不能证明架构有错。
|
|
34
34
|
6. **失败后重新调查。** 假设被否定或修复无效时,记录反证,回到现场与调用链,不在未证实的改动上叠加补丁。
|
|
35
35
|
连续三次修复无效,或修复不断引出不同组件的异常时,重新检查问题模型、环境和共享状态/耦合;
|
|
@@ -48,6 +48,6 @@ description: Diagnose bugs, recurring or flaky failures, slowness, and performan
|
|
|
48
48
|
|
|
49
49
|
## 项目运行适配
|
|
50
50
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
`scripts/hitl-loop.template.js`。它是 HITL 的唯一运行入口;不要执行留档的 Bash 模板。
|
|
51
|
+
`references/diagnosing-bugs.upstream.md` 作为上游六阶段原文留档,`scripts/hitl-loop.template.sh` 作为上游原始 Bash 模板留档,均保持原样;
|
|
52
|
+
只有核对上游来源或差异时才读取,不作为排障执行参考。
|
|
53
|
+
需要人工操作才能复现时,使用 `scripts/hitl-loop.template.js`。它是 HITL 的唯一运行入口;不要执行留档的 Bash 模板。
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# 调试方法参考
|
|
2
|
+
|
|
3
|
+
疑难排障时按已有证据选用相关方法,不要求逐项执行。流程、修复门槛和退出条件由 `../SKILL.md` 定义。
|
|
4
|
+
|
|
5
|
+
## 捕捉原症状
|
|
6
|
+
|
|
7
|
+
- 可重现时,优先复用能触达真实故障路径的测试、CLI、HTTP 请求或浏览器操作;断言用户报告的症状,不能只检查“没有报错”。
|
|
8
|
+
- 有留存请求或事件时,可用脱敏夹具重放,核对版本、输入和依赖是否对应原现场;隔离后的结果不能冒充原场景复现。
|
|
9
|
+
- 无法重现时,关联现有日志、trace、请求标识、时间线和代码路径;对照正常请求或版本,用局部实验检验解释。
|
|
10
|
+
- 偶发问题记录样本数、失败率和触发条件。固定时间、随机种子或隔离状态可以减少噪音;是否增加压力或样本由证据需要决定,不设固定复现率或秒级要求。
|
|
11
|
+
|
|
12
|
+
## 缩小异常边界
|
|
13
|
+
|
|
14
|
+
- 比较最后正常边界与最早异常边界的输入、输出和状态,沿调用链找到首次偏离预期的位置。
|
|
15
|
+
- 有复现场景时,每次减少一个输入、调用者、配置或步骤,保留仍能触发原症状的部分;记录哪些条件影响结果。
|
|
16
|
+
- 怀疑版本或配置变化时,用相同输入作前后对照;只有两端结果可比较时才使用二分定位。
|
|
17
|
+
- 缩小运行范围、缓存无关初始化等方式可加快反馈,不能以牺牲症状覆盖换取速度。
|
|
18
|
+
|
|
19
|
+
## 区分解释
|
|
20
|
+
|
|
21
|
+
- 每个假设写清现有依据、可推翻它的预测和能区分竞争解释的最小实验;选择有信息价值的假设,不凑固定数量。
|
|
22
|
+
- 用断点、局部观测或带唯一标记的临时日志捕捉异常边界,一次改变一个变量,记录实际结果与反证。
|
|
23
|
+
- 性能问题先取得可比较的耗时、资源或调用测量,再对照版本、配置或输入;普通日志不能代替性能测量。
|
|
24
|
+
|
|
25
|
+
## 回归与清理
|
|
26
|
+
|
|
27
|
+
- 有能覆盖真实故障模式的测试入口时,把复现场景转成失败回归测试,再修复并验证;入口不足时记录验证缺口,继续检查实际调用场景。
|
|
28
|
+
- 检查原始场景与关键触发条件,避免仅凭缩小后的单一路径通过就宣称修复;偶发问题报告实际样本和残留不确定性。
|
|
29
|
+
- 清理本次临时观测和一次性夹具,保留长期回归测试及必要证据;不要删除用户已有文件。
|
|
30
|
+
- 需要人工操作时,按 `../scripts/hitl-loop.template.js` 记录步骤与结果。生产访问或观测需要单独授权,不能因缺少复现而自行扩大权限。
|
package/rules/02-code-size.md
DELETED
package/rules/03-architecture.md
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
# 架构与兼容
|
|
2
|
-
|
|
3
|
-
- 遵循目标项目的目录、分层和依赖方向;仅调整影响当前需求的职责与耦合。
|
|
4
|
-
- 优先现有实现、标准库和已安装依赖。抽象应隐藏细节、减少调用方复杂度;不为假设的复用增加接口或透传层。
|
|
5
|
-
- 实现、测试和类型保持局部性;跨域共用目录只承接已出现的稳定复用。
|
|
6
|
-
- 状态变化显式,遵循项目更新惯例;保留公共接口和既有工作流,破坏性变更需用户批准。
|
|
7
|
-
- 重构增量、可验证、可回退,正常与边界路径有相称验证。
|
|
8
|
-
|
|
9
|
-
## 跨平台脚本
|
|
10
|
-
|
|
11
|
-
优先复用项目脚本运行时;本项目使用 Node.js。必须兼容 Windows/macOS/Linux 的路径和进程调用,
|
|
12
|
-
按目标项目锁文件或配置选择 npm、pnpm、yarn 或 bun,不硬编码开发机路径。
|
package/rules/06-comments.md
DELETED