@mriekki/lean 0.0.0-stage → 0.1.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 (82) hide show
  1. package/README.md +66 -2
  2. package/assets/components.json +33 -0
  3. package/assets/core/distribution.json +51 -0
  4. package/assets/deployment/distribution.json +34 -0
  5. package/assets/generated/ASSEMBLY.json +382 -0
  6. package/assets/generated/core/core/agents/coach.agent.md +69 -0
  7. package/assets/generated/core/core/agents/reviewer.agent.md +85 -0
  8. package/assets/generated/core/core/instructions/lean-docs.instructions.md +14 -0
  9. package/assets/generated/core/core/instructions/lean-workflow.instructions.md +35 -0
  10. package/assets/generated/core/core/learning/CODING_DRILLS.md +35 -0
  11. package/assets/generated/core/core/learning/DIAGRAM_GUIDE.md +19 -0
  12. package/assets/generated/core/core/learning/ENGINEERING_LEARNING_WORKBOOK.md +82 -0
  13. package/assets/generated/core/core/learning/LEARNING_MAP.md +51 -0
  14. package/assets/generated/core/core/learning/LEARNING_PROGRESS.md +31 -0
  15. package/assets/generated/core/core/learning/RESOURCE_CATALOG.md +25 -0
  16. package/assets/generated/core/core/learning/SQL_DRILLS.md +27 -0
  17. package/assets/generated/core/core/learning/SYSTEM_DESIGN_DRILLS.md +21 -0
  18. package/assets/generated/core/core/process/COACHING_GUIDE.md +57 -0
  19. package/assets/generated/core/core/process/GUIDED_NEXT_STEPS.md +48 -0
  20. package/assets/generated/core/core/process/HUMAN_GATES.md +81 -0
  21. package/assets/generated/core/core/process/INTERACTIVE_SESSION_GUIDE.md +62 -0
  22. package/assets/generated/core/core/process/PRODUCTION_ENABLEMENT.md +59 -0
  23. package/assets/generated/core/core/process/PR_WORKFLOW.md +53 -0
  24. package/assets/generated/core/core/process/SETUP_ACCEPTANCE_CHECKLIST.md +72 -0
  25. package/assets/generated/core/core/process/WORK_ITEM_MODEL.md +56 -0
  26. package/assets/generated/core/core/skills/cleanup-branches/SKILL.md +190 -0
  27. package/assets/generated/core/core/skills/coach/SKILL.md +136 -0
  28. package/assets/generated/core/core/skills/code-walkthrough/SKILL.md +197 -0
  29. package/assets/generated/core/core/skills/core-sync/SKILL.md +220 -0
  30. package/assets/generated/core/core/skills/define-feature/SKILL.md +144 -0
  31. package/assets/generated/core/core/skills/deliver/SKILL.md +315 -0
  32. package/assets/generated/core/core/skills/deploy/SKILL.md +193 -0
  33. package/assets/generated/core/core/skills/grill-me/SKILL.md +77 -0
  34. package/assets/generated/core/core/skills/grill-with-docs/SKILL.md +90 -0
  35. package/assets/generated/core/core/skills/learning-review/SKILL.md +90 -0
  36. package/assets/generated/core/core/skills/next-step/SKILL.md +166 -0
  37. package/assets/generated/core/core/skills/production-readiness/SKILL.md +357 -0
  38. package/assets/generated/core/core/skills/pull-latest/SKILL.md +166 -0
  39. package/assets/generated/core/core/skills/refine-requirements/SKILL.md +207 -0
  40. package/assets/generated/core/core/skills/start-work/SKILL.md +178 -0
  41. package/assets/generated/core/core/skills/tear-down/SKILL.md +138 -0
  42. package/assets/generated/core/core/skills/upstream-fix/SKILL.md +206 -0
  43. package/assets/generated/core/core/skills/wait-what/SKILL.md +86 -0
  44. package/assets/generated/core/core/templates/FEATURE_BRIEF_TEMPLATE.md +27 -0
  45. package/assets/generated/core/core/templates/PRODUCT_BRIEF_TEMPLATE.md +27 -0
  46. package/assets/generated/core/core/templates/PULL_REQUEST_TEMPLATE.md +37 -0
  47. package/assets/generated/core/core/templates/REQUIREMENTS_TEMPLATE.md +17 -0
  48. package/assets/generated/core/profiles/greenfield/lean-workspace.json +12 -0
  49. package/assets/generated/core/tools/package/check_baseline.py +102 -0
  50. package/assets/generated/core/tools/package/check_upstream.py +171 -0
  51. package/assets/generated/deployment/distribution/lean-poc-deploy.py +8 -0
  52. package/assets/generated/deployment/src/lean_poc_deployment/__init__.py +3 -0
  53. package/assets/generated/deployment/src/lean_poc_deployment/__main__.py +3 -0
  54. package/assets/generated/deployment/src/lean_poc_deployment/app_cli.py +140 -0
  55. package/assets/generated/deployment/src/lean_poc_deployment/app_runtime.py +455 -0
  56. package/assets/generated/deployment/src/lean_poc_deployment/app_runtime_remote.py +416 -0
  57. package/assets/generated/deployment/src/lean_poc_deployment/box_platform.py +208 -0
  58. package/assets/generated/deployment/src/lean_poc_deployment/box_platform_assets.py +100 -0
  59. package/assets/generated/deployment/src/lean_poc_deployment/box_platform_remote.py +271 -0
  60. package/assets/generated/deployment/src/lean_poc_deployment/cli.py +437 -0
  61. package/assets/generated/deployment/src/lean_poc_deployment/doctor.py +121 -0
  62. package/assets/generated/deployment/src/lean_poc_deployment/entrypoint.py +25 -0
  63. package/assets/generated/deployment/src/lean_poc_deployment/errors.py +5 -0
  64. package/assets/generated/deployment/src/lean_poc_deployment/keys.py +171 -0
  65. package/assets/generated/deployment/src/lean_poc_deployment/profiles.py +204 -0
  66. package/assets/generated/deployment/src/lean_poc_deployment/route_registry.py +367 -0
  67. package/assets/generated/deployment/src/lean_poc_deployment/route_registry_remote.py +443 -0
  68. package/assets/generated/deployment/src/lean_poc_deployment/security.py +290 -0
  69. package/assets/generated/deployment/src/lean_poc_deployment/sqlite_adapter.py +335 -0
  70. package/assets/generated/deployment/src/lean_poc_deployment/sqlite_adapter_remote.py +340 -0
  71. package/assets/generated/deployment/src/lean_poc_deployment/sqlite_cli.py +86 -0
  72. package/assets/generated/deployment/src/lean_poc_deployment/sqlite_import_recovery.py +437 -0
  73. package/assets/generated/deployment/src/lean_poc_deployment/ssh.py +118 -0
  74. package/assets/generated/deployment/src/lean_poc_deployment/teardown.py +286 -0
  75. package/assets/generated/deployment/src/lean_poc_deployment/teardown_cli.py +120 -0
  76. package/assets/generated/deployment/src/lean_poc_deployment/teardown_remote.py +100 -0
  77. package/assets/generated/deployment/src/lean_poc_deployment/trust.py +278 -0
  78. package/bin/lean.mjs +9 -0
  79. package/package.json +31 -4
  80. package/src/cli.mjs +131 -0
  81. package/src/engine.mjs +243 -0
  82. package/src/package-data.mjs +18 -0
@@ -0,0 +1,166 @@
1
+ ---
2
+ name: pull-latest
3
+ description: Guided fast-forward-only Git update so a developer can safely get the latest remote branch state without remembering Git syntax.
4
+ argument-hint: "[optional branch name]"
5
+ user-invocable: true
6
+ disable-model-invocation: true
7
+ ---
8
+
9
+ # Pull Latest
10
+
11
+ `/pull-latest` is a small convenience wrapper for routine Git updates. It removes the need to remember `fetch`, `switch`, `pull --ff-only`, or upstream-status syntax while preserving normal repository safety.
12
+
13
+ Existing repository conventions outrank Lean defaults.
14
+
15
+ Invocation starts read-only.
16
+
17
+ ## 1. Inspect current state
18
+
19
+ Inspect:
20
+
21
+ ```text
22
+ git status --short --branch
23
+ git branch --show-current
24
+ git remote -v
25
+ git branch -vv
26
+ ```
27
+
28
+ Resolve:
29
+ - current branch,
30
+ - configured upstream for the current branch,
31
+ - configured default branch when observable,
32
+ - requested branch when one was supplied,
33
+ - whether the working tree is clean enough to switch/update safely.
34
+
35
+ Do not fetch, switch branches, pull, stash, merge, rebase, reset, clean, or delete anything during this first inspection.
36
+
37
+ ## 2. Safety stop conditions
38
+
39
+ Stop before update when:
40
+ - tracked/staged/untracked work could be overwritten or makes branch switching unsafe,
41
+ - a merge/rebase/cherry-pick is in progress,
42
+ - the requested branch or remote is ambiguous,
43
+ - no usable upstream exists for the branch being updated,
44
+ - authentication/remote access fails,
45
+ - repository policy requires a different update method.
46
+
47
+ Never auto-stash user work.
48
+ Never use `reset --hard`, force-push, merge, or rebase as part of `/pull-latest`.
49
+
50
+ ## 3. Choose the update target
51
+
52
+ If the human supplied a branch, use that branch as the requested target when it can be resolved safely.
53
+
54
+ If no branch was supplied and the current branch is the default branch, present:
55
+
56
+ ```text
57
+ PULL LATEST READY
58
+
59
+ Current branch: <branch>
60
+ Working tree: CLEAN
61
+
62
+ 1. Refresh remote state and pull latest <branch> [GIT WRITE] — recommended
63
+ 2. Stop [NO ACTION]
64
+ ```
65
+
66
+ If no branch was supplied and the current branch is a non-default branch, present:
67
+
68
+ ```text
69
+ PULL LATEST READY
70
+
71
+ Current branch: <branch>
72
+ Default branch: <default>
73
+ Working tree: CLEAN
74
+
75
+ 1. Refresh and pull the current branch [GIT WRITE]
76
+ 2. Switch to the default branch and pull latest [GIT WRITE] — recommended for returning to baseline
77
+ 3. Stop [NO ACTION]
78
+ ```
79
+
80
+ Only the selected option authorizes fetch/switch/pull mechanics for the selected branch.
81
+
82
+ ## 4. Refresh remote state
83
+
84
+ For the selected remote/branch, run the repository-normal equivalent of:
85
+
86
+ ```text
87
+ git fetch <remote> --prune
88
+ ```
89
+
90
+ Then re-evaluate local branch, upstream, and remote head before pulling.
91
+
92
+ Classify the branch as:
93
+ - `CURRENT` — local and upstream point to the same commit,
94
+ - `BEHIND` — local can be fast-forwarded to upstream,
95
+ - `AHEAD` — local has commits not on upstream,
96
+ - `DIVERGED` — both local and upstream contain unique commits,
97
+ - `UNKNOWN` — state cannot be established safely.
98
+
99
+ ## 5. Apply only a fast-forward-safe update
100
+
101
+ ### CURRENT
102
+
103
+ Do not create a no-op commit or other change. Report that the branch is already current.
104
+
105
+ ### BEHIND
106
+
107
+ Use the repository-normal equivalent of:
108
+
109
+ ```text
110
+ git pull --ff-only
111
+ ```
112
+
113
+ If the user selected the default branch while currently on another branch, first switch to the existing local default branch only after confirming the working tree is safe, then perform the same fast-forward-only update.
114
+
115
+ ### AHEAD
116
+
117
+ Do not pull, merge, rebase, reset, or push. Report `LOCAL AHEAD` and the observed commit counts when available.
118
+
119
+ ### DIVERGED
120
+
121
+ Stop. Report `DIVERGED` and recommend explicit inspection. `/pull-latest` must not choose merge, rebase, reset, or force-push on the user's behalf.
122
+
123
+ ### UNKNOWN
124
+
125
+ Stop and report the missing/ambiguous evidence.
126
+
127
+ ## 6. Verification
128
+
129
+ After a successful update, inspect:
130
+
131
+ ```text
132
+ git status --short --branch
133
+ git log -1 --oneline
134
+ ```
135
+
136
+ When useful, also confirm the local branch head matches its upstream.
137
+
138
+ ## 7. Completion report
139
+
140
+ Use:
141
+
142
+ ```text
143
+ PULL LATEST COMPLETE
144
+
145
+ Branch: <branch>
146
+ Remote/upstream: <remote>/<branch>
147
+ Result: UPDATED | ALREADY CURRENT | LOCAL AHEAD | DIVERGED | BLOCKED
148
+ Head: <sha>
149
+ Working tree: <state>
150
+ ```
151
+
152
+ Do not claim an update succeeded unless the resulting branch/upstream state was observed.
153
+
154
+ ## 8. Boundaries
155
+
156
+ `/pull-latest` never:
157
+ - modifies application/source files directly,
158
+ - stashes work automatically,
159
+ - creates or deletes branches,
160
+ - commits or pushes,
161
+ - merges or rebases,
162
+ - resets or cleans the worktree,
163
+ - resolves conflicts automatically,
164
+ - changes remotes/upstreams unless a separate explicit action authorizes that configuration change.
165
+
166
+ It is intentionally just the safe convenience path for `refresh remote state → fast-forward if possible → verify`.
@@ -0,0 +1,207 @@
1
+ ---
2
+ name: refine-requirements
3
+ description: Assess and continuously refine requirement coverage for the configured authoritative work-item source without forcing a local requirements hierarchy.
4
+ argument-hint: "<work-item ID, external key, or topic>"
5
+ user-invocable: true
6
+ disable-model-invocation: true
7
+ ---
8
+
9
+ # Refine Requirements
10
+
11
+ Purpose: make requirements implementation-ready when the work benefits from detailed precision.
12
+
13
+ This skill is proportional; it is not mandatory for every change.
14
+
15
+ ## 1. Resolve authority and context
16
+
17
+ Read `.github/lean-workspace.json` when present.
18
+
19
+ Determine:
20
+ - authoritative work-item source,
21
+ - parent/grouping context when actually available,
22
+ - permitted Product/Feature Brief roles,
23
+ - whether local detailed requirements are authoritative, supplemental, read-only, or not used,
24
+ - relevant accepted ADR/design rules.
25
+
26
+ Read only the minimum relevant context. Do not preload unrelated work items. Do not claim external content was read unless it is actually available.
27
+
28
+ Never assume `Jira Epic == Feature Brief`.
29
+
30
+ ## 2. Decide whether detail is warranted
31
+
32
+ Detailed refinement is useful for behavior such as:
33
+ - lifecycle/state transitions,
34
+ - archive/delete/restore,
35
+ - validation/uniqueness,
36
+ - identity/permissions/attribution,
37
+ - data integrity,
38
+ - concurrency/transactions,
39
+ - destructive/reversible behavior,
40
+ - failure handling,
41
+ - multiple related workflows,
42
+ - cross-layer behavior needing testable boundaries.
43
+
44
+ For LIGHT/obvious work, say detailed refinement is unnecessary and return to `/start-work`.
45
+
46
+ ## 3. Requirement shape depends on authority
47
+
48
+ ### Local combined requirements permitted
49
+
50
+ Prefer one combined file rather than separate user-story/domain files.
51
+
52
+ Product Feature:
53
+
54
+ ```text
55
+ requirements.md
56
+ ├── User Stories
57
+ ├── Domain Requirements
58
+ ├── Acceptance / Validation Scenarios
59
+ ├── Open Decisions
60
+ ├── Traceability
61
+ └── Approval
62
+ ```
63
+
64
+ Engineering Enabler:
65
+
66
+ ```text
67
+ requirements.md
68
+ ├── Engineering Requirements
69
+ ├── Acceptance Criteria / Validation Scenarios
70
+ ├── Open Decisions
71
+ ├── Traceability
72
+ └── Approval
73
+ ```
74
+
75
+ Do not invent personas for technical enablers.
76
+
77
+ ### External work item is primary
78
+
79
+ If Jira/Issue/another external system is primary and local detailed requirements are not an approved supplement:
80
+ - assess the external content actually provided/accessible,
81
+ - maintain concise proposed external-work-item updates during the session,
82
+ - do not create `requirements.md` merely as a dumping ground.
83
+
84
+ ## 4. Initial behavior is read-only
85
+
86
+ Report an evidence-backed coverage assessment first:
87
+
88
+ ```text
89
+ REQUIREMENTS COVERAGE
90
+
91
+ User / engineering outcomes:
92
+ ✓ ...
93
+ ○ ...
94
+
95
+ Domain / engineering rules:
96
+ ✓ ...
97
+ ○ ...
98
+
99
+ Acceptance / validation:
100
+ ✓ ...
101
+ ○ ...
102
+
103
+ Cross-work-item/grouping context:
104
+ ✓ / ○ / N/A
105
+
106
+ Open material decisions:
107
+ - ...
108
+
109
+ AUTHORITATIVE SOURCE
110
+ <source>
111
+
112
+ STATUS
113
+ <DRAFT / APPROVED / external status / not represented locally>
114
+ ```
115
+
116
+ Then present only relevant choices, for example:
117
+
118
+ ```text
119
+ 1. Review outcomes [READ ONLY]
120
+ 2. Review rules [READ ONLY]
121
+ 3. Review acceptance scenarios [READ ONLY]
122
+ 4. Refine identified gaps [MODIFIES DOCS or PROPOSED EXTERNAL UPDATE]
123
+ 5. Grill an unresolved decision [READ ONLY]
124
+ 6. Review full requirements/work item [READ ONLY]
125
+ 7. Approve local requirements when applicable [REQUIREMENTS GATE]
126
+ 8. Stop [NO ACTION]
127
+ ```
128
+
129
+ ## 5. Active refinement session
130
+
131
+ Once the human selects a modifying refinement option, enter a bounded continuous session:
132
+
133
+ ```text
134
+ ask one material requirement question
135
+ → human answers
136
+ → reconcile/update/propose only what was resolved
137
+ → update directly affected validation scenario when useful
138
+ → summarize exactly what changed
139
+ → next material question
140
+ ```
141
+
142
+ For bounded requirement decisions such as lifecycle policy, validation behavior, destructive/reversible handling, or a small set of credible alternatives, use the choice-first interaction guidance from `INTERACTIVE_SESSION_GUIDE.md`. Keep outcome wording, workflow descriptions, acceptance intent, and other human-authored framing open-ended when predefined choices would constrain the requirement.
143
+
144
+ Do not ask after each answer whether to update.
145
+
146
+ For local combined requirements:
147
+ - preserve stable IDs,
148
+ - do not renumber approved IDs,
149
+ - keep implementation convenience out unless it is itself an approved requirement.
150
+
151
+ For external-primary requirements without write authorization:
152
+ - accumulate `PROPOSED EXTERNAL WORK-ITEM UPDATES`.
153
+
154
+ If a permitted external write integration exists, require explicit `[EXTERNAL WRITE]` authorization before applying those updates.
155
+
156
+ ## 6. Pause only for material conflicts
157
+
158
+ Stop automatic reconciliation when an answer would:
159
+ - materially change approved higher-level scope,
160
+ - contradict an approved Product/Feature/Enabler rule,
161
+ - contradict an accepted ADR/design decision,
162
+ - require a cross-cutting architecture decision,
163
+ - remain too ambiguous to record faithfully.
164
+
165
+ Then present a small explicit choice.
166
+
167
+ ## 7. Approval gate
168
+
169
+ Local detailed requirements use only meaningful authoring states:
170
+
171
+ ```text
172
+ DRAFT
173
+ APPROVED
174
+ ```
175
+
176
+ Human approval is explicit. Do not infer approval from review/planning/implementation.
177
+
178
+ Before approval report coverage and open material decisions. Only an explicit `[REQUIREMENTS GATE]` choice may change local status to `APPROVED`.
179
+
180
+ External work-item status/approval follows the external team's conventions; Lean must not fabricate a local approval state.
181
+
182
+ ## 8. Natural completion
183
+
184
+ Summarize:
185
+
186
+ ```text
187
+ REQUIREMENTS REFINEMENT COMPLETE
188
+
189
+ Updated/proposed:
190
+ - <outcomes>
191
+ - <rules>
192
+ - <acceptance scenarios>
193
+
194
+ Open material decisions:
195
+ None / list
196
+
197
+ Authority/status:
198
+ <source and status>
199
+ ```
200
+
201
+ Then offer review, more grilling/refinement, approval when applicable, or stop.
202
+
203
+ ## 9. Stop boundary
204
+
205
+ Do not create implementation plans or production code.
206
+
207
+ When requirements are ready, recommend `/start-work <ID-or-key>`.
@@ -0,0 +1,178 @@
1
+ ---
2
+ name: start-work
3
+ description: Assess requirement readiness and implementation risk, then guide direct Agent work or native planning for the configured work item.
4
+ argument-hint: "<work-item ID, external key, or concise change>"
5
+ user-invocable: true
6
+ disable-model-invocation: true
7
+ ---
8
+
9
+ # Start Work
10
+
11
+ ## 1. Resolve the requested work
12
+
13
+ Read `.github/lean-workspace.json` when present.
14
+
15
+ Resolve only the context needed:
16
+ - authoritative work-item source,
17
+ - parent/grouping context when actually available,
18
+ - optional Product/Feature/Enabler briefs according to configured authority,
19
+ - local detailed requirements when permitted/present,
20
+ - relevant decisions/ADRs/architecture/standards,
21
+ - current code/tests and branch/diff when relevant.
22
+
23
+ Do not require local briefs when the repository uses Jira/Issues. Do not invent external content.
24
+
25
+ ## 2. Check requirement readiness before planning
26
+
27
+ Assess:
28
+ - outcome clarity,
29
+ - acceptance criteria/validation expectations,
30
+ - material domain/engineering rules,
31
+ - dependencies/cross-work-item context,
32
+ - unresolved human decisions,
33
+ - requirement authority/status.
34
+
35
+ Ask:
36
+
37
+ ```text
38
+ Does detailed precision matter?
39
+ Does the authoritative source contain enough detail?
40
+ If local requirements exist, are they DRAFT or APPROVED?
41
+ Are material decisions unresolved?
42
+ ```
43
+
44
+ If detailed precision is warranted but incomplete, recommend `/refine-requirements`, `/grill-me`, or `/grill-with-docs` rather than silently inventing behavior.
45
+
46
+ If local requirements are DRAFT and carry material behavior, human approval is the gate before substantive planning/implementation.
47
+
48
+ If requirements are already sufficient/approved under the configured model, do not force another refinement cycle.
49
+
50
+ ## 3. Classify risk
51
+
52
+ ### LIGHT
53
+
54
+ Tiny, obvious, low-risk; no meaningful schema/security/concurrency/deployment/major-UX implications.
55
+
56
+ ```text
57
+ Agent
58
+ → relevant checks
59
+ → human meaningful-diff review
60
+ ```
61
+
62
+ No formal plan or detailed requirements are required.
63
+
64
+ ### STANDARD
65
+
66
+ Meaningful multi-file work.
67
+
68
+ ```text
69
+ requirements ready as needed
70
+ → native plan
71
+ → HUMAN PLAN APPROVAL
72
+ → short-lived work branch setup
73
+ → Agent implementation
74
+ → checks
75
+ → Reviewer
76
+ → human meaningful-diff acceptance
77
+ ```
78
+
79
+ ### ELEVATED
80
+
81
+ Use for:
82
+ - schema/data-loss risk,
83
+ - authentication/security,
84
+ - concurrency/transactions,
85
+ - release/deployment/recovery,
86
+ - significant architecture,
87
+ - broad cross-layer changes,
88
+ - hard-to-reverse decisions.
89
+
90
+ ```text
91
+ detailed approved requirements / ADR as needed
92
+ → native plan
93
+ → Reviewer challenges plan
94
+ → HUMAN PLAN APPROVAL
95
+ → short-lived work branch setup
96
+ → implementation in small slices
97
+ → stronger verification
98
+ → Reviewer
99
+ → human acceptance
100
+ ```
101
+
102
+ Explain why the level was chosen.
103
+
104
+ ## 4. Optional learning checkpoint
105
+
106
+ For STANDARD/ELEVATED work, once requirements are ready, coaching may be offered but is never required:
107
+
108
+ ```text
109
+ 1. Continue without coaching — recommended default
110
+ 2. /coach for a short pre-build concept review
111
+ 3. /grill-me for challenge rather than teaching
112
+ 4. Stop
113
+ ```
114
+
115
+ For LIGHT work, do not interrupt with coaching unless requested.
116
+
117
+ ## 5. Planning rules
118
+
119
+ For STANDARD/ELEVATED work:
120
+ - use the editor's current native planning capability,
121
+ - plan approach, affected areas, key decisions, risks, and verification,
122
+ - require human plan approval before implementation,
123
+ - do not auto-launch subagents,
124
+ - do not create mandatory `spec.md` or `tasks.md`,
125
+ - save a durable plan only when it is useful across sessions or for genuinely complex/risky work.
126
+
127
+ ## 6. Working branch setup
128
+
129
+ Once implementation is authorized to begin, establish the repository-appropriate short-lived work branch as routine setup before substantive edits.
130
+
131
+ Do not ask a separate branch-creation permission when all of the following are true:
132
+ - the current branch is the default/integration branch and repository policy expects short-lived work branches,
133
+ - the work-item boundary is clear,
134
+ - the target branch name is unambiguous under repository convention or the Lean fallback below,
135
+ - creating/switching branches does not require history rewriting or discarding work.
136
+
137
+ Branch naming order:
138
+ 1. repository/team convention when defined,
139
+ 2. an already-existing branch clearly tied to the work item,
140
+ 3. Lean fallback: `<lowercase-work-item-id>-<concise-slug>` for ID-backed work, or `work/<concise-slug>` for a concise ad hoc change.
141
+
142
+ Examples of the fallback shape are conceptual only; never invent a consumer-specific work-item ID in Core documentation or behavior.
143
+
144
+ If scoped uncommitted changes already exist on the default branch and clearly belong to this work item, preserve them while creating/switching to the short-lived branch when Git can do so safely. Verify that the worktree diff is unchanged after the branch switch.
145
+
146
+ Stop and ask only when branch policy/naming is materially ambiguous, the intended branch already exists with divergent work, unrelated changes are present, or the operation would require stash/reset/rebase/force/history rewriting.
147
+
148
+ For LIGHT work, branch setup is part of the human-selected implementation action. For STANDARD/ELEVATED work, it is part of the approved implementation start after plan approval. Merely inspecting `/start-work` does not authorize implementation before its required gate.
149
+
150
+ ## 7. Production deployment enabler
151
+
152
+ When a work item owns production release/deployment, classify it ELEVATED.
153
+
154
+ Production target discovery may begin early with:
155
+
156
+ ```text
157
+ /production-readiness <deployment-enabler-ID> discovery
158
+ ```
159
+
160
+ Discovery is non-destructive and does not authorize production writes.
161
+
162
+ After implementation review/local acceptance, use `/deliver`. After merge and required post-merge default-branch CI is green, hand off to:
163
+
164
+ ```text
165
+ /production-readiness <deployment-enabler-ID> enable
166
+ ```
167
+
168
+ ## 8. Guided ending
169
+
170
+ Return:
171
+ - CURRENT STATE,
172
+ - risk level and why,
173
+ - requirement readiness,
174
+ - branch state / expected short-lived branch when implementation is about to begin,
175
+ - RECOMMENDED NEXT STEP,
176
+ - a small numbered OPTIONS menu with action labels.
177
+
178
+ Do not skip an unresolved requirement/plan gate merely because implementation is technically possible. Once implementation is selected/approved, do not insert a separate ceremonial branch-creation gate when the branch setup is safe and deterministic.
@@ -0,0 +1,138 @@
1
+ ---
2
+ name: tear-down
3
+ description: "Guided destructive environment cleanup for local, Staging, Production, or all supported POC scopes. Preserves exact ownership boundaries, separate Production-data authorization, and delegates deletion mechanics to repository-provided tooling."
4
+ argument-hint: "[local|staging|production|all]"
5
+ user-invocable: true
6
+ disable-model-invocation: true
7
+ ---
8
+
9
+ # Tear Down
10
+
11
+ `/tear-down` is the human-facing destructive cleanup workflow for repository-owned POC environments and local runtime state.
12
+
13
+ The skill owns scope selection, read-only preflight, destructive preview, and Human-in-the-Loop authorization. Repository-provided deployment tooling owns teardown mechanics.
14
+
15
+ Do not implement Docker, filesystem, route, database, registry, or host cleanup directly in the skill when an approved repository command exists.
16
+
17
+ ## 1. Begin read-only
18
+
19
+ Invocation starts read-only.
20
+
21
+ Read only the minimum repository context needed to identify:
22
+
23
+ - the repository's approved tear-down entry point;
24
+ - the canonical repository/application identity used by that entry point;
25
+ - configured Staging and Production environment-to-target bindings when those scopes are available;
26
+ - the exact local image/package identity used to identify POC-owned local Docker state;
27
+ - the currently supported tear-down scopes and their ownership boundaries.
28
+
29
+ Do not assume script paths, container names, volume names, environment bindings, target addresses, or package coordinates unless the repository establishes them.
30
+
31
+ If the repository does not provide an approved deterministic tear-down command for the requested scope, stop. Do not improvise destructive shell commands.
32
+
33
+ ## 2. Select the scope explicitly
34
+
35
+ Supported generic scope names are:
36
+
37
+ ```text
38
+ local
39
+ staging
40
+ production
41
+ all
42
+ ```
43
+
44
+ If the invocation did not name a scope, present only scopes the current repository actually supports and ask the human to select one.
45
+
46
+ Rules:
47
+
48
+ - never silently default to `production` or `all`;
49
+ - never infer destructive scope from a previous deployment or prior conversation;
50
+ - never widen a requested scope after a failure;
51
+ - `all` means all supported tear-down scopes for this one repository/POC, not machine-wide cleanup;
52
+ - selecting a scope does not itself authorize deletion.
53
+
54
+ If a named scope is unsupported or not configured, fail explicitly.
55
+
56
+ ## 3. Resolve exact ownership and target evidence
57
+
58
+ Before presenting an authorization gate, resolve the non-secret ownership evidence required by the repository's tear-down contract.
59
+
60
+ For local cleanup, this should identify the exact POC-owned local runtime/package boundary. For remote environments, this should identify the exact named environment, configured logical target, repository/application identity, and any ownership markers the deterministic tear-down tool verifies.
61
+
62
+ Preserve the repository's shared-resource boundary. Normal POC tear-down must not broaden into deletion of shared platform infrastructure, unrelated POCs, workstation trust/credentials, or registry packages unless the repository defines a separate explicit lifecycle operation for those resources.
63
+
64
+ If ownership is ambiguous, a target binding changed, host identity cannot be verified, or the underlying tool reports mismatched ownership, stop without deletion.
65
+
66
+ ## 4. Present the destructive preview
67
+
68
+ Before authorization, show what will be removed and what will be preserved using the repository's actual contract.
69
+
70
+ A typical preview is:
71
+
72
+ ```text
73
+ TEAR-DOWN READY
74
+
75
+ Scope: <local|staging|production|all>
76
+ Repository/app: <verified identity>
77
+ Staging target: <verified logical target or not selected>
78
+ Production target: <verified logical target or not selected>
79
+ Local package/runtime identity: <exact identity or not selected>
80
+
81
+ Will remove:
82
+ <repository-supported owned resources>
83
+
84
+ Will preserve:
85
+ <shared/unrelated resources established by the repository contract>
86
+ ```
87
+
88
+ For Deployment-Kit consumers, expected behavior includes:
89
+
90
+ - `local` — exact-package local containers/images and Docker-managed anonymous volumes attached to those owned containers;
91
+ - `staging` — the owned Staging route, runtime, release/evidence state, persistent application data, and backups;
92
+ - `production` — the owned Production route, runtime, release/evidence state, persistent application data, and backups;
93
+ - `all` — Staging + Production + local for the selected POC only.
94
+
95
+ Do not promise deletion of named/shared Docker volumes or other resources unless the repository has an independent ownership model that safely proves they belong to this POC.
96
+
97
+ ## 5. Require the destructive authorization gate
98
+
99
+ Every modifying tear-down requires one explicit bounded authorization for the exact previewed scope and evidence:
100
+
101
+ ```text
102
+ [POC TEAR DOWN]
103
+ ```
104
+
105
+ For `production` or `all`, persistent Production data is part of the requested destructive scope. Require an additional independent authorization:
106
+
107
+ ```text
108
+ [PRODUCTION DATA DELETE]
109
+ ```
110
+
111
+ The Production-data authorization is required even when Production was previously deployed, tested, approved, or selected. Deployment authorization does not authorize data deletion.
112
+
113
+ If the resolved repository/app identity, target binding, ownership evidence, or deletion set materially changes after the preview, stop and require renewed review and authorization.
114
+
115
+ ## 6. Execute only the approved repository command
116
+
117
+ After the required authorization phrase or phrases are explicitly provided, invoke only the repository-approved tear-down command with the exact selected scope and resolved inputs.
118
+
119
+ Pass authorization through only when the repository command expects the same bounded contract. Do not translate one approval into broader deletion authority.
120
+
121
+ Do not add machine-wide Docker prune, shared-network removal, shared Caddy/Avahi removal, unrelated branch/repository cleanup, registry-package deletion, host reprovisioning, target rebinding, or secret/trust cleanup unless those operations are separately defined and explicitly authorized by the repository.
122
+
123
+ If the deterministic command stops partway through `all`, report the completed and remaining scopes. Do not compensate by manually deleting the remainder.
124
+
125
+ ## 7. Verify and report the outcome
126
+
127
+ Use repository-provided evidence/status commands when available. Report only what the evidence supports, including:
128
+
129
+ - requested scope;
130
+ - repository/application identity;
131
+ - environments/targets actually processed;
132
+ - local runtime state actually processed;
133
+ - whether persistent Production data was included;
134
+ - removed versus already-absent resources;
135
+ - any failure point or remaining scope after a partial stop;
136
+ - confirmation that shared/unrelated resources were preserved when the repository provides evidence for that claim.
137
+
138
+ The operation should remain safe to rerun for already-absent owned resources when the repository's tear-down contract says it is idempotent.