pi-matt-pocock 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 (62) hide show
  1. package/LICENSE +27 -0
  2. package/README.md +38 -0
  3. package/TODO.md +11 -0
  4. package/index.ts +1 -0
  5. package/package.json +44 -0
  6. package/procedures/ADR-FORMAT.md +47 -0
  7. package/procedures/AGENT-BRIEF.md +207 -0
  8. package/procedures/CONTEXT-FORMAT.md +60 -0
  9. package/procedures/DEEPENING.md +37 -0
  10. package/procedures/DESIGN-IT-TWICE.md +44 -0
  11. package/procedures/GLOSSARY-FORMAT.md +35 -0
  12. package/procedures/GLOSSARY.md +201 -0
  13. package/procedures/HTML-REPORT.md +123 -0
  14. package/procedures/LEARNING-RECORD-FORMAT.md +46 -0
  15. package/procedures/LOGIC.md +79 -0
  16. package/procedures/MISSION-FORMAT.md +31 -0
  17. package/procedures/OUT-OF-SCOPE.md +105 -0
  18. package/procedures/RESOURCES-FORMAT.md +32 -0
  19. package/procedures/SKILL-MECHANICS.md +22 -0
  20. package/procedures/UI.md +112 -0
  21. package/procedures/bdd-best-practices.md +68 -0
  22. package/procedures/bdd.md +98 -0
  23. package/procedures/code-review.md +111 -0
  24. package/procedures/codebase-design.md +113 -0
  25. package/procedures/diagnosing-bugs.md +139 -0
  26. package/procedures/domain-modeling.md +73 -0
  27. package/procedures/domain.md +51 -0
  28. package/procedures/gherkin-guide.md +109 -0
  29. package/procedures/grill-me.md +5 -0
  30. package/procedures/grill-with-docs.md +5 -0
  31. package/procedures/grilling.md +11 -0
  32. package/procedures/handoff.md +13 -0
  33. package/procedures/hitl-loop.template.sh +44 -0
  34. package/procedures/implement.md +13 -0
  35. package/procedures/improve-codebase-architecture.md +69 -0
  36. package/procedures/issue-tracker-github.md +45 -0
  37. package/procedures/issue-tracker-gitlab.md +46 -0
  38. package/procedures/issue-tracker-local.md +30 -0
  39. package/procedures/mocking.md +59 -0
  40. package/procedures/phase-boundaries.md +55 -0
  41. package/procedures/prototype.md +25 -0
  42. package/procedures/research.md +11 -0
  43. package/procedures/resolving-merge-conflicts.md +13 -0
  44. package/procedures/setup-matt-pocock-skills.md +114 -0
  45. package/procedures/tdd.md +60 -0
  46. package/procedures/teach.md +137 -0
  47. package/procedures/template.sh +204 -0
  48. package/procedures/testing-anti-patterns.md +37 -0
  49. package/procedures/tests.md +77 -0
  50. package/procedures/to-questionnaire.md +47 -0
  51. package/procedures/to-spec.md +77 -0
  52. package/procedures/to-tickets.md +97 -0
  53. package/procedures/triage-labels.md +15 -0
  54. package/procedures/triage.md +110 -0
  55. package/procedures/wait-what.md +1 -0
  56. package/procedures/wayfinder.md +127 -0
  57. package/procedures/wizard.md +39 -0
  58. package/procedures/writing-for-agents.md +76 -0
  59. package/procedures/writing-great-skills.md +81 -0
  60. package/src/index.ts +485 -0
  61. package/src/procedures.ts +33 -0
  62. package/src/workflow.ts +192 -0
@@ -0,0 +1,139 @@
1
+ # Diagnosing Bugs
2
+
3
+ A discipline for hard bugs. Skip phases only when explicitly justified.
4
+
5
+ When exploring the codebase, read `CONTEXT.md` (if it exists) to get a clear mental model of the relevant modules, and check ADRs in the area you're touching.
6
+
7
+ ## Redact
8
+
9
+ This skill has you show commands, outputs and captured artifacts. **Redact every secret first** — write `<REDACTED>` in its place. Build loops against env vars, so the credential stays in the environment rather than in what you show. Captured artifacts carry auth headers: quote only the lines that carry the signal.
10
+
11
+ If the redacted output is not enough to diagnose the bug, say so and ask the user.
12
+
13
+ ## Phase 1 — Build a feedback loop
14
+
15
+ **This is the skill.** Everything else is mechanical. If you have a **tight** pass/fail signal for the bug — one that goes red on _this_ bug — you will find the cause; bisection, hypothesis-testing, and instrumentation all just consume it. If you don't have one, no amount of staring at code will save you.
16
+
17
+ Spend disproportionate effort here. **Be aggressive. Be creative. Refuse to give up.**
18
+
19
+ ### Ways to construct one — try them in roughly this order
20
+
21
+ 1. **Failing test** at whatever seam reaches the bug — unit, integration, e2e.
22
+ 2. **Curl / HTTP script** against a running dev server.
23
+ 3. **CLI invocation** with a fixture input, diffing stdout against a known-good snapshot.
24
+ 4. **Headless browser script** (Playwright / Puppeteer) — drives the UI, asserts on DOM/console/network.
25
+ 5. **Replay a captured trace.** Save a real network request / payload / event log to disk; replay it through the code path in isolation.
26
+ 6. **Throwaway harness.** Spin up a minimal subset of the system (one service, mocked deps) that exercises the bug code path with a single function call.
27
+ 7. **Property / fuzz loop.** If the bug is "sometimes wrong output", run 1000 random inputs and look for the failure mode.
28
+ 8. **Bisection harness.** If the bug appeared between two known states (commit, dataset, version), automate "boot at state X, check, repeat" so you can `git bisect run` it.
29
+ 9. **Differential loop.** Run the same input through old-version vs new-version (or two configs) and diff outputs.
30
+ 10. **HITL bash script.** Last resort. If a human must click, drive _them_ with `hitl-loop.template.sh` so the loop is still structured. Captured output feeds back to you.
31
+
32
+ Build the right feedback loop, and the bug is 90% fixed.
33
+
34
+ ### Tighten the loop
35
+
36
+ Treat the loop as a product. Once you have _a_ loop, **tighten** it:
37
+
38
+ - Can I make it faster? (Cache setup, skip unrelated init, narrow the test scope.)
39
+ - Can I make the signal sharper? (Assert on the specific symptom, not "didn't crash".)
40
+ - Can I make it more deterministic? (Pin time, seed RNG, isolate filesystem, freeze network.)
41
+
42
+ A 30-second flaky loop is barely better than no loop; a 2-second deterministic one is tight — a debugging superpower.
43
+
44
+ ### Non-deterministic bugs
45
+
46
+ The goal is not a clean repro but a **higher reproduction rate**. Loop the trigger 100×, parallelise, add stress, narrow timing windows, inject sleeps. A 50%-flake bug is debuggable; 1% is not — keep raising the rate until it's debuggable.
47
+
48
+ ### When you genuinely cannot build a loop
49
+
50
+ Stop and say so explicitly. List what you tried. Ask the user directly in the conversation for (a) access to whatever environment reproduces it, (b) a redacted captured artifact (HAR file, log dump, core dump, screen recording with timestamps), or (c) permission to add temporary production instrumentation, then wait for the reply. Do **not** proceed to hypothesise without a loop.
51
+
52
+ ### Completion criterion — a tight loop that goes red
53
+
54
+ Phase 1 is done when the loop is **tight** and **red-capable**: you can name **one command** — a script path, a test invocation, a curl — that you have **already run at least once** (show the invocation and its output, redacted), and that is:
55
+
56
+ - [ ] **Red-capable** — it drives the actual bug code path and asserts the **user's exact symptom**, so it can go red on this bug and green once fixed. Not "runs without erroring" — it must be able to _catch this specific bug_.
57
+ - [ ] **Deterministic** — same verdict every run (flaky bugs: a pinned, high reproduction rate, per above).
58
+ - [ ] **Fast** — seconds, not minutes.
59
+ - [ ] **Agent-runnable** — you can run it unattended; a human in the loop only via `hitl-loop.template.sh`.
60
+
61
+ If you catch yourself reading code to build a theory before this command exists, **stop — jumping straight to a hypothesis is the exact failure this skill prevents.** No red-capable command, no Phase 2.
62
+
63
+ ## CRITICAL: No loop, no theory
64
+
65
+ The feedback loop **is** the skill. Do not hypothesise, instrument, or fix until a tight, red-capable command exists — one you have already run at least once, that drives this bug's exact symptom, deterministically and fast. No red-capable command, no Phase 2.
66
+
67
+ ## Phase 2 — Reproduce + minimise
68
+
69
+ Run the loop. Watch it go red — the bug appears.
70
+
71
+ Confirm:
72
+
73
+ - [ ] The loop produces the failure mode the **user** described — not a different failure that happens to be nearby. Wrong bug = wrong fix.
74
+ - [ ] The failure is reproducible across multiple runs (or, for non-deterministic bugs, reproducible at a high enough rate to debug against).
75
+ - [ ] You have captured the exact symptom (error message, wrong output, slow timing) so later phases can verify the fix actually addresses it.
76
+
77
+ ### Minimise
78
+
79
+ Once it's red, shrink the repro to the **smallest scenario that still goes red**. Cut inputs, callers, config, data, and steps **one at a time**, re-running the loop after each cut — keep only what's load-bearing for the failure.
80
+
81
+ Why bother: a minimal repro shrinks the hypothesis space in Phase 3 (fewer moving parts left to suspect) and becomes the clean regression test in Phase 5.
82
+
83
+ Done when **every remaining element is load-bearing** — removing any one of them makes the loop go green.
84
+
85
+ Do not proceed until you have reproduced **and** minimised.
86
+
87
+ ## Phase 3 — Hypothesise
88
+
89
+ Generate **3–5 ranked hypotheses** before testing any of them. Single-hypothesis generation anchors on the first plausible idea.
90
+
91
+ Each hypothesis must be **falsifiable**: state the prediction it makes.
92
+
93
+ > Format: "If <X> is the cause, then <changing Y> will make the bug disappear / <changing Z> will make it worse."
94
+
95
+ If you cannot state the prediction, the hypothesis is a vibe — discard or sharpen it.
96
+
97
+ **Show the ranked list to the user before testing.** They often have domain knowledge that re-ranks instantly ("we just deployed a change to #3"), or know hypotheses they've already ruled out. Cheap checkpoint, big time saver. Don't block on it — proceed with your ranking if the user is AFK.
98
+
99
+ ## Phase 4 — Instrument
100
+
101
+ Each probe must map to a specific prediction from Phase 3. **Change one variable at a time.**
102
+
103
+ Tool preference:
104
+
105
+ 1. **Debugger / REPL inspection** if the env supports it. One breakpoint beats ten logs.
106
+ 2. **Targeted logs** at the boundaries that distinguish hypotheses.
107
+ 3. Never "log everything and grep".
108
+
109
+ **Tag every debug log** with a unique prefix, e.g. `[DEBUG-a4f2]`. Cleanup at the end becomes a single grep. Untagged logs survive; tagged logs die.
110
+
111
+ **Perf branch.** For performance regressions, logs are usually wrong. Instead: establish a baseline measurement (timing harness, `performance.now()`, profiler, query plan), then bisect. Measure first, fix second.
112
+
113
+ ## Phase 5 — Fix + regression test
114
+
115
+ Write the regression test **before the fix** — but only if there is a **correct seam** for it.
116
+
117
+ A correct seam is one where the test exercises the **real bug pattern** as it occurs at the call site. If the only available seam is too shallow (single-caller test when the bug needs multiple callers, unit test that can't replicate the chain that triggered the bug), a regression test there gives false confidence.
118
+
119
+ **If no correct seam exists, that itself is the finding.** Note it. The codebase architecture is preventing the bug from being locked down. Flag this for the next phase.
120
+
121
+ If a correct seam exists:
122
+
123
+ 1. Turn the minimised repro into a failing test at that seam.
124
+ 2. Watch it fail.
125
+ 3. Apply the fix.
126
+ 4. Watch it pass.
127
+ 5. Re-run the Phase 1 feedback loop against the original (un-minimised) scenario.
128
+
129
+ ## Phase 6 — Cleanup + post-mortem
130
+
131
+ Required before declaring done:
132
+
133
+ - [ ] Original repro no longer reproduces (re-run the Phase 1 loop)
134
+ - [ ] Regression test passes (or absence of seam is documented)
135
+ - [ ] All `[DEBUG-...]` instrumentation removed (`grep` the prefix)
136
+ - [ ] Throwaway prototypes deleted (or moved to a clearly-marked debug location)
137
+ - [ ] The hypothesis that turned out correct is stated in the commit / PR message — so the next debugger learns
138
+
139
+ **Then determine from the evidence what would have prevented this bug** — no good test seam / tangled callers / hidden coupling / nothing worth changing / another cause. Record the finding and run [code-review](code-review.md) over the fix immediately — a bug fix without a two-axis review is not finished work. If the evidence leaves a genuinely user-owned architectural trade-off, ask it through `matt_pocock_ask` without making the review wait; otherwise hand off to [improve-codebase-architecture](improve-codebase-architecture.md) when it involves no good test seam, tangled callers, or hidden coupling. Make the recommendation **after** the fix is in, not before — you have more information now than when you started.
@@ -0,0 +1,73 @@
1
+ # Domain Modeling
2
+
3
+ Actively build and sharpen the project's domain model as you design. This is the *active* discipline — challenging terms, inventing edge-case scenarios, and writing the glossary and decisions down the moment they crystallise. (Merely *reading* `CONTEXT.md` for vocabulary is not this skill — that's a one-line habit any skill can do. This skill is for when you're changing the model, not just consuming it.)
4
+
5
+ ## File structure
6
+
7
+ Most repos have a single context:
8
+
9
+ ```
10
+ /
11
+ ├── CONTEXT.md
12
+ ├── docs/
13
+ │ └── adr/
14
+ │ ├── 0001-event-sourced-orders.md
15
+ │ └── 0002-postgres-for-write-model.md
16
+ └── src/
17
+ ```
18
+
19
+ If a `CONTEXT-MAP.md` exists at the root, the repo has multiple contexts. The map points to where each one lives:
20
+
21
+ ```
22
+ /
23
+ ├── CONTEXT-MAP.md
24
+ ├── docs/
25
+ │ └── adr/ ← system-wide decisions
26
+ ├── src/
27
+ │ ├── ordering/
28
+ │ │ ├── CONTEXT.md
29
+ │ │ └── docs/adr/ ← context-specific decisions
30
+ │ └── billing/
31
+ │ ├── CONTEXT.md
32
+ │ └── docs/adr/
33
+ ```
34
+
35
+ Create files lazily — only when you have something to write. If no `CONTEXT.md` exists, create one when the first term is resolved. If no `docs/adr/` exists, create it when the first ADR is needed.
36
+
37
+ ## During the session
38
+
39
+ ### Challenge against the glossary
40
+
41
+ When the user uses a term that conflicts with the existing language in `CONTEXT.md`, call it out immediately. "Your glossary defines 'cancellation' as X, but you seem to mean Y — which is it?"
42
+
43
+ ### Sharpen fuzzy language
44
+
45
+ When the user uses vague or overloaded terms, propose a precise canonical term. "You're saying 'account' — do you mean the Customer or the User? Those are different things."
46
+
47
+ ### Discuss concrete scenarios
48
+
49
+ When domain relationships are being discussed, stress-test them with specific scenarios. Invent scenarios that probe edge cases and force the user to be precise about the boundaries between concepts.
50
+
51
+ ### Cross-reference with code
52
+
53
+ When the user states how something works, check whether the code agrees. If you find a contradiction, surface it: "Your code cancels entire Orders, but you just said partial cancellation is possible — which is right?"
54
+
55
+ ### Update CONTEXT.md inline
56
+
57
+ When a term is resolved, update `CONTEXT.md` right there. Don't batch these up — capture them as they happen. Use the format in [CONTEXT-FORMAT.md](./CONTEXT-FORMAT.md).
58
+
59
+ `CONTEXT.md` should be totally devoid of implementation details. Do not treat `CONTEXT.md` as a spec, a scratch pad, or a repository for implementation decisions. It is a glossary and nothing else.
60
+
61
+ ## CRITICAL: CONTEXT.md is a glossary and nothing else
62
+
63
+ Never treat `CONTEXT.md` as a spec, a scratch pad, or a home for implementation decisions — implementation details are forbidden there. Capture resolved terms inline the moment they crystallise, and offer an ADR only when a decision is hard to reverse, surprising without context, and the result of a real trade-off.
64
+
65
+ ### Offer ADRs sparingly
66
+
67
+ Only offer to create an ADR when all three are true:
68
+
69
+ 1. **Hard to reverse** — the cost of changing your mind later is meaningful
70
+ 2. **Surprising without context** — a future reader will wonder "why did they do it this way?"
71
+ 3. **The result of a real trade-off** — there were genuine alternatives and you picked one for specific reasons
72
+
73
+ If any of the three is missing, skip the ADR. Use the format in [ADR-FORMAT.md](./ADR-FORMAT.md).
@@ -0,0 +1,51 @@
1
+ # Domain Docs
2
+
3
+ How the engineering skills should consume this repo's domain documentation when exploring the codebase.
4
+
5
+ ## Before exploring, read these
6
+
7
+ - **`CONTEXT.md`** at the repo root, or
8
+ - **`CONTEXT-MAP.md`** at the repo root if it exists — it points at one `CONTEXT.md` per context. Read each one relevant to the topic.
9
+ - **`docs/adr/`** — read ADRs that touch the area you're about to work in. In multi-context repos, also check `src/<context>/docs/adr/` for context-scoped decisions.
10
+
11
+ If any of these files don't exist, **proceed silently**. Don't flag their absence; don't suggest creating them upfront. The [domain-modeling](domain-modeling.md) skill (reached via [grill-with-docs](grill-with-docs.md) and [improve-codebase-architecture](improve-codebase-architecture.md)) creates them lazily when terms or decisions actually get resolved.
12
+
13
+ ## File structure
14
+
15
+ Single-context repo (most repos):
16
+
17
+ ```
18
+ /
19
+ ├── CONTEXT.md
20
+ ├── docs/adr/
21
+ │ ├── 0001-event-sourced-orders.md
22
+ │ └── 0002-postgres-for-write-model.md
23
+ └── src/
24
+ ```
25
+
26
+ Multi-context repo (presence of `CONTEXT-MAP.md` at the root):
27
+
28
+ ```
29
+ /
30
+ ├── CONTEXT-MAP.md
31
+ ├── docs/adr/ ← system-wide decisions
32
+ └── src/
33
+ ├── ordering/
34
+ │ ├── CONTEXT.md
35
+ │ └── docs/adr/ ← context-specific decisions
36
+ └── billing/
37
+ ├── CONTEXT.md
38
+ └── docs/adr/
39
+ ```
40
+
41
+ ## Use the glossary's vocabulary
42
+
43
+ When your output names a domain concept (in an issue title, a refactor proposal, a hypothesis, a test name), use the term as defined in `CONTEXT.md`. Don't drift to synonyms the glossary explicitly avoids.
44
+
45
+ If the concept you need isn't in the glossary yet, that's a signal — either you're inventing language the project doesn't use (reconsider) or there's a real gap (note it for [domain-modeling](domain-modeling.md)).
46
+
47
+ ## Flag ADR conflicts
48
+
49
+ If your output contradicts an existing ADR, surface it explicitly rather than silently overriding:
50
+
51
+ > _Contradicts ADR-0007 (event-sourced orders) — but worth reopening because…_
@@ -0,0 +1,109 @@
1
+ # Cucumber Gherkin Guide
2
+
3
+ Gherkin is the language used to define test cases in BDD. It is designed to be non-technical and human-readable, describing software behavior without detailing how that behavior is implemented.
4
+
5
+ ## Key Principles
6
+
7
+ 1. **Declarative, Not Imperative:** Describe *what* the user does, not *how* they do it.
8
+ * *Bad:* "Given I click the user field, and I type 'Alice', and I click the password field..."
9
+ * *Good:* "Given I am logged in as 'Alice'"
10
+ 2. **Business Language:** Use the domain language (Ubiquitous Language) of the business, not technical terms like "JSON", "Database", or "CSS selector".
11
+ 3. **Single Responsibility:** Each scenario should test exactly one rule or behavior.
12
+
13
+ ## Keywords Reference
14
+
15
+ ### Feature
16
+ High-level description of a software feature. Groups related scenarios.
17
+ ```gherkin
18
+ Feature: User Login
19
+ As a registered user
20
+ I want to log in
21
+ So that I can access my dashboard
22
+ ```
23
+
24
+ ### Scenario / Example
25
+ A concrete example illustrating a business rule.
26
+ ```gherkin
27
+ Scenario: Successful login
28
+ Given I am on the login page
29
+ When I log in with valid credentials
30
+ Then I should be redirected to the dashboard
31
+ ```
32
+
33
+ ### Given (Context)
34
+ Describes the initial context or state of the system.
35
+ * **Tip:** Use `Background` for Givens shared by all scenarios in a feature.
36
+
37
+ ### When (Action)
38
+ Describes the event or action taken by the user or system.
39
+ * **Tip:** There should usually be only one `When` step per scenario to clearly identify the trigger.
40
+
41
+ ### Then (Outcome)
42
+ Describes the expected outcome or result.
43
+ * **Tip:** This is where your assertions live.
44
+
45
+ ### And / But
46
+ Connects multiple steps of the same type to improve readability.
47
+
48
+ ### Scenario Outline & Examples
49
+ Used to run the same scenario with different data inputs.
50
+ ```gherkin
51
+ Scenario Outline: Eating cucumbers
52
+ Given there are <start> cucumbers
53
+ When I eat <eat> cucumbers
54
+ Then I should have <left> cucumbers
55
+
56
+ Examples:
57
+ | start | eat | left |
58
+ | 12 | 5 | 7 |
59
+ | 20 | 5 | 15 |
60
+ ```
61
+
62
+ ## Storage & Structure
63
+
64
+ ### Planning vs Execution Artifacts
65
+
66
+ In the BDD workflow, Gherkin scenarios exist in two forms at different stages:
67
+
68
+ | Stage | File | Purpose |
69
+ |-------|------|---------|
70
+ | Spec and planning | `docs/specs/.../scenarios.md` | Review behavior, trace requirements, drive ticket decomposition |
71
+ | Implementation and automation | `tests/features/*.feature` or framework-native executable specs | Run automated BDD checks and serve as living documentation |
72
+
73
+ Use `docs/specs/.../scenarios.md` as the planning artifact while shaping the spec and writing tickets. When execution begins, move or translate the scenarios that must run into `.feature` files or the project's executable test format. Do not leave the only copy of an automated behavior inside planning markdown.
74
+
75
+ ### Where to Store Gherkin Scenarios
76
+
77
+ **Best Practice:** Store scenarios in dedicated `.feature` files, NOT as code comments.
78
+
79
+ ```
80
+ tests/
81
+ ├── features/ # BDD scenarios (business-readable)
82
+ │ ├── user-login.feature # Given/When/Then specifications
83
+ │ ├── user-registration.feature
84
+ │ └── order-processing.feature
85
+ ├── step-definitions/ # Implementation glue code
86
+ │ ├── login-steps.ts # Map scenarios to code
87
+ │ └── order-steps.ts
88
+ └── unit/ # Pure unit tests
89
+ ```
90
+
91
+ **Why not as code comments?**
92
+ - Comments are not executable by BDD frameworks (Cucumber, SpecFlow, etc.)
93
+ - Non-technical stakeholders (PO, BA, QA) cannot access or read code comments
94
+ - Violates separation of concerns: WHAT (behavior) vs HOW (implementation)
95
+ - Loses the "Living Documentation" value that makes BDD valuable
96
+
97
+ **Key Principles:**
98
+ - Feature files serve as executable specifications that both technical and business teams understand
99
+ - Step definitions connect scenarios to implementation code without exposing technical details
100
+ - This separation makes tests resilient to UI changes and implementation refactoring
101
+
102
+ ## Best Practices Checklist
103
+
104
+ - [ ] **Golden Rule:** Can a non-technical stakeholder read and understand this?
105
+ - [ ] **Independence:** Scenarios must not depend on each other (no shared state between tests).
106
+ - [ ] **Brevity:** Keep scenarios short (3-5 steps is ideal).
107
+ - [ ] **Data Tables:** Use data tables for setup to avoid repetitive "Given" steps.
108
+ - [ ] **Backgrounds:** Use Backgrounds to DRY up repeated setup, but don't hide critical context.
109
+ - [ ] **Separation:** Store scenarios in .feature files, not as code comments.
@@ -0,0 +1,5 @@
1
+ Run a [grilling](grilling.md) session.
2
+
3
+ ## CRITICAL: One question at a time, with a recommendation
4
+
5
+ Run the [grilling](grilling.md) discipline relentlessly: ask one question at a time using the `matt_pocock_ask` interactive selection tool, provide suggested options with a recommended option marked "(Recommended)" or set as fallback, support a timeout mechanism, and allow the user to type custom answers. Wait for the reply before continuing. Do not act until the user confirms shared understanding.
@@ -0,0 +1,5 @@
1
+ Run a [grilling](grilling.md) session, using the [domain-modeling](domain-modeling.md) skill.
2
+
3
+ ## CRITICAL: Grill with the docs skills loaded
4
+
5
+ Run the [grilling](grilling.md) session with the [domain-modeling](domain-modeling.md) skill active. Every sharpened term and locked decision lands in `CONTEXT.md` or an ADR as it crystallises — the paper trail is what distinguishes this skill from [grill-me](grill-me.md). Ask interview questions using the `matt_pocock_ask` interactive tool, one at a time, with suggested options, recommendations, timeout, and custom response support. Wait for each reply as [grilling](grilling.md) dictates.
@@ -0,0 +1,11 @@
1
+ Interview me relentlessly about every aspect of this until we reach a shared understanding. Walk down each branch of the decision tree, resolving dependencies between decisions one-by-one. For each question, provide your recommended answer.
2
+
3
+ Ask each question using the `matt_pocock_ask` interactive selection tool, one at a time, and wait for the reply before continuing. Give 2–4 concise alternatives, put your recommended option first marked "(Recommended)", specify a timeout, and explicitly welcome a different answer via custom input. A timeout or unavailable UI leaves the decision pending; a recommendation is never authorization to choose for the user. Asking multiple questions at once is bewildering.
4
+
5
+ If a *fact* can be found by exploring the environment (filesystem, tools, etc.), look it up rather than asking me. The *decisions*, though, are mine — put each one to me via `matt_pocock_ask` and wait for my answer.
6
+
7
+ Do not act on it until I confirm we have reached a shared understanding. Once that confirmation has been reached and the confirmed decisions are recorded: Do not ask whether to continue or request separate permission for the next step; begin the next applicable workflow work immediately.
8
+
9
+ ## CRITICAL: One question at a time — facts you look up, decisions the user makes
10
+
11
+ Ask each question using `matt_pocock_ask`, one at a time, and wait for the reply before continuing; multiple questions at once is bewildering. Put the recommended option first, marked "(Recommended)", specify a timeout, and leave room for a different answer via custom typing. A timeout or unavailable UI leaves the decision pending; it does not select the recommendation. If a fact can be found by exploring the environment (filesystem, tools, etc.), look it up rather than asking. The decisions are the user's — put each one to them, and do not act until they confirm shared understanding. After shared understanding is confirmed, proceed directly to the next applicable workflow work rather than asking whether to continue.
@@ -0,0 +1,13 @@
1
+ Write a portable handoff document summarising the current conversation. This skill only writes the document: it does not create, fork, or seed a session. Save it to the temporary directory of the user's OS — not the current workspace. The user or a receiving agent may use the document in a later session.
2
+
3
+ Include a "suggested skills" section in the document, which suggests skills that the agent should invoke.
4
+
5
+ Do not duplicate content already captured in other artifacts (specs, plans, ADRs, issues, commits, diffs). Reference them by path or URL instead.
6
+
7
+ Redact any sensitive information, such as API keys, passwords, or personally identifiable information.
8
+
9
+ If the user passed arguments, treat them as a description of what the next session will focus on and tailor the doc accordingly.
10
+
11
+ ## CRITICAL: Reference, don't duplicate — and redact
12
+
13
+ Do not copy content already captured in specs, plans, ADRs, issues, commits, or diffs — reference them by path or URL instead. Redact API keys, passwords, and personally identifiable information. Save to the OS temporary directory, never the workspace.
@@ -0,0 +1,44 @@
1
+ #!/usr/bin/env bash
2
+ # Human-in-the-loop reproduction loop.
3
+ # Copy this file, edit the steps below, and run it.
4
+ # The agent runs the script; the user follows prompts in their terminal.
5
+ #
6
+ # Usage:
7
+ # bash hitl-loop.template.sh
8
+ #
9
+ # Two helpers:
10
+ # step "<instruction>" → show instruction, wait for Enter
11
+ # capture VAR "<question>" → show question, read response into VAR
12
+ #
13
+ # At the end, captured values are printed as KEY=VALUE for the agent to parse.
14
+ #
15
+ # `capture` prints its value back to the terminal, where the agent reads it — so
16
+ # capture observations, and leave signing in to the user as a `step`.
17
+
18
+ set -euo pipefail
19
+
20
+ step() {
21
+ printf '\n>>> %s\n' "$1"
22
+ read -r -p " [Enter when done] " _
23
+ }
24
+
25
+ capture() {
26
+ local var="$1" question="$2" answer
27
+ printf '\n>>> %s\n' "$question"
28
+ read -r -p " > " answer
29
+ printf -v "$var" '%s' "$answer"
30
+ }
31
+
32
+ # --- edit below ---------------------------------------------------------
33
+
34
+ step "Open the app at http://localhost:3000 and sign in."
35
+
36
+ capture ERRORED "Click the 'Export' button. Did it throw an error? (y/n)"
37
+
38
+ capture ERROR_MSG "Paste the error message (or 'none'):"
39
+
40
+ # --- edit above ---------------------------------------------------------
41
+
42
+ printf '\n--- Captured ---\n'
43
+ printf 'ERRORED=%s\n' "$ERRORED"
44
+ printf 'ERROR_MSG=%s\n' "$ERROR_MSG"
@@ -0,0 +1,13 @@
1
+ Implement the work described by the user in the spec or tickets.
2
+
3
+ Use [bdd](bdd.md) where possible, at pre-agreed seams. During the Automation phase, load [tdd](tdd.md) (BDD-driven) for test quality, seams, and mocking guidance.
4
+
5
+ Run typechecking regularly, single test files regularly, and the full test suite once at the end.
6
+
7
+ Once done, use [code-review](code-review.md) to review the work.
8
+
9
+ ## CRITICAL: BDD at pre-agreed seams, review before commit
10
+
11
+ Use [bdd](bdd.md) where possible, one red-green slice at a time at pre-agreed seams. Load [tdd](tdd.md) (BDD-driven) during the Automation phase for test quality, seams, and mocking guidance. When the work is done, run [code-review](code-review.md) over it — a change without the two-axis review is not finished work.
12
+
13
+ When the user asks to commit, follow the repository's git-agent workflow rather than staging or committing directly.
@@ -0,0 +1,69 @@
1
+ # Improve Codebase Architecture
2
+
3
+ Surface architectural friction and propose **deepening opportunities** — refactors that turn shallow modules into deep ones. The aim is testability and AI-navigability.
4
+
5
+ This command is _informed_ by the project's domain model and built on a shared design vocabulary:
6
+
7
+ - Run the [codebase-design](codebase-design.md) skill for the architecture vocabulary (**module**, **interface**, **depth**, **seam**, **adapter**, **leverage**, **locality**) and its principles (the deletion test, "the interface is the test surface", "one adapter = hypothetical seam, two = real"). Use these terms exactly in every suggestion — don't drift into "component," "service," "API," or "boundary."
8
+ - The domain language in `CONTEXT.md` gives names to good seams; ADRs in `docs/adr/` record decisions this command should not re-litigate.
9
+
10
+ ## Process
11
+
12
+ ### 1. Explore
13
+
14
+ **Scope before you scan — YAGNI.** Deepening a module pays off by making future changes to it easier, so put extra weight on the parts of the codebase that have recently changed. Decide *where* to look before you look:
15
+
16
+ - If the user named a direction — a module, a subsystem, a pain point — take it, and skip the inference below.
17
+ - Otherwise, walk back a good stretch of the commit history (`git log --oneline`) to find the codebase's hot spots — the files and areas that keep coming up — and let those paths pull your attention first. If the changes are scattered with no clear hot spot, widen the net.
18
+
19
+ Read the project's domain glossary (`CONTEXT.md`) and any ADRs in the area you're touching first.
20
+
21
+ If the teammate facility is available, delegate this codebase walk to a teammate; otherwise perform it in the current context. Don't follow rigid heuristics — explore organically and note where you experience friction:
22
+
23
+ - Where does understanding one concept require bouncing between many small modules?
24
+ - Where are modules **shallow** — interface nearly as complex as the implementation?
25
+ - Where have pure functions been extracted just for testability, but the real bugs hide in how they're called (no **locality**)?
26
+ - Where do tightly-coupled modules leak across their seams?
27
+ - Which parts of the codebase are untested, or hard to test through their current interface?
28
+
29
+ Apply the **deletion test** to anything you suspect is shallow: would deleting it concentrate complexity, or just move it? A "yes, concentrates" is the signal you want.
30
+
31
+ ### 2. Present candidates as an HTML report
32
+
33
+ Write a self-contained HTML file to the OS temp directory so nothing lands in the repo. Resolve the temp dir from `$TMPDIR`, falling back to `/tmp` (or `%TEMP%` on Windows), and write to `<tmpdir>/architecture-review-<timestamp>.html` so each run gets a fresh file. Open it for the user — `xdg-open <path>` on Linux, `open <path>` on macOS, `start <path>` on Windows — and tell them the absolute path.
34
+
35
+ The report uses **Tailwind via CDN** for layout and styling, and **Mermaid via CDN** for diagrams where a graph/flow/sequence reliably communicates the structure. Mix Mermaid with hand-crafted CSS/SVG visuals — use Mermaid when relationships are graph-shaped (call graphs, dependencies, sequences), and hand-built divs/SVG when you want something more editorial (mass diagrams, cross-sections, collapse animations). Each candidate gets a **before/after visualisation**. Be visual.
36
+
37
+ For each candidate, render a card with:
38
+
39
+ - **Files** — which files/modules are involved
40
+ - **Problem** — why the current architecture is causing friction
41
+ - **Solution** — plain English description of what would change
42
+ - **Benefits** — explained in terms of locality and leverage, and how tests would improve
43
+ - **Before / After diagram** — side-by-side, custom-drawn, illustrating the shallowness and the deepening
44
+ - **Recommendation strength** — one of `Strong`, `Worth exploring`, `Speculative`, rendered as a badge
45
+
46
+ End the report with a **Top recommendation** section: which candidate you'd tackle first and why.
47
+
48
+ **Use CONTEXT.md vocabulary for the domain, and the [codebase-design](codebase-design.md) vocabulary for the architecture.** If `CONTEXT.md` defines "Order," talk about "the Order intake module" — not "the FooBarHandler," and not "the Order service."
49
+
50
+ **ADR conflicts**: if a candidate contradicts an existing ADR, only surface it when the friction is real enough to warrant revisiting the ADR. Mark it clearly in the card (e.g. a warning callout: _"contradicts ADR-0007 — but worth reopening because…"_). Don't list every theoretical refactor an ADR forbids.
51
+
52
+ See [HTML-REPORT.md](HTML-REPORT.md) for the full HTML scaffold, diagram patterns, and styling guidance.
53
+
54
+ Do NOT propose interfaces yet. After the file is written, present the candidates in the conversation, mark your recommended one "(Recommended)", ask which candidate to explore, and wait for the reply.
55
+
56
+ ## CRITICAL: Scope before you scan — and never propose interfaces
57
+
58
+ Decide where to look before looking: follow the user's direction, or walk the commit history for hot spots — YAGNI. The report surfaces candidates only: **do NOT propose interfaces yet** — present the report, ask directly in the conversation which candidate to explore, and wait for the reply before any design work.
59
+
60
+ ### 3. Grilling loop
61
+
62
+ Once the user picks a candidate, run the [grilling](grilling.md) skill to walk the decision tree with them — constraints, dependencies, the shape of the deepened module, what sits behind the seam, what tests survive.
63
+
64
+ Side effects happen inline as decisions crystallize — run the [domain-modeling](domain-modeling.md) skill to keep the domain model current as you go:
65
+
66
+ - **Naming a deepened module after a concept not in `CONTEXT.md`?** Add the term to `CONTEXT.md`. Create the file lazily if it doesn't exist.
67
+ - **Sharpening a fuzzy term during the conversation?** Update `CONTEXT.md` right there.
68
+ - **User rejects the candidate with a load-bearing reason?** Offer an ADR, framed as: _"Want me to record this as an ADR so future architecture reviews don't re-suggest it?"_ Only offer when the reason would actually be needed by a future explorer to avoid re-suggesting the same thing — skip ephemeral reasons ("not worth it right now") and self-evident ones.
69
+ - **Want to explore alternative interfaces for the deepened module?** Run the [codebase-design](codebase-design.md) skill and use its Design It Twice pattern with teammates when the teammate facility is available, or compare designs sequentially in the current context.
@@ -0,0 +1,45 @@
1
+ # Issue tracker: GitHub
2
+
3
+ Issues and PRDs for this repo live as GitHub issues. Use the `gh` CLI for all operations.
4
+
5
+ ## Conventions
6
+
7
+ - **Create an issue**: `gh issue create --title "..." --body "..."`. Use a heredoc for multi-line bodies.
8
+ - **Read an issue**: `gh issue view <number> --comments`, filtering comments by `jq` and also fetching labels.
9
+ - **List issues**: `gh issue list --state open --json number,title,body,labels,comments --jq '[.[] | {number, title, body, labels: [.labels[].name], comments: [.comments[].body]}]'` with appropriate `--label` and `--state` filters.
10
+ - **Comment on an issue**: `gh issue comment <number> --body "..."`
11
+ - **Apply / remove labels**: `gh issue edit <number> --add-label "..."` / `--remove-label "..."`
12
+ - **Close**: `gh issue close <number> --comment "..."`
13
+
14
+ Infer the repo from `git remote -v` — `gh` does this automatically when run inside a clone.
15
+
16
+ ## Pull requests as a triage surface
17
+
18
+ **PRs as a request surface: no.** _(Set to `yes` if this repo treats external PRs as feature requests; [triage](triage.md) reads this flag.)_
19
+
20
+ When set to `yes`, PRs run through the same labels and states as issues, using the `gh pr` equivalents:
21
+
22
+ - **Read a PR**: `gh pr view <number> --comments` and `gh pr diff <number>` for the diff.
23
+ - **List external PRs for triage**: `gh pr list --state open --json number,title,body,labels,author,authorAssociation,comments` then keep only `authorAssociation` of `CONTRIBUTOR`, `FIRST_TIME_CONTRIBUTOR`, or `NONE` (drop `OWNER`/`MEMBER`/`COLLABORATOR`).
24
+ - **Comment / label / close**: `gh pr comment`, `gh pr edit --add-label`/`--remove-label`, `gh pr close`.
25
+
26
+ GitHub shares one number space across issues and PRs, so a bare `#42` may be either — resolve with `gh pr view 42` and fall back to `gh issue view 42`.
27
+
28
+ ## When a skill says "publish to the issue tracker"
29
+
30
+ Create a GitHub issue.
31
+
32
+ ## When a skill says "fetch the relevant ticket"
33
+
34
+ Run `gh issue view <number> --comments`.
35
+
36
+ ## Wayfinding operations
37
+
38
+ Used by [wayfinder](wayfinder.md). The **map** is a single issue with **child** issues as tickets.
39
+
40
+ - **Map**: a single issue labelled `wayfinder:map`, holding the Notes / Decisions-so-far / Fog body. `gh issue create --label wayfinder:map`.
41
+ - **Child ticket**: an issue linked to the map as a GitHub sub-issue (`gh api` on the sub-issues endpoint). Where sub-issues aren't enabled, add the child to a task list in the map body and put `Part of #<map>` at the top of the child body. Labels: `wayfinder:<type>` (`research`/`prototype`/`grilling`/`task`). Once claimed, the ticket is assigned to the driving dev.
42
+ - **Blocking**: GitHub's **native issue dependencies** — the canonical, UI-visible representation. Add an edge with `gh api --method POST repos/<owner>/<repo>/issues/<child>/dependencies/blocked_by -F issue_id=<blocker-db-id>`, where `<blocker-db-id>` is the blocker's numeric **database id** (`gh api repos/<owner>/<repo>/issues/<n> --jq .id`, _not_ the `#number` or `node_id`). GitHub reports `issue_dependencies_summary.blocked_by` (open blockers only — the live gate). Where dependencies aren't available, fall back to a `Blocked by: #<n>, #<n>` line at the top of the child body. A ticket is unblocked when every blocker is closed.
43
+ - **Frontier query**: list the map's open children (`gh issue list --state open`, scoped to the map's sub-issues / task list), drop any with an open blocker (`issue_dependencies_summary.blocked_by > 0`, or an open issue in the `Blocked by` line) or an assignee; first in map order wins.
44
+ - **Claim**: `gh issue edit <n> --add-assignee @me` — the session's first write.
45
+ - **Resolve**: `gh issue comment <n> --body "<answer>"`, then `gh issue close <n>`, then append a context pointer (gist + link) to the map's Decisions-so-far.
@@ -0,0 +1,46 @@
1
+ # Issue tracker: GitLab
2
+
3
+ Issues and PRDs for this repo live as GitLab issues. Use the [`glab`](https://gitlab.com/gitlab-org/cli) CLI for all operations.
4
+
5
+ ## Conventions
6
+
7
+ - **Create an issue**: `glab issue create --title "..." --description "..."`. Use a heredoc for multi-line descriptions. Pass `--description -` to open an editor.
8
+ - **Read an issue**: `glab issue view <number> --comments`. Use `-F json` for machine-readable output.
9
+ - **List issues**: `glab issue list -F json` with appropriate `--label` filters.
10
+ - **Comment on an issue**: `glab issue note <number> --message "..."`. GitLab calls comments "notes".
11
+ - **Apply / remove labels**: `glab issue update <number> --label "..."` / `--unlabel "..."`. Multiple labels can be comma-separated or by repeating the flag.
12
+ - **Close**: `glab issue close <number>`. `glab issue close` does not accept a closing comment, so post the explanation first with `glab issue note <number> --message "..."`, then close.
13
+ - **Merge requests**: GitLab calls PRs "merge requests". Use `glab mr create`, `glab mr view`, `glab mr note`, etc. — the same shape as `gh pr ...` with `mr` in place of `pr` and `note`/`--message` in place of `comment`/`--body`.
14
+
15
+ Infer the repo from `git remote -v` — `glab` does this automatically when run inside a clone.
16
+
17
+ ## Merge requests as a triage surface
18
+
19
+ **MRs as a request surface: no.** _(Set to `yes` if this repo treats external merge requests as feature requests; [triage](triage.md) reads this flag.)_
20
+
21
+ When set to `yes`, MRs run through the same labels and states as issues, using the `glab mr` equivalents:
22
+
23
+ - **Read an MR**: `glab mr view <number> --comments` and `glab mr diff <number>` for the diff.
24
+ - **List external MRs for triage**: `glab mr list -F json`, then keep only MRs whose author is not a project member/owner (a contributor's MR, not a maintainer's in-flight work).
25
+ - **Comment / label / close**: `glab mr note`, `glab mr update --label`/`--unlabel`, `glab mr close`.
26
+
27
+ Unlike GitHub, GitLab numbers issues and MRs separately, so `#42` is unambiguous once you know which surface the maintainer means.
28
+
29
+ ## When a skill says "publish to the issue tracker"
30
+
31
+ Create a GitLab issue.
32
+
33
+ ## When a skill says "fetch the relevant ticket"
34
+
35
+ Run `glab issue view <number> --comments`.
36
+
37
+ ## Wayfinding operations
38
+
39
+ Used by [wayfinder](wayfinder.md). The **map** is a single issue with **child** issues as tickets.
40
+
41
+ - **Map**: a single issue labelled `wayfinder:map`, holding the Notes / Decisions-so-far / Fog body. `glab issue create --label wayfinder:map`. (On GitLab tiers with native epics, an epic may hold the map instead; a labelled issue works everywhere.)
42
+ - **Child ticket**: an issue carrying `Part of #<map>` at the top of its description and labels `wayfinder:<type>` (`research`/`prototype`/`grilling`/`task`). Once claimed, the ticket is assigned to the driving dev.
43
+ - **Blocking**: GitLab's **native blocking link** — the canonical, UI-visible representation. Add it with the `/blocked_by #<n>` quick action, posted as a note (`glab issue note <child> --message "/blocked_by #<blocker>"`). Native blocking links are a Premium/Ultimate feature; on the free tier (or where unavailable) fall back to a `Blocked by: #<n>, #<n>` line at the top of the description. A ticket is unblocked when every blocker is closed.
44
+ - **Frontier query**: `glab issue list -F json` scoped to the map's children, drop any with an open blocker — a native `blocked_by` link to an open issue (`glab api projects/:id/issues/:iid/links`), or an open issue in the `Blocked by` line — or an assignee; first in map order wins.
45
+ - **Claim**: `glab issue update <n> --assignee @me` — the session's first write.
46
+ - **Resolve**: `glab issue note <n> --message "<answer>"`, then `glab issue close <n>`, then append a context pointer (gist + link) to the map's Decisions-so-far.