@leocm/flowcraft 2.1.0 → 2.3.0

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.
Files changed (96) hide show
  1. package/README.md +19 -2
  2. package/bin/cli.js +108 -108
  3. package/flowcraft.yaml +30 -30
  4. package/install.sh +24 -24
  5. package/lib/args.js +38 -38
  6. package/lib/config.js +20 -20
  7. package/lib/copy.js +131 -131
  8. package/lib/fix.js +110 -110
  9. package/lib/fsutil.js +104 -104
  10. package/lib/global.js +229 -229
  11. package/lib/init.js +43 -43
  12. package/lib/runtime.js +84 -84
  13. package/lib/version.js +55 -55
  14. package/lib/wizard.js +125 -125
  15. package/package.json +33 -33
  16. package/presets/backend.yaml +20 -20
  17. package/presets/default.yaml +15 -15
  18. package/presets/frontend.yaml +20 -20
  19. package/presets/quick-fix.yaml +15 -15
  20. package/setup/.claude/hooks/check-phase-test.py +152 -152
  21. package/setup/.claude/hooks/check-phase-write.py +235 -235
  22. package/setup/.claude/hooks/dispatch.py +67 -67
  23. package/setup/.claude/hooks/file-suggestion.py +45 -45
  24. package/setup/.claude/hooks/flowcraft_env.py +162 -137
  25. package/setup/.claude/hooks/permission-request.py +132 -125
  26. package/setup/.claude/hooks/post-tool-failure.py +36 -36
  27. package/setup/.claude/hooks/pre-compact.py +66 -66
  28. package/setup/.claude/hooks/review-runner.py +846 -846
  29. package/setup/.claude/hooks/setup-keys.py +282 -282
  30. package/setup/.claude/hooks/statusline.py +63 -63
  31. package/setup/.claude/hooks/stop-check.py +186 -171
  32. package/setup/.claude/hooks/subagent-start.py +50 -50
  33. package/setup/.claude/hooks/subagent-stop.py +63 -63
  34. package/setup/.claude/hooks/task-completed.py +57 -57
  35. package/setup/.claude/hooks/task_manager.py +592 -592
  36. package/setup/.claude/hooks/user-prompt-submit.py +91 -85
  37. package/setup/.claude/settings.json +233 -237
  38. package/setup/.claude/skills/Pstatus/SKILL.md +68 -68
  39. package/setup/.claude/skills/archive/SKILL.md +195 -195
  40. package/setup/.claude/skills/brainstorming/SKILL.md +5 -5
  41. package/setup/.claude/skills/brainstorming/scripts/server.cjs +723 -723
  42. package/setup/.claude/skills/brainstorming/scripts/start-server.py +245 -245
  43. package/setup/.claude/skills/brainstorming/scripts/stop-server.py +178 -178
  44. package/setup/.claude/skills/brainstorming/visual-companion.md +298 -298
  45. package/setup/.claude/skills/chrome-integration/SKILL.md +66 -66
  46. package/setup/.claude/skills/code-review/SKILL.md +264 -264
  47. package/setup/.claude/skills/executing-plans/SKILL.md +1 -1
  48. package/setup/.claude/skills/gitnexus/gitnexus-cli/SKILL.md +67 -67
  49. package/setup/.claude/skills/gitnexus/gitnexus-debugging/SKILL.md +1 -1
  50. package/setup/.claude/skills/gitnexus/gitnexus-exploring/SKILL.md +1 -1
  51. package/setup/.claude/skills/gitnexus/gitnexus-guide/SKILL.md +1 -1
  52. package/setup/.claude/skills/gitnexus/gitnexus-impact-analysis/SKILL.md +1 -1
  53. package/setup/.claude/skills/gitnexus/gitnexus-refactoring/SKILL.md +1 -1
  54. package/setup/.claude/skills/methodology/SKILL.md +124 -0
  55. package/setup/.claude/skills/phase/SKILL.md +62 -62
  56. package/setup/.claude/skills/playwright/SKILL.md +85 -85
  57. package/setup/.claude/skills/review/SKILL.md +97 -97
  58. package/setup/.claude/skills/task/SKILL.md +26 -26
  59. package/setup/.claude/skills/test-driven-development/SKILL.md +1 -1
  60. package/setup/.claude/skills/ui-ux-pro-max/SKILL.md +1 -1
  61. package/setup/.claude/skills/verification-before-completion/SKILL.md +1 -1
  62. package/setup/.claude/skills/writing-plans/SKILL.md +1 -1
  63. package/setup/.codex/.agents/skills/archive/SKILL.md +195 -195
  64. package/setup/.codex/.agents/skills/brainstorming/SKILL.md +5 -5
  65. package/setup/.codex/.agents/skills/brainstorming/scripts/server.cjs +723 -723
  66. package/setup/.codex/.agents/skills/brainstorming/scripts/start-server.py +245 -245
  67. package/setup/.codex/.agents/skills/brainstorming/scripts/stop-server.py +178 -178
  68. package/setup/.codex/.agents/skills/brainstorming/visual-companion.md +298 -298
  69. package/setup/.codex/.agents/skills/chrome-integration/SKILL.md +66 -66
  70. package/setup/.codex/.agents/skills/code-review/SKILL.md +264 -264
  71. package/setup/.codex/.agents/skills/executing-plans/SKILL.md +1 -1
  72. package/setup/.codex/.agents/skills/gitnexus/gitnexus-cli/SKILL.md +67 -67
  73. package/setup/.codex/.agents/skills/gitnexus/gitnexus-debugging/SKILL.md +1 -1
  74. package/setup/.codex/.agents/skills/gitnexus/gitnexus-exploring/SKILL.md +1 -1
  75. package/setup/.codex/.agents/skills/gitnexus/gitnexus-guide/SKILL.md +1 -1
  76. package/setup/.codex/.agents/skills/gitnexus/gitnexus-impact-analysis/SKILL.md +1 -1
  77. package/setup/.codex/.agents/skills/gitnexus/gitnexus-refactoring/SKILL.md +1 -1
  78. package/setup/.codex/.agents/skills/methodology/SKILL.md +124 -0
  79. package/setup/.codex/.agents/skills/phase/SKILL.md +62 -62
  80. package/setup/.codex/.agents/skills/playwright/SKILL.md +85 -85
  81. package/setup/.codex/.agents/skills/review/SKILL.md +97 -97
  82. package/setup/.codex/.agents/skills/task/SKILL.md +27 -27
  83. package/setup/.codex/.agents/skills/test-driven-development/SKILL.md +1 -1
  84. package/setup/.codex/.agents/skills/ui-ux-pro-max/SKILL.md +1 -1
  85. package/setup/.codex/.agents/skills/verification-before-completion/SKILL.md +1 -1
  86. package/setup/.codex/.agents/skills/writing-plans/SKILL.md +1 -1
  87. package/setup/.codex/hooks/review-runner.py +851 -851
  88. package/setup/.codex/hooks/setup-keys.py +287 -287
  89. package/setup/AGENTS.md +11 -1
  90. package/setup/CLAUDE.md +11 -1
  91. package/setup/install.sh +24 -24
  92. package/setup/tests/test_decision_timeout.py +241 -241
  93. package/setup/tests/test_hook_guards.py +357 -357
  94. package/setup/tests/test_sdlc_bootstrap.py +167 -167
  95. package/setup/tests/test_sessionlog_switch.py +199 -0
  96. package/setup/tests/test_task_manager.py +148 -148
@@ -1,67 +1,67 @@
1
- ---
2
- name: gitnexus-cli
3
- description: "GitNexus CLI: install/analyze/query/impact/rename. | 触发词:索引仓库/重新分析/GitNexus安装"
4
- ---
5
-
6
- > **Note (定位)**: 代码图谱/查询主用 `graphify` 技能(R1);GitNexus 用于符号级 rename/impact 与深度影响分析(R2,非商用)。
7
-
8
- # GitNexus CLI — Install & Usage (安装与使用)
9
-
10
- ## Install (安装)
11
-
12
- > 本机 npm 11.6.2 有原生依赖安装崩溃 bug(GitNexus README 官方提示),推荐用 pnpm。
13
-
14
- **方式 1 — pnpm 按需(推荐,本机现用)**
15
- ```bash
16
- pnpm --allow-build=@ladybugdb/core --allow-build=gitnexus --allow-build=tree-sitter dlx gitnexus@latest <cmd>
17
- ```
18
-
19
- **方式 2 — pnpm 全局(长期使用)**
20
- ```bash
21
- pnpm setup # 把 pnpm bin 加入 PATH(会改 shell 配置)
22
- pnpm --allow-build=@ladybugdb/core --allow-build=gitnexus --allow-build=tree-sitter add -g gitnexus
23
- gitnexus <cmd>
24
- ```
25
-
26
- **方式 3 — npm 全局(仅 npm < 11)**
27
- ```bash
28
- npm install -g gitnexus
29
- gitnexus <cmd>
30
- ```
31
-
32
- ## Enable (启用/建索引)
33
-
34
- ```bash
35
- # 从项目根目录
36
- gitnexus analyze # 建/刷新索引(npx/pnpm dlx 等价)
37
- gitnexus status # 查看索引新鲜度
38
- ```
39
-
40
- ## Usage (常用命令)
41
-
42
- | Command | Purpose (用途) |
43
- |---|---|
44
- | `gitnexus analyze` | 建/刷新索引(`--force` 全量重索引;`--embeddings` 语义搜索,默认关) |
45
- | `gitnexus status` | 索引新鲜度 + 符号/关系计数 |
46
- | `gitnexus query "<概念>"` | 按概念搜索知识图谱中的执行流 |
47
- | `gitnexus context <符号>` | 符号 360° 视图:调用方/被调/流程 |
48
- | `gitnexus impact <符号>` | 影响分析:改这个会破坏什么 |
49
- | `gitnexus trace <from> <to>` | 两符号间最短调用路径 |
50
- | `gitnexus detect-changes` | 把 git diff 映射到符号与受影响流程 |
51
- | `gitnexus clean` | 删除 `.gitnexus/` 索引(`--force`/`--all`) |
52
- | `gitnexus list` | 列出已索引仓库 |
53
- | `gitnexus doctor` | 平台能力/FTS/嵌入配置诊断 |
54
- | `gitnexus serve` / `mcp` | 启动 Web UI / MCP 服务(编辑器集成用 `setup`) |
55
- | `gitnexus setup` | 一次性配置 MCP(Cursor/Claude Code/Codex) |
56
-
57
- ## After Indexing (建索引后)
58
-
59
- 1. 读 `gitnexus://repo/{name}/context` 验证索引加载
60
- 2. 代码理解/查询优先 `graphify`;符号级 rename/impact 用本技能
61
- 3. 复杂任务参考 gitnexus-exploring / debugging / impact-analysis / refactoring
62
-
63
- ## Notes (注意)
64
-
65
- - **FTS 全文搜索**:Windows 上 LadybugDB FTS 扩展可能装不上(仅影响 BM25 关键词搜索,核心图谱不受影响);用 `gitnexus doctor` 排查
66
- - **License**:PolyForm 非商用;自用 OK,商用需企业版或改用 graphify(Apache-2.0)
67
- - **Troubleshooting**:需在 git 仓库内运行;索引陈旧就重新 `analyze`;嵌入慢可省略 `--embeddings`
1
+ ---
2
+ name: gitnexus-cli
3
+ description: "GitNexus CLI: install/analyze/query/impact/rename. | 触发词:索引仓库/重新分析/GitNexus安装"
4
+ ---
5
+
6
+ > **Note (定位)**: 代码图谱/查询主用 `graphify` 技能(R1);GitNexus 用于符号级 rename/impact 与深度影响分析(R2,非商用)。
7
+
8
+ # GitNexus CLI — Install & Usage (安装与使用)
9
+
10
+ ## Install (安装)
11
+
12
+ > 本机 npm 11.6.2 有原生依赖安装崩溃 bug(GitNexus README 官方提示),推荐用 pnpm。
13
+
14
+ **方式 1 — pnpm 按需(推荐,本机现用)**
15
+ ```bash
16
+ pnpm --allow-build=@ladybugdb/core --allow-build=gitnexus --allow-build=tree-sitter dlx gitnexus@latest <cmd>
17
+ ```
18
+
19
+ **方式 2 — pnpm 全局(长期使用)**
20
+ ```bash
21
+ pnpm setup # 把 pnpm bin 加入 PATH(会改 shell 配置)
22
+ pnpm --allow-build=@ladybugdb/core --allow-build=gitnexus --allow-build=tree-sitter add -g gitnexus
23
+ gitnexus <cmd>
24
+ ```
25
+
26
+ **方式 3 — npm 全局(仅 npm < 11)**
27
+ ```bash
28
+ npm install -g gitnexus
29
+ gitnexus <cmd>
30
+ ```
31
+
32
+ ## Enable (启用/建索引)
33
+
34
+ ```bash
35
+ # 从项目根目录
36
+ gitnexus analyze # 建/刷新索引(npx/pnpm dlx 等价)
37
+ gitnexus status # 查看索引新鲜度
38
+ ```
39
+
40
+ ## Usage (常用命令)
41
+
42
+ | Command | Purpose (用途) |
43
+ |---|---|
44
+ | `gitnexus analyze` | 建/刷新索引(`--force` 全量重索引;`--embeddings` 语义搜索,默认关) |
45
+ | `gitnexus status` | 索引新鲜度 + 符号/关系计数 |
46
+ | `gitnexus query "<概念>"` | 按概念搜索知识图谱中的执行流 |
47
+ | `gitnexus context <符号>` | 符号 360° 视图:调用方/被调/流程 |
48
+ | `gitnexus impact <符号>` | 影响分析:改这个会破坏什么 |
49
+ | `gitnexus trace <from> <to>` | 两符号间最短调用路径 |
50
+ | `gitnexus detect-changes` | 把 git diff 映射到符号与受影响流程 |
51
+ | `gitnexus clean` | 删除 `.gitnexus/` 索引(`--force`/`--all`) |
52
+ | `gitnexus list` | 列出已索引仓库 |
53
+ | `gitnexus doctor` | 平台能力/FTS/嵌入配置诊断 |
54
+ | `gitnexus serve` / `mcp` | 启动 Web UI / MCP 服务(编辑器集成用 `setup`) |
55
+ | `gitnexus setup` | 一次性配置 MCP(Cursor/Claude Code/Codex) |
56
+
57
+ ## After Indexing (建索引后)
58
+
59
+ 1. 读 `gitnexus://repo/{name}/context` 验证索引加载
60
+ 2. 代码理解/查询优先 `graphify`;符号级 rename/impact 用本技能
61
+ 3. 复杂任务参考 gitnexus-exploring / debugging / impact-analysis / refactoring
62
+
63
+ ## Notes (注意)
64
+
65
+ - **FTS 全文搜索**:Windows 上 LadybugDB FTS 扩展可能装不上(仅影响 BM25 关键词搜索,核心图谱不受影响);用 `gitnexus doctor` 排查
66
+ - **License**:PolyForm 非商用;自用 OK,商用需企业版或改用 graphify(Apache-2.0)
67
+ - **Troubleshooting**:需在 git 仓库内运行;索引陈旧就重新 `analyze`;嵌入慢可省略 `--embeddings`
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: gitnexus-debugging
3
- description: "Debug issues: trace errors, find root causes. | 触发词:调试/报错/为什么失败"
3
+ description: "Debug issues: trace errors, find root causes. | 触发词:调试/报错/为什么失败"
4
4
  ---
5
5
 
6
6
  # Debugging with GitNexus
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: gitnexus-exploring
3
- description: "Explore code: understand architecture and execution flows. | 触发词:代码怎么工作/架构/调用链"
3
+ description: "Explore code: understand architecture and execution flows. | 触发词:代码怎么工作/架构/调用链"
4
4
  ---
5
5
 
6
6
  # Exploring Codebases with GitNexus
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: gitnexus-guide
3
- description: "GitNexus usage guide: tools, queries, workflow reference. | 触发词:gitnexus指导/怎么用"
3
+ description: "GitNexus usage guide: tools, queries, workflow reference. | 触发词:gitnexus指导/怎么用"
4
4
  ---
5
5
 
6
6
  # GitNexus Guide
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: gitnexus-impact-analysis
3
- description: "Impact analysis: what breaks if you change something. | 触发词:影响分析/改了什么会挂/安全吗"
3
+ description: "Impact analysis: what breaks if you change something. | 触发词:影响分析/改了什么会挂/安全吗"
4
4
  ---
5
5
 
6
6
  # Impact Analysis with GitNexus
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: gitnexus-refactoring
3
- description: "Safe refactoring: rename/extract/split/move code. | 触发词:重构/重命名/提取"
3
+ description: "Safe refactoring: rename/extract/split/move code. | 触发词:重构/重命名/提取"
4
4
  ---
5
5
 
6
6
  # Refactoring with GitNexus
@@ -0,0 +1,124 @@
1
+ ---
2
+ name: methodology
3
+ description: "解决需求的方法论:判据先行、单变量实验、枚举候选、三次换维度、结论不升级、汇报四段。| 触发词:判据/卡住/换维度/枚举/复盘/汇报/方案验证/无进展"
4
+ ---
5
+
6
+ # 解决问题的方法论
7
+
8
+ > 适用于任何需求的通用解题闭环:需求澄清、方案验证、缺陷排查、批量改造、代码审查、技术选型、汇报复盘都按它执行。
9
+
10
+ ## 1. 核心闭环
11
+
12
+ ```
13
+ 目标 → 假设 → 实验(单变量) → 判据(机器可判) → 结论(只降级到"此法失败")
14
+ ↑ │
15
+ └──────── 换维度 ←── 三次不通 ────────┘
16
+ ```
17
+
18
+ - **目标**:可判定达成与否——"干半天不知道算不算完"就是目标没定
19
+ - **假设**:一次只提一个可证伪的假设——变量混杂则结果无法归因
20
+ - **实验**:只改一个变量——否则说不清哪一步起作用
21
+ - **判据**:机器可判(数值/状态/差分)——靠眼看,慢且会自欺
22
+ - **结论**:只降级到"此方法失败"——升级成"不可能"会把路堵死
23
+
24
+ **核心顺序:判据先行。** 动手前先回答"我怎么知道它成了";答不上来,不许开工。
25
+
26
+ > **一句话版**:先定判据再动手,一次只改一个变量;不确定就枚举候选逐个验;三次不通换维度;失败只记"此法不行",不记"做不到";用户的红线不能拿去换进度;被指出别人做到了,先说它怎么做,再直接做下一步。
27
+
28
+ ## 2. 五条铁律(最小约束集)
29
+
30
+ 1. 先定判据,再动手。没有可判定的成功标准,不许开实验。
31
+ 2. 一次只改一个变量,其余保持不变,并记录。
32
+ 3. 不确定操作对象时,枚举全部候选逐个试、逐个验;不许先推理定死一个。
33
+ 4. 同一维度连续失败 3 次,强制换维度(对象/坐标/通道/坐标系/时序/权限)。
34
+ 5. 一次失败只能产出"这种方法失败",不许产出"做不到"。
35
+
36
+ ## 3. 准则 14 条(可直接当提示词)
37
+
38
+ 1. 先定判据,再动手。没有可判定的成功标准,不许开实验。
39
+ 2. 一次只改一个变量,其余保持不变,并记录。
40
+ 3. 不确定操作对象时,枚举全部候选,逐个试、逐个验;不许先推理定死一个。
41
+ 4. 同一维度连续失败 3 次,强制换维度(对象/坐标/通道/坐标系/时序/权限)。
42
+ 5. 一次失败只能产出"这种方法失败",不许产出"做不到"。
43
+ 6. 禁止用"读几个字、看一眼"当判据;必须能量化或可客观比对。
44
+ 7. 用户给定的硬约束是红线,不是权衡项;为推进而违反,算失败并需回滚。
45
+ 8. 不得自行放宽范围或标准;要改,先停、先问、得到明确同意。
46
+ 9. 被指出"别人做到了",先复述对方做法与自己的差距,再直接给下一步实验。
47
+ 10. 卡住 = 连续 3 轮无实质进展。此时停止重试,输出已试清单 + 最佳假设 + 缺什么。
48
+ 11. 汇报固定四段:结论(达成/未达成)、已完成、未完成及原因(只写事实)、下一步(具体动作)。
49
+ 12. 不认领他人成果;引用须标注来源,借来的成果不能当完成论据。
50
+ 13. 禁止的自我安慰句式:"理论上可以""再试一次应该行""可能是环境问题"(除非能给出验证方式)。
51
+ 14. 同一参数连续微调两次即视为原地打转,必须换维度。
52
+
53
+ ## 4. 反模式对照
54
+
55
+ - **结论升级**:一次实验失败 → "根本不可能" ⟶ 只记"此路径失败,下一路径:X"
56
+ - **判据模糊**:靠肉眼读界面或日志文字判断是否生效 ⟶ 图像差分/状态字段,毫秒级出结果
57
+ - **推理代替枚举**:认定"投给顶层对象就对" ⟶ 列出全部候选逐个投、逐个验
58
+ - **重复同维度**:反复改参数、加兜底、重试同类操作 ⟶ 三次不通就换维度
59
+ - **用解释冒充交付**:花大篇幅讲"为什么不行" ⟶ 先给下一步动作,解释不超过两句
60
+ - **拿约束换进度**:为了跑通退回违反红线的做法 ⟶ 约束是红线,宁可卡住
61
+ - **消化反例**:别人做成了,用"那是特例"解释掉 ⟶ 承认差距,定位缺的那一步
62
+ - **维护一致性**:说过"不行",之后只找支持自己的证据 ⟶ 把旧结论当待推翻的假设
63
+
64
+ ## 5. 检查清单
65
+
66
+ **开始前**
67
+ - 成功的判据是什么?能量化吗?
68
+ - 这次只改哪一个变量?
69
+ - 有哪些候选对象需要枚举?
70
+ - 用户给了哪些红线?
71
+
72
+ **卡住时**
73
+ - 我已经试了几种?分别是哪几种?
74
+ - 判据可靠吗,会不会是我看错了?
75
+ - 我是不是在重复同一维度?
76
+ - 我现在是在做实验,还是在写解释?
77
+
78
+ ## 6. 按工作类型适配
79
+
80
+ **Java 后端缺陷排查**
81
+ - 判据(不可用"看着好了"替代):可重复复现步骤且失败现象一致;证据链(堆栈指向具体类与方法/日志时间戳对齐/观测数据);修复后同一复现步骤不再触发且原有用例全绿;结论能被第三方用同样证据复算
82
+ - 单变量:一次只改一处——序列化器配置、连接池参数、依赖版本、超时值;改完只跑同一组用例,不顺手加别的改动
83
+ - 换维度三方向:证据层(加日志/抓包/反编译)→ 隔离层(拆最小复现工程)→ 环境层(版本、连接方式、部署差异)
84
+ - 反模式:拿"应该是序列化问题"当结论;反复重启服务看是否好转;把环境偶然通过当成修复
85
+
86
+ **批量改造(大规模迁移)**
87
+ - 判据:编译通过(不是"IDE 没报红");自动化扫描旧模式残留数 = 0(正则/脚本统计,给出数字);关键链路回归用例通过;每批次改动可独立回滚
88
+ - 分批原则:按模块切,不按时间切;单批规模以"出问题能 30 分钟内定位"为上限
89
+ - 换维度含义:换匹配规则(正则精度)、换工具(IDE 批量 vs 脚本)、换粒度(文件级 vs 项目级),而不是重跑同一替换
90
+ - 反模式:人眼抽查代替扫描;一次性全量替换后再看编译;"改完了应该没问题"
91
+
92
+ **代码审查与团队规范**
93
+ - 判据必须可被他人或机器检查,否则不叫判据:命名规范=静态检查规则命中数 0;日志规范=关键路径入参/出参/异常三件套逐项打勾;分支规范=分支名匹配约定且合并前 CI 通过;审查有效性=每条意见有结论(改/不改+理由),不留"已读"
94
+ - 反模式:把"大家都理解了"当落地;用会议纪要代替检查项;审查意见只写"建议优化"
95
+
96
+ **AI 转型试点**
97
+ - 判据只有一个:一条真实业务用例端到端跑通——真实数据进来 → 自动处理 → 能被检索/使用 → 业务方确认结果对
98
+ - 不是判据的东西:工具链搭好了、Demo 跑通了、模型能对话了
99
+ - 收缩范围:先跑通最关键模块中的 1 个,再谈铺开;每加一个模块必须能独立验证
100
+ - 反模式:先搭全套框架再找场景;用"流程已打通"描述未验证的链路;把方案文档当成成果
101
+
102
+ **汇报与复盘**(固定四段,缺一不可)
103
+ ```
104
+ 结论:达成 / 未达成 / 部分达成(哪部分)
105
+ 已完成:可验证的事实(数字、链接、提交号)
106
+ 未完成及原因:只写事实,不写辩解
107
+ 下一步:具体动作 + 责任人 + 判据
108
+ ```
109
+ - 反模式:用"正在推进"覆盖进度;用篇幅代替结论;原因段写成解释段
110
+
111
+ ## 7. 补充规则
112
+
113
+ **枚举成本过高时:两段式筛选**
114
+ - 候选超过 10 个时,不许全枚举,也不许直接猜
115
+ - 粗筛:按一个可解释的特征把候选砍到 3-5 个,并写明筛选依据(能被别人质疑)
116
+ - 逐个验:对这 3-5 个逐个试 + 逐个判定
117
+ - 不许用"凭经验"当筛选依据
118
+
119
+ **探索期:允许失败,但不允许没有判据**
120
+ - 调研、选型、试点这类任务,假设不成立是正常产出,不算失败
121
+ - 判据可以后置,但必须在动手后一小时内补上,且写成"最小可交付切片"(能跑通一个真实场景)
122
+ - 允许连续多次假设不成立,但每次留下结论:`假设 X 不成立,依据是 Y`
123
+ - 连续 3 个假设都不成立 → 停下来重新定义问题,而不是继续换假设
124
+ - 唯一不允许:探索期用"还在研究"当状态,既没有判据也没有结论
@@ -1,63 +1,63 @@
1
- ---
2
- name: phase
3
- description: "SDLC phase management: view/advance/rollback. | 触发词:下一阶段/推进/查看阶段"
4
- argument-hint: "[next|back|status]"
5
- allowed-tools:
6
- - Read
7
- - Edit
8
- - Glob
9
- - Grep
10
- ---
11
-
12
- Usage: `/phase [next|back|status]`
13
-
14
- Arguments: $ARGUMENTS
15
-
16
- ---
17
-
18
- ## Decision point format (决策点格式)
19
-
20
- Present every decision point (requirement method A/B, P0.5 A/B/C, etc.) with the Decision Card format defined in AGENTS.md / CLAUDE.md → "Display Format Standard (展示格式规范) → Decision point format (决策点格式)": bold black title, options labeled A./B./C. in order, ✅ Recommended / 🔀 Alternative marks, features/when-to-use/costs per option; no thin box-drawing characters, no trailing operation hint line.
21
-
22
- ## Current phase (当前阶段)
23
- Read `.claude/project-state.md` to get the `current_phase` value.
24
-
25
- ## Execution logic (执行逻辑)
26
-
27
- ### No argument or `status`
28
- Read `.claude/project-state.md` and output: phase number + name, allowed operations, completion conditions, advancement method.
29
-
30
- ### `next` — advance to the next phase
31
-
32
- 1. Read the current phase and check completion conditions
33
- 2. **P1 (advance on user PRD confirmation)**: at P1 start, ask the user to choose requirement method **A. brainstorming (default) / B. openspec** and record it; after the user confirms the PRD (including architecture + prototype) → **first write `plan/<task-name>.md` to save the design** → update `project-state.md` → prompt "entering auto-driven mode (自动驱动模式)"
34
- 3. **P2/P3/P5 (advance on completion, no review)**: before P2, Read `plan/` to confirm the plan file exists; write it first if missing → P2 done (requires [P2-COMPLETION] three-question self-review) → P3; P3 done → P4; P5 done → output the delivery summary report
35
- 4. **P4 (the only formal review)**: auto-run `/review` → pass → P5; fail → auto-fix and re-review (max 3 times)
36
-
37
- Update fields: `current_phase`, `phase_history`, `last_updated`, `review_retry_count`→0
38
-
39
- ### `back` — roll back to the previous phase
40
- P0/P1 cannot roll back. Ask for the rollback reason; update `project-state.md` (`current_phase`, `phase_history` including the rollback reason, `last_updated`)
41
-
42
- ---
43
-
44
- ## Auto-driven mode (自动驱动模式)
45
-
46
- After the user confirms the PRD in P1, P2-P5 run automatically: coding → testing → P4 comprehensive review → delivery. P4 is the only review gate; on failure, auto-fix and retry (max 3 times). The user can intervene anytime: `/phase` to view progress, `/review` for a manual review, `/phase back` to roll back.
47
-
48
- ---
49
-
50
- ## P5 delivery summary report format (P5 交付摘要报告格式, concise)
51
-
52
- ```
53
- # P5 Delivery Summary (P5 交付摘要)
54
-
55
- **PRD completed (PRD 完成)**: {n}/{n} (100%) | R1✅ R2✅ R3✅
56
- **Files (文件)**: {n} | **Tests (测试)**: {n} passed | **Git**: {hash}
57
- **Review retries (审查重试)**: {n}
58
- ```
59
-
60
- ## Mandatory rules (强制规则, violation = violation)
61
- - Before entering P2 (coding), must first check whether the `plan/` directory contains a plan file for the current task; output the detailed plan doc to `plan/`
62
- - If the plan file does not exist, must first write `plan/<task-name>.md` and get user confirmation
1
+ ---
2
+ name: phase
3
+ description: "SDLC phase management: view/advance/rollback. | 触发词:下一阶段/推进/查看阶段"
4
+ argument-hint: "[next|back|status]"
5
+ allowed-tools:
6
+ - Read
7
+ - Edit
8
+ - Glob
9
+ - Grep
10
+ ---
11
+
12
+ Usage: `/phase [next|back|status]`
13
+
14
+ Arguments: $ARGUMENTS
15
+
16
+ ---
17
+
18
+ ## Decision point format (决策点格式)
19
+
20
+ Present every decision point (requirement method A/B, P0.5 A/B/C, etc.) with the Decision Card format defined in AGENTS.md / CLAUDE.md → "Display Format Standard (展示格式规范) → Decision point format (决策点格式)": bold black title, options labeled A./B./C. in order, ✅ Recommended / 🔀 Alternative marks, features/when-to-use/costs per option; no thin box-drawing characters, no trailing operation hint line.
21
+
22
+ ## Current phase (当前阶段)
23
+ Read `.claude/project-state.md` to get the `current_phase` value.
24
+
25
+ ## Execution logic (执行逻辑)
26
+
27
+ ### No argument or `status`
28
+ Read `.claude/project-state.md` and output: phase number + name, allowed operations, completion conditions, advancement method.
29
+
30
+ ### `next` — advance to the next phase
31
+
32
+ 1. Read the current phase and check completion conditions
33
+ 2. **P1 (advance on user PRD confirmation)**: at P1 start, ask the user to choose requirement method **A. brainstorming (default) / B. openspec** and record it; after the user confirms the PRD (including architecture + prototype) → **first write `plan/<task-name>.md` to save the design** → update `project-state.md` → prompt "entering auto-driven mode (自动驱动模式)"
34
+ 3. **P2/P3/P5 (advance on completion, no review)**: before P2, Read `plan/` to confirm the plan file exists; write it first if missing → P2 done (requires [P2-COMPLETION] three-question self-review) → P3; P3 done → P4; P5 done → output the delivery summary report
35
+ 4. **P4 (the only formal review)**: auto-run `/review` → pass → P5; fail → auto-fix and re-review (max 3 times)
36
+
37
+ Update fields: `current_phase`, `phase_history`, `last_updated`, `review_retry_count`→0
38
+
39
+ ### `back` — roll back to the previous phase
40
+ P0/P1 cannot roll back. Ask for the rollback reason; update `project-state.md` (`current_phase`, `phase_history` including the rollback reason, `last_updated`)
41
+
42
+ ---
43
+
44
+ ## Auto-driven mode (自动驱动模式)
45
+
46
+ After the user confirms the PRD in P1, P2-P5 run automatically: coding → testing → P4 comprehensive review → delivery. P4 is the only review gate; on failure, auto-fix and retry (max 3 times). The user can intervene anytime: `/phase` to view progress, `/review` for a manual review, `/phase back` to roll back.
47
+
48
+ ---
49
+
50
+ ## P5 delivery summary report format (P5 交付摘要报告格式, concise)
51
+
52
+ ```
53
+ # P5 Delivery Summary (P5 交付摘要)
54
+
55
+ **PRD completed (PRD 完成)**: {n}/{n} (100%) | R1✅ R2✅ R3✅
56
+ **Files (文件)**: {n} | **Tests (测试)**: {n} passed | **Git**: {hash}
57
+ **Review retries (审查重试)**: {n}
58
+ ```
59
+
60
+ ## Mandatory rules (强制规则, violation = violation)
61
+ - Before entering P2 (coding), must first check whether the `plan/` directory contains a plan file for the current task; output the detailed plan doc to `plan/`
62
+ - If the plan file does not exist, must first write `plan/<task-name>.md` and get user confirmation
63
63
  - Creating or modifying code files without a plan file is forbidden
@@ -1,86 +1,86 @@
1
- # Playwright Testing Skill
2
-
3
- > **Note (说明)**: 浏览器交互工具层已由官方 `playwright-cli` 技能取代(R4);本技能保留 E2E 测试框架(@playwright/test)用法。
4
-
5
- Browser automation and end-to-end testing using Playwright.
6
-
7
- ## Installation
8
-
9
- ```bash
10
- npm install -D @playwright/test
11
- npx playwright install chromium
12
- ```
13
-
14
- ## Common Commands
15
-
16
- | Task | Command |
17
- |------|---------|
18
- | Install browsers | `npx playwright install` |
19
- | Run tests | `npx playwright test` |
20
- | UI mode | `npx playwright test --ui` |
21
- | Headless | `npx playwright test --headed` |
22
- | Debug | `npx playwright test --debug` |
23
- | Record | `npx playwright codegen` |
24
-
25
- ## Test Structure
26
-
27
- ```typescript
28
- import { test, expect } from '@playwright/test'
29
-
30
- test('basic test', async ({ page }) => {
31
- await page.goto('http://localhost:5173')
32
- await expect(page.locator('h1')).toContainText('Dashboard')
33
- })
34
- ```
35
-
36
- ## Selectors
37
-
38
- | Type | Example |
39
- |------|---------|
40
- | Text | `page.getByText('Submit')` |
41
- | Role | `page.getByRole('button')` |
42
- | Label | `page.getByLabel('Email')` |
43
- | TestId | `page.getByTestId('submit-btn')` |
44
-
45
- ## Common Actions
46
-
47
- ```typescript
48
- // Click
49
- await page.click('button#submit')
50
-
51
- // Fill input
52
- await page.fill('input[name="email"]', 'test@example.com')
53
-
54
- // Select dropdown
55
- await page.selectOption('select#country', 'US')
56
-
57
- // Hover
58
- await page.hover('.menu-item')
59
-
60
- // Screenshot
61
- await page.screenshot({ path: 'screenshot.png' })
62
-
63
- // Wait for navigation
64
- await page.waitForURL('**/dashboard')
65
- ```
66
-
67
- ## Assertions
68
-
69
- ```typescript
70
- await expect(page.locator('h1')).toHaveText('Welcome')
71
- await expect(page.locator('.error')).toBeHidden()
72
- await expect(page.locator('table tr')).toHaveCount(5)
73
- ```
74
-
75
- ## Wait Strategies
76
-
77
- ```typescript
78
- // Wait for element
79
- await page.waitForSelector('.loading', { state: 'hidden' })
80
-
81
- // Wait for response
82
- await page.waitForResponse('**/api/data')
83
-
84
- // Network idle
85
- await page.waitForLoadState('networkidle')
1
+ # Playwright Testing Skill
2
+
3
+ > **Note (说明)**: 浏览器交互工具层已由官方 `playwright-cli` 技能取代(R4);本技能保留 E2E 测试框架(@playwright/test)用法。
4
+
5
+ Browser automation and end-to-end testing using Playwright.
6
+
7
+ ## Installation
8
+
9
+ ```bash
10
+ npm install -D @playwright/test
11
+ npx playwright install chromium
12
+ ```
13
+
14
+ ## Common Commands
15
+
16
+ | Task | Command |
17
+ |------|---------|
18
+ | Install browsers | `npx playwright install` |
19
+ | Run tests | `npx playwright test` |
20
+ | UI mode | `npx playwright test --ui` |
21
+ | Headless | `npx playwright test --headed` |
22
+ | Debug | `npx playwright test --debug` |
23
+ | Record | `npx playwright codegen` |
24
+
25
+ ## Test Structure
26
+
27
+ ```typescript
28
+ import { test, expect } from '@playwright/test'
29
+
30
+ test('basic test', async ({ page }) => {
31
+ await page.goto('http://localhost:5173')
32
+ await expect(page.locator('h1')).toContainText('Dashboard')
33
+ })
34
+ ```
35
+
36
+ ## Selectors
37
+
38
+ | Type | Example |
39
+ |------|---------|
40
+ | Text | `page.getByText('Submit')` |
41
+ | Role | `page.getByRole('button')` |
42
+ | Label | `page.getByLabel('Email')` |
43
+ | TestId | `page.getByTestId('submit-btn')` |
44
+
45
+ ## Common Actions
46
+
47
+ ```typescript
48
+ // Click
49
+ await page.click('button#submit')
50
+
51
+ // Fill input
52
+ await page.fill('input[name="email"]', 'test@example.com')
53
+
54
+ // Select dropdown
55
+ await page.selectOption('select#country', 'US')
56
+
57
+ // Hover
58
+ await page.hover('.menu-item')
59
+
60
+ // Screenshot
61
+ await page.screenshot({ path: 'screenshot.png' })
62
+
63
+ // Wait for navigation
64
+ await page.waitForURL('**/dashboard')
65
+ ```
66
+
67
+ ## Assertions
68
+
69
+ ```typescript
70
+ await expect(page.locator('h1')).toHaveText('Welcome')
71
+ await expect(page.locator('.error')).toBeHidden()
72
+ await expect(page.locator('table tr')).toHaveCount(5)
73
+ ```
74
+
75
+ ## Wait Strategies
76
+
77
+ ```typescript
78
+ // Wait for element
79
+ await page.waitForSelector('.loading', { state: 'hidden' })
80
+
81
+ // Wait for response
82
+ await page.waitForResponse('**/api/data')
83
+
84
+ // Network idle
85
+ await page.waitForLoadState('networkidle')
86
86
  ```