@laitszkin/apollo-toolkit 5.0.3 → 5.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +23 -0
- package/package.json +1 -1
- package/skills/design/SKILL.md +92 -54
- package/skills/design/assets/templates/CHECKLIST.md +1 -0
- package/skills/design/assets/templates/DESIGN.md +1 -0
- package/skills/docs-project/SKILL.md +23 -6
- package/skills/fix/SKILL.md +1 -1
- package/skills/implement/SKILL.md +1 -1
- package/skills/plan/SKILL.md +52 -47
- package/skills/plan/assets/templates/PROMPT.md +97 -159
- package/skills/plan/assets/templates/WORKER_PROMPT.md +92 -0
- package/skills/qa/SKILL.md +83 -57
- package/skills/qa/assets/templates/FIX.md +118 -231
- package/skills/qa/assets/templates/FIX_WORKER.md +96 -0
- package/skills/qa/assets/templates/REGTEST_WORKER.md +98 -0
- package/skills/spec/SKILL.md +40 -25
- package/skills/spec/assets/templates/SPEC.md +4 -2
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,29 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this repository are documented in this file.
|
|
4
4
|
|
|
5
|
+
## [v5.0.5] - 2026-06-07
|
|
6
|
+
|
|
7
|
+
### Changed
|
|
8
|
+
|
|
9
|
+
- **P1-P5 prompt architecture**: `plan` and `qa` coordinator prompt templates (PROMPT.md, FIX.md) restructured into 5-section architecture: Your Role & Rules → Context → Execution Plan → Final Verification → References. All behavioral rules consolidated into Section 1.
|
|
10
|
+
- **Dual parallelism gate**: Both `plan` and `qa` skills' parallelism conditions updated to require BOTH zero file overlap AND no logical dependency. Previous versions only enforced file overlap as the hard gate.
|
|
11
|
+
- **Independent worker prompt templates**: Worker prompt formats extracted from inline SKILL.md blocks into dedicated template files (`WORKER_PROMPT.md`, `FIX_WORKER.md`, `REGTEST_WORKER.md`), each following the P1-P5 architecture.
|
|
12
|
+
- **References section cleaned**: Hard-coded project file names removed from template placeholders, using generic descriptions with `— e.g.,` pattern consistent with other skills.
|
|
13
|
+
|
|
14
|
+
## [v5.0.4] - 2026-06-07
|
|
15
|
+
|
|
16
|
+
### Added
|
|
17
|
+
|
|
18
|
+
- **design skill `references/` folder**: Design phase now populates `<spec_dir>/references/` with external method/API reference documents (name, purpose, required parameters), reducing hallucinated external code during implementation.
|
|
19
|
+
- **`apltk codegraph` as dedicated workflow step**: `spec` and `docs-project` skills now run `apltk codegraph survey` before reading requirements, ensuring BDD boundaries align with real code. `design` uses codegraph survey before architecture design.
|
|
20
|
+
- **Brownfield refactoring assessment**: `design` skill now includes explicit T1–T3 refactoring planning for brownfield changes as a standard workflow step.
|
|
21
|
+
- **Worker prompt separation**: `plan` and `qa` skills now store worker prompts in `plan/*.md` and `fix/*.md` files respectively, keeping coordinator prompts focused on strategy. PROMPT.md/FIX.md Reference sections cite all worker prompt paths and code file paths.
|
|
22
|
+
- **Prompt generation guidance consolidated**: Notes on writing quality worker prompts moved from PROMPT.md/FIX.md templates into `plan`/`qa` SKILL.md, aligning with the optimise-skill principle of behavioral guidance in SKILL.md.
|
|
23
|
+
|
|
24
|
+
### Changed
|
|
25
|
+
|
|
26
|
+
- **Self-review renamed to Verification**: `design` and `spec` skills now use "Pre-delivery Verification" with explicit completeness and quality checks, plus code traceability validation.
|
|
27
|
+
|
|
5
28
|
## [v5.0.3] - 2026-06-06
|
|
6
29
|
|
|
7
30
|
### Added
|
package/package.json
CHANGED
package/skills/design/SKILL.md
CHANGED
|
@@ -12,9 +12,13 @@ During architecture survey, identify and classify refactoring opportunities by m
|
|
|
12
12
|
## Acceptance Criteria
|
|
13
13
|
|
|
14
14
|
- Three web research passes completed and recorded
|
|
15
|
+
- `apltk codegraph` survey run on affected modules, with findings recorded
|
|
16
|
+
- Brownfield assessment completed: T1–T3 refactoring opportunities identified and dispositioned
|
|
15
17
|
- `docs/plans/<YYYY-MM-DD>/<spec_name>/DESIGN.md` produced, covering: architecture design, external dependencies (with API facts and limits), data persistence, invariants, technical trade-offs, design-time refactoring
|
|
16
18
|
- `docs/plans/<YYYY-MM-DD>/<spec_name>/CHECKLIST.md` produced, covering: behavior-to-test mapping, hardening requirements, test level choices
|
|
19
|
+
- `docs/plans/<YYYY-MM-DD>/<spec_name>/references/` populated with external method/API reference documents (name, purpose, required parameters)
|
|
17
20
|
- Architecture Diff produced using the C4 model hierarchy
|
|
21
|
+
- DESIGN.md and CHECKLIST.md References sections cite all designed code file paths (not just project context files)
|
|
18
22
|
- Design-time refactoring classified by module boundary scope (T1–T3) and dispositioned (refactored / scheduled / deferred with rationale)
|
|
19
23
|
|
|
20
24
|
## Workflow
|
|
@@ -72,9 +76,42 @@ Verify external dependency compatibility with the repo's existing dependencies:
|
|
|
72
76
|
|
|
73
77
|
Output: Recommended tech stack + compatibility report
|
|
74
78
|
|
|
75
|
-
### 3.
|
|
79
|
+
### 3. CodeGraph Survey
|
|
76
80
|
|
|
77
|
-
|
|
81
|
+
Deeply investigate the repo using `apltk codegraph` before designing.
|
|
82
|
+
|
|
83
|
+
#### 3a. Survey the Project
|
|
84
|
+
|
|
85
|
+
Run `apltk codegraph survey --json` to get entry points, function clusters, and cross-boundary edges.
|
|
86
|
+
|
|
87
|
+
Consult `references/codegraph.md` for detailed flags.
|
|
88
|
+
|
|
89
|
+
#### 3b. List APIs in Affected Areas
|
|
90
|
+
|
|
91
|
+
Use `apltk codegraph list-apis` to review the full project API directory in the affected modules — function names, file paths, callers. Understand what existing modules and functions the new feature will interact with.
|
|
92
|
+
|
|
93
|
+
#### 3c. Code Health Assessment
|
|
94
|
+
|
|
95
|
+
While reading code via codegraph, actively assess code quality:
|
|
96
|
+
- Identify code smells, dead code, legacy patterns, and unnecessary complexity in the affected modules
|
|
97
|
+
- Classify findings using the T1–T3 framework (see `references/code-smells.md` for patterns to recognize)
|
|
98
|
+
- T1 items (module-internal simplification) are safe to refactor immediately — existing tests validate behavioral preservation
|
|
99
|
+
- T2 and T3 items feed into the target architecture design
|
|
100
|
+
|
|
101
|
+
### 4. Read Spec and Design Architecture → DESIGN.md
|
|
102
|
+
|
|
103
|
+
Based on web research (Step 2) and codegraph findings (Step 3), design the architecture. Use `assets/templates/DESIGN.md`.
|
|
104
|
+
|
|
105
|
+
#### 4a. Brownfield Assessment
|
|
106
|
+
|
|
107
|
+
If this is a brownfield change (modifying existing code), design a refactoring plan:
|
|
108
|
+
- Identify which existing modules need restructuring to accommodate the new feature
|
|
109
|
+
- Classify refactoring by T1–T3 scopes (see `references/code-smells.md`)
|
|
110
|
+
- T1: Safe to refactor inline — existing unit tests validate behavior
|
|
111
|
+
- T2: Schedule in task decomposition — existing integration tests validate
|
|
112
|
+
- T3: Define migration strategy with dedicated test coverage
|
|
113
|
+
|
|
114
|
+
#### 4b. Fill DESIGN.md
|
|
78
115
|
|
|
79
116
|
Transfer the research outputs from Steps 2a-2c into the **Research Summary** section of DESIGN.md (feasibility table, reference patterns table, tech stack compatibility table).
|
|
80
117
|
|
|
@@ -87,17 +124,17 @@ Cover the following sections:
|
|
|
87
124
|
- **System Invariants**: Architectural constraints that must not be violated, plus violation symptoms
|
|
88
125
|
- **Technical Trade-offs**: Each decision with rejected alternatives and lock-in effects
|
|
89
126
|
- **Design-Time Refactoring**: T1–T3 code health findings classified and dispositioned
|
|
90
|
-
- **References**: List
|
|
127
|
+
- **References**: List designed code file paths, project context files, and related documents
|
|
91
128
|
|
|
92
129
|
Use `Req 1`, `Req 2` numbering to reference SPEC.md requirements (matching the SPEC.md template's `Requirement 1`, `Requirement 2`).
|
|
93
130
|
|
|
94
131
|
**Scale awareness** — Not every section applies at full depth. Adapt based on the change's scope:
|
|
95
132
|
|
|
96
|
-
- **Interaction Design
|
|
97
|
-
- **External Dependency deep-dives
|
|
98
|
-
- **Target vs Baseline
|
|
99
|
-
- **System Invariants
|
|
100
|
-
- **Design-Time Refactoring
|
|
133
|
+
- **Interaction Design**: If the change is confined to a single module with no new cross-module coupling, mark this section as `None`. Do not fabricate INT-### entries.
|
|
134
|
+
- **External Dependency deep-dives**: For simple utility libraries (e.g., date formatting, UUID generation) with no API quotas, authentication, or failure modes, skip the sub-tables. A one-line entry in the overview suffices.
|
|
135
|
+
- **Target vs Baseline**: If the change touches multiple dimensions (new modules, removed modules, ownership shifts, deployment changes), expand to multiple rows. A single-dimension change needs only one row.
|
|
136
|
+
- **System Invariants**: If the change does not modify any architectural constraint, explicitly write `None` with brief justification.
|
|
137
|
+
- **Design-Time Refactoring**: If no code health issues were identified during the architecture survey, write `None`. Do not fabricate findings.
|
|
101
138
|
|
|
102
139
|
**Design self-challenge** — Before finalizing the design, step back and ask three questions:
|
|
103
140
|
|
|
@@ -105,18 +142,10 @@ Use `Req 1`, `Req 2` numbering to reference SPEC.md requirements (matching the S
|
|
|
105
142
|
2. **Is this the simplest viable design?** Have I introduced abstractions, indirections, or intermediate layers that are not justified by the current requirements? Prefer the simplest structure that works.
|
|
106
143
|
3. **Are there rejected alternatives?** For every major architectural decision (module split, dependency choice, communication pattern), if you have not considered and explicitly rejected at least one alternative, you may be settling on the first workable solution rather than the best one.
|
|
107
144
|
|
|
108
|
-
**Design-time refactoring** — While designing the target architecture, also assess code health in the affected modules:
|
|
109
|
-
|
|
110
|
-
- **T1 (Module-internal simplification)**: Simplify control flow, remove dead code, inline unnecessary wrappers within a single function or file. Existing unit tests validate behavior — refactor directly.
|
|
111
|
-
- **T2 (Module-internal restructuring)**: Extract shared logic, consolidate state, reorganize files within the same module boundary. Existing integration tests validate behavior — include in the design's task decomposition.
|
|
112
|
-
- **T3 (Module boundary adjustment)**: Changes affecting a module's public API, data contract, or cross-module coupling. Requires dedicated test coverage — define test strategy in CHECKLIST.md.
|
|
113
|
-
|
|
114
|
-
See `references/code-smells.md` for patterns to identify, and the module-specific reference files for detailed guidance per tier.
|
|
115
|
-
|
|
116
145
|
**Single spec**: Produce one DESIGN.md for one SPEC.md.
|
|
117
146
|
**Batch spec**: Produce **one** unified DESIGN.md covering the scope of all SPEC.md files in the batch.
|
|
118
147
|
|
|
119
|
-
###
|
|
148
|
+
### 5. Define Verification Strategy → CHECKLIST.md
|
|
120
149
|
|
|
121
150
|
Use the `test-case-strategy` skill to design the verification strategy.
|
|
122
151
|
Use `assets/templates/CHECKLIST.md`.
|
|
@@ -128,7 +157,7 @@ Cover the following sections:
|
|
|
128
157
|
- **Hardening Requirements**: Regression tests, drift checks, property-based tests, edge cases, authorization checks
|
|
129
158
|
- **E2E / Integration Decisions**: Per flow, choose the appropriate test level with rationale
|
|
130
159
|
- **Design-Time Refactoring (T3)**: If T3 refactoring is planned, define its test coverage requirements here
|
|
131
|
-
- **References**: List
|
|
160
|
+
- **References**: List designed code file paths, project context files, and related documents
|
|
132
161
|
|
|
133
162
|
**Mandatory test coverage** (applies when the SPEC.md describes changes other than pure documentation or pure test changes):
|
|
134
163
|
|
|
@@ -141,38 +170,24 @@ Risk definitions: **Medium risk** = paths involving I/O, external dependencies,
|
|
|
141
170
|
**Single spec**: Produce one CHECKLIST.md for one SPEC.md.
|
|
142
171
|
**Batch spec**: Produce **one** unified CHECKLIST.md covering the behavioral requirements of all SPEC.md files in the batch.
|
|
143
172
|
|
|
144
|
-
###
|
|
173
|
+
### 6. Generate Architecture Diff
|
|
145
174
|
|
|
146
175
|
Use the `apltk architecture` CLI tool to generate the Architecture Diff, following the C4 model hierarchy.
|
|
147
176
|
|
|
148
|
-
####
|
|
149
|
-
|
|
150
|
-
**Prerequisite** before any diff work. Survey the project code to establish a code-level baseline for comparison with the atlas.
|
|
151
|
-
|
|
152
|
-
Run `apltk codegraph survey --json` to get entry points, function clusters, and cross-boundary edges.
|
|
153
|
-
|
|
154
|
-
Consult `references/codegraph.md` for detailed flags.
|
|
155
|
-
|
|
156
|
-
#### 5b. Read the Existing Architecture
|
|
177
|
+
#### 6a. Read the Existing Architecture
|
|
157
178
|
|
|
158
179
|
Read the project's existing architecture files (`resources/project-architecture/atlas/atlas.index.yaml` + the affected feature YAML files).
|
|
159
180
|
Do not read unrelated features or modules — maintain context economy.
|
|
160
181
|
|
|
161
182
|
If no existing architecture exists, skip the baseline comparison and start defining the boundary from System Context level.
|
|
162
183
|
|
|
163
|
-
|
|
164
|
-
- Identify code smells, dead code, legacy patterns, and unnecessary complexity in the affected modules
|
|
165
|
-
- Classify findings using the T1–T3 framework (see `references/code-smells.md` for patterns to recognize)
|
|
166
|
-
- T1 items (module-internal simplification) are safe to refactor immediately — existing tests validate behavioral preservation
|
|
167
|
-
- T2 and T3 items feed into the target architecture design in Step 3
|
|
168
|
-
|
|
169
|
-
#### 5c. Measure Baseline Drift
|
|
184
|
+
#### 6b. Measure Baseline Drift
|
|
170
185
|
|
|
171
186
|
Compare the existing architecture diagram against the current code to assess its reliability:
|
|
172
187
|
- If the baseline atlas differs significantly from the code (> 20% entries inconsistent), flag the risk in the architecture diff
|
|
173
188
|
- If the baseline atlas is reliable, the diff can be layered directly on top of it
|
|
174
189
|
|
|
175
|
-
####
|
|
190
|
+
#### 6c. Define the Diff by C4 Level
|
|
176
191
|
|
|
177
192
|
1. **System Context**: Define external actors, system boundaries, cross-system edges
|
|
178
193
|
2. **Container level** (features): Define new or modified features and the edges between them
|
|
@@ -181,62 +196,85 @@ Compare the existing architecture diagram against the current code to assess its
|
|
|
181
196
|
|
|
182
197
|
C4 level mapping: System Context → system boundary, Container → feature, Component → submodule, Code → function (selective). See `references/definition.md` for full definitions.
|
|
183
198
|
|
|
184
|
-
####
|
|
199
|
+
#### 6d. Evidence Tracing
|
|
185
200
|
|
|
186
201
|
Each component should link to:
|
|
187
202
|
- The requirement number from SPEC.md (requirement → module)
|
|
188
203
|
- The technical decision from research findings (decision → dependency choice)
|
|
189
204
|
|
|
190
|
-
####
|
|
205
|
+
#### 6e. Generate the Diff and Validate
|
|
191
206
|
|
|
192
207
|
Two alternative workflows — use the **Classic flow** when `codegraph` is not installed, or the **CodeGraph-integrated flow** when it is available.
|
|
193
208
|
|
|
194
209
|
**Classic flow** (manual):
|
|
195
210
|
Generate and validate the architecture diff using `apltk architecture` commands. Confirm validation passes, then produce a visual comparison. See `references/architecture.md` for all CLI flags.
|
|
196
211
|
|
|
197
|
-
**
|
|
198
|
-
|
|
199
|
-
1. **Survey the existing API landscape** — Use `apltk codegraph list-apis` to review the full project API directory (function names, file paths, callers). Understand what existing modules and functions your new feature will interact with.
|
|
212
|
+
**CodeGraph-integrated flow:**
|
|
200
213
|
|
|
201
|
-
|
|
214
|
+
1. **Fill the proposal skeleton** — Based on design decisions from steps 6a–6d, fill in the `proposal.yaml` file generated by `apltk architecture template`. Define the feature, its submodules, their functions, and cross-feature edges.
|
|
202
215
|
|
|
203
|
-
|
|
216
|
+
2. **Apply and verify** — Apply the mutations and verify correctness:
|
|
204
217
|
- `apltk architecture apply` processes all mutations with undo protection
|
|
205
218
|
- `apltk codegraph verify` confirms every symbol and edge reference exists in actual code
|
|
206
219
|
|
|
207
|
-
|
|
220
|
+
3. **Render diff** (optional) — `apltk architecture diff --spec <spec_dir>` for visual confirmation.
|
|
208
221
|
|
|
209
222
|
See `references/architecture.md` for exact CLI flags and mutation commands.
|
|
210
223
|
|
|
211
224
|
**Single spec**: Produce one Architecture Diff for one SPEC.md.
|
|
212
225
|
**Batch spec**: Produce **one** unified Architecture Diff covering all SPEC.md files in the batch.
|
|
213
226
|
|
|
214
|
-
###
|
|
227
|
+
### 7. Populate references/ Folder
|
|
228
|
+
|
|
229
|
+
Under `<spec_dir>/references/` (single spec) or `<batch_dir>/references/` (batch spec), create reference documents for every external method and API used in the design:
|
|
230
|
+
|
|
231
|
+
#### External Methods
|
|
232
|
+
|
|
233
|
+
For each external method referenced in the design, document:
|
|
234
|
+
- **Method name**: The method or function name
|
|
235
|
+
- **Purpose**: What it does, why it is needed
|
|
236
|
+
- **Required parameters**: Input parameters with types and descriptions
|
|
237
|
+
- **Source**: Where this method is documented (URL or code path)
|
|
238
|
+
|
|
239
|
+
#### External APIs
|
|
240
|
+
|
|
241
|
+
For each external API referenced in the design, document:
|
|
242
|
+
- **API name**: The API or service name
|
|
243
|
+
- **Purpose**: What it does, why it is needed
|
|
244
|
+
- **Required parameters**: Request payload structure, query parameters, headers
|
|
245
|
+
- **Authentication**: How to authenticate (key location, scope)
|
|
246
|
+
- **Rate limits / quotas**: Documented limits
|
|
247
|
+
|
|
248
|
+
**Why this step exists**: Explicit external method/API reference documentation reduces the chance of hallucinated code during implementation. Workers and coordinators can consult these files instead of guessing API shapes.
|
|
249
|
+
|
|
250
|
+
### 8. Pre-delivery Verification
|
|
215
251
|
|
|
216
252
|
Before delivering, run two passes — completeness then quality.
|
|
217
253
|
|
|
218
|
-
|
|
254
|
+
#### Completeness checks (documentation integrity)
|
|
219
255
|
|
|
220
256
|
- Research results are recorded in DESIGN.md as evidence for technical decisions
|
|
221
257
|
- Every architecture decision has a trade-off record (rejected alternatives + lock-in effects)
|
|
222
258
|
- External dependency API facts are traceable to official documentation
|
|
223
259
|
- CHECKLIST.md completely covers all BDD requirements from SPEC.md
|
|
224
260
|
- Architecture Diff covers the full change scope
|
|
225
|
-
- Design-time refactoring is documented in DESIGN.md
|
|
261
|
+
- Design-time refactoring is documented in DESIGN.md with T1–T3 findings classified and dispositioned
|
|
262
|
+
- `references/` folder exists with external method and API reference documents
|
|
263
|
+
- DESIGN.md and CHECKLIST.md References sections cite designed code file paths
|
|
226
264
|
|
|
227
|
-
|
|
265
|
+
#### Design quality checks (architectural soundness)
|
|
228
266
|
|
|
229
267
|
- **Requirement traceability**: Can every BDD behavior from SPEC.md be traced to a module, interaction, data flow, or invariant in this design?
|
|
230
|
-
- **Internal consistency**: Do the modules listed in
|
|
268
|
+
- **Internal consistency**: Do the modules listed in the architecture appear as callers or callees in the interaction design? Do the dependencies correspond to module responsibilities?
|
|
231
269
|
- **Design simplicity**: Is this the simplest design that satisfies all requirements? Could any module, abstraction, or dependency be removed without breaking functionality?
|
|
232
|
-
- **Risk transparency**: Are all feasibility risks, compatibility concerns, or uncertain technical points
|
|
233
|
-
- **Refactoring disposition**: Are all identified code health findings accounted for — either refactored, scheduled in the task plan, or explicitly deferred with rationale?
|
|
270
|
+
- **Risk transparency**: Are all feasibility risks, compatibility concerns, or uncertain technical points either addressed in the design or explicitly documented as accepted risks?
|
|
271
|
+
- **Refactoring disposition**: Are all identified code health findings accounted for — either refactored, scheduled in the task plan, or explicitly deferred with rationale?
|
|
234
272
|
|
|
235
273
|
## Examples
|
|
236
274
|
|
|
237
|
-
- "SPEC.md defines a real-time messaging feature" → Research WebSocket vs SSE vs Polling → Confirm compatibility → Choose SSE → Design architecture → Produce DESIGN.md + CHECKLIST.md + Architecture Diff → During code survey, identify legacy socket wrapper (T2) → schedule extraction in task plan
|
|
238
|
-
- "SPEC.md requires CSV export, repo has no CSV library" → Research Node.js CSV libraries (json2csv vs csv-writer vs papaparse) → Confirm compatibility → Choose the lightest option → Design export flow architecture
|
|
239
|
-
- "Batch spec: docs/plans/2026-05-29/auth-redesign/ with 3 SPEC.md files (login, permissions, 2FA)" → Read all 3 SPEC.md files → Unified research →
|
|
275
|
+
- "SPEC.md defines a real-time messaging feature" → Research WebSocket vs SSE vs Polling → CodeGraph survey to find existing socket infrastructure → Confirm compatibility → Choose SSE → Design architecture → Produce DESIGN.md + CHECKLIST.md + Architecture Diff → During code survey, identify legacy socket wrapper (T2) → schedule extraction in task plan → Populate references/ with external API docs
|
|
276
|
+
- "SPEC.md requires CSV export, repo has no CSV library" → Research Node.js CSV libraries (json2csv vs csv-writer vs papaparse) → CodeGraph survey to understand export module boundaries → Confirm compatibility → Choose the lightest option → Design export flow architecture → Document CSV library API in references/
|
|
277
|
+
- "Batch spec: docs/plans/2026-05-29/auth-redesign/ with 3 SPEC.md files (login, permissions, 2FA)" → Read all 3 SPEC.md files → Unified research → CodeGraph survey of auth modules → Unified DESIGN.md + CHECKLIST.md + Architecture Diff → Brownfield assessment: identify dead auth middleware during survey (T1) → remove and verify with existing tests → Populate references/ with auth API docs
|
|
240
278
|
|
|
241
279
|
## References
|
|
242
280
|
|
|
@@ -42,5 +42,6 @@ Map each BDD requirement from SPEC.md to one or more tests:
|
|
|
42
42
|
|
|
43
43
|
## References
|
|
44
44
|
|
|
45
|
+
- **Designed code file paths**: [List code file paths that this design touches or references — e.g., `src/auth/login.ts`, `src/api/routes.ts`]
|
|
45
46
|
- **Project context files**: [List important project files the LLM will need — e.g., `CLAUDE.md`, `AGENTS.md`, `resources/project-architecture/**`]
|
|
46
47
|
- **Related documents**: [Links to related SPEC.md, DESIGN.md, or external documentation]
|
|
@@ -156,5 +156,6 @@ If none, write **None**.
|
|
|
156
156
|
|
|
157
157
|
## 9. References
|
|
158
158
|
|
|
159
|
+
- **Designed code file paths**: [List code file paths that this design touches or references — e.g., `src/auth/login.ts`, `src/api/routes.ts`]
|
|
159
160
|
- **Project context files**: [List important project files the LLM will need — e.g., `CLAUDE.md`, `AGENTS.md`, `resources/project-architecture/**`]
|
|
160
161
|
- **Related documents**: [Links to related SPEC.md, other design docs, or external documentation]
|
|
@@ -13,6 +13,8 @@ description: >-
|
|
|
13
13
|
|
|
14
14
|
## 驗收條件
|
|
15
15
|
|
|
16
|
+
- 使用 `apltk codegraph` 完成 repo 深度調查,產出模組邊界與 API 目錄分析
|
|
17
|
+
- 使用 subagents 閱讀關鍵程式碼片段,確保文檔記述可驗證
|
|
16
18
|
- repo 的所有細節被仔細閱讀,並轉化為標準化的 `docs/features/`、`docs/architecture/`、`docs/principles/` 文檔
|
|
17
19
|
- 每條文檔記述皆有可追溯的來源證據(檔案路徑 + 行號區間);無法證明的內容標記為 `[INFERRED]`
|
|
18
20
|
- `AGENTS.md` / `CLAUDE.md` 已被同步更新
|
|
@@ -20,21 +22,36 @@ description: >-
|
|
|
20
22
|
|
|
21
23
|
## 工作流程
|
|
22
24
|
|
|
23
|
-
### 1.
|
|
25
|
+
### 1. 使用 CodeGraph 深入調查 Repo
|
|
24
26
|
|
|
25
|
-
|
|
27
|
+
在開始文檔工作前,先用 `apltk codegraph` 建立對 repo 的深度理解。
|
|
26
28
|
|
|
27
|
-
|
|
29
|
+
1. 執行 `apltk codegraph survey --json` 取得專案的 entry points、function clusters、cross-boundary edges
|
|
30
|
+
2. 使用 `apltk codegraph list-apis` 檢視完整 API 目錄(函式名稱、檔案路徑、呼叫者)
|
|
31
|
+
3. 對關鍵模組使用 `apltk codegraph explore` 深入了解內部結構
|
|
32
|
+
|
|
33
|
+
將調查結果記錄為結構化摘要,供後續文檔撰寫使用。
|
|
34
|
+
|
|
35
|
+
### 2. 建立對 Repo 的基線認知
|
|
36
|
+
|
|
37
|
+
閱讀項目現有文檔,並結合 CodeGraph 調查結果,建立對 repo 的基線認知,制定後續閱讀策略。
|
|
38
|
+
|
|
39
|
+
### 3. 比對 Repo 及項目文檔
|
|
28
40
|
|
|
29
41
|
按照上一步建立的閱讀策略,通過並行調度 subagents 全面搜索整個 repo,驗證並確保現有項目文檔的描述正確、無遺漏。
|
|
30
42
|
|
|
31
|
-
|
|
43
|
+
使用 subagents 深入閱讀關鍵程式碼片段:
|
|
44
|
+
- 每個 subagent 負責一個模組或檔案群組
|
|
45
|
+
- Subagent 閱讀原始碼後回報:模組職責、關鍵函式、資料流程、外部整合點
|
|
46
|
+
- 將 subagent 發現與現有文檔比對,標記差異
|
|
47
|
+
|
|
48
|
+
### 4. 制定文檔更新策略
|
|
32
49
|
|
|
33
50
|
根據上一步發現的文檔遺漏或脫節之處,制定文檔更新策略。
|
|
34
51
|
閱讀模板文檔;使用模板規定的格式重寫所有項目文檔。
|
|
35
52
|
移除舊有說明文檔(必要文檔如 `CHANGELOG.md`、`CONTRIBUTION.md` 除外)。
|
|
36
53
|
|
|
37
|
-
###
|
|
54
|
+
### 5. 後續維護指引
|
|
38
55
|
|
|
39
56
|
完成初始文檔後,在 `docs/README.md` 中記錄以下維護指引:
|
|
40
57
|
|
|
@@ -44,4 +61,4 @@ description: >-
|
|
|
44
61
|
- **定期 drift detection**(建議):定期(每月或每季)比對文檔與實際程式碼,確認無重大偏離。發現 drift 時只修補受影響章節,不全面重寫。
|
|
45
62
|
|
|
46
63
|
## 參考資料
|
|
47
|
-
- `assets/templates/standardized-docs-template.md` - 三類文檔的目標結構、分類規則與清理檢查表。
|
|
64
|
+
- `assets/templates/standardized-docs-template.md` - 三類文檔的目標結構、分類規則與清理檢查表。
|
package/skills/fix/SKILL.md
CHANGED
|
@@ -59,7 +59,7 @@ Report to the user:
|
|
|
59
59
|
|
|
60
60
|
## Examples
|
|
61
61
|
|
|
62
|
-
- FIX.md defines Batch 1 with 2 parallel fixes → Coordinator
|
|
62
|
+
- FIX.md defines Batch 1 with 2 parallel fixes → Coordinator reads FIX-01 and FIX-03 worker prompts from `fix/` files listed in Section 6 (Worker Prompt Index) → Dispatches 2 workers → Waits → Digests results → Runs gate verification → Proceeds to Batch 2
|
|
63
63
|
- Worker FIX-02 reports failure → Coordinator retries the worker with more specific guidance → Second attempt still fails → Pauses, preserves FIX-01's success, notifies the user
|
|
64
64
|
- All batches complete → Regression tests pass → Commit → Cross-check REPORT.md → Report
|
|
65
65
|
|
|
@@ -56,7 +56,7 @@ Report to the user:
|
|
|
56
56
|
|
|
57
57
|
## Examples
|
|
58
58
|
|
|
59
|
-
- PROMPT.md defines Batch 1 with 2 parallel tasks → Coordinator
|
|
59
|
+
- PROMPT.md defines Batch 1 with 2 parallel tasks → Coordinator reads T1.1 and T1.2 worker prompts from `plan/` files listed in Section 6 (Worker Prompt Index) → Dispatches 2 workers → Waits for both → Digests results → Runs gate verification → Proceeds to Batch 2
|
|
60
60
|
- Worker T2.1 reports failure → Coordinator retries the worker with more specific guidance → Second attempt still fails → Pauses, preserves T2.2's success, notifies the user
|
|
61
61
|
- Merge conflict detected when combining worker results → Coordinator resolves the conflict markers → Re-runs batch gate verification → Proceeds
|
|
62
62
|
|
package/skills/plan/SKILL.md
CHANGED
|
@@ -13,16 +13,22 @@ This prompt defines a coordinator agent:
|
|
|
13
13
|
|
|
14
14
|
This skill is responsible for "planning the coordination strategy" — extracting information from SPEC/DESIGN/CHECKLIST, decomposing into concrete tasks, pre-writing worker prompts, and scheduling batch execution order.
|
|
15
15
|
|
|
16
|
+
Worker prompts are written to individual files under `<spec_dir>/plan/` (single spec) or `<batch_dir>/plan/` (batch spec) instead of inline in PROMPT.md. This keeps PROMPT.md focused on coordination strategy while each worker prompt is independently dispatchable.
|
|
17
|
+
|
|
16
18
|
## Acceptance Criteria
|
|
17
19
|
|
|
18
20
|
- `docs/plans/<YYYY-MM-DD>/<spec_name>/PROMPT.md` is produced and placed at the root of the spec or batch spec directory
|
|
19
21
|
- PROMPT.md is a **self-contained coordinator prompt**, containing:
|
|
20
22
|
- Coordinator role definition (what to do, what not to do)
|
|
21
23
|
- Task decomposition with dependency graph
|
|
22
|
-
-
|
|
24
|
+
- Worker prompt index referencing `plan/*.md` files
|
|
23
25
|
- Batch schedule with verification gates
|
|
24
26
|
- Error recovery strategy
|
|
25
27
|
- Boundary rules (ALWAYS / ASK FIRST / NEVER)
|
|
28
|
+
- Worker prompts are stored in `<spec_dir>/plan/*.md` or `<batch_dir>/plan/*.md`, one prompt per file
|
|
29
|
+
- PROMPT.md References section cites:
|
|
30
|
+
- Worker prompt file paths (`plan/*.md`)
|
|
31
|
+
- All code file paths that need modification across all tasks
|
|
26
32
|
|
|
27
33
|
## Workflow
|
|
28
34
|
|
|
@@ -39,6 +45,7 @@ Read all files thoroughly:
|
|
|
39
45
|
- `SPEC.md` — Business requirements and scope (BDD GIVEN/WHEN/THEN), In/Out of Scope
|
|
40
46
|
- `DESIGN.md` — Module architecture, interaction anchors (INT-###), external dependencies (EXT-###), system invariants, technical trade-offs
|
|
41
47
|
- `CHECKLIST.md` — Behavior-to-test mapping, hardening requirements, test level choices
|
|
48
|
+
- `<spec_dir>/references/` or `<batch_dir>/references/` — External method/API reference documents (name, purpose, parameters)
|
|
42
49
|
|
|
43
50
|
### 3. Task Decomposition
|
|
44
51
|
|
|
@@ -53,7 +60,7 @@ Decompose the architecture design from DESIGN.md into tasks precise to the file
|
|
|
53
60
|
|
|
54
61
|
**Decide whether each task needs an independent worker:**
|
|
55
62
|
- Touches ≥2 files → needs independent worker
|
|
56
|
-
- **
|
|
63
|
+
- **Workers may run in parallel only when BOTH conditions are met:** (1) file lists have ZERO overlap across all workers within the same batch, AND (2) no logical dependency exists between the tasks. If either condition is violated, the tasks must run sequentially.
|
|
57
64
|
- File overlap or logical dependency between tasks → must run sequentially
|
|
58
65
|
- Purely procedural operations (lockfile update, merge, commit) → no worker needed; coordinator handles directly
|
|
59
66
|
|
|
@@ -78,35 +85,35 @@ Analyze dependencies between specs:
|
|
|
78
85
|
|
|
79
86
|
Output: Spec DAG.
|
|
80
87
|
|
|
81
|
-
### 5.
|
|
88
|
+
### 5. Parallelism Gate (File Overlap + Logical Dependency)
|
|
82
89
|
|
|
83
|
-
File overlap detection
|
|
90
|
+
File overlap detection and dependency analysis form the **dual gate that determines parallelism**. Parallel execution is only permitted when BOTH conditions are met:
|
|
84
91
|
|
|
85
92
|
1. Collect the file list each task unit is expected to modify
|
|
86
|
-
2. Compare file lists and mark overlaps — zero overlap is
|
|
87
|
-
3.
|
|
93
|
+
2. Compare file lists and mark overlaps — zero overlap is required for parallel execution. Any file overlap at all → must be sequential. This is a hard constraint — never dispatch parallel workers for tasks sharing a file.
|
|
94
|
+
3. Check for logical dependencies between task units — even with no file overlap, tasks that depend on each other's output must run sequentially.
|
|
88
95
|
|
|
89
96
|
### 6. Write Worker Prompts (One Per Dispatchable Task)
|
|
90
97
|
|
|
91
|
-
For each task that needs an independent worker, write a self-contained worker prompt.
|
|
98
|
+
For each task that needs an independent worker, write a self-contained worker prompt. Save each prompt to a separate file under `<spec_dir>/plan/` or `<batch_dir>/plan/`.
|
|
99
|
+
|
|
100
|
+
**Worker prompt file naming**: `plan/T{batch}.{sequence}-{kebab-case-name}.md`
|
|
92
101
|
|
|
93
|
-
|
|
102
|
+
Use `assets/templates/WORKER_PROMPT.md`. The template follows the P1-P5 architecture:
|
|
94
103
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
## Boundaries — Constraints (don't touch other workers' files, don't add dependencies, report blockers)
|
|
103
|
-
```
|
|
104
|
+
| Section | Purpose (P#) |
|
|
105
|
+
|---------|--------------|
|
|
106
|
+
| 1. Mission & Rules | Goal + behavioral rules |
|
|
107
|
+
| 2. Context | Files to read, background knowledge |
|
|
108
|
+
| 3. Tasks | Concrete file-level instructions (file, line range, change) |
|
|
109
|
+
| 4. Verification | Commands and expected results |
|
|
110
|
+
| 5. Scope & References | Allowed/forbidden files, related references |
|
|
104
111
|
|
|
105
|
-
**Writing principles:**
|
|
106
|
-
- **Self-contained**: Workers do not see the coordinator's context. The prompt must include everything necessary
|
|
107
|
-
- **Concrete**: For every file the worker must modify, specify: (1) the exact file path, (2) the function or line range, (3) what to add, delete, or change. Do not write "fix it", "update as needed", or "based on your findings"
|
|
108
|
-
- **Declarative**: Describe "what to do", not "which tool to use"
|
|
109
|
-
- **Clear boundaries**: Explicitly list allowed and forbidden files
|
|
112
|
+
**Writing principles (move these to your process, not the template):**
|
|
113
|
+
- **Self-contained**: Workers do not see the coordinator's context. The prompt must include everything necessary. Do not rely on shared context or assume the worker has read other documents.
|
|
114
|
+
- **Concrete**: For every file the worker must modify, specify: (1) the exact file path, (2) the function or line range, (3) what to add, delete, or change. Do not write "fix it", "update as needed", or "based on your findings".
|
|
115
|
+
- **Declarative**: Describe "what to do", not "which tool to use".
|
|
116
|
+
- **Clear boundaries**: Explicitly list allowed and forbidden files. A worker should never need to guess which files it can modify.
|
|
110
117
|
|
|
111
118
|
Tasks that do not need a worker (purely procedural operations) do not get a worker prompt. The coordinator handles these directly in the corresponding batch.
|
|
112
119
|
|
|
@@ -114,8 +121,8 @@ Tasks that do not need a worker (purely procedural operations) do not get a work
|
|
|
114
121
|
|
|
115
122
|
Based on dependency analysis and file overlap detection, build the batch schedule → PROMPT.md Section 7 (Batch Schedule).
|
|
116
123
|
|
|
117
|
-
**Batch partitioning principles (file overlap
|
|
118
|
-
- Within the same batch: tasks must have ZERO file overlap — only then may they dispatch workers in parallel.
|
|
124
|
+
**Batch partitioning principles (file overlap and logical dependency are the hard gates):**
|
|
125
|
+
- Within the same batch: tasks must have ZERO file overlap AND no logical dependency — only then may they dispatch workers in parallel. Tasks with file overlap or logical dependency must be placed in separate sequential batches regardless.
|
|
119
126
|
- Between batches: the previous batch must complete and pass its gate before the next batch begins
|
|
120
127
|
- A final integration batch handles housekeeping tasks (lockfile update, final test suite)
|
|
121
128
|
|
|
@@ -132,7 +139,7 @@ Based on dependency analysis and file overlap detection, build the batch schedul
|
|
|
132
139
|
|
|
133
140
|
→ PROMPT.md Section 10 (Boundaries).
|
|
134
141
|
|
|
135
|
-
- **ALWAYS**: Run gate verification after every batch, extract worker prompts verbatim from Section
|
|
142
|
+
- **ALWAYS**: Run gate verification after every batch, extract worker prompts verbatim from Section 7, digest results before deciding next step
|
|
136
143
|
- **ASK FIRST**: Modify files not defined in SPEC/DESIGN, add new dependencies, two worker failures, regression with unclear cause
|
|
137
144
|
- **NEVER**: Coordinator edits source code directly, workers spawn sub-workers, skip verification, issue vague instructions
|
|
138
145
|
|
|
@@ -142,17 +149,11 @@ Use `assets/templates/PROMPT.md`. Fill each section according to the table below
|
|
|
142
149
|
|
|
143
150
|
| Section | Content Source |
|
|
144
151
|
|---------|---------------|
|
|
145
|
-
| 1. Your Role | Fixed template (
|
|
146
|
-
| 2.
|
|
147
|
-
| 3.
|
|
148
|
-
| 4.
|
|
149
|
-
| 5. References |
|
|
150
|
-
| 6. Task Units | Step 3 (task decomposition) + Step 4 (dependency analysis) |
|
|
151
|
-
| 7. Worker Prompt Library | Step 6 — one entry per dispatchable task |
|
|
152
|
-
| 8. Batch Schedule | Step 7 (batch schedule) |
|
|
153
|
-
| 9. Verification Checkpoints | CHECKLIST.md: behavior-to-test mapping (CL-###), hardening requirements, test execution commands |
|
|
154
|
-
| 10. Error Recovery | Fixed template — populate spec-specific test commands from CHECKLIST.md |
|
|
155
|
-
| 11. Boundaries | Fixed template + spec-specific rules (including worktree cleanup after each batch) |
|
|
152
|
+
| 1. Your Role & Rules | Fixed template (Mission from SPEC.md Goal + business value; Boundaries + Error Recovery are fixed scaffold; add spec-specific rules) |
|
|
153
|
+
| 2. Context | SPEC.md In/Out of Scope + DESIGN.md: module list with responsibilities, interaction anchors (INT-###) and dependency order, external dependency setup order (EXT-###), system invariants, technical decisions and trade-offs |
|
|
154
|
+
| 3. Execution Plan | Step 3 (task decomposition) + Step 4 (dependency analysis) + Step 6 (worker prompts per `assets/templates/WORKER_PROMPT.md`) + Step 7 (batch schedule). Per-batch verification commands from CHECKLIST.md |
|
|
155
|
+
| 4. Final Verification | Fixed scaffold (meta-checks) |
|
|
156
|
+
| 5. References | Worker prompt file paths (`plan/*.md`), all code file paths that need modification across all tasks, project context files, related documents |
|
|
156
157
|
|
|
157
158
|
### 11. Pre-delivery Self-Review
|
|
158
159
|
|
|
@@ -160,32 +161,36 @@ Before delivering PROMPT.md, verify all of the following.
|
|
|
160
161
|
|
|
161
162
|
**Worker prompt quality:**
|
|
162
163
|
|
|
163
|
-
- Every worker prompt in
|
|
164
|
+
- Every worker prompt in `plan/*.md` is self-contained. Scan for phrases like "based on your findings", "fix it appropriately", "as discussed above" — these leak shared context assumptions. If found, rewrite the prompt to include the necessary information inline.
|
|
164
165
|
- Every worker prompt has a concrete file-level Scope (allowed + forbidden files listed explicitly).
|
|
165
166
|
- Every worker prompt has a concrete Verify command with an expected output (not just "run tests").
|
|
167
|
+
- Worker prompt filenames match their task IDs (`plan/T{batch}.{sequence}-*.md`).
|
|
166
168
|
|
|
167
169
|
**Coverage completeness:**
|
|
168
170
|
|
|
169
|
-
- Every BDD requirement from SPEC.md is addressed by at least one task in Section
|
|
171
|
+
- Every BDD requirement from SPEC.md is addressed by at least one task in Section 3 (Task Units). If a requirement has no task, add one or document why it is already satisfied by existing code.
|
|
170
172
|
- Every module from DESIGN.md has a corresponding task or is explicitly noted as unchanged.
|
|
171
|
-
- Every hardening requirement from CHECKLIST.md appears in Section
|
|
173
|
+
- Every hardening requirement from CHECKLIST.md appears in Section 4 (Final Verification) or in the Batch Schedule gates.
|
|
172
174
|
|
|
173
175
|
**Structural consistency:**
|
|
174
176
|
|
|
175
|
-
- Each task's Depends on field
|
|
176
|
-
- Every task listed in
|
|
177
|
-
- No orphaned tasks (a task listed in
|
|
177
|
+
- Each task's Depends on field matches the batch ordering. No task scheduled in a batch before its dependencies are met.
|
|
178
|
+
- Every task listed in Batch Schedule has a worker prompt in `plan/*.md` — unless it is explicitly marked as coordinator-handled.
|
|
179
|
+
- No orphaned tasks (a task listed in Task Units that never appears in any batch), no missing dependencies (a Depends on field referencing a task ID that does not exist).
|
|
180
|
+
- Section 5 (References) lists all worker prompt paths and all code file paths.
|
|
178
181
|
|
|
179
|
-
### 12. Produce PROMPT.md
|
|
182
|
+
### 12. Produce PROMPT.md and Worker Prompts
|
|
180
183
|
|
|
181
184
|
Place the PROMPT.md at the root of the spec or batch spec directory.
|
|
185
|
+
Place worker prompts in `<spec_dir>/plan/` or `<batch_dir>/plan/`.
|
|
182
186
|
|
|
183
187
|
## Examples
|
|
184
188
|
|
|
185
|
-
- "Generate a coordinator prompt for a single spec" → Read SPEC.md + DESIGN.md → Decompose into 3 tasks → T1.1 and T1.2 have no file overlap → parallel → Write worker prompts
|
|
186
|
-
- "Generate a coordinator prompt for a batch spec with 4 specs" → Read all SPEC.md + DESIGN.md → Build spec DAG → Detect cross-spec file overlap → Schedule batches → Write worker prompts
|
|
187
|
-
- "Two tasks modify the same file" → Assign to different batches, each with an independent worker prompt
|
|
189
|
+
- "Generate a coordinator prompt for a single spec" → Read SPEC.md + DESIGN.md + references/ → Decompose into 3 tasks → T1.1 and T1.2 have no file overlap → parallel → Write worker prompts to `plan/` → Schedule: Batch 1 parallel T1.1+T1.2 → Batch 2 T1.3 → Output PROMPT.md + plan/*.md
|
|
190
|
+
- "Generate a coordinator prompt for a batch spec with 4 specs" → Read all SPEC.md + DESIGN.md + references/ → Build spec DAG → Detect cross-spec file overlap → Schedule batches → Write worker prompts to `plan/` → Output PROMPT.md + plan/*.md
|
|
191
|
+
- "Two tasks modify the same file" → Assign to different batches, each with an independent worker prompt in `plan/`, sequential execution → Reference both prompt paths in PROMPT.md
|
|
188
192
|
|
|
189
193
|
## References
|
|
190
194
|
|
|
191
|
-
- `assets/templates/PROMPT.md` —
|
|
195
|
+
- `assets/templates/PROMPT.md` — Coordinator prompt template
|
|
196
|
+
- `assets/templates/WORKER_PROMPT.md` — Worker prompt template (used in Step 6)
|