@laitszkin/apollo-toolkit 3.8.4 → 3.9.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 (26) hide show
  1. package/CHANGELOG.md +5 -0
  2. package/align-project-documents/SKILL.md +49 -121
  3. package/analyse-app-logs/scripts/__pycache__/filter_logs_by_time.cpython-312.pyc +0 -0
  4. package/analyse-app-logs/scripts/__pycache__/log_cli_utils.cpython-312.pyc +0 -0
  5. package/analyse-app-logs/scripts/__pycache__/search_logs.cpython-312.pyc +0 -0
  6. package/commit-and-push/SKILL.md +52 -75
  7. package/develop-new-features/SKILL.md +53 -113
  8. package/docs-to-voice/scripts/__pycache__/docs_to_voice.cpython-312.pyc +0 -0
  9. package/enhance-existing-features/SKILL.md +59 -125
  10. package/generate-spec/SKILL.md +86 -195
  11. package/generate-spec/scripts/__pycache__/create-specscpython-312.pyc +0 -0
  12. package/implement-specs/SKILL.md +47 -43
  13. package/implement-specs-with-subagents/SKILL.md +69 -165
  14. package/implement-specs-with-worktree/SKILL.md +53 -102
  15. package/katex/scripts/__pycache__/render_katex.cpython-312.pyc +0 -0
  16. package/maintain-project-constraints/SKILL.md +53 -105
  17. package/maintain-skill-catalog/SKILL.md +46 -42
  18. package/open-github-issue/scripts/__pycache__/open_github_issue.cpython-312.pyc +0 -0
  19. package/package.json +1 -1
  20. package/read-github-issue/scripts/__pycache__/find_issues.cpython-312.pyc +0 -0
  21. package/read-github-issue/scripts/__pycache__/read_issue.cpython-312.pyc +0 -0
  22. package/resolve-review-comments/scripts/__pycache__/review_threads.cpython-312.pyc +0 -0
  23. package/review-spec-related-changes/SKILL.md +49 -82
  24. package/solve-issues-found-during-review/SKILL.md +46 -106
  25. package/text-to-short-video/scripts/__pycache__/enforce_video_aspect_ratio.cpython-312.pyc +0 -0
  26. package/version-release/SKILL.md +52 -88
@@ -1,143 +1,77 @@
1
1
  ---
2
2
  name: enhance-existing-features
3
3
  description: >-
4
- Extend brownfield features by exploring the codebase first, then deciding
5
- whether shared planning docs (`spec.md`/`tasks.md`/`checklist.md`/`contract.md`/`design.md`) are required
6
- before coding. When specs are needed, use `generate-spec` for planning,
7
- clarification, approval, and backfill, and complete approved in-scope tasks
8
- before yielding unless scope changes or an external blocker prevents safe
9
- completion. With or without specs, use `test-case-strategy` to select and
10
- run relevant unit, property-based, regression, integration, E2E, adversarial,
11
- mock/fake, and drift-check coverage, and verify meaningful business outcomes
12
- instead of smoke-only success.
4
+ Extend brownfield systems only after reading the real modules involved: choose **`generate-spec`**/`recover-missing-plan` when user-visible scope, ambiguity, coordination, or sensitive flows demand written approval; otherwise implement directly but still run **`test-case-strategy`** on every non-trivial delta (property/adversarial/integration as risk dictates) and never check off plans without commit+test evidence.
5
+ Use for backlog work that mutates production behavior; reroute pure regressions, copy/style-only tweaks, or single-pocket config nits that restore documented intent without new surface area.
6
+ Bad: multi-service permission change with zero spec… Good: contract captures external API limits + property tests cover invariants… Single-file pagination fix matching README → targeted regression only…
13
7
  ---
14
8
 
15
9
  # Enhance Existing Features
16
10
 
17
11
  ## Dependencies
18
12
 
19
- - Required: `test-case-strategy` for risk-driven test selection, meaningful oracle design, and unit drift checks.
20
- - Conditional: `generate-spec` for shared planning docs when spec-trigger conditions are met; `recover-missing-plan` when the user points to a required `docs/plans/...` spec set that is missing, archived, or mismatched in the current workspace.
13
+ - Required: `test-case-strategy` for risk selection, oracles, drift checks.
14
+ - Conditional: **`generate-spec`** when spec triggers below fire; **`recover-missing-plan`** when user-named `docs/plans/...` is missing/archived/mismatched.
21
15
  - Optional: none.
22
- - Fallback: If `test-case-strategy` is unavailable, stop and report the missing dependency. If specs are required and `generate-spec` is unavailable, stop and report the missing dependency.
16
+ - Fallback: **`test-case-strategy`** unavailable ⇒ **stop**. Spec path required but **`generate-spec`** unavailable ⇒ **stop**.
23
17
 
24
- ## Standards
18
+ ## Non-negotiables
25
19
 
26
- - Evidence: Explore the existing codebase first and verify the latest authoritative docs for the involved stack or integrations.
27
- - Execution: Decide whether specs are required from the actual change surface, run `generate-spec` when needed, then continue through implementation, testing, and backfill until the active scope is fully reconciled; when the user asks for a specific final behavior or architectural end state, do not substitute a preparatory or partial milestone unless the user explicitly re-scopes the request.
28
- - Quality: Use `test-case-strategy` to add risk-based tests with property-based, regression, integration, E2E, adversarial, and rollback coverage when relevant.
29
- - Output: Keep implementation and any planning artifacts traceable, updated, and aligned with actual completion results.
20
+ - **MUST** explore relevant code (entrypoints, flows, integrations) **before** deciding process or editing—**MUST NOT** spec-dump or code-dump from titles alone.
21
+ - Spec path **when** any: new/changed **user-visible** behavior (not mere restore of old intent); ambiguity needing approval; multi-module alignment; critical/sensitive/irreversible/migration risk; traceability materially reduces error.
22
+ - **MUST NOT** open **`generate-spec`** for clearly tiny/localized work: pure regression to prior intent; polish-only UI copy/style; one-area config/constant/flag; narrow CRUD/validation tweak; internal refactor/observability **without** behavior change—**implement + `test-case-strategy` directly**.
23
+ - If specs: **MUST** complete **`generate-spec`** lifecycle (approval before code; backfill after); **≤3 modules** per spec set—split independent non-dependent sets + batch `coordination.md` when coordinated parallelism; **MUST NOT** code pre-approval.
24
+ - **MUST NOT** yield with approved in-scope **`tasks.md`/`checklist.md`** undone except user deferral or documented external blocker (record in plans).
25
+ - **`test-case-strategy` required** for non-trivial deltas—property/adversarial/integration etc. per risk; meaningful oracles; drift check or explicit **`N/A`** with reason per non-trivial logic task.
26
+ - External deps: **`contract.md`** records official-backed obligations when material.
27
+
28
+ ## Standards (summary)
29
+
30
+ - **Evidence**: Code exploration + official docs/APIs where touched.
31
+ - **Execution**: Explore → decide specs → docs/officials → implement → test → backfill/summary.
32
+ - **Quality**: No speculative scope expansion; reuse patterns.
33
+ - **Output**: Behavior matches ask; traceable tests; plans honest if specs used.
30
34
 
31
35
  ## Workflow
32
36
 
33
- ### 1) Explore codebase first
34
-
35
- - Read the relevant existing code before deciding process or editing anything.
36
- - Locate entrypoints, configuration, and primary data flow.
37
- - Trace module relationships (imports, call graph, shared models, side effects).
38
- - Identify integration points (DB, RPC, external APIs, queues, filesystems).
39
- - Identify user-critical logic chains affected by the change.
40
- - Summarize findings and the likely change surface before editing.
41
-
42
- ### 2) Decide whether specs are required from the requested change
43
-
44
- Use the user's requested change together with the codebase exploration results to decide whether to generate specs.
45
-
46
- Trigger specs when any of the following is true:
47
- - the change introduces new user-visible behavior, not just a bug fix restoring intended behavior
48
- - requirements are ambiguous enough that approval on written scope, tradeoffs, or edge cases is useful
49
- - multiple modules, layers, services, or teams must stay aligned
50
- - the change touches critical flows, sensitive data, permissions, money movement, migrations, or irreversible operations
51
- - the risk profile is high enough that explicit requirement-to-test traceability will materially reduce mistakes
52
-
53
- Do not generate specs when the work is clearly small and localized, such as:
54
- - bug fixes or regressions that restore already-intended behavior without changing product scope
55
- - pure frontend polish: copy tweaks, styling, spacing, alignment, responsive touch-ups, visual cleanup, or simple template/view wiring
56
- - small configuration, constant, dependency, content, or feature-flag updates confined to one area
57
- - straightforward CRUD field additions, validation message tweaks, or one-path handler adjustments with limited blast radius
58
- - refactors, renames, dead-code cleanup, or observability-only changes that do not alter user-visible behavior
59
-
60
- When in doubt, prefer direct implementation for genuinely low-risk localized changes, and reserve specs for changes whose scope or risk would benefit from explicit approval artifacts.
61
-
62
- If triggered:
63
- - If the user already points to a specific `docs/plans/...` path and that plan set is missing or mismatched in the current workspace, run `$recover-missing-plan` before deciding whether to continue implementation or backfill.
64
- - Run `$generate-spec` and follow its workflow completely.
65
- - Use it to create or update `docs/plans/{YYYY-MM-DD}/{change_name}/spec.md`, `tasks.md`, `checklist.md`, `contract.md`, and `design.md`.
66
- - Keep each spec set scoped to at most three modules.
67
- - If the requested change would require edits across more than three modules, split it into multiple spec sets instead of drafting one large coupled plan.
68
- - Design the split spec sets so they are independently valid, do not conflict with each other, and do not require another spec set to land first.
69
- - When multiple spec sets are created for one coordinated change, place them under `docs/plans/{YYYY-MM-DD}/{batch_name}/{change_name}/` and maintain one batch-level `coordination.md` that records shared preparation, ownership boundaries, replacement direction, and merge order.
70
- - Ensure planned behaviors and edge cases cover external dependency states, abuse/adversarial paths, and any relevant authorization/idempotency/concurrency/data-integrity risks.
71
- - When external dependencies materially constrain the change, make sure `contract.md` captures their official-source-backed invocation surface, constraints, and caller obligations.
72
- - Make sure `design.md` captures the architecture/design delta, affected modules, control flow, and tradeoff decisions for the approved scope.
73
- - After implementation and testing, update the same plan set so `spec.md` reflects requirement completion status in addition to task and checklist progress.
74
- - If users answer clarification questions, update the planning docs and obtain explicit approval again before implementation.
75
- - Do not modify implementation code before approval.
76
- - Once approval is granted, do not stop with unchecked in-scope items remaining in `tasks.md` or applicable unchecked items in `checklist.md` unless the user explicitly defers them or an external blocker prevents safe completion.
77
-
78
- If not triggered:
79
- - Continue directly with the same downstream workflow below.
80
-
81
- ### 3) Verify latest authoritative docs
82
-
83
- - Identify the tech stack, libraries, and external dependencies involved.
84
- - Use official documentation as the source of truth.
85
- - Prefer Context7 for framework/library APIs; use web for latest official docs.
86
- - If required docs are private or missing, request access or user-provided references.
87
-
88
- ### 4) Implement the feature
89
-
90
- - Reuse existing patterns and abstractions; avoid over-engineering.
91
- - Keep changes focused and minimal; preserve current behavior unless required.
92
- - Follow project conventions (naming, linting, formatting, configuration).
93
- - Update environment examples only when new inputs are required.
94
- - If specs exist, treat every unchecked in-scope task and applicable checklist item as part of the required deliverable for this run.
95
- - Do not stop after partial code changes, partial tests, or partial backfill when approved planned work remains.
96
- - Do not present an enabling first stage, temporary coalescing step, or other intermediate milestone as complete when the user asked for the final scoped behavior.
97
- - Only pause before completion if:
98
- - the user changes scope or explicitly asks to stop
99
- - new clarification requires plan updates and renewed approval
100
- - an external blocker (missing credentials, unavailable dependency, access restriction, broken upstream system) prevents safe completion
101
- - When blocked, record the exact unfinished items and blocker in the spec set before yielding.
102
-
103
- ### 5) Testing coverage (required with or without specs)
104
-
105
- Use `$test-case-strategy` for every non-trivial change, even when specs are skipped.
106
-
107
- - Start from risk inventory and changed behavior, not from the happy path.
108
- - Define test oracles before implementation when the change is planned, and before finalizing tests when the change is discovered during brownfield exploration.
109
- - For each atomic task that changes non-trivial local logic, define a focused unit drift check or record the smallest replacement verification with a concrete `N/A` reason.
110
- - Add unit, regression, property-based, integration, E2E, adversarial, mock/fake, rollback, or no-partial-write coverage only when the risk profile warrants it.
111
- - Each planned test must have a meaningful oracle: exact business output, persisted state, emitted side effects, or intentional lack of side effects.
112
- - Run relevant tests when possible and fix failures.
113
-
114
- ### 6) Completion updates
115
-
116
- - If specs were used, backfill `spec.md`, `tasks.md`, `checklist.md`, `contract.md`, and `design.md` through `$generate-spec` workflow based on actual completion and test outcomes.
117
- - If the change used a parallel batch, update `coordination.md` whenever shared preparation, legacy replacement direction, or merge constraints changed during execution.
118
- - In `spec.md`, mark each relevant requirement with its actual completion state, such as completed, partially completed, deferred, or not implemented, plus brief evidence or rationale where needed.
119
- - If specs were used, mark every completed task in `tasks.md`.
120
- - If specs were used, update only the applicable checklist items that correspond to real scope, chosen test strategy, and actual execution.
121
- - If specs were used, update `contract.md` so the documented dependency obligations and constraints match the implemented reality.
122
- - If specs were used, update `design.md` so the architecture/design record matches the delivered implementation.
123
- - Do not mark unused template examples, mutually exclusive alternatives, or non-applicable branches as completed.
124
- - Remove, rewrite, or leave `N/A` on starter-template items when they do not belong to the real change.
125
- - Explicitly label any still-applicable remaining item as deferred or blocked with the reason.
126
- - If specs were not used, provide a concise execution summary including test IDs/results, regression coverage, mock scenario coverage, adversarial coverage, and any `N/A` reasons.
127
-
128
- ## Working Rules
129
-
130
- - Keep the solution minimal and executable.
131
- - Always decide the need for specs only after exploring the existing codebase.
132
- - When specs are used, keep each spec set limited to at most three modules; split broader work into independent, non-conflicting, non-dependent spec sets before approval.
133
- - When specs are split for parallel worktree implementation, keep batch-wide rules only in `coordination.md` rather than copying them into every spec-local `design.md`.
134
- - Maintain traceability between requirements, tasks, and tests when specs are present.
135
- - Treat checklists as living artifacts: adjust items to match real change scope.
136
- - Treat mutually exclusive template choices as a decision to record, not multiple boxes to finish.
137
- - Every planned test should justify a distinct risk; remove shallow duplicates that only prove the code "still runs".
138
- - If a spec set exists and approval has been granted, do not yield with unfinished in-scope tasks or checklist items unless the user approves a deferment or an external blocker makes completion impossible.
37
+ **Chain-of-thought:** **`Pause →`** after explorations and spec decision—wrong classification wastes days.
38
+
39
+ ### 1) Explore codebase
40
+
41
+ - Map modules, integrations, blast radius.
42
+ - **Pause →** Can I state **one paragraph** concrete change surface before editing?
43
+
44
+ ### 2) Decide specs
45
+
46
+ - Apply Non-negotiable triggers above; if doubt favors **implement-only** **only when** genuinely low-risk localized.
47
+ - If specs: broken path ⇒ **`recover-missing-plan`** then **`generate-spec`** (templates, clarification loop, approval). Parallel batch rules per **`generate-spec`**. If **not** specs: complete step 2 with “no specs” rationale, then continue with steps 3–6 (still run official-doc pass when external surfaces change).
48
+ - **Pause →** Am I dodging specs just to avoid bureaucracy while scope is multi-team/critical?
49
+
50
+ ### 3) Authoritative docs
51
+
52
+ - Official docs / Context7 / web for libs used in change.
53
+
54
+ ### 4) Implement
55
+
56
+ - Minimal diffs preserving behavior unless tasked otherwise; specs ⇒ every in-scope unchecked item delivered; intermediate milestones ≠ user’s final asked outcome unless rescoped.
57
+
58
+ ### 5) Testing (always for non-trivial)
59
+
60
+ - **`test-case-strategy`**: inventory risk tests with oracles run/fix.
61
+
62
+ ### 6) Completion
63
+
64
+ - With specs: backfill **`spec.md`/`tasks.md`/`checklist.md`/`contract.md`/`design.md`** (+ **`coordination.md`** if batch truth moved). **`spec.md`** requirement status honest. Strip template noise / `N/A` properly.
65
+ - Without specs: concise summary citing tests/results/`N/A` reasons.
66
+
67
+ ## Sample hints
68
+
69
+ - **Spec yes**: Adds new permission model affecting API+DB+UI—the blast radius crosses layers.
70
+ - **Spec no**: Off-by-one in existing pagination restoring documented behavior—fix + regression test.
71
+ - **Split**: Touches auth, billing, infra—**three plans** capped modules, **`coordination.md`** collision map.
139
72
 
140
73
  ## References
141
74
 
142
- - `$generate-spec`: shared planning and approval workflow.
143
- - `$test-case-strategy`: shared test selection, oracle design, and unit drift-check workflow.
75
+ - **`generate-spec`**: planning/backfill lifecycle
76
+ - **`test-case-strategy`**: tests + drift philosophy
77
+ - **`recover-missing-plan`**: heal missing dirs
@@ -1,215 +1,106 @@
1
1
  ---
2
2
  name: generate-spec
3
- description: Generate and maintain shared feature planning artifacts (`spec.md`, `tasks.md`, `checklist.md`, `contract.md`, `design.md`, and when needed shared `coordination.md` or `preparation.md`) from standard templates with clarification tracking, approval gating, unit drift-check planning, and post-implementation backfill. Use when a workflow needs specs before coding, or when another skill needs to create/update planning docs under `docs/plans/{YYYY-MM-DD}/...`.
3
+ description: >-
4
+ Author planning trees under docs/plans: run `apltk create-specs`, hydrate templates (`spec/tasks/checklist/contract/design`; add `coordination.md`/`preparation.md` when parallel/prep dictates), cite official docs for every material external dependency, plan tests with **`test-case-strategy`**, and block product code changes until explicit user approval completes.
5
+ Use when drafting or refreshing specs before coding, restructuring multi-member batches, or recording clarifications—not when simply executing tasks from an approved plan (**`implement-specs*`** family instead).
6
+ Reject ALWAYS vague `tasks.md` lines missing file target + mutation + verifier; SPLIT work when scope exceeds three modules; never overwrite a neighboring `{change}` directory for a different issue.
7
+ Example bad: `- [ ] Add tests`… Example ok: `- [ ] src/auth/scope.rs — deny unknown scopes — Verify: cargo test scope::defaults`…
4
8
  ---
5
9
 
6
10
  # Generate Spec
7
11
 
8
12
  ## Dependencies
9
13
 
10
- - Required: `test-case-strategy` for risk-driven test case selection, meaningful oracle design, and unit drift-check planning.
14
+ - Required: `test-case-strategy` for risk-driven test selection, oracles, and unit drift-check planning.
11
15
  - Conditional: none.
12
16
  - Optional: none.
13
- - Fallback: If `test-case-strategy` is unavailable, stop and report the missing dependency instead of inventing test coverage heuristics locally.
17
+ - Fallback: If `test-case-strategy` is unavailable, **MUST** stop and report it. **MUST NOT** invent local coverage heuristics as a substitute.
14
18
 
15
- ## Standards
19
+ ## Non-negotiables
16
20
 
17
- - Evidence: Review the relevant code, configs, and authoritative docs before filling requirements or test plans; when external dependencies, libraries, frameworks, APIs, or platforms are involved, checking their official documentation is mandatory during spec creation.
18
- - Execution: Generate the planning files from this skill's current templates first. Follow the scoping, independence, and parallel-safety rules in Working Rules. Surface shared-file or shared-contract collision risks during planning and resolve coordination rules before implementation starts. Use `preparation.md` only when needed; keep that preparation minimal and free of core business logic or target outcomes (see Working Rules). Complete plans with traceable requirements and risks, handle clarification updates, then wait for explicit approval before implementation.
19
- - Quality: Keep `spec.md`, `tasks.md`, `checklist.md`, `contract.md`, `design.md`, and any shared batch docs synchronized, use `test-case-strategy` to map each planned test to a concrete risk or requirement, preserve the actual headings and field structure from this skill's templates, and tailor the templates so only applicable items remain active.
20
- - Output: Store planning artifacts under `docs/plans/{YYYY-MM-DD}/{change_name}/` for single-spec work, or `docs/plans/{YYYY-MM-DD}/{batch_name}/{change_name}/` plus shared `coordination.md` for multi-spec parallel work. Add shared `preparation.md` at the batch root only when prerequisite work must land before member specs can run in parallel, and keep individual specs concise, executable, non-overlapping with that preparation, and easy to update.
21
+ - **MUST** read relevant code, config, and authoritative external documentation before writing requirements, contracts, or test plans. When the change depends on frameworks, libraries, SDKs, APIs, CLIs, or hosted services, **MUST** consult **official** documentation during spec creation (required evidence step, not optional).
22
+ - **MUST** generate new or refreshed files from this skills **`references/templates/*.md`** via `apltk create-specs` (paths `scripts/...` and `references/...` in this document are **under this skill folder**, not the target project). **MUST NOT** let older `docs/plans/...` layouts override current template headings or required fields; old plans are scope evidence only.
23
+ - **MUST NOT** overwrite or repurpose a neighboring plan directory just because topics overlap; adjacent scope **MUST** get a new `change_name` unless it is the **same** issue/change.
24
+ - **MUST** keep each spec set to **at most three modules** that will be touched. If broader, **MUST** split into multiple spec sets (each ≤3 modules), each independently valid; **MUST NOT** ship one oversized coupled plan.
25
+ - **MUST** use batch-root `preparation.md` **only** for minimal shared prerequisite work that must land before parallel implementation; keep that preparation minimal and free of core business logic or target outcomes (see Working Rules). **`preparation.md` content boundary**: enabling scaffolds, shared fixtures, stubs, mechanical migrations, compatibility surfaces—**no** core business logic, **no** target user-visible outcomes (those stay in normal specs). Exclude core business logic, target business outcomes, user-visible behavior changes, and member-spec implementation guidance; those belong in normal spec files.
26
+ - **`tasks.md` checklist items**: **every** `- [ ]` **MUST** specify (a) concrete file/function target, (b) specific modification and expected outcome, (c) a verification hook—**no** vague rows (`Implement integration`, `Add tests`). Forbidden vague items **MUST** be rewritten before approval.
27
+ - **MUST** use `test-case-strategy` when planning non-trivial logic tests and checklist mapping (test IDs, drift checks). Every **non-trivial** `tasks.md` implementation item **MUST** name a focused unit drift check, another concrete verification hook, or **`N/A`** with a concrete reason.
28
+ - **MUST NOT** modify implementation code before **explicit user approval** of the spec set. Clarifications **MUST** sync across affected files and **MUST** re-trigger approval. If scope becomes a **different issue**, **MUST** stop editing the old set and create a **new** `change_name`.
29
+ - Write prose in the **user’s language** by default; keep requirement/task/test IDs traceable across `spec.md`, `tasks.md`, and `checklist.md`.
30
+ - **MUST** use **kebab-case** `change_name`; **MUST NOT** use spaces or arbitrary special characters in names.
21
31
 
22
- ## Goal
32
+ ## Standards (summary)
23
33
 
24
- Own the shared planning-doc lifecycle for feature work so other skills can reuse one consistent spec-generation workflow.
34
+ - **Evidence**: Official docs when externally constrained; record cites in `spec.md` / `contract.md`.
35
+ - **Execution**: Scaffold → fill templates in place → clarification loop → approval gate → (later) backfill after implementation.
36
+ - **Quality**: Synchronized artifacts; applicable template sections only; realistic checklist vs boilerplate (add/remove by risk); finalized docs read as an approved plan, not a fully checked starter; `contract.md` standardized records or honest `None` with reason.
37
+ - **Output**: `docs/plans/{YYYY-MM-DD}/{change_name}/` or `docs/plans/{YYYY-MM-DD}/{batch_name}/{change_name}/`; batch root `coordination.md` when intentionally parallel; `preparation.md` only when prerequisite batch work is required first.
25
38
 
26
39
  ## Workflow
27
40
 
28
- ### 1) Gather inputs and evidence
29
-
30
- - Confirm the target workspace root, feature name, and a kebab-case `change_name`.
31
- - Review only the code, configuration, and external docs needed to understand the requested behavior.
32
- - **Official documentation lookup is mandatory** when the change depends on frameworks, libraries, SDKs, APIs, CLIs, hosted services, or other external systems. This is a required evidence-gathering step, not an optional refinement.
33
- - Use the official docs to verify expected behavior, supported constraints, configuration surface, integration contracts, and any implementation limits that should shape the spec.
34
- - Record the references that should appear in `spec.md` and the dependency evidence that should appear in `contract.md`.
35
- - Inspect existing `docs/plans/` directories before deciding whether to edit an existing plan set.
36
- - Reuse an existing plan set only when it clearly matches the same requested issue/change scope.
37
- - If the requested work is adjacent to, but not actually covered by, an existing plan set, create a new directory instead of overwriting the neighboring one.
38
- - Treat existing or archived project-local specs as scope evidence only, not as formatting authority.
39
- - Do not copy older spec layouts, condensed repo conventions, or neighboring plan structures when they differ from this skill's current templates.
40
-
41
- ### 2) Generate the planning files
42
-
43
- - Resolve paths from this skill directory, not the target project directory.
44
- - Before generating files, identify the concrete modules that would be touched by the requested change.
45
- - Keep each spec set scoped to at most three modules.
46
- - If the requested work would span more than three modules, do not draft one oversized coupled plan.
47
- - Instead, split the work into multiple spec sets, each independently valid and each covering no more than three modules.
48
- - See Working Rules for the independence rule.
49
- - Use `preparation.md`, not individual spec files, when the only safe way to parallelize a batch is to land shared prerequisite work before any spec starts.
50
- - Keep `preparation.md` small: it may define enabling scaffolds, shared test fixtures, naming/contract stubs, mechanical migrations, or non-business compatibility surfaces. See Working Rules for the preparation.md rule.
51
- - Allow shared preparation only when it is completed before parallel implementation begins; do not hide required pre-work inside one member spec while other specs depend on it.
52
- - See Working Rules for the parallel-safety rule.
53
- - If two candidate spec sets would still need to edit the same non-additive surface, either merge them into one spec set, record a concrete ownership split plus additive-only rule that makes parallel work safe, or move the shared pre-work into `preparation.md` when the pre-work can be completed once before all specs.
54
- - Use:
55
- - `WORKSPACE_ROOT=<target_project_root>`
56
- - `apltk create-specs "<feature_name>" --change-name <kebab-case> --output-dir "$WORKSPACE_ROOT/docs/plans"`
57
- - For parallel multi-spec generation, also use:
58
- - `--batch-name <kebab-case-batch-name>`
59
- - `--with-coordination`
60
- - If and only if multiple spec sets cannot be made parallel-safe without prior shared work, also use:
61
- - `--with-preparation`
62
- - Always generate:
63
- - `references/templates/spec.md`
64
- - `references/templates/tasks.md`
65
- - `references/templates/checklist.md`
66
- - `references/templates/contract.md`
67
- - `references/templates/design.md`
68
- - Generate `references/templates/coordination.md` at the batch root when multiple spec sets are intentionally created for parallel implementation.
69
- - Generate `references/templates/preparation.md` at the batch root only when required prerequisite work must be completed before member specs can be parallel-implemented.
70
- - Save files under `docs/plans/{YYYY-MM-DD}/{change_name}/` or `docs/plans/{YYYY-MM-DD}/{batch_name}/{change_name}/`.
71
- - After generation, fill the files in place without renaming, removing, or collapsing template headings unless a heading is explicitly template-only and not applicable to the real scope.
72
- - Before approval, compare the drafted files against the current template headings and required fields; fix any drift caused by following older project examples.
73
-
74
- ### 3) Fill `spec.md`
75
-
76
- - Keep the goal and scope concrete.
77
- - Ensure the described scope and requirements do not contradict the relevant official documentation or integration contracts.
78
- - Write functional behaviors in BDD form with `GIVEN`, `WHEN`, `THEN`, `AND`, and `Requirements`.
79
- - Make each requirement testable.
80
- - Cover boundaries, authorization, external dependency states, abuse/adversarial paths, failure handling, and any relevant idempotency/concurrency/data-integrity risks.
81
- - Record the official-doc references actually used for the spec, especially for external dependency behavior and constraints.
82
- - If requirements are unclear, list 3-5 clarification questions; otherwise write `None`.
83
-
84
- ### 4) Fill `tasks.md`
85
-
86
- - Use `## **Task N: [Task Title]**` for each main task with `Purpose`, `Requirements`, `Scope`, and `Out of scope` guardrails.
87
- - Use `- N. [ ]` for atomic task items; use `- N.x [ ]` only when a task must be split into additional atomic subtasks.
88
- - Treat `tasks.md` as an implementation queue, not a high-level summary.
89
- - **Every checkbox must specify three things: (a) the exact file path or function, (b) the specific modification to make, and (c) a concrete verification step.** These three are mandatory — no item may omit any of them.
90
- - Per-item format (compact template):
91
- - `[file/function]` — `[specific modification; expected outcome]`
92
- - `- Verify:` — focused command, test reference, or manual inspection
93
- - Do not add extra sub-fields beyond what the template provides; put all change detail in the inline description.
94
- - Make each checkbox atomic: one verb, one file/function, one change outcome, and one verification hook.
95
- - If one task needs more than three files, more than one behavior slice, or an implementation decision not already captured in `design.md` or `contract.md`, split it before approval.
96
- - Use `$test-case-strategy` to define test IDs and unit drift checks for non-trivial local logic before implementation starts.
97
- - Include explicit tasks for testing, mocks/fakes, regression coverage, and adversarial or edge-case hardening when relevant.
98
- - Vague items such as `Implement integration`, `Add tests`, or `Update docs` are forbidden; replace them with specific file paths, concrete changes, and executable verification commands.
99
-
100
- ### 5) Fill `contract.md`
101
-
102
- - When the change uses external dependencies, libraries, frameworks, SDKs, APIs, CLIs, hosted services, or other upstream systems, document each material dependency in a standardized dependency record.
103
- - For each dependency, capture the official source, the invocation surface, required inputs, expected outputs, supported behavior, limits, compatibility constraints, security/access requirements, failure contract, and caller obligations.
104
- - Record constraints and forbidden assumptions explicitly so later implementation and review do not rely on unstated expectations.
105
- - If no external dependency materially constrains the change, write `None` and a brief scope-based reason instead of inventing a fake dependency record.
106
-
107
- ### 6) Fill `design.md`
108
-
109
- - Write the architecture/design delta related to the current spec in a standardized format.
110
- - Identify the affected modules, current baseline, proposed architecture, component responsibilities, control flow, data/state impact, and risk/tradeoff decisions.
111
- - Cross-reference relevant requirement IDs from `spec.md` and any external dependency records from `contract.md`.
112
- - Make architecture boundaries, invariants, and rollback/fallback expectations explicit when they matter to safe implementation.
113
- - When the spec belongs to a parallel batch, add a short reference to the parent `coordination.md`, state the exact assumptions that let this spec be implemented in parallel, and keep `design.md` focused on the single-spec delta rather than duplicating cross-spec ownership rules.
114
- - When the batch uses `preparation.md`, write each spec's implementation guidance as if the preparation has already been completed and committed; do not duplicate preparation tasks, verification, or shared setup in member specs.
115
-
116
- ### 6.5) Fill `coordination.md` for parallel multi-spec batches
117
-
118
- - Create `coordination.md` only when one user request is intentionally split into multiple spec sets that may be implemented in parallel.
119
- - Place it at `docs/plans/{YYYY-MM-DD}/{batch_name}/coordination.md`.
120
- - Use it as the batch-level source of truth organized in three sections: **Business Goals**, **Design Principles**, and **Spec Boundaries**.
121
- - Keep single-spec concerns in that spec's own `design.md`; reserve `coordination.md` for batch-wide rules only.
122
- - See Working Rules for the independence rule.
123
-
124
- **Business Goals** — Record the shared batch outcome, list the member spec sets, state parallel readiness, and note shared exclusions. If the batch is not ready, point to `preparation.md` or list blocking coordination items.
125
-
126
- **Design Principles** — Record the current baseline, shared invariants and constraints that every spec must preserve, legacy replacement direction, compatibility windows, and post-cutover cleanup. Keep these high-level and cross-cutting; leave per-spec design decisions in each `design.md`.
127
-
128
- **Spec Boundaries** — Split into two sub-sections:
129
- - **Ownership Map**: For each spec set, list its primary concern, allowed touch points, and forbidden touch points. This is the merge-conflict prevention contract.
130
- - **Collisions & Integration**: Record shared-file edit rules, API/schema freeze owners, compatibility shim retention rules, merge order, post-merge integration checkpoints, and the re-coordination trigger. Every known collision candidate must have a pre-agreed resolution.
131
-
132
- ### 6.6) Fill `preparation.md` only for prerequisite work
133
-
134
- - Create `preparation.md` only when multiple spec sets cannot be implemented safely in parallel until shared prerequisite work is completed first.
135
- - Place it at `docs/plans/{YYYY-MM-DD}/{batch_name}/preparation.md`.
136
- - Treat it as a pre-parallel implementation queue for the coordinating/main agent, not as another member spec.
137
- - Follow a tasks.md-like structure with a **Preparation Goal** header, atomic preparation tasks, a **Validation** section, and a **Handoff** section.
138
- - In **Preparation Goal**, state why this prerequisite is necessary, confirm that no core business logic is implemented here, list which specs depend on it, and define when parallel work can start.
139
- - In each **Task P[N]**, use the same compact format as `tasks.md`: a one-line Purpose, Scope, and Out of scope guardrails, followed by atomic checkbox items with concrete file paths, modifications, and verification hooks.
140
- - Include only the smallest shared prerequisite work that every affected spec can assume after it lands.
141
- - Exclude core business logic, target business outcomes, user-visible behavior changes, and member-spec implementation guidance; those belong in normal spec files.
142
- - In **Validation**, list the verification commands, expected results, and regression risks that prove the prepared baseline is ready.
143
- - In **Handoff**, record what member specs may assume, what they must not change, and the re-coordination rule if preparation changes later.
144
- - Remove overlapping instructions from member specs; specs must reference the prepared baseline as an assumption instead of repeating the setup tasks.
145
- - See Working Rules for the parallel-safety rule.
146
-
147
- ### 7) Fill `checklist.md`
148
-
149
- - Use checkbox format `- [ ]` for checklist items.
150
- - Adapt the template to actual scope; remove inapplicable items.
151
- - Map observable behaviors to requirement IDs and test case IDs using `$test-case-strategy`.
152
- - Each Behavior-to-Test item: `[CL-xx]: [behavior] — R?.? → [Test IDs] — Result: [status]`.
153
- - Property-based coverage required for business-logic changes unless `N/A` with concrete reason.
154
- - Hardening items: keep as single-line checkboxes with `N/A` + reason when not applicable.
155
- - E2E/Integration decisions: one checkbox per decision with inline reason.
156
- - Execution summary: one checkbox per test category with status.
157
- - Completion records: one checkbox per flow/group with status and remaining items.
158
-
159
- ### 8) Process clarifications and approval
160
-
161
- - When the user answers clarification questions, first update the clarification and approval section in `checklist.md`.
162
- - Review whether `spec.md`, `tasks.md`, `checklist.md`, `contract.md`, and `design.md` must be updated.
163
- - After any clarification-driven update, obtain explicit approval on the updated spec set again.
164
- - Do not modify implementation code before approval.
165
- - When clarification reveals the work is a different issue or materially different scope than the current plan set, stop editing that plan set and generate a new one with a distinct `change_name`.
166
-
167
- ### 9) Backfill after implementation and testing
168
-
169
- - Mark completed tasks in `tasks.md`.
170
- - Update `checklist.md` with real test outcomes, `N/A` reasons, and any scope adjustments.
171
- - Update `contract.md` when the final dependency usage, obligations, or verified constraints differ from the planning draft.
172
- - Update `design.md` when the approved architecture changes during implementation, and record the final chosen design rather than leaving stale placeholders.
173
- - Update `coordination.md` when shared ownership, replacement sequencing, or cross-spec preparation changed during implementation or merge planning.
174
- - Update `preparation.md` when prerequisite work was completed, verified, skipped with an approved reason, or changed during implementation.
175
- - Only mark checklist items complete when the work actually happened or the recorded decision actually applies.
176
- - Do not check off unused examples, placeholder rows, or non-selected decision options.
177
- - If different flows use different test strategies, preserve separate decision records in the final checklist instead of merging them into a misleading single summary.
178
- - If different parts of the approved scope have different completion states, preserve separate completion records in the final checklist instead of flattening them into one ambiguous status.
179
- - Remove stale placeholders or template-only guidance once the documents are finalized.
180
-
181
- ## Working Rules
182
-
183
- - By default, write planning docs in the user's language.
184
- - Keep requirement IDs, task IDs, and test IDs traceable across all three files.
185
- - Every non-trivial implementation task must have either a focused unit drift check, another concrete verification hook, or an explicit `N/A` reason.
186
- - Never allow one spec set to cover more than three modules.
187
- - When a request exceeds that scope, split it into independent, non-conflicting, non-dependent spec sets before approval.
188
- - For batch specs, independence is mandatory: each spec must describe a complete slice that can be implemented, tested, reviewed, and merged without waiting for another spec in the same batch.
189
- - For batch specs, parallel readiness is also mandatory: each spec must be safe to implement concurrently after any approved `preparation.md` work is completed, with shared-file collisions and ownership rules settled in `coordination.md` before coding begins.
190
- - Use `preparation.md` sparingly: it is allowed only for explicit, minimal, non-business pre-parallel shared work, not for normal cross-spec coordination or member-spec implementation.
191
- - When multiple spec sets are created for one batch, keep their shared implementation direction in one `coordination.md` instead of duplicating cross-spec rules in every `design.md`.
192
- - When `preparation.md` exists, every member spec must avoid duplicating its tasks and must state its implementation assumptions against the post-preparation baseline.
193
- - For parallel worktree batches, make `coordination.md` specific enough that another engineer can tell which files they may edit, which shared contracts are frozen or additive-only, which shims must remain in place, and what combined behaviors need verification after merge.
194
- - Prefer realistic coverage over boilerplate: add or remove checklist items based on actual risk.
195
- - When external dependencies materially shape the change, `contract.md` is required and must capture the official-source-backed contract in the standardized record format.
196
- - `design.md` is required and must describe the architecture/design delta for the spec in the standardized format, even when the final design is intentionally minimal.
197
- - Finalized planning docs should read like the actual approved plan and execution record, not like a fully checked starter template.
198
- - If official documentation materially constrains implementation choices, reflect that constraint explicitly in the spec instead of leaving it implicit.
199
- - Use kebab-case for `change_name`; avoid spaces and special characters.
200
- - Path rule: `scripts/...` and `references/...` in this file always mean paths under the current skill folder, not the target project root.
201
- - Never overwrite a nearby issue's plan set just because the technical area overlaps; shared modules are not sufficient evidence that the scope is the same.
202
- - Template authority rule: the current `references/templates/*.md` files in this skill are the binding format for new or refreshed spec documents. Older `docs/plans/...` files may inform scope, terminology, and historical decisions, but they must not override the current template structure.
203
- - Before presenting specs for approval, run a template-drift pass: verify the expected template sections are present, remove stale placeholder examples, and ensure any removed section has a scope-based reason rather than being omitted because an older project spec omitted it.
41
+ **Chain-of-thought:** For every subsection **`N)`**, answer **`Pause →`** prompts before scaffolding or authoring the next subsection; unanswered external constraints or ambiguous scope mean **stop** or **loop** clarifications—not silent drafting.
42
+
43
+ ### 1) Inputs and evidence
44
+
45
+ Confirm workspace root, feature title, kebab-case `change_name`. Review minimal code/config. **Mandatory** official-doc pass when external systems apply; note sources for `spec.md` / `contract.md`. Inspect existing `docs/plans/`—reuse a set **only** when it matches **this** issue; otherwise create a new directory.
46
+ - **Pause →** Which **official** URLs or docs did I actually consult for each external dependency I plan to cite—URLs not opened are not citations?
47
+ - **Pause →** Is the user ask the **same** issue as an existing nearby plan—or only **adjacent**, requiring a **new** `change_name`?
48
+ - **Pause →** What is the smallest set of repo paths whose behavior I **must** read before writing requirements truthfully?
49
+
50
+ ### 2) Scaffold planning files
51
+
52
+ Identify concrete modules (≤3 per set; split if needed). Resolve shared collision: merge spec sets, additive-only ownership rules in `coordination.md`, or `preparation.md` when one-time shared prep is the only safe path.
53
+
54
+ Run from this skill’s context (templates resolved from this skill dir):
55
+
56
+ ```bash
57
+ WORKSPACE_ROOT=<target_project_root>
58
+ apltk create-specs "<feature_name>" --change-name <kebab-case> --output-dir "$WORKSPACE_ROOT/docs/plans"
59
+ ```
60
+
61
+ Multi-spec parallel batch: add `--batch-name <kebab-case>` and `--with-coordination`. **Only** if parallel safety needs prior shared work: add `--with-preparation`.
62
+
63
+ Always materialize: `spec.md`, `tasks.md`, `checklist.md`, `contract.md`, `design.md` from `references/templates/`. Add `coordination.md` / `preparation.md` at batch root only when flags require. Save under `docs/plans/{YYYY-MM-DD}/...`. After generation, fill in place **without** removing template headings unless truly N/A (document reason). Run a **template-drift pass** before approval: sections present, placeholders removed or justified.
64
+ - **Pause →** List the **module names** (≤3) this spec set will touch; if more, where is my **split plan**?
65
+ - **Pause →** For every shared file two specs might touch, where is the **named** resolution in `coordination.md` or why is `preparation.md` required instead?
66
+ - **Pause →** Did I run `apltk create-specs` from the **skill** context so template paths resolve correctly?
67
+
68
+ ### 3) Author content (fill templates)
69
+
70
+ - **`spec.md`**: Concrete scope; BDD (`GIVEN` / `WHEN` / `THEN` / `AND` / `Requirements`); testable requirements; boundaries, auth, failure, idempotency/concurrency/integrity where relevant; doc references; `3-5` clarification questions or `None`.
71
+ - **`tasks.md`**: `## **Task N: [Title]**` with Purpose, Requirements, Scope, Out of scope; atomic `- N [ ]` lines obeying the triple requirement above; split tasks that exceed three files / multiple behavior slices / undocumented decisions; integrate `test-case-strategy` for test IDs and drift checks for non-trivial logic.
72
+ - **`contract.md`**: One record per material external dependency (source, surface, I/O, limits, security, failures); else `None` + short reason—**no** fabricated deps.
73
+ - **`design.md`**: Delta vs baseline; modules, responsibilities, flow, state, risks; cross-ref requirement IDs; parallel batch: pointer to `coordination.md`, assumptions for safe concurrency, **no** duplicating batch rules; with `preparation.md`, assume prep **done**—**do not** duplicate prep tasks.
74
+ - **`coordination.md`** (batch root, parallel only): **Business Goals** (outcome, member specs, parallel readiness, exclusions, blockers → `preparation.md` or list); **Design Principles** (baseline, shared invariants, compat, cleanup—high level); **Spec Boundaries** → **Ownership Map** (allowed/forbidden touchpoints per spec) and **Collisions & Integration** (shared-file rules, freeze owners, merge order, checkpoints, re-coordination trigger)—**every** collision candidate **MUST** have a named resolution.
75
+ - **`preparation.md`** (batch root, only if required): Preparation Goal (why, no core business logic, dependents, start condition); **Task P[N]** like `tasks.md` (atomic triple items); **Validation**; **Handoff** (assumptions, must-not-change, if prep changes later). Strip duplicate prep from member specs.
76
+ - **`checklist.md`**: `- [ ]` adapted to scope; map behaviors to requirement/test IDs via `test-case-strategy`; behavior lines `[CL-xx]: … — R?.? → [Test IDs] — Result: …`; property-based logic **required** unless `N/A` + reason; honest execution/completion records—**no** checking unused examples or unchosen options.
77
+ - **Pause →** Pick one **random** `tasks.md` checkbox: does it still fail the triple rule (target, change, verify)—if yes, rewrite now?
78
+ - **Pause →** Does every **R** requirement ID I care about appear in `tasks.md` or `checklist.md` with a test or explicit `N/A`?
79
+ - **Pause →** For parallel batches, does `design.md` **avoid** duplicating what `coordination.md` already owns?
80
+
81
+ ### 4) Clarifications and approval
82
+
83
+ On answers: update clarification/approval section in `checklist.md` first, then any of `spec.md`, `tasks.md`, `checklist.md`, `contract.md`, `design.md`; **MUST** obtain approval again after material edits. **MUST NOT** touch product code pre-approval.
84
+ - **Pause →** Am I about to “just fix a small bug” in product code before explicit approval—**why is that not a hard stop**?
85
+ - **Pause →** After the last edit, does the user still owe an **explicit** approval token, or did I assume silence means yes?
86
+
87
+ ### 5) Backfill after implementation
88
+
89
+ When implementation exists: mark `tasks.md`; sync `checklist.md` outcomes/`N/A`; fix `contract.md` / `design.md` if reality diverged; update `coordination.md` / `preparation.md` if ownership or prep status changed. Checklist complete **only** for work actually done or decisions actually taken; separate rows for divergent flows; remove stale placeholders.
90
+ - **Pause →** For each checked item, what **evidence** (commit, test log) would a reviewer use to agree it is true?
91
+ - **Pause →** Did implementation reality change **shared** ownership or prep assumptions—if so, which batch file records that?
92
+
93
+ ## Sample hints
94
+
95
+ - **`tasks.md` line bad**: `- [ ] Add tests` **reject** (no path, change, verifier).
96
+ - **`tasks.md` line — ok**:
97
+ `- [ ] src/auth/scope.rs — add deny-by-default matcher for unknown scopes · Verify: cargo test scope::defaults`
98
+ - **Batch scaffold** (three member specs): `WORKSPACE_ROOT=... apltk create-specs "OAuth batch" --change-name oauth-api --batch-name oauth-may-batch --with-coordination --output-dir "$WORKSPACE_ROOT/docs/plans"` (then repeat or use generator rules for additional `change-name` dirs as your tooling permits).
99
+ - **`checklist.md` behavior row sketch**: `[CL-01]: invalid token rejected R2.1 TU-Scope-01,TU-Scope-02 Result: pending`
100
+ - **Split-trigger**: change touches `src/auth/*`, `src/cli/*`, `src/db/*`, `infra/terraform/*` (four modules) **minimum two spec sets**, not one.
204
101
 
205
102
  ## References
206
103
 
207
- - `$test-case-strategy`: shared test case selection, oracle design, and unit drift-check workflow.
208
- - `scripts/create-specs`: shared planning file generator, exposed as `apltk create-specs`.
209
- - `references/templates/spec.md`: BDD requirement template.
210
- - `references/templates/tasks.md`: task breakdown template.
211
- - `references/templates/checklist.md`: behavior-to-test alignment template.
212
- - `references/templates/contract.md`: external dependency contract template.
213
- - `references/templates/design.md`: architecture/design delta template.
214
- - `references/templates/coordination.md`: parallel batch coordination template.
215
- - `references/templates/preparation.md`: optional pre-parallel prerequisite work template.
104
+ - `test-case-strategy`: test design and drift checks
105
+ - `scripts/create-specs` / `apltk create-specs`: generator
106
+ - `references/templates/spec.md`, `tasks.md`, `checklist.md`, `contract.md`, `design.md`, `coordination.md`, `preparation.md`: binding templates