tech-lead-stack 1.0.1

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 (123) hide show
  1. package/.agents/hr-workflows/hr-ad-distributor.md +18 -0
  2. package/.agents/hr-workflows/hr-candidate-sourcer.md +18 -0
  3. package/.agents/hr-workflows/hr-endorsement-synthesizer.md +18 -0
  4. package/.agents/hr-workflows/hr-intake-specifier.md +18 -0
  5. package/.agents/hr-workflows/hr-interview-auditor.md +18 -0
  6. package/.agents/hr-workflows/hr-jd-drafter.md +18 -0
  7. package/.agents/hr-workflows/hr-pipeline-translator.md +18 -0
  8. package/.agents/pm-workflows/pm-action-item-mapper.md +18 -0
  9. package/.agents/pm-workflows/pm-backlog-auditor.md +18 -0
  10. package/.agents/pm-workflows/pm-context-summarizer.md +18 -0
  11. package/.agents/pm-workflows/pm-design-system-auditor.md +18 -0
  12. package/.agents/pm-workflows/pm-effort-estimator.md +18 -0
  13. package/.agents/pm-workflows/pm-newsletter-generator.md +18 -0
  14. package/.agents/pm-workflows/pm-progress-translator.md +18 -0
  15. package/.agents/pm-workflows/pm-release-note-drafter.md +18 -0
  16. package/.agents/pm-workflows/pm-risk-detector.md +18 -0
  17. package/.agents/pm-workflows/pm-story-augmenter.md +18 -0
  18. package/.agents/pm-workflows/pm-task-specifier.md +18 -0
  19. package/.agents/workflows/accessibility-audit.md +30 -0
  20. package/.agents/workflows/ask.md +44 -0
  21. package/.agents/workflows/audit-tech-debt.md +31 -0
  22. package/.agents/workflows/changelog.md +31 -0
  23. package/.agents/workflows/clean-code-audit.md +31 -0
  24. package/.agents/workflows/code-review.md +38 -0
  25. package/.agents/workflows/competitive-analysis.md +46 -0
  26. package/.agents/workflows/design-requirements-to-architecture.md +31 -0
  27. package/.agents/workflows/design-system-review.md +113 -0
  28. package/.agents/workflows/dev-team-sub-max.md +57 -0
  29. package/.agents/workflows/dev-team-sub-pro.md +57 -0
  30. package/.agents/workflows/dev-team.md +52 -0
  31. package/.agents/workflows/feature-orchestrator.md +43 -0
  32. package/.agents/workflows/init.md +31 -0
  33. package/.agents/workflows/mission-architect.md +31 -0
  34. package/.agents/workflows/onboard-dev.md +31 -0
  35. package/.agents/workflows/plan-quick.md +33 -0
  36. package/.agents/workflows/plan.md +31 -0
  37. package/.agents/workflows/pr-automator.md +44 -0
  38. package/.agents/workflows/pr-design-review-init.md +57 -0
  39. package/.agents/workflows/qa-handover.md +40 -0
  40. package/.agents/workflows/reflexion-loop-sub-max.md +46 -0
  41. package/.agents/workflows/reflexion-loop-sub-pro.md +45 -0
  42. package/.agents/workflows/reflexion-loop.md +66 -0
  43. package/.agents/workflows/regression-bug-fix.md +31 -0
  44. package/.agents/workflows/security-audit.md +31 -0
  45. package/.agents/workflows/standup-daily-summary.md +31 -0
  46. package/.agents/workflows/strategy-target-evaluation.md +31 -0
  47. package/.agents/workflows/style-logic-exporter.md +84 -0
  48. package/.agents/workflows/ui-spec-generator.md +156 -0
  49. package/.agents/workflows/verify-changes.md +31 -0
  50. package/.agents/workflows/vertical-slice.md +52 -0
  51. package/.agents/workflows/weekly-leadership-report.md +39 -0
  52. package/.ai/agent-surfaces.json +1235 -0
  53. package/.ai/hooks/README.md +32 -0
  54. package/.ai/hooks/build-requires-approved-spec.json +10 -0
  55. package/.ai/hooks/deploy-requires-review.json +11 -0
  56. package/.ai/hooks/no-ai-approve-deploy.json +10 -0
  57. package/.ai/hooks/protected-paths.json +10 -0
  58. package/.ai/hr-skills/hr-ad-distributor.md +61 -0
  59. package/.ai/hr-skills/hr-candidate-sourcer.md +69 -0
  60. package/.ai/hr-skills/hr-endorsement-synthesizer.md +82 -0
  61. package/.ai/hr-skills/hr-intake-specifier.md +71 -0
  62. package/.ai/hr-skills/hr-interview-auditor.md +60 -0
  63. package/.ai/hr-skills/hr-jd-drafter.md +61 -0
  64. package/.ai/hr-skills/hr-pipeline-translator.md +58 -0
  65. package/.ai/pm-skills/pm-action-item-mapper.md +61 -0
  66. package/.ai/pm-skills/pm-backlog-auditor.md +57 -0
  67. package/.ai/pm-skills/pm-context-summarizer.md +61 -0
  68. package/.ai/pm-skills/pm-effort-estimator.md +79 -0
  69. package/.ai/pm-skills/pm-newsletter-generator.md +60 -0
  70. package/.ai/pm-skills/pm-progress-translator.md +59 -0
  71. package/.ai/pm-skills/pm-release-note-drafter.md +58 -0
  72. package/.ai/pm-skills/pm-risk-detector.md +58 -0
  73. package/.ai/pm-skills/pm-story-augmenter.md +70 -0
  74. package/.ai/pm-skills/pm-task-specifier.md +70 -0
  75. package/.ai/policies/diagnosis-first.md +26 -0
  76. package/.ai/policies/four-pillars.md +72 -0
  77. package/.ai/policies/user-sovereignty.md +25 -0
  78. package/.ai/skills/accessibility-auditor.md +105 -0
  79. package/.ai/skills/agent-optimizer.md +99 -0
  80. package/.ai/skills/ask.md +200 -0
  81. package/.ai/skills/capacity-planner.md +60 -0
  82. package/.ai/skills/changelog-generator.md +131 -0
  83. package/.ai/skills/clean-code.md +136 -0
  84. package/.ai/skills/code-review-checklist.md +103 -0
  85. package/.ai/skills/codebase-onboarding-intelligence.md +130 -0
  86. package/.ai/skills/competitive-analysis.md +114 -0
  87. package/.ai/skills/daily-standup.md +106 -0
  88. package/.ai/skills/design-system-review.md +308 -0
  89. package/.ai/skills/dev-team-local.md +52 -0
  90. package/.ai/skills/dev-team-orchestrator.md +289 -0
  91. package/.ai/skills/dev-team-sub-max.md +369 -0
  92. package/.ai/skills/dev-team-sub-pro.md +288 -0
  93. package/.ai/skills/dummy-skill.md +28 -0
  94. package/.ai/skills/feature-design-assistant.md +134 -0
  95. package/.ai/skills/feature-orchestrator.md +163 -0
  96. package/.ai/skills/knowledge-manager.md +103 -0
  97. package/.ai/skills/mission-architect.md +86 -0
  98. package/.ai/skills/mission-control.md +102 -0
  99. package/.ai/skills/operational-boundaries.md +94 -0
  100. package/.ai/skills/planning-expert-quick.md +164 -0
  101. package/.ai/skills/planning-expert.md +390 -0
  102. package/.ai/skills/pr-automator.md +431 -0
  103. package/.ai/skills/product-strategist.md +123 -0
  104. package/.ai/skills/qa-handover-generator.md +182 -0
  105. package/.ai/skills/reflexion-loop-local.md +39 -0
  106. package/.ai/skills/reflexion-loop-sub-max.md +214 -0
  107. package/.ai/skills/reflexion-loop-sub-pro.md +164 -0
  108. package/.ai/skills/reflexion-loop.md +119 -0
  109. package/.ai/skills/regression-bug-fix.md +95 -0
  110. package/.ai/skills/security-audit.md +97 -0
  111. package/.ai/skills/solutioning-facilitator.md +338 -0
  112. package/.ai/skills/style-logic-exporter.md +115 -0
  113. package/.ai/skills/technical-debt-auditor.md +119 -0
  114. package/.ai/skills/ui-spec-generator.md +78 -0
  115. package/.ai/skills/verification-auditor.md +101 -0
  116. package/.ai/skills/vertical-slice-decomposer.md +335 -0
  117. package/.ai/skills/visual-verifier.md +134 -0
  118. package/.ai/skills/weekly-leadership-report.md +224 -0
  119. package/.ai/skills.graph.json +1550 -0
  120. package/LICENSE +21 -0
  121. package/README.md +58 -0
  122. package/dist/mcp-server.mjs +5203 -0
  123. package/package.json +48 -0
@@ -0,0 +1,164 @@
1
+ ---
2
+ name: planning-expert-quick
3
+ description: >
4
+ Ultra-lean strategic planning. Optimized for speed, token efficiency, and
5
+ rapid MVC delivery. Now PR-batch aware — it ingests vertical slices handed off
6
+ from `vertical-slice-decomposer` as well as freeform slices a developer writes
7
+ by hand, keeps every PR batch <=15-20 changed files, and on reaching that
8
+ ceiling hands off to `pr-automator` and escalates multi-batch sequencing to
9
+ `planning-expert`. Use for common, lightweight tasks (1-2 files) where
10
+ velocity is the priority.
11
+ cost: ~2300 tokens
12
+ modes: [read-only, write, mcp]
13
+ surface: public
14
+ category: Plan & Harden
15
+ how:
16
+ 'Anchors tech stack followed by a condensed W/W/H blueprint and rapid
17
+ execution cycle.'
18
+ useCase:
19
+ 'Common, less complex, lite-weight tasks where velocity is the priority.'
20
+ phase: plan
21
+ kind: skill
22
+ domain: eng
23
+ ownership:
24
+ drive: human-ai
25
+ approve: human
26
+ targets: [local, api, subscription]
27
+ minModelClass: small
28
+ consumes: [spec]
29
+ emits: [plan]
30
+ requires: [pr-automator]
31
+ suggests:
32
+ [
33
+ clean-code,
34
+ regression-bug-fix,
35
+ ask,
36
+ planning-expert,
37
+ vertical-slice-decomposer,
38
+ ]
39
+ policies:
40
+ - user-sovereignty
41
+ - diagnosis-first
42
+ - four-pillars
43
+ ---
44
+
45
+ # Planning Expert (The G-Stack Runner)
46
+
47
+ ## Runtime modes
48
+
49
+ Produces a verifiable quick plan blueprint in read-only chat, and executes +
50
+ verifies the planning phase in an IDE/MCP agent.
51
+
52
+ > [!NOTE] **Invoke** with `@planning-expert-quick` / `/planning-expert-quick` /
53
+ > context-injection, then paste the work. Input is loose — a
54
+ > `vertical-slice-decomposer` block, a **freeform slice typed by a developer**,
55
+ > or a small raw task all work (see the input note below).
56
+
57
+ <!-- -->
58
+
59
+ > [!TIP] **Ethos**: "No commentary. Just the output." Focus on the **Minimal
60
+ > Viable Change** (MVC) to keep velocity high. A plan ships as
61
+ > **forward-independent PR batches** — working code only, no dependency on a
62
+ > later PR.
63
+ >
64
+ > **Methodology Alignment**: This skill strictly adheres to the four core
65
+ > pillars: **G-Stack Ethos**, **MinimumCD**, **Agent Skills**, and **Modern Web
66
+ > Guidance**.
67
+
68
+ <!-- -->
69
+
70
+ > [!IMPORTANT] **Input may be a vertical slice** — either a
71
+ > `vertical-slice-decomposer` block (carry forward, do not re-decide, its
72
+ > **GWT** acceptance criteria, **Dark release** `beta_*` flag, **Data source**
73
+ > mock/real, and **Design reference**) **or a freeform slice a developer typed
74
+ > by hand** (e.g. "as an admin I can see an audit-log row when an export
75
+ > finishes"). Detect freeform on an "As a … I can …" / acceptance-criteria
76
+ > signal, normalize it to those same fields, and **fill any missing Dark release
77
+ > / Data source from Phase-0 discovery, stating the assumption** (ask only if
78
+ > high-stakes). Otherwise slice the raw task yourself.
79
+
80
+ <!-- -->
81
+
82
+ > [!CAUTION] **Runtime mode (one skill, env-adaptive).** Identical in the web
83
+ > chat UI, the IDE/MCP agent, and the e2b sandbox. In **read-only `/chat`** you
84
+ > cannot run git/exec — deliver the plan + the PR-boundary hand-off as
85
+ > instructions; the pause is conversational and does **not** block the chat
86
+ > workflow. In the **IDE / e2b sandbox** you run the live diff check and the
87
+ > real boundary gate. Never claim a file was changed or a PR created in chat.
88
+
89
+ ## 🎯 Strategic Workflow
90
+
91
+ ### Phase 0: Rapid Discovery (MANDATORY)
92
+
93
+ - **Stack ID:** Call `get_skill`. Inspect manifest files (`package.json`,
94
+ `go.mod`, etc.) to anchor the tech stack.
95
+ - **Pattern Match:** Quickly identify core naming and folder conventions.
96
+ - **Flag infra:** Note the dark-release gate (`beta_*` / `x-beta-flags`) in case
97
+ an incomplete change must ship hidden behind a flag.
98
+ - **Habit:** Turn off Search and Extended Thinking if the task scope is obvious.
99
+
100
+ ### Phase 1: Minimalist Blueprint
101
+
102
+ - **Framework:** Provide a condensed **W/W/H** (What/Why/How).
103
+ - **Strategy:** Reference file paths; DO NOT duplicate existing code logic in
104
+ the plan.
105
+
106
+ ### Phase 2: Atomic Execution Cycle
107
+
108
+ - **Sizing:** XS/S tasks only (1-2 files).
109
+ - **The Cycle:** **Implement → Test → Verify → Commit**.
110
+
111
+ ## 📦 PR Boundary Rule (condensed)
112
+
113
+ - **Ceiling:** soft **15** / hard **20** counted changed files per PR batch. The
114
+ count is a **proxy** — the real cut is the deployable seam; pair it with the
115
+ line signals. **Count only functional/UI/reviewable changes** (logic, UI,
116
+ `next.config`/`tailwind.config`, helpers); **do not count** mechanical-only
117
+ diffs (Prettier/formatting, import-only, lockfiles, generated, snapshots). A
118
+ quick-plan task should rarely approach this.
119
+ - **Escalation:** if the work is clearly going to cross the ceiling, it is no
120
+ longer a quick-plan task — **STOP and escalate to `planning-expert`**, which
121
+ owns the full multi-batch PR Ledger and sequencing.
122
+ - **If a batch does reach the ceiling here**, run the blocking hand-off (same as
123
+ `planning-expert`):
124
+ 1. Confirm the batch is **forward-independent** (working code • no dependency
125
+ on a later PR • incomplete UI flag-gated).
126
+ 2. Recommend the user run the **`pr-automator`** workflow now (`/pr-automator`
127
+ / `rtk run create-pr` — their "/pr-automation"). **PAUSE.**
128
+ 3. **WAIT** for the user to confirm the **draft PR** exists.
129
+ 4. Ask the user to create the continuation branch (you never run git — the
130
+ stack forbids agent `git add`/`push`):
131
+ `git checkout <current> && git checkout -b <next>` to keep momentum
132
+ (stacked), or branch from refreshed `main` after the squash-merge lands.
133
+ 5. **WAIT** for branch confirmation, then resume the next batch.
134
+
135
+ ## 🛠 Outcome Actions
136
+
137
+ - **Deliver:** `task.md` handoff.
138
+ - **Constraint:** NO conversational preamble or filler. (The PR-boundary
139
+ announcement and branch request are protocol control messages, not filler —
140
+ those are required.)
141
+
142
+ ## ⚖️ Anti-Rationalization (MANDATORY)
143
+
144
+ | Excuse | Rebuttal |
145
+ | :------------------------------------ | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
146
+ | "This is too simple for tests." | **Denied.** Simple logic often hides complex edge cases. |
147
+ | "I'll just skip Phase 0." | **Denied.** Skipping discovery is the #1 cause of broken builds. |
148
+ | "It grew past 20 files, ship it all." | **Denied.** Escalate to `planning-expert` and split into forward-independent PRs at the deployable seam. |
149
+ | "I'll open the PR / push for you." | **Denied for the planner.** It never runs git — hand off. `pr-automator` is the scoped exception (reads history + `gh pr create`; never pushes your code). Instruct the user; wait for confirmation. |
150
+
151
+ ## 🚩 Red Flags (STOP & Pivot)
152
+
153
+ - **Bloat**: Plan exceeds 2 files or 50 lines (quick-plan threshold) — reassess
154
+ scope.
155
+ - **Ambiguity**: Unclear file paths or missing line ranges.
156
+ - **Ceiling approach**: Heading toward 15+ files — escalate to `planning-expert`
157
+ rather than forcing it through here.
158
+ - **Forward dependency**: A batch needs code from a not-yet-created PR.
159
+
160
+ ## ✅ Verification Gate (Hard Evidence)
161
+
162
+ - **MANDATORY**: Minimal evidence (build logs, `rtk run validate`) is required.
163
+ - **Per batch**: forward-independent (working code • no forward dep • flag-gated
164
+ if incomplete) and within the file ceiling.
@@ -0,0 +1,390 @@
1
+ ---
2
+ name: planning-expert
3
+ description: >
4
+ The complete Planning Expert Zenith. Orchestrates deep pattern discovery,
5
+ vertical slicing, and safe incremental delivery. Now PR-batch aware — it
6
+ ingests vertical slices handed off from `vertical-slice-decomposer` (the
7
+ `/plan` target) as well as freeform slices a developer writes by hand, caps
8
+ every PR batch at <=15-20 changed files, and breaks oversized plans into
9
+ forward-independent, individually deployable PRs with a blocking hand-off to
10
+ `pr-automator`. Use for complex or heavy tasks, architectural refactors,
11
+ multi-file features, or whenever a plan will touch more than ~15 files and
12
+ must be split into stacked PRs under Trunk-Based Development.
13
+ cost: ~5900 tokens
14
+ modes: [read-only, write, mcp]
15
+ surface: public
16
+ category: Plan & Harden
17
+ how:
18
+ 'Deep codebase audit followed by an atomic G-Stack blueprint and commit-ready
19
+ task list.'
20
+ useCase:
21
+ 'Breaking down complex Jira tickets or architectural refactors into
22
+ test-driven steps.'
23
+ phase: plan
24
+ kind: skill
25
+ domain: eng
26
+ ownership:
27
+ drive: human-ai
28
+ approve: human
29
+ targets: [local, api, subscription]
30
+ minModelClass: small
31
+ consumes: [spec]
32
+ emits: [plan]
33
+ requires: [pr-automator]
34
+ suggests:
35
+ [
36
+ clean-code,
37
+ regression-bug-fix,
38
+ ask,
39
+ feature-orchestrator,
40
+ vertical-slice-decomposer,
41
+ ]
42
+ policies:
43
+ - user-sovereignty
44
+ - diagnosis-first
45
+ - four-pillars
46
+ ---
47
+
48
+ # Planning Expert (The Sovereign Zenith)
49
+
50
+ ## Runtime modes
51
+
52
+ Produces a verifiable full plan blueprint in read-only chat, and executes +
53
+ verifies the planning phase in an IDE/MCP agent. Tested in Antigravity, Cursor,
54
+ Continue
55
+
56
+ > [!NOTE] **Invoke** with `@planning-expert` (Cursor) / `/planning-expert`
57
+ > (Antigravity) / context-injection (web chat), then paste the work. Input is
58
+ > intentionally loose — a `vertical-slice-decomposer` block, a **freeform slice
59
+ > a developer wrote by hand**, or a raw ticket all work. See the Input Contract
60
+ > for how each is detected and normalized.
61
+
62
+ <!-- -->
63
+
64
+ > [!TIP] **Ethos**: Diagnosis before Advice. Build in **Thin Vertical Slices**.
65
+ > **Rule 0**: Simplicity first. **Rule 0.5**: Scope Discipline (Touch only what
66
+ > is required). **Rule 0.75**: A plan is delivered as a sequence of
67
+ > **forward-independent PR batches** — every batch ships only working code and
68
+ > never depends on a batch that comes after it.
69
+ >
70
+ > **Methodology Alignment**: This skill strictly adheres to the four core
71
+ > pillars: **G-Stack Ethos**, **MinimumCD**, **Agent Skills**, and **Modern Web
72
+ > Guidance**.
73
+
74
+ <!-- -->
75
+
76
+ > [!CAUTION] **PRIME DIRECTIVE — BATCH ANTI-DRIFT (NON-NEGOTIABLE)** Planning is
77
+ > **iterative and multi-turn**. The **PR Batch Ledger** (see "PR Batching &
78
+ > Delivery Protocol") is the source of truth and survives every detour.
79
+ >
80
+ > 1. **Never plan past a PR boundary without an explicit user hand-off.** When a
81
+ > batch reaches the file ceiling, you **STOP**, hand off, and **WAIT**.
82
+ > 2. **Git is the user's job, not yours.** Per this stack's
83
+ > `BRANCH_MANAGEMENT.md`, the planning agent MUST NOT run `git add`,
84
+ > `git commit`, or `git push`. You _instruct_ the user with exact commands;
85
+ > they execute. (The hand-off target `pr-automator` carries the one
86
+ > **sanctioned, scoped** git exception — read-only history + `gh pr create`,
87
+ > never pushing your code. See its Git Command Policy.)
88
+ > 3. **Every response after a detour reprints the Ledger** and names the next
89
+ > pending batch. Never silently abandon a pending batch.
90
+
91
+ <!-- -->
92
+
93
+ > [!CAUTION] **RUNTIME MODE (DETERMINE FIRST — NON-NEGOTIABLE)** This is **one
94
+ > skill**, identical across the web chat UI, the IDE/MCP agent, and the e2b
95
+ > feature-discovery sandbox. It adapts; it is never forked per environment.
96
+ > State the mode once, then proceed — never fake the boundary.
97
+ >
98
+ > - **Read-only chat (`/chat`, the tech-lead-stack web app):** write/exec tools
99
+ > are forbidden; only `get_skill`, `list_skills`, `read_file` exist. Produce
100
+ > the **full plan + PR-batch blueprint** and deliver the boundary hand-off as
101
+ > **instructions** (recommend `pr-automator`, list the branch commands) for
102
+ > the user / IDE agent to run. You cannot run `git`, so enforce the file
103
+ > ceiling against the **estimate + the file list the user reports**, and emit
104
+ > the live `git diff` check (below) as part of the handoff. Never claim a file
105
+ > was changed or a PR was created here. **This update does NOT block the chat
106
+ > workflow — the pause is a conversational hand-off, not an execution.**
107
+ > - **IDE / MCP agent + e2b sandbox (feature-discovery / `feature-orchestrator`
108
+ > implement phase):** write/exec exist. Run the read-only discovery and the
109
+ > **live `git diff` enforcement** yourself; the PR boundary is a real stage
110
+ > gate — hand off to `pr-automator` for the draft PR and wait for the user's
111
+ > branch before resuming. When invoked under `feature-orchestrator`, the
112
+ > boundary is a Phase-3 checkpoint; the orchestrator must not auto-advance
113
+ > past it.
114
+
115
+ ## 📥 Input Contract (Vertical-Slice Aware)
116
+
117
+ You are the **`/plan`** hand-off target named in `vertical-slice-decomposer`'s
118
+ Output Contract — but a slice may also be **hand-written by a developer** and
119
+ never have passed through that skill. Detect which of three shapes you got, then
120
+ **normalize to the same internal model** before planning.
121
+
122
+ - **Shape 1 — Structured slice block (from `vertical-slice-decomposer`).** Has
123
+ the explicit field labels below. Parse and **carry forward, do not
124
+ re-litigate**:
125
+ - `Vertical slice` + `Acceptance criteria (GWT)` → behavioural spec + per-task
126
+ verification target.
127
+ - `Technical details` (layers / contract + payload / schema delta) → the files
128
+ and contracts your tasks will touch.
129
+ - `Design reference` (Figma / screenshot + state) → UI acceptance.
130
+ - **`Dark release`** (beta flag yes/`betaName`) → the flag an incomplete batch
131
+ ships behind; the flag owner removes it at go-live.
132
+ - **`Data source`** (Mock backend-first / MSW fallback / Real) → honour the
133
+ mock-vs-real choice; do not flip it.
134
+ - `Definition of Ready/Done` → fold into each task's acceptance criteria.
135
+
136
+ - **Shape 2 — Freeform slice (developer-authored, loose).** Detect on **any** of
137
+ these signals even without the labels: an actor + observable behaviour ("As a
138
+ … I can …", "user can …", "when X then Y"), a single user-facing corridor (not
139
+ a layer), or a short list of acceptance criteria. **Normalize** the prose onto
140
+ the Shape-1 fields, then **fill gaps explicitly — never silently default**:
141
+ - Missing `Acceptance criteria` → derive `Given–When–Then` from the prose and
142
+ show them back for confirmation.
143
+ - Missing `Dark release` → decide from Phase-0 flag-infra discovery (hide
144
+ incomplete user-facing behaviour behind a `beta_*` flag) and **state the
145
+ assumption**.
146
+ - Missing `Data source` → decide from whether the contract already exists
147
+ (new/unbuilt ⇒ mock backend-first; stable ⇒ real) and **state it**.
148
+ - Missing `Design reference` → "none" unless frames were attached.
149
+ - If a gap is **high-stakes and ambiguous** (auth, billing, data migration,
150
+ irreversible writes), ask **one** clarifying question instead of assuming.
151
+ - Apply the **deployability test** and **INVEST** exactly as the decomposer
152
+ would — informal input does not lower the bar. If the freeform item is
153
+ really several corridors or a layer, say so and reslice before planning.
154
+
155
+ - **Shape 3 — Raw ticket / architectural task** (backend, infra, refactor — what
156
+ the decomposer routes here). Run full discovery and slice it yourself.
157
+
158
+ A single slice is normally <=2 days and should fit inside **one** PR batch. If
159
+ its footprint exceeds the ceiling, that signals an over-coarse cut — note it
160
+ back, then still ship as forward-independent batches via the protocol below.
161
+
162
+ **Pattern reference — these describe the _same_ slice; detect either form:**
163
+
164
+ ```md
165
+ <!-- Shape 1: structured (emitted by vertical-slice-decomposer) -->
166
+
167
+ ### Task: Show an audit-log row when an export finishes
168
+
169
+ **Vertical slice:** As an admin, I can see a row in the audit log when an export
170
+ completes [happy path]. **Acceptance criteria (GWT):** Given an export
171
+ completes, When I open the audit log, Then the newest row shows the export name
172
+ and finish time. **Dark release:** yes: `auditBeta`. **Data source:** Mock
173
+ (backend-first). **Design reference:** Figma "Audit/row-populated".
174
+ ```
175
+
176
+ ```text
177
+ <!-- Shape 2: freeform (a developer typed this). Same slice, no labels. -->
178
+ Plan this slice: as an admin I want an audit-log row to appear when an export
179
+ finishes — show the export name and finish time.
180
+ (No flag / data-source stated → Phase-0 says the contract is unbuilt and there's
181
+ a beta gate, so normalize to: Dark release `auditBeta`, Data source Mock
182
+ backend-first, and state those assumptions back.)
183
+ ```
184
+
185
+ ## 🎯 Strategic Workflow
186
+
187
+ ### Phase 0: Read-Only Forensic Discovery (MANDATORY)
188
+
189
+ - **Stack ID:** Call `get_skills` (which may be prefixed as
190
+ `mcp_tech-lead-stack_get_skills` or `tech-lead-stack_get_skills` depending on
191
+ client prefixing). Inspect manifest files AND directory structures using
192
+ `repo_map` to identify framework conventions (e.g., `/controllers`, `/hooks`).
193
+ - **Pattern & Principle ID:** Identify naming conventions, error-handling
194
+ styles, and architectural patterns (e.g., SOLID, MVC). Use `code_search` and
195
+ `read_region` MCP tools to find existing implementations of similar features.
196
+ INSTEAD of reading whole files, fetch only exact required lines.
197
+ - **Release & flag infra:** Locate the dark-release gate (e.g. Next.js
198
+ middleware, `beta_*` cookies / `x-beta-flags` header) so an incomplete batch
199
+ can be hidden behind a flag rather than deferred.
200
+ - **Scoping:** Evaluate Global → Project → Folder scopes. **Last scope wins**.
201
+
202
+ ### Phase 1: The W/W/H Implementation Plan
203
+
204
+ - **WHAT:** Scope and specific target files (Referenced, not duplicated).
205
+ - **WHY:** Architecture rationale based on discovered principles + Anti-patterns
206
+ to avoid.
207
+ - **HOW:** Delivery strategy (Vertical/Risk-First) and **PR-Batch / Branching
208
+ Plan** — partition the full plan into forward-independent batches up front
209
+ (see "PR Batching & Delivery Protocol"), naming the expected batch count and
210
+ the deployable seam between each.
211
+
212
+ ### Phase 2: Atomic Decomposition (The Increment Cycle)
213
+
214
+ - **Sizing (per task):** XS/S/M only (<5 files, <100 lines). If XL, break it
215
+ down.
216
+ - **Sizing (per PR batch):** group tasks into batches of **<=15 files (soft) /
217
+ 20 files (hard ceiling)** counted changed files. A batch boundary MUST land on
218
+ a deployable seam — never split one task across two batches.
219
+ - **Enforce against reality, not the estimate (execution contexts only):** in
220
+ the IDE/MCP agent or e2b sandbox, before opening each new task re-run the same
221
+ diff `pr-automator` uses, with mechanical files excluded, and compare to the
222
+ ceiling:
223
+
224
+ ```bash
225
+ git diff --name-only <base>...HEAD \
226
+ | grep -vE '(pnpm-lock\.yaml|package-lock\.json|yarn\.lock|\.snap$|/generated/|\.generated\.)' \
227
+ | wc -l
228
+ ```
229
+
230
+ Then discount any remaining file whose diff is import-only or formatting-only.
231
+ That remainder is the number checked against 15/20. In read-only chat you
232
+ cannot run this — enforce against the estimate and the file list the user
233
+ reports, and hand this command off for the implementing agent to run.
234
+
235
+ - **The Cycle:** **Implement → Test → Verify → Commit**.
236
+ - **Task Structure:** Description + Acceptance Criteria + Specific Verification
237
+ CLI commands (Build, Test, Lint).
238
+ - **ATDD Generation:** When planning acceptance criteria, you MUST generate a
239
+ living Gherkin scenario file in `.ai/output/features/<feature-name>.feature`.
240
+ Use declarative business language (avoid imperative commands like "Click" or
241
+ "Type"). Commit these files as part of the PR batch.
242
+
243
+ ### Phase 3: Checkpoints & Handoff
244
+
245
+ - **Action:** Insert checkpoints for human review every 2-3 tasks.
246
+ - **Guardrail:** Halt if the plan document exceeds 500 lines. Note but do not
247
+ touch adjacent refactors.
248
+ - **PR boundary:** When a batch reaches the file ceiling, execute the **PR
249
+ Batching & Delivery Protocol** and STOP.
250
+
251
+ ## 📦 PR Batching & Delivery Protocol (CORE)
252
+
253
+ > [!IMPORTANT] The plan is a queue of PR batches. You maintain the **Ledger**,
254
+ > count changed files as you go, and hand off cleanly at every boundary.
255
+
256
+ ### The File-Count Rule
257
+
258
+ - **The count is a guardrail, not the real boundary.** A 19-file rename is
259
+ trivial to review; a 6-file state-machine rewrite is not. The **true cut is
260
+ the deployable seam** — use the count as a proxy and pair it with the line
261
+ signals (<100 lines/task, <500 lines/plan) and review-complexity judgement.
262
+ - **Soft target: 15** counted files per batch. **Hard ceiling: 20.**
263
+ - **What counts (functional / reviewable change):** count a file once per batch
264
+ only if its change is **functional or UI** — anything that consumes real
265
+ code-review time: logic and helpers (`*.ts`), UI (`*.tsx`/`*.jsx`/`*.css`/
266
+ `*.scss`), and **config that changes runtime or UI behaviour**
267
+ (`next.config.*`, `tailwind.config.*`, middleware, env/schema). Created /
268
+ modified / deleted all count. A file with a functional change **plus**
269
+ incidental formatting still counts.
270
+ - **What does NOT count (mechanical-only change):** files whose **entire** diff
271
+ is mechanical — Prettier/formatting-only, import reorder or auto-fix with no
272
+ behaviour change, lockfiles (`pnpm-lock.yaml`, `package-lock.json`,
273
+ `yarn.lock`), generated clients, and snapshots. These never push you over the
274
+ ceiling on their own.
275
+ - As the counted tally crosses **15**, start looking for the next deployable
276
+ seam. Adding a task that would push the batch **over 20 counted files** is
277
+ forbidden — close the batch first.
278
+ - **Irreducible-unit exception:** if one minimal deployable unit genuinely
279
+ cannot land under 20 counted files (e.g. a codemod, a generated client), that
280
+ is a **🚩 red flag** for a horizontal/over-coarse slice. STOP, surface it, and
281
+ get explicit user sign-off (with justification) before exceeding the ceiling.
282
+
283
+ ### Forward-Independence Rule
284
+
285
+ Each batch must satisfy all three before it is allowed to close:
286
+
287
+ 1. **Working code only** — trunk stays green; the batch builds, types, and tests
288
+ pass on its own.
289
+ 2. **No forward dependency** — nothing in this batch needs a _later_ batch/PR to
290
+ function. (Depending on an _earlier_, already-shipped batch is fine — that is
291
+ the normal stacking direction.)
292
+ 3. **Incomplete UI is flag-gated** — any user-facing behaviour that isn't done
293
+ ships hidden behind the slice's `beta_*` dark-release flag, not deferred.
294
+
295
+ ### The Boundary Hand-Off (BLOCKING — do not auto-continue)
296
+
297
+ When a batch hits the ceiling on a deployable seam:
298
+
299
+ 1. **Freeze the batch.** Stop planning tasks into it. Verify it passes the
300
+ Forward-Independence Rule.
301
+ 2. **Emit the batch** as the current `task.md` increment with its verification
302
+ gate, and mark it `ready-for-PR` in the Ledger.
303
+ 3. **Announce + recommend.** Tell the user the file tally and that this is a PR
304
+ boundary, and recommend running the **`pr-automator`** workflow now
305
+ (`/pr-automator`, or `rtk run create-pr` in this stack — the user's
306
+ "/pr-automation"). State plainly that you are pausing.
307
+ 4. **WAIT.** Do not plan or emit the next batch. The user runs `pr-automator`
308
+ and replies confirming the **draft PR** exists (link / number).
309
+ 5. **Request the continuation branch** (user-executed — you never run git). Give
310
+ exact commands for the path that fits their state:
311
+ - **Continuity / keep momentum (stacked):** branch off the _current_ feature
312
+ branch so the next batch builds on this one's code.
313
+
314
+ ```bash
315
+ # user runs this — replaces <current> and <next>
316
+ git checkout <current-feature-branch>
317
+ git checkout -b <next-feature-branch>
318
+ ```
319
+
320
+ - **TBD-pure (after the draft PR is squash-merged):** branch off refreshed
321
+ `main`.
322
+
323
+ ```bash
324
+ git checkout main && git pull origin main
325
+ git checkout -b <next-feature-branch>
326
+ ```
327
+
328
+ - **⚠️ Squash-merge caveat for the stacked path:** this repo squash-merges,
329
+ so once batch _n_'s PR merges, the stacked branch must be re-pointed to
330
+ avoid replaying already-merged diffs — tell the user to
331
+ `git rebase --onto main <old-base> <next-feature-branch>` (or re-target the
332
+ PR base to `main`) after the squash lands.
333
+
334
+ 6. **WAIT** for the user to confirm the new branch and that they are on it.
335
+ 7. **Resume.** Reprint the Ledger, open the next batch on the new branch, and
336
+ continue the original plan exactly where it left off.
337
+
338
+ ### The PR Batch Ledger (reprint at every checkpoint and after every detour)
339
+
340
+ | Batch | Files (n / 20) | Tasks | Branch | Base | Beta flag | PR status (planned / ready-for-PR / drafted / merged) |
341
+ | ----- | -------------- | ----- | ------ | ---- | --------- | ----------------------------------------------------- |
342
+
343
+ ## 🛠 Outcome Actions
344
+
345
+ - **Deliver:** `task.md` handoff per batch. NO commentary _inside the artifact_.
346
+ (Boundary announcements and branch requests are protocol control messages, not
347
+ commentary — those are required.)
348
+
349
+ ## ⚖️ Anti-Rationalization (MANDATORY)
350
+
351
+ | Excuse | Rebuttal |
352
+ | :--------------------------------------------------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
353
+ | "I'll add tests in a follow-up PR." | **Denied.** Verification is part of the task, not a post-script. |
354
+ | "This is just a small change, no need for deep discovery." | **Denied.** Small changes have the highest risk of unintended side effects. |
355
+ | "The environment isn't set up for testing." | **Denied.** Part of Phase 0 is resolving environment blockers or mocking them. |
356
+ | "The existing code is messy, I'll clean it later." | **Denied.** Follow the Boy Scout Rule: Leave it better than you found it. |
357
+ | "It's all one feature — just ship the 30 files in one PR." | **Denied.** >20 files buries the review signal and breaks MinimumCD atomic batches. Cut at the deployable seam. |
358
+ | "Batch 2 needs batch 1's unmerged code, so bundle them." | **Denied.** That is a _backward_ dependency — stack the branch on batch 1. Only _forward_ dependencies are forbidden. |
359
+ | "I'll just push the branch / open the PR for you." | **Denied for the planning agent.** It never runs git — it hands off. `pr-automator` is the sanctioned exception, and even it only reads history + runs `gh pr create`; it never pushes your code. Instruct the user and wait for confirmation. |
360
+ | "Keep planning past the ceiling, we'll split it later." | **Denied.** Post-hoc splitting loses the deployable-seam discipline and produces broken intermediate PRs. Freeze at the seam now. |
361
+ | "The slice said mock, but real is easier here." | **Denied.** Honour the slice's `Data source` and `Dark release` decisions; the plan operationalizes them, it does not revote. |
362
+ | "The dev typed it freeform, just plan it as-is." | **Denied.** Normalize freeform input to the slice fields, fill gaps explicitly (state the assumptions), and apply the deployability test — informal input still gets sliced. |
363
+
364
+ ## 🚩 Red Flags (STOP & Pivot)
365
+
366
+ - **Scope Creep**: Plan touches files unrelated to the core mission.
367
+ - **Complexity Explosion**: A single task requires more than 3 logic branches.
368
+ - **Pattern Deviation**: Proposing a solution that breaks project-established
369
+ conventions.
370
+ - **Silence on Failure**: Tool output shows errors but the plan proceeds as if
371
+ successful.
372
+ - **Ceiling breach**: A batch is heading past 20 files with no deployable seam —
373
+ reslice or invoke the irreducible-unit exception.
374
+ - **Forward dependency**: A batch needs code that lives in a not-yet-created PR.
375
+ - **Unnormalized freeform input**: planning a hand-written "slice" verbatim when
376
+ it is really a layer or several corridors, or with the beta-flag / data-source
377
+ silently assumed instead of stated.
378
+ - **Boundary drift**: Continuing to plan/emit after announcing a PR boundary
379
+ without the user's draft-PR + new-branch confirmation (anti-drift breach —
380
+ reprint the Ledger and wait).
381
+
382
+ ## ✅ Verification Gate (Hard Evidence)
383
+
384
+ - **MANDATORY**: Every task completion MUST be accompanied by a specific CLI
385
+ command output or screenshot.
386
+ - **Requirement**: "Seems to work" or "Code looks good" is NOT evidence.
387
+ - **Tools**: Use `rtk run validate`, `npm test`, or browser automation logs.
388
+ - **Per batch**: each batch passes the **Forward-Independence Rule** (working
389
+ code • no forward dep • flag-gated if incomplete) and records its final file
390
+ tally (<=20) in the Ledger. "It's basically deployable" is NOT evidence.