xtrm-tools 0.5.27 → 0.5.28

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.
@@ -0,0 +1,350 @@
1
+ ---
2
+ name: planning
3
+ description: >
4
+ Structured planning skill for xtrm ecosystem projects. Creates a well-documented
5
+ bd issue board from any task, feature, spec, or idea — with phases, dependencies,
6
+ rich descriptions, and integrated test coverage via test-planning. MUST activate
7
+ whenever the user wants to "plan", "design", "architect", "break down", "structure",
8
+ "scope out", or "start" a feature or epic. Also activate when: the user describes
9
+ a complex task without existing issues, pastes a spec or PRD to decompose, asks
10
+ "how should I approach X" or "where do I start", mentions wanting to create
11
+ implementation issues, or starts a new worktree session without a claimed issue.
12
+ Activate even when the user says something like "I want to implement X" — if there's
13
+ no existing issue board for X, planning comes first. Never skip planning when a
14
+ task spans more than 2 files or 3 steps — that's when a structured board saves hours.
15
+ ---
16
+
17
+ # Planning
18
+
19
+ Transform intent into a bd issue board: each issue self-contained, documented
20
+ enough for any agent or human to work independently.
21
+
22
+ ## When This Fires
23
+
24
+ - `plan`, `design`, `architect`, `scope out`, `break down`, `how should I approach`
25
+ - Starting a new feature/epic from scratch
26
+ - Decomposing a spec, PRD, or long description into tasks
27
+ - Reviewing existing issues that lack documentation or structure
28
+ - Before `bd update --claim` — plan first, then claim
29
+
30
+ ---
31
+
32
+ ## Workflow
33
+
34
+ ```
35
+ Phase 1 Clarify intent → understand what, why, constraints
36
+ Phase 2 Explore codebase → GitNexus + Serena, read-only
37
+ Phase 3 Structure the plan → phases, deps, CoT reasoning
38
+ Phase 4 Create bd issues → epic + tasks, rich descriptions
39
+ Phase 5 test-planning → companion test issues per layer
40
+ Phase 6 Handoff → claim first issue, ready to build
41
+ ```
42
+
43
+ ---
44
+
45
+ ## Phase 1 — Clarify Intent
46
+
47
+ Before touching any code, nail down:
48
+
49
+ <clarification_checklist>
50
+ <item>What is being built? (feature, fix, refactor, migration)</item>
51
+ <item>Why — what problem does it solve?</item>
52
+ <item>Constraints (must not break X, must use pattern Y, deadline)</item>
53
+ <item>Known unknowns — what needs investigation?</item>
54
+ <item>Priority (P0 critical → P4 backlog)</item>
55
+ </clarification_checklist>
56
+
57
+ If the request is under 8 words or the scope is unclear, ask **one** clarifying question before exploring. Don't ask two.
58
+
59
+ ---
60
+
61
+ ## Phase 2 — Explore Codebase (Read-Only)
62
+
63
+ Use GitNexus and Serena to understand the landscape. No file edits.
64
+
65
+ ```bash
66
+ # Find relevant execution flows
67
+ gitnexus_query({query: "<concept related to task>"})
68
+
69
+ # Understand a specific symbol
70
+ gitnexus_context({name: "<affected symbol>"})
71
+
72
+ # Check blast radius before planning changes
73
+ gitnexus_impact({target: "<symbol to change>", direction: "upstream"})
74
+
75
+ # Map a file without reading all of it
76
+ get_symbols_overview("path/to/relevant/file.ts")
77
+
78
+ # Read just the relevant function
79
+ find_symbol("SymbolName", include_body=true)
80
+ ```
81
+
82
+ **Capture from exploration:**
83
+ - Which files/symbols will be affected
84
+ - What existing patterns to follow (naming, structure, error handling)
85
+ - Any d=1 dependents that require updates when you change a symbol
86
+ - Risk level: if CRITICAL or HIGH → warn user before proceeding
87
+
88
+ ---
89
+
90
+ ## Phase 3 — Structure the Plan
91
+
92
+ Think through the plan before writing any bd commands. Use structured CoT:
93
+
94
+ <thinking>
95
+ 1. What are the distinct units of work? (group by: what can change together without breaking other things)
96
+ 2. What phases make sense?
97
+ - P0: Scaffold (types, interfaces, file structure) — others depend on this
98
+ - P1: Core (pure logic, no I/O) — depends on scaffold
99
+ - P2: Boundary/Integration (HTTP, DB, CLI wiring) — depends on core
100
+ - P3: Tests — companion issues, see Phase 5
101
+ 3. What are the dependencies? (what must be done before X can start?)
102
+ 4. What can run in parallel? (independent tasks → no deps between them)
103
+ 5. What are the risks? (complex areas, unclear spec, risky refactors)
104
+ </thinking>
105
+
106
+ <plan>
107
+ <phase name="P0: Scaffold" issues="N">
108
+ Setup that unblocks all other work
109
+ </phase>
110
+ <phase name="P1: Core" issues="N">
111
+ Pure logic, data transforms, parsers
112
+ </phase>
113
+ <phase name="P2: Integration" issues="N">
114
+ CLI wiring, API clients, I/O
115
+ </phase>
116
+ </plan>
117
+
118
+ **Sizing guidance:**
119
+ - Prefer tasks completable in one session (1-4 hours of focused work)
120
+ - If a task has 5+ unrelated deliverables → split it
121
+ - If two tasks always ship together → merge them
122
+
123
+ ---
124
+
125
+ ## Phase 4 — Create bd Issues
126
+
127
+ ### Determine epic scope
128
+
129
+ If the work fits under an **existing open epic** (`bd ready` to check), create tasks
130
+ under it with `--parent=<existing-epic-id>` and skip creating a new epic.
131
+
132
+ If this is genuinely new work with no parent, create the epic first.
133
+
134
+ ### Create the epic (new work only)
135
+
136
+ ```bash
137
+ bd create \
138
+ --title="<Feature name — concise verb phrase>" \
139
+ --description="$(cat <<'EOF'
140
+ ## Overview
141
+
142
+ <2-3 sentences: what this is and why it exists>
143
+
144
+ ## Goals
145
+
146
+ - Goal 1: measurable outcome
147
+ - Goal 2: measurable outcome
148
+
149
+ ## Non-goals
150
+
151
+ - What we are explicitly NOT doing
152
+
153
+ ## Success criteria
154
+
155
+ - [ ] Criteria 1 (observable, testable)
156
+ - [ ] Criteria 2
157
+
158
+ ## Context / background
159
+
160
+ <Links to specs, related issues, existing code paths>
161
+ EOF
162
+ )" \
163
+ --type=epic \
164
+ --priority=<0-4>
165
+ ```
166
+
167
+ ### Create child task issues
168
+
169
+ ```bash
170
+ bd create \
171
+ --title="<Action phrase — what gets built>" \
172
+ --description="$(cat <<'EOF'
173
+ ## Context
174
+
175
+ <Why does this task exist? What does it enable? What comes before/after?>
176
+
177
+ ## What to build
178
+
179
+ <Specific deliverables. Not "implement X" — "X that does Y when Z">
180
+
181
+ ## Acceptance criteria
182
+
183
+ - [ ] Criterion 1
184
+ - [ ] Criterion 2
185
+ - [ ] Tests pass / lint clean
186
+
187
+ ## Approach notes
188
+
189
+ <Relevant code paths (file:line), patterns to follow, discovered risks>
190
+ EOF
191
+ )" \
192
+ --type=task \
193
+ --priority=<same or +1 from epic> \
194
+ --parent=<epic-id>
195
+ ```
196
+
197
+ ### Wire dependencies
198
+
199
+ ```bash
200
+ # B depends on A (A blocks B)
201
+ bd dep add <B-id> <A-id>
202
+
203
+ # Non-blocking relationship
204
+ bd dep relate <issue-a> <issue-b>
205
+ ```
206
+
207
+ ### Issue description quality bar
208
+
209
+ Every task issue description must answer:
210
+ 1. **Why** — why does this exist? (not obvious from the title)
211
+ 2. **What** — specific deliverables (not vague)
212
+ 3. **When done** — acceptance criteria as checkboxes
213
+ 4. **How** — approach hints, relevant code paths, patterns to follow
214
+
215
+ If you can't fill in all four, the scope is still unclear — go back to Phase 1.
216
+
217
+ ---
218
+
219
+ ## Phase 5 — Test Planning Integration
220
+
221
+ After the implementation issues are created, invoke **test-planning**:
222
+
223
+ ```
224
+ /test-planning
225
+ ```
226
+
227
+ test-planning will:
228
+ 1. Classify each implementation issue by layer (core / boundary / shell)
229
+ 2. Pick the right testing strategy per layer
230
+ 3. Create companion test issues batched by layer and phase
231
+ 4. Gate next-phase issues on test completion
232
+
233
+ **When to call it:**
234
+ - Always after creating an epic with 3+ implementation tasks
235
+ - When closing an implementation issue (test-planning checks for gaps)
236
+ - When you realize tests weren't planned upfront
237
+
238
+ **Layer signals to include in your issue descriptions** (helps test-planning classify correctly):
239
+ - Core layer: "transforms", "computes", "parses", "validates", no HTTP/DB/filesystem
240
+ - Boundary layer: "API", "endpoint", "client", "query", "fetch", URLs, ports
241
+ - Shell layer: "CLI command", "subcommand", "orchestrates", "wires together"
242
+
243
+ ---
244
+
245
+ ## Phase 6 — Handoff
246
+
247
+ Present the board and transition to implementation:
248
+
249
+ ```bash
250
+ # Show the full board
251
+ bd show <epic-id>
252
+
253
+ # Claim the first implementation issue
254
+ bd update <first-task-id> --claim
255
+ ```
256
+
257
+ Then begin work on the first task. The planning phase is complete.
258
+
259
+ ---
260
+
261
+ ## Examples
262
+
263
+ ### Example 1 — New CLI command
264
+
265
+ <example>
266
+ <scenario>User: "add a `xtrm audit` command that checks for stale hooks"</scenario>
267
+
268
+ <exploration>
269
+ gitnexus_query({query: "hook wiring audit clean"})
270
+ → finds: cleanOrphanedHookEntries, pruneStaleWrappers in clean.ts
271
+ gitnexus_impact({target: "cleanOrphanedHookEntries", direction: "upstream"})
272
+ → 2 callers, LOW risk
273
+ </exploration>
274
+
275
+ <plan>
276
+ Phase 1: Add audit command skeleton (new file, register in index.ts)
277
+ Phase 2: Implement hook validation logic (read config/hooks.json, compare installed)
278
+ Phase 3: Add --fix flag to auto-remediate drift
279
+ Phase 4: Tests — CLI integration test (shell layer)
280
+ </plan>
281
+
282
+ <bd_commands>
283
+ bd create --title="xtrm audit: detect and report stale hook wiring" --type=epic
284
+ bd create --title="Scaffold xtrm audit command" --description="Context: ..." --type=task
285
+ bd create --title="Implement hook validation — compare config/hooks.json to settings.json" ...
286
+ bd create --title="Add --fix flag for auto-remediation" ...
287
+ bd dep add <wiring-id> <scaffold-id> # wiring depends on scaffold
288
+ bd dep add <fix-id> <wiring-id> # fix depends on wiring
289
+ </bd_commands>
290
+ </example>
291
+
292
+ ### Example 2 — Bug fix with investigation
293
+
294
+ <example>
295
+ <scenario>User: "bd close sometimes doesn't auto-commit"</scenario>
296
+
297
+ <exploration>
298
+ gitnexus_query({query: "bd close auto-commit"})
299
+ → finds: beads-claim-sync.mjs, close event handler
300
+ find_symbol("handleClose", include_body=true)
301
+ → discovers: auto-commit only fires if tracked files changed, not untracked
302
+ </exploration>
303
+
304
+ <thinking>
305
+ Root cause identified: git commit -am skips untracked files.
306
+ Fix: check git ls-files --others before committing.
307
+ Risk: LOW — only beads-claim-sync.mjs changes.
308
+ Single task, no phases needed.
309
+ </thinking>
310
+
311
+ <bd_command>
312
+ bd create \
313
+ --title="Fix bd close auto-commit skips untracked new files" \
314
+ --description="Context: beads-claim-sync.mjs uses 'git commit -am' which skips
315
+ untracked files. Fix: add 'git ls-files --others --exclude-standard' check and
316
+ 'git add -A' scoped to expected paths before committing.
317
+ AC: [ ] auto-commit includes new untracked files [ ] existing behavior preserved"
318
+ --type=bug --priority=1
319
+ </bd_command>
320
+ </example>
321
+
322
+ ### Example 3 — Greenfield feature from spec
323
+
324
+ <example>
325
+ <scenario>User provides a 3-paragraph spec for a new xtrm status command</scenario>
326
+
327
+ <approach>
328
+ Phase 0: Define TypeScript interfaces (StatusReport, HealthCheck)
329
+ Phase 1: Implement each health check function (hooks, settings, bd, mcp)
330
+ Phase 2: Implement CLI command, output formatting, --json flag
331
+ Phase 3: Tests — unit for each check fn (core), integration for CLI (shell)
332
+
333
+ Create epic first, then 4 implementation tasks, then call /test-planning.
334
+ </approach>
335
+ </example>
336
+
337
+ ---
338
+
339
+ ## Self-Check Before Finishing
340
+
341
+ Before presenting the plan to the user:
342
+
343
+ - [ ] Every issue has context / what / AC / notes
344
+ - [ ] Dependencies are correct (A blocks B when B needs A's output)
345
+ - [ ] No task is more than "one session" of work (split if needed)
346
+ - [ ] test-planning was invoked (or scheduled as next step)
347
+ - [ ] First implementation issue is ready to claim
348
+
349
+ If any issue description is empty or just restates the title — it's not ready.
350
+ The test of a good issue: could another agent pick it up cold and succeed?
@@ -0,0 +1,19 @@
1
+ {
2
+ "skill_name": "planning",
3
+ "evals": [
4
+ {
5
+ "id": 1,
6
+ "eval_name": "docs-list-command",
7
+ "prompt": "Plan the implementation of the `xtrm docs list` command (xtrm-vwp0). The command should list all project docs with metadata, support filtering, table output, and JSON mode. It needs to be a subcommand of the existing `xtrm docs` CLI group in cli/src/. There's already a partially-implemented docs.ts somewhere. Break this into a proper phased issue board.",
8
+ "expected_output": "An epic with phased child tasks (scaffold/core/integration), each with rich descriptions containing context, what to build, AC, and approach notes. test-planning invoked after issue board created. Dependencies wired between phases.",
9
+ "files": []
10
+ },
11
+ {
12
+ "id": 2,
13
+ "eval_name": "docs-crosscheck-command",
14
+ "prompt": "Plan the implementation of the `xtrm docs cross-check` command (xtrm-uc0e). This validates docs against PRs and bd issues — detects stale docs, coverage gaps, open issue references. Uses gh CLI for GitHub data. Needs to be a subcommand of `xtrm docs`. Break this into a well-structured bd issue board with proper phasing.",
15
+ "expected_output": "An epic with phased child tasks covering: GitHub data fetching (boundary layer), cross-check logic (core layer), CLI command wiring (shell layer). test-planning invoked. High-quality issue descriptions that another agent could work from independently.",
16
+ "files": []
17
+ }
18
+ ]
19
+ }