@gtrabanco/pi-agentic-workflow 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (137) hide show
  1. package/LICENSE +21 -0
  2. package/README.es.md +154 -0
  3. package/README.md +148 -0
  4. package/dist/config/defaults.d.ts +8 -0
  5. package/dist/config/defaults.js +11 -0
  6. package/dist/config/load.d.ts +19 -0
  7. package/dist/config/load.js +76 -0
  8. package/dist/config/merge.d.ts +4 -0
  9. package/dist/config/merge.js +43 -0
  10. package/dist/config/schema.d.ts +21 -0
  11. package/dist/config/schema.js +144 -0
  12. package/dist/config/types.d.ts +53 -0
  13. package/dist/config/types.js +12 -0
  14. package/dist/extension/factory.d.ts +47 -0
  15. package/dist/extension/factory.js +49 -0
  16. package/dist/extension/index.d.ts +4 -0
  17. package/dist/extension/index.js +84 -0
  18. package/dist/routing/catalogue.d.ts +35 -0
  19. package/dist/routing/catalogue.js +79 -0
  20. package/dist/routing/dispatch.d.ts +34 -0
  21. package/dist/routing/dispatch.js +191 -0
  22. package/dist/routing/state.d.ts +13 -0
  23. package/dist/routing/state.js +65 -0
  24. package/dist/routing/types.d.ts +90 -0
  25. package/dist/routing/types.js +3 -0
  26. package/dist/settings/console.d.ts +55 -0
  27. package/dist/settings/console.js +266 -0
  28. package/dist/settings/store.d.ts +3 -0
  29. package/dist/settings/store.js +24 -0
  30. package/dist/settings/view.d.ts +11 -0
  31. package/dist/settings/view.js +46 -0
  32. package/package.json +59 -0
  33. package/skills/audit-docs/SKILL.md +171 -0
  34. package/skills/audit-pr/SKILL.md +201 -0
  35. package/skills/audit-pr/references/01_MERGE_GATES.md +24 -0
  36. package/skills/audit-pr/references/02_CLOSURE_AND_SCOPE_GATES.md +83 -0
  37. package/skills/audit-pr/references/03_AUDIT_PROCESS.md +69 -0
  38. package/skills/audit-pr/references/04_VERDICT.md +69 -0
  39. package/skills/audit-pr/references/05_ROUTING_AND_GUARDRAILS.md +58 -0
  40. package/skills/audit-pr/references/PORTABILITY.md +17 -0
  41. package/skills/design-feature/SKILL.md +162 -0
  42. package/skills/design-feature/references/INTERVIEW.md +52 -0
  43. package/skills/design-feature/references/PORTABILITY.md +15 -0
  44. package/skills/design-feature/references/UPSERT_EXAMPLE.md +8 -0
  45. package/skills/design-feature/references/WRITE_AND_UPSERT.md +92 -0
  46. package/skills/discover-repository-state/SKILL.md +83 -0
  47. package/skills/execute-phase/SKILL.md +115 -0
  48. package/skills/execute-phase/references/BATCH_AND_PORTABILITY.md +54 -0
  49. package/skills/execute-phase/references/CLOSEOUT.md +74 -0
  50. package/skills/execute-phase/references/DESCOPE.md +35 -0
  51. package/skills/execute-phase/references/EXECUTION_CONTRACT.md +147 -0
  52. package/skills/execute-phase/references/FOLDING.md +73 -0
  53. package/skills/execute-phase/references/FORGE_BODY.md +24 -0
  54. package/skills/execute-phase/references/HANDOFF.md +21 -0
  55. package/skills/execute-phase/references/OPPORTUNISTIC_FINDING.md +45 -0
  56. package/skills/execute-phase/references/PREFLIGHT.md +152 -0
  57. package/skills/execute-phase/references/UNIT_LOOP.md +88 -0
  58. package/skills/execute-phase/references/WORKFLOWS_FEATURE.md +37 -0
  59. package/skills/execute-phase/references/WORKFLOWS_FIX.md +43 -0
  60. package/skills/execute-phase/references/WORKFLOWS_LEGACY.md +26 -0
  61. package/skills/execute-phase/references/WORKFLOWS_SMALL_PHASED.md +38 -0
  62. package/skills/fold-findings/SKILL.md +141 -0
  63. package/skills/fold-findings/references/FOLD_POLICY.md +43 -0
  64. package/skills/fold-findings/references/FOLD_PROCESS.md +41 -0
  65. package/skills/generate-docs/SKILL.md +145 -0
  66. package/skills/generate-docs/references/ADAPTERS.md +15 -0
  67. package/skills/generate-docs/references/ADAPTER_DISCOVERY.md +33 -0
  68. package/skills/generate-docs/references/GENERATION_PROCESS.md +90 -0
  69. package/skills/init-workspace/SKILL.md +152 -0
  70. package/skills/init-workspace/references/BOOTSTRAP_DISCOVERY.md +70 -0
  71. package/skills/init-workspace/references/BOOTSTRAP_WRITE.md +58 -0
  72. package/skills/init-workspace/references/PORTABILITY.md +16 -0
  73. package/skills/init-workspace/references/UPGRADE.md +83 -0
  74. package/skills/log-session/SKILL.md +159 -0
  75. package/skills/loop-review-fold/SKILL.md +168 -0
  76. package/skills/orchestration-envelope/SKILL.md +81 -0
  77. package/skills/orchestration-envelope/references/TURN_CONTRACT.md +21 -0
  78. package/skills/phase-contract/SKILL.md +82 -0
  79. package/skills/plan-feature/SKILL.md +179 -0
  80. package/skills/plan-feature/references/ROUTING.md +83 -0
  81. package/skills/plan-feature-from-issue/SKILL.md +140 -0
  82. package/skills/plan-feature-scaffold/SKILL.md +93 -0
  83. package/skills/plan-feature-scaffold/references/SCAFFOLD_PROCESS.md +76 -0
  84. package/skills/plan-fix/SKILL.md +115 -0
  85. package/skills/plan-fix/references/PLANNING_PROCESS.md +118 -0
  86. package/skills/plan-fix/references/SPEC_CONTRACT.md +22 -0
  87. package/skills/planning-preflight/SKILL.md +130 -0
  88. package/skills/product-audit/SKILL.md +225 -0
  89. package/skills/product-audit/references/AUDIT_DIMENSIONS.md +24 -0
  90. package/skills/product-audit/references/AUDIT_PROCESS.md +85 -0
  91. package/skills/resolve-repository-state/SKILL.md +79 -0
  92. package/skills/review-a11y/SKILL.md +60 -0
  93. package/skills/review-brand/SKILL.md +65 -0
  94. package/skills/review-change/SKILL.md +156 -0
  95. package/skills/review-change/references/ADVERSARIAL_RECOMMENDATION.md +31 -0
  96. package/skills/review-change/references/ADVERSARIAL_SETUP.md +86 -0
  97. package/skills/review-change/references/ADVERSARIAL_SYNTHESIS.md +53 -0
  98. package/skills/review-change/references/OUTPUT_AND_GUARDRAILS.md +85 -0
  99. package/skills/review-change/references/PERSIST_AND_DECIDE.md +151 -0
  100. package/skills/review-change/references/PORTABILITY.md +74 -0
  101. package/skills/review-change/references/REVIEW_PROCESS.md +86 -0
  102. package/skills/review-code/SKILL.md +69 -0
  103. package/skills/review-debt/SKILL.md +72 -0
  104. package/skills/review-design/SKILL.md +60 -0
  105. package/skills/review-implementation/SKILL.md +108 -0
  106. package/skills/review-implementation/references/CLASSIFY.md +96 -0
  107. package/skills/review-implementation/references/FIND.md +35 -0
  108. package/skills/review-perf/SKILL.md +79 -0
  109. package/skills/review-security/SKILL.md +65 -0
  110. package/skills/review-seo/SKILL.md +65 -0
  111. package/skills/review-verify/SKILL.md +66 -0
  112. package/skills/ship-roadmap/SKILL.md +120 -0
  113. package/skills/ship-roadmap/references/ADVANCE.md +90 -0
  114. package/skills/ship-roadmap/references/AUDIT_AND_MERGE.md +64 -0
  115. package/skills/ship-roadmap/references/CLOSEOUT_AND_LOG.md +26 -0
  116. package/skills/ship-roadmap/references/FOUNDING.md +101 -0
  117. package/skills/ship-roadmap/references/GUARDRAILS.md +56 -0
  118. package/skills/ship-roadmap/references/MODEL_ROUTING.md +14 -0
  119. package/skills/ship-roadmap/references/PORTABILITY.md +34 -0
  120. package/skills/ship-roadmap/references/RECOVERY_AND_SELECTION.md +93 -0
  121. package/skills/ship-roadmap/references/STOP_CONDITIONS.md +9 -0
  122. package/skills/ship-roadmap/references/TERMINAL_REPORT.md +34 -0
  123. package/skills/triage-issue/SKILL.md +148 -0
  124. package/skills/triage-issue/references/AUDIT_FINDINGS.md +35 -0
  125. package/skills/triage-issue/references/FOLD_LEDGER.md +32 -0
  126. package/skills/triage-issue/references/ISSUE_PROCESS.md +101 -0
  127. package/skills/triage-issue/references/LABELS.md +83 -0
  128. package/skills/triage-issue/references/REVIEW_FINDING_PROCESS.md +41 -0
  129. package/skills/verification-contract/SKILL.md +77 -0
  130. package/skills/workflow-status/SKILL.md +143 -0
  131. package/skills/workflow-status/references/CRASH_RECOVERY.md +66 -0
  132. package/skills/workflow-status/references/ENVELOPE_CORE.md +107 -0
  133. package/skills/workflow-status/references/ENVELOPE_FIELDS.md +77 -0
  134. package/skills/workflow-status/references/GUARDRAILS.md +17 -0
  135. package/skills/workflow-status/references/PORTABILITY.md +14 -0
  136. package/skills/workflow-status/references/SENSOR_CORE.md +95 -0
  137. package/skills/workflow-status/references/SENSOR_SIGNALS.md +128 -0
@@ -0,0 +1,140 @@
1
+ ---
2
+ name: plan-feature-from-issue
3
+ user-invocable: false
4
+ version: 1.7.0
5
+ author: "Gabriel Trabanco <gtrabanco@users.noreply.github.com>"
6
+ license: MIT
7
+ description: >
8
+ Internal step of plan-feature: turn a feature-request issue into a scoped,
9
+ sized, roadmap-mapped SPEC **product half** (capability closure satisfied)
10
+ with Closes #N traceability.
11
+ ---
12
+
13
+ # Plan Feature — From Issue (internal)
14
+
15
+ Convert a feature-request issue into the project's planning artifacts, keeping a
16
+ clean issue → SPEC → PR(Closes #n) trace. Writes the SPEC's **product half**
17
+ (same two-halves convention `design-feature` uses) and must satisfy capability
18
+ closure before handing off — a thin issue does not get a shortcut around it.
19
+
20
+ ## When to use
21
+
22
+ - The `plan-feature` router calls this when the input is a GitHub issue (or
23
+ `--from-issue N`) that describes new product capability.
24
+
25
+ If the issue is a **bug or tech-debt**, stop and route it: `triage-issue` to
26
+ classify, then `plan-fix` + `execute-phase --fix`. This skill is for
27
+ genuine features only.
28
+
29
+ ## Step 0 — Discover the project (always first)
30
+
31
+ Per the agent guide's **Workflow conventions** + **documentation map**, then read
32
+ what THIS skill needs: the feature SPEC template, the roadmap, and the issue/PR
33
+ templates (`.github/ISSUE_TEMPLATE/`, `.github/PULL_REQUEST_TEMPLATE.md`) so the
34
+ SPEC mirrors the fields reviewers expect. Then read the issue (forge CLI per the
35
+ project's Workflow conventions — examples use `gh`):
36
+
37
+ ```sh
38
+ gh issue view <N> --json number,title,body,labels,state,comments
39
+ ```
40
+
41
+ ## Process
42
+
43
+ 1. **Classify first.** Confirm it is a feature. Not a feature if it describes a
44
+ defect, regression, duplicated code, perf debt, or carries a "when to
45
+ fix / trigger" clause → hand to `triage-issue`. State the verdict explicitly.
46
+ 2. **Normalize language.** If not in the project's docs language (this repo:
47
+ **English**), translate before drafting any artifact.
48
+ 3. **Map to the roadmap.** Assign the next number + slug. Identify dependencies
49
+ and conflicts with existing features, coupling/migration risks, and whether
50
+ it should instead extend an existing feature.
51
+ 4. **Close product-half gaps proactively.** Compare the issue against what a
52
+ complete SPEC **product half** needs (goals, scope in/out, business goals,
53
+ i18n/SEO/a11y/pricing per the docs map, a UI design reference when the
54
+ feature has a UI surface), probing the same fixed **vagueness rubric**
55
+ `design-feature`'s interview uses: affected users/roles · error & edge
56
+ states · data shape · boundaries & limits · out of scope · success
57
+ criteria — each slot filled or explicit `n/a: <reason>`. For each genuine
58
+ gap you can't safely default, ask the user **one question per turn, never
59
+ batched**, each with a recommended default; never ask what the issue or
60
+ docs already answer. **Structural hand-off threshold:** if ≥ 3 rubric
61
+ slots remain unfillable from the issue plus the answers so far, stop and
62
+ hand the feature to `design-feature` (the thin-issue rule below, now with
63
+ a fixed trigger) instead of continuing to interview here.
64
+ 5. **Satisfy capability closure.** Walk the same fixed checklist
65
+ `design-feature` uses (per entity: CRUD + state transitions, each with UI +
66
+ API + test, or explicit `n/a: <reason>`; per capability: entry point + ACL;
67
+ per role: assigned/revoked/viewed where) into the SPEC's `## Capability
68
+ closure` and `## Acceptance criteria`. **A thin issue that doesn't carry
69
+ enough to fill it is not a shortcut around the gate** — hand it to
70
+ `design-feature` (compose in-turn only at ≥ this skill's tier, per
71
+ *Guardrails*; otherwise hand off with `run /design-feature <slug>` and stop
72
+ here) rather than stamping `designed` on a hollow closure.
73
+ 6. **Size it.** Estimate `XS / S / M / L` (scale defined in the SPEC template)
74
+ and record it in the SPEC. XS/S → the SPEC is the only planning artifact
75
+ (single-pass execution); M/L → full artifact set. If L, propose splitting.
76
+ 7. **Produce the SPEC product half.** Fill it and stamp `## Design status:
77
+ designed` once closure is complete; set the roadmap row (added at `idea`
78
+ first if it didn't exist) to `defined` in the same edit — the same
79
+ `idea → defined` transition `design-feature` owns, performed here when this
80
+ skill is the one that satisfies closure. The `plan-feature` router then runs
81
+ `plan-feature-scaffold` for the engineering half + `defined → planned`
82
+ roadmap promotion.
83
+ 8. **Wire traceability.** Record `#N` in the SPEC; the PR body must include
84
+ `Closes #N` so the issue closes on merge.
85
+ 9. **Hand off — return exactly** (fixed completion report, back to the router):
86
+
87
+ ```
88
+ ISSUE #<N> → SPEC <slug> — size: <XS|S|M|L>
89
+ Verdict: feature (not bug/debt — else this would have routed to triage-issue)
90
+ Gaps closed: <n> asked / <n> defaulted (logged) Closure: designed | handed to design-feature
91
+ Traceability: Closes #<N> wired
92
+ → scaffold next (plan-feature-scaffold)
93
+ ```
94
+
95
+ ## Guardrails
96
+
97
+ - Don't silently expand scope beyond the issue — surface additions as proposals.
98
+ - Don't open the feature branch or write code here.
99
+ - Keep the `Closes #N` link; an issue-born feature must close it.
100
+ - **Never stamp `## Design status: designed` with a blank Capability closure
101
+ row** — the same rule `design-feature` follows; a thin issue hands off
102
+ instead of faking closure.
103
+ - **Composition tier.** Composing `design-feature` in-turn for a thin issue is
104
+ allowed only when this skill is running at ≥ `design-feature`'s tier
105
+ (planning-class — strongest model / highest effort); otherwise hand off
106
+ (`run /design-feature <slug>`) rather than under-power it.
107
+ - Otherwise honor the project's **Workflow conventions** (branch/PR, docs-language).
108
+
109
+ ## Architectural invariants
110
+
111
+ The [planning preflight](<../planning-preflight/SKILL.md>) owns the normalized
112
+ repository state read and the ONE final architectural classification for the
113
+ whole plan. Consume it here before writing the product half: for each applicable
114
+ invariant rule, cite its ID and repository evidence and classify the issue
115
+ proposal as `preserves`, `violates`, `introduces`, or `changes`. Only
116
+ `preserves` can be stamped `designed`; every other classification stops for an
117
+ explicit architectural decision through the project-declared authority — never
118
+ before the full plan exists, and never inferred from the issue body, SPEC, or
119
+ passing test.
120
+
121
+ ## Relationship to other skills
122
+
123
+ - `triage-issue` — decides bug vs feature vs defer; call it if unsure.
124
+ - `plan-fix` — the fix-side sibling for bug/debt issues.
125
+ - `design-feature` — receives thin issues this skill cannot safely close
126
+ capability closure for; both write the SPEC's product half in the same format.
127
+ - `plan-feature-scaffold` — fills the engineering half once the product half
128
+ is designed.
129
+ - `execute-phase` — executes the phases; its PR carries `Closes #N`.
130
+
131
+ ## Done when
132
+
133
+ - A filled SPEC product half + planning artifacts exist, roadmap-registered.
134
+ - Capability closure is satisfied (or the issue was handed off to
135
+ `design-feature` instead of faking it) and `## Design status` is accurate.
136
+ - The roadmap row status is `defined` (added at `idea` first if new) whenever
137
+ `## Design status: designed` was stamped — never `defined` on a hollow
138
+ closure, never left at `idea` once `designed` is stamped.
139
+ - `#N` is recorded and the PR plan includes `Closes #N`.
140
+ - Scope gaps were resolved with the user, not assumed.
@@ -0,0 +1,93 @@
1
+ ---
2
+ name: plan-feature-scaffold
3
+ user-invocable: false
4
+ version: 1.14.0
5
+ author: "Gabriel Trabanco <gtrabanco@users.noreply.github.com>"
6
+ license: MIT
7
+ description: >
8
+ Internal step of plan-feature: from an already-designed SPEC (product half
9
+ `designed`), fill the **engineering half** and generate the planning
10
+ artifact set scaled to the feature's size (XS/S → SPEC-only with ≥ 2 phases
11
+ in the SPEC, last = Hardening & PR; M/L → full set with a hardening phase),
12
+ freeze one compact ACCEPTANCE.md for every size, and register the roadmap
13
+ entry. Docs only — never code.
14
+ ---
15
+
16
+ # Plan Feature — Scaffold (internal)
17
+
18
+ Turn a designed feature into the project's complete planning artifact set,
19
+ ready for phase-by-phase execution. Fills only the SPEC's **engineering half**
20
+ — the product half (goal, context, scope, capability closure) already exists
21
+ and is marked `designed` before this skill ever runs (`plan-feature`'s
22
+ redirect gate guarantees it). **Docs only — never code.**
23
+
24
+ ## When to use
25
+
26
+ - The `plan-feature` router calls this once a feature's product half is
27
+ `designed` — from `design-feature`, `plan-feature-from-issue`, or an
28
+ already-scoped slug/SPEC — to fill the engineering half of its
29
+ `docs/features/<NN>-<slug>/SPEC.md` and the rest of the folder, then update
30
+ the roadmap.
31
+
32
+ Not for product definition (that is `design-feature`) or writing code (that is
33
+ `execute-phase`) or deciding *whether* to build (that is the `plan-feature`
34
+ router / `triage-issue`).
35
+
36
+ ## Step 0 — Discover the project (always first)
37
+
38
+ Per the agent guide's **Workflow conventions** + **documentation map**, then read
39
+ what THIS skill needs: the feature SPEC **template**, the **roadmap**
40
+ (numbering/order/deps), 1–2 recent feature folders to mirror the artifact set, and
41
+ the architecture/domain docs the map points to. No template/roadmap → fall back to
42
+ the agent guide and state the assumption.
43
+
44
+ ## Progressive loading — scaffold only after discovery
45
+
46
+ The reference allowlist is exactly one path. After Step 0, read and execute the
47
+ complete [scaffold process](references/SCAFFOLD_PROCESS.md). It owns the product-
48
+ half gate, artifact scaling, roadmap transition, re-read, and fixed completion
49
+ report. The [phase contract](<../phase-contract/SKILL.md>) owns the 8-box
50
+ phase-lint and the normalized phase fingerprint.
51
+
52
+ The resource is normative and one hop from this file. Missing resource → stop;
53
+ never reconstruct phase or close-out wording from memory.
54
+
55
+ The [verification contract](<../verification-contract/SKILL.md>) owns the
56
+ `ACCEPTANCE.md` schema, validation ladder, and anti-weakening rules. Consume it
57
+ after the engineering plan is complete and before registering `planned`.
58
+
59
+ ## Guardrails
60
+
61
+ - Docs only. No source edits, migrations, or dependencies.
62
+ - Respect the architecture: honor layer rules (inner layers don't import outer)
63
+ and any domain/i18n/SEO/a11y rules from the docs map.
64
+ - **Architectural invariants.** The [planning preflight](<../planning-preflight/SKILL.md>)
65
+ owns the normalized repository state read and the ONE final architectural
66
+ classification for the whole plan; consume it here. Its absence is compatible:
67
+ record `n/a: no project invariants declared` in the engineering half. For
68
+ every applicable rule, record its ID, repository evidence, and
69
+ `preserves | violates | introduces | changes` classification in
70
+ `### Architecture impact`. Only `preserves` may produce phases; the other
71
+ classifications stop for an explicit architectural decision through the
72
+ project's declared authority — and only after the full plan exists, never
73
+ converted into a phase task or inferred from the product half.
74
+ - Surface conflicts (numbering clashes, dependency cycles, scope overlap) before
75
+ writing, not after.
76
+ - Otherwise honor the project's **Workflow conventions** (branch/PR, docs-language).
77
+
78
+ ## Relationship to other skills
79
+
80
+ Invoked by the `plan-feature` router (after `design-feature` /
81
+ `plan-feature-from-issue` designed the product half, or directly for an
82
+ already-designed scoped slug/SPEC). Hands off to `execute-phase` for P1;
83
+ `audit-docs` audits anytime.
84
+
85
+ ## Done when
86
+
87
+ - `docs/features/<NN>-<slug>/` exists with the SPEC's engineering half +
88
+ `ACCEPTANCE.md` + every scaled planning artifact filled — the product half untouched from what
89
+ `design-feature` / `plan-feature-from-issue` wrote.
90
+ - The roadmap lists the feature with correct number, order, dependencies, and
91
+ **status `planned`** (the `defined → planned` write this skill owns) —
92
+ **re-read and confirmed after the write**, not assumed from having run it.
93
+ - No code changed; open questions captured in `decisions.md`.
@@ -0,0 +1,76 @@
1
+ ## Scaffold process
2
+
3
+ 1. **Verify design.** `## Design status` must be `designed` and Capability
4
+ closure complete. Otherwise stop: this is a caller bug; never repair the
5
+ Product half here.
6
+ 2. **Resolve identity.** Confirm the existing number/slug, or choose the next
7
+ free number for a designed SPEC missing from the roadmap. Record dependencies
8
+ and surface numbering, ordering, cycle, or overlap conflicts before writing.
9
+ 3. **Fill only the Engineering half:** technical goals, architecture impact,
10
+ design, decisions to confirm, branch, phases, testing requirements, and dev
11
+ scenarios covering happy path plus reproducible empty/degraded, race, and
12
+ outage cases. Leave no placeholders; put genuine unknowns in `decisions.md`.
13
+ 4. **Scale by size:**
14
+
15
+ - **XS/S:** SPEC + `ACCEPTANCE.md`. Its `### Phases` has checkbox tasks and at least `P1`
16
+ implementation plus final `P2 — Hardening & PR`. Copy the final phase's
17
+ literal tasks from `docs/fix/_TEMPLATE/SPEC.md`; never paraphrase them.
18
+ - **M/L:** create `ACCEPTANCE.md`, `PLAN.md`, `TASKS.md`, `progress.md`, `testing.md`,
19
+ `known-issues.md`, `decisions.md`, and `architecture-notes.md`.
20
+ - **Mandatory split:** use `Depends on:`-chained features when the plan would
21
+ exceed about five phases, any phase spans multiple layers/concerns, or a
22
+ phase contains an unresolved design decision. Reuse the existing dependency
23
+ gate/build order; never invent another mechanism.
24
+ - Every phase passes: independently checkable tasks without judgment; zero
25
+ open design decisions; one layer/concern; locally runnable verification.
26
+ Re-cut or split on any failure.
27
+ - Run the canonical eight-box Phase-lint owned by the
28
+ [phase contract](<../../phase-contract/SKILL.md>) against every phase
29
+ before emission. Any FAIL is re-cut/split; never emit an unticked phase.
30
+ - Run the feature template's full Spec-lint after the Engineering half is
31
+ filled, including Product-half regression boxes. Fix every presence failure
32
+ before reporting.
33
+ - Consume the canonical [verification contract](<../../verification-contract/SKILL.md>)
34
+ and write one compact, frozen `ACCEPTANCE.md` for every size. Map every SPEC
35
+ criterion to a deterministic command, labelled read check, or exact manual
36
+ observation. The manifest is the implementation/review finish line, not a
37
+ second specification.
38
+
39
+ ### M/L artifact contract
40
+
41
+ - `PLAN.md`: `P1, P2, …` phases only; no `S1`/`Step`. The last implementation
42
+ phase hardens and tests the SPEC failure scenarios.
43
+ - `TASKS.md`: per-phase checklists. Express command-checkable acceptance as the
44
+ command; label judgment-only checks `read-verified`. Its final phase ends with
45
+ these literal tasks:
46
+
47
+ ```text
48
+ [ ] open the PR (`gh pr create --body-file <path>` — body written as a Markdown file, real backticks, never inline `--body`/heredoc that leaves `\`-escaped backticks) and PRINT THE PR URL in the chat
49
+ [ ] update the roadmap row to `done · [#<pr>](<pr-url>)`
50
+ [ ] commit `docs: link PR #<n>` and push
51
+ ```
52
+
53
+ - `progress.md`: initialize only `Last reviewed: —`; the executor appends one
54
+ fixed-schema handoff entry after each phase with `Done`, `Remains`, `Gotchas`,
55
+ `Files`, and `Next`.
56
+ - `testing.md`: test layers, preferring integration; use the same command rule.
57
+ - `ACCEPTANCE.md`: required for every size; frozen validation manifest owned by
58
+ `verification-contract`, with the literal quality floor.
59
+ - `known-issues.md`: deferred items linked to/destined for issues, never inline.
60
+ - `decisions.md`: architecture/scope decisions and open questions.
61
+ - `architecture-notes.md`: layer, port, schema, and binding impact.
62
+
63
+ 5. **Register and verify.** Set the roadmap row to `planned` (`defined → planned`;
64
+ a missing row may be added directly as `planned`). Re-read it after the write.
65
+ If it does not literally say `planned`, reapply and re-read before continuing.
66
+ 6. **Do not branch or code.** Record the future branch in the SPEC only.
67
+ 7. **Return exactly**; the `plan-feature` caller prints the closing hand-off:
68
+
69
+ ```
70
+ SCAFFOLD <NN>-<slug> — size: <XS|S|M|L>
71
+ Artifacts written: <SPEC.md ACCEPTANCE.md [+ PLAN.md TASKS.md progress.md testing.md
72
+ known-issues.md decisions.md architecture-notes.md for M/L]>
73
+ Roadmap: registered as <NN> (deps: <list|none>) Phases: <n> (P1…P<n>, last = <hardening (M/L) | Hardening & PR (XS/S)>)
74
+ Spec-lint: PASS (<n>/<n> boxes) Phase-lint: PASS (all phases)
75
+ Open questions: <n> (in decisions.md) | none
76
+ ```
@@ -0,0 +1,115 @@
1
+ ---
2
+ name: plan-fix
3
+ user-invocable: true
4
+ version: 2.7.0
5
+ argument-hint: <issue-number> [<issue-number> …]
6
+ author: "Gabriel Trabanco <gtrabanco@users.noreply.github.com>"
7
+ license: MIT
8
+ description: >
9
+ Draft and locally commit a tightly scoped, phased fix SPEC from one or more
10
+ issues, then stop before push/PR and hand off to execute-phase --fix. Triggers:
11
+ "plan-fix", "plan a fix for issue N", "draft the fix spec".
12
+ ---
13
+
14
+ # Plan Fix
15
+
16
+ Fix-flow counterpart of `plan-feature`: draft the SPEC plus frozen acceptance,
17
+ stop for review, then `execute-phase --fix` implements every remaining phase.
18
+
19
+ ## Turn contract — verify before ending the turn
20
+
21
+ ```
22
+ ✓ The fix SPEC is committed on its `fix/<n>-<topic>` branch (commit sha pasted) — NOT pushed, NO PR
23
+ ✓ The Hand-off block was printed exactly as specified
24
+ ✓ A multi-issue unit? The hand-off names every issue once as `#primary + #n2 + …`; a single-issue unit names only its issue
25
+ ✓ Artifact language: explicit user instruction > the project's declared docs language > English. The CONVERSATION language never decides — a Spanish prompt still produces English artifacts unless one of the first two says otherwise
26
+ ✓ The closing `→ Next:` block is printed as the ABSOLUTE last output
27
+ ```
28
+
29
+ About to end the turn with any box unchecked? The turn is NOT done — complete the
30
+ missing box first (weak models drop end-of-document duties).
31
+
32
+ ## Persona
33
+
34
+ Senior software architect: skeptical, scope-disciplined and evidence-based.
35
+ Choose the smallest change set, surface second-order effects, and cite evidence.
36
+
37
+ ## Input
38
+
39
+ One or more GitHub issue numbers from this repo, space-separated.
40
+
41
+ - **One number:** unchanged single-issue behavior (`plan-fix 17`).
42
+ - **Multiple numbers:** step 5 decides one capability bundle or homogeneous
43
+ mechanical batch; different symptoms/files may merge when one outcome,
44
+ validator and rollback boundary own them.
45
+ - **Invalid input:** name the bad token and stop; never proceed partially.
46
+
47
+ ## Output
48
+
49
+ - `docs/fix/<primary>-<topic>/SPEC.md` — template plus required sections and a
50
+ `## Phases` ledger (**always ≥2**; final `Hardening & PR`). Primary is the sole
51
+ issue number or the lowest merged issue; merged SPECs retain each issue's criteria.
52
+ - `docs/fix/<primary-issue-number>-<topic>/ACCEPTANCE.md` — the compact frozen
53
+ finish line from `verification-contract`, retaining one criterion per issue.
54
+ - Branch `fix/<primary>-<topic>` from `main`.
55
+ - One local commit with SPEC and `docs/fix/README.md` (`pending`, all merged issues).
56
+ - **Stop: do not push/open PR.** Hand off to `execute-phase --fix`.
57
+
58
+ ## Hard rules
59
+
60
+ - Honor Workflow conventions: create `fix/<n>-<topic>` first, never `main`; gate,
61
+ docs language and evidence apply. Cite file paths for code and sections for docs;
62
+ track new problems as separate fix/roadmap entries, never inline.
63
+ - **Language precedence**: explicit user instruction > declared docs language > English — the conversation language never decides. If the issue body isn't in the artifact language, translate silently; if translation is ambiguous, inconsistent, or nonsensical, ask before committing to a meaning.
64
+ - Never push, never open the PR — that's `execute-phase --fix`.
65
+
66
+ ## Progressive loading — validate before drafting
67
+
68
+ The allowlist is exactly these five paths:
69
+
70
+ 1. Every invocation: read [planning process](references/PLANNING_PROCESS.md) and
71
+ execute its validation and multi-issue gate; a refusal or invalid input stops.
72
+ 2. Before a material question or SPEC: read [question and SPEC
73
+ contract](references/SPEC_CONTRACT.md).
74
+ 3. Any route that can write a fix SPEC: consume the [planning preflight](<../planning-preflight/SKILL.md>)
75
+ (owns the normalized repository state read and the ONE final architectural classification) before drafting.
76
+ 4. Before emitting phases: load the [phase contract](<../phase-contract/SKILL.md>) for the 8-box phase-lint and phase fingerprint.
77
+ 5. Before commit: consume the [verification contract](<../verification-contract/SKILL.md>)
78
+ and write the frozen `ACCEPTANCE.md`.
79
+
80
+ Resources are normative and one hop from this file. Missing required resource →
81
+ stop; never approximate fixed blocks or phase rules.
82
+
83
+ ## Hand-off
84
+
85
+ After commit, print exactly:
86
+
87
+ ```
88
+ SPEC drafted: docs/fix/<primary>-<topic>/SPEC.md
89
+ Branch: fix/<primary>-<topic> (local, not pushed)
90
+ Commit: <short hash>
91
+ Issue set: #<primary> + #<n2> + #<n3> (print every issue in this unit; single issue → #<primary>)
92
+
93
+ → Next: review the SPEC, then /execute-phase --fix <primary> — execute every remaining phase in issue set #<primary> + #<n2> + #<n3> and open the PR
94
+ · explicit atomic mode → /execute-phase --fix <primary> P<n> (same issue set: #<primary> + #<n2> + #<n3>)
95
+ · the final `Hardening & PR` phase pushes and opens the PR with `Closes #<primary>`
96
+ plus one `Closes #<n>` line for every other issue listed in the Issue set
97
+ · scope looks wrong → adjust the SPEC and re-run /plan-fix
98
+ ```
99
+
100
+ Replace every placeholder with the complete actual issue set before printing;
101
+ never print `<n2>`, `<n3>`, or `…` in a live hand-off.
102
+
103
+ Then end in the user's language with a 2-3 sentence summary: what the SPEC ships, the biggest risk, and any open decisions left for the implementer.
104
+
105
+ ## Portability (agents other than Claude Code)
106
+
107
+ Use explicit fallbacks when a primitive is absent: open named `SKILL.md` files in
108
+ a fresh context; run architect-level scoping on the strongest model, then hand
109
+ implementation to a cheaper worker.
110
+
111
+ ## Done when
112
+
113
+ - The SPEC and frozen `ACCEPTANCE.md` follow canonical contracts, surface
114
+ risks/blockers, register in `docs/fix/README.md`, and are committed locally on
115
+ `fix/<n>-<topic>` (not pushed/no PR). The closing `→ Next:` Hand-off is printed.
@@ -0,0 +1,118 @@
1
+ ## Planning process
2
+
3
+ 1. **Ingest all inputs.** Each token must be a numeric issue resolved by
4
+ `gh issue view <n> --json title,body,labels,number,author,createdAt,comments`
5
+ (use the declared forge equivalent). Any failure stops the whole set. Translate
6
+ issue text to the artifact language; ask only on material ambiguity. Derive a
7
+ kebab-case topic (≤40 chars, no leading verb) from the primary issue title.
8
+ 2. **Read the docs map.** Read `CLAUDE.md`, then relevant mapped docs; every SPEC
9
+ claim cites a path/section.
10
+ 3. **Locate affected code.** Name per issue the layers, modules/files, ports,
11
+ adapters, and entities.
12
+ 4. **Cross-check work.** List open issues and PRs; classify overlaps as
13
+ prerequisite, parallel, absorbable, or unrelated. Record dependencies and
14
+ Cross-issue notes.
15
+ 5. **Resolve one vs. many issues before drafting.** One issue proceeds as the
16
+ primary. Multiple issues may form one unit through either supported mode:
17
+
18
+ - **Capability bundle** — different symptoms/root causes jointly prevent one
19
+ user-visible or operational outcome (for example, login succeeds end to
20
+ end). They may touch different layers or the same file repeatedly.
21
+ - **Homogeneous mechanical batch** — the same low-risk transformation is
22
+ repeated across independent surfaces (for example, CSS token replacement,
23
+ documentation correction, or one API rename).
24
+
25
+ Evaluate the set as one atomic delivery boundary, not every pair by file
26
+ coincidence. All five boxes must pass:
27
+
28
+ Select the mode by first match: (1) different corrections jointly unblock
29
+ one named end-to-end outcome → `capability bundle`; (2) otherwise, the same
30
+ literal low-risk transformation repeats on every member → `homogeneous
31
+ mechanical batch`; (3) otherwise → split. Different files/layers never turn
32
+ an end-to-end capability bundle into a mechanical batch.
33
+
34
+ - one sentence names the shared outcome **or** the repeated mechanical rule;
35
+ - one verification plan proves every issue's separate acceptance criteria;
36
+ - the set can ship and roll back together without leaving a partial state;
37
+ - no conflicting dependency, release order, product/architecture decision,
38
+ permission/schema migration, or triage route requires isolation;
39
+ - aggregate work fits one reviewable fix PR (XS/S/M); an L bundle is promoted
40
+ to one feature rather than fragmented into fixes.
41
+
42
+ Shared files, one root cause, and equal severities are useful evidence but
43
+ are **not requirements**. A security-critical member raises the whole unit's
44
+ verification/routing floor instead of forcing a separate PR when the atomic
45
+ boundary still holds.
46
+
47
+ All pass → one unit whose primary is the lowest number; every issue retains
48
+ separate acceptance criteria and manifest IDs, the fix index names all, and
49
+ the PR later uses one `Closes #<n>` line per issue. Print exactly:
50
+
51
+ ```text
52
+ MULTI-ISSUE MERGE — #<primary> + #<n2> + #<n3>
53
+ Atomic-delivery mode: <capability bundle|homogeneous mechanical batch>
54
+ Checklist: ALL 5 boxes ticked
55
+ ✓ shared outcome/rule: <one sentence>
56
+ ✓ one verification plan covers every issue: <commands/checks>
57
+ ✓ one release + rollback boundary: <evidence>
58
+ ✓ no isolation conflict: <evidence>
59
+ ✓ aggregate size: <XS|S|M>
60
+ Unit: docs/fix/<primary>-<topic>/SPEC.md
61
+ Issues merged: #<primary> (primary) + #<n2> + #<n3>
62
+ PR will carry: Closes #<primary>
63
+ Closes #<n2>
64
+ Closes #<n3>
65
+ ```
66
+
67
+ Replace the placeholders with every actual issue number before printing;
68
+ use ` + ` between all members and never print a literal ellipsis.
69
+
70
+ Any box fails → write nothing. Partition the input into the **fewest maximal
71
+ compatible groups** that do pass (singletons only when no bundle exists),
72
+ cite the set-level boundary that prevents their combination, print exactly,
73
+ and end:
74
+
75
+ ```text
76
+ MULTI-ISSUE SPLIT — the full set is not one atomic delivery unit
77
+ Boundary: <failing box> — <one-line repository/issue evidence>
78
+ No SPEC written. Recommended maximal groups:
79
+ /plan-fix <a> <b> <c> — <shared outcome/rule + verifier>
80
+ /plan-fix <d> <e> — <shared outcome/rule + verifier>
81
+ [/plan-fix <f> — singleton only because <reason>]
82
+ ```
83
+
84
+ Invalid/unknown token → print exactly and end without partial work:
85
+
86
+ ```text
87
+ Usage: plan-fix <issue-number> [<issue-number> …]
88
+ Invalid token: "<token>" — not a number, or not an issue in this repo.
89
+ ```
90
+
91
+ 6. **Define scope.** Include only the smallest change closing every unit issue.
92
+ Route each adjacent problem elsewhere; never absorb hypothetical improvement.
93
+ 7. **Analyze risk:** blast radius, detection lead time, operations (jobs, queues,
94
+ cache, schema, external adapters), security (auth, secrets, PII, webhooks,
95
+ limits), compliance (`n/a` when none), and migration/backward compatibility.
96
+ 8. **Acceptance/tests.** Make every criterion objective and map it to unit,
97
+ integration, contract, architecture, or justified manual verification. Name
98
+ regression-risk tests; keep merged-issue criteria identifiable.
99
+ 9. **Observability.** Name the log/metric/alert proving health and silent failure.
100
+ 10. **Affected docs.** Add an acceptance criterion for every mapped doc update.
101
+ 11. **Rollback.** Give one command/PR-revert flow, data cleanup (or `none`), and
102
+ what is preserved/lost.
103
+ 12. **Effort.** XS ≤1h/1 commit; S ≤4h/1 commit; M ≤1 day/multi-commit; L >1 day
104
+ → propose `plan-feature`; the user decides.
105
+ 13. **Phases.** Emit at least one `P1..Pn` implementation phase plus final
106
+ `P(n+1) — Hardening & PR` (always ≥2 total). Each task is independently
107
+ checkable without judgment; each phase has zero open design decisions, one
108
+ layer/concern, and a local gate. Copy the template's final tasks literally.
109
+ Run the canonical eight-box Phase-lint (owned by the [phase contract](<../../phase-contract/SKILL.md>)) on every implementation phase; re-cut or split any FAIL.
110
+ 14. **Self-review.** All template/extra sections filled; claims cited; no scope
111
+ creep; out-of-scope work routed; acceptance checkboxes independently
112
+ verifiable; phase rules satisfied; template Spec-lint fully ticked; no
113
+ placeholders; artifact language correct.
114
+ 15. **Commit locally.** Run `git branch --show-current`. From the default branch,
115
+ create `fix/<primary>-<topic>`; from another working branch, stop and ask.
116
+ Stage the SPEC and `docs/fix/README.md`; commit
117
+ `docs(fix): draft SPEC for #<primary>[+#<n2>+…] — <topic>`. Never push or
118
+ open a PR. Print branch, sha, and the entrypoint's hand-off block.
@@ -0,0 +1,22 @@
1
+ ## Question protocol
2
+
3
+ Follow the project's **Workflow conventions** question protocol (what / scope / criticality / each option with pros-cons + flagged recommendation). Fix-specific: *critical* = a wrong answer breaks production or invalidates the fix; also note **what it affects** (users, ops, security, data, future features). Only ask when the answer changes the SPEC materially — routine assumptions (e.g. a helper name) are made silently and recorded under "Decisions made during drafting".
4
+
5
+ ## SPEC sections (extends the base template)
6
+
7
+ The base template at `docs/fix/_TEMPLATE/SPEC.md` is mandatory. Add these sections in order, after the existing ones:
8
+
9
+ - **Impact** — layers touched (per the architecture doc); modules and files (paths); blast radius; detection lead time.
10
+ - **Rules that must never be violated** — project-wide invariants the fix must preserve, from CLAUDE.md "Hard rules" + the cited docs. E.g. "Domain value-object rules hold", "Inner layers cannot import outer layers".
11
+ - **Operational risks** — scheduled-job / queue / cache / schema / external-adapter interactions; concurrency or eventual-consistency hazards.
12
+ - **Security risks** — auth, secrets, PII, webhooks, rate-limits.
13
+ - **Compliance touchpoints** — any domain/compliance rules; note "n/a" explicitly if none.
14
+ - **Affected docs** — files in `docs/` needing updates; each becomes an acceptance criterion.
15
+ - **Observability** — log line / metric / alert confirming the fix is live and healthy.
16
+ - **Cross-issue notes** — open issues / PRs that may absorb, block, or be blocked by this fix; decision for each.
17
+ - **Effort** — T-shirt size with one-line justification.
18
+ - **Decisions made during drafting** — non-blocking assumptions made by the architect, so the implementer can re-question.
19
+
20
+ After the SPEC is complete, write `ACCEPTANCE.md` using the canonical
21
+ `verification-contract`. For merged issues, keep at least one stable criterion
22
+ ID per source issue so a shared implementation cannot hide an unclosed report.