@leocm/flowcraft 0.0.0-stage → 2.1.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.
- package/README.md +855 -3
- package/bin/cli.js +108 -0
- package/flowcraft.yaml +30 -0
- package/install.sh +24 -0
- package/lib/args.js +38 -0
- package/lib/config.js +20 -0
- package/lib/copy.js +131 -0
- package/lib/fix.js +110 -0
- package/lib/fsutil.js +104 -0
- package/lib/global.js +229 -0
- package/lib/init.js +43 -0
- package/lib/runtime.js +84 -0
- package/lib/version.js +55 -0
- package/lib/wizard.js +125 -0
- package/package.json +31 -4
- package/presets/backend.yaml +20 -0
- package/presets/default.yaml +15 -0
- package/presets/frontend.yaml +20 -0
- package/presets/quick-fix.yaml +15 -0
- package/setup/.claude/commands/P0.5.md +1 -0
- package/setup/.claude/commands/P0.md +1 -0
- package/setup/.claude/commands/P1.md +1 -0
- package/setup/.claude/commands/P2.md +1 -0
- package/setup/.claude/commands/P3.md +1 -0
- package/setup/.claude/commands/P4.md +1 -0
- package/setup/.claude/commands/P5.md +1 -0
- package/setup/.claude/commands/code-analysis-init.md +1 -0
- package/setup/.claude/commands/code-analysis-rebuild.md +1 -0
- package/setup/.claude/commands/code-analysis-show-memory.md +1 -0
- package/setup/.claude/commands/code-analysis-update.md +1 -0
- package/setup/.claude/hooks/check-phase-advancement.py +180 -0
- package/setup/.claude/hooks/check-phase-test.py +152 -0
- package/setup/.claude/hooks/check-phase-write.py +235 -0
- package/setup/.claude/hooks/dispatch.py +67 -0
- package/setup/.claude/hooks/file-suggestion.py +45 -0
- package/setup/.claude/hooks/flowcraft_env.py +137 -0
- package/setup/.claude/hooks/log_session.py +93 -0
- package/setup/.claude/hooks/permission-request.py +125 -0
- package/setup/.claude/hooks/post-tool-failure.py +36 -0
- package/setup/.claude/hooks/pre-compact.py +66 -0
- package/setup/.claude/hooks/review-runner.py +846 -0
- package/setup/.claude/hooks/session-end.py +184 -0
- package/setup/.claude/hooks/session-start.py +188 -0
- package/setup/.claude/hooks/settings.json +0 -0
- package/setup/.claude/hooks/setup-keys.py +282 -0
- package/setup/.claude/hooks/statusline.py +63 -0
- package/setup/.claude/hooks/stop-check.py +171 -0
- package/setup/.claude/hooks/subagent-start.py +50 -0
- package/setup/.claude/hooks/subagent-stop.py +63 -0
- package/setup/.claude/hooks/task-completed.py +57 -0
- package/setup/.claude/hooks/task_manager.py +592 -0
- package/setup/.claude/hooks/user-prompt-submit.py +85 -0
- package/setup/.claude/project-state.md +109 -0
- package/setup/.claude/settings.json +237 -0
- package/setup/.claude/settings.local.json +13 -0
- package/setup/.claude/skills/P5report/SKILL.md +77 -0
- package/setup/.claude/skills/Pstatus/SKILL.md +68 -0
- package/setup/.claude/skills/archive/SKILL.md +196 -0
- package/setup/.claude/skills/brainstorming/SKILL.md +155 -0
- package/setup/.claude/skills/brainstorming/scripts/frame-template.html +213 -0
- package/setup/.claude/skills/brainstorming/scripts/helper.js +167 -0
- package/setup/.claude/skills/brainstorming/scripts/server.cjs +723 -0
- package/setup/.claude/skills/brainstorming/scripts/start-server.py +245 -0
- package/setup/.claude/skills/brainstorming/scripts/stop-server.py +178 -0
- package/setup/.claude/skills/brainstorming/spec-document-reviewer-prompt.md +49 -0
- package/setup/.claude/skills/brainstorming/visual-companion.md +298 -0
- package/setup/.claude/skills/checkpoint/SKILL.md +42 -0
- package/setup/.claude/skills/chrome-integration/SKILL.md +67 -0
- package/setup/.claude/skills/code-analysis/SKILL.md +1243 -0
- package/setup/.claude/skills/code-review/SKILL.md +265 -0
- package/setup/.claude/skills/cross-review/SKILL.md +41 -0
- package/setup/.claude/skills/executing-plans/SKILL.md +64 -0
- package/setup/.claude/skills/git-prep/SKILL.md +50 -0
- package/setup/.claude/skills/gitnexus/gitnexus-cli/SKILL.md +67 -0
- package/setup/.claude/skills/gitnexus/gitnexus-debugging/SKILL.md +89 -0
- package/setup/.claude/skills/gitnexus/gitnexus-exploring/SKILL.md +78 -0
- package/setup/.claude/skills/gitnexus/gitnexus-guide/SKILL.md +66 -0
- package/setup/.claude/skills/gitnexus/gitnexus-impact-analysis/SKILL.md +97 -0
- package/setup/.claude/skills/gitnexus/gitnexus-refactoring/SKILL.md +121 -0
- package/setup/.claude/skills/graphify/SKILL.md +49 -0
- package/setup/.claude/skills/openspec-apply-change/SKILL.md +185 -0
- package/setup/.claude/skills/openspec-archive-change/SKILL.md +182 -0
- package/setup/.claude/skills/openspec-bulk-archive-change/SKILL.md +339 -0
- package/setup/.claude/skills/openspec-continue-change/SKILL.md +118 -0
- package/setup/.claude/skills/openspec-explore/SKILL.md +311 -0
- package/setup/.claude/skills/openspec-ff-change/SKILL.md +113 -0
- package/setup/.claude/skills/openspec-new-change/SKILL.md +77 -0
- package/setup/.claude/skills/openspec-onboard/SKILL.md +573 -0
- package/setup/.claude/skills/openspec-propose/SKILL.md +149 -0
- package/setup/.claude/skills/openspec-sync-specs/SKILL.md +262 -0
- package/setup/.claude/skills/openspec-update-change/SKILL.md +91 -0
- package/setup/.claude/skills/openspec-verify-change/SKILL.md +175 -0
- package/setup/.claude/skills/oss-version-check/SKILL.md +71 -0
- package/setup/.claude/skills/oss-version-check/check_oss_version.py +205 -0
- package/setup/.claude/skills/phase/SKILL.md +63 -0
- package/setup/.claude/skills/playwright/SKILL.md +86 -0
- package/setup/.claude/skills/playwright-cli/SKILL.md +420 -0
- package/setup/.claude/skills/playwright-cli/references/element-attributes.md +23 -0
- package/setup/.claude/skills/playwright-cli/references/playwright-tests.md +39 -0
- package/setup/.claude/skills/playwright-cli/references/references/element-attributes.md +23 -0
- package/setup/.claude/skills/playwright-cli/references/references/playwright-tests.md +39 -0
- package/setup/.claude/skills/playwright-cli/references/references/request-mocking.md +87 -0
- package/setup/.claude/skills/playwright-cli/references/references/running-code.md +241 -0
- package/setup/.claude/skills/playwright-cli/references/references/session-management.md +225 -0
- package/setup/.claude/skills/playwright-cli/references/references/storage-state.md +275 -0
- package/setup/.claude/skills/playwright-cli/references/references/test-generation.md +433 -0
- package/setup/.claude/skills/playwright-cli/references/references/tracing.md +139 -0
- package/setup/.claude/skills/playwright-cli/references/references/video-recording.md +143 -0
- package/setup/.claude/skills/playwright-cli/references/request-mocking.md +87 -0
- package/setup/.claude/skills/playwright-cli/references/running-code.md +241 -0
- package/setup/.claude/skills/playwright-cli/references/session-management.md +225 -0
- package/setup/.claude/skills/playwright-cli/references/storage-state.md +275 -0
- package/setup/.claude/skills/playwright-cli/references/test-generation.md +433 -0
- package/setup/.claude/skills/playwright-cli/references/tracing.md +139 -0
- package/setup/.claude/skills/playwright-cli/references/video-recording.md +143 -0
- package/setup/.claude/skills/review/SKILL.md +98 -0
- package/setup/.claude/skills/review-tools/SKILL.md +76 -0
- package/setup/.claude/skills/subagent-driven-development/SKILL.md +94 -0
- package/setup/.claude/skills/task/SKILL.md +26 -0
- package/setup/.claude/skills/test-driven-development/SKILL.md +320 -0
- package/setup/.claude/skills/test-driven-development/writing-good-tests.md +198 -0
- package/setup/.claude/skills/ui-ux-pro-max/SKILL.md +377 -0
- package/setup/.claude/skills/ui-ux-pro-max/data/charts.csv +26 -0
- package/setup/.claude/skills/ui-ux-pro-max/data/colors.csv +97 -0
- package/setup/.claude/skills/ui-ux-pro-max/data/icons.csv +101 -0
- package/setup/.claude/skills/ui-ux-pro-max/data/landing.csv +31 -0
- package/setup/.claude/skills/ui-ux-pro-max/data/products.csv +97 -0
- package/setup/.claude/skills/ui-ux-pro-max/data/react-performance.csv +45 -0
- package/setup/.claude/skills/ui-ux-pro-max/data/stacks/astro.csv +54 -0
- package/setup/.claude/skills/ui-ux-pro-max/data/stacks/flutter.csv +53 -0
- package/setup/.claude/skills/ui-ux-pro-max/data/stacks/html-tailwind.csv +56 -0
- package/setup/.claude/skills/ui-ux-pro-max/data/stacks/jetpack-compose.csv +53 -0
- package/setup/.claude/skills/ui-ux-pro-max/data/stacks/nextjs.csv +53 -0
- package/setup/.claude/skills/ui-ux-pro-max/data/stacks/nuxt-ui.csv +51 -0
- package/setup/.claude/skills/ui-ux-pro-max/data/stacks/nuxtjs.csv +59 -0
- package/setup/.claude/skills/ui-ux-pro-max/data/stacks/react-native.csv +52 -0
- package/setup/.claude/skills/ui-ux-pro-max/data/stacks/react.csv +54 -0
- package/setup/.claude/skills/ui-ux-pro-max/data/stacks/shadcn.csv +61 -0
- package/setup/.claude/skills/ui-ux-pro-max/data/stacks/svelte.csv +54 -0
- package/setup/.claude/skills/ui-ux-pro-max/data/stacks/swiftui.csv +51 -0
- package/setup/.claude/skills/ui-ux-pro-max/data/stacks/vue.csv +50 -0
- package/setup/.claude/skills/ui-ux-pro-max/data/styles.csv +68 -0
- package/setup/.claude/skills/ui-ux-pro-max/data/typography.csv +58 -0
- package/setup/.claude/skills/ui-ux-pro-max/data/ui-reasoning.csv +101 -0
- package/setup/.claude/skills/ui-ux-pro-max/data/ux-guidelines.csv +100 -0
- package/setup/.claude/skills/ui-ux-pro-max/data/web-interface.csv +31 -0
- package/setup/.claude/skills/ui-ux-pro-max/scripts/core.py +253 -0
- package/setup/.claude/skills/ui-ux-pro-max/scripts/design_system.py +1067 -0
- package/setup/.claude/skills/ui-ux-pro-max/scripts/search.py +114 -0
- package/setup/.claude/skills/ui-ux-standards/SKILL.md +154 -0
- package/setup/.claude/skills/verification-before-completion/SKILL.md +120 -0
- package/setup/.claude/skills/wiki-read/SKILL.md +190 -0
- package/setup/.claude/skills/writing-plans/SKILL.md +168 -0
- package/setup/.claude/skills/writing-plans/plan-document-reviewer-prompt.md +49 -0
- package/setup/.claude/tasks/.last-session +1 -0
- package/setup/.codex/.agents/skills/P5report/SKILL.md +77 -0
- package/setup/.codex/.agents/skills/Pstatus/SKILL.md +30 -0
- package/setup/.codex/.agents/skills/archive/SKILL.md +196 -0
- package/setup/.codex/.agents/skills/brainstorming/SKILL.md +155 -0
- package/setup/.codex/.agents/skills/brainstorming/scripts/frame-template.html +213 -0
- package/setup/.codex/.agents/skills/brainstorming/scripts/helper.js +167 -0
- package/setup/.codex/.agents/skills/brainstorming/scripts/server.cjs +723 -0
- package/setup/.codex/.agents/skills/brainstorming/scripts/start-server.py +245 -0
- package/setup/.codex/.agents/skills/brainstorming/scripts/stop-server.py +178 -0
- package/setup/.codex/.agents/skills/brainstorming/spec-document-reviewer-prompt.md +49 -0
- package/setup/.codex/.agents/skills/brainstorming/visual-companion.md +298 -0
- package/setup/.codex/.agents/skills/checkpoint/SKILL.md +42 -0
- package/setup/.codex/.agents/skills/chrome-integration/SKILL.md +67 -0
- package/setup/.codex/.agents/skills/code-analysis/SKILL.md +1243 -0
- package/setup/.codex/.agents/skills/code-review/SKILL.md +265 -0
- package/setup/.codex/.agents/skills/cross-review/SKILL.md +42 -0
- package/setup/.codex/.agents/skills/executing-plans/SKILL.md +64 -0
- package/setup/.codex/.agents/skills/git-prep/SKILL.md +50 -0
- package/setup/.codex/.agents/skills/gitnexus/gitnexus-cli/SKILL.md +67 -0
- package/setup/.codex/.agents/skills/gitnexus/gitnexus-debugging/SKILL.md +89 -0
- package/setup/.codex/.agents/skills/gitnexus/gitnexus-exploring/SKILL.md +78 -0
- package/setup/.codex/.agents/skills/gitnexus/gitnexus-guide/SKILL.md +66 -0
- package/setup/.codex/.agents/skills/gitnexus/gitnexus-impact-analysis/SKILL.md +97 -0
- package/setup/.codex/.agents/skills/gitnexus/gitnexus-refactoring/SKILL.md +121 -0
- package/setup/.codex/.agents/skills/graphify/SKILL.md +49 -0
- package/setup/.codex/.agents/skills/openspec-apply-change/SKILL.md +185 -0
- package/setup/.codex/.agents/skills/openspec-archive-change/SKILL.md +182 -0
- package/setup/.codex/.agents/skills/openspec-bulk-archive-change/SKILL.md +339 -0
- package/setup/.codex/.agents/skills/openspec-continue-change/SKILL.md +118 -0
- package/setup/.codex/.agents/skills/openspec-explore/SKILL.md +311 -0
- package/setup/.codex/.agents/skills/openspec-ff-change/SKILL.md +113 -0
- package/setup/.codex/.agents/skills/openspec-new-change/SKILL.md +77 -0
- package/setup/.codex/.agents/skills/openspec-onboard/SKILL.md +573 -0
- package/setup/.codex/.agents/skills/openspec-propose/SKILL.md +149 -0
- package/setup/.codex/.agents/skills/openspec-sync-specs/SKILL.md +262 -0
- package/setup/.codex/.agents/skills/openspec-update-change/SKILL.md +91 -0
- package/setup/.codex/.agents/skills/openspec-verify-change/SKILL.md +175 -0
- package/setup/.codex/.agents/skills/oss-version-check/SKILL.md +71 -0
- package/setup/.codex/.agents/skills/oss-version-check/check_oss_version.py +205 -0
- package/setup/.codex/.agents/skills/phase/SKILL.md +63 -0
- package/setup/.codex/.agents/skills/playwright/SKILL.md +86 -0
- package/setup/.codex/.agents/skills/playwright-cli/SKILL.md +420 -0
- package/setup/.codex/.agents/skills/playwright-cli/references/element-attributes.md +23 -0
- package/setup/.codex/.agents/skills/playwright-cli/references/playwright-tests.md +39 -0
- package/setup/.codex/.agents/skills/playwright-cli/references/references/element-attributes.md +23 -0
- package/setup/.codex/.agents/skills/playwright-cli/references/references/playwright-tests.md +39 -0
- package/setup/.codex/.agents/skills/playwright-cli/references/references/request-mocking.md +87 -0
- package/setup/.codex/.agents/skills/playwright-cli/references/references/running-code.md +241 -0
- package/setup/.codex/.agents/skills/playwright-cli/references/references/session-management.md +225 -0
- package/setup/.codex/.agents/skills/playwright-cli/references/references/storage-state.md +275 -0
- package/setup/.codex/.agents/skills/playwright-cli/references/references/test-generation.md +433 -0
- package/setup/.codex/.agents/skills/playwright-cli/references/references/tracing.md +139 -0
- package/setup/.codex/.agents/skills/playwright-cli/references/references/video-recording.md +143 -0
- package/setup/.codex/.agents/skills/playwright-cli/references/request-mocking.md +87 -0
- package/setup/.codex/.agents/skills/playwright-cli/references/running-code.md +241 -0
- package/setup/.codex/.agents/skills/playwright-cli/references/session-management.md +225 -0
- package/setup/.codex/.agents/skills/playwright-cli/references/storage-state.md +275 -0
- package/setup/.codex/.agents/skills/playwright-cli/references/test-generation.md +433 -0
- package/setup/.codex/.agents/skills/playwright-cli/references/tracing.md +139 -0
- package/setup/.codex/.agents/skills/playwright-cli/references/video-recording.md +143 -0
- package/setup/.codex/.agents/skills/review/SKILL.md +98 -0
- package/setup/.codex/.agents/skills/review-tools/SKILL.md +76 -0
- package/setup/.codex/.agents/skills/subagent-driven-development/SKILL.md +94 -0
- package/setup/.codex/.agents/skills/task/SKILL.md +27 -0
- package/setup/.codex/.agents/skills/test-driven-development/SKILL.md +320 -0
- package/setup/.codex/.agents/skills/test-driven-development/writing-good-tests.md +198 -0
- package/setup/.codex/.agents/skills/ui-ux-pro-max/SKILL.md +377 -0
- package/setup/.codex/.agents/skills/ui-ux-pro-max/data/charts.csv +26 -0
- package/setup/.codex/.agents/skills/ui-ux-pro-max/data/colors.csv +97 -0
- package/setup/.codex/.agents/skills/ui-ux-pro-max/data/icons.csv +101 -0
- package/setup/.codex/.agents/skills/ui-ux-pro-max/data/landing.csv +31 -0
- package/setup/.codex/.agents/skills/ui-ux-pro-max/data/products.csv +97 -0
- package/setup/.codex/.agents/skills/ui-ux-pro-max/data/react-performance.csv +45 -0
- package/setup/.codex/.agents/skills/ui-ux-pro-max/data/stacks/astro.csv +54 -0
- package/setup/.codex/.agents/skills/ui-ux-pro-max/data/stacks/flutter.csv +53 -0
- package/setup/.codex/.agents/skills/ui-ux-pro-max/data/stacks/html-tailwind.csv +56 -0
- package/setup/.codex/.agents/skills/ui-ux-pro-max/data/stacks/jetpack-compose.csv +53 -0
- package/setup/.codex/.agents/skills/ui-ux-pro-max/data/stacks/nextjs.csv +53 -0
- package/setup/.codex/.agents/skills/ui-ux-pro-max/data/stacks/nuxt-ui.csv +51 -0
- package/setup/.codex/.agents/skills/ui-ux-pro-max/data/stacks/nuxtjs.csv +59 -0
- package/setup/.codex/.agents/skills/ui-ux-pro-max/data/stacks/react-native.csv +52 -0
- package/setup/.codex/.agents/skills/ui-ux-pro-max/data/stacks/react.csv +54 -0
- package/setup/.codex/.agents/skills/ui-ux-pro-max/data/stacks/shadcn.csv +61 -0
- package/setup/.codex/.agents/skills/ui-ux-pro-max/data/stacks/svelte.csv +54 -0
- package/setup/.codex/.agents/skills/ui-ux-pro-max/data/stacks/swiftui.csv +51 -0
- package/setup/.codex/.agents/skills/ui-ux-pro-max/data/stacks/vue.csv +50 -0
- package/setup/.codex/.agents/skills/ui-ux-pro-max/data/styles.csv +68 -0
- package/setup/.codex/.agents/skills/ui-ux-pro-max/data/typography.csv +58 -0
- package/setup/.codex/.agents/skills/ui-ux-pro-max/data/ui-reasoning.csv +101 -0
- package/setup/.codex/.agents/skills/ui-ux-pro-max/data/ux-guidelines.csv +100 -0
- package/setup/.codex/.agents/skills/ui-ux-pro-max/data/web-interface.csv +31 -0
- package/setup/.codex/.agents/skills/ui-ux-pro-max/scripts/core.py +253 -0
- package/setup/.codex/.agents/skills/ui-ux-pro-max/scripts/design_system.py +1067 -0
- package/setup/.codex/.agents/skills/ui-ux-pro-max/scripts/search.py +114 -0
- package/setup/.codex/.agents/skills/ui-ux-standards/SKILL.md +154 -0
- package/setup/.codex/.agents/skills/verification-before-completion/SKILL.md +120 -0
- package/setup/.codex/.agents/skills/wiki-read/SKILL.md +190 -0
- package/setup/.codex/.agents/skills/writing-plans/SKILL.md +168 -0
- package/setup/.codex/.agents/skills/writing-plans/plan-document-reviewer-prompt.md +49 -0
- package/setup/.codex/config.toml +10 -0
- package/setup/.codex/hooks/log_session.py +92 -0
- package/setup/.codex/hooks/review-runner.py +851 -0
- package/setup/.codex/hooks/sdlc-codex-hook.cjs +1039 -0
- package/setup/.codex/hooks/setup-keys.py +287 -0
- package/setup/.codex/hooks.json +121 -0
- package/setup/.codex/model-catalog.json +154 -0
- package/setup/.codex/project-state.md +103 -0
- package/setup/AGENTS.md +722 -0
- package/setup/CLAUDE.md +717 -0
- package/setup/install.sh +24 -0
- package/setup/tests/test_decision_timeout.py +241 -0
- package/setup/tests/test_hook_guards.py +357 -0
- package/setup/tests/test_sdlc_bootstrap.py +167 -0
- package/setup/tests/test_task_manager.py +148 -0
package/setup/CLAUDE.md
ADDED
|
@@ -0,0 +1,717 @@
|
|
|
1
|
+
# SDLC Development Standard (SDLC Development Standard)
|
|
2
|
+
|
|
3
|
+
> Available commands: `/phase`, `/P0`, `/P1`, `/P2`, `/P3`, `/P4`, `/P5`, `/Pstatus`, `/checkpoint`, `/review`, `/archive`, `/wiki-read`, `/code-review`, `/P5report`
|
|
4
|
+
|
|
5
|
+
@.claude/project-state.md
|
|
6
|
+
|
|
7
|
+
## Framework Maintenance Rule (2026-08-19)
|
|
8
|
+
|
|
9
|
+
- `flowcraft/` is the distribution package; install source is `flowcraft/setup/` (install.sh copies from setup to project root).
|
|
10
|
+
- After modifying framework files (`.codex/hooks.json`, `.codex/hooks/*.cjs`, `.agents/skills` / `.claude/skills` skills, AGENTS.md / CLAUDE.md), MUST sync to `flowcraft/setup/` (and `sdlc-skills` mirrors) to take effect on next install.
|
|
11
|
+
|
|
12
|
+
## FlowCraft Configuration (flowcraft.yaml)
|
|
13
|
+
|
|
14
|
+
Stage behavior is controlled by `flowcraft.yaml` in the project root:
|
|
15
|
+
|
|
16
|
+
```yaml
|
|
17
|
+
stages:
|
|
18
|
+
P1: auto # true=always, false=skip, auto=AI decides
|
|
19
|
+
P2: true # always enabled
|
|
20
|
+
P3: auto
|
|
21
|
+
P4: true # always enabled
|
|
22
|
+
P5: auto
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
**Auto mode complexity rules:**
|
|
26
|
+
- **Low complexity** (bug fix, config change, rename, ≤2 files): skip P1/P3/P5
|
|
27
|
+
- **Medium complexity** (new feature, refactor, 3-10 files): full P1-P5
|
|
28
|
+
- **High complexity** (new system, cross-module, new dependencies): deep P1 + full P3 + dual P4
|
|
29
|
+
|
|
30
|
+
**Complexity assessment** happens at P0 start, written to `project-state.md` → `complexity_level`.
|
|
31
|
+
|
|
32
|
+
**Safety overrides:**
|
|
33
|
+
- First task on new project → always full P1-P5
|
|
34
|
+
- Security-related changes (auth/crypto) → P1/P3 never skipped
|
|
35
|
+
- `/phase P1` forces into any skipped phase
|
|
36
|
+
- `/phase full` forces complete flow
|
|
37
|
+
|
|
38
|
+
## 多任务(Multi-task)
|
|
39
|
+
|
|
40
|
+
- 任务绑定全自动,用户零配置。解析优先级:`FLOWCRAFT_TASK_ID` > session 绑定(`.claude/tasks/.bindings.json`)> 目录默认(`.claude/tasks/{目录名}.md`)> `project-state.md` 单任务回退
|
|
41
|
+
- 用户入口只有触发词:**新任务 / 切换任务 / 任务列表 / 归档任务** → AI 执行 `task_manager.py create|use|list|archive`(见 `task` skill),禁止让用户手敲 python 命令
|
|
42
|
+
- 并行任务 = 多工作根(git worktree / 多目录)+ 各自 `cd && claude`;同目录多会话按 session_id 自动隔离
|
|
43
|
+
- `dispatch.py` 将钩子载荷的 session_id 注入 `FLOWCRAFT_SESSION_ID`;无 `tasks/` 的单任务项目行为不变
|
|
44
|
+
|
|
45
|
+
## Startup Instructions (Mandatory)
|
|
46
|
+
|
|
47
|
+
**At the start of every conversation the following steps MUST be executed; do not skip:**
|
|
48
|
+
|
|
49
|
+
1. **Read `.claude/project-state.md`** to get `current_phase`
|
|
50
|
+
2. **Identify the request type**:
|
|
51
|
+
- "implement / fix / refactor / what changes / add / modify" → **modification task**
|
|
52
|
+
- "analyze / explain / view / why / how" → **consultation task**
|
|
53
|
+
3. **Automatic phase transition** (modification task + P0 state):
|
|
54
|
+
- When `current_phase = P0` and the request is a modification task → **auto-execute `/P1`**
|
|
55
|
+
- After entering P1, perform requirement clarification and technical analysis
|
|
56
|
+
4. **Phase state handling**:
|
|
57
|
+
- P1-P5: report status and continue
|
|
58
|
+
- P0 + consultation task: answer the question, do NOT enter P1
|
|
59
|
+
- P0.5: report the issue and wait for user decision
|
|
60
|
+
|
|
61
|
+
**Consequence of violation**: modifying code directly in P0 = SDLC violation; code must be rolled back and the flow redone.
|
|
62
|
+
|
|
63
|
+
## Skill Trigger Rules
|
|
64
|
+
|
|
65
|
+
### Automatic phase triggers
|
|
66
|
+
|
|
67
|
+
| Phase | Trigger | Skill | Description |
|
|
68
|
+
|-------|---------|-------|-------------|
|
|
69
|
+
| P0+modification task | auto | `/P1` | enter requirements phase |
|
|
70
|
+
| P1 | at start | `brainstorming` | brainstorm requirements & design |
|
|
71
|
+
| P1 | method B selected | `openspec-explore` / `openspec-propose` | spec-driven requirement clarification |
|
|
72
|
+
| P2 | method B selected | `openspec-apply-change` | implement per tasks |
|
|
73
|
+
| P3/P4 | method B selected | `openspec-verify-change` | verify implementation vs specs |
|
|
74
|
+
| P5 | method B selected | `openspec-archive-change` | archive change |
|
|
75
|
+
| P1 | at start | `/wiki-read` | mandatory prerequisite |
|
|
76
|
+
| P1 | at start | `/gitnexus-cli` | check index status (GitNexus preferred; graphify disabled) |
|
|
77
|
+
| P2 | at start | `subagent-driven-development` | parallel task development |
|
|
78
|
+
| P2 | on completion | `/code-review` | AI code review |
|
|
79
|
+
| P4 | at start | `/review` | comprehensive review |
|
|
80
|
+
| P5 | in progress | `/P5report` | generate report |
|
|
81
|
+
| P5 | in progress | `/archive` | archive task |
|
|
82
|
+
| P5 | in progress | `code-analysis update` | update Wiki |
|
|
83
|
+
|
|
84
|
+
### On-demand triggers
|
|
85
|
+
|
|
86
|
+
| Scenario | Skill | Command |
|
|
87
|
+
|----------|-------|---------|
|
|
88
|
+
| Debug issue | gitnexus-debugging | `/gitnexus-debugging` |
|
|
89
|
+
| Explore code | gitnexus-exploring | `/gitnexus-exploring` |
|
|
90
|
+
| Impact analysis | gitnexus-impact-analysis | `/gitnexus-impact-analysis` |
|
|
91
|
+
| Refactor code | gitnexus-refactoring | `/gitnexus-refactoring` |
|
|
92
|
+
| GitNexus guidance | gitnexus-guide | `/gitnexus-guide` |
|
|
93
|
+
| UI/UX design | ui-ux-pro-max | `/ui-ux-pro-max` |
|
|
94
|
+
| End-to-end test | playwright | `/playwright` |
|
|
95
|
+
| Prototype demo | chrome-integration | - |
|
|
96
|
+
| Code review | code-review | `/code-review` |
|
|
97
|
+
| View status | Pstatus | `/Pstatus` |
|
|
98
|
+
| Save snapshot | checkpoint | `/checkpoint` |
|
|
99
|
+
| Clean & archive | archive | `/archive` |
|
|
100
|
+
| Branch preparation | git-prep | `/git-prep` |
|
|
101
|
+
| Version verification | oss-version-check | `/oss-version-check` |
|
|
102
|
+
|
|
103
|
+
## Output Format Standard
|
|
104
|
+
|
|
105
|
+
### Phase status display (at the start of every reply)
|
|
106
|
+
|
|
107
|
+
```
|
|
108
|
+
┌─────────────────────────────────────────────────────────────────┐
|
|
109
|
+
│ SDLC │ P2 编码实现 │ ████████░░░░ 60% │ 当前任务: 实现登录功能 │
|
|
110
|
+
└─────────────────────────────────────────────────────────────────┘
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
**Format notes**:
|
|
114
|
+
- Fixed-width border, content centered
|
|
115
|
+
- Phase names: P0 Standby / P1 Requirements & Design / P2 Coding / P3 Testing / P4 Review / P5 Delivery
|
|
116
|
+
- Progress bar: `█` done / `░` pending, total length 12 characters
|
|
117
|
+
- Task description: read from `task_description`, truncate beyond 20 chars
|
|
118
|
+
- **No background colors**: do not use ANSI background color codes (e.g. \033[40-47m, \033[100-107m); border characters themselves are fine
|
|
119
|
+
|
|
120
|
+
**Progress calculation**:
|
|
121
|
+
- P0: 0%
|
|
122
|
+
- P1: completed decision points × 20% (max 5 decision points)
|
|
123
|
+
- P2: coding done 50% + review passed 100%
|
|
124
|
+
- P3: tests passed 100%
|
|
125
|
+
- P4: review passed 100%
|
|
126
|
+
- P5: report generated 50% + archived 100%
|
|
127
|
+
|
|
128
|
+
## Core Rules
|
|
129
|
+
|
|
130
|
+
- **Develop strictly per PRD**: every line of code must map to a PRD requirement. If you cannot answer which requirement it maps to, do not write it. Adding or removing anything outside the PRD is forbidden.
|
|
131
|
+
- **Execute the six phases in order**: P1 requirements+design → P2 coding → P3 testing → P4 review → P5 delivery. P0.5 (problem rollback) triggers on demand.
|
|
132
|
+
- **Review only once**: P4 is the only formal review gate (code + tests + integration + PRD traceability). P1 advances on user confirmation; P2/P3/P4/P5 advance directly upon completion.
|
|
133
|
+
**P4 cross-model review (dual-run merge)**: current model + user-selected model each review once, merged (skip if same). Codex uses codex CLI, Claude uses claude CLI (no cross-contamination). Model list in model-catalog.json, keys per directory api-keys.json (scripts: .codex/hooks/review-runner.py / ~/.flowcraft/hooks/review-runner.py, auto-discovered by setup-keys.py). When user selects an unconfigured model, confirm base_url / context / key / model first, write to api-keys.json, then run.
|
|
134
|
+
- **Auto-driven**: after the user confirms the PRD in P1, P2-P5 run fully automatically. Once P4 review passes, advance directly to P5 without user confirmation. If P4 fails, auto-fix (up to 3 times).
|
|
135
|
+
- **One question at a time**: each decision point must be asked separately; combining multiple decision points into one message is forbidden.
|
|
136
|
+
- **Automatic task identification**: "implement / fix / refactor / what changes / add / modify" → **modification task** → automatically enter P1. "analyze / explain / view / why / how" → **consultation task** → answer directly in P0, do not enter P1. After an old task completes, a new request → archive to `completed_tasks` + reset task fields + new P1. **`project_roadmap` / `completed_tasks` / `global_architecture` are never reset**
|
|
137
|
+
- **Problem rollback**: when an issue is found in completed functionality → enter P0.5, do not modify code casually
|
|
138
|
+
- **Version selection must be user-confirmed**: when adding new dependencies/components, the P1 phase must first run `/oss-version-check` to verify the real latest stable version and known vulnerabilities (Maven Central / GitHub Releases / OSV), then provide version suggestions (current stable / latest / LTS) with a version verification table, and **wait for user confirmation before use**. Choosing a version on your own is forbidden. If the network is unavailable, mark the suggestion as "unverified" and re-verify after the network recovers.
|
|
139
|
+
|
|
140
|
+
## Wiki Cross-Validation Rules (Mandatory)
|
|
141
|
+
|
|
142
|
+
Every SDLC phase must perform Wiki cross-validation to ensure docs and code stay consistent:
|
|
143
|
+
|
|
144
|
+
| Phase | Wiki validation action | What to do |
|
|
145
|
+
|-------|------------------------|------------|
|
|
146
|
+
| **P1 requirements clarification** | Read Wiki | Read `wiki/main`, `wiki/{module}/` docs; verify the requirement understanding matches existing docs |
|
|
147
|
+
| **P2 coding** | Wiki validation | When analyzing code, compare against Wiki architecture/process docs; verify implementation matches design |
|
|
148
|
+
| **P5 delivery & archive** | Update Wiki | Run `code-analysis update` for incremental Wiki updates |
|
|
149
|
+
|
|
150
|
+
### Wiki directory detection
|
|
151
|
+
|
|
152
|
+
```
|
|
153
|
+
1. Check whether a `wiki/` directory exists at the project root
|
|
154
|
+
2. If it exists → Wiki path is `wiki/`
|
|
155
|
+
3. If not → Wiki path is `docs/wiki/`
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
### Per-phase Wiki operations
|
|
159
|
+
|
|
160
|
+
**P1 requirement clarification phase**:
|
|
161
|
+
- Read the relevant module Wiki docs (architecture, process, requirements)
|
|
162
|
+
- Cross-check against the user requirements
|
|
163
|
+
- Raise confirmation when inconsistencies are found
|
|
164
|
+
|
|
165
|
+
**P2 coding phase**:
|
|
166
|
+
- Code against the design docs in Wiki
|
|
167
|
+
- Flag issues when Wiki and code disagree
|
|
168
|
+
- Propose doc updates when necessary
|
|
169
|
+
|
|
170
|
+
**P5 delivery & archive phase**:
|
|
171
|
+
- Run `code-analysis update {module}` to update Wiki
|
|
172
|
+
- Ensure code changes are synced to Wiki docs
|
|
173
|
+
- Complete archiving
|
|
174
|
+
|
|
175
|
+
## P2 Coding Phase
|
|
176
|
+
|
|
177
|
+
**P2 execution flow (mandatory)**: Code index check (GitNexus preferred; graphify disabled) → /git-prep branch preparation (public-branch guard + branch naming + fetch/pull) → ask development method → ask whether to enable subagent-driven-development → code / AI review → handle issues → P3
|
|
178
|
+
|
|
179
|
+
### Change log template
|
|
180
|
+
|
|
181
|
+
Every completed task MUST print a change description:
|
|
182
|
+
```
|
|
183
|
+
[实现记录 / Change Log]
|
|
184
|
+
- 任务 / Task: xxx
|
|
185
|
+
- 修改内容 / Change: added/modified xxx
|
|
186
|
+
- 修改位置 / Location: xxx.java:line
|
|
187
|
+
- 影响 / Impact: may cause xxx to change
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
### Coding process constraints
|
|
191
|
+
|
|
192
|
+
1. **Pause and clarify immediately when a problem is found**
|
|
193
|
+
- If the plan cannot be implemented → print the problem description → wait for user confirmation
|
|
194
|
+
- If a requirement gap is found → print the defect description → wait for user confirmation
|
|
195
|
+
- Continuing to code without user permission is forbidden
|
|
196
|
+
|
|
197
|
+
2. **Dependency/version issues must be clarified**
|
|
198
|
+
- If dependency versions do not match the code → print the version conflict → wait for user confirmation
|
|
199
|
+
- If new/upgraded dependencies are needed → print the dependency change → wait for user confirmation
|
|
200
|
+
- If environment differences exist (e.g. JDK version) → print the environment difference → wait for user confirmation
|
|
201
|
+
- **Never change pom.xml version numbers or dependency versions on your own**
|
|
202
|
+
|
|
203
|
+
### Code graph usage
|
|
204
|
+
- **GitNexus (preferred)**: must use when indexed (impact/query/context/rename/detect_changes); see GitNexus section
|
|
205
|
+
- **graphify (disabled)**: only enable when user explicitly requests; skip when not indexed
|
|
206
|
+
|
|
207
|
+
### Development method selection
|
|
208
|
+
|
|
209
|
+
**dev_method (agent mode)**: sub-agent driven approach (already determined in P1)
|
|
210
|
+
|
|
211
|
+
**code_method (coding method)**: ask the user to choose
|
|
212
|
+
1. **TDD** — write test cases first, then implementation
|
|
213
|
+
2. **Normal coding** — implement directly, compile+test all tasks together at the end
|
|
214
|
+
|
|
215
|
+
> Normal coding special rule: complete all tasks → compile/verify → go directly to P4 review (skip P3 testing)
|
|
216
|
+
|
|
217
|
+
### P2 completion self-review (mandatory)
|
|
218
|
+
Before declaring a coding task complete (and before AI code review), answer three questions honestly and emit `[P2-COMPLETION]`:
|
|
219
|
+
1. **Correctness (正确性)** — does the change actually solve the problem? Any typos, missing imports, wrong paths, off-by-one errors?
|
|
220
|
+
2. **Side effects (副作用)** — does it break callers/tests? Have you traced every caller of every function you modified?
|
|
221
|
+
3. **Closure (收尾)** — have you met every PRD acceptance criterion? What is still not done?
|
|
222
|
+
If any answer is "not sure", go back and verify — never declare completion without the self-review.
|
|
223
|
+
Completion marker:
|
|
224
|
+
```
|
|
225
|
+
[P2-COMPLETION]
|
|
226
|
+
## What I changed
|
|
227
|
+
- <file> — <one-line description>
|
|
228
|
+
## Impact analysis
|
|
229
|
+
- Affected callers: <list or none>
|
|
230
|
+
- Verification: <tests/commands run>
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
### AI code review (auto-triggered after P2)
|
|
234
|
+
|
|
235
|
+
1. **Trigger time**: P2 phase completed → before transitioning to P3
|
|
236
|
+
2. **Read files**: read the `modified_files` list from `project-state.md`
|
|
237
|
+
3. **Perform review**: review each file for AI code quality (based on the Alibaba Java Development Manual)
|
|
238
|
+
4. **Issue handling**:
|
|
239
|
+
- No issues: **auto-advance to P3 without user confirmation**
|
|
240
|
+
- Issues found: **must first list the complete issue list** (file, line, description, severity), **wait for client confirmation before fixing**
|
|
241
|
+
- After the client confirms the fix method:
|
|
242
|
+
- A. AI-generated: AI generates the fix, user confirms, back to P2
|
|
243
|
+
- B. User-directed: user tells the fix approach, AI executes, back to P2
|
|
244
|
+
- C. Ignore: record the exemption, enter P3
|
|
245
|
+
- **Hard constraint**: forbidden to modify code before listing the issue list or obtaining client confirmation
|
|
246
|
+
- **Retry limit**: same issue max 5 fixes; after that must stop and ask the user to intervene (prevent infinite loops)
|
|
247
|
+
5. **Save report**: review report saved to `.claude/code-review-report.md`
|
|
248
|
+
|
|
249
|
+
**Manual invocation**: user can run `/code-review` at any time
|
|
250
|
+
## P0.5 Problem Rollback (on demand)
|
|
251
|
+
|
|
252
|
+
Receive issue report → record symptom → root-cause analysis (requirement ambiguity / design flaw / implementation bug) → A/B/C decision → wait for user choice, then execute:
|
|
253
|
+
- **A** Optimize on original approach → P1 (approach has direction but has flaws)
|
|
254
|
+
- **B** Redo requirements → P1 (requirements themselves are problematic)
|
|
255
|
+
- **C** Fix code directly (not recommended, only when error is clear and does not affect approach)
|
|
256
|
+
|
|
257
|
+
After execution → update `phase_history` → `current_phase` returns to P0
|
|
258
|
+
|
|
259
|
+
## P1 Requirements Clarification + Research + Design + Prototype
|
|
260
|
+
|
|
261
|
+
**P1 execution flow**: Wiki read → Code index check (GitNexus preferred; graphify disabled) → requirement method selection (A: brainstorming default / B: openspec) → A: brainstorming → PRD → Plan | B: openspec-explore → openspec-propose (proposal/specs/design/tasks) → confirm → P2
|
|
262
|
+
|
|
263
|
+
**brainstorming output**:
|
|
264
|
+
- Design doc: brainstorming writes to `docs/superpowers/specs/YYYY-MM-DD-<topic>-design.md`
|
|
265
|
+
- After user confirmation → copy to `wiki/{module}/05-plan/{task-name}.md` → enter PRD
|
|
266
|
+
|
|
267
|
+
### 0. Wiki read + Code index + Plan (mandatory prerequisites)
|
|
268
|
+
|
|
269
|
+
1. `/wiki-read` (auto, cannot be skipped) → no other action allowed until completed
|
|
270
|
+
2. GitNexus index check (indexed → assist analysis; not indexed → prompt user to run `npx gitnexus analyze` or `/gitnexus-cli`)
|
|
271
|
+
3. Create Plan file: wiki exists → `wiki/{module}/05-plan/{task-name}.md`, otherwise → `plan/{task-name}.md` (with goal/interface/implementation/steps/risks)
|
|
272
|
+
|
|
273
|
+
> Plan not created → forbidden to enter requirement clarification
|
|
274
|
+
|
|
275
|
+
### 1.0 Requirement method selection (mandatory)
|
|
276
|
+
At P1 start, ask the user to choose the requirement clarification method:
|
|
277
|
+
- **A. brainstorming (default)**: existing flow → PRD → Plan; P2-P5 use existing review/archive
|
|
278
|
+
- **B. openspec**: openspec-explore → openspec-propose; P2 = openspec-apply-change, P3/P4 = openspec-verify-change, P5 = openspec-archive-change
|
|
279
|
+
|
|
280
|
+
### 1. brainstorming requirement clarification
|
|
281
|
+
Use the brainstorming skill to systematically clarify requirements; output the requirement list and design doc.
|
|
282
|
+
|
|
283
|
+
**【Decision Point 1: requirement confirmation】**
|
|
284
|
+
|
|
285
|
+
### 2. Technical research + tech stack confirmation
|
|
286
|
+
First ask technical preference; research with Context7 MCP + WebSearch; UI must use ui-ux-pro-max (67 styles + 96 palettes + 57 fonts). **【Decision Point 2: tech stack confirmation】**
|
|
287
|
+
|
|
288
|
+
### 3. Write PRD and confirm
|
|
289
|
+
Write a lean PRD (≤150 lines) to `.claude/prd.md`, record `prd_file`, delete `requirements_clarification`, lock it. **【Decision Point 3: PRD confirmation】**
|
|
290
|
+
|
|
291
|
+
### 4. Architecture design + approach comparison
|
|
292
|
+
Provide 2-3 approaches (with modules/data/API/deployment/pros-cons/scenarios); after the user picks, write to `architecture_decisions`. **【Decision Point 4: architecture confirmation】**
|
|
293
|
+
|
|
294
|
+
### 5. Prototype design + design confirmation (UI projects)
|
|
295
|
+
Apply the design system, show responsive design in Chrome (375/768/1440px), write to `ui_design`; Bootstrap 3/4 and jQuery UI are forbidden. **【Decision Point 5: design confirmation】**
|
|
296
|
+
|
|
297
|
+
**5 decision points confirmed → P2 auto-driven**
|
|
298
|
+
|
|
299
|
+
## P3 Interface List Check (optional)
|
|
300
|
+
|
|
301
|
+
Only for tasks with external HTTP calls (API development); TDD / pure utilities skip by default.
|
|
302
|
+
Flow: ask user if needed → scan HTTP/HTTPS calls in `modified_files` → choose format (CURL/table/JSON) → generate `.claude/external-urls.md` → user confirm → P4
|
|
303
|
+
|
|
304
|
+
## P5 Delivery Phase
|
|
305
|
+
|
|
306
|
+
**P5 execution flow**: GitNexus update → wiki update → generate report → delivery confirmation → archive
|
|
307
|
+
|
|
308
|
+
### 1. GitNexus update
|
|
309
|
+
- Indexed: run `npx gitnexus analyze` to update the knowledge graph
|
|
310
|
+
- Not indexed: prompt user to configure index; if user declines, record skip reason
|
|
311
|
+
|
|
312
|
+
### 2. wiki update
|
|
313
|
+
- Wiki directory exists: run `/code-analysis update {module}` to update docs
|
|
314
|
+
- Wiki directory does not exist: skip
|
|
315
|
+
|
|
316
|
+
### 3. Generate report
|
|
317
|
+
Auto-run `/P5report` to generate the task summary report.
|
|
318
|
+
|
|
319
|
+
### 4. Delivery confirmation
|
|
320
|
+
Show the user the deliverable list and report summary; confirm completion.
|
|
321
|
+
|
|
322
|
+
### 5. Archive
|
|
323
|
+
After confirmation, archive the task to `completed_tasks`, clear `phase_history`, and return to P0.
|
|
324
|
+
|
|
325
|
+
### P5 Delivery Outputs
|
|
326
|
+
|
|
327
|
+
Deliverables: requirements design (`plan/{task}-需求.md`) + approach (`plan/{task}-方案.md`) + code commit + test report + review report + work analysis report (change stats / issue list / exception waivers) + session_log
|
|
328
|
+
|
|
329
|
+
> Work analysis report auto-generated by `/P5report`, includes requirements / coding / stats / issues / waivers / delivery 6 sections
|
|
330
|
+
|
|
331
|
+
## Phase Checkpoints
|
|
332
|
+
|
|
333
|
+
**Purpose**: ensure no mandatory action of any phase is skipped
|
|
334
|
+
|
|
335
|
+
| Phase | Checkpoint | Verification | Skippable |
|
|
336
|
+
|-------|------------|--------------|-----------|
|
|
337
|
+
| P1 | wiki_read | must read Wiki and record consistency conclusion with code | no |
|
|
338
|
+
| P1 | requirements_clarified | `requirements_clarification` filled | no |
|
|
339
|
+
| P1 | plan_created | plan file created (wiki→`wiki/{module}/05-plan/{Chinese-task-name}.md`, no→`plan/{Chinese-task-name}.md`) | no |
|
|
340
|
+
| P1 | requirement_method_selected | `requirement_method` recorded(A brainstorming / B openspec)| no |
|
|
341
|
+
| P2 | prd_confirmed | `prd_file` set | no |
|
|
342
|
+
| P2 | architecture_decided | `architecture_decisions` filled | no |
|
|
343
|
+
| P2 | dev_method_selected | `dev_method` set with a valid value | no |
|
|
344
|
+
| P2 | code_method_selected | `code_method` set (TDD/Normal) | no |
|
|
345
|
+
| P3 | test_executed | test results recorded | no |
|
|
346
|
+
| P4 | code_review_passed | `review_retry_count <= 3` | no |
|
|
347
|
+
| P5 | wiki_updated | `code-analysis update` executed | no |
|
|
348
|
+
| P5 | report_generated | report file exists under `.claude/reports/` | no |
|
|
349
|
+
|
|
350
|
+
**Phase transition rules**:
|
|
351
|
+
- P0 → P1: all P1 mandatory checkpoints must be complete
|
|
352
|
+
- P1 → P2: all P1 mandatory checkpoints + `plan_file` set + `prd_file` set
|
|
353
|
+
- P2 → P3: all P2 mandatory checkpoints
|
|
354
|
+
- P3 → P4: all P3 mandatory checkpoints
|
|
355
|
+
- P4 → P5: all P4 mandatory checkpoints
|
|
356
|
+
- **Phases cannot advance until checkpoints are complete**
|
|
357
|
+
|
|
358
|
+
## Self-check (mandatory)
|
|
359
|
+
|
|
360
|
+
**At conversation start**: read `project-state.md` → identify task type → P0 + modification task auto-enters P1
|
|
361
|
+
|
|
362
|
+
**Before every reply**: log reply with `python ~/.flowcraft/hooks/log_session.py assistant`
|
|
363
|
+
|
|
364
|
+
**On issue report**: read phase → check P0.5 trigger → if triggered, wait for user A/B/C (no code changes until chosen) → C requires double confirmation
|
|
365
|
+
|
|
366
|
+
**Hard constraint**: changing code before user chooses = SDLC violation, must rollback. When in doubt, read `project-state.md`; do not rely on memory.
|
|
367
|
+
|
|
368
|
+
## Execution Standards
|
|
369
|
+
|
|
370
|
+
**Bash format**: all commands must be single-line. No line breaks before `2>&1`, `|`, `&&`.
|
|
371
|
+
**Test efficiency**: run only once (`tee /tmp/sdlc-test-output.txt`), Read to analyze results, batch-fix, then run once more. Max 3 runs.
|
|
372
|
+
**Process restart**: Java/Node processes must be killed with `kill -9`, not just `pkill`. Steps: `ps aux` to find PID → `kill -9 PID` → start the new process.
|
|
373
|
+
**Lean output**: reports/PRDs/docs use concise formats:
|
|
374
|
+
- One-sentence principle: use one sentence rather than two
|
|
375
|
+
- Tables preferred: structured info in tables
|
|
376
|
+
- Length limits: PRD≤150 lines, review≤15 lines, delivery≤10 lines
|
|
377
|
+
- Lean memory: `completed_tasks` in lean format; auto-archive when ≥5
|
|
378
|
+
|
|
379
|
+
**phase_history rules**:
|
|
380
|
+
- Only record the current task's `phase_history`; after task completion archive to `completed_tasks` and clear it
|
|
381
|
+
- Time format: seconds (e.g. "2026-05-11 18:58:05")
|
|
382
|
+
- Update `phase_history` immediately on phase transitions
|
|
383
|
+
|
|
384
|
+
## Display Format Standard
|
|
385
|
+
|
|
386
|
+
### Forbidden Formats
|
|
387
|
+
- **Markdown tables forbidden** (borderless, not intuitive)
|
|
388
|
+
- **ASCII-art tables forbidden** (not pretty)
|
|
389
|
+
|
|
390
|
+
### Approach comparison format
|
|
391
|
+
Use **bold headings + lists**:
|
|
392
|
+
|
|
393
|
+
**Approach A: name**
|
|
394
|
+
- Description: concrete description
|
|
395
|
+
- Pros: pro1, pro2
|
|
396
|
+
- Cons: con1, con2
|
|
397
|
+
|
|
398
|
+
**Approach B: name**
|
|
399
|
+
- Description: concrete description
|
|
400
|
+
- Pros: pro1, pro2
|
|
401
|
+
- Cons: con1, con2
|
|
402
|
+
|
|
403
|
+
### Issue list format
|
|
404
|
+
Use **bold headings + lists** for each issue:
|
|
405
|
+
|
|
406
|
+
**Issue 1: file line X**
|
|
407
|
+
- Issue: description
|
|
408
|
+
- Severity: blocker / serious / suggestion
|
|
409
|
+
|
|
410
|
+
**Issue 2: file line X**
|
|
411
|
+
- Issue: description
|
|
412
|
+
- Severity: blocker / serious / suggestion
|
|
413
|
+
|
|
414
|
+
|
|
415
|
+
### Decision point format
|
|
416
|
+
|
|
417
|
+
All decision points must be presented as a "Decision Card" (决策卡片): bold black title, options labeled **A./B./C.** in order, recommended option marked **✅ Recommended (推荐)**, alternatives marked **🔀 Alternative (备选)**, each option lists Features/When-to-use/Costs (特点/适合/代价), a `>` line may state prerequisites, and a selection rule (选择规则) closes the card. No thin box-drawing characters (━ ┃ ─), no trailing "operation" hint line. Applies to every decision point: P0.5 (A/B/C), P1 decision points 0-5, P2 dev/coding method, P3 interface-list format, P4 issue handling, P5 delivery confirmation.
|
|
418
|
+
|
|
419
|
+
Template (模板):
|
|
420
|
+
|
|
421
|
+
**🧭 决策点 N | 名称**
|
|
422
|
+
⏱ {N}s 未选择 → 自动按推荐项执行
|
|
423
|
+
|
|
424
|
+
**✅ 推荐 · A. 名称(默认)**
|
|
425
|
+
- 特点 / Features: ...
|
|
426
|
+
- 适合 / When to use: ...
|
|
427
|
+
- 代价 / Costs: ...
|
|
428
|
+
|
|
429
|
+
**🔀 备选 · B. 名称**
|
|
430
|
+
- 特点 / Features: ...
|
|
431
|
+
- 适合 / When to use: ...
|
|
432
|
+
- 代价 / Costs: ...
|
|
433
|
+
|
|
434
|
+
**选择规则 / Selection rule**: ...
|
|
435
|
+
|
|
436
|
+
**Timeout auto-default (超时自动默认)**:
|
|
437
|
+
- Decision cards MUST be sent as plain text ending the turn (never via AskUserQuestion — it blocks without a timer). Then schedule a /loop wakeup (interval = flowcraft.yaml `decision_timeout`, default 120s). If it fires with no user reply → auto-execute the recommended option; mark the output 「⏱ 已超时自动执行(推荐项 X),如需改选请说明,可回退」
|
|
438
|
+
- Danger decision points (删除文件 / 推送远端 / 合并 main / rebase etc., irreversible external operations) never time out and show no ⏱ line — always wait for the user's explicit choice
|
|
439
|
+
- Stop hook writes pending marker `.claude/decision-pending.json` (Codex side: `.codex/decision-pending.json`); any user input resolves the decision and deletes the marker (mis-execution guard); cross-session fallback: session-start lazy-checks an expired marker and injects「先按推荐项自动执行」context
|
|
440
|
+
|
|
441
|
+
---
|
|
442
|
+
|
|
443
|
+
## Coding Standards
|
|
444
|
+
|
|
445
|
+
### PRD constraints (highest priority)
|
|
446
|
+
|
|
447
|
+
For every function/class/module written, you must be able to answer "which PRD requirement does this map to?"
|
|
448
|
+
|
|
449
|
+
- **No additions**: functions, interfaces, parameters, config items, or optimizations not listed in the PRD
|
|
450
|
+
- **No reductions**: do not skip or simplify any PRD requirement
|
|
451
|
+
- **No "while-at-it" improvements**: do not refactor unrelated code, add extra docs, or optimize unrequested performance during coding
|
|
452
|
+
|
|
453
|
+
> PRD gap found → **stop coding, return to P1 and confirm with the user**.
|
|
454
|
+
|
|
455
|
+
### Hard metrics
|
|
456
|
+
|
|
457
|
+
| Metric | Limit |
|
|
458
|
+
|--------|-------|
|
|
459
|
+
| Function body lines | ≤ 50 lines (excluding comments and blank lines) |
|
|
460
|
+
| Nesting depth | ≤ 3 levels |
|
|
461
|
+
| Function parameters | ≤ 4; use object/struct beyond that |
|
|
462
|
+
| Single responsibility | function name needing "and" → split |
|
|
463
|
+
|
|
464
|
+
### Security standard (OWASP focus)
|
|
465
|
+
|
|
466
|
+
| Risk | Defense |
|
|
467
|
+
|------|---------|
|
|
468
|
+
| SQL injection | parameterized queries; concatenation forbidden |
|
|
469
|
+
| XSS | escape user input HTML |
|
|
470
|
+
| Path traversal | validate file path operations |
|
|
471
|
+
| Hardcoded secrets | forbidden; use env vars or secret management |
|
|
472
|
+
| Log leakage | no sensitive info in logs |
|
|
473
|
+
| Loop DB execution | **SQL in loops forbidden**. If unavoidable → clarify with user first, then replace with batch operations |
|
|
474
|
+
|
|
475
|
+
### Transaction standard
|
|
476
|
+
|
|
477
|
+
| Rule | Description |
|
|
478
|
+
|------|-------------|
|
|
479
|
+
| Transaction granularity | as small as possible, only necessary data ops |
|
|
480
|
+
| Transaction propagation | explicitly specify (`_required`/`_nested`/`_requires_new` etc.) |
|
|
481
|
+
| Read-only transactions | use `readOnly=true` for queries |
|
|
482
|
+
|
|
483
|
+
### Exception handling standard
|
|
484
|
+
|
|
485
|
+
| Rule | Description |
|
|
486
|
+
|------|-------------|
|
|
487
|
+
| Catch must handle | empty catch implementations forbidden |
|
|
488
|
+
| Sanitize external errors | do not expose technical details to clients |
|
|
489
|
+
| Preserve exception chain | use `cause` |
|
|
490
|
+
|
|
491
|
+
### Comment standard
|
|
492
|
+
|
|
493
|
+
**All methods must have comments** (public/private/static/constructor): description + `@param` + `@return` + `@throws` (if applicable). Core calculation logic must have detailed comments.
|
|
494
|
+
|
|
495
|
+
### Coding checklist
|
|
496
|
+
|
|
497
|
+
- [ ] **PRD compliance** — all code maps to a PRD requirement
|
|
498
|
+
- [ ] function ≤50 lines, nesting ≤3, single responsibility
|
|
499
|
+
- [ ] no security issues (injection, XSS, sensitive info leakage)
|
|
500
|
+
- [ ] no hardcoded magic numbers/strings
|
|
501
|
+
- [ ] **100% comment coverage** — all methods commented, core logic detailed
|
|
502
|
+
- [ ] **UI/UX standard** (when UI involved) — modern component library, responsive, accessible
|
|
503
|
+
|
|
504
|
+
### UI/UX coding standard (mandatory when UI involved)
|
|
505
|
+
|
|
506
|
+
Implement strictly per P1 prototype + componentize + CSS Modules/Tailwind + CSS Variables theming + responsive relative units + Lucide/Heroicons icons + accessibility (≥44px interactive elements, contrast≥4.5:1, keyboard nav, label+for, aria-label)
|
|
507
|
+
|
|
508
|
+
> Forbidden: Bootstrap 3/4, jQuery UI, inline style, fixed pixels, emoji icons; see UI/UX Design Standards section
|
|
509
|
+
---
|
|
510
|
+
|
|
511
|
+
## Testing Standards
|
|
512
|
+
|
|
513
|
+
### PRD-driven testing (highest priority)
|
|
514
|
+
|
|
515
|
+
Tests must be based on the PRD; every PRD requirement maps to at least one test case.
|
|
516
|
+
|
|
517
|
+
### Test types
|
|
518
|
+
|
|
519
|
+
| Type | Requirement | Description |
|
|
520
|
+
|------|-------------|-------------|
|
|
521
|
+
| Unit test | must | cover all new/modified public functions |
|
|
522
|
+
| Boundary test | must | null values, extremes, boundary conditions |
|
|
523
|
+
| Error-path test | must | exception input, error-handling branches |
|
|
524
|
+
| Integration test | as needed | when multiple modules interact |
|
|
525
|
+
| E2E test | as needed | when user interaction flows are involved |
|
|
526
|
+
|
|
527
|
+
### Coverage requirements
|
|
528
|
+
|
|
529
|
+
| Metric | Target |
|
|
530
|
+
|--------|--------|
|
|
531
|
+
| New code line coverage | ≥ 80% |
|
|
532
|
+
| Key business logic coverage | ≥ 90% |
|
|
533
|
+
| Branch coverage | ≥ 70% |
|
|
534
|
+
|
|
535
|
+
### PRD→test mapping table
|
|
536
|
+
|
|
537
|
+
At the start of P3, first list the PRD→test mapping:
|
|
538
|
+
```
|
|
539
|
+
PRD requirement → test case mapping:
|
|
540
|
+
- R1 (JVM monitoring) → test_getJvmMetrics_shouldReturnJvmData
|
|
541
|
+
- R2 (HTTP monitoring) → test_getHttpMetrics_shouldReturnHttpData
|
|
542
|
+
- ...
|
|
543
|
+
```
|
|
544
|
+
|
|
545
|
+
### Test execution report template
|
|
546
|
+
|
|
547
|
+
```
|
|
548
|
+
[测试执行报告 / Test Execution Report]
|
|
549
|
+
用例总数 / Total cases:X
|
|
550
|
+
通过 / Passed:X | 失败 / Failed:X | 跳过 / Skipped:X
|
|
551
|
+
执行时间 / Duration:Xs
|
|
552
|
+
|
|
553
|
+
[覆盖率报告 / Coverage Report]
|
|
554
|
+
行覆盖率 / Line coverage:XX% (target≥80%)
|
|
555
|
+
分支覆盖率 / Branch coverage:XX% (target≥70%)
|
|
556
|
+
关键业务覆盖率 / Key business coverage:XX% (target≥90%)
|
|
557
|
+
```
|
|
558
|
+
|
|
559
|
+
### Test execution efficiency rules
|
|
560
|
+
|
|
561
|
+
**Run a test command only once; analyze results from the output file. Running the same test repeatedly is forbidden.**
|
|
562
|
+
|
|
563
|
+
1. Run once, `tee /tmp/sdlc-test-output.txt` to save output
|
|
564
|
+
2. Read the output file and analyze all results
|
|
565
|
+
3. If failures → collect all errors at once → **batch-fix** → run once more to verify
|
|
566
|
+
4. **At most 3 test runs across the whole P3**
|
|
567
|
+
|
|
568
|
+
---
|
|
569
|
+
|
|
570
|
+
## Git Workflow
|
|
571
|
+
|
|
572
|
+
**Branch naming**: `{type}/{requirement}-{yyyyMMdd}` (type: feature/fixbug/hotfix); call `/git-prep` before P2
|
|
573
|
+
|
|
574
|
+
**Branch operations**: public-branch guard (dev/main/master forbidden for direct development) → create branch → daily pull → pre-commit fetch to confirm not behind → merge requires user confirmation
|
|
575
|
+
|
|
576
|
+
**Safety rules**:
|
|
577
|
+
- ❌ `push --force` (main/master), `reset --hard`, `clean -f`, `branch -D` (unless explicitly requested by user)
|
|
578
|
+
- ⚠️ First `push`, merge to main, `rebase` → user confirmation required
|
|
579
|
+
- ✅ `status`/`diff`/`log`/`stash` freely executable
|
|
580
|
+
|
|
581
|
+
**Conflict resolution**: prefer `git merge` to keep full history, resolve file by file keeping both sides' valid changes, run tests after resolving, confirm before committing for complex conflicts
|
|
582
|
+
|
|
583
|
+
---
|
|
584
|
+
|
|
585
|
+
## Anti-Amnesia
|
|
586
|
+
|
|
587
|
+
Defenses: SessionStart hook + UserPromptSubmit phase reminders + PreCompact state save + sub-agent context injection + public-branch guard. New task completed → archive to `completed_tasks`, `project_roadmap` never reset.
|
|
588
|
+
|
|
589
|
+
**Priority**: Security > User instruction > SDLC process > Coding standards > Git rules
|
|
590
|
+
|
|
591
|
+
---
|
|
592
|
+
|
|
593
|
+
## Multi-Agent Parallel Development
|
|
594
|
+
|
|
595
|
+
### Core Principles
|
|
596
|
+
|
|
597
|
+
1. **Independence & PRD alignment** — only dependency-free tasks can run in parallel; each sub-agent maps to explicit PRD requirements
|
|
598
|
+
2. **Main-agent coordination** — split, assign, aggregate, resolve conflicts
|
|
599
|
+
|
|
600
|
+
### Agent Dispatch
|
|
601
|
+
|
|
602
|
+
| Phase | Trigger | Split granularity | Post-aggregation |
|
|
603
|
+
|-------|---------|-------------------|------------------|
|
|
604
|
+
| P2 | 2+ independent implementation modules | by module/file | check interface consistency |
|
|
605
|
+
| P3 | 2+ independent tested modules | by tested module | run all tests together |
|
|
606
|
+
| P4 | modified_files ≥5 | by review dimension (max 3) | merge review reports |
|
|
607
|
+
|
|
608
|
+
### Limits
|
|
609
|
+
|
|
610
|
+
- Max 2 parallel sub-agents; small tasks (single file or <50 lines) done by the main agent directly
|
|
611
|
+
- P1/P5 do not support parallelism; sub-agent failure → switch to main-agent serial execution
|
|
612
|
+
|
|
613
|
+
---
|
|
614
|
+
|
|
615
|
+
## Chrome Browser Integration
|
|
616
|
+
|
|
617
|
+
Browser operations via chrome-integration / playwright. **Only P1 (prototype preview / design confirmation) and P3 (visual regression / E2E / responsive testing) allowed**; all other phases forbidden. UI tasks create self-contained prototype HTML in P1 → Chrome preview → screenshot → iterate until confirmed → enter P2.
|
|
618
|
+
|
|
619
|
+
---
|
|
620
|
+
|
|
621
|
+
## Lean Memory & Document Management
|
|
622
|
+
|
|
623
|
+
Minimum-necessary principle: keep only the minimal info needed to resume work; delete redundant, decorative, derivable content.
|
|
624
|
+
|
|
625
|
+
**completed_tasks**: task≤20 chars + prd_summary≤50 chars + key_decisions≤3 items + completed_at; auto-archive oldest 2 when ≥5 to `.claude/archive/`; forbidden to store full PRD / file lists / code snippets
|
|
626
|
+
|
|
627
|
+
**Field leanness**: `architecture_decisions`≤5 items, `phase_history` compress when ≥10, `key_context`≤50 chars, `prd_file` store path only
|
|
628
|
+
|
|
629
|
+
**Document rules**: one sentence over two, tables preferred, no decoration, no duplication, quantifiable. PRD≤150 lines, architecture≤50 lines, review≤15 lines, delivery≤10 lines
|
|
630
|
+
|
|
631
|
+
---
|
|
632
|
+
|
|
633
|
+
## UI/UX Design Standards
|
|
634
|
+
|
|
635
|
+
### Core Principles
|
|
636
|
+
|
|
637
|
+
| Principle | Description |
|
|
638
|
+
|-----------|-------------|
|
|
639
|
+
| **Modern first** | ❌ Bootstrap 3/4, jQuery UI ✅ shadcn/ui, Radix, Ant Design 5+ |
|
|
640
|
+
| **Design-system driven** | choose from 67 styles + 96 palettes + 57 fonts (arbitrary colors forbidden) |
|
|
641
|
+
| **Accessibility** | WCAG 2.1 AA (contrast≥4.5:1, keyboard nav, ARIA) |
|
|
642
|
+
| **Responsive** | mobile-first; test 375px/768px/1440px |
|
|
643
|
+
| **Performance** | Core Web Vitals (LCP<2.5s, CLS<0.1) |
|
|
644
|
+
|
|
645
|
+
### UI/UX forbidden implementations
|
|
646
|
+
|
|
647
|
+
| ❌ Forbidden | ✅ Replacement |
|
|
648
|
+
|--------------|----------------|
|
|
649
|
+
| lots of inline `style={{}}` | CSS Modules/Tailwind |
|
|
650
|
+
| fixed pixel `width: 300px` | responsive `max-width: 100%` |
|
|
651
|
+
| `!important` | proper CSS specificity |
|
|
652
|
+
| hardcoded color `#3b82f6` | `var(--color-primary)` |
|
|
653
|
+
| jQuery DOM manipulation | framework state management |
|
|
654
|
+
| float layout | Flexbox / Grid |
|
|
655
|
+
|
|
656
|
+
### UI/UX P3 test requirements
|
|
657
|
+
|
|
658
|
+
| Test type | Tool | Requirement |
|
|
659
|
+
|-----------|------|-------------|
|
|
660
|
+
| Visual regression | Playwright screenshot | major pages/components |
|
|
661
|
+
| Responsive | 3 breakpoint tests | 375/768/1440px |
|
|
662
|
+
| Accessibility | axe-core/Lighthouse | 0 critical violations |
|
|
663
|
+
| Interaction | Testing Library/Playwright | all user flows |
|
|
664
|
+
| Performance | Lighthouse CI | LCP<2.5s, CLS<0.1 |
|
|
665
|
+
|
|
666
|
+
---
|
|
667
|
+
|
|
668
|
+
## Review Toolchain
|
|
669
|
+
|
|
670
|
+
Auto-detect project type by file (package.json→Node / pyproject.toml→Python / go.mod→Go / pom.xml→Java), select corresponding lint/typecheck/test/audit commands.
|
|
671
|
+
|
|
672
|
+
**Key metrics**: P2 review = lint error count + build success + dependency vulnerabilities; P3 test = pass rate + line coverage≥80% + key business≥90% + branch≥70%
|
|
673
|
+
|
|
674
|
+
<!-- gitnexus:start -->
|
|
675
|
+
# GitNexus — Code Intelligence
|
|
676
|
+
|
|
677
|
+
This project is indexed by GitNexus as **sdlc** (2676 symbols, 4199 relationships, 183 execution flows). Use the GitNexus MCP tools to understand code, assess impact, and navigate safely.
|
|
678
|
+
|
|
679
|
+
> Index stale? Run `node .gitnexus/run.cjs analyze` from the project root — it auto-selects an available runner. No `.gitnexus/run.cjs` yet? `npx gitnexus analyze` (npm 11 crash → `npm i -g gitnexus`; #1939).
|
|
680
|
+
|
|
681
|
+
## Always Do
|
|
682
|
+
|
|
683
|
+
- **MUST run impact analysis before editing any symbol.** Before modifying a function, class, or method, run `impact({target: "symbolName", direction: "upstream"})` and report the blast radius (direct callers, affected processes, risk level) to the user.
|
|
684
|
+
- **MUST run `detect_changes()` before committing** to verify your changes only affect expected symbols and execution flows. For regression review, compare against the default branch: `detect_changes({scope: "compare", base_ref: "main"})`.
|
|
685
|
+
- **MUST warn the user** if impact analysis returns HIGH or CRITICAL risk before proceeding with edits.
|
|
686
|
+
- When exploring unfamiliar code, use `query({search_query: "concept"})` to find execution flows instead of grepping. It returns process-grouped results ranked by relevance.
|
|
687
|
+
- When you need full context on a specific symbol — callers, callees, which execution flows it participates in — use `context({name: "symbolName"})`.
|
|
688
|
+
- For security review, `explain({target: "fileOrSymbol"})` lists taint findings (source→sink flows; needs `analyze --pdg`).
|
|
689
|
+
|
|
690
|
+
## Never Do
|
|
691
|
+
|
|
692
|
+
- NEVER edit a function, class, or method without first running `impact` on it.
|
|
693
|
+
- NEVER ignore HIGH or CRITICAL risk warnings from impact analysis.
|
|
694
|
+
- NEVER rename symbols with find-and-replace — use `rename` which understands the call graph.
|
|
695
|
+
- NEVER commit changes without running `detect_changes()` to check affected scope.
|
|
696
|
+
|
|
697
|
+
## Resources
|
|
698
|
+
|
|
699
|
+
| Resource | Use for |
|
|
700
|
+
|----------|---------|
|
|
701
|
+
| `gitnexus://repo/sdlc/context` | Codebase overview, check index freshness |
|
|
702
|
+
| `gitnexus://repo/sdlc/clusters` | All functional areas |
|
|
703
|
+
| `gitnexus://repo/sdlc/processes` | All execution flows |
|
|
704
|
+
| `gitnexus://repo/sdlc/process/{name}` | Step-by-step execution trace |
|
|
705
|
+
|
|
706
|
+
## CLI
|
|
707
|
+
|
|
708
|
+
| Task | Read this skill file |
|
|
709
|
+
|------|---------------------|
|
|
710
|
+
| Understand architecture / "How does X work?" | `~/.claude/skills/gitnexus/gitnexus-exploring/SKILL.md` |
|
|
711
|
+
| Blast radius / "What breaks if I change X?" | `~/.claude/skills/gitnexus/gitnexus-impact-analysis/SKILL.md` |
|
|
712
|
+
| Trace bugs / "Why is X failing?" | `~/.claude/skills/gitnexus/gitnexus-debugging/SKILL.md` |
|
|
713
|
+
| Rename / extract / split / refactor | `~/.claude/skills/gitnexus/gitnexus-refactoring/SKILL.md` |
|
|
714
|
+
| Tools, resources, schema reference | `~/.claude/skills/gitnexus/gitnexus-guide/SKILL.md` |
|
|
715
|
+
| Index, status, clean, wiki CLI commands | `~/.claude/skills/gitnexus/gitnexus-cli/SKILL.md` |
|
|
716
|
+
|
|
717
|
+
<!-- gitnexus:end -->
|