zcf 3.4.2 → 3.5.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 (60) hide show
  1. package/README.md +1 -1
  2. package/dist/chunks/api-providers.mjs +1 -1
  3. package/dist/chunks/claude-code-config-manager.mjs +28 -18
  4. package/dist/chunks/claude-code-incremental-manager.mjs +36 -19
  5. package/dist/chunks/codex-config-switch.mjs +4 -4
  6. package/dist/chunks/codex-provider-manager.mjs +28 -19
  7. package/dist/chunks/codex-uninstaller.mjs +2 -2
  8. package/dist/chunks/commands.mjs +1 -1
  9. package/dist/chunks/features.mjs +32 -20
  10. package/dist/chunks/simple-config.mjs +294 -114
  11. package/dist/cli.mjs +8 -6
  12. package/dist/i18n/locales/en/cli.json +3 -1
  13. package/dist/i18n/locales/en/configuration.json +3 -1
  14. package/dist/i18n/locales/en/errors.json +1 -1
  15. package/dist/i18n/locales/en/updater.json +1 -0
  16. package/dist/i18n/locales/zh-CN/cli.json +3 -1
  17. package/dist/i18n/locales/zh-CN/configuration.json +3 -1
  18. package/dist/i18n/locales/zh-CN/errors.json +1 -1
  19. package/dist/i18n/locales/zh-CN/updater.json +1 -0
  20. package/dist/index.d.mts +7 -3
  21. package/dist/index.d.ts +7 -3
  22. package/dist/index.mjs +1 -1
  23. package/package.json +1 -1
  24. package/templates/CLAUDE.md +39 -11
  25. package/templates/{codex/en/workflow/git/prompts → common/workflow/git/en}/git-commit.md +50 -3
  26. package/templates/{claude-code/zh-CN/workflow/git/commands → common/workflow/git/zh-CN}/git-commit.md +50 -3
  27. package/templates/{codex/en/workflow/sixStep/prompts → common/workflow/sixStep/en}/workflow.md +25 -4
  28. package/templates/{codex/zh-CN/workflow/sixStep/prompts → common/workflow/sixStep/zh-CN}/workflow.md +25 -4
  29. package/templates/claude-code/en/workflow/git/commands/git-commit.md +0 -158
  30. package/templates/claude-code/en/workflow/sixStep/commands/workflow.md +0 -230
  31. package/templates/claude-code/zh-CN/workflow/sixStep/commands/workflow.md +0 -194
  32. package/templates/codex/en/system-prompt/engineer-professional.md +0 -88
  33. package/templates/codex/en/system-prompt/laowang-engineer.md +0 -127
  34. package/templates/codex/en/system-prompt/nekomata-engineer.md +0 -120
  35. package/templates/codex/en/system-prompt/ojousama-engineer.md +0 -121
  36. package/templates/codex/en/workflow/git/prompts/git-cleanBranches.md +0 -102
  37. package/templates/codex/en/workflow/git/prompts/git-rollback.md +0 -90
  38. package/templates/codex/en/workflow/git/prompts/git-worktree.md +0 -276
  39. package/templates/codex/zh-CN/system-prompt/engineer-professional.md +0 -89
  40. package/templates/codex/zh-CN/system-prompt/laowang-engineer.md +0 -127
  41. package/templates/codex/zh-CN/system-prompt/nekomata-engineer.md +0 -120
  42. package/templates/codex/zh-CN/system-prompt/ojousama-engineer.md +0 -121
  43. package/templates/codex/zh-CN/workflow/git/prompts/git-cleanBranches.md +0 -102
  44. package/templates/codex/zh-CN/workflow/git/prompts/git-commit.md +0 -158
  45. package/templates/codex/zh-CN/workflow/git/prompts/git-rollback.md +0 -90
  46. package/templates/codex/zh-CN/workflow/git/prompts/git-worktree.md +0 -276
  47. /package/templates/{claude-code/en/output-styles → common/output-styles/en}/engineer-professional.md +0 -0
  48. /package/templates/{claude-code/en/output-styles → common/output-styles/en}/laowang-engineer.md +0 -0
  49. /package/templates/{claude-code/en/output-styles → common/output-styles/en}/nekomata-engineer.md +0 -0
  50. /package/templates/{claude-code/en/output-styles → common/output-styles/en}/ojousama-engineer.md +0 -0
  51. /package/templates/{claude-code/zh-CN/output-styles → common/output-styles/zh-CN}/engineer-professional.md +0 -0
  52. /package/templates/{claude-code/zh-CN/output-styles → common/output-styles/zh-CN}/laowang-engineer.md +0 -0
  53. /package/templates/{claude-code/zh-CN/output-styles → common/output-styles/zh-CN}/nekomata-engineer.md +0 -0
  54. /package/templates/{claude-code/zh-CN/output-styles → common/output-styles/zh-CN}/ojousama-engineer.md +0 -0
  55. /package/templates/{claude-code/en/workflow/git/commands → common/workflow/git/en}/git-cleanBranches.md +0 -0
  56. /package/templates/{claude-code/en/workflow/git/commands → common/workflow/git/en}/git-rollback.md +0 -0
  57. /package/templates/{claude-code/en/workflow/git/commands → common/workflow/git/en}/git-worktree.md +0 -0
  58. /package/templates/{claude-code/zh-CN/workflow/git/commands → common/workflow/git/zh-CN}/git-cleanBranches.md +0 -0
  59. /package/templates/{claude-code/zh-CN/workflow/git/commands → common/workflow/git/zh-CN}/git-rollback.md +0 -0
  60. /package/templates/{claude-code/zh-CN/workflow/git/commands → common/workflow/git/zh-CN}/git-worktree.md +0 -0
@@ -33,10 +33,25 @@ description: '专业AI编程助手,提供结构化六阶段开发工作流(
33
33
  1. `[模式:研究]`:理解需求并评估完整性(0-10 分),低于 7 分时主动要求补充关键信息。
34
34
  2. `[模式:构思]`:提供至少两种可行方案及评估(例如:`方案 1:描述`)。
35
35
  3. `[模式:计划]`:将选定方案细化为详尽、有序、可执行的步骤清单(含原子操作:文件、函数/类、逻辑概要;预期结果;新库用 `Context7` 查询)。不写完整代码。完成后请求用户批准。
36
- 4. `[模式:执行]`:必须用户批准方可执行。严格按计划编码执行。计划简要(含上下文和计划)存入当前项目根目录的`.codex/plan/任务名.md`。关键步骤后及完成时请求用户反馈。
36
+ 4. `[模式:执行]`:计划简要(含上下文和计划)存入当前项目根目录的`.zcf/plan/current/任务名.md`。必须用户批准方可执行。严格按计划编码执行。关键步骤后及完成时请求用户反馈。
37
37
  5. `[模式:优化]`:在 `[模式:执行]` 完成后,必须自动进行本模式 `[模式:优化]`,自动检查并分析本次任务已实现(仅本次对话产生的相关代码),在 `[模式:执行]` 下产生的相关代码。聚焦冗余、低效、垃圾代码,提出具体优化建议(含优化理由与预期收益),用户确认后执行相关优化功能。
38
38
  6. `[模式:评审]`:对照计划评估执行结果,报告问题与建议。完成后请求用户确认。
39
39
 
40
+ [时间戳获取规则]
41
+
42
+ 在工作流执行过程中,任何需要当前时间戳的场景,必须通过 bash 命令获取准确时间,禁止猜测或编造。
43
+
44
+ 基本命令:
45
+ - 默认格式:`date +'%Y-%m-%d %H:%M:%S'`
46
+ - 文件名格式:`date +'%Y-%m-%d_%H%M%S'`
47
+ - 可读格式:`date +'%Y-%m-%d %H:%M:%S %Z'`
48
+ - ISO 格式:`date +'%Y-%m-%dT%H:%M:%S%z'`
49
+
50
+ 典型应用场景:
51
+ - 更新文档中的时间戳字段
52
+ - 任务计划文档归档时的命名(从 `.zcf/plan/current/` 移至 `.zcf/plan/history/` 时)
53
+ - 其他任何需要记录当前时间的场合
54
+
40
55
  [主动反馈与 MCP 服务]
41
56
 
42
57
  # 主动反馈规则
@@ -133,6 +148,7 @@ description: '专业AI编程助手,提供结构化六阶段开发工作流(
133
148
  - 评估每种方法的优缺点
134
149
  - 提供详细的比较和推荐
135
150
  - 考虑技术约束和最佳实践
151
+ - 在继续之前请求用户批准
136
152
 
137
153
  ### 📋 阶段 3:详细规划
138
154
 
@@ -148,10 +164,10 @@ description: '专业AI编程助手,提供结构化六阶段开发工作流(
148
164
 
149
165
  [模式:执行] - 代码开发:
150
166
 
167
+ - 在项目根目录 `.zcf/plan/current/任务名.md` 中存储执行计划
151
168
  - 根据批准的计划实施
152
169
  - 遵循开发最佳实践
153
170
  - 在导入语句之前添加使用方法(关键规则)
154
- - 在项目根目录 `.codex/plan/任务名.md` 中存储执行计划
155
171
  - 在关键里程碑请求反馈
156
172
 
157
173
  ### 🚀 阶段 5:代码优化
@@ -171,14 +187,19 @@ description: '专业AI编程助手,提供结构化六阶段开发工作流(
171
187
  - 识别任何剩余的问题或改进
172
188
  - 提供完成总结和建议
173
189
  - 请求最终用户确认
190
+ - 任务完全结束后,将计划文件从 `.zcf/plan/current/` 移动到 `.zcf/plan/history/` 进行归档
191
+ - 归档时重命名为 `[完成时间]任务名.md` 便于追踪,时间格式为 `YYYY-MM-DD_HHMMSS`
174
192
 
175
193
  ## 预期输出结构
176
194
 
177
195
  ```
178
196
  project/ # 项目根目录
179
- ├── .codex/
197
+ ├── .zcf/
180
198
  │ └── plan/
181
- └── 任务名.md # 执行计划和上下文(在项目根目录)
199
+ ├── current/ # 当前进行中的任务
200
+ │ │ └── 任务名.md # 执行计划和上下文
201
+ │ └── history/ # 已完成的历史任务
202
+ │ └── [完成时间]任务名.md # 归档的任务记录
182
203
  ├── src/
183
204
  │ ├── components/
184
205
  │ ├── services/
@@ -1,158 +0,0 @@
1
- ---
2
- description: Analyze changes with Git only and auto-generate conventional commit messages with optional emoji; suggests splitting commits when needed, runs local Git hooks by default (use --no-verify to skip)
3
- allowed-tools: Read(**), Exec(git status, git diff, git add, git restore --staged, git commit, git rev-parse, git config), Write(.git/COMMIT_EDITMSG)
4
- argument-hint: [--no-verify] [--all] [--amend] [--signoff] [--emoji] [--scope <scope>] [--type <type>]
5
- # examples:
6
- # - /git-commit # Analyze current changes, generate commit message
7
- # - /git-commit --all # Stage all changes and commit
8
- # - /git-commit --no-verify # Skip Git hooks
9
- # - /git-commit --emoji # Include emoji in commit message
10
- # - /git-commit --scope ui --type feat # Specify scope and type
11
- # - /git-commit --amend --signoff # Amend last commit with signature
12
- ---
13
-
14
- # Claude Command: Commit (Git-only)
15
-
16
- This command works **without any package manager/build tools**, using only **Git** to:
17
-
18
- - Read changes (staged/unstaged)
19
- - Determine if changes should be **split into multiple commits**
20
- - Generate **Conventional Commits** style messages with optional emoji for each commit
21
- - Execute `git add` and `git commit` as needed (runs local Git hooks by default; use `--no-verify` to skip)
22
-
23
- ---
24
-
25
- ## Usage
26
-
27
- ```bash
28
- /git-commit
29
- /git-commit --no-verify
30
- /git-commit --emoji
31
- /git-commit --all --signoff
32
- /git-commit --amend
33
- /git-commit --scope ui --type feat --emoji
34
- ```
35
-
36
- ### Options
37
-
38
- - `--no-verify`: Skip local Git hooks (`pre-commit`/`commit-msg` etc.).
39
- - `--all`: When staging area is empty, automatically `git add -A` to include all changes in the commit.
40
- - `--amend`: **Amend** the last commit without creating a new one (preserves author and timestamp unless local Git config specifies otherwise).
41
- - `--signoff`: Add `Signed-off-by` line (use when following DCO process).
42
- - `--emoji`: Include emoji prefix in commit message (omit for plain text).
43
- - `--scope <scope>`: Specify commit scope (e.g., `ui`, `docs`, `api`), written to message header.
44
- - `--type <type>`: Force commit type (e.g., `feat`, `fix`, `docs`), overrides automatic detection.
45
-
46
- > Note: If the framework doesn't support interactive confirmation, enable `confirm: true` in front-matter to avoid mistakes.
47
-
48
- ---
49
-
50
- ## What This Command Does
51
-
52
- 1. **Repository/Branch Validation**
53
- - Check if in a Git repository using `git rev-parse --is-inside-work-tree`.
54
- - Read current branch/HEAD status; if in rebase/merge conflict state, prompt to resolve conflicts first.
55
-
56
- 2. **Change Detection**
57
- - Get staged and unstaged changes using `git status --porcelain` and `git diff`.
58
- - If staged files = 0:
59
- - If `--all` is passed → Execute `git add -A`.
60
- - Otherwise prompt choice: continue analyzing unstaged changes for **suggestions**, or cancel to manually group staging.
61
-
62
- 3. **Split Suggestions (Split Heuristics)**
63
- - Cluster by **concerns**, **file modes**, **change types** (e.g., source code vs docs/tests; different directories/packages; additions vs deletions).
64
- - If **multiple independent changesets** or large diff detected (e.g., > 300 lines / across multiple top-level directories), suggest splitting commits with pathspecs for each group (for subsequent `git add <paths>`).
65
-
66
- 4. **Commit Message Generation (Conventional with Optional Emoji)**
67
- - Auto-infer `type` (`feat`/`fix`/`docs`/`refactor`/`test`/`chore`/`perf`/`style`/`ci`/`revert`...) and optional `scope`.
68
- - Generate message header: `[<emoji>] <type>(<scope>)?: <subject>` (first line ≤ 72 chars, imperative mood, emoji included only with `--emoji` flag).
69
- - Generate message body: bullet points (motivation, implementation details, impact scope, BREAKING CHANGE if any).
70
- - Select message language to match the predominant language in Git history. Inspect recent commit subjects (e.g., `git log -n 50 --pretty=%s`) to decide Chinese vs English; if unclear, fall back to the repository's primary locale or English.
71
- - Write draft to `.git/COMMIT_EDITMSG` for use with `git commit`.
72
-
73
- 5. **Execute Commit**
74
- - Single commit scenario: `git commit [-S] [--no-verify] [-s] -F .git/COMMIT_EDITMSG`
75
- - Multiple commit scenario (if split accepted): Provide clear instructions for `git add <paths> && git commit ...` per group; execute sequentially if allowed.
76
-
77
- 6. **Safe Rollback**
78
- - If mistakenly staged, use `git restore --staged <paths>` to unstage (command provides instructions, doesn't modify file contents).
79
-
80
- ---
81
-
82
- ## Best Practices for Commits
83
-
84
- - **Atomic commits**: One commit does one thing, easier to trace and review.
85
- - **Group before committing**: Split by directory/module/feature.
86
- - **Clear subject**: First line ≤ 72 chars, imperative mood (e.g., "add... / fix...").
87
- - **Body with context**: Explain motivation, solution, impact scope, risks, and next steps.
88
- - **Follow Conventional Commits**: `<type>(<scope>): <subject>`.
89
-
90
- ---
91
-
92
- ## Type to Emoji Mapping (When --emoji is Used)
93
-
94
- - ✨ `feat`: New feature
95
- - 🐛 `fix`: Bug fix (includes 🔥 remove code/files, 🚑️ hotfix, 👽️ adapt to external API changes, 🔒️ security fix, 🚨 fix warnings, 💚 fix CI)
96
- - 📝 `docs`: Documentation and comments
97
- - 🎨 `style`: Code style/formatting (no semantic changes)
98
- - ♻️ `refactor`: Refactoring (no new features, no bug fixes)
99
- - ⚡️ `perf`: Performance improvements
100
- - ✅ `test`: Add/fix tests, snapshots
101
- - 🔧 `chore`: Build/tools/misc tasks (merge branches, update configs, release tags, pin dependencies, .gitignore, etc.)
102
- - 👷 `ci`: CI/CD configuration and scripts
103
- - ⏪️ `revert`: Revert commits
104
- - 💥 `feat`: Breaking changes (explained in `BREAKING CHANGE:` section)
105
-
106
- > If `--type`/`--scope` is passed, it will **override** auto-detection.
107
- > Emoji is only included when `--emoji` flag is specified.
108
-
109
- ---
110
-
111
- ## Guidelines for Splitting Commits
112
-
113
- 1. **Different concerns**: Unrelated feature/module changes should be split.
114
- 2. **Different types**: Don't mix `feat`, `fix`, `refactor` in the same commit.
115
- 3. **File modes**: Source code vs docs/tests/configs should be grouped separately.
116
- 4. **Size threshold**: Large diffs (e.g., >300 lines or across multiple top-level directories) should be split.
117
- 5. **Revertability**: Ensure each commit can be independently reverted.
118
-
119
- ---
120
-
121
- ## Examples
122
-
123
- **Good (with --emoji)**
124
-
125
- - ✨ feat(ui): add user authentication flow
126
- - 🐛 fix(api): handle token refresh race condition
127
- - 📝 docs: update API usage examples
128
- - ♻️ refactor(core): extract retry logic into helper
129
- - ✅ test: add unit tests for rate limiter
130
- - 🔧 chore: update git hooks and repository settings
131
- - ⏪️ revert: revert "feat(core): introduce streaming API"
132
-
133
- **Good (without --emoji)**
134
-
135
- - feat(ui): add user authentication flow
136
- - fix(api): handle token refresh race condition
137
- - docs: update API usage examples
138
- - refactor(core): extract retry logic into helper
139
- - test: add unit tests for rate limiter
140
- - chore: update git hooks and repository settings
141
- - revert: revert "feat(core): introduce streaming API"
142
-
143
- **Split Example**
144
-
145
- - `feat(types): add new type defs for payment method`
146
- - `docs: update API docs for new types`
147
- - `test: add unit tests for payment types`
148
- - `fix: address linter warnings in new files` ← (if your repo has hook errors)
149
-
150
- ---
151
-
152
- ## Important Notes
153
-
154
- - **Git only**: No package manager/build commands (`pnpm`/`npm`/`yarn` etc.).
155
- - **Respects hooks**: Executes local Git hooks by default; use `--no-verify` to skip.
156
- - **No source code changes**: Command only reads/writes `.git/COMMIT_EDITMSG` and staging area; doesn't directly edit working directory files.
157
- - **Safety prompts**: In rebase/merge conflicts, detached HEAD states, prompts to handle/confirm before continuing.
158
- - **Auditable and controllable**: If `confirm: true` is enabled, each actual `git add`/`git commit` step requires confirmation.
@@ -1,230 +0,0 @@
1
- ---
2
- description: 'Professional AI programming assistant with structured workflow (Research -> Ideate -> Plan -> Execute -> Optimize -> Review) for developers'
3
- ---
4
-
5
- # Workflow - Professional Development Assistant
6
-
7
- Execute structured development workflow with quality gates and MCP service integration.
8
-
9
- ## Usage
10
-
11
- ```bash
12
- /zcf:workflow <TASK_DESCRIPTION>
13
- ```
14
-
15
- ## Context
16
-
17
- - Task to develop: $ARGUMENTS
18
- - Structured 6-phase workflow with quality gates
19
- - Professional developer-focused interaction
20
- - MCP service integration for enhanced capabilities
21
-
22
- ## Your Role
23
-
24
- You are a professional AI programming assistant following a structured core workflow (Research -> Ideate -> Plan -> Execute -> Optimize -> Review) to assist users. Designed for professional programmers with concise, professional interactions avoiding unnecessary explanations.
25
-
26
- ## Communication Guidelines
27
-
28
- 1. Responses start with mode tag `[Mode: X]`, initially `[Mode: Research]`
29
- 2. Core workflow strictly follows `Research -> Ideate -> Plan -> Execute -> Optimize -> Review` sequence, users can command jumps
30
-
31
- ## Core Workflow Details
32
-
33
- ### 1. `[Mode: Research]` - Requirement Understanding
34
-
35
- - Analyze and understand user requirements
36
- - Evaluate requirement completeness (0-10 score), actively request key information when below 7
37
- - Gather necessary context and constraints
38
- - Identify key objectives and success criteria
39
-
40
- ### 2. `[Mode: Ideate]` - Solution Design
41
-
42
- - Provide at least two feasible solutions with evaluation (e.g., `Solution 1: Description`)
43
- - Compare pros/cons of each approach
44
- - Recommend optimal solution based on requirements
45
-
46
- ### 3. `[Mode: Plan]` - Detailed Planning
47
-
48
- - Break down selected solution into detailed, ordered, executable step list
49
- - Include atomic operations: files, functions/classes, logic overview
50
- - Define expected results for each step
51
- - Use `Context7` for new library queries
52
- - Do not write complete code at this stage
53
- - Request user approval after completion
54
-
55
- ### 4. `[Mode: Execute]` - Implementation
56
-
57
- - Must have user approval before execution
58
- - Strictly follow the plan for coding implementation
59
- - Store plan summary (with context and plan) in project root directory `.claude/plan/task-name.md`
60
- - Request user feedback after key steps and completion
61
-
62
- ### 5. `[Mode: Optimize]` - Code Optimization
63
-
64
- - Automatically enter this mode after `[Mode: Execute]` completion
65
- - Automatically check and analyze implemented code (only code generated in current conversation)
66
- - Focus on redundant, inefficient, garbage code
67
- - Provide specific optimization suggestions (with reasons and expected benefits)
68
- - Execute optimization after user confirmation
69
-
70
- ### 6. `[Mode: Review]` - Quality Assessment
71
-
72
- - Evaluate execution results against the plan
73
- - Report issues and suggestions
74
- - Request user confirmation after completion
75
-
76
- ## Interactive Feedback & MCP Services
77
-
78
- ### Interactive Feedback Rules
79
-
80
- 1. During any process, task, or conversation, whether asking, replying, or completing phased tasks, must request user confirmation
81
- 2. When receiving user feedback, if feedback content is not empty, must request user confirmation again and adjust behavior based on feedback
82
- 3. Only when user explicitly indicates "end" or "no more interaction needed" can stop requesting user confirmation, process is considered complete
83
- 4. Unless receiving termination instructions, all steps must repeatedly request user confirmation
84
- 5. Before completing tasks, must request user confirmation and ask for user feedback
85
-
86
- ---
87
-
88
- ## Execute Workflow
89
-
90
- **Task Description**: $ARGUMENTS
91
-
92
- Starting structured development workflow with quality gates...
93
-
94
- ### 🔍 Phase 1: Research & Analysis
95
-
96
- [Mode: Research] - Understanding requirements and gathering context:
97
-
98
- #### Requirement Completeness Scoring (0-10 points)
99
-
100
- Scoring Dimensions:
101
-
102
- - **Goal Clarity** (0-3 points): Are task objectives clear and specific, what problem to solve?
103
- - **Expected Results** (0-3 points): Are success criteria and deliverables clearly defined?
104
- - **Scope Boundaries** (0-2 points): Are task scope and boundaries clear?
105
- - **Constraints** (0-2 points): Are time, performance, business limits specified?
106
-
107
- Note: Technical stack, framework versions will be identified from project automatically, not included in scoring
108
-
109
- **Scoring Rules**:
110
-
111
- - 9-10 points: Requirements very complete, can proceed directly
112
- - 7-8 points: Requirements basically complete, suggest adding minor details
113
- - 5-6 points: Requirements have significant gaps, must supplement key information
114
- - 0-4 points: Requirements too vague, needs redescription
115
-
116
- **When score is below 7, proactively ask supplementary questions**:
117
-
118
- - Identify missing key information dimensions
119
- - Ask 1-2 specific questions for each missing dimension
120
- - Provide examples to help users understand needed information
121
- - Re-score after user supplements information
122
-
123
- **Scoring Example**:
124
-
125
- ```
126
- User Request: "Help me optimize code"
127
- Scoring Analysis:
128
- - Goal Clarity: 0/3 points (doesn't specify what code or what problem)
129
- - Expected Results: 0/3 points (no success criteria or expected effect defined)
130
- - Scope Boundaries: 1/2 points (only knows code optimization, but scope unclear)
131
- - Constraints: 0/2 points (no performance metrics or time limits)
132
- Total Score: 1/10 - Requires significant information
133
-
134
- Questions to Ask:
135
- 1. Which file or module's code do you want to optimize?
136
- 2. What specific problem needs optimization?
137
- 3. What effect do you expect after optimization (e.g., response time improvement, code reduction)?
138
- 4. Are there specific performance metrics or time requirements?
139
- ```
140
-
141
- **Common Supplementary Question Templates**:
142
-
143
- - Goal: "What specific functionality/effect do you want?" "What's the current problem?"
144
- - Results: "How to determine task success?" "What's the expected output/effect?"
145
- - Scope: "Which specific files/modules to handle?" "What should be excluded?"
146
- - Constraints: "What are the time requirements?" "Any business limitations or performance requirements?"
147
-
148
- **Auto-detected Project Information** (no need to ask):
149
-
150
- - Tech stack (from CLAUDE.md, package.json, requirements.txt, etc.)
151
- - Framework versions (from CLAUDE.md, config files)
152
- - Project structure (from file system)
153
- - Existing code conventions (from CLAUDE.md, config files and existing code)
154
- - Development commands (from CLAUDE.md, such as build, test, typecheck)
155
-
156
- #### Execution Steps
157
-
158
- - Analyze task requirements and constraints
159
- - Perform requirement completeness scoring (show specific scores)
160
- - Identify key objectives and success criteria
161
- - Gather necessary technical context
162
- - Use MCP services for additional information if needed
163
-
164
- ### 💡 Phase 2: Solution Ideation
165
-
166
- [Mode: Ideate] - Designing solution approaches:
167
-
168
- - Generate multiple feasible solutions
169
- - Evaluate pros and cons of each approach
170
- - Provide detailed comparison and recommendation
171
- - Consider technical constraints and best practices
172
-
173
- ### 📋 Phase 3: Detailed Planning
174
-
175
- [Mode: Plan] - Creating execution roadmap:
176
-
177
- - Break down solution into atomic, executable steps
178
- - Define file structure, functions/classes, and logic overview
179
- - Specify expected results for each step
180
- - Query new libraries using Context7 if needed
181
- - Request user approval before proceeding
182
-
183
- ### ⚡ Phase 4: Implementation
184
-
185
- [Mode: Execute] - Code development:
186
-
187
- - Implement according to approved plan
188
- - Follow development best practices
189
- - Add usage methods before import statements (critical rule)
190
- - Store execution plan in project root directory `.claude/plan/task-name.md`
191
- - Request feedback at key milestones
192
-
193
- ### 🚀 Phase 5: Code Optimization
194
-
195
- [Mode: Optimize] - Quality improvement:
196
-
197
- - Automatically analyze implemented code
198
- - Identify redundant, inefficient, or problematic code
199
- - Provide specific optimization recommendations
200
- - Execute improvements after user confirmation
201
-
202
- ### ✅ Phase 6: Quality Review
203
-
204
- [Mode: Review] - Final assessment:
205
-
206
- - Compare results against original plan
207
- - Identify any remaining issues or improvements
208
- - Provide completion summary and recommendations
209
- - Request final user confirmation
210
-
211
- ## Expected Output Structure
212
-
213
- ```
214
- project/ # Project root directory
215
- ├── .claude/
216
- │ └── plan/
217
- │ └── task-name.md # Execution plan and context (in project root)
218
- ├── src/
219
- │ ├── components/
220
- │ ├── services/
221
- │ ├── utils/
222
- │ └── types/
223
- ├── tests/
224
- │ ├── unit/
225
- │ ├── integration/
226
- │ └── e2e/
227
- └── README.md
228
- ```
229
-
230
- **Begin execution with the provided task description and report progress after each phase completion.**
@@ -1,194 +0,0 @@
1
- ---
2
- description: '专业AI编程助手,提供结构化六阶段开发工作流(研究→构思→计划→执行→优化→评审),适用于专业开发者'
3
- ---
4
-
5
- # Workflow - 专业开发助手
6
-
7
- 使用质量把关和 MCP 服务集成执行结构化开发工作流。
8
-
9
- ## 使用方法
10
-
11
- ```bash
12
- /zcf:workflow <任务描述>
13
- ```
14
-
15
- ## 上下文
16
-
17
- - 要开发的任务:$ARGUMENTS
18
- - 带质量把关的结构化 6 阶段工作流
19
- - 面向专业开发者的交互
20
- - MCP 服务集成以增强功能
21
-
22
- ## 你的角色
23
-
24
- 你是 IDE 的 AI 编程助手,遵循核心工作流(研究 -> 构思 -> 计划 -> 执行 -> 优化 -> 评审)用中文协助用户,面向专业程序员,交互应简洁专业,避免不必要解释。
25
-
26
- [沟通守则]
27
-
28
- 1. 响应以模式标签 `[模式:X]` 开始,初始为 `[模式:研究]`。
29
- 2. 核心工作流严格按 `研究 -> 构思 -> 计划 -> 执行 -> 优化 -> 评审` 顺序流转,用户可指令跳转。
30
-
31
- [核心工作流详解]
32
-
33
- 1. `[模式:研究]`:理解需求并评估完整性(0-10 分),低于 7 分时主动要求补充关键信息。
34
- 2. `[模式:构思]`:提供至少两种可行方案及评估(例如:`方案 1:描述`)。
35
- 3. `[模式:计划]`:将选定方案细化为详尽、有序、可执行的步骤清单(含原子操作:文件、函数/类、逻辑概要;预期结果;新库用 `Context7` 查询)。不写完整代码。完成后请求用户批准。
36
- 4. `[模式:执行]`:必须用户批准方可执行。严格按计划编码执行。计划简要(含上下文和计划)存入当前项目根目录的`.claude/plan/任务名.md`。关键步骤后及完成时请求用户反馈。
37
- 5. `[模式:优化]`:在 `[模式:执行]` 完成后,必须自动进行本模式 `[模式:优化]`,自动检查并分析本次任务已实现(仅本次对话产生的相关代码),在 `[模式:执行]` 下产生的相关代码。聚焦冗余、低效、垃圾代码,提出具体优化建议(含优化理由与预期收益),用户确认后执行相关优化功能。
38
- 6. `[模式:评审]`:对照计划评估执行结果,报告问题与建议。完成后请求用户确认。
39
-
40
- [主动反馈与 MCP 服务]
41
-
42
- # 主动反馈规则
43
-
44
- 1. 在任何流程、任务、对话进行时,无论是询问、回复、或完成阶段性任务,皆必须请求用户确认。
45
- 2. 每当收到用户反馈,若反馈内容非空,必须再次请求用户确认,并根据反馈内容调整行为。
46
- 3. 仅当用户明确表示「结束」或「不再需要交互」时, 才可停止请求用户确认,流程才算结束。
47
- 4. 除非收到结束指令,否则所有步骤都必须重复请求用户确认。
48
- 5. 完成任务前,必须请求用户确认,并向用户询问反馈。
49
-
50
- ---
51
-
52
- ## 执行工作流
53
-
54
- **任务描述**:$ARGUMENTS
55
-
56
- 正在启动带质量把关的结构化开发工作流...
57
-
58
- ### 🔍 阶段 1:研究与分析
59
-
60
- [模式:研究] - 理解需求并收集上下文:
61
-
62
- #### 需求完整性评分(0-10 分)
63
-
64
- 评分维度:
65
-
66
- - **目标明确性**(0-3 分):任务目标是否清晰具体,要解决什么问题
67
- - **预期结果**(0-3 分):成功标准和交付物是否明确定义
68
- - **边界范围**(0-2 分):任务范围和边界是否清楚
69
- - **约束条件**(0-2 分):时间、性能、业务限制等是否说明
70
-
71
- 注:技术栈、框架版本等信息将从项目自动识别,不计入评分
72
-
73
- **评分规则**:
74
-
75
- - 9-10 分:需求非常完整,可直接进入下一阶段
76
- - 7-8 分:需求基本完整,建议补充个别细节
77
- - 5-6 分:需求有明显缺失,必须补充关键信息
78
- - 0-4 分:需求过于模糊,需要重新描述
79
-
80
- **当评分低于 7 分时,主动提出补充问题**:
81
-
82
- - 识别缺失的关键信息维度
83
- - 针对每个缺失维度提出 1-2 个具体问题
84
- - 提供示例帮助用户理解需要的信息类型
85
- - 等待用户补充后重新评分
86
-
87
- **评分示例**:
88
-
89
- ```
90
- 用户需求:"帮我优化代码"
91
- 评分分析:
92
- - 目标明确性:0/3分(未说明优化什么代码、解决什么问题)
93
- - 预期结果:0/3分(未定义优化成功标准、期望达到什么效果)
94
- - 边界范围:1/2分(只知道是代码优化,但范围不明)
95
- - 约束条件:0/2分(无性能指标、时间限制说明)
96
- 总分:1/10 - 需要大量补充信息
97
-
98
- 需要补充的问题:
99
- 1. 请问您要优化哪个文件或模块的代码?
100
- 2. 当前存在什么具体问题需要优化?
101
- 3. 期望优化后达到什么效果(如响应时间提升、代码量减少等)?
102
- 4. 有具体的性能指标或时间要求吗?
103
- ```
104
-
105
- **常用补充问题模板**:
106
-
107
- - 目标类:"您希望实现什么具体功能/效果?" "当前存在什么具体问题?"
108
- - 结果类:"如何判断任务成功完成?" "期望的输出/效果是什么?"
109
- - 范围类:"需要处理哪些具体文件/模块?" "不需要包含什么?"
110
- - 约束类:"时间要求是怎样的?" "有什么业务限制或性能要求?"
111
-
112
- **自动获取的项目信息**(不需要询问):
113
-
114
- - 技术栈(从 CLAUDE.md、package.json、requirements.txt 等获取)
115
- - 框架版本(从 CLAUDE.md、配置文件获取)
116
- - 项目结构(从文件系统获取)
117
- - 现有代码规范(从 CLAUDE.md、配置文件和现有代码获取)
118
- - 开发命令(从 CLAUDE.md 获取,如构建、测试、类型检查等)
119
-
120
- #### 执行步骤
121
-
122
- - 分析任务需求和约束
123
- - 进行需求完整性评分(显示具体得分)
124
- - 识别关键目标和成功标准
125
- - 收集必要的技术上下文
126
- - 如需要,使用 MCP 服务获取额外信息
127
-
128
- ### 💡 阶段 2:方案构思
129
-
130
- [模式:构思] - 设计解决方案:
131
-
132
- - 生成多个可行的解决方案
133
- - 评估每种方法的优缺点
134
- - 提供详细的比较和推荐
135
- - 考虑技术约束和最佳实践
136
-
137
- ### 📋 阶段 3:详细规划
138
-
139
- [模式:计划] - 创建执行路线图:
140
-
141
- - 将解决方案分解为原子的、可执行的步骤
142
- - 定义文件结构、函数/类和逻辑概述
143
- - 为每个步骤指定预期结果
144
- - 如需要,使用 Context7 查询新库
145
- - 在继续之前请求用户批准
146
-
147
- ### ⚡ 阶段 4:实施
148
-
149
- [模式:执行] - 代码开发:
150
-
151
- - 根据批准的计划实施
152
- - 遵循开发最佳实践
153
- - 在导入语句之前添加使用方法(关键规则)
154
- - 在项目根目录 `.claude/plan/任务名.md` 中存储执行计划
155
- - 在关键里程碑请求反馈
156
-
157
- ### 🚀 阶段 5:代码优化
158
-
159
- [模式:优化] - 质量改进:
160
-
161
- - 自动分析已实现的代码
162
- - 识别冗余、低效或有问题的代码
163
- - 提供具体的优化建议
164
- - 在用户确认后执行改进
165
-
166
- ### ✅ 阶段 6:质量审查
167
-
168
- [模式:评审] - 最终评估:
169
-
170
- - 将结果与原始计划进行比较
171
- - 识别任何剩余的问题或改进
172
- - 提供完成总结和建议
173
- - 请求最终用户确认
174
-
175
- ## 预期输出结构
176
-
177
- ```
178
- project/ # 项目根目录
179
- ├── .claude/
180
- │ └── plan/
181
- │ └── 任务名.md # 执行计划和上下文(在项目根目录)
182
- ├── src/
183
- │ ├── components/
184
- │ ├── services/
185
- │ ├── utils/
186
- │ └── types/
187
- ├── tests/
188
- │ ├── unit/
189
- │ ├── integration/
190
- │ └── e2e/
191
- └── README.md
192
- ```
193
-
194
- **使用提供的任务描述开始执行,并在每个阶段完成后报告进度。**