ai-workflow-init 1.3.1 → 3.0.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.
@@ -1,22 +1,31 @@
1
- Compare current implementation against planning and implementation notes.
2
-
3
- ## Workflow Alignment
4
- - Provide brief status updates (1–3 sentences) before/after important actions.
5
- - Provide a high-signal summary at completion highlighting key mismatches and next steps.
6
-
7
- 1) Ask me for:
8
- - Feature name (if not provided)
9
- - Then locate docs by feature name:
10
- - Planning: `docs/ai/planning/feature-{name}.md`
11
- - Implementation (optional): `docs/ai/implementation/feature-{name}.md`
12
-
13
- 2) Validation Scope (no inference):
14
- - Verify code follows the acceptance criteria from the planning doc
15
- - Verify code matches the steps/changes in the implementation notes (when present)
16
- - Do NOT invent or infer alternative logic beyond what the docs specify
17
-
18
- 3) Output
19
- - List concrete mismatches between code and docs
20
- - List missing pieces the docs require but code lacks
21
- - Short actionable next steps
22
-
1
+ ---
2
+ name: check-implementation
3
+ description: Validates implementation against planning doc.
4
+ ---
5
+
6
+ Compare current implementation against planning doc.
7
+
8
+ ## Workflow Alignment
9
+
10
+ - Provide brief status updates (1–3 sentences) before/after important actions.
11
+ - Provide a high-signal summary at completion highlighting key mismatches and next steps.
12
+
13
+ 1. Ask me for:
14
+
15
+ - Feature name (if not provided)
16
+ - Then locate planning doc by feature name:
17
+ - Planning: `docs/ai/planning/feature-{name}.md`
18
+
19
+ 2. Validation Scope (no inference):
20
+
21
+ - Verify code follows the acceptance criteria from the planning doc
22
+ - Verify code matches the steps/changes in the implementation plan phases
23
+ - Check that completed tasks (marked `[x]`) have corresponding code changes
24
+ - Do NOT invent or infer alternative logic beyond what the docs specify
25
+
26
+ 3. Output
27
+
28
+ - List concrete mismatches between code and planning doc
29
+ - List missing pieces the planning doc requires but code lacks
30
+ - List tasks marked complete `[x]` but code not implemented
31
+ - Short actionable next steps
@@ -1,95 +1,136 @@
1
- ## Goal
2
-
3
- Generate a planning doc at `docs/ai/planning/feature-{name}.md` using the template, with minimal, actionable content aligned to the 4-phase workflow. Also initialize the implementation doc at `docs/ai/implementation/feature-{name}.md` based on the implementation template.
4
-
5
- ## Workflow Alignment
6
-
7
- - Provide brief status updates (1–3 sentences) before/after important actions.
8
- - For medium/large tasks, create todos (≤14 words, verb-led). Keep only one `in_progress` item.
9
- - Update todos immediately after progress; mark completed upon finish.
10
-
11
- ## Step 1: Clarify Scope (Focused Q&A Guidelines)
12
-
13
- Purpose: the agent MUST generate a short, numbered Q&A for the user to clarify scope; keep it relevant, avoid off-topic, and do not build a static question bank.
14
-
15
- Principles:
16
-
17
- - Quickly classify context: a) Micro-UI, b) Page/Flow, c) Service/API/Data, d) Cross-cutting.
18
- - Ask only what is missing to produce Goal, Tasks, Risks, and DoD. Keep to 3–7 questions.
19
- - Do not re-ask what the user already stated; if ambiguous, confirm briefly (yes/no or single choice).
20
- - Keep each question short and single-purpose; avoid multi-part questions.
21
- - Answers may be a/b/c or free text; the agent is not required to present fixed option lists.
22
-
23
- Output format for Q&A:
24
-
25
- - Number questions sequentially starting at 1 (e.g., "1.", "2.").
26
- - Under each question, provide 2–4 suggested options labeled with lowercase letters + ")" (e.g., "a)", "b)").
27
- - Keep options short (≤7 words) and add an "other" when useful.
28
- - Example:
29
- 1. UI library?
30
- a) TailwindCSS b) Bootstrap c) SCSS d) Other
31
-
32
- Scope checklist to cover (ask only missing items, based on context):
33
-
34
- 1. Problem & Users: the core problem and target user groups.
35
- 2. In-scope vs Out-of-scope: what is included and excluded (e.g., MVP, no i18n, no payments).
36
- 3. Acceptance Criteria (GWT): 2–3 key Given–When–Then scenarios.
37
- 4. Constraints & Dependencies: technical constraints, libraries, real API vs mock, deadlines, external deps.
38
- 5. Risks & Assumptions: known risks and key assumptions.
39
- 6. Tasks Overview: 3–7 high-level work items.
40
- 7. Definition of Done: completion criteria (build/test/docs/review).
41
-
42
- Adaptive behavior:
43
-
44
- - Always reduce questions to what is necessary; once Goal/Tasks/Risks/DoD can be written, stop asking.
45
- - Prioritize clarifying scope and acceptance criteria before implementation details.
46
- - If the user already specified items (framework, API/Mock, deadlines, etc.), confirm briefly only.
47
-
48
- Then collect inputs (after Q&A):
49
-
50
- - Feature name (kebab-case, e.g., `user-authentication`)
51
- - Short goal and scope
52
- - High-level tasks overview (3–7 items)
53
- - Definition of Done (build/test/review/docs)
54
-
55
- ## Step 2: Load Templates
56
-
57
- **Before creating docs, read the following files:**
58
-
59
- - `docs/ai/planning/feature-template.md` - Template structure to follow
60
- - `docs/ai/implementation/feature-template.md` - Template structure to follow for the implementation doc
61
-
62
- This template defines the required structure and format. Use it as the baseline for creating the planning doc.
63
-
64
- ## Step 3: Draft the Plan (auto-generate)
65
-
66
- Using the Q&A results and templates, immediately generate the plan without asking for confirmation.
67
-
68
- Auto-name feature:
69
-
70
- - Derive `feature-{name}` from user prompt + Q&A (kebab-case, concise, specific).
71
- - Example: "Login Page (HTML/CSS)" → `feature-login-page`.
72
- - If a file with the same name already exists, append a numeric suffix: `feature-{name}-2`, `feature-{name}-3`, ...
73
-
74
- Create the following files automatically and populate initial content:
75
-
76
- - `docs/ai/planning/feature-{name}.md` - Use structure from `feature-template.md`
77
- - `docs/ai/implementation/feature-{name}.md` - Use structure from `docs/ai/implementation/feature-template.md` (read this template before writing)
78
-
79
- Notify the user when done.
80
-
81
- Produce a Markdown doc following the template structure:
82
-
83
- - Match sections from `docs/ai/planning/feature-template.md`
84
- - Fill in content from Q&A inputs
85
- - Ensure all required sections are present
86
-
87
- ## Step 4: Next Actions
88
-
89
- Suggest running `execute-plan` to begin task execution. Implementation work will be driven from `docs/ai/implementation/feature-{name}.md` as the task source.
90
- Note: Test documentation will be created separately using the `writing-test` command.
91
-
92
- ## Notes
93
-
94
- - This command creates the planning doc and initializes the implementation doc; it does not modify unrelated existing files.
95
- - Idempotent: safe to re-run; auto-appends numeric suffix if files exist.
1
+ ---
2
+ name: create-plan
3
+ description: Generates a feature planning doc with implementation details.
4
+ ---
5
+
6
+ ## Goal
7
+
8
+ Generate a single planning doc at `docs/ai/planning/feature-{name}.md` using the template, with goal, acceptance criteria, risks, and detailed implementation phases with pseudo-code.
9
+
10
+ ## Workflow Alignment
11
+
12
+ - Provide brief status updates (1–3 sentences) before/after important actions.
13
+ - For medium/large tasks, create todos (≤14 words, verb-led). Keep only one `in_progress` item.
14
+ - Update todos immediately after progress; mark completed upon finish.
15
+
16
+ ## Step 1: Clarify Scope (Focused Q&A Guidelines)
17
+
18
+ Purpose: the agent MUST generate a short, numbered Q&A for the user to clarify scope; keep it relevant, avoid off-topic, and do not build a static question bank.
19
+
20
+ Principles:
21
+
22
+ - Quickly classify context: a) Micro-UI, b) Page/Flow, c) Service/API/Data, d) Cross-cutting.
23
+ - Ask only what is missing to produce Goal, Tasks, Risks, and DoD. Keep to 3–7 questions.
24
+ - Do not re-ask what the user already stated; if ambiguous, confirm briefly (yes/no or single choice).
25
+ - Keep each question short and single-purpose; avoid multi-part questions.
26
+ - Answers may be a/b/c or free text; the agent is not required to present fixed option lists.
27
+
28
+ Output format for Q&A:
29
+
30
+ - Number questions sequentially starting at 1 (e.g., "1.", "2.").
31
+ - Under each question, provide 2–4 suggested options labeled with lowercase letters + ")" (e.g., "a)", "b)").
32
+ - Keep options short (≤7 words) and add an "other" when useful.
33
+ - Example:
34
+ 1. UI library?
35
+ a) TailwindCSS b) Bootstrap c) SCSS d) Other
36
+
37
+ Scope checklist to cover (ask only missing items, based on context):
38
+
39
+ 1. Problem & Users: the core problem and target user groups.
40
+ 2. In-scope vs Out-of-scope: what is included and excluded (e.g., MVP, no i18n, no payments).
41
+ 3. Acceptance Criteria (GWT): 2–3 key Given–When–Then scenarios.
42
+ 4. Constraints & Dependencies: technical constraints, libraries, real API vs mock, deadlines, external deps.
43
+ 5. Risks & Assumptions: known risks and key assumptions.
44
+ 6. Tasks Overview: 3–7 high-level work items.
45
+ 7. Definition of Done: completion criteria (build/test/docs/review).
46
+
47
+ Adaptive behavior:
48
+
49
+ - Always reduce questions to what is necessary; once Goal/Tasks/Risks/DoD can be written, stop asking.
50
+ - Prioritize clarifying scope and acceptance criteria before implementation details.
51
+ - If the user already specified items (framework, API/Mock, deadlines, etc.), confirm briefly only.
52
+
53
+ Then collect inputs (after Q&A):
54
+
55
+ - Feature name (kebab-case, e.g., `user-authentication`)
56
+ - Short goal and scope
57
+ - High-level tasks overview (3–7 items)
58
+ - Definition of Done (build/test/review/docs)
59
+
60
+ ## Step 2: Load Template
61
+
62
+ **Before creating the plan doc, read the following file:**
63
+
64
+ - `docs/ai/planning/feature-template.md` - Template structure to follow
65
+
66
+ This template defines the required structure and format. Use it as the baseline for creating the planning doc.
67
+
68
+ ## Step 3: Draft the Plan (auto-generate)
69
+
70
+ Using the Q&A results and template, immediately generate the plan without asking for confirmation.
71
+
72
+ Auto-name feature:
73
+
74
+ - Derive `feature-{name}` from user prompt + Q&A (kebab-case, concise, specific).
75
+ - Example: "Login Page (HTML/CSS)" → `feature-login-page`.
76
+ - If a file with the same name already exists, append a numeric suffix: `feature-{name}-2`, `feature-{name}-3`, ...
77
+
78
+ ### Generate Single Planning Doc
79
+
80
+ Produce a Markdown doc following `docs/ai/planning/feature-template.md` with all 5 sections:
81
+
82
+ 1. **Goal & Acceptance Criteria**: Brief goal + Given-When-Then scenarios
83
+ 2. **Risks & Assumptions**: Known risks and key assumptions
84
+ 3. **Definition of Done**: Build/test/review/docs checklist
85
+ 4. **Implementation Plan**:
86
+ - Summary: Brief description of solution approach (1-3 sentences)
87
+ - Phases: Detailed tasks with pseudo-code
88
+ 5. **Follow-ups**: TODOs or deferred work
89
+
90
+ **Estimate phase scope**:
91
+ - Count total tasks from Q&A
92
+ - If tasks ≤ 5: use single phase named "Core Implementation"
93
+ - If tasks 6–12: suggest 2–3 phases (group by feature area or dependency order)
94
+ - If tasks > 12: suggest 3–5 phases; prioritize logical grouping
95
+
96
+ **For each phase, generate**:
97
+ - Phase name (descriptive, e.g., "Database Schema Setup", "API Endpoints", "UI Components")
98
+ - Tasks list: `[ ] [ACTION] path/to/file — Summary`
99
+ - Pseudo-code outline (show logic structure, not real code):
100
+ ```
101
+ Pseudo-code:
102
+ - [Step 1]: what will be done
103
+ - [Step 2]: validation or check
104
+ - [Step 3]: data storage/return
105
+ ```
106
+
107
+ **Pseudo-code guidelines**:
108
+ - Keep to 3–5 lines per task
109
+ - Show inputs, key logic, outputs
110
+ - Use natural language, not actual syntax
111
+ - Example for "Create user endpoint":
112
+ ```
113
+ Pseudo-code:
114
+ - Parse username + password from request
115
+ - Validate password strength
116
+ - Hash password with bcrypt
117
+ - Store user in database
118
+ - Return success + user ID
119
+ ```
120
+
121
+ Create the file automatically:
122
+
123
+ - `docs/ai/planning/feature-{name}.md` - Use complete structure from `feature-template.md`
124
+
125
+ Notify the user when done with summary: "Created plan with X phases: Phase 1 (name), Phase 2 (name), ..."
126
+
127
+ ## Step 4: Next Actions
128
+
129
+ Suggest running `execute-plan` to begin task execution. Implementation work will be driven from `docs/ai/planning/feature-{name}.md` as the task source.
130
+
131
+ Note: Test documentation will be created separately using the `writing-test` command.
132
+
133
+ ## Notes
134
+
135
+ - This command creates a single planning doc with both overview and implementation details.
136
+ - Idempotent: safe to re-run; auto-appends numeric suffix if files exist.
@@ -1,109 +1,141 @@
1
- ## Goal
2
-
3
- Execute the feature plan by implementing tasks from the implementation doc and persisting notes to docs.
4
-
5
- ## Workflow Alignment
6
-
7
- - Provide brief status updates (1–3 sentences) before each operation.
8
- - For medium/large tasks, create todos (≤14 words, verb-led). Keep only one `in_progress` item.
9
- - Update todos immediately after progress; mark completed upon finish.
10
- - Perform edits via file editing tools, not by printing code for copy-paste.
11
-
12
- ### Prerequisites
13
-
14
- - Feature name (kebab-case, e.g., `user-authentication`)
15
- - Implementation doc exists: `docs/ai/implementation/feature-{name}.md`
16
- - Planning doc exists: `docs/ai/planning/feature-{name}.md` (reference only; tasks are driven by implementation doc)
17
-
18
- ## Step 1: Gather Context
19
-
20
- - Ask for feature name if not provided (must be kebab-case).
21
- - Load implementation doc: `docs/ai/implementation/feature-{name}.md`.
22
- - **Load template:** Read `docs/ai/implementation/feature-template.md` to understand required structure.
23
-
24
- ## Step 2: Build Task Queue
25
-
26
- - Parse tasks (checkboxes `[ ]`, `[x]`) from the implementation doc:
27
- - Primary source: `## Changes` section with `[ ] [ACTION] ...` entries.
28
- - For `[MODIFIED]` files, parse sub-bullets representing distinct logic items with line ranges.
29
- - Optionally include other `[ ]` sections (e.g., `## Follow-ups`) if designated in-scope.
30
- - Build prioritized task queue (top-to-bottom unless dependencies block).
31
- - Identify blocked tasks and note reasons.
32
-
33
- ## Step 3: Implement Iteratively (per task)
34
-
35
- For each task in queue:
36
-
37
- 1. **Status update**: Brief note (1–3 sentences) on what will be done.
38
- 2. Plan minimal change set:
39
- - Identify files/regions to modify
40
- - Map changes to acceptance criteria from plan (reference if needed)
41
- 3. Implement changes:
42
- - Write/edit code according to the implementation doc entries (`[ACTION]` items)
43
- - Keep changes minimal and incremental
44
- - Avoid speculative changes beyond implementation scope
45
- 4. Quick validation:
46
- - Run build/compile if available
47
- - Run fast unit/smoke tests if available
48
- - Fix immediate issues before proceeding
49
- 5. Persist notes to implementation doc:
50
- - File: `docs/ai/implementation/feature-{name}.md`
51
- - Update the relevant `[ ]` entry to `[x]` when completed
52
- - For `MODIFIED` files with sub-bullets, mark each completed sub-bullet `[x]`
53
- - Include line ranges and concise summaries as per template
54
- 6. Update implementation doc:
55
- - Mark completed tasks `[x]` with brief notes
56
- - Mark blocked tasks with reason
57
- - Do not mirror completion state in the planning doc
58
-
59
- ## Step 4: Implementation Doc Structure
60
-
61
- **Before creating the implementation doc, ensure you have read:**
62
-
63
- - `docs/ai/implementation/feature-template.md` - Template structure to follow
64
-
65
- If creating implementation doc for the first task (should already exist from create-plan):
66
-
67
- - Use the structure from `feature-template.md` exactly
68
- - Ensure these sections exist:
69
- - `# Implementation Notes: {Feature Name}`
70
- - `## Summary` - Brief description of overall approach
71
- - `## Changes` Use `[ ] [ACTION] ...` format with allowed actions ADDED | MODIFIED | DELETED | RENAMED
72
- - For MODIFIED, use sub-bullets with line ranges and per-logic summaries
73
- - `## Edge Cases` - List of handled edge cases
74
- - `## Follow-ups` - TODOs or deferred work
75
- - `## Execution Discipline`
76
-
77
- ## Step 5: Quality Checks
78
-
79
- After completing Step 4 for each task batch:
80
-
81
- - Detect available tools from project config (e.g., `package.json`, `pyproject.toml`, `go.mod`, `Cargo.toml`, build files) and run the appropriate non-interactive checks.
82
- - Linting on changed files (prefer non-interactive):
83
- - JavaScript/TypeScript: `npx eslint .` or `pnpm eslint .` (add `--max-warnings=0` if desired)
84
- - Python: `ruff .` or `flake8 .`
85
- - Go: `golangci-lint run` or `go vet ./...`
86
- - Rust: `cargo clippy -- -D warnings`
87
- - Java: `./gradlew check` or `mvn -q -DskipTests=false -Dspotbugs.failOnError=true verify`
88
- - Scope to changed files when possible for speed
89
- - Type checks (non-emitting where applicable):
90
- - TypeScript: `npx tsc --noEmit`
91
- - Python: `mypy .` (if configured) or `pyright` if present
92
- - Go/Rust/Java: rely on compiler/type system via build step
93
- - Parallelize lint and type-check when safe; fix issues (up to 3 attempts) before proceeding.
94
-
95
- ## Step 6: Next Actions
96
-
97
- After completing tasks:
98
-
99
- - Suggest running `code-review` to verify against standards
100
- - Suggest running `writing-test` if edge cases need coverage
101
- - Suggest running `check-implementation` to validate alignment with implementation entries
102
-
103
- ## Notes
104
-
105
- - Keep code changes minimal and focused on implementation tasks
106
- - Document all changes in the implementation doc; use checkboxes to track progress
107
- - Avoid implementing features not in the implementation doc scope
108
- - Modifies source code per implementation scope; updates `docs/ai/implementation/feature-{name}.md`. Does not modify unrelated files.
109
- - Idempotent: safe to re-run; updates checkboxes deterministically.
1
+ ---
2
+ name: execute-plan
3
+ description: Executes the planning doc tasks, edits code, and persists notes.
4
+ ---
5
+
6
+ ## Goal
7
+
8
+ Execute the feature plan by implementing tasks from the planning doc and updating task checkboxes as work progresses.
9
+
10
+ ## Workflow Alignment
11
+
12
+ - Provide brief status updates (1–3 sentences) before each operation.
13
+ - For medium/large tasks, create todos (≤14 words, verb-led). Keep only one `in_progress` item.
14
+ - Update todos immediately after progress; mark completed upon finish.
15
+ - Perform edits via file editing tools, not by printing code for copy-paste.
16
+
17
+ ### Prerequisites
18
+
19
+ - Feature name (kebab-case, e.g., `user-authentication`)
20
+ - Planning doc exists: `docs/ai/planning/feature-{name}.md`
21
+
22
+ ## Step 1: Gather Context
23
+
24
+ - Ask for feature name if not provided (must be kebab-case).
25
+ - Load planning doc: `docs/ai/planning/feature-{name}.md`.
26
+ - **Load template:** Read `docs/ai/planning/feature-template.md` to understand required structure.
27
+
28
+ ### 1a: Phase Progress Detection
29
+
30
+ If planning doc exists, scan for phase markers (`### Phase X:`):
31
+
32
+ - **Count total phases** in the document
33
+ - **Detect last completed phase**: Find the highest phase where ALL tasks (checkbox `[x]`) are marked complete
34
+ - **Detect current phase**: Find the first phase with incomplete tasks (`[ ]` marks)
35
+ - **Show summary to user**:
36
+
37
+ ```
38
+ Found 3 phases.
39
+ - Phase 1 (Database Setup): Complete [x]
40
+ - Phase 2 (API Endpoints): In Progress [2/4 tasks done]
41
+ - Phase 3 (Frontend): Not Started
42
+
43
+ Resuming Phase 2...
44
+ ```
45
+
46
+ If no phases detected (old format):
47
+
48
+ - Treat entire "Implementation Plan" section as single phase (backward compatible)
49
+
50
+ ## Step 2: Build Task Queue
51
+
52
+ - Parse tasks (checkboxes `[ ]`, `[x]`) from **current phase only** (from phase detection in Step 1a):
53
+ - Primary source: Tasks under `### Phase X:` with `[ ] [ACTION] ...` entries (incomplete only).
54
+ - For `[MODIFIED]` files, parse sub-bullets representing distinct logic items with line ranges.
55
+ - **Skip completed phases** entirely (do not re-execute)
56
+ - Build prioritized task queue (top-to-bottom unless dependencies block).
57
+ - Identify blocked tasks and note reasons.
58
+
59
+ Note: Do not include Follow-ups section unless explicitly in current phase.
60
+
61
+ ## Step 3: Implement Iteratively (per task)
62
+
63
+ For each task in queue:
64
+
65
+ 1. **Status update**: Brief note (1–3 sentences) on what will be done.
66
+ 2. Plan minimal change set:
67
+ - Identify files/regions to modify
68
+ - Map changes to acceptance criteria from plan (reference if needed)
69
+ 3. Implement changes:
70
+ - Write/edit code according to the planning doc entries (`[ACTION]` items)
71
+ - Keep changes minimal and incremental
72
+ - Avoid speculative changes beyond implementation scope
73
+ 4. Quick validation:
74
+ - Run build/compile if available
75
+ - Run fast unit/smoke tests if available
76
+ - Fix immediate issues before proceeding
77
+ 5. Persist notes to planning doc:
78
+ - File: `docs/ai/planning/feature-{name}.md`
79
+ - Update the relevant `[ ]` entry to `[x]` when completed
80
+ - For `MODIFIED` files with sub-bullets, mark each completed sub-bullet `[x]`
81
+ - Include line ranges and concise summaries as per template
82
+ 6. Update planning doc:
83
+ - Mark completed tasks `[x]` with brief notes
84
+ - Mark blocked tasks with reason
85
+
86
+ ## Step 4: Quality Checks
87
+
88
+ After completing each task batch:
89
+
90
+ - Detect available tools from project config (e.g., `package.json`, `pyproject.toml`, `go.mod`, `Cargo.toml`, build files) and run the appropriate non-interactive checks.
91
+ - Linting on changed files (prefer non-interactive):
92
+ - JavaScript/TypeScript: `npx eslint .` or `pnpm eslint .` (add `--max-warnings=0` if desired)
93
+ - Python: `ruff .` or `flake8 .`
94
+ - Go: `golangci-lint run` or `go vet ./...`
95
+ - Rust: `cargo clippy -- -D warnings`
96
+ - Java: `./gradlew check` or `mvn -q -DskipTests=false -Dspotbugs.failOnError=true verify`
97
+ - Scope to changed files when possible for speed
98
+ - Type checks (non-emitting where applicable):
99
+ - TypeScript: `npx tsc --noEmit`
100
+ - Python: `mypy .` (if configured) or `pyright` if present
101
+ - Go/Rust/Java: rely on compiler/type system via build step
102
+ - Parallelize lint and type-check when safe; fix issues (up to 3 attempts) before proceeding.
103
+
104
+ ## Step 5: Phase Completion Check
105
+
106
+ After completing all tasks in current phase:
107
+
108
+ 1. **Mark phase complete** in planning doc (optional visual marker)
109
+ 2. **Check remaining phases**:
110
+ - If more incomplete phases exist:
111
+ ```
112
+ ✓ Phase 2 complete!
113
+ Ready for Phase 3 (Frontend)?
114
+ Run: /execute-plan
115
+ ```
116
+ - If this is final phase:
117
+ ```
118
+ ✓ All phases complete!
119
+ Ready for code review?
120
+ Run: /code-review
121
+ ```
122
+
123
+ ## Step 6: Next Actions
124
+
125
+ After all phases complete:
126
+
127
+ - Suggest running `code-review` to verify against standards
128
+ - Suggest running `writing-test` if edge cases need coverage
129
+ - Suggest running `check-implementation` to validate alignment with planning entries
130
+
131
+ If phases remain:
132
+
133
+ - User runs `/execute-plan` again; Phase detection (Step 1a) will resume correctly
134
+
135
+ ## Notes
136
+
137
+ - Keep code changes minimal and focused on planning tasks
138
+ - Document all changes by updating checkboxes in the planning doc
139
+ - Avoid implementing features not in the planning doc scope
140
+ - Modifies source code per planning scope; updates `docs/ai/planning/feature-{name}.md`. Does not modify unrelated files.
141
+ - Idempotent: safe to re-run; updates checkboxes deterministically.
@@ -0,0 +1,208 @@
1
+ ---
2
+ name: modify-plan
3
+ description: Modify plan and code after implementation; support revert or apply new approach.
4
+ ---
5
+
6
+ ## Goal
7
+
8
+ Modify a feature plan after partial/full implementation. Support reverting to a previous git state or applying new requirement changes with both code and documentation sync.
9
+
10
+ ## Prerequisites
11
+
12
+ - Feature name (kebab-case, e.g., `user-authentication`)
13
+ - Planning doc exists: `docs/ai/planning/feature-{name}.md`
14
+ - Git repo initialized (for tracking code state)
15
+
16
+ ## Workflow Alignment
17
+
18
+ - Provide brief status updates (1–3 sentences) before/after important actions.
19
+ - Update planning doc when making changes.
20
+ - Do NOT auto-commit; user reviews all changes before pushing.
21
+
22
+ ## Step 1: Load Current State
23
+
24
+ Ask for feature name (must be kebab-case).
25
+
26
+ Load and summarize:
27
+
28
+ 1. **Planning doc**: Current goal, scope, implementation phases, completion status
29
+
30
+ Display summary:
31
+
32
+ ```
33
+ Feature: user-authentication
34
+ Plan: Create user login + registration endpoints
35
+
36
+ Implementation Progress:
37
+ - Phase 1 (Database): Complete [x]
38
+ Files: src/db/schema.ts
39
+ - Phase 2 (API Endpoints): In Progress [3/4]
40
+ Files: src/api/users.ts, src/api/auth.ts
41
+ - Phase 3 (Frontend): Not Started [ ]
42
+ Files: src/components/Login.tsx
43
+
44
+ Total files touched: 4
45
+ ```
46
+
47
+ ## Step 2: Scope of Change (Q&A)
48
+
49
+ Ask user what's changing:
50
+
51
+ **1. Type of modification:**
52
+ a) Modify goal/scope (entire plan changes)
53
+ b) Modify specific phase(s) (tactical change)
54
+ c) Revert to previous approach (git reset)
55
+ d) Other (describe)
56
+
57
+ **2a. If modifying goal/scope:**
58
+
59
+ - What's the new goal/scope?
60
+ - How does it impact existing tasks?
61
+
62
+ **2b. If modifying specific phase(s):**
63
+
64
+ - Which phase(s)? (list by name)
65
+ - What requirement/approach is changing?
66
+
67
+ **2c. If reverting approach:**
68
+
69
+ - Show last 5 commits; ask which to revert to
70
+ - Or reset to specific phase (revert all code changes after phase X)?
71
+
72
+ ## Step 3: Apply Changes
73
+
74
+ ### Option A: Revert to Previous Git State
75
+
76
+ If user selects revert:
77
+
78
+ 1. **Identify affected files & changes**:
79
+
80
+ - Parse planning doc; list all files modified in affected phase(s)
81
+ - Show file list that needs reverting:
82
+ ```
83
+ Files to revert (manual):
84
+ - src/api/users.ts (lines 45–120)
85
+ - src/db/schema.ts (lines 10–30)
86
+ - tests/api.test.ts (delete entire file)
87
+ ```
88
+
89
+ 2. **Manual revert guidance**:
90
+
91
+ - For MODIFIED files: show current state vs. target state (code snippets/line ranges)
92
+ - For DELETED files: ask user to delete manually
93
+ - Ask: "Ready to manually revert these files?"
94
+
95
+ 3. **If user confirms**:
96
+
97
+ - User manually reverts files (copy-paste old code back, undo in IDE, etc.)
98
+ - Update planning doc:
99
+
100
+ - Mark affected phases/tasks `[ ]` (reset to pending)
101
+ - Add "Modification History" entry:
102
+
103
+ ```
104
+ ## Modification History
105
+
106
+ ### Revert [Date]: {Reason}
107
+ - **Reverted phases**: Phase X, Y
108
+ - **Reason**: [user provided]
109
+ - **Files manually reverted**: [list]
110
+ - **Affected tasks reset**: [ ] Task 1, [ ] Task 2, ...
111
+ ```
112
+
113
+ 4. **Result**: Docs updated; tasks reset; ready to re-implement with new approach
114
+
115
+ ### Option B: Apply New Changes
116
+
117
+ If user selects new approach:
118
+
119
+ 1. **Update planning doc**:
120
+
121
+ - Modify goal/scope section if changed
122
+ - Update affected task(s) with new approach
123
+ - Update pseudo-code to match new approach
124
+ - Add "Modification History" section:
125
+
126
+ ```
127
+ ## Modification History
128
+
129
+ ### Change [Date]: {Title}
130
+ - **Previous approach**: [original details]
131
+ - **New approach**: [new details]
132
+ - **Reason**: [user provided]
133
+ - **Affected phases**: Phase X, Y
134
+ ```
135
+
136
+ 2. **Update implementation phases**:
137
+
138
+ - For affected phases:
139
+ - Modify pseudo-code to match new approach
140
+ - Reset incomplete tasks `[ ]` (if approach changed significantly)
141
+ - Keep completed tasks as-is (do not re-implement)
142
+ - Update "Implementation Plan" section with new structure (files/logic outline)
143
+
144
+ 3. **Show git impact**:
145
+ - Highlight files that may need re-editing
146
+ - Ask: "Ready to re-implement with new approach?" (yes/no)
147
+
148
+ ## Step 4: Confirmation & Audit Trail
149
+
150
+ Before finalizing, show:
151
+
152
+ 1. **Updated planning doc** snippet (modified sections)
153
+ 2. **Git state** (files that will be changed)
154
+
155
+ Ask: **"Apply changes and update doc?"** (yes/no)
156
+
157
+ If **yes**:
158
+
159
+ - Save updated planning doc
160
+ - If revert: `git status` shows reverted files (unstaged)
161
+ - If new approach: doc updated; code changes staged for review
162
+
163
+ If **no**:
164
+
165
+ - Rollback changes to doc
166
+ - Discard any temporary changes
167
+
168
+ ## Step 5: Next Actions
169
+
170
+ **After manual revert**:
171
+
172
+ - "Docs updated. Affected tasks reset to `[ ]`. Run `/execute-plan` to re-implement Phase X with new approach."
173
+
174
+ **After apply new approach**:
175
+
176
+ - If only pseudo-code/docs changed (no code revert needed): "Continue current phase with `/execute-plan`."
177
+ - If code changes needed (revert old approach + implement new): "Manually update code files first, then run `/execute-plan`."
178
+ - "When done, run `/code-review` to validate standards."
179
+
180
+ ## Important Notes
181
+
182
+ - **Manual revert**: User manually reverts code files (no git reset); AI guides the process
183
+ - **Multi-feature safe**: Works when implementing multiple features simultaneously (selective revert possible)
184
+ - **Backward compatible**: Works with both phase-based and non-phase-based planning docs
185
+ - **Audit trail**: "Modification History" section preserves decision rationale and affected files
186
+ - **Idempotent**: Safe to re-run; modification history accumulates
187
+ - **Safe defaults**: Asks confirmation before any changes; user always has final say
188
+
189
+ ## Example Flow
190
+
191
+ ```
192
+ User: I want to modify plan
193
+ Agent: Load state, show summary
194
+
195
+ User: Revert Phase 2 (API Endpoints) - use different auth approach
196
+ Agent: Identify affected files (src/api/users.ts, src/api/auth.ts)
197
+ Show current state vs. target state (pseudo-code + old implementation)
198
+ Ask: Ready to manually revert these files?
199
+
200
+ User: Yes, I'll manually revert
201
+ Agent: (User manually copies old code back or undoes changes in IDE)
202
+ Update planning doc:
203
+ - Mark Phase 2 tasks [ ] (reset)
204
+ - Add Modification History: Phase 2 reverted, reason: better auth strategy
205
+
206
+ Agent: Phase 2 reset. Ready to re-implement with new auth approach?
207
+ Run: /execute-plan
208
+ ```
package/cli.js CHANGED
@@ -75,9 +75,9 @@ function cloneDocsAI(source, dest) {
75
75
  run(`npx degit ${source} ${tempDir} --force`);
76
76
 
77
77
  // Xử lý từng subfolder
78
- const subfolders = ["implementation", "planning", "testing"];
78
+ const subfolders = ["planning", "testing"];
79
79
 
80
- // Xử lý folders: implementation, planning, testing
80
+ // Xử lý folders: planning, testing
81
81
  for (const subfolder of subfolders) {
82
82
  const tempSubfolder = path.join(tempDir, subfolder);
83
83
  const destSubfolder = path.join(dest, subfolder);
@@ -171,9 +171,10 @@ function askIDE() {
171
171
  console.log("\n🤖 Which AI tool(s) do you want to setup?");
172
172
  console.log("1. Cursor");
173
173
  console.log("2. GitHub Copilot");
174
- console.log("3. Both");
174
+ console.log("3. Claude Code");
175
+ console.log("4. All");
175
176
 
176
- rl.question("\nEnter your choice (1-3): ", (answer) => {
177
+ rl.question("\nEnter your choice (1-4): ", (answer) => {
177
178
  rl.close();
178
179
  resolve(answer.trim());
179
180
  });
@@ -182,11 +183,12 @@ function askIDE() {
182
183
 
183
184
  async function main() {
184
185
  const choice = await askIDE();
185
- const installCursor = ["1", "3"].includes(choice);
186
- const installCopilot = ["2", "3"].includes(choice);
186
+ const installCursor = ["1", "4"].includes(choice);
187
+ const installCopilot = ["2", "4"].includes(choice);
188
+ const installClaudeCode = ["3", "4"].includes(choice);
187
189
 
188
- if (!["1", "2", "3"].includes(choice)) {
189
- console.error("❌ Invalid choice. Please enter 1, 2, or 3.");
190
+ if (!["1", "2", "3", "4"].includes(choice)) {
191
+ console.error("❌ Invalid choice. Please enter 1, 2, 3, or 4.");
190
192
  process.exit(1);
191
193
  }
192
194
 
@@ -201,6 +203,7 @@ async function main() {
201
203
  }
202
204
  step("🚚 Downloading Cursor agent commands (.cursor/commands)...");
203
205
  run(`npx degit ${REPO}/.cursor/commands .cursor/commands --force`);
206
+
204
207
  }
205
208
 
206
209
  // Clone GitHub Copilot prompts (luôn ghi đè)
@@ -210,6 +213,37 @@ async function main() {
210
213
  }
211
214
  step("🚚 Downloading GitHub Copilot prompts (.github/prompts)...");
212
215
  run(`npx degit ${REPO}/.github/prompts .github/prompts --force`);
216
+
217
+ }
218
+
219
+ // Clone Claude Code commands (luôn ghi đè)
220
+ if (installClaudeCode) {
221
+ if (!existsSync(".claude/commands")) {
222
+ mkdirSync(".claude/commands", { recursive: true });
223
+ }
224
+ step("🚚 Downloading Claude Code commands (.claude/commands)...");
225
+ run(`npx degit ${REPO}/.claude/commands .claude/commands --force`);
226
+
227
+ // Download CLAUDE.md (context memory) - only if not exists
228
+ step("🚚 Downloading Claude Code context memory (.claude/CLAUDE.md)...");
229
+ const claudeMdPath = ".claude/CLAUDE.md";
230
+ if (existsSync(claudeMdPath)) {
231
+ console.log(`⏭️ Skipping (already exists): ${claudeMdPath}`);
232
+ } else {
233
+ try {
234
+ run(`curl -fsSL ${RAW_BASE}/.claude/CLAUDE.md -o ${claudeMdPath}`);
235
+ } catch (_) {
236
+ run(`wget -qO ${claudeMdPath} ${RAW_BASE}/.claude/CLAUDE.md`);
237
+ }
238
+ }
239
+
240
+ // Download hooks.json (always overwrite to get latest)
241
+ step("🚚 Downloading Claude Code hooks (.claude/hooks.json)...");
242
+ try {
243
+ run(`curl -fsSL ${RAW_BASE}/.claude/hooks.json -o .claude/hooks.json`);
244
+ } catch (_) {
245
+ run(`wget -qO .claude/hooks.json ${RAW_BASE}/.claude/hooks.json`);
246
+ }
213
247
  }
214
248
 
215
249
  // Clone Cursor prompts (luôn ghi đè)
@@ -7,26 +7,42 @@ description: Feature planning docs and workflow guidelines
7
7
  # Planning Documentation
8
8
 
9
9
  ## Purpose
10
- This directory contains planning documents for individual features. Each feature follows a structured planning process before implementation.
10
+ This directory contains planning documents for individual features. Each feature plan includes both high-level goals and detailed implementation steps in a single file.
11
11
 
12
12
  ## Feature Planning Workflow
13
13
 
14
14
  ### Creating a Feature Plan
15
15
  Use the `create-plan` command to generate a new feature plan:
16
- - Command: `.cursor/commands/create-plan.md`
16
+ - Command: Available in `.cursor/commands/`, `.claude/commands/`, or `.github/prompts/`
17
17
  - Output: `docs/ai/planning/feature-{name}.md`
18
18
  - Template: `docs/ai/planning/feature-template.md`
19
19
 
20
20
  ### Feature Plan Structure
21
- Each feature plan follows the template structure:
22
- - **Goal**: Objectives, scope, acceptance criteria (Given-When-Then format)
23
- - **Tasks**: Checklist of high-level work items (3–7 tasks)
24
- - **Risks/Assumptions**: Key risks and assumptions
25
- - **Metrics / Definition of Done**: Completion criteria (build/test/review/docs)
26
-
27
- ### From Plan to Execution (Todos)
28
- - After the plan is written, generate an execution todo checklist from the plan.
29
- - Do not start Implementation until the todo list exists and is agreed.
21
+ Each feature plan follows the template structure with 5 sections:
22
+
23
+ 1. **Goal & Acceptance Criteria**: Objectives, scope, and Given-When-Then format
24
+ 2. **Risks & Assumptions**: Key risks and assumptions to be aware of
25
+ 3. **Definition of Done**: Completion criteria (build/test/review/docs)
26
+ 4. **Implementation Plan**:
27
+ - Summary of solution approach
28
+ - Phases with detailed tasks and pseudo-code
29
+ 5. **Follow-ups**: TODOs or deferred work
30
+
31
+ ### What Makes a Good Plan?
32
+ A good plan helps both humans and AI agents understand:
33
+ - **For humans**: What problem we're solving, why, and how
34
+ - **For AI agents**: Exactly what files to change, what logic to implement, and in what order
35
+
36
+ The plan should be:
37
+ - Clear enough for a different AI agent to execute independently
38
+ - Detailed enough with pseudo-code to guide implementation
39
+ - Concise enough to avoid information overload
40
+
41
+ ### From Plan to Execution
42
+ - After the plan is written, use the `execute-plan` command to begin implementation
43
+ - The AI agent will read the plan and implement tasks phase by phase
44
+ - Tasks are tracked with checkboxes `[ ]` → `[x]` as they complete
45
+ - Do not start coding until the plan is reviewed and agreed upon
30
46
 
31
47
  ### Feature Plan Naming Convention
32
48
  - Format: `feature-{name}.md` (kebab-case)
@@ -37,7 +53,6 @@ Each feature plan follows the template structure:
37
53
  See `feature-template.md` for the exact structure required for feature plans.
38
54
 
39
55
  ## Related Documentation
40
- - Implementation notes: `../implementation/`
41
56
  - Test plans: `../testing/`
42
57
  - Project standards: `../project/`
43
58
 
@@ -2,29 +2,68 @@
2
2
 
3
3
  Note: All content in this document must be written in English.
4
4
 
5
- ## Goal
6
- - Objectives, scope, acceptance criteria (Given-When-Then)
5
+ ## 1. Goal & Acceptance Criteria
6
+
7
+ ### Goal
8
+ - [Brief description: what problem this solves and why it matters]
7
9
 
8
10
  ### Acceptance Criteria (Given/When/Then)
9
- - Given ...
10
- - When ...
11
- - Then ...
11
+ - Given [context or initial state]
12
+ - When [action or event occurs]
13
+ - Then [expected result or outcome]
14
+
15
+ ## 2. Risks & Assumptions
16
+
17
+ ### Risks
18
+ - [Potential issues, blockers, or unknowns]
19
+
20
+ ### Assumptions
21
+ - [What we assume is true for this plan to work]
22
+
23
+ ## 3. Definition of Done
24
+ - [ ] Build passes (linter, type checks, compile)
25
+ - [ ] Tests added and passing
26
+ - [ ] Code reviewed and approved
27
+ - [ ] Documentation updated
28
+
29
+ ---
30
+
31
+ ## 4. Implementation Plan
32
+
33
+ ### Summary
34
+ [Brief description of the solution approach in 1-3 sentences]
35
+
36
+ ### Phase 1: [Phase Name]
37
+
38
+ - [ ] [ACTION] path/to/file — Summary of change
39
+ ```
40
+ Pseudo-code:
41
+ - Step 1: describe what will be done
42
+ - Step 2: validation or key logic
43
+ - Step 3: output or return value
44
+ ```
12
45
 
13
- ## Tasks (overview)
14
- - [ ] Task 1
15
- - [ ] Task 2
16
- - [ ] Task 3
46
+ - [ ] [ACTION] path/to/file — Summary of change
47
+ ```
48
+ Pseudo-code:
49
+ - ...
50
+ ```
17
51
 
18
- ## Risks/Assumptions
19
- - Key risks / assumptions
52
+ ### Phase 2: [Phase Name]
20
53
 
21
- ## Observability
22
- - Logging requirements:
23
- - Metrics/telemetry:
54
+ - [ ] [ACTION] path/to/file — Summary of change
55
+ ```
56
+ Pseudo-code:
57
+ - ...
58
+ ```
24
59
 
25
- ## Metrics / Definition of Done
26
- - Build green, tests added, review passed, docs updated
60
+ Notes:
61
+ - ACTION must be one of: ADDED | MODIFIED | DELETED | RENAMED
62
+ - For MODIFIED files, use sub-bullets for each distinct logic change and include line ranges
63
+ - Pseudo-code shows logic structure and key steps, not actual implementation code
64
+ - Each phase groups related tasks; phases execute sequentially
65
+ - Use only one phase for small features (≤ 5 tasks); use multiple phases for larger features
27
66
 
28
- ## Execution Checklist (Todo)
29
- - Before starting implementation, generate a todo checklist from this plan.
30
- - Do not start coding until the todo list exists and is agreed.
67
+ ## 5. Follow-ups
68
+ - [ ] [TODO item or deferred work]
69
+ - [ ] [Future improvements]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai-workflow-init",
3
- "version": "1.3.1",
3
+ "version": "3.0.0",
4
4
  "description": "Initialize AI workflow docs & commands into any repo with one command",
5
5
  "bin": {
6
6
  "ai-workflow-init": "./cli.js"
@@ -1,51 +0,0 @@
1
- ---
2
- phase: implementation
3
- title: Implementation Documentation
4
- description: Feature implementation notes and tracking
5
- ---
6
-
7
- # Implementation Documentation
8
-
9
- ## Purpose
10
- This directory contains implementation notes for individual features. These docs track what code was written, why, and how it aligns with the plan.
11
-
12
- ## Implementation Documentation Workflow
13
-
14
- ### Creating Implementation Notes
15
- Implementation notes are created automatically during `execute-plan`:
16
- - Command: `.cursor/commands/execute-plan.md`
17
- - Output: `docs/ai/implementation/feature-{name}.md`
18
- - Template: `docs/ai/implementation/feature-template.md`
19
-
20
- ### Implementation Doc Structure
21
- Each implementation doc follows the template structure:
22
- - **Summary**: Brief description of overall solution approach
23
- - **Changes**: Per-task entries with:
24
- - File paths and line ranges
25
- - Approach/pattern used
26
- - Brief description of changes
27
- - **Edge Cases**: List of handled edge cases
28
- - **Follow-ups**: TODOs or deferred work
29
-
30
- ### Purpose
31
- Implementation docs serve as:
32
- - **Audit trail**: What code was written for this feature
33
- - **Review reference**: For code-review and check-implementation commands
34
- - **Refactor guide**: Understanding what was done for future improvements
35
-
36
- ### Execution Discipline
37
- - Provide a short status update before each meaningful action (1–3 sentences).
38
- - Perform edits via file editing tools; avoid printing large code for copy-paste.
39
- - After each batch of edits, run linter/type/build on changed files; auto-fix issues (up to 3 attempts) before requesting review.
40
-
41
- ## Template Reference
42
- See `feature-template.md` for the exact structure required for implementation notes.
43
-
44
- ## Related Documentation
45
- - Planning docs: `../planning/`
46
- - Test plans: `../testing/`
47
- - Project standards: `../project/`
48
-
49
- ---
50
-
51
- **Note**: For general implementation patterns and best practices, refer to `../project/CODE_CONVENTIONS.md` and `../project/PROJECT_STRUCTURE.md`.
@@ -1,31 +0,0 @@
1
- # Implementation Notes: {Feature Name}
2
-
3
- Note: All content in this document must be written in English.
4
-
5
- ## Summary
6
-
7
- - Short description of the solution approach
8
-
9
- ## Changes
10
-
11
- - [ ] [ACTION] path/to/file (lines: x–y) — Summary of change
12
- - [ ] [ACTION] path/to/file (lines: a–b) — Summary of change
13
-
14
- Notes:
15
-
16
- - ACTION must be one of: ADDED | MODIFIED | DELETED | RENAMED
17
- - For MODIFIED files, use sub-bullets for each distinct logic change and include line ranges.
18
-
19
- ## Edge Cases
20
-
21
- - List of handled edge cases
22
-
23
- ## Follow-ups
24
-
25
- - TODOs or deferred work
26
-
27
- ## Execution Discipline
28
-
29
- - Before each edit, provide a short status update describing the next action (1–3 sentences).
30
- - Perform edits via file editing tools; avoid printing large code blocks for copy-paste.
31
- - After each batch of edits, run linter/type/build on changed files; auto-fix issues (up to 3 attempts) before requesting review.