melkholy commited on
Commit
c1fa0b4
Β·
verified Β·
1 Parent(s): 8b341cb

feat: single-image Hugging Face Spaces deployment with rate limiting

Browse files
This view is limited to 50 files because it contains too many changes. Β  See raw diff
Files changed (50) hide show
  1. .agents/skills/ask-matt/SKILL.md +70 -0
  2. .agents/skills/code-review/SKILL.md +87 -0
  3. .agents/skills/codebase-design/DEEPENING.md +37 -0
  4. .agents/skills/codebase-design/DESIGN-IT-TWICE.md +44 -0
  5. .agents/skills/codebase-design/SKILL.md +112 -0
  6. .agents/skills/design-an-interface/SKILL.md +92 -0
  7. .agents/skills/diagnosing-bugs/SKILL.md +132 -0
  8. .agents/skills/diagnosing-bugs/scripts/hitl-loop.template.sh +41 -0
  9. .agents/skills/domain-modeling/ADR-FORMAT.md +47 -0
  10. .agents/skills/domain-modeling/CONTEXT-FORMAT.md +60 -0
  11. .agents/skills/domain-modeling/SKILL.md +72 -0
  12. .agents/skills/edit-article/SKILL.md +12 -0
  13. .agents/skills/git-guardrails-claude-code/SKILL.md +93 -0
  14. .agents/skills/git-guardrails-claude-code/scripts/block-dangerous-git.sh +25 -0
  15. .agents/skills/grill-me/SKILL.md +4 -0
  16. .agents/skills/grill-with-docs/SKILL.md +4 -0
  17. .agents/skills/grilling/SKILL.md +8 -0
  18. .agents/skills/handoff/SKILL.md +12 -0
  19. .agents/skills/implement/SKILL.md +12 -0
  20. .agents/skills/improve-codebase-architecture/HTML-REPORT.md +123 -0
  21. .agents/skills/improve-codebase-architecture/SKILL.md +63 -0
  22. .agents/skills/loop-me/SKILL.md +28 -0
  23. .agents/skills/migrate-to-shoehorn/SKILL.md +116 -0
  24. .agents/skills/obsidian-vault/SKILL.md +57 -0
  25. .agents/skills/prototype/LOGIC.md +79 -0
  26. .agents/skills/prototype/SKILL.md +28 -0
  27. .agents/skills/prototype/UI.md +112 -0
  28. .agents/skills/qa/SKILL.md +128 -0
  29. .agents/skills/request-refactor-plan/SKILL.md +66 -0
  30. .agents/skills/resolving-merge-conflicts/SKILL.md +12 -0
  31. .agents/skills/scaffold-exercises/SKILL.md +104 -0
  32. .agents/skills/setup-matt-pocock-skills/SKILL.md +124 -0
  33. .agents/skills/setup-matt-pocock-skills/domain.md +51 -0
  34. .agents/skills/setup-matt-pocock-skills/issue-tracker-github.md +34 -0
  35. .agents/skills/setup-matt-pocock-skills/issue-tracker-gitlab.md +35 -0
  36. .agents/skills/setup-matt-pocock-skills/issue-tracker-local.md +19 -0
  37. .agents/skills/setup-matt-pocock-skills/triage-labels.md +15 -0
  38. .agents/skills/setup-pre-commit/SKILL.md +89 -0
  39. .agents/skills/tdd/SKILL.md +34 -0
  40. .agents/skills/tdd/mocking.md +59 -0
  41. .agents/skills/tdd/tests.md +77 -0
  42. .agents/skills/teach/GLOSSARY-FORMAT.md +35 -0
  43. .agents/skills/teach/LEARNING-RECORD-FORMAT.md +46 -0
  44. .agents/skills/teach/MISSION-FORMAT.md +31 -0
  45. .agents/skills/teach/RESOURCES-FORMAT.md +32 -0
  46. .agents/skills/teach/SKILL.md +136 -0
  47. .agents/skills/to-issues/SKILL.md +81 -0
  48. .agents/skills/to-prd/SKILL.md +72 -0
  49. .agents/skills/triage/AGENT-BRIEF.md +207 -0
  50. .agents/skills/triage/OUT-OF-SCOPE.md +105 -0
.agents/skills/ask-matt/SKILL.md ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ description: "Ask which skill or flow fits your situation. A router over the skills in this repo."
3
+ ---
4
+ # Ask Matt
5
+
6
+ You don't remember every skill, so ask.
7
+
8
+ A **flow** is a path through the skills. Most paths run along one **main flow**, and two **on-ramps** merge onto it. Everything else is standalone, or a vocabulary layer that runs underneath.
9
+
10
+ ## The main flow: idea β†’ ship
11
+
12
+ The route most work travels. You have an idea and want it built.
13
+
14
+ 1. **`/grill-with-docs`** β€” sharpen the idea by interview. Start here when you **have a codebase**: it's stateful, retaining what it learns in `CONTEXT.md` and ADRs. (No codebase? Use `/grill-me` β€” see Standalone. Both run the same `/grilling` primitive; `grill-with-docs` is the one that leaves a paper trail.)
15
+ 2. **Branch β€” can you settle every question in conversation?** If a question needs a runnable answer (state, business logic, a UI you have to see), detour through a prototype, bridged by **`/handoff`** in both directions (see Crossing sessions):
16
+ - **`/handoff`** out, then open a fresh session against that file,
17
+ - **`/prototype`** to answer the question with throwaway code,
18
+ - **`/handoff`** back what you learned, and reference it from the original idea thread.
19
+ 3. **Branch β€” is this a multi-session build?**
20
+ - **Yes** β†’ **`/to-prd`** (turn the thread into a PRD) β†’ **`/to-issues`** (split the PRD into independently-grabbable issues). Because the issues are independent, **clear context between each one**: start a fresh session per issue and kick off **`/implement`** by passing it the PRD and the single issue to work on.
21
+ - **No** β†’ **`/implement`** right here, in the same context window.
22
+
23
+ Either way, **`/implement`** builds each issue by driving **`/tdd`** internally β€” one red-green slice at a time β€” then closes out by running **`/code-review`**, a two-axis review (Standards + Spec) of the diff, before committing. Reach for **`/tdd`** on its own when you just want to build a concrete behaviour test-first without a full spec, and **`/code-review`** on its own whenever you want to review a branch or PR against a fixed point.
24
+
25
+ ### Context hygiene
26
+
27
+ Keep steps 1–3 in **one unbroken context window** β€” don't compact or clear until after `/to-issues` β€” so the grilling, PRD, and issues all build on the same thinking. Each `/implement` then starts fresh, working from the issue.
28
+
29
+ The limit on this is the **[smart zone](https://www.aihero.dev/ai-coding-dictionary/smart-zone)**: the window (~120k tokens on state-of-the-art models) within which the model still reasons sharply. If a session approaches it before `/to-issues`, don't push on degraded β€” `/handoff` and continue in a fresh thread.
30
+
31
+ ## On-ramps
32
+
33
+ A starting situation that generates work, then merges onto the main flow.
34
+
35
+ - **Bugs and requests piling up** β†’ **`/triage`**. It moves issues through triage roles and produces agent-ready issues, which **`/implement`** later picks up.
36
+
37
+ Triage is only for issues **you didn't create** β€” bug reports, incoming feature requests, anything that arrives raw. Issues that `/to-issues` produced are already agent-ready, so **don't triage them**.
38
+
39
+ - **Something's broken** β†’ **`/diagnosing-bugs`**. For the hard ones: the bug that resists a first glance, the intermittent flake, the regression that crept in between two known-good states. It refuses to theorise until it has a **tight feedback loop** β€” one command that already goes red on *this* bug β€” then fixes with a regression test. Its post-mortem hands off to **`/improve-codebase-architecture`** when the real finding is that there's no good seam to lock the bug down.
40
+
41
+ ## Codebase health
42
+
43
+ Not feature work β€” upkeep.
44
+
45
+ - **`/improve-codebase-architecture`** β€” run whenever you have a spare moment to keep the codebase good for agents to operate in. It surfaces **deepening opportunities**; picking one _generates an idea_ you can take into the main flow at `/grill-with-docs`. It's the survey that finds the candidates; **`/codebase-design`** (below) is the bench you design the chosen one on.
46
+
47
+ ## Vocabulary underneath
48
+
49
+ Two model-invoked references that run *beneath* the other skills β€” each the single source of truth for its vocabulary. Reach for them directly when the **words**, not the process, are the problem; or let the skills above pull them in.
50
+
51
+ - **`/domain-modeling`** β€” sharpen the project's *domain* language: challenge a fuzzy term, resolve an overloaded word ("account" doing three jobs), record a hard-to-reverse decision as an ADR. It's the active discipline `/grill-with-docs` drives to keep `CONTEXT.md` a clean glossary.
52
+ - **`/codebase-design`** β€” the deep-module vocabulary (module, interface, depth, seam, adapter, leverage, locality) for designing a module's *shape*: a lot of behaviour behind a small interface at a clean seam. `/tdd` and `/improve-codebase-architecture` both speak it.
53
+
54
+ ## Crossing sessions
55
+
56
+ - **`/handoff`** β€” when a thread is full or you need to branch off (e.g. into a `/prototype` session), this compacts the conversation into a markdown file. You don't continue in place β€” you **open a new session and reference that file** to carry the context across. It's the bridge between context windows, in either direction. Use it when you want a **fresh session** but need the **current conversation preserved**.
57
+ - **`/compact`** (built-in) β€” stay in the **same conversation**, letting the earlier turns be summarized. Use it at **intentional breaks between phases**, when you don't mind losing the verbatim history. Don't compact mid-phase β€” the agent can lose its way. `/handoff` forks; `/compact` continues.
58
+
59
+ ## Standalone
60
+
61
+ Off the main flow entirely.
62
+
63
+ - **`/grill-me`** β€” the same relentless interview as `/grill-with-docs`, but for when you have **no codebase**. Stateless: it saves nothing locally, builds no `CONTEXT.md`. Reach for it to sharpen any plan or design that doesn't live in a repo.
64
+ - **`/prototype`** β€” a small, throwaway program that answers one design question: does this state model feel right, or what should this UI look like. Throwaway from day one β€” keep the answer, delete the code. It's the detour in step 2 of the main flow, but reach for it any time a design question is hard to settle on paper.
65
+ - **`/teach`** β€” learn a concept over multiple sessions, using the current directory as a stateful workspace.
66
+ - **`/writing-great-skills`** β€” reference for writing and editing skills well.
67
+
68
+ ## Precondition
69
+
70
+ **`/setup-matt-pocock-skills`** β€” run before your first engineering flow to configure the issue tracker, triage labels, and doc layout the other skills assume. Custom issue trackers also work.
.agents/skills/code-review/SKILL.md ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ description: "Review the changes since a fixed point (commit, branch, tag, or merge-base) along two axes β€” Standards (does the code follow this repo's documented coding standards?) and Spec (does the code match what the originating issue/PRD asked for?). Runs both reviews in parallel sub-agents and reports them side by side. Use when the user wants to review a branch, a PR, work-in-progress changes, or asks to \"review since X\"."
3
+ ---
4
+ Two-axis review of the diff between `HEAD` and a fixed point the user supplies:
5
+
6
+ - **Standards** β€” does the code conform to this repo's documented coding standards?
7
+ - **Spec** β€” does the code faithfully implement the originating issue / PRD / spec?
8
+
9
+ Both axes run as **parallel sub-agents** so they don't pollute each other's context, then this skill aggregates their findings.
10
+
11
+ The issue tracker should have been provided to you β€” run `/setup-matt-pocock-skills` if `docs/agents/issue-tracker.md` is missing.
12
+
13
+ ## Process
14
+
15
+ ### 1. Pin the fixed point
16
+
17
+ Whatever the user said is the fixed point β€” a commit SHA, branch name, tag, `main`, `HEAD~5`, etc. If they didn't specify one, ask for it.
18
+
19
+ Capture the diff command once: `git diff <fixed-point>...HEAD` (three-dot, so the comparison is against the merge-base). Also note the list of commits via `git log <fixed-point>..HEAD --oneline`.
20
+
21
+ Before going further, confirm the fixed point resolves (`git rev-parse <fixed-point>`) and the diff is non-empty. A bad ref or empty diff should fail here β€” not inside two parallel sub-agents.
22
+
23
+ ### 2. Identify the spec source
24
+
25
+ Look for the originating spec, in this order:
26
+
27
+ 1. Issue references in the commit messages (`#123`, `Closes #45`, GitLab `!67`, etc.) β€” fetch via the workflow in `docs/agents/issue-tracker.md`.
28
+ 2. A path the user passed as an argument.
29
+ 3. A PRD/spec file under `docs/`, `specs/`, or `.scratch/` matching the branch name or feature.
30
+ 4. If nothing is found, ask the user where the spec is. If they say there isn't one, the **Spec** sub-agent will skip and report "no spec available".
31
+
32
+ ### 3. Identify the standards sources
33
+
34
+ Anything in the repo that documents how code should be written, such as `CODING_STANDARDS.md` or `CONTRIBUTING.md`.
35
+
36
+ On top of whatever the repo documents, the Standards axis always carries the **smell baseline** below β€” a fixed set of Fowler code smells (_Refactoring_, ch.3) that applies even when a repo documents nothing. Two rules bind it:
37
+
38
+ - **The repo overrides.** A documented repo standard always wins; where it endorses something the baseline would flag, suppress the smell.
39
+ - **Always a judgement call.** Each smell is a labelled heuristic ("possible Feature Envy"), never a hard violation β€” and, like any standard here, skip anything tooling already enforces.
40
+
41
+ Each smell reads *what it is* β†’ *how to fix*; match it against the diff:
42
+
43
+ - **Mysterious Name** β€” a function, variable, or type whose name doesn't reveal what it does or holds. β†’ rename it; if no honest name comes, the design's murky.
44
+ - **Duplicated Code** β€” the same logic shape appears in more than one hunk or file in the change. β†’ extract the shared shape, call it from both.
45
+ - **Feature Envy** β€” a method that reaches into another object's data more than its own. β†’ move the method onto the data it envies.
46
+ - **Data Clumps** β€” the same few fields or params keep travelling together (a type wanting to be born). β†’ bundle them into one type, pass that.
47
+ - **Primitive Obsession** β€” a primitive or string standing in for a domain concept that deserves its own type. β†’ give the concept its own small type.
48
+ - **Repeated Switches** β€” the same `switch`/`if`-cascade on the same type recurs across the change. β†’ replace with polymorphism, or one map both sites share.
49
+ - **Shotgun Surgery** β€” one logical change forces scattered edits across many files in the diff. β†’ gather what changes together into one module.
50
+ - **Divergent Change** β€” one file or module is edited for several unrelated reasons. β†’ split so each module changes for one reason.
51
+ - **Speculative Generality** β€” abstraction, parameters, or hooks added for needs the spec doesn't have. β†’ delete it; inline back until a real need shows.
52
+ - **Message Chains** β€” long `a.b().c().d()` navigation the caller shouldn't depend on. β†’ hide the walk behind one method on the first object.
53
+ - **Middle Man** β€” a class or function that mostly just delegates onward. β†’ cut it, call the real target direct.
54
+ - **Refused Bequest** β€” a subclass or implementer that ignores or overrides most of what it inherits. β†’ drop the inheritance, use composition.
55
+
56
+ ### 4. Spawn both sub-agents in parallel
57
+
58
+ Send a single message with two `Agent` tool calls. Use the `general-purpose` subagent for both.
59
+
60
+ **Standards sub-agent prompt** β€” include:
61
+
62
+ - The full diff command and commit list.
63
+ - The list of standards-source files you found in step 3, **plus the smell baseline from step 3** pasted in full β€” the sub-agent has no other access to it.
64
+ - The brief: "Report β€” per file/hunk where relevant β€” (a) every place the diff violates a documented standard: cite the standard (file + the rule); and (b) any baseline smell you spot: name it and quote the hunk. Distinguish hard violations from judgement calls β€” documented-standard breaches can be hard, but baseline smells are always judgement calls, and a documented repo standard overrides the baseline. Skip anything tooling enforces. Under 400 words."
65
+
66
+ **Spec sub-agent prompt** β€” include:
67
+
68
+ - The diff command and commit list.
69
+ - The path or fetched contents of the spec.
70
+ - The brief: "Report: (a) requirements the spec asked for that are missing or partial; (b) behaviour in the diff that wasn't asked for (scope creep); (c) requirements that look implemented but where the implementation looks wrong. Quote the spec line for each finding. Under 400 words."
71
+
72
+ If the spec is missing, skip the Spec sub-agent and note this in the final report.
73
+
74
+ ### 5. Aggregate
75
+
76
+ Present the two reports under `## Standards` and `## Spec` headings, verbatim or lightly cleaned. Do **not** merge or rerank findings β€” the two axes are deliberately separate (see _Why two axes_).
77
+
78
+ End with a one-line summary: total findings per axis, and the worst issue _within each axis_ (if any). Don't pick a single winner across axes β€” that's the reranking the separation exists to prevent.
79
+
80
+ ## Why two axes
81
+
82
+ A change can pass one axis and fail the other:
83
+
84
+ - Code that follows every standard but implements the wrong thing β†’ **Standards pass, Spec fail.**
85
+ - Code that does exactly what the issue asked but breaks the project's conventions β†’ **Spec pass, Standards fail.**
86
+
87
+ Reporting them separately stops one axis from masking the other.
.agents/skills/codebase-design/DEEPENING.md ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Deepening
2
+
3
+ How to deepen a cluster of shallow modules safely, given its dependencies. Assumes the vocabulary in [SKILL.md](SKILL.md) β€” **module**, **interface**, **seam**, **adapter**.
4
+
5
+ ## Dependency categories
6
+
7
+ When assessing a candidate for deepening, classify its dependencies. The category determines how the deepened module is tested across its seam.
8
+
9
+ ### 1. In-process
10
+
11
+ Pure computation, in-memory state, no I/O. Always deepenable β€” merge the modules and test through the new interface directly. No adapter needed.
12
+
13
+ ### 2. Local-substitutable
14
+
15
+ Dependencies that have local test stand-ins (PGLite for Postgres, in-memory filesystem). Deepenable if the stand-in exists. The deepened module is tested with the stand-in running in the test suite. The seam is internal; no port at the module's external interface.
16
+
17
+ ### 3. Remote but owned (Ports & Adapters)
18
+
19
+ Your own services across a network boundary (microservices, internal APIs). Define a **port** (interface) at the seam. The deep module owns the logic; the transport is injected as an **adapter**. Tests use an in-memory adapter. Production uses an HTTP/gRPC/queue adapter.
20
+
21
+ Recommendation shape: *"Define a port at the seam, implement an HTTP adapter for production and an in-memory adapter for testing, so the logic sits in one deep module even though it's deployed across a network."*
22
+
23
+ ### 4. True external (Mock)
24
+
25
+ Third-party services (Stripe, Twilio, etc.) you don't control. The deepened module takes the external dependency as an injected port; tests provide a mock adapter.
26
+
27
+ ## Seam discipline
28
+
29
+ - **One adapter means a hypothetical seam. Two adapters means a real one.** Don't introduce a port unless at least two adapters are justified (typically production + test). A single-adapter seam is just indirection.
30
+ - **Internal seams vs external seams.** A deep module can have internal seams (private to its implementation, used by its own tests) as well as the external seam at its interface. Don't expose internal seams through the interface just because tests use them.
31
+
32
+ ## Testing strategy: replace, don't layer
33
+
34
+ - Old unit tests on shallow modules become waste once tests at the deepened module's interface exist β€” delete them.
35
+ - Write new tests at the deepened module's interface. The **interface is the test surface**.
36
+ - Tests assert on observable outcomes through the interface, not internal state.
37
+ - Tests should survive internal refactors β€” they describe behaviour, not implementation. If a test has to change when the implementation changes, it's testing past the interface.
.agents/skills/codebase-design/DESIGN-IT-TWICE.md ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Design It Twice
2
+
3
+ When the user wants to explore alternative interfaces for a chosen deepening candidate, use this parallel sub-agent pattern. Based on "Design It Twice" (Ousterhout) β€” your first idea is unlikely to be the best.
4
+
5
+ Uses the vocabulary in [SKILL.md](SKILL.md) β€” **module**, **interface**, **seam**, **adapter**, **leverage**.
6
+
7
+ ## Process
8
+
9
+ ### 1. Frame the problem space
10
+
11
+ Before spawning sub-agents, write a user-facing explanation of the problem space for the chosen candidate:
12
+
13
+ - The constraints any new interface would need to satisfy
14
+ - The dependencies it would rely on, and which category they fall into (see [DEEPENING.md](DEEPENING.md))
15
+ - A rough illustrative code sketch to ground the constraints β€” not a proposal, just a way to make the constraints concrete
16
+
17
+ Show this to the user, then immediately proceed to Step 2. The user reads and thinks while the sub-agents work in parallel.
18
+
19
+ ### 2. Spawn sub-agents
20
+
21
+ Spawn 3+ sub-agents in parallel using the Agent tool. Each must produce a **radically different** interface for the deepened module.
22
+
23
+ Prompt each sub-agent with a separate technical brief (file paths, coupling details, dependency category from [DEEPENING.md](DEEPENING.md), what sits behind the seam). The brief is independent of the user-facing problem-space explanation in Step 1. Give each agent a different design constraint:
24
+
25
+ - Agent 1: "Minimize the interface β€” aim for 1–3 entry points max. Maximise leverage per entry point."
26
+ - Agent 2: "Maximise flexibility β€” support many use cases and extension."
27
+ - Agent 3: "Optimise for the most common caller β€” make the default case trivial."
28
+ - Agent 4 (if applicable): "Design around ports & adapters for cross-seam dependencies."
29
+
30
+ Include both [SKILL.md](SKILL.md) vocabulary and CONTEXT.md vocabulary in the brief so each sub-agent names things consistently with the architecture language and the project's domain language.
31
+
32
+ Each sub-agent outputs:
33
+
34
+ 1. Interface (types, methods, params β€” plus invariants, ordering, error modes)
35
+ 2. Usage example showing how callers use it
36
+ 3. What the implementation hides behind the seam
37
+ 4. Dependency strategy and adapters (see [DEEPENING.md](DEEPENING.md))
38
+ 5. Trade-offs β€” where leverage is high, where it's thin
39
+
40
+ ### 3. Present and compare
41
+
42
+ Present designs sequentially so the user can absorb each one, then compare them in prose. Contrast by **depth** (leverage at the interface), **locality** (where change concentrates), and **seam placement**.
43
+
44
+ After comparing, give your own recommendation: which design you think is strongest and why. If elements from different designs would combine well, propose a hybrid. Be opinionated β€” the user wants a strong read, not a menu.
.agents/skills/codebase-design/SKILL.md ADDED
@@ -0,0 +1,112 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ description: "Shared vocabulary for designing deep modules. Use when the user wants to design or improve a module's interface, find deepening opportunities, decide where a seam goes, make code more testable or AI-navigable, or when another skill needs the deep-module vocabulary."
3
+ ---
4
+ # Codebase Design
5
+
6
+ Design **deep modules**: a lot of behaviour behind a small interface, placed at a clean seam, testable through that interface. Use this language and these principles wherever code is being designed or restructured. The aim is leverage for callers, locality for maintainers, and testability for everyone.
7
+
8
+ ## Glossary
9
+
10
+ Use these terms exactly β€” don't substitute "component," "service," "API," or "boundary." Consistent language is the whole point.
11
+
12
+ **Module** β€” anything with an interface and an implementation. Deliberately scale-agnostic: a function, class, package, or tier-spanning slice. _Avoid_: unit, component, service.
13
+
14
+ **Interface** β€” everything a caller must know to use the module correctly: the type signature, but also invariants, ordering constraints, error modes, required configuration, and performance characteristics. _Avoid_: API, signature (too narrow β€” they refer only to the type-level surface).
15
+
16
+ **Implementation** β€” what's inside a module, its body of code. Distinct from **Adapter**: a thing can be a small adapter with a large implementation (a Postgres repo) or a large adapter with a small implementation (an in-memory fake). Reach for "adapter" when the seam is the topic; "implementation" otherwise.
17
+
18
+ **Depth** β€” leverage at the interface: the amount of behaviour a caller (or test) can exercise per unit of interface they have to learn. A module is **deep** when a large amount of behaviour sits behind a small interface, **shallow** when the interface is nearly as complex as the implementation.
19
+
20
+ **Seam** _(Michael Feathers)_ β€” a place where you can alter behaviour without editing in that place; the *location* at which a module's interface lives. Where to put the seam is its own design decision, distinct from what goes behind it. _Avoid_: boundary (overloaded with DDD's bounded context).
21
+
22
+ **Adapter** β€” a concrete thing that satisfies an interface at a seam. Describes *role* (what slot it fills), not substance (what's inside).
23
+
24
+ **Leverage** β€” what callers get from depth: more capability per unit of interface they learn. One implementation pays back across N call sites and M tests.
25
+
26
+ **Locality** β€” what maintainers get from depth: change, bugs, knowledge, and verification concentrate in one place rather than spreading across callers. Fix once, fixed everywhere.
27
+
28
+ ## Deep vs shallow
29
+
30
+ **Deep module** = small interface + lots of implementation:
31
+
32
+ ```
33
+ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
34
+ β”‚ Small Interface β”‚ ← Few methods, simple params
35
+ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
36
+ β”‚ β”‚
37
+ β”‚ Deep Implementationβ”‚ ← Complex logic hidden
38
+ β”‚ β”‚
39
+ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
40
+ ```
41
+
42
+ **Shallow module** = large interface + little implementation (avoid):
43
+
44
+ ```
45
+ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
46
+ β”‚ Large Interface β”‚ ← Many methods, complex params
47
+ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
48
+ β”‚ Thin Implementation β”‚ ← Just passes through
49
+ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
50
+ ```
51
+
52
+ When designing an interface, ask:
53
+
54
+ - Can I reduce the number of methods?
55
+ - Can I simplify the parameters?
56
+ - Can I hide more complexity inside?
57
+
58
+ ## Principles
59
+
60
+ - **Depth is a property of the interface, not the implementation.** A deep module can be internally composed of small, mockable, swappable parts β€” they just aren't part of the interface. A module can have **internal seams** (private to its implementation, used by its own tests) as well as the **external seam** at its interface.
61
+ - **The deletion test.** Imagine deleting the module. If complexity vanishes, it was a pass-through. If complexity reappears across N callers, it was earning its keep.
62
+ - **The interface is the test surface.** Callers and tests cross the same seam. If you want to test *past* the interface, the module is probably the wrong shape.
63
+ - **One adapter means a hypothetical seam. Two adapters means a real one.** Don't introduce a seam unless something actually varies across it.
64
+
65
+ ## Designing for testability
66
+
67
+ Good interfaces make testing natural:
68
+
69
+ 1. **Accept dependencies, don't create them.**
70
+
71
+ ```typescript
72
+ // Testable
73
+ function processOrder(order, paymentGateway) {}
74
+
75
+ // Hard to test
76
+ function processOrder(order) {
77
+ const gateway = new StripeGateway();
78
+ }
79
+ ```
80
+
81
+ 2. **Return results, don't produce side effects.**
82
+
83
+ ```typescript
84
+ // Testable
85
+ function calculateDiscount(cart): Discount {}
86
+
87
+ // Hard to test
88
+ function applyDiscount(cart): void {
89
+ cart.total -= discount;
90
+ }
91
+ ```
92
+
93
+ 3. **Small surface area.** Fewer methods = fewer tests needed. Fewer params = simpler test setup.
94
+
95
+ ## Relationships
96
+
97
+ - A **Module** has exactly one **Interface** (the surface it presents to callers and tests).
98
+ - **Depth** is a property of a **Module**, measured against its **Interface**.
99
+ - A **Seam** is where a **Module**'s **Interface** lives.
100
+ - An **Adapter** sits at a **Seam** and satisfies the **Interface**.
101
+ - **Depth** produces **Leverage** for callers and **Locality** for maintainers.
102
+
103
+ ## Rejected framings
104
+
105
+ - **Depth as ratio of implementation-lines to interface-lines** (Ousterhout): rewards padding the implementation. We use depth-as-leverage instead.
106
+ - **"Interface" as the TypeScript `interface` keyword or a class's public methods**: too narrow β€” interface here includes every fact a caller must know.
107
+ - **"Boundary"**: overloaded with DDD's bounded context. Say **seam** or **interface**.
108
+
109
+ ## Going deeper
110
+
111
+ - **Deepening a cluster given its dependencies** β€” see [DEEPENING.md](DEEPENING.md): dependency categories, seam discipline, and replace-don't-layer testing.
112
+ - **Exploring alternative interfaces** β€” see [DESIGN-IT-TWICE.md](DESIGN-IT-TWICE.md): spin up parallel sub-agents to design the interface several radically different ways, then compare on depth, locality, and seam placement.
.agents/skills/design-an-interface/SKILL.md ADDED
@@ -0,0 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ description: "Generate multiple radically different interface designs for a module using parallel sub-agents. Use when user wants to design an API, explore interface options, compare module shapes, or mentions \"design it twice\"."
3
+ ---
4
+ # Design an Interface
5
+
6
+ Based on "Design It Twice" from "A Philosophy of Software Design": your first idea is unlikely to be the best. Generate multiple radically different designs, then compare.
7
+
8
+ ## Workflow
9
+
10
+ ### 1. Gather Requirements
11
+
12
+ Before designing, understand:
13
+
14
+ - [ ] What problem does this module solve?
15
+ - [ ] Who are the callers? (other modules, external users, tests)
16
+ - [ ] What are the key operations?
17
+ - [ ] Any constraints? (performance, compatibility, existing patterns)
18
+ - [ ] What should be hidden inside vs exposed?
19
+
20
+ Ask: "What does this module need to do? Who will use it?"
21
+
22
+ ### 2. Generate Designs (Parallel Sub-Agents)
23
+
24
+ Spawn 3+ sub-agents simultaneously using Task tool. Each must produce a **radically different** approach.
25
+
26
+ ```
27
+ Prompt template for each sub-agent:
28
+
29
+ Design an interface for: [module description]
30
+
31
+ Requirements: [gathered requirements]
32
+
33
+ Constraints for this design: [assign a different constraint to each agent]
34
+ - Agent 1: "Minimize method count - aim for 1-3 methods max"
35
+ - Agent 2: "Maximize flexibility - support many use cases"
36
+ - Agent 3: "Optimize for the most common case"
37
+ - Agent 4: "Take inspiration from [specific paradigm/library]"
38
+
39
+ Output format:
40
+ 1. Interface signature (types/methods)
41
+ 2. Usage example (how caller uses it)
42
+ 3. What this design hides internally
43
+ 4. Trade-offs of this approach
44
+ ```
45
+
46
+ ### 3. Present Designs
47
+
48
+ Show each design with:
49
+
50
+ 1. **Interface signature** - types, methods, params
51
+ 2. **Usage examples** - how callers actually use it in practice
52
+ 3. **What it hides** - complexity kept internal
53
+
54
+ Present designs sequentially so user can absorb each approach before comparison.
55
+
56
+ ### 4. Compare Designs
57
+
58
+ After showing all designs, compare them on:
59
+
60
+ - **Interface simplicity**: fewer methods, simpler params
61
+ - **General-purpose vs specialized**: flexibility vs focus
62
+ - **Implementation efficiency**: does shape allow efficient internals?
63
+ - **Depth**: small interface hiding significant complexity (good) vs large interface with thin implementation (bad)
64
+ - **Ease of correct use** vs **ease of misuse**
65
+
66
+ Discuss trade-offs in prose, not tables. Highlight where designs diverge most.
67
+
68
+ ### 5. Synthesize
69
+
70
+ Often the best design combines insights from multiple options. Ask:
71
+
72
+ - "Which design best fits your primary use case?"
73
+ - "Any elements from other designs worth incorporating?"
74
+
75
+ ## Evaluation Criteria
76
+
77
+ From "A Philosophy of Software Design":
78
+
79
+ **Interface simplicity**: Fewer methods, simpler params = easier to learn and use correctly.
80
+
81
+ **General-purpose**: Can handle future use cases without changes. But beware over-generalization.
82
+
83
+ **Implementation efficiency**: Does interface shape allow efficient implementation? Or force awkward internals?
84
+
85
+ **Depth**: Small interface hiding significant complexity = deep module (good). Large interface with thin implementation = shallow module (avoid).
86
+
87
+ ## Anti-Patterns
88
+
89
+ - Don't let sub-agents produce similar designs - enforce radical difference
90
+ - Don't skip comparison - the value is in contrast
91
+ - Don't implement - this is purely about interface shape
92
+ - Don't evaluate based on implementation effort
.agents/skills/diagnosing-bugs/SKILL.md ADDED
@@ -0,0 +1,132 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ description: "Diagnosis loop for hard bugs and performance regressions. Use when the user says \"diagnose\"/\"debug this\", or reports something broken/throwing/failing/slow."
3
+ ---
4
+ # Diagnosing Bugs
5
+
6
+ A discipline for hard bugs. Skip phases only when explicitly justified.
7
+
8
+ 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.
9
+
10
+ ## Phase 1 β€” Build a feedback loop
11
+
12
+ **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.
13
+
14
+ Spend disproportionate effort here. **Be aggressive. Be creative. Refuse to give up.**
15
+
16
+ ### Ways to construct one β€” try them in roughly this order
17
+
18
+ 1. **Failing test** at whatever seam reaches the bug β€” unit, integration, e2e.
19
+ 2. **Curl / HTTP script** against a running dev server.
20
+ 3. **CLI invocation** with a fixture input, diffing stdout against a known-good snapshot.
21
+ 4. **Headless browser script** (Playwright / Puppeteer) β€” drives the UI, asserts on DOM/console/network.
22
+ 5. **Replay a captured trace.** Save a real network request / payload / event log to disk; replay it through the code path in isolation.
23
+ 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.
24
+ 7. **Property / fuzz loop.** If the bug is "sometimes wrong output", run 1000 random inputs and look for the failure mode.
25
+ 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.
26
+ 9. **Differential loop.** Run the same input through old-version vs new-version (or two configs) and diff outputs.
27
+ 10. **HITL bash script.** Last resort. If a human must click, drive _them_ with `scripts/hitl-loop.template.sh` so the loop is still structured. Captured output feeds back to you.
28
+
29
+ Build the right feedback loop, and the bug is 90% fixed.
30
+
31
+ ### Tighten the loop
32
+
33
+ Treat the loop as a product. Once you have _a_ loop, **tighten** it:
34
+
35
+ - Can I make it faster? (Cache setup, skip unrelated init, narrow the test scope.)
36
+ - Can I make the signal sharper? (Assert on the specific symptom, not "didn't crash".)
37
+ - Can I make it more deterministic? (Pin time, seed RNG, isolate filesystem, freeze network.)
38
+
39
+ A 30-second flaky loop is barely better than no loop; a 2-second deterministic one is tight β€” a debugging superpower.
40
+
41
+ ### Non-deterministic bugs
42
+
43
+ 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.
44
+
45
+ ### When you genuinely cannot build a loop
46
+
47
+ Stop and say so explicitly. List what you tried. Ask the user for: (a) access to whatever environment reproduces it, (b) a captured artifact (HAR file, log dump, core dump, screen recording with timestamps), or (c) permission to add temporary production instrumentation. Do **not** proceed to hypothesise without a loop.
48
+
49
+ ### Completion criterion β€” a tight loop that goes red
50
+
51
+ 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** (paste the invocation and its output), and that is:
52
+
53
+ - [ ] **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_.
54
+ - [ ] **Deterministic** β€” same verdict every run (flaky bugs: a pinned, high reproduction rate, per above).
55
+ - [ ] **Fast** β€” seconds, not minutes.
56
+ - [ ] **Agent-runnable** β€” you can run it unattended; a human in the loop only via `scripts/hitl-loop.template.sh`.
57
+
58
+ 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.
59
+
60
+ ## Phase 2 β€” Reproduce + minimise
61
+
62
+ Run the loop. Watch it go red β€” the bug appears.
63
+
64
+ Confirm:
65
+
66
+ - [ ] The loop produces the failure mode the **user** described β€” not a different failure that happens to be nearby. Wrong bug = wrong fix.
67
+ - [ ] The failure is reproducible across multiple runs (or, for non-deterministic bugs, reproducible at a high enough rate to debug against).
68
+ - [ ] You have captured the exact symptom (error message, wrong output, slow timing) so later phases can verify the fix actually addresses it.
69
+
70
+ ### Minimise
71
+
72
+ 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.
73
+
74
+ 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.
75
+
76
+ Done when **every remaining element is load-bearing** β€” removing any one of them makes the loop go green.
77
+
78
+ Do not proceed until you have reproduced **and** minimised.
79
+
80
+ ## Phase 3 β€” Hypothesise
81
+
82
+ Generate **3–5 ranked hypotheses** before testing any of them. Single-hypothesis generation anchors on the first plausible idea.
83
+
84
+ Each hypothesis must be **falsifiable**: state the prediction it makes.
85
+
86
+ > Format: "If <X> is the cause, then <changing Y> will make the bug disappear / <changing Z> will make it worse."
87
+
88
+ If you cannot state the prediction, the hypothesis is a vibe β€” discard or sharpen it.
89
+
90
+ **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.
91
+
92
+ ## Phase 4 β€” Instrument
93
+
94
+ Each probe must map to a specific prediction from Phase 3. **Change one variable at a time.**
95
+
96
+ Tool preference:
97
+
98
+ 1. **Debugger / REPL inspection** if the env supports it. One breakpoint beats ten logs.
99
+ 2. **Targeted logs** at the boundaries that distinguish hypotheses.
100
+ 3. Never "log everything and grep".
101
+
102
+ **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.
103
+
104
+ **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.
105
+
106
+ ## Phase 5 β€” Fix + regression test
107
+
108
+ Write the regression test **before the fix** β€” but only if there is a **correct seam** for it.
109
+
110
+ 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.
111
+
112
+ **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.
113
+
114
+ If a correct seam exists:
115
+
116
+ 1. Turn the minimised repro into a failing test at that seam.
117
+ 2. Watch it fail.
118
+ 3. Apply the fix.
119
+ 4. Watch it pass.
120
+ 5. Re-run the Phase 1 feedback loop against the original (un-minimised) scenario.
121
+
122
+ ## Phase 6 β€” Cleanup + post-mortem
123
+
124
+ Required before declaring done:
125
+
126
+ - [ ] Original repro no longer reproduces (re-run the Phase 1 loop)
127
+ - [ ] Regression test passes (or absence of seam is documented)
128
+ - [ ] All `[DEBUG-...]` instrumentation removed (`grep` the prefix)
129
+ - [ ] Throwaway prototypes deleted (or moved to a clearly-marked debug location)
130
+ - [ ] The hypothesis that turned out correct is stated in the commit / PR message β€” so the next debugger learns
131
+
132
+ **Then ask: what would have prevented this bug?** If the answer involves architectural change (no good test seam, tangled callers, hidden coupling) hand off to the `/improve-codebase-architecture` skill with the specifics. Make the recommendation **after** the fix is in, not before β€” you have more information now than when you started.
.agents/skills/diagnosing-bugs/scripts/hitl-loop.template.sh ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ set -euo pipefail
16
+
17
+ step() {
18
+ printf '\n>>> %s\n' "$1"
19
+ read -r -p " [Enter when done] " _
20
+ }
21
+
22
+ capture() {
23
+ local var="$1" question="$2" answer
24
+ printf '\n>>> %s\n' "$question"
25
+ read -r -p " > " answer
26
+ printf -v "$var" '%s' "$answer"
27
+ }
28
+
29
+ # --- edit below ---------------------------------------------------------
30
+
31
+ step "Open the app at http://localhost:3000 and sign in."
32
+
33
+ capture ERRORED "Click the 'Export' button. Did it throw an error? (y/n)"
34
+
35
+ capture ERROR_MSG "Paste the error message (or 'none'):"
36
+
37
+ # --- edit above ---------------------------------------------------------
38
+
39
+ printf '\n--- Captured ---\n'
40
+ printf 'ERRORED=%s\n' "$ERRORED"
41
+ printf 'ERROR_MSG=%s\n' "$ERROR_MSG"
.agents/skills/domain-modeling/ADR-FORMAT.md ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ADR Format
2
+
3
+ ADRs live in `docs/adr/` and use sequential numbering: `0001-slug.md`, `0002-slug.md`, etc.
4
+
5
+ Create the `docs/adr/` directory lazily β€” only when the first ADR is needed.
6
+
7
+ ## Template
8
+
9
+ ```md
10
+ # {Short title of the decision}
11
+
12
+ {1-3 sentences: what's the context, what did we decide, and why.}
13
+ ```
14
+
15
+ That's it. An ADR can be a single paragraph. The value is in recording *that* a decision was made and *why* β€” not in filling out sections.
16
+
17
+ ## Optional sections
18
+
19
+ Only include these when they add genuine value. Most ADRs won't need them.
20
+
21
+ - **Status** frontmatter (`proposed | accepted | deprecated | superseded by ADR-NNNN`) β€” useful when decisions are revisited
22
+ - **Considered Options** β€” only when the rejected alternatives are worth remembering
23
+ - **Consequences** β€” only when non-obvious downstream effects need to be called out
24
+
25
+ ## Numbering
26
+
27
+ Scan `docs/adr/` for the highest existing number and increment by one.
28
+
29
+ ## When to offer an ADR
30
+
31
+ All three of these must be true:
32
+
33
+ 1. **Hard to reverse** β€” the cost of changing your mind later is meaningful
34
+ 2. **Surprising without context** β€” a future reader will look at the code and wonder "why on earth did they do it this way?"
35
+ 3. **The result of a real trade-off** β€” there were genuine alternatives and you picked one for specific reasons
36
+
37
+ If a decision is easy to reverse, skip it β€” you'll just reverse it. If it's not surprising, nobody will wonder why. If there was no real alternative, there's nothing to record beyond "we did the obvious thing."
38
+
39
+ ### What qualifies
40
+
41
+ - **Architectural shape.** "We're using a monorepo." "The write model is event-sourced, the read model is projected into Postgres."
42
+ - **Integration patterns between contexts.** "Ordering and Billing communicate via domain events, not synchronous HTTP."
43
+ - **Technology choices that carry lock-in.** Database, message bus, auth provider, deployment target. Not every library β€” just the ones that would take a quarter to swap out.
44
+ - **Boundary and scope decisions.** "Customer data is owned by the Customer context; other contexts reference it by ID only." The explicit no-s are as valuable as the yes-s.
45
+ - **Deliberate deviations from the obvious path.** "We're using manual SQL instead of an ORM because X." Anything where a reasonable reader would assume the opposite. These stop the next engineer from "fixing" something that was deliberate.
46
+ - **Constraints not visible in the code.** "We can't use AWS because of compliance requirements." "Response times must be under 200ms because of the partner API contract."
47
+ - **Rejected alternatives when the rejection is non-obvious.** If you considered GraphQL and picked REST for subtle reasons, record it β€” otherwise someone will suggest GraphQL again in six months.
.agents/skills/domain-modeling/CONTEXT-FORMAT.md ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # CONTEXT.md Format
2
+
3
+ ## Structure
4
+
5
+ ```md
6
+ # {Context Name}
7
+
8
+ {One or two sentence description of what this context is and why it exists.}
9
+
10
+ ## Language
11
+
12
+ **Order**:
13
+ {A one or two sentence description of the term}
14
+ _Avoid_: Purchase, transaction
15
+
16
+ **Invoice**:
17
+ A request for payment sent to a customer after delivery.
18
+ _Avoid_: Bill, payment request
19
+
20
+ **Customer**:
21
+ A person or organization that places orders.
22
+ _Avoid_: Client, buyer, account
23
+ ```
24
+
25
+ ## Rules
26
+
27
+ - **Be opinionated.** When multiple words exist for the same concept, pick the best one and list the others under `_Avoid_`.
28
+ - **Keep definitions tight.** One or two sentences max. Define what it IS, not what it does.
29
+ - **Only include terms specific to this project's context.** General programming concepts (timeouts, error types, utility patterns) don't belong even if the project uses them extensively. Before adding a term, ask: is this a concept unique to this context, or a general programming concept? Only the former belongs.
30
+ - **Group terms under subheadings** when natural clusters emerge. If all terms belong to a single cohesive area, a flat list is fine.
31
+
32
+ ## Single vs multi-context repos
33
+
34
+ **Single context (most repos):** One `CONTEXT.md` at the repo root.
35
+
36
+ **Multiple contexts:** A `CONTEXT-MAP.md` at the repo root lists the contexts, where they live, and how they relate to each other:
37
+
38
+ ```md
39
+ # Context Map
40
+
41
+ ## Contexts
42
+
43
+ - [Ordering](./src/ordering/CONTEXT.md) β€” receives and tracks customer orders
44
+ - [Billing](./src/billing/CONTEXT.md) β€” generates invoices and processes payments
45
+ - [Fulfillment](./src/fulfillment/CONTEXT.md) β€” manages warehouse picking and shipping
46
+
47
+ ## Relationships
48
+
49
+ - **Ordering β†’ Fulfillment**: Ordering emits `OrderPlaced` events; Fulfillment consumes them to start picking
50
+ - **Fulfillment β†’ Billing**: Fulfillment emits `ShipmentDispatched` events; Billing consumes them to generate invoices
51
+ - **Ordering ↔ Billing**: Shared types for `CustomerId` and `Money`
52
+ ```
53
+
54
+ The skill infers which structure applies:
55
+
56
+ - If `CONTEXT-MAP.md` exists, read it to find contexts
57
+ - If only a root `CONTEXT.md` exists, single context
58
+ - If neither exists, create a root `CONTEXT.md` lazily when the first term is resolved
59
+
60
+ When multiple contexts exist, infer which one the current topic relates to. If unclear, ask.
.agents/skills/domain-modeling/SKILL.md ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ description: "Build and sharpen a project's domain model. Use when the user wants to pin down domain terminology or a ubiquitous language, record an architectural decision, or when another skill needs to maintain the domain model."
3
+ ---
4
+ # Domain Modeling
5
+
6
+ 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.)
7
+
8
+ ## File structure
9
+
10
+ Most repos have a single context:
11
+
12
+ ```
13
+ /
14
+ β”œβ”€β”€ CONTEXT.md
15
+ β”œβ”€β”€ docs/
16
+ β”‚ └── adr/
17
+ β”‚ β”œβ”€β”€ 0001-event-sourced-orders.md
18
+ β”‚ └── 0002-postgres-for-write-model.md
19
+ └── src/
20
+ ```
21
+
22
+ If a `CONTEXT-MAP.md` exists at the root, the repo has multiple contexts. The map points to where each one lives:
23
+
24
+ ```
25
+ /
26
+ β”œβ”€β”€ CONTEXT-MAP.md
27
+ β”œβ”€β”€ docs/
28
+ β”‚ └── adr/ ← system-wide decisions
29
+ β”œβ”€β”€ src/
30
+ β”‚ β”œβ”€β”€ ordering/
31
+ β”‚ β”‚ β”œβ”€β”€ CONTEXT.md
32
+ β”‚ β”‚ └── docs/adr/ ← context-specific decisions
33
+ β”‚ └── billing/
34
+ β”‚ β”œβ”€β”€ CONTEXT.md
35
+ β”‚ └── docs/adr/
36
+ ```
37
+
38
+ 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.
39
+
40
+ ## During the session
41
+
42
+ ### Challenge against the glossary
43
+
44
+ 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?"
45
+
46
+ ### Sharpen fuzzy language
47
+
48
+ 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."
49
+
50
+ ### Discuss concrete scenarios
51
+
52
+ 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.
53
+
54
+ ### Cross-reference with code
55
+
56
+ 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?"
57
+
58
+ ### Update CONTEXT.md inline
59
+
60
+ 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).
61
+
62
+ `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.
63
+
64
+ ### Offer ADRs sparingly
65
+
66
+ Only offer to create an ADR when all three are true:
67
+
68
+ 1. **Hard to reverse** β€” the cost of changing your mind later is meaningful
69
+ 2. **Surprising without context** β€” a future reader will wonder "why did they do it this way?"
70
+ 3. **The result of a real trade-off** β€” there were genuine alternatives and you picked one for specific reasons
71
+
72
+ If any of the three is missing, skip the ADR. Use the format in [ADR-FORMAT.md](./ADR-FORMAT.md).
.agents/skills/edit-article/SKILL.md ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ description: "Edit and improve articles by restructuring sections, improving clarity, and tightening prose. Use when user wants to edit, revise, or improve an article draft."
3
+ ---
4
+ 1. First, divide the article into sections based on its headings. Think about the main points you want to make during those sections.
5
+
6
+ Consider that information is a directed acyclic graph, and that pieces of information can depend on other pieces of information. Make sure that the order of the sections and their contents respects these dependencies.
7
+
8
+ Confirm the sections with the user.
9
+
10
+ 2. For each section:
11
+
12
+ 2a. Rewrite the section to improve clarity, coherence, and flow. Use maximum 240 characters per paragraph.
.agents/skills/git-guardrails-claude-code/SKILL.md ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ description: "Set up Claude Code hooks to block dangerous git commands (push, reset --hard, clean, branch -D, etc.) before they execute. Use when user wants to prevent destructive git operations, add git safety hooks, or block git push/reset in Claude Code."
3
+ ---
4
+ # Setup Git Guardrails
5
+
6
+ Sets up a PreToolUse hook that intercepts and blocks dangerous git commands before Claude executes them.
7
+
8
+ ## What Gets Blocked
9
+
10
+ - `git push` (all variants including `--force`)
11
+ - `git reset --hard`
12
+ - `git clean -f` / `git clean -fd`
13
+ - `git branch -D`
14
+ - `git checkout .` / `git restore .`
15
+
16
+ When blocked, Claude sees a message telling it that it does not have authority to access these commands.
17
+
18
+ ## Steps
19
+
20
+ ### 1. Ask scope
21
+
22
+ Ask the user: install for **this project only** (`.claude/settings.json`) or **all projects** (`~/.claude/settings.json`)?
23
+
24
+ ### 2. Copy the hook script
25
+
26
+ The bundled script is at: [scripts/block-dangerous-git.sh](scripts/block-dangerous-git.sh)
27
+
28
+ Copy it to the target location based on scope:
29
+
30
+ - **Project**: `.claude/hooks/block-dangerous-git.sh`
31
+ - **Global**: `~/.claude/hooks/block-dangerous-git.sh`
32
+
33
+ Make it executable with `chmod +x`.
34
+
35
+ ### 3. Add hook to settings
36
+
37
+ Add to the appropriate settings file:
38
+
39
+ **Project** (`.claude/settings.json`):
40
+
41
+ ```json
42
+ {
43
+ "hooks": {
44
+ "PreToolUse": [
45
+ {
46
+ "matcher": "Bash",
47
+ "hooks": [
48
+ {
49
+ "type": "command",
50
+ "command": "\"$CLAUDE_PROJECT_DIR\"/.claude/hooks/block-dangerous-git.sh"
51
+ }
52
+ ]
53
+ }
54
+ ]
55
+ }
56
+ }
57
+ ```
58
+
59
+ **Global** (`~/.claude/settings.json`):
60
+
61
+ ```json
62
+ {
63
+ "hooks": {
64
+ "PreToolUse": [
65
+ {
66
+ "matcher": "Bash",
67
+ "hooks": [
68
+ {
69
+ "type": "command",
70
+ "command": "~/.claude/hooks/block-dangerous-git.sh"
71
+ }
72
+ ]
73
+ }
74
+ ]
75
+ }
76
+ }
77
+ ```
78
+
79
+ If the settings file already exists, merge the hook into existing `hooks.PreToolUse` array β€” don't overwrite other settings.
80
+
81
+ ### 4. Ask about customization
82
+
83
+ Ask if user wants to add or remove any patterns from the blocked list. Edit the copied script accordingly.
84
+
85
+ ### 5. Verify
86
+
87
+ Run a quick test:
88
+
89
+ ```bash
90
+ echo '{"tool_input":{"command":"git push origin main"}}' | <path-to-script>
91
+ ```
92
+
93
+ Should exit with code 2 and print a BLOCKED message to stderr.
.agents/skills/git-guardrails-claude-code/scripts/block-dangerous-git.sh ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+
3
+ INPUT=$(cat)
4
+ COMMAND=$(echo "$INPUT" | jq -r '.tool_input.command')
5
+
6
+ DANGEROUS_PATTERNS=(
7
+ "git push"
8
+ "git reset --hard"
9
+ "git clean -fd"
10
+ "git clean -f"
11
+ "git branch -D"
12
+ "git checkout \."
13
+ "git restore \."
14
+ "push --force"
15
+ "reset --hard"
16
+ )
17
+
18
+ for pattern in "${DANGEROUS_PATTERNS[@]}"; do
19
+ if echo "$COMMAND" | grep -qE "$pattern"; then
20
+ echo "BLOCKED: '$COMMAND' matches dangerous pattern '$pattern'. The user has prevented you from doing this." >&2
21
+ exit 2
22
+ fi
23
+ done
24
+
25
+ exit 0
.agents/skills/grill-me/SKILL.md ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ ---
2
+ description: "A relentless interview to sharpen a plan or design."
3
+ ---
4
+ Run a `/grilling` session.
.agents/skills/grill-with-docs/SKILL.md ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ ---
2
+ description: "A relentless interview to sharpen a plan or design, which also creates docs (ADR's and glossary) as we go."
3
+ ---
4
+ Run a `/grilling` session, using the `/domain-modeling` skill.
.agents/skills/grilling/SKILL.md ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ description: "Interview the user relentlessly about a plan or design. Use when the user wants to stress-test a plan before building, or uses any 'grill' trigger phrases."
3
+ ---
4
+ Interview me relentlessly about every aspect of this plan until we reach a shared understanding. Walk down each branch of the design tree, resolving dependencies between decisions one-by-one. For each question, provide your recommended answer.
5
+
6
+ Ask the questions one at a time, waiting for feedback on each question before continuing. Asking multiple questions at once is bewildering.
7
+
8
+ If a question can be answered by exploring the codebase, explore the codebase instead.
.agents/skills/handoff/SKILL.md ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ description: "Compact the current conversation into a handoff document for another agent to pick up."
3
+ ---
4
+ Write a handoff document summarising the current conversation so a fresh agent can continue the work. Save to the temporary directory of the user's OS - not the current workspace.
5
+
6
+ Include a "suggested skills" section in the document, which suggests skills that the agent should invoke.
7
+
8
+ Do not duplicate content already captured in other artifacts (PRDs, plans, ADRs, issues, commits, diffs). Reference them by path or URL instead.
9
+
10
+ Redact any sensitive information, such as API keys, passwords, or personally identifiable information.
11
+
12
+ If the user passed arguments, treat them as a description of what the next session will focus on and tailor the doc accordingly.
.agents/skills/implement/SKILL.md ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ description: "Implement a piece of work based on a PRD or set of issues."
3
+ ---
4
+ Implement the work described by the user in the PRD or issues.
5
+
6
+ Use /tdd where possible, at pre-agreed seams.
7
+
8
+ Run typechecking regularly, single test files regularly, and the full test suite once at the end.
9
+
10
+ Once done, use /code-review to review the work.
11
+
12
+ Commit your work to the current branch.
.agents/skills/improve-codebase-architecture/HTML-REPORT.md ADDED
@@ -0,0 +1,123 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # HTML Report Format
2
+
3
+ The architectural review is rendered as a single self-contained HTML file in the OS temp directory. Tailwind and Mermaid both come from CDNs. Mermaid handles graph-shaped diagrams reliably; hand-built divs and inline SVG handle the more editorial visuals (mass diagrams, cross-sections). Mix the two β€” don't lean on Mermaid for everything, it'll start to look generic.
4
+
5
+ ## Scaffold
6
+
7
+ ```html
8
+ <!doctype html>
9
+ <html lang="en">
10
+ <head>
11
+ <meta charset="utf-8" />
12
+ <title>Architecture review β€” {{repo name}}</title>
13
+ <script src="https://cdn.tailwindcss.com"></script>
14
+ <script type="module">
15
+ import mermaid from "https://cdn.jsdelivr.net/npm/mermaid@11/dist/mermaid.esm.min.mjs";
16
+ mermaid.initialize({ startOnLoad: true, theme: "neutral", securityLevel: "loose" });
17
+ </script>
18
+ <style>
19
+ /* small custom layer for things Tailwind doesn't cover cleanly:
20
+ dashed seam lines, hand-drawn-feeling arrow heads, etc. */
21
+ .seam { stroke-dasharray: 4 4; }
22
+ .leak { stroke: #dc2626; }
23
+ .deep { background: linear-gradient(135deg, #0f172a, #1e293b); }
24
+ </style>
25
+ </head>
26
+ <body class="bg-stone-50 text-slate-900 font-sans">
27
+ <main class="max-w-5xl mx-auto px-6 py-12 space-y-12">
28
+ <header>...</header>
29
+ <section id="candidates" class="space-y-10">...</section>
30
+ <section id="top-recommendation">...</section>
31
+ </main>
32
+ </body>
33
+ </html>
34
+ ```
35
+
36
+ ## Header
37
+
38
+ Repo name, date, and a compact legend: solid box = module, dashed line = seam, red arrow = leakage, thick dark box = deep module. No introduction paragraph β€” straight into the candidates.
39
+
40
+ ## Candidate card
41
+
42
+ The diagrams carry the weight. Prose is sparse, plain, and uses the glossary terms (from the `/codebase-design` skill) without ceremony.
43
+
44
+ Each candidate is one `<article>`:
45
+
46
+ - **Title** β€” short, names the deepening (e.g. "Collapse the Order intake pipeline").
47
+ - **Badge row** β€” recommendation strength (`Strong` = emerald, `Worth exploring` = amber, `Speculative` = slate), plus a tag for the dependency category (`in-process`, `local-substitutable`, `ports & adapters`, `mock`).
48
+ - **Files** β€” monospaced list, `font-mono text-sm`.
49
+ - **Before / After diagram** β€” the centrepiece. Two columns, side by side. See patterns below.
50
+ - **Problem** β€” one sentence. What hurts.
51
+ - **Solution** β€” one sentence. What changes.
52
+ - **Wins** β€” bullets, ≀6 words each. e.g. "Tests hit one interface", "Pricing logic stops leaking", "Delete 4 shallow wrappers".
53
+ - **ADR callout** (if applicable) β€” one line in an amber-tinted box.
54
+
55
+ No paragraphs of explanation. If the diagram needs a paragraph to be understood, redraw the diagram.
56
+
57
+ ## Diagram patterns
58
+
59
+ Pick the pattern that fits the candidate. Mix them. Don't make every diagram look the same β€” variety is part of the point.
60
+
61
+ ### Mermaid graph (the workhorse for dependencies / call flow)
62
+
63
+ Use a Mermaid `flowchart` or `graph` when the point is "X calls Y calls Z, and look at the mess." Wrap it in a Tailwind-styled card so it doesn't feel parachuted in. Style with classDef to colour leakage edges red and the deep module dark. Sequence diagrams work well for "before: 6 round-trips; after: 1."
64
+
65
+ ```html
66
+ <div class="rounded-lg border border-slate-200 bg-white p-4">
67
+ <pre class="mermaid">
68
+ flowchart LR
69
+ A[OrderHandler] --> B[OrderValidator]
70
+ B --> C[OrderRepo]
71
+ C -.leak.-> D[PricingClient]
72
+ classDef leak stroke:#dc2626,stroke-width:2px;
73
+ class C,D leak
74
+ </pre>
75
+ </div>
76
+ ```
77
+
78
+ ### Hand-built boxes-and-arrows (when Mermaid's layout fights you)
79
+
80
+ Modules as `<div>`s with borders and labels. Arrows as inline SVG `<line>` or `<path>` elements positioned absolutely over a relative container. Reach for this when you want the "after" diagram to feel like one thick-bordered deep module with greyed-out internals β€” Mermaid won't render that with the right weight.
81
+
82
+ ### Cross-section (good for layered shallowness)
83
+
84
+ Stack horizontal bands (`h-12 border-l-4`) to show layers a call passes through. Before: 6 thin layers each doing nothing. After: 1 thick band labelled with the consolidated responsibility.
85
+
86
+ ### Mass diagram (good for "interface as wide as implementation")
87
+
88
+ Two rectangles per module β€” one for interface surface area, one for implementation. Before: interface rectangle is nearly as tall as the implementation rectangle (shallow). After: interface rectangle is short, implementation rectangle is tall (deep).
89
+
90
+ ### Call-graph collapse
91
+
92
+ Before: a tree of function calls rendered as nested boxes. After: the same tree collapsed into one box, with the now-internal calls shown faded inside it.
93
+
94
+ ## Style guidance
95
+
96
+ - Lean editorial, not corporate-dashboard. Generous whitespace. Serif optional for headings (`font-serif` works well with stone/slate).
97
+ - Colour sparingly: one accent (emerald or indigo) plus red for leakage and amber for warnings.
98
+ - Keep diagrams ~320px tall so before/after sits comfortably side by side without scrolling.
99
+ - Use `text-xs uppercase tracking-wider` for module labels inside diagrams β€” they should read as schematic, not as UI.
100
+ - The only scripts are the Tailwind CDN and the Mermaid ESM import. The report is otherwise static β€” no app code, no interactivity beyond Mermaid's own rendering.
101
+
102
+ ## Top recommendation section
103
+
104
+ One larger card. Candidate name, one sentence on why, anchor link to its card. That's it.
105
+
106
+ ## Tone
107
+
108
+ Plain English, concise β€” but the architectural nouns and verbs come straight from the `/codebase-design` skill. Concision is not an excuse to drift.
109
+
110
+ **Use exactly:** module, interface, implementation, depth, deep, shallow, seam, adapter, leverage, locality.
111
+
112
+ **Never substitute:** component, service, unit (for module) Β· API, signature (for interface) Β· boundary (for seam) Β· layer, wrapper (for module, when you mean module).
113
+
114
+ **Phrasings that fit the style:**
115
+
116
+ - "Order intake module is shallow β€” interface nearly matches the implementation."
117
+ - "Pricing leaks across the seam."
118
+ - "Deepen: one interface, one place to test."
119
+ - "Two adapters justify the seam: HTTP in prod, in-memory in tests."
120
+
121
+ **Wins bullets** name the gain in glossary terms: *"locality: bugs concentrate in one module"*, *"leverage: one interface, N call sites"*, *"interface shrinks; implementation absorbs the wrappers"*. Don't write *"easier to maintain"* or *"cleaner code"* β€” those terms aren't in the glossary and don't earn their place.
122
+
123
+ No hedging, no throat-clearing, no "it's worth noting that…". If a sentence could be a bullet, make it a bullet. If a bullet could be cut, cut it. If a term isn't in the `/codebase-design` glossary, reach for one that is before inventing a new one.
.agents/skills/improve-codebase-architecture/SKILL.md ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ description: "Scan a codebase for deepening opportunities, present them as a visual HTML report, then grill through whichever one you pick."
3
+ ---
4
+ # Improve Codebase Architecture
5
+
6
+ Surface architectural friction and propose **deepening opportunities** β€” refactors that turn shallow modules into deep ones. The aim is testability and AI-navigability.
7
+
8
+ This command is _informed_ by the project's domain model and built on a shared design vocabulary:
9
+
10
+ - Run the `/codebase-design` 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."
11
+ - The domain language in `CONTEXT.md` gives names to good seams; ADRs in `docs/adr/` record decisions this command should not re-litigate.
12
+
13
+ ## Process
14
+
15
+ ### 1. Explore
16
+
17
+ Read the project's domain glossary (`CONTEXT.md`) and any ADRs in the area you're touching first.
18
+
19
+ Then use the Agent tool with `subagent_type=Explore` to walk the codebase. Don't follow rigid heuristics β€” explore organically and note where you experience friction:
20
+
21
+ - Where does understanding one concept require bouncing between many small modules?
22
+ - Where are modules **shallow** β€” interface nearly as complex as the implementation?
23
+ - Where have pure functions been extracted just for testability, but the real bugs hide in how they're called (no **locality**)?
24
+ - Where do tightly-coupled modules leak across their seams?
25
+ - Which parts of the codebase are untested, or hard to test through their current interface?
26
+
27
+ 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.
28
+
29
+ ### 2. Present candidates as an HTML report
30
+
31
+ 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.
32
+
33
+ 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.
34
+
35
+ For each candidate, render a card with:
36
+
37
+ - **Files** β€” which files/modules are involved
38
+ - **Problem** β€” why the current architecture is causing friction
39
+ - **Solution** β€” plain English description of what would change
40
+ - **Benefits** β€” explained in terms of locality and leverage, and how tests would improve
41
+ - **Before / After diagram** β€” side-by-side, custom-drawn, illustrating the shallowness and the deepening
42
+ - **Recommendation strength** β€” one of `Strong`, `Worth exploring`, `Speculative`, rendered as a badge
43
+
44
+ End the report with a **Top recommendation** section: which candidate you'd tackle first and why.
45
+
46
+ **Use CONTEXT.md vocabulary for the domain, and the `/codebase-design` vocabulary for the architecture.** If `CONTEXT.md` defines "Order," talk about "the Order intake module" β€” not "the FooBarHandler," and not "the Order service."
47
+
48
+ **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.
49
+
50
+ See [HTML-REPORT.md](HTML-REPORT.md) for the full HTML scaffold, diagram patterns, and styling guidance.
51
+
52
+ Do NOT propose interfaces yet. After the file is written, ask the user: "Which of these would you like to explore?"
53
+
54
+ ### 3. Grilling loop
55
+
56
+ Once the user picks a candidate, run the `/grilling` skill to walk the design tree with them β€” constraints, dependencies, the shape of the deepened module, what sits behind the seam, what tests survive.
57
+
58
+ Side effects happen inline as decisions crystallize β€” run the `/domain-modeling` skill to keep the domain model current as you go:
59
+
60
+ - **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.
61
+ - **Sharpening a fuzzy term during the conversation?** Update `CONTEXT.md` right there.
62
+ - **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.
63
+ - **Want to explore alternative interfaces for the deepened module?** Run the `/codebase-design` skill and use its design-it-twice parallel sub-agent pattern.
.agents/skills/loop-me/SKILL.md ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ description: "Grill me about specs for the workflows I want to build, within this workspace."
3
+ ---
4
+ Run a stateful `/grilling` session whose only output is **workflow** specs. Use the grilling discipline β€” relentless, one question at a time, a recommended answer attached to each β€” aimed at the vocabulary and goal below. Create, edit, and delete specs as the grilling resolves things.
5
+
6
+ ## The loop lens
7
+
8
+ A **loop** is a recurring pattern in the user's life: their career, their week, their morning, a single repeated activity. Picturing a life as loops within loops reveals how predictable its activities really are β€” which is what makes them worth **delegating**. Use the lens to find loops worth specifying, and propose ones the user hasn't noticed.
9
+
10
+ A **workflow** is the spec of one loop, made real. You run a workflow on a loop β€” the loop is its running instantiation. Workflows live in `workflows/*.md` and are the source of truth.
11
+
12
+ ## Vocabulary
13
+
14
+ A shared language, reached for only when a workflow calls for it β€” never a checklist. **Mandate nothing structural**: a workflow needs no AI, no checkpoint, and no schedule unless the grilling shows it does.
15
+
16
+ - **Trigger** β€” what fires each run: an **event** (a new email, a new issue) or a **schedule** (every morning). Event-triggering is usually the more efficient.
17
+ - **Checkpoint** β€” a human-in-the-loop point where the user is asked to verify or decide. Some workflows have none and run autonomously; some use no AI at all.
18
+ - **Push right** β€” defer the checkpoint as far as it will go. Do maximal work before involving the human, so they are asked once, late, with everything prepared.
19
+ - **Brief** β€” what a checkpoint presents: a tight, decision-ready summary β€” what was produced, why, and a link down to the asset itself β€” never the raw output. The user reads a brief, not a draft. Speed of review is imperative.
20
+
21
+ ## Definition of done
22
+
23
+ A workflow spec is done when an implementer agent could build it without asking a single question. Grill until then; nothing is done while a question remains.
24
+
25
+ ## The workspace
26
+
27
+ - `workflows/*.md` β€” one spec per workflow.
28
+ - `NOTES.md` β€” raw notes on the user's world: the tools they use, the channels they process, and their own terminology for both. When it is empty or thin, interview them about their world before specifying anything. Sharpen fuzzy terms into canonical ones as they surface, and record them here.
.agents/skills/migrate-to-shoehorn/SKILL.md ADDED
@@ -0,0 +1,116 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ description: "Migrate test files from `as` type assertions to @total-typescript/shoehorn. Use when user mentions shoehorn, wants to replace `as` in tests, or needs partial test data."
3
+ ---
4
+ # Migrate to Shoehorn
5
+
6
+ ## Why shoehorn?
7
+
8
+ `shoehorn` lets you pass partial data in tests while keeping TypeScript happy. It replaces `as` assertions with type-safe alternatives.
9
+
10
+ **Test code only.** Never use shoehorn in production code.
11
+
12
+ Problems with `as` in tests:
13
+
14
+ - Trained not to use it
15
+ - Must manually specify target type
16
+ - Double-as (`as unknown as Type`) for intentionally wrong data
17
+
18
+ ## Install
19
+
20
+ ```bash
21
+ npm i @total-typescript/shoehorn
22
+ ```
23
+
24
+ ## Migration patterns
25
+
26
+ ### Large objects with few needed properties
27
+
28
+ Before:
29
+
30
+ ```ts
31
+ type Request = {
32
+ body: { id: string };
33
+ headers: Record<string, string>;
34
+ cookies: Record<string, string>;
35
+ // ...20 more properties
36
+ };
37
+
38
+ it("gets user by id", () => {
39
+ // Only care about body.id but must fake entire Request
40
+ getUser({
41
+ body: { id: "123" },
42
+ headers: {},
43
+ cookies: {},
44
+ // ...fake all 20 properties
45
+ });
46
+ });
47
+ ```
48
+
49
+ After:
50
+
51
+ ```ts
52
+ import { fromPartial } from "@total-typescript/shoehorn";
53
+
54
+ it("gets user by id", () => {
55
+ getUser(
56
+ fromPartial({
57
+ body: { id: "123" },
58
+ }),
59
+ );
60
+ });
61
+ ```
62
+
63
+ ### `as Type` β†’ `fromPartial()`
64
+
65
+ Before:
66
+
67
+ ```ts
68
+ getUser({ body: { id: "123" } } as Request);
69
+ ```
70
+
71
+ After:
72
+
73
+ ```ts
74
+ import { fromPartial } from "@total-typescript/shoehorn";
75
+
76
+ getUser(fromPartial({ body: { id: "123" } }));
77
+ ```
78
+
79
+ ### `as unknown as Type` β†’ `fromAny()`
80
+
81
+ Before:
82
+
83
+ ```ts
84
+ getUser({ body: { id: 123 } } as unknown as Request); // wrong type on purpose
85
+ ```
86
+
87
+ After:
88
+
89
+ ```ts
90
+ import { fromAny } from "@total-typescript/shoehorn";
91
+
92
+ getUser(fromAny({ body: { id: 123 } }));
93
+ ```
94
+
95
+ ## When to use each
96
+
97
+ | Function | Use case |
98
+ | --------------- | -------------------------------------------------- |
99
+ | `fromPartial()` | Pass partial data that still type-checks |
100
+ | `fromAny()` | Pass intentionally wrong data (keeps autocomplete) |
101
+ | `fromExact()` | Force full object (swap with fromPartial later) |
102
+
103
+ ## Workflow
104
+
105
+ 1. **Gather requirements** - ask user:
106
+ - What test files have `as` assertions causing problems?
107
+ - Are they dealing with large objects where only some properties matter?
108
+ - Do they need to pass intentionally wrong data for error testing?
109
+
110
+ 2. **Install and migrate**:
111
+ - [ ] Install: `npm i @total-typescript/shoehorn`
112
+ - [ ] Find test files with `as` assertions: `grep -r " as [A-Z]" --include="*.test.ts" --include="*.spec.ts"`
113
+ - [ ] Replace `as Type` with `fromPartial()`
114
+ - [ ] Replace `as unknown as Type` with `fromAny()`
115
+ - [ ] Add imports from `@total-typescript/shoehorn`
116
+ - [ ] Run type check to verify
.agents/skills/obsidian-vault/SKILL.md ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ description: "Search, create, and manage notes in the Obsidian vault with wikilinks and index notes. Use when user wants to find, create, or organize notes in Obsidian."
3
+ ---
4
+ # Obsidian Vault
5
+
6
+ ## Vault location
7
+
8
+ `/mnt/d/Obsidian Vault/AI Research/`
9
+
10
+ Mostly flat at root level.
11
+
12
+ ## Naming conventions
13
+
14
+ - **Index notes**: aggregate related topics (e.g., `Ralph Wiggum Index.md`, `Skills Index.md`, `RAG Index.md`)
15
+ - **Title case** for all note names
16
+ - No folders for organization - use links and index notes instead
17
+
18
+ ## Linking
19
+
20
+ - Use Obsidian `[[wikilinks]]` syntax: `[[Note Title]]`
21
+ - Notes link to dependencies/related notes at the bottom
22
+ - Index notes are just lists of `[[wikilinks]]`
23
+
24
+ ## Workflows
25
+
26
+ ### Search for notes
27
+
28
+ ```bash
29
+ # Search by filename
30
+ find "/mnt/d/Obsidian Vault/AI Research/" -name "*.md" | grep -i "keyword"
31
+
32
+ # Search by content
33
+ grep -rl "keyword" "/mnt/d/Obsidian Vault/AI Research/" --include="*.md"
34
+ ```
35
+
36
+ Or use Grep/Glob tools directly on the vault path.
37
+
38
+ ### Create a new note
39
+
40
+ 1. Use **Title Case** for filename
41
+ 2. Write content as a unit of learning (per vault rules)
42
+ 3. Add `[[wikilinks]]` to related notes at the bottom
43
+ 4. If part of a numbered sequence, use the hierarchical numbering scheme
44
+
45
+ ### Find related notes
46
+
47
+ Search for `[[Note Title]]` across the vault to find backlinks:
48
+
49
+ ```bash
50
+ grep -rl "\\[\\[Note Title\\]\\]" "/mnt/d/Obsidian Vault/AI Research/"
51
+ ```
52
+
53
+ ### Find index notes
54
+
55
+ ```bash
56
+ find "/mnt/d/Obsidian Vault/AI Research/" -name "*Index*"
57
+ ```
.agents/skills/prototype/LOGIC.md ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Logic Prototype
2
+
3
+ A tiny interactive terminal app that lets the user drive a state model by hand. Use this when the question is about **business logic, state transitions, or data shape** β€” the kind of thing that looks reasonable on paper but only feels wrong once you push it through real cases.
4
+
5
+ ## When this is the right shape
6
+
7
+ - "I'm not sure if this state machine handles the edge case where X then Y."
8
+ - "Does this data model actually let me represent the case where..."
9
+ - "I want to feel out what the API should look like before writing it."
10
+ - Anything where the user wants to **press buttons and watch state change**.
11
+
12
+ If the question is "what should this look like" β€” wrong branch. Use [UI.md](UI.md).
13
+
14
+ ## Process
15
+
16
+ ### 1. State the question
17
+
18
+ Before writing code, write down what state model and what question you're prototyping. One paragraph, in the prototype's README or a comment at the top of the file. A logic prototype that answers the wrong question is pure waste β€” make the question explicit so it can be checked later, whether the user is watching now or returning to it AFK.
19
+
20
+ ### 2. Pick the language
21
+
22
+ Use whatever the host project uses. If the project has no obvious runtime (e.g. a docs repo), ask.
23
+
24
+ Match the project's existing conventions for tooling β€” don't add a new package manager or runtime just for the prototype.
25
+
26
+ ### 3. Isolate the logic in a portable module
27
+
28
+ Put the actual logic β€” the bit that's answering the question β€” behind a small, pure interface that could be lifted out and dropped into the real codebase later. The TUI around it is throwaway; the logic module shouldn't be.
29
+
30
+ The right shape depends on the question:
31
+
32
+ - **A pure reducer** β€” `(state, action) => state`. Good when actions are discrete events and state is a single value.
33
+ - **A state machine** β€” explicit states and transitions. Good when "which actions are even legal right now" is part of the question.
34
+ - **A small set of pure functions** over a plain data type. Good when there's no implicit current state β€” just transformations.
35
+ - **A class or module with a clear method surface** when the logic genuinely owns ongoing internal state.
36
+
37
+ Pick whichever shape best fits the question being asked, *not* whichever is easiest to wire to a TUI. Keep it pure: no I/O, no terminal code, no `console.log` for control flow. The TUI imports it and calls into it; nothing flows the other direction.
38
+
39
+ This is what makes the prototype useful past its own lifetime. When the question's been answered, the validated reducer / machine / function set can be lifted into the real module β€” the TUI shell gets deleted.
40
+
41
+ ### 4. Build the smallest TUI that exposes the state
42
+
43
+ Build it as a **lightweight TUI** β€” on every tick, clear the screen (`console.clear()` / `print("\033[2J\033[H")` / equivalent) and re-render the whole frame. The user should always see one stable view, not an ever-growing scrollback.
44
+
45
+ Each frame has two parts, in this order:
46
+
47
+ 1. **Current state**, pretty-printed and diff-friendly (one field per line, or formatted JSON). Use **bold** for field names or section headers and **dim** for less important context (timestamps, IDs, derived values). Native ANSI escape codes are fine β€” `\x1b[1m` bold, `\x1b[2m` dim, `\x1b[0m` reset. No need to pull in a styling library unless one is already in the project.
48
+ 2. **Keyboard shortcuts**, listed at the bottom: `[a] add user [d] delete user [t] tick clock [q] quit`. Bold the key, dim the description, or vice-versa β€” whatever reads cleanly.
49
+
50
+ Behaviour:
51
+
52
+ 1. **Initialise state** β€” a single in-memory object/struct. Render the first frame on start.
53
+ 2. **Read one keystroke (or one line)** at a time, dispatch to a handler that mutates state.
54
+ 3. **Re-render** the full frame after every action β€” don't append, replace.
55
+ 4. **Loop until quit.**
56
+
57
+ The whole frame should fit on one screen.
58
+
59
+ ### 5. Make it runnable in one command
60
+
61
+ Add a script to the project's existing task runner (`package.json` scripts, `Makefile`, `justfile`, `pyproject.toml`). The user should run `pnpm run <prototype-name>` or equivalent β€” never need to remember a path.
62
+
63
+ If the host project has no task runner, just put the command at the top of the prototype's README.
64
+
65
+ ### 6. Hand it over
66
+
67
+ Give the user the run command. They'll drive it themselves; the interesting moments are when they say "wait, that shouldn't be possible" or "huh, I assumed X would be different" β€” those are the bugs in the _idea_, which is the whole point. If they want new actions added, add them. Prototypes evolve.
68
+
69
+ ### 7. Capture the answer
70
+
71
+ When the prototype has done its job, the answer to the question is the only thing worth keeping. If the user is around, ask what it taught them. If not, leave a `NOTES.md` next to the prototype so the answer can be filled in (or filled in by you, if you've watched the session) before the prototype gets deleted.
72
+
73
+ ## Anti-patterns
74
+
75
+ - **Don't add tests.** A prototype that needs tests is no longer a prototype.
76
+ - **Don't wire it to the real database.** Use an in-memory store unless the question is specifically about persistence.
77
+ - **Don't generalise.** No "what if we wanted to support X later." The prototype answers one question.
78
+ - **Don't blur the logic and the TUI together.** If the reducer / state machine references `console.log`, prompts, or terminal escape codes, it's no longer portable. Keep the TUI as a thin shell over a pure module.
79
+ - **Don't ship the TUI shell into production.** The shell is optimised for being driven by hand from a terminal. The logic module behind it is the bit worth keeping.
.agents/skills/prototype/SKILL.md ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ description: "Build a throwaway prototype to answer a design question. Use when the user wants to sanity-check whether a state model or logic feels right, or explore what a UI should look like."
3
+ ---
4
+ # Prototype
5
+
6
+ A prototype is **throwaway code that answers a question**. The question decides the shape.
7
+
8
+ ## Pick a branch
9
+
10
+ Identify which question is being answered β€” from the user's prompt, the surrounding code, or by asking if the user is around:
11
+
12
+ - **"Does this logic / state model feel right?"** β†’ [LOGIC.md](LOGIC.md). Build a tiny interactive terminal app that pushes the state machine through cases that are hard to reason about on paper.
13
+ - **"What should this look like?"** β†’ [UI.md](UI.md). Generate several radically different UI variations on a single route, switchable via a URL search param and a floating bottom bar.
14
+
15
+ The two branches produce very different artifacts β€” getting this wrong wastes the whole prototype. If the question is genuinely ambiguous and the user isn't reachable, default to whichever branch better matches the surrounding code (a backend module β†’ logic; a page or component β†’ UI) and state the assumption at the top of the prototype.
16
+
17
+ ## Rules that apply to both
18
+
19
+ 1. **Throwaway from day one, and clearly marked as such.** Locate the prototype code close to where it will actually be used (next to the module or page it's prototyping for) so context is obvious β€” but name it so a casual reader can see it's a prototype, not production. For throwaway UI routes, obey whatever routing convention the project already uses; don't invent a new top-level structure.
20
+ 2. **One command to run.** Whatever the project's existing task runner supports β€” `pnpm <name>`, `python <path>`, `bun <path>`, etc. The user must be able to start it without thinking.
21
+ 3. **No persistence by default.** State lives in memory. Persistence is the thing the prototype is _checking_, not something it should depend on. If the question explicitly involves a database, hit a scratch DB or a local file with a clear "PROTOTYPE β€” wipe me" name.
22
+ 4. **Skip the polish.** No tests, no error handling beyond what makes the prototype _runnable_, no abstractions. The point is to learn something fast and then delete it.
23
+ 5. **Surface the state.** After every action (logic) or on every variant switch (UI), print or render the full relevant state so the user can see what changed.
24
+ 6. **Delete or absorb when done.** When the prototype has answered its question, either delete it or fold the validated decision into the real code β€” don't leave it rotting in the repo.
25
+
26
+ ## When done
27
+
28
+ The _answer_ is the only thing worth keeping from a prototype. Capture it somewhere durable (commit message, ADR, issue, or a `NOTES.md` next to the prototype) along with the question it was answering. If the user is around, that capture is a quick conversation; if not, leave the placeholder so they (or you, on the next pass) can fill in the verdict before deleting the prototype.
.agents/skills/prototype/UI.md ADDED
@@ -0,0 +1,112 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # UI Prototype
2
+
3
+ Generate **several radically different UI variations** on a single route, switchable from a floating bottom bar. The user flips between variants in the browser, picks one (or steals bits from each), then throws the rest away.
4
+
5
+ If the question is about logic/state rather than what something looks like β€” wrong branch. Use [LOGIC.md](LOGIC.md).
6
+
7
+ ## When this is the right shape
8
+
9
+ - "What should this page look like?"
10
+ - "I want to see a few options for this dashboard before committing."
11
+ - "Try a different layout for the settings screen."
12
+ - Any time the user would otherwise spend a day picking between three vague mockups in their head.
13
+
14
+ ## Two sub-shapes β€” strongly prefer sub-shape A
15
+
16
+ A UI prototype is much easier to judge when it's **butting up against the rest of the app** β€” real header, real sidebar, real data, real density. A throwaway route on its own is a vacuum: every variant looks fine in isolation. Default to sub-shape A whenever there's a plausible existing page to host the variants. Only reach for sub-shape B if the prototype genuinely has no nearby home.
17
+
18
+ ### Sub-shape A β€” adjustment to an existing page (preferred)
19
+
20
+ The route already exists. Variants are rendered **on the same route**, gated by a `?variant=` URL search param. The existing data fetching, params, and auth all stay β€” only the rendering swaps. This is the default; pick it unless there's a specific reason not to.
21
+
22
+ If the prototype is for something that doesn't yet have a page but *would naturally live inside one* (a new section of the dashboard, a new card on the settings screen, a new step in an existing flow) β€” that's still sub-shape A. Mount the variants inside the host page.
23
+
24
+ ### Sub-shape B β€” a new page (last resort)
25
+
26
+ Only use this when the thing being prototyped genuinely has no existing page to live inside β€” e.g. an entirely new top-level surface, or a flow that can't be embedded anywhere sensible.
27
+
28
+ Create a **throwaway route** following whatever routing convention the project already uses β€” don't invent a new top-level structure. Name it so it's obviously a prototype (e.g. include the word `prototype` in the path or filename). Same `?variant=` pattern.
29
+
30
+ Before committing to sub-shape B, sanity-check: is there really no existing page this could be embedded in? An empty route hides design problems that a populated one would expose.
31
+
32
+ In both sub-shapes the floating bottom bar is identical.
33
+
34
+ ## Process
35
+
36
+ ### 1. State the question and pick N
37
+
38
+ Default to **3 variants**. More than 5 stops being radically different and starts being noise β€” cap there.
39
+
40
+ Write down the plan in one line, in the prototype's location or a top-of-file comment:
41
+
42
+ > "Three variants of the settings page, switchable via `?variant=`, on the existing `/settings` route."
43
+
44
+ This works whether the user is here to push back or not.
45
+
46
+ ### 2. Generate radically different variants
47
+
48
+ Draft each variant. Hold each one to:
49
+
50
+ - The page's purpose and the data it has access to.
51
+ - The project's component library / styling system (TailwindCSS, shadcn, MUI, plain CSS, whatever).
52
+ - A clear exported component name, e.g. `VariantA`, `VariantB`, `VariantC`.
53
+
54
+ Variants must be **structurally different** β€” different layout, different information hierarchy, different primary affordance, not just different colours. Three slightly-tweaked card grids isn't a UI prototype, it's wallpaper. If two drafts come out too similar, redo one with explicit "do not use a card grid" guidance.
55
+
56
+ ### 3. Wire them together
57
+
58
+ Create a single switcher component on the route:
59
+
60
+ ```tsx
61
+ // pseudo-code β€” adapt to the project's framework
62
+ const variant = searchParams.get('variant') ?? 'A';
63
+ return (
64
+ <>
65
+ {variant === 'A' && <VariantA {...data} />}
66
+ {variant === 'B' && <VariantB {...data} />}
67
+ {variant === 'C' && <VariantC {...data} />}
68
+ <PrototypeSwitcher variants={['A','B','C']} current={variant} />
69
+ </>
70
+ );
71
+ ```
72
+
73
+ For sub-shape A (existing page): keep all the existing data fetching above the switcher; only the rendered subtree changes per variant.
74
+
75
+ For sub-shape B (new page): the throwaway route under `/prototype/<name>` mounts the same switcher.
76
+
77
+ ### 4. Build the floating switcher
78
+
79
+ A small fixed-position bar at the bottom-centre of the screen with three pieces:
80
+
81
+ - **Left arrow** β€” cycles to the previous variant (wraps around).
82
+ - **Variant label** β€” shows the current variant key and, if the variant exports a name, that name too. e.g. `B β€” Sidebar layout`.
83
+ - **Right arrow** β€” cycles forward (wraps around).
84
+
85
+ Behaviour:
86
+
87
+ - Clicking an arrow updates the URL search param (use the framework's router β€” `router.replace` on Next, `navigate` on React Router, etc) so the variant is shareable and reload-stable.
88
+ - Keyboard: `←` and `β†’` arrow keys also cycle. Don't intercept arrow keys when an `<input>`, `<textarea>`, or `[contenteditable]` is focused.
89
+ - Visually distinct from the page (e.g. high-contrast pill, subtle shadow) so it's obviously not part of the design being evaluated.
90
+ - Hidden in production builds β€” gate on `process.env.NODE_ENV !== 'production'` or an equivalent check, so a stray prototype merge can't ship the bar to users.
91
+
92
+ Put the switcher in a single shared component so both sub-shapes can reuse it. Locate it wherever shared UI lives in the project.
93
+
94
+ ### 5. Hand it over
95
+
96
+ Surface the URL (and the `?variant=` keys). The user will flip through whenever they get to it. The interesting feedback is usually **"I want the header from B with the sidebar from C"** β€” that's the actual design they want.
97
+
98
+ ### 6. Capture the answer and clean up
99
+
100
+ Once a variant has won, write down which one and why (commit message, ADR, issue, or a `NOTES.md` next to the prototype if running AFK and the user hasn't responded yet). Then:
101
+
102
+ - **Sub-shape A** β€” delete the losing variants and the switcher; fold the winner into the existing page.
103
+ - **Sub-shape B** β€” promote the winning variant to a real route, delete the throwaway route and the switcher.
104
+
105
+ Don't leave variant components or the switcher lying around. They rot fast and confuse the next reader.
106
+
107
+ ## Anti-patterns
108
+
109
+ - **Variants that differ only in colour or copy.** That's a tweak, not a prototype. Real variants disagree about structure.
110
+ - **Sharing too much code between variants.** A shared `<Header>` is fine; a shared `<Layout>` defeats the point. Each variant should be free to throw out the layout.
111
+ - **Wiring variants to real mutations.** Read-only prototypes are fine. If a variant needs to mutate, point it at a stub β€” the question is "what should this look like", not "does the backend work".
112
+ - **Promoting the prototype directly to production.** The variant code was written under prototype constraints (no tests, minimal error handling). Rewrite it properly when you fold it in.
.agents/skills/qa/SKILL.md ADDED
@@ -0,0 +1,128 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ description: "Interactive QA session where user reports bugs or issues conversationally, and the agent files GitHub issues. Explores the codebase in the background for context and domain language. Use when user wants to report bugs, do QA, file issues conversationally, or mentions \"QA session\"."
3
+ ---
4
+ # QA Session
5
+
6
+ Run an interactive QA session. The user describes problems they're encountering. You clarify, explore the codebase for context, and file GitHub issues that are durable, user-focused, and use the project's domain language.
7
+
8
+ ## For each issue the user raises
9
+
10
+ ### 1. Listen and lightly clarify
11
+
12
+ Let the user describe the problem in their own words. Ask **at most 2-3 short clarifying questions** focused on:
13
+
14
+ - What they expected vs what actually happened
15
+ - Steps to reproduce (if not obvious)
16
+ - Whether it's consistent or intermittent
17
+
18
+ Do NOT over-interview. If the description is clear enough to file, move on.
19
+
20
+ ### 2. Explore the codebase in the background
21
+
22
+ While talking to the user, kick off an Agent (subagent_type=Explore) in the background to understand the relevant area. The goal is NOT to find a fix β€” it's to:
23
+
24
+ - Learn the domain language used in that area (check UBIQUITOUS_LANGUAGE.md)
25
+ - Understand what the feature is supposed to do
26
+ - Identify the user-facing behavior boundary
27
+
28
+ This context helps you write a better issue β€” but the issue itself should NOT reference specific files, line numbers, or internal implementation details.
29
+
30
+ ### 3. Assess scope: single issue or breakdown?
31
+
32
+ Before filing, decide whether this is a **single issue** or needs to be **broken down** into multiple issues.
33
+
34
+ Break down when:
35
+
36
+ - The fix spans multiple independent areas (e.g. "the form validation is wrong AND the success message is missing AND the redirect is broken")
37
+ - There are clearly separable concerns that different people could work on in parallel
38
+ - The user describes something that has multiple distinct failure modes or symptoms
39
+
40
+ Keep as a single issue when:
41
+
42
+ - It's one behavior that's wrong in one place
43
+ - The symptoms are all caused by the same root behavior
44
+
45
+ ### 4. File the GitHub issue(s)
46
+
47
+ Create issues with `gh issue create`. Do NOT ask the user to review first β€” just file and share URLs.
48
+
49
+ Issues must be **durable** β€” they should still make sense after major refactors. Write from the user's perspective.
50
+
51
+ #### For a single issue
52
+
53
+ Use this template:
54
+
55
+ ```
56
+ ## What happened
57
+
58
+ [Describe the actual behavior the user experienced, in plain language]
59
+
60
+ ## What I expected
61
+
62
+ [Describe the expected behavior]
63
+
64
+ ## Steps to reproduce
65
+
66
+ 1. [Concrete, numbered steps a developer can follow]
67
+ 2. [Use domain terms from the codebase, not internal module names]
68
+ 3. [Include relevant inputs, flags, or configuration]
69
+
70
+ ## Additional context
71
+
72
+ [Any extra observations from the user or from codebase exploration that help frame the issue β€” e.g. "this only happens when using the Docker layer, not the filesystem layer" β€” use domain language but don't cite files]
73
+ ```
74
+
75
+ #### For a breakdown (multiple issues)
76
+
77
+ Create issues in dependency order (blockers first) so you can reference real issue numbers.
78
+
79
+ Use this template for each sub-issue:
80
+
81
+ ```
82
+ ## Parent issue
83
+
84
+ #<parent-issue-number> (if you created a tracking issue) or "Reported during QA session"
85
+
86
+ ## What's wrong
87
+
88
+ [Describe this specific behavior problem β€” just this slice, not the whole report]
89
+
90
+ ## What I expected
91
+
92
+ [Expected behavior for this specific slice]
93
+
94
+ ## Steps to reproduce
95
+
96
+ 1. [Steps specific to THIS issue]
97
+
98
+ ## Blocked by
99
+
100
+ - #<issue-number> (if this issue can't be fixed until another is resolved)
101
+
102
+ Or "None β€” can start immediately" if no blockers.
103
+
104
+ ## Additional context
105
+
106
+ [Any extra observations relevant to this slice]
107
+ ```
108
+
109
+ When creating a breakdown:
110
+
111
+ - **Prefer many thin issues over few thick ones** β€” each should be independently fixable and verifiable
112
+ - **Mark blocking relationships honestly** β€” if issue B genuinely can't be tested until issue A is fixed, say so. If they're independent, mark both as "None β€” can start immediately"
113
+ - **Create issues in dependency order** so you can reference real issue numbers in "Blocked by"
114
+ - **Maximize parallelism** β€” the goal is that multiple people (or agents) can grab different issues simultaneously
115
+
116
+ #### Rules for all issue bodies
117
+
118
+ - **No file paths or line numbers** β€” these go stale
119
+ - **Use the project's domain language** (check UBIQUITOUS_LANGUAGE.md if it exists)
120
+ - **Describe behaviors, not code** β€” "the sync service fails to apply the patch" not "applyPatch() throws on line 42"
121
+ - **Reproduction steps are mandatory** β€” if you can't determine them, ask the user
122
+ - **Keep it concise** β€” a developer should be able to read the issue in 30 seconds
123
+
124
+ After filing, print all issue URLs (with blocking relationships summarized) and ask: "Next issue, or are we done?"
125
+
126
+ ### 5. Continue the session
127
+
128
+ Keep going until the user says they're done. Each issue is independent β€” don't batch them.
.agents/skills/request-refactor-plan/SKILL.md ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ description: "Create a detailed refactor plan with tiny commits via user interview, then file it as a GitHub issue. Use when user wants to plan a refactor, create a refactoring RFC, or break a refactor into safe incremental steps."
3
+ ---
4
+ This skill will be invoked when the user wants to create a refactor request. You should go through the steps below. You may skip steps if you don't consider them necessary.
5
+
6
+ 1. Ask the user for a long, detailed description of the problem they want to solve and any potential ideas for solutions.
7
+
8
+ 2. Explore the repo to verify their assertions and understand the current state of the codebase.
9
+
10
+ 3. Ask whether they have considered other options, and present other options to them.
11
+
12
+ 4. Interview the user about the implementation. Be extremely detailed and thorough.
13
+
14
+ 5. Hammer out the exact scope of the implementation. Work out what you plan to change and what you plan not to change.
15
+
16
+ 6. Look in the codebase to check for test coverage of this area of the codebase. If there is insufficient test coverage, ask the user what their plans for testing are.
17
+
18
+ 7. Break the implementation into a plan of tiny commits. Remember Martin Fowler's advice to "make each refactoring step as small as possible, so that you can always see the program working."
19
+
20
+ 8. Create a GitHub issue with the refactor plan. Use the following template for the issue description:
21
+
22
+ <refactor-plan-template>
23
+
24
+ ## Problem Statement
25
+
26
+ The problem that the developer is facing, from the developer's perspective.
27
+
28
+ ## Solution
29
+
30
+ The solution to the problem, from the developer's perspective.
31
+
32
+ ## Commits
33
+
34
+ A LONG, detailed implementation plan. Write the plan in plain English, breaking down the implementation into the tiniest commits possible. Each commit should leave the codebase in a working state.
35
+
36
+ ## Decision Document
37
+
38
+ A list of implementation decisions that were made. This can include:
39
+
40
+ - The modules that will be built/modified
41
+ - The interfaces of those modules that will be modified
42
+ - Technical clarifications from the developer
43
+ - Architectural decisions
44
+ - Schema changes
45
+ - API contracts
46
+ - Specific interactions
47
+
48
+ Do NOT include specific file paths or code snippets. They may end up being outdated very quickly.
49
+
50
+ ## Testing Decisions
51
+
52
+ A list of testing decisions that were made. Include:
53
+
54
+ - A description of what makes a good test (only test external behavior, not implementation details)
55
+ - Which modules will be tested
56
+ - Prior art for the tests (i.e. similar types of tests in the codebase)
57
+
58
+ ## Out of Scope
59
+
60
+ A description of the things that are out of scope for this refactor.
61
+
62
+ ## Further Notes (optional)
63
+
64
+ Any further notes about the refactor.
65
+
66
+ </refactor-plan-template>
.agents/skills/resolving-merge-conflicts/SKILL.md ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ description: "Use when you need to resolve an in-progress git merge/rebase conflict."
3
+ ---
4
+ 1. **See the current state** of the merge/rebase. Check git history, and the conflicting files.
5
+
6
+ 2. **Find the primary sources** for each conflict. Understand deeply why each change was made, and what the original intent was. Read the commit messages, check the PRs, check original issues/tickets.
7
+
8
+ 3. **Resolve each hunk.** Preserve both intents where possible. Where incompatible, pick the one matching the merge's stated goal and note the trade-off. Do **not** invent new behaviour. Always resolve; never `--abort`.
9
+
10
+ 4. Discover the project's **automated checks** and run them β€” typically typecheck, then tests, then format. Fix anything the merge broke.
11
+
12
+ 5. **Finish the merge/rebase.** Stage everything and commit. If rebasing, continue the rebase process until all commits are rebased.
.agents/skills/scaffold-exercises/SKILL.md ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ description: "Create exercise directory structures with sections, problems, solutions, and explainers that pass linting. Use when user wants to scaffold exercises, create exercise stubs, or set up a new course section."
3
+ ---
4
+ # Scaffold Exercises
5
+
6
+ Create exercise directory structures that pass `pnpm ai-hero-cli internal lint`, then commit with `git commit`.
7
+
8
+ ## Directory naming
9
+
10
+ - **Sections**: `XX-section-name/` inside `exercises/` (e.g., `01-retrieval-skill-building`)
11
+ - **Exercises**: `XX.YY-exercise-name/` inside a section (e.g., `01.03-retrieval-with-bm25`)
12
+ - Section number = `XX`, exercise number = `XX.YY`
13
+ - Names are dash-case (lowercase, hyphens)
14
+
15
+ ## Exercise variants
16
+
17
+ Each exercise needs at least one of these subfolders:
18
+
19
+ - `problem/` - student workspace with TODOs
20
+ - `solution/` - reference implementation
21
+ - `explainer/` - conceptual material, no TODOs
22
+
23
+ When stubbing, default to `explainer/` unless the plan specifies otherwise.
24
+
25
+ ## Required files
26
+
27
+ Each subfolder (`problem/`, `solution/`, `explainer/`) needs a `readme.md` that:
28
+
29
+ - Is **not empty** (must have real content, even a single title line works)
30
+ - Has no broken links
31
+
32
+ When stubbing, create a minimal readme with a title and a description:
33
+
34
+ ```md
35
+ # Exercise Title
36
+
37
+ Description here
38
+ ```
39
+
40
+ If the subfolder has code, it also needs a `main.ts` (>1 line). But for stubs, a readme-only exercise is fine.
41
+
42
+ ## Workflow
43
+
44
+ 1. **Parse the plan** - extract section names, exercise names, and variant types
45
+ 2. **Create directories** - `mkdir -p` for each path
46
+ 3. **Create stub readmes** - one `readme.md` per variant folder with a title
47
+ 4. **Run lint** - `pnpm ai-hero-cli internal lint` to validate
48
+ 5. **Fix any errors** - iterate until lint passes
49
+
50
+ ## Lint rules summary
51
+
52
+ The linter (`pnpm ai-hero-cli internal lint`) checks:
53
+
54
+ - Each exercise has subfolders (`problem/`, `solution/`, `explainer/`)
55
+ - At least one of `problem/`, `explainer/`, or `explainer.1/` exists
56
+ - `readme.md` exists and is non-empty in the primary subfolder
57
+ - No `.gitkeep` files
58
+ - No `speaker-notes.md` files
59
+ - No broken links in readmes
60
+ - No `pnpm run exercise` commands in readmes
61
+ - `main.ts` required per subfolder unless it's readme-only
62
+
63
+ ## Moving/renaming exercises
64
+
65
+ When renumbering or moving exercises:
66
+
67
+ 1. Use `git mv` (not `mv`) to rename directories - preserves git history
68
+ 2. Update the numeric prefix to maintain order
69
+ 3. Re-run lint after moves
70
+
71
+ Example:
72
+
73
+ ```bash
74
+ git mv exercises/01-retrieval/01.03-embeddings exercises/01-retrieval/01.04-embeddings
75
+ ```
76
+
77
+ ## Example: stubbing from a plan
78
+
79
+ Given a plan like:
80
+
81
+ ```
82
+ Section 05: Memory Skill Building
83
+ - 05.01 Introduction to Memory
84
+ - 05.02 Short-term Memory (explainer + problem + solution)
85
+ - 05.03 Long-term Memory
86
+ ```
87
+
88
+ Create:
89
+
90
+ ```bash
91
+ mkdir -p exercises/05-memory-skill-building/05.01-introduction-to-memory/explainer
92
+ mkdir -p exercises/05-memory-skill-building/05.02-short-term-memory/{explainer,problem,solution}
93
+ mkdir -p exercises/05-memory-skill-building/05.03-long-term-memory/explainer
94
+ ```
95
+
96
+ Then create readme stubs:
97
+
98
+ ```
99
+ exercises/05-memory-skill-building/05.01-introduction-to-memory/explainer/readme.md -> "# Introduction to Memory"
100
+ exercises/05-memory-skill-building/05.02-short-term-memory/explainer/readme.md -> "# Short-term Memory"
101
+ exercises/05-memory-skill-building/05.02-short-term-memory/problem/readme.md -> "# Short-term Memory"
102
+ exercises/05-memory-skill-building/05.02-short-term-memory/solution/readme.md -> "# Short-term Memory"
103
+ exercises/05-memory-skill-building/05.03-long-term-memory/explainer/readme.md -> "# Long-term Memory"
104
+ ```
.agents/skills/setup-matt-pocock-skills/SKILL.md ADDED
@@ -0,0 +1,124 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ description: "Configure this repo for the engineering skills β€” set up its issue tracker, triage label vocabulary, and domain doc layout. Run once before first use of the other engineering skills."
3
+ ---
4
+ # Setup Matt Pocock's Skills
5
+
6
+ Scaffold the per-repo configuration that the engineering skills assume:
7
+
8
+ - **Issue tracker** β€” where issues live (GitHub by default; local markdown is also supported out of the box)
9
+ - **Triage labels** β€” the strings used for the five canonical triage roles
10
+ - **Domain docs** β€” where `CONTEXT.md` and ADRs live, and the consumer rules for reading them
11
+
12
+ This is a prompt-driven skill, not a deterministic script. Explore, present what you found, confirm with the user, then write.
13
+
14
+ ## Process
15
+
16
+ ### 1. Explore
17
+
18
+ Look at the current repo to understand its starting state. Read whatever exists; don't assume:
19
+
20
+ - `git remote -v` and `.git/config` β€” is this a GitHub repo? Which one?
21
+ - `AGENTS.md` and `CLAUDE.md` at the repo root β€” does either exist? Is there already an `## Agent skills` section in either?
22
+ - `CONTEXT.md` and `CONTEXT-MAP.md` at the repo root
23
+ - `docs/adr/` and any `src/*/docs/adr/` directories
24
+ - `docs/agents/` β€” does this skill's prior output already exist?
25
+ - `.scratch/` β€” sign that a local-markdown issue tracker convention is already in use
26
+
27
+ ### 2. Present findings and ask
28
+
29
+ Summarise what's present and what's missing. Then walk the user through the three decisions **one at a time** β€” present a section, get the user's answer, then move to the next. Don't dump all three at once.
30
+
31
+ Assume the user does not know what these terms mean. Each section starts with a short explainer (what it is, why these skills need it, what changes if they pick differently). Then show the choices and the default.
32
+
33
+ **Section A β€” Issue tracker.**
34
+
35
+ > Explainer: The "issue tracker" is where issues live for this repo. Skills like `to-issues`, `triage`, `to-prd`, and `qa` read from and write to it β€” they need to know whether to call `gh issue create`, write a markdown file under `.scratch/`, or follow some other workflow you describe. Pick the place you actually track work for this repo.
36
+
37
+ Default posture: these skills were designed for GitHub. If a `git remote` points at GitHub, propose that. If a `git remote` points at GitLab (`gitlab.com` or a self-hosted host), propose GitLab. Otherwise (or if the user prefers), offer:
38
+
39
+ - **GitHub** β€” issues live in the repo's GitHub Issues (uses the `gh` CLI)
40
+ - **GitLab** β€” issues live in the repo's GitLab Issues (uses the [`glab`](https://gitlab.com/gitlab-org/cli) CLI)
41
+ - **Local markdown** β€” issues live as files under `.scratch/<feature>/` in this repo (good for solo projects or repos without a remote)
42
+ - **Other** (Jira, Linear, etc.) β€” ask the user to describe the workflow in one paragraph; the skill will record it as freeform prose
43
+
44
+ If β€” and only if β€” the user picked **GitHub** or **GitLab**, ask one follow-up:
45
+
46
+ > Explainer: Open-source repos often receive feature requests as pull requests, not just issues β€” a PR is an issue with attached code. If you turn this on, `/triage` pulls *external* PRs into the same queue and runs them through the same labels and states as issues (collaborators' in-flight PRs are left alone). Leave it off if PRs aren't a request surface for you.
47
+
48
+ - **PRs as a request surface** β€” yes / no (default: no). Record the answer in `docs/agents/issue-tracker.md`. For local-markdown and other trackers, skip this question β€” there are no PRs.
49
+
50
+ **Section B β€” Triage label vocabulary.**
51
+
52
+ > Explainer: When the `triage` skill processes an incoming issue, it moves it through a state machine β€” needs evaluation, waiting on reporter, ready for an AFK agent to pick up, ready for a human, or won't fix. To do that, it needs to apply labels (or the equivalent in your issue tracker) that match strings *you've actually configured*. If your repo already uses different label names (e.g. `bug:triage` instead of `needs-triage`), map them here so the skill applies the right ones instead of creating duplicates.
53
+
54
+ The five canonical roles:
55
+
56
+ - `needs-triage` β€” maintainer needs to evaluate
57
+ - `needs-info` β€” waiting on reporter
58
+ - `ready-for-agent` β€” fully specified, AFK-ready (an agent can pick it up with no human context)
59
+ - `ready-for-human` β€” needs human implementation
60
+ - `wontfix` β€” will not be actioned
61
+
62
+ Default: each role's string equals its name. Ask the user if they want to override any. If their issue tracker has no existing labels, the defaults are fine.
63
+
64
+ **Section C β€” Domain docs.**
65
+
66
+ > Explainer: Some skills (`improve-codebase-architecture`, `diagnosing-bugs`, `tdd`) read a `CONTEXT.md` file to learn the project's domain language, and `docs/adr/` for past architectural decisions. They need to know whether the repo has one global context or multiple (e.g. a monorepo with separate frontend/backend contexts) so they look in the right place.
67
+
68
+ Confirm the layout:
69
+
70
+ - **Single-context** β€” one `CONTEXT.md` + `docs/adr/` at the repo root. Most repos are this.
71
+ - **Multi-context** β€” `CONTEXT-MAP.md` at the root pointing to per-context `CONTEXT.md` files (typically a monorepo).
72
+
73
+ ### 3. Confirm and edit
74
+
75
+ Show the user a draft of:
76
+
77
+ - The `## Agent skills` block to add to whichever of `CLAUDE.md` / `AGENTS.md` is being edited (see step 4 for selection rules)
78
+ - The contents of `docs/agents/issue-tracker.md`, `docs/agents/triage-labels.md`, `docs/agents/domain.md`
79
+
80
+ Let them edit before writing.
81
+
82
+ ### 4. Write
83
+
84
+ **Pick the file to edit:**
85
+
86
+ - If `CLAUDE.md` exists, edit it.
87
+ - Else if `AGENTS.md` exists, edit it.
88
+ - If neither exists, ask the user which one to create β€” don't pick for them.
89
+
90
+ Never create `AGENTS.md` when `CLAUDE.md` already exists (or vice versa) β€” always edit the one that's already there.
91
+
92
+ If an `## Agent skills` block already exists in the chosen file, update its contents in-place rather than appending a duplicate. Don't overwrite user edits to the surrounding sections.
93
+
94
+ The block:
95
+
96
+ ```markdown
97
+ ## Agent skills
98
+
99
+ ### Issue tracker
100
+
101
+ [one-line summary of where issues are tracked, plus whether external PRs are a triage surface]. See `docs/agents/issue-tracker.md`.
102
+
103
+ ### Triage labels
104
+
105
+ [one-line summary of the label vocabulary]. See `docs/agents/triage-labels.md`.
106
+
107
+ ### Domain docs
108
+
109
+ [one-line summary of layout β€” "single-context" or "multi-context"]. See `docs/agents/domain.md`.
110
+ ```
111
+
112
+ Then write the three docs files using the seed templates in this skill folder as a starting point:
113
+
114
+ - [issue-tracker-github.md](./issue-tracker-github.md) β€” GitHub issue tracker
115
+ - [issue-tracker-gitlab.md](./issue-tracker-gitlab.md) β€” GitLab issue tracker
116
+ - [issue-tracker-local.md](./issue-tracker-local.md) β€” local-markdown issue tracker
117
+ - [triage-labels.md](./triage-labels.md) β€” label mapping
118
+ - [domain.md](./domain.md) β€” domain doc consumer rules + layout
119
+
120
+ For "other" issue trackers, write `docs/agents/issue-tracker.md` from scratch using the user's description.
121
+
122
+ ### 5. Done
123
+
124
+ Tell the user the setup is complete and which engineering skills will now read from these files. Mention they can edit `docs/agents/*.md` directly later β€” re-running this skill is only necessary if they want to switch issue trackers or restart from scratch.
.agents/skills/setup-matt-pocock-skills/domain.md ADDED
@@ -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` skill (reached via `/grill-with-docs` and `/improve-codebase-architecture`) 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`).
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…_
.agents/skills/setup-matt-pocock-skills/issue-tracker-github.md ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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` 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`.
.agents/skills/setup-matt-pocock-skills/issue-tracker-gitlab.md ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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` 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`.
.agents/skills/setup-matt-pocock-skills/issue-tracker-local.md ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Issue tracker: Local Markdown
2
+
3
+ Issues and PRDs for this repo live as markdown files in `.scratch/`.
4
+
5
+ ## Conventions
6
+
7
+ - One feature per directory: `.scratch/<feature-slug>/`
8
+ - The PRD is `.scratch/<feature-slug>/PRD.md`
9
+ - Implementation issues are `.scratch/<feature-slug>/issues/<NN>-<slug>.md`, numbered from `01`
10
+ - Triage state is recorded as a `Status:` line near the top of each issue file (see `triage-labels.md` for the role strings)
11
+ - Comments and conversation history append to the bottom of the file under a `## Comments` heading
12
+
13
+ ## When a skill says "publish to the issue tracker"
14
+
15
+ Create a new file under `.scratch/<feature-slug>/` (creating the directory if needed).
16
+
17
+ ## When a skill says "fetch the relevant ticket"
18
+
19
+ Read the file at the referenced path. The user will normally pass the path or the issue number directly.
.agents/skills/setup-matt-pocock-skills/triage-labels.md ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Triage Labels
2
+
3
+ The skills speak in terms of five canonical triage roles. This file maps those roles to the actual label strings used in this repo's issue tracker.
4
+
5
+ | Label in mattpocock/skills | Label in our tracker | Meaning |
6
+ | -------------------------- | -------------------- | ---------------------------------------- |
7
+ | `needs-triage` | `needs-triage` | Maintainer needs to evaluate this issue |
8
+ | `needs-info` | `needs-info` | Waiting on reporter for more information |
9
+ | `ready-for-agent` | `ready-for-agent` | Fully specified, ready for an AFK agent |
10
+ | `ready-for-human` | `ready-for-human` | Requires human implementation |
11
+ | `wontfix` | `wontfix` | Will not be actioned |
12
+
13
+ When a skill mentions a role (e.g. "apply the AFK-ready triage label"), use the corresponding label string from this table.
14
+
15
+ Edit the right-hand column to match whatever vocabulary you actually use.
.agents/skills/setup-pre-commit/SKILL.md ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ description: "Set up Husky pre-commit hooks with lint-staged (Prettier), type checking, and tests in the current repo. Use when user wants to add pre-commit hooks, set up Husky, configure lint-staged, or add commit-time formatting/typechecking/testing."
3
+ ---
4
+ # Setup Pre-Commit Hooks
5
+
6
+ ## What This Sets Up
7
+
8
+ - **Husky** pre-commit hook
9
+ - **lint-staged** running Prettier on all staged files
10
+ - **Prettier** config (if missing)
11
+ - **typecheck** and **test** scripts in the pre-commit hook
12
+
13
+ ## Steps
14
+
15
+ ### 1. Detect package manager
16
+
17
+ Check for `package-lock.json` (npm), `pnpm-lock.yaml` (pnpm), `yarn.lock` (yarn), `bun.lockb` (bun). Use whichever is present. Default to npm if unclear.
18
+
19
+ ### 2. Install dependencies
20
+
21
+ Install as devDependencies:
22
+
23
+ ```
24
+ husky lint-staged prettier
25
+ ```
26
+
27
+ ### 3. Initialize Husky
28
+
29
+ ```bash
30
+ npx husky init
31
+ ```
32
+
33
+ This creates `.husky/` dir and adds `prepare: "husky"` to package.json.
34
+
35
+ ### 4. Create `.husky/pre-commit`
36
+
37
+ Write this file (no shebang needed for Husky v9+):
38
+
39
+ ```
40
+ npx lint-staged
41
+ npm run typecheck
42
+ npm run test
43
+ ```
44
+
45
+ **Adapt**: Replace `npm` with detected package manager. If repo has no `typecheck` or `test` script in package.json, omit those lines and tell the user.
46
+
47
+ ### 5. Create `.lintstagedrc`
48
+
49
+ ```json
50
+ {
51
+ "*": "prettier --ignore-unknown --write"
52
+ }
53
+ ```
54
+
55
+ ### 6. Create `.prettierrc` (if missing)
56
+
57
+ Only create if no Prettier config exists. Use these defaults:
58
+
59
+ ```json
60
+ {
61
+ "useTabs": false,
62
+ "tabWidth": 2,
63
+ "printWidth": 80,
64
+ "singleQuote": false,
65
+ "trailingComma": "es5",
66
+ "semi": true,
67
+ "arrowParens": "always"
68
+ }
69
+ ```
70
+
71
+ ### 7. Verify
72
+
73
+ - [ ] `.husky/pre-commit` exists and is executable
74
+ - [ ] `.lintstagedrc` exists
75
+ - [ ] `prepare` script in package.json is `"husky"`
76
+ - [ ] `prettier` config exists
77
+ - [ ] Run `npx lint-staged` to verify it works
78
+
79
+ ### 8. Commit
80
+
81
+ Stage all changed/created files and commit with message: `Add pre-commit hooks (husky + lint-staged + prettier)`
82
+
83
+ This will run through the new pre-commit hooks β€” a good smoke test that everything works.
84
+
85
+ ## Notes
86
+
87
+ - Husky v9+ doesn't need shebangs in hook files
88
+ - `prettier --ignore-unknown` skips files Prettier can't parse (images, etc.)
89
+ - The pre-commit runs lint-staged first (fast, staged-only), then full typecheck and tests
.agents/skills/tdd/SKILL.md ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ description: "Test-driven development. Use when the user wants to build features or fix bugs test-first, mentions \"red-green-refactor\", or wants integration tests."
3
+ ---
4
+ # Test-Driven Development
5
+
6
+ TDD is the red β†’ green loop. This skill is the reference that makes that loop produce tests worth keeping: what a good test is, where tests go, the anti-patterns, and the rules of the loop. Every section applies on every cycle β€” consult them before and during the loop, not after.
7
+
8
+ When exploring the codebase, read `CONTEXT.md` (if it exists) so test names and interface vocabulary match the project's domain language, and respect ADRs in the area you're touching.
9
+
10
+ ## What a good test is
11
+
12
+ Tests verify behavior through public interfaces, not implementation details. Code can change entirely; tests shouldn't. A good test reads like a specification β€” "user can checkout with valid cart" tells you exactly what capability exists β€” and survives refactors because it doesn't care about internal structure.
13
+
14
+ See [tests.md](tests.md) for examples and [mocking.md](mocking.md) for mocking guidelines.
15
+
16
+ ## Seams β€” where tests go
17
+
18
+ A **seam** is the public boundary you test at: the interface where you observe behavior without reaching inside. Tests live at seams, never against internals.
19
+
20
+ **Test only at pre-agreed seams.** Before writing any test, write down the seams under test and confirm them with the user. No test is written at an unconfirmed seam. You can't test everything β€” agreeing the seams up front is how testing effort lands on the critical paths and complex logic instead of every edge case.
21
+
22
+ Ask: "What's the public interface, and which seams should we test?"
23
+
24
+ ## Anti-patterns
25
+
26
+ - **Implementation-coupled** β€” mocks internal collaborators, tests private methods, or verifies through a side channel (querying the database instead of using the interface). The tell: the test breaks when you refactor but behavior hasn't changed.
27
+ - **Tautological** β€” the assertion recomputes the expected value the way the code does (`expect(add(a, b)).toBe(a + b)`, a snapshot derived by hand the same way, a constant asserted equal to itself), so it passes by construction and can never disagree with the code. Expected values must come from an independent source of truth β€” a known-good literal, a worked example, the spec.
28
+ - **Horizontal slicing** β€” writing all tests first, then all implementation. Bulk tests verify _imagined_ behavior: you test the _shape_ of things rather than user-facing behavior, the tests go insensitive to real changes, and you commit to test structure before understanding the implementation. Work in **vertical slices** instead β€” one test β†’ one implementation β†’ repeat, each test a **tracer bullet** that responds to what the last cycle taught you.
29
+
30
+ ## Rules of the loop
31
+
32
+ - **Red before green.** Write the failing test first, then only enough code to pass it. Don't anticipate future tests or add speculative features.
33
+ - **One slice at a time.** One seam, one test, one minimal implementation per cycle.
34
+ - **Refactoring is not part of the loop.** It belongs to the review stage (see the `review` skill), not the red β†’ green implementation cycle.
.agents/skills/tdd/mocking.md ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # When to Mock
2
+
3
+ Mock at **system boundaries** only:
4
+
5
+ - External APIs (payment, email, etc.)
6
+ - Databases (sometimes - prefer test DB)
7
+ - Time/randomness
8
+ - File system (sometimes)
9
+
10
+ Don't mock:
11
+
12
+ - Your own classes/modules
13
+ - Internal collaborators
14
+ - Anything you control
15
+
16
+ ## Designing for Mockability
17
+
18
+ At system boundaries, design interfaces that are easy to mock:
19
+
20
+ **1. Use dependency injection**
21
+
22
+ Pass external dependencies in rather than creating them internally:
23
+
24
+ ```typescript
25
+ // Easy to mock
26
+ function processPayment(order, paymentClient) {
27
+ return paymentClient.charge(order.total);
28
+ }
29
+
30
+ // Hard to mock
31
+ function processPayment(order) {
32
+ const client = new StripeClient(process.env.STRIPE_KEY);
33
+ return client.charge(order.total);
34
+ }
35
+ ```
36
+
37
+ **2. Prefer SDK-style interfaces over generic fetchers**
38
+
39
+ Create specific functions for each external operation instead of one generic function with conditional logic:
40
+
41
+ ```typescript
42
+ // GOOD: Each function is independently mockable
43
+ const api = {
44
+ getUser: (id) => fetch(`/users/${id}`),
45
+ getOrders: (userId) => fetch(`/users/${userId}/orders`),
46
+ createOrder: (data) => fetch('/orders', { method: 'POST', body: data }),
47
+ };
48
+
49
+ // BAD: Mocking requires conditional logic inside the mock
50
+ const api = {
51
+ fetch: (endpoint, options) => fetch(endpoint, options),
52
+ };
53
+ ```
54
+
55
+ The SDK approach means:
56
+ - Each mock returns one specific shape
57
+ - No conditional logic in test setup
58
+ - Easier to see which endpoints a test exercises
59
+ - Type safety per endpoint
.agents/skills/tdd/tests.md ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Good and Bad Tests
2
+
3
+ ## Good Tests
4
+
5
+ **Integration-style**: Test through real interfaces, not mocks of internal parts.
6
+
7
+ ```typescript
8
+ // GOOD: Tests observable behavior
9
+ test("user can checkout with valid cart", async () => {
10
+ const cart = createCart();
11
+ cart.add(product);
12
+ const result = await checkout(cart, paymentMethod);
13
+ expect(result.status).toBe("confirmed");
14
+ });
15
+ ```
16
+
17
+ Characteristics:
18
+
19
+ - Tests behavior users/callers care about
20
+ - Uses public API only
21
+ - Survives internal refactors
22
+ - Describes WHAT, not HOW
23
+ - One logical assertion per test
24
+
25
+ ## Bad Tests
26
+
27
+ **Implementation-detail tests**: Coupled to internal structure.
28
+
29
+ ```typescript
30
+ // BAD: Tests implementation details
31
+ test("checkout calls paymentService.process", async () => {
32
+ const mockPayment = jest.mock(paymentService);
33
+ await checkout(cart, payment);
34
+ expect(mockPayment.process).toHaveBeenCalledWith(cart.total);
35
+ });
36
+ ```
37
+
38
+ Red flags:
39
+
40
+ - Mocking internal collaborators
41
+ - Testing private methods
42
+ - Asserting on call counts/order
43
+ - Test breaks when refactoring without behavior change
44
+ - Test name describes HOW not WHAT
45
+ - Verifying through external means instead of interface
46
+
47
+ ```typescript
48
+ // BAD: Bypasses interface to verify
49
+ test("createUser saves to database", async () => {
50
+ await createUser({ name: "Alice" });
51
+ const row = await db.query("SELECT * FROM users WHERE name = ?", ["Alice"]);
52
+ expect(row).toBeDefined();
53
+ });
54
+
55
+ // GOOD: Verifies through interface
56
+ test("createUser makes user retrievable", async () => {
57
+ const user = await createUser({ name: "Alice" });
58
+ const retrieved = await getUser(user.id);
59
+ expect(retrieved.name).toBe("Alice");
60
+ });
61
+ ```
62
+
63
+ **Tautological tests**: Expected value restates the implementation, so the test passes by construction.
64
+
65
+ ```typescript
66
+ // BAD: Expected value is recomputed the way the code computes it
67
+ test("calculateTotal sums line items", () => {
68
+ const items = [{ price: 10 }, { price: 5 }];
69
+ const expected = items.reduce((sum, i) => sum + i.price, 0);
70
+ expect(calculateTotal(items)).toBe(expected);
71
+ });
72
+
73
+ // GOOD: Expected value is an independent, known literal
74
+ test("calculateTotal sums line items", () => {
75
+ expect(calculateTotal([{ price: 10 }, { price: 5 }])).toBe(15);
76
+ });
77
+ ```
.agents/skills/teach/GLOSSARY-FORMAT.md ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # GLOSSARY.md Format
2
+
3
+ `GLOSSARY.md` is the canonical language for this teaching workspace. All explainers, exercises, and learning records should adhere to its terminology. Building it is itself part of learning: compressing a concept into a tight definition is evidence the user understands it.
4
+
5
+ ## Structure
6
+
7
+ ```md
8
+ # {Topic} Glossary
9
+
10
+ {One or two sentence description of the topic this glossary covers.}
11
+
12
+ ## Terms
13
+
14
+ **Hypertrophy**:
15
+ Muscle growth driven by mechanical tension and metabolic stress over repeated training sessions.
16
+ _Avoid_: Bulking, getting big
17
+
18
+ **Progressive overload**:
19
+ Systematically increasing the demand on a muscle over time β€” via load, volume, or intensity.
20
+ _Avoid_: Pushing harder, levelling up
21
+
22
+ **RPE (Rate of Perceived Exertion)**:
23
+ A 1–10 self-rating of how hard a set felt, where 10 is failure and 8 means two reps left in the tank.
24
+ _Avoid_: Effort score, intensity rating
25
+ ```
26
+
27
+ ## Rules
28
+
29
+ - **Add a term only when the user understands it.** The glossary is a record of compressed knowledge, not a dictionary the user reads to learn. If the user has just been introduced to a concept, wait until they can use it correctly before promoting it here.
30
+ - **Be opinionated.** When several words exist for the same concept, pick the best one and list the rest as aliases to avoid. This is how language compresses.
31
+ - **Keep definitions tight.** One or two sentences. Define what the term IS, not what it does or how to do it.
32
+ - **Use the glossary's own terms inside definitions.** Once a term is in the glossary, prefer it everywhere β€” including inside other definitions. This is what makes complex terms easier to grasp later.
33
+ - **Group under subheadings** when natural clusters emerge (e.g. `## Anatomy`, `## Programming`). A flat list is fine when terms cohere.
34
+ - **Flag ambiguities explicitly.** If a term is used loosely in the wider field, note the resolution: "In this workspace, 'set' always means a working set β€” warm-ups are tracked separately."
35
+ - **Revise as understanding deepens.** A definition the user wrote in week one may be wrong by week six. Update in place; do not leave stale entries.
.agents/skills/teach/LEARNING-RECORD-FORMAT.md ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Learning Record Format
2
+
3
+ Learning records live in `./learning-records/` and use sequential numbering: `0001-slug.md`, `0002-slug.md`, etc. Create the directory lazily β€” only when the first record is written.
4
+
5
+ They are the teaching equivalent of ADRs: they capture non-obvious lessons, key insights, and stated prior knowledge that will steer future sessions. They are used to calculate the zone of proximal development.
6
+
7
+ ## Template
8
+
9
+ ```md
10
+ # {Short title of what was learned or established}
11
+
12
+ {1-3 sentences: what was learned (or what prior knowledge was established), and why it matters for future sessions.}
13
+ ```
14
+
15
+ That is the whole format. A learning record can be a single paragraph. The value is recording _that_ this is now known and _why_ it changes what to teach next β€” not in filling out sections.
16
+
17
+ ## Optional sections
18
+
19
+ Only include these when they add genuine value. Most records won't need them.
20
+
21
+ - **Status** frontmatter (`active | superseded by LR-NNNN`) β€” useful when an earlier understanding turns out to be wrong and is replaced.
22
+ - **Evidence** β€” how the user demonstrated the understanding (a question answered, an exercise completed, prior experience cited). Useful when the claim might be revisited.
23
+ - **Implications** β€” what this unlocks or rules out for future sessions. Worth recording when non-obvious.
24
+
25
+ ## Numbering
26
+
27
+ Scan `./learning-records/` for the highest existing number and increment by one.
28
+
29
+ ## When to write a learning record
30
+
31
+ Write one when any of these is true:
32
+
33
+ 1. **The user demonstrated genuine understanding of something non-trivial** β€” not just exposure, but evidence they can use the concept correctly. This sets a new floor for what to teach next.
34
+ 2. **The user disclosed prior knowledge** β€” "I already know X." Record it so future sessions don't re-teach it. Also record the _depth_ claimed.
35
+ 3. **A misconception was corrected** β€” the user previously believed something wrong and now sees why. These are high-value: they predict future stumbling blocks for related topics.
36
+ 4. **The mission shifted in response to learning** β€” the user discovered they cared about something different than they thought. Cross-link to [[MISSION.md]] and update it.
37
+
38
+ ### What does _not_ qualify
39
+
40
+ - Material that was merely covered. Coverage is not learning. Wait for evidence.
41
+ - Anything already captured tersely in [[GLOSSARY.md]] as a term definition. Don't duplicate.
42
+ - Session-by-session activity logs. Learning records are not a journal β€” they are decision-grade insights.
43
+
44
+ ## Supersession
45
+
46
+ When a later record contradicts an earlier one (the user's understanding deepened or corrected), mark the old record `Status: superseded by LR-NNNN` rather than deleting it. The history of how understanding evolved is itself useful signal.
.agents/skills/teach/MISSION-FORMAT.md ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # MISSION.md Format
2
+
3
+ `MISSION.md` lives at the workspace root. It captures the _reason_ the user is learning this topic. Every teaching decision β€” what to teach next, which resources to surface, which exercises to design β€” should trace back to this document.
4
+
5
+ ## Template
6
+
7
+ ```md
8
+ # Mission: {Topic}
9
+
10
+ ## Why
11
+ {1-3 sentences. The concrete real-world goal the user is chasing. What changes in their life or work when they have this skill? Avoid abstract framings like "to understand X" β€” push for the underlying outcome.}
12
+
13
+ ## Success looks like
14
+ - {A specific, observable thing the user will be able to do}
15
+ - {Another specific thing}
16
+ - {…}
17
+
18
+ ## Constraints
19
+ - {Time, budget, prior commitments, learning preferences, anything that bounds the approach}
20
+
21
+ ## Out of scope
22
+ - {Adjacent topics the user explicitly does not want to chase right now β€” protects the zone of proximal development}
23
+ ```
24
+
25
+ ## Rules
26
+
27
+ - **One mission per workspace.** If the user wants to learn two unrelated things, that is two workspaces.
28
+ - **Concrete over abstract.** "Run a half marathon by October" beats "get fitter." "Ship a Rust CLI to my team" beats "learn Rust."
29
+ - **Push back on vagueness.** If the user cannot articulate why, interview them before writing anything. A bad mission is worse than no mission.
30
+ - **Revise when reality shifts.** Missions change. When the user's goal moves, update this file β€” don't leave a stale mission steering future sessions.
31
+ - **Keep it short.** If `MISSION.md` runs past a screen, it has stopped being a compass and started being a plan.
.agents/skills/teach/RESOURCES-FORMAT.md ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # RESOURCES.md Format
2
+
3
+ `RESOURCES.md` is the curated set of trusted sources for this topic. Knowledge for explainers should be drawn from here, not from parametric guesses. Wisdom comes from the communities listed here.
4
+
5
+ ## Structure
6
+
7
+ ```md
8
+ # {Topic} Resources
9
+
10
+ ## Knowledge
11
+
12
+ - [Book: _The Science and Practice of Strength Training_ β€” Zatsiorsky & Kraemer](https://example.com)
13
+ Foundational text on programming and adaptation. Use for: anything to do with periodisation, recovery, intensity zones.
14
+ - [Article: "How Much Should I Train?" β€” Greg Nuckols (Stronger By Science)](https://example.com)
15
+ Evidence-based review of volume landmarks. Use for: weekly set targets per muscle group.
16
+
17
+ ## Wisdom (Communities)
18
+
19
+ - [r/weightroom](https://reddit.com/r/weightroom)
20
+ High-signal subreddit, moderated against bro-science. Use for: programme critique, plateau troubleshooting.
21
+ - Local: Tuesday strength class at {gym name}
22
+ Use for: real-time coaching feedback on lifts.
23
+ ```
24
+
25
+ ## Rules
26
+
27
+ - **High-trust only.** Prefer primary sources, recognised experts, peer-reviewed work, and communities with strong moderation. If a resource is marketing dressed as education, leave it out.
28
+ - **Annotate every entry.** A bare link is useless in three months. Add one line: what it covers and when to reach for it.
29
+ - **Group by Knowledge / Wisdom.** Mirrors the philosophy in [SKILL.md](./SKILL.md). It is fine for a resource to appear in only one group.
30
+ - **Surface gaps explicitly.** If no good resource exists for an area the mission needs, write a `## Gaps` section listing what is missing. This drives future search.
31
+ - **Prune ruthlessly.** A resource that turned out to be wrong, shallow, or off-mission should be removed, not buried. Better five sharp sources than thirty mediocre ones.
32
+ - **Record community preferences.** If the user has opted out of joining communities, note it here so future sessions don't keep proposing them.
.agents/skills/teach/SKILL.md ADDED
@@ -0,0 +1,136 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ description: "Teach the user a new skill or concept, within this workspace."
3
+ ---
4
+ The user has asked you to teach them something. This is a stateful request - they intend to learn the topic over multiple sessions.
5
+
6
+ ## Teaching Workspace
7
+
8
+ Treat the current directory as a teaching workspace. The state of their learning is captured in this directory in several files:
9
+
10
+ - `MISSION.md`: A document capturing the _reason_ the user is interested in the topic. This should be used to ground all teaching. Use the format in [MISSION-FORMAT.md](./MISSION-FORMAT.md).
11
+ - `./reference/*.html`: A directory of reference materials. These are the compressed learnings from the lessons - cheat sheets, reference algorithms, syntax, yoga poses, glossaries. They are the raw units of learning. They should be beautiful documents which print out well, and are designed for quick reference.
12
+ - `RESOURCES.md`: A list of resources which can be explored to ground your teaching in contextual knowledge, or to acquire knowledge and wisdom. Use the format in [RESOURCES-FORMAT.md](./RESOURCES-FORMAT.md).
13
+ - `./learning-records/*.md`: A directory of learning records, which capture what the user has learned. These are loosely equivalent to architectural decision records in software development - they capture non-obvious lessons and key insights that may need to be revised later, or drive future sessions. These should be used to calculate the zone of proximal development. They are titled `0001-<dash-case-name>.md`, where the number increments each time. Use the format in [LEARNING-RECORD-FORMAT.md](./LEARNING-RECORD-FORMAT.md).
14
+ - `./lessons/*.html`: A directory of lessons. A **lesson** is a single, self-contained HTML output that teaches one tightly-scoped thing tied to the mission. This is the primary unit of teaching in this workspace.
15
+ - `./assets/*`: Reusable **components** shared across lessons. See [Assets](#assets).
16
+ - `NOTES.md`: A scratchpad for you to jot down user preferences, or working notes.
17
+
18
+ ## Philosophy
19
+
20
+ To learn at a deep level, the user needs three things:
21
+
22
+ - **Knowledge**, captured from high-quality, high-trust resources
23
+ - **Skills**, acquired through highly-relevant interactive lessons devised by you, based on the knowledge
24
+ - **Wisdom**, which comes from interacting with other learners and practitioners
25
+
26
+ Before the `RESOURCES.md` is well-populated, your focus should be to find high-quality resources which will help the user acquire knowledge. Never trust your parametric knowledge.
27
+
28
+ Some topics may require more skills than knowledge. Learning more about theoretical physics might be more knowledge-based. For yoga, more skills-based.
29
+
30
+ ### Fluency vs Storage Strength
31
+
32
+ You should be careful to split between two types of learning:
33
+
34
+ - **Fluency strength**: in-the-moment retrieval of knowledge
35
+ - **Storage strength**: long-term retention of knowledge
36
+
37
+ Fluency can give the user an illusory sense of mastery, but storage strength is the real goal. Try to design lessons which build long-term retention by desirable difficulty:
38
+
39
+ - Using retrieval practice (recall from memory)
40
+ - Spacing (distributing practice over time)
41
+ - Interleaving (mixing up different but related topics in practice - for skills practice only)
42
+
43
+ ## Lessons
44
+
45
+ A lesson is the main thing you produce β€” the unit in which knowledge and skills reach the user. Each lesson is one self-contained HTML file, saved to `./lessons/` and titled `0001-<dash-case-name>.html` where the number increments each time.
46
+
47
+ A lesson should be **beautiful** β€” clean, readable typography and layout β€” since the user will return to these later to review. Think Tufte.
48
+
49
+ The lesson should be short, and completable very quickly. Learners' working memory is very small, and we need to stay within it. But each lesson should give the user a single tangible win that they can build on. It should be directly tied to the mission, and should be in the user's zone of proximal development.
50
+
51
+ If possible, open the lesson file for the user by running a CLI command.
52
+
53
+ Each lesson should link via HTML anchors to other lessons and reference documents.
54
+
55
+ Each lesson should recommend a primary source for the user to read or watch. This should be the most high-quality, high-trust resource you found on the topic.
56
+
57
+ Each lesson should contain a reminder to ask followup questions to the agent. The agent is their teacher, and can assist with anything that's unclear.
58
+
59
+ ## Assets
60
+
61
+ Lessons are built from reusable **components**, stored in `./assets/`: stylesheets, quiz widgets, simulators, diagram helpers β€” anything a second lesson could reuse.
62
+
63
+ Reuse is the default, not the exception. Before authoring a lesson, read `./assets/` and build from the components already there. When a lesson needs something new and reusable, write it as a component in `./assets/` and link to it β€” never inline code a future lesson would duplicate.
64
+
65
+ A shared stylesheet is the first component every workspace earns: every lesson links it, so the lessons look like one consistent course rather than a pile of one-offs. As the workspace grows, so should the component library.
66
+
67
+ ## The Mission
68
+
69
+ Every lesson should be tied into the mission - the reason that the user is interested in learning about the topic.
70
+
71
+ If the user is unclear about the mission, or the `MISSION.md` is not populated, your first job should be to question the user on why they want to learn this.
72
+
73
+ Failing to understand the mission will mean knowledge acquisition is not grounded in real-world goals. Lessons will feel too abstract. You will have no way of judging what the user should do next.
74
+
75
+ Missions may change as the user develops more skills and knowledge. This is normal - make sure to update the `MISSION.md` and add a learning record to capture the change. Confirm with the user before changing the mission.
76
+
77
+ ## Zone Of Proximal Development
78
+
79
+ Each lesson, the user should always feel as if they are being challenged 'just enough'.
80
+
81
+ The user may specify an exact thing they want to learn. If they don't, figure out their zone of proximal development by:
82
+
83
+ - Reading their `learning-records`
84
+ - Figuring out the right thing to teach them based on their mission
85
+ - Teach the most relevant thing that fits in their zone of proximal development
86
+
87
+ ## Knowledge
88
+
89
+ Lessons should be designed around a skill the user is going to learn. The knowledge in the lesson should be only what's required to acquire that skill. You teach the knowledge first, then get the user to practice the skills via an interactive feedback loop.
90
+
91
+ Knowledge should first be gathered from trusted resources. Use `RESOURCES.md` to keep track of them. Lessons should be littered with citations - links to external resources to back up any claim made. This increases the trustworthiness of the lesson.
92
+
93
+ For acquiring knowledge, difficulty is the enemy. It eats working memory you need for understanding.
94
+
95
+ ## Skills
96
+
97
+ If knowledge is all about acquisition, skills are about durability and flexibility. Make the knowledge stick.
98
+
99
+ For skill acquisition, difficulty is the tool. Effortful retrieval is what builds storage strength. Skills should be taught through interactive lessons. There are several tools at your disposal:
100
+
101
+ - Interactive lessons, using quizzes and light in-browser tasks
102
+ - Lessons which guide the user through a list of real-world steps to take (for instance, yoga poses)
103
+
104
+ Each of these should be based on a **feedback loop**, where the user receives feedback on their performance. This feedback loop should be as tight as possible, giving feedback immediately - and ideally automatically.
105
+
106
+ For quizzes, each answer should be exactly the same number of words (and characters, if possible). Don't give the user any clues about the answer through formatting.
107
+
108
+ ## Acquiring Wisdom
109
+
110
+ Wisdom comes from true real-world interaction - testing your skills outside the learning environment.
111
+
112
+ When the user asks a question that appears to require wisdom, your default posture should be to attempt to answer - but to ultimately delegate to a **community**.
113
+
114
+ A community is a place (online or offline) where the user can test their skills in the real world. This might be a forum, a subreddit, a real-world class (budget permitting) or a local interest group.
115
+
116
+ You should attempt to find high-reputation communities the user can join. If the user expresses a preference that they don't want to join a community, respect it.
117
+
118
+ ## Reference Documents
119
+
120
+ While creating lessons, you should also create reference documents. Lessons can reference these documents - they are useful for tracking raw units of knowledge useful across lessons.
121
+
122
+ Lessons will rarely be revisited later - reference documents will be. They should be the compressed essence of the lesson, in a format designed for quick reference.
123
+
124
+ Some learning topics lend themselves to reference:
125
+
126
+ - Syntax and code snippets for programming
127
+ - Algorithms and flowcharts for processes
128
+ - Yoga poses and sequences for yoga
129
+ - Exercises and routines for fitness
130
+ - Glossaries for any topic with its own nomenclature
131
+
132
+ Glossaries, in particular, are an essential reference. Once one is created, it should be adhered to in every lesson.
133
+
134
+ ## `NOTES.md`
135
+
136
+ The user will sometimes express preferences of how they want to be taught, or things you should keep in mind. This is the place to record those preferences, so you can refer back to them when designing lessons or working with the user.
.agents/skills/to-issues/SKILL.md ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ description: "Break a plan, spec, or PRD into independently-grabbable issues on the project issue tracker using tracer-bullet vertical slices."
3
+ ---
4
+ # To Issues
5
+
6
+ Break a plan into independently-grabbable issues using vertical slices (tracer bullets).
7
+
8
+ The issue tracker and triage label vocabulary should have been provided to you β€” run `/setup-matt-pocock-skills` if not.
9
+
10
+ ## Process
11
+
12
+ ### 1. Gather context
13
+
14
+ Work from whatever is already in the conversation context. If the user passes an issue reference (issue number, URL, or path) as an argument, fetch it from the issue tracker and read its full body and comments.
15
+
16
+ ### 2. Explore the codebase (optional)
17
+
18
+ If you have not already explored the codebase, do so to understand the current state of the code. Issue titles and descriptions should use the project's domain glossary vocabulary, and respect ADRs in the area you're touching.
19
+
20
+ Look for opportunities to prefactor the code to make the implementation easier. "Make the change easy, then make the easy change."
21
+
22
+ ### 3. Draft vertical slices
23
+
24
+ Break the plan into **tracer bullet** issues. Each issue is a thin vertical slice that cuts through ALL integration layers end-to-end, NOT a horizontal slice of one layer.
25
+
26
+ <vertical-slice-rules>
27
+
28
+ - Each slice delivers a narrow but COMPLETE path through every layer (schema, API, UI, tests)
29
+ - A completed slice is demoable or verifiable on its own
30
+ - Any prefactoring should be done first
31
+
32
+ </vertical-slice-rules>
33
+
34
+ ### 4. Quiz the user
35
+
36
+ Present the proposed breakdown as a numbered list. For each slice, show:
37
+
38
+ - **Title**: short descriptive name
39
+ - **Blocked by**: which other slices (if any) must complete first
40
+ - **User stories covered**: which user stories this addresses (if the source material has them)
41
+
42
+ Ask the user:
43
+
44
+ - Does the granularity feel right? (too coarse / too fine)
45
+ - Are the dependency relationships correct?
46
+ - Should any slices be merged or split further?
47
+
48
+ Iterate until the user approves the breakdown.
49
+
50
+ ### 5. Publish the issues to the issue tracker
51
+
52
+ For each approved slice, publish a new issue to the issue tracker. Use the issue body template below. These issues are considered ready for AFK agents, so publish them with the correct triage label unless instructed otherwise.
53
+
54
+ Publish issues in dependency order (blockers first) so you can reference real issue identifiers in the "Blocked by" field.
55
+
56
+ <issue-template>
57
+ ## Parent
58
+
59
+ A reference to the parent issue on the issue tracker (if the source was an existing issue, otherwise omit this section).
60
+
61
+ ## What to build
62
+
63
+ A concise description of this vertical slice. Describe the end-to-end behavior, not layer-by-layer implementation.
64
+
65
+ Avoid specific file paths or code snippets β€” they go stale fast. Exception: if a prototype produced a snippet that encodes a decision more precisely than prose can (state machine, reducer, schema, type shape), inline it here and note briefly that it came from a prototype. Trim to the decision-rich parts β€” not a working demo, just the important bits.
66
+
67
+ ## Acceptance criteria
68
+
69
+ - [ ] Criterion 1
70
+ - [ ] Criterion 2
71
+ - [ ] Criterion 3
72
+
73
+ ## Blocked by
74
+
75
+ - A reference to the blocking ticket (if any)
76
+
77
+ Or "None - can start immediately" if no blockers.
78
+
79
+ </issue-template>
80
+
81
+ Do NOT close or modify any parent issue.
.agents/skills/to-prd/SKILL.md ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ description: "Turn the current conversation into a PRD and publish it to the project issue tracker β€” no interview, just synthesis of what you've already discussed."
3
+ ---
4
+ This skill takes the current conversation context and codebase understanding and produces a PRD. Do NOT interview the user β€” just synthesize what you already know.
5
+
6
+ The issue tracker and triage label vocabulary should have been provided to you β€” run `/setup-matt-pocock-skills` if not.
7
+
8
+ ## Process
9
+
10
+ 1. Explore the repo to understand the current state of the codebase, if you haven't already. Use the project's domain glossary vocabulary throughout the PRD, and respect any ADRs in the area you're touching.
11
+
12
+ 2. Sketch out the seams at which you're going to test the feature. Existing seams should be preferred to new ones. Use the highest seam possible. If new seams are needed, propose them at the highest point you can. The fewer seams across the codebase, the better - the ideal number is one.
13
+
14
+ Check with the user that these seams match their expectations.
15
+
16
+ 3. Write the PRD using the template below, then publish it to the project issue tracker. Apply the `ready-for-agent` triage label - no need for additional triage.
17
+
18
+ <prd-template>
19
+
20
+ ## Problem Statement
21
+
22
+ The problem that the user is facing, from the user's perspective.
23
+
24
+ ## Solution
25
+
26
+ The solution to the problem, from the user's perspective.
27
+
28
+ ## User Stories
29
+
30
+ A LONG, numbered list of user stories. Each user story should be in the format of:
31
+
32
+ 1. As an <actor>, I want a <feature>, so that <benefit>
33
+
34
+ <user-story-example>
35
+ 1. As a mobile bank customer, I want to see balance on my accounts, so that I can make better informed decisions about my spending
36
+ </user-story-example>
37
+
38
+ This list of user stories should be extremely extensive and cover all aspects of the feature.
39
+
40
+ ## Implementation Decisions
41
+
42
+ A list of implementation decisions that were made. This can include:
43
+
44
+ - The modules that will be built/modified
45
+ - The interfaces of those modules that will be modified
46
+ - Technical clarifications from the developer
47
+ - Architectural decisions
48
+ - Schema changes
49
+ - API contracts
50
+ - Specific interactions
51
+
52
+ Do NOT include specific file paths or code snippets. They may end up being outdated very quickly.
53
+
54
+ Exception: if a prototype produced a snippet that encodes a decision more precisely than prose can (state machine, reducer, schema, type shape), inline it within the relevant decision and note briefly that it came from a prototype. Trim to the decision-rich parts β€” not a working demo, just the important bits.
55
+
56
+ ## Testing Decisions
57
+
58
+ A list of testing decisions that were made. Include:
59
+
60
+ - A description of what makes a good test (only test external behavior, not implementation details)
61
+ - Which modules will be tested
62
+ - Prior art for the tests (i.e. similar types of tests in the codebase)
63
+
64
+ ## Out of Scope
65
+
66
+ A description of the things that are out of scope for this PRD.
67
+
68
+ ## Further Notes
69
+
70
+ Any further notes about the feature.
71
+
72
+ </prd-template>
.agents/skills/triage/AGENT-BRIEF.md ADDED
@@ -0,0 +1,207 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Writing Agent Briefs
2
+
3
+ An agent brief is a structured comment posted on a GitHub issue or PR when it moves to `ready-for-agent`. It is the authoritative specification that an AFK agent will work from. The original body and discussion are context β€” the agent brief is the contract.
4
+
5
+ The brief states **what the agent should do**, which stretches to both surfaces: for an issue, that's building the change from nothing; for a PR, it's what's left to do *to the existing diff* β€” finish it, close gaps, address review points. Same principles either way; the PR example below shows the difference.
6
+
7
+ ## Principles
8
+
9
+ ### Durability over precision
10
+
11
+ The issue may sit in `ready-for-agent` for days or weeks. The codebase will change in the meantime. Write the brief so it stays useful even as files are renamed, moved, or refactored.
12
+
13
+ - **Do** describe interfaces, types, and behavioral contracts
14
+ - **Do** name specific types, function signatures, or config shapes that the agent should look for or modify
15
+ - **Don't** reference file paths β€” they go stale
16
+ - **Don't** reference line numbers
17
+ - **Don't** assume the current implementation structure will remain the same
18
+
19
+ ### Behavioral, not procedural
20
+
21
+ Describe **what** the system should do, not **how** to implement it. The agent will explore the codebase fresh and make its own implementation decisions.
22
+
23
+ - **Good:** "The `SkillConfig` type should accept an optional `schedule` field of type `CronExpression`"
24
+ - **Bad:** "Open src/types/skill.ts and add a schedule field on line 42"
25
+ - **Good:** "When a user runs `/triage` with no arguments, they should see a summary of issues needing attention"
26
+ - **Bad:** "Add a switch statement in the main handler function"
27
+
28
+ ### Complete acceptance criteria
29
+
30
+ The agent needs to know when it's done. Every agent brief must have concrete, testable acceptance criteria. Each criterion should be independently verifiable.
31
+
32
+ - **Good:** "Running `gh issue list --label needs-triage` returns issues that have been through initial classification"
33
+ - **Bad:** "Triage should work correctly"
34
+
35
+ ### Explicit scope boundaries
36
+
37
+ State what is out of scope. This prevents the agent from gold-plating or making assumptions about adjacent features.
38
+
39
+ ## Template
40
+
41
+ ```markdown
42
+ ## Agent Brief
43
+
44
+ **Category:** bug / enhancement
45
+ **Summary:** one-line description of what needs to happen
46
+
47
+ **Current behavior:**
48
+ Describe what happens now. For bugs, this is the broken behavior.
49
+ For enhancements, this is the status quo the feature builds on.
50
+
51
+ **Desired behavior:**
52
+ Describe what should happen after the agent's work is complete.
53
+ Be specific about edge cases and error conditions.
54
+
55
+ **Key interfaces:**
56
+ - `TypeName` β€” what needs to change and why
57
+ - `functionName()` return type β€” what it currently returns vs what it should return
58
+ - Config shape β€” any new configuration options needed
59
+
60
+ **Acceptance criteria:**
61
+ - [ ] Specific, testable criterion 1
62
+ - [ ] Specific, testable criterion 2
63
+ - [ ] Specific, testable criterion 3
64
+
65
+ **Out of scope:**
66
+ - Thing that should NOT be changed or addressed in this issue
67
+ - Adjacent feature that might seem related but is separate
68
+ ```
69
+
70
+ ## Examples
71
+
72
+ ### Good agent brief (bug)
73
+
74
+ ```markdown
75
+ ## Agent Brief
76
+
77
+ **Category:** bug
78
+ **Summary:** Skill description truncation drops mid-word, producing broken output
79
+
80
+ **Current behavior:**
81
+ When a skill description exceeds 1024 characters, it is truncated at exactly
82
+ 1024 characters regardless of word boundaries. This produces descriptions
83
+ that end mid-word (e.g. "Use when the user wants to confi").
84
+
85
+ **Desired behavior:**
86
+ Truncation should break at the last word boundary before 1024 characters
87
+ and append "..." to indicate truncation.
88
+
89
+ **Key interfaces:**
90
+ - The `SkillMetadata` type's `description` field β€” no type change needed,
91
+ but the validation/processing logic that populates it needs to respect
92
+ word boundaries
93
+ - Any function that reads SKILL.md frontmatter and extracts the description
94
+
95
+ **Acceptance criteria:**
96
+ - [ ] Descriptions under 1024 chars are unchanged
97
+ - [ ] Descriptions over 1024 chars are truncated at the last word boundary
98
+ before 1024 chars
99
+ - [ ] Truncated descriptions end with "..."
100
+ - [ ] The total length including "..." does not exceed 1024 chars
101
+
102
+ **Out of scope:**
103
+ - Changing the 1024 char limit itself
104
+ - Multi-line description support
105
+ ```
106
+
107
+ ### Good agent brief (enhancement)
108
+
109
+ ```markdown
110
+ ## Agent Brief
111
+
112
+ **Category:** enhancement
113
+ **Summary:** Add `.out-of-scope/` directory support for tracking rejected feature requests
114
+
115
+ **Current behavior:**
116
+ When a feature request is rejected, the issue is closed with a `wontfix` label
117
+ and a comment. There is no persistent record of the decision or reasoning.
118
+ Future similar requests require the maintainer to recall or search for the
119
+ prior discussion.
120
+
121
+ **Desired behavior:**
122
+ Rejected feature requests should be documented in `.out-of-scope/<concept>.md`
123
+ files that capture the decision, reasoning, and links to all issues that
124
+ requested the feature. When triaging new issues, these files should be
125
+ checked for matches.
126
+
127
+ **Key interfaces:**
128
+ - Markdown file format in `.out-of-scope/` β€” each file should have a
129
+ `# Concept Name` heading, a `**Decision:**` line, a `**Reason:**` line,
130
+ and a `**Prior requests:**` list with issue links
131
+ - The triage workflow should read all `.out-of-scope/*.md` files early
132
+ and match incoming issues against them by concept similarity
133
+
134
+ **Acceptance criteria:**
135
+ - [ ] Closing a feature as wontfix creates/updates a file in `.out-of-scope/`
136
+ - [ ] The file includes the decision, reasoning, and link to the closed issue
137
+ - [ ] If a matching `.out-of-scope/` file already exists, the new issue is
138
+ appended to its "Prior requests" list rather than creating a duplicate
139
+ - [ ] During triage, existing `.out-of-scope/` files are checked and surfaced
140
+ when a new issue matches a prior rejection
141
+
142
+ **Out of scope:**
143
+ - Automated matching (human confirms the match)
144
+ - Reopening previously rejected features
145
+ - Bug reports (only enhancement rejections go to `.out-of-scope/`)
146
+ ```
147
+
148
+ ### Good agent brief (PR)
149
+
150
+ For a PR, "Current behavior" describes the state of the diff, and the brief asks the agent to finish or fix it rather than build from scratch.
151
+
152
+ ```markdown
153
+ ## Agent Brief
154
+
155
+ **Category:** enhancement
156
+ **Summary:** Finish the contributor's `--json` output flag for `triage list`
157
+
158
+ **Current behavior:**
159
+ The PR adds a `--json` flag that serializes the issue list to JSON. The happy
160
+ path works and the diff matches the project's command structure. Two gaps
161
+ remain: errors are still printed as human text (not JSON), and the new flag has
162
+ no test coverage.
163
+
164
+ **Desired behavior:**
165
+ With `--json`, all output β€” including errors β€” is well-formed JSON on stdout,
166
+ and the command's exit codes are unchanged. The existing human-readable output
167
+ is untouched when the flag is absent.
168
+
169
+ **Key interfaces:**
170
+ - The command's error path should emit `{ "error": string }` under `--json`
171
+ instead of the plain-text error
172
+ - Reuse the existing serializer the PR already added; don't introduce a second
173
+
174
+ **Acceptance criteria:**
175
+ - [ ] `triage list --json` emits valid JSON for both success and error cases
176
+ - [ ] Exit codes match the non-JSON command
177
+ - [ ] A test covers the `--json` success output and one error case
178
+ - [ ] Default (non-JSON) output is byte-for-byte unchanged
179
+
180
+ **Out of scope:**
181
+ - Adding `--json` to any other command
182
+ - Changing the JSON shape of the success payload the PR already defined
183
+ ```
184
+
185
+ ### Bad agent brief
186
+
187
+ ```markdown
188
+ ## Agent Brief
189
+
190
+ **Summary:** Fix the triage bug
191
+
192
+ **What to do:**
193
+ The triage thing is broken. Look at the main file and fix it.
194
+ The function around line 150 has the issue.
195
+
196
+ **Files to change:**
197
+ - src/triage/handler.ts (line 150)
198
+ - src/types.ts (line 42)
199
+ ```
200
+
201
+ This is bad because:
202
+ - No category
203
+ - Vague description ("the triage thing is broken")
204
+ - References file paths and line numbers that will go stale
205
+ - No acceptance criteria
206
+ - No scope boundaries
207
+ - No description of current vs desired behavior
.agents/skills/triage/OUT-OF-SCOPE.md ADDED
@@ -0,0 +1,105 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Out-of-Scope Knowledge Base
2
+
3
+ The `.out-of-scope/` directory in a repo stores persistent records of rejected feature requests. It serves two purposes:
4
+
5
+ 1. **Institutional memory** β€” why a feature was rejected, so the reasoning isn't lost when the issue is closed
6
+ 2. **Deduplication** β€” when a new issue comes in that matches a prior rejection, the skill can surface the previous decision instead of re-litigating it
7
+
8
+ ## Directory structure
9
+
10
+ ```
11
+ .out-of-scope/
12
+ β”œβ”€β”€ dark-mode.md
13
+ β”œβ”€β”€ plugin-system.md
14
+ └── graphql-api.md
15
+ ```
16
+
17
+ One file per **concept**, not per issue. Multiple issues requesting the same thing are grouped under one file.
18
+
19
+ ## File format
20
+
21
+ The file should be written in a relaxed, readable style β€” more like a short design document than a database entry. Use paragraphs, code samples, and examples to make the reasoning clear and useful to someone encountering it for the first time.
22
+
23
+ ```markdown
24
+ # Dark Mode
25
+
26
+ This project does not support dark mode or user-facing theming.
27
+
28
+ ## Why this is out of scope
29
+
30
+ The rendering pipeline assumes a single color palette defined in
31
+ `ThemeConfig`. Supporting multiple themes would require:
32
+
33
+ - A theme context provider wrapping the entire component tree
34
+ - Per-component theme-aware style resolution
35
+ - A persistence layer for user theme preferences
36
+
37
+ This is a significant architectural change that doesn't align with the
38
+ project's focus on content authoring. Theming is a concern for downstream
39
+ consumers who embed or redistribute the output.
40
+
41
+ ```ts
42
+ // The current ThemeConfig interface is not designed for runtime switching:
43
+ interface ThemeConfig {
44
+ colors: ColorPalette; // single palette, resolved at build time
45
+ fonts: FontStack;
46
+ }
47
+ ```
48
+
49
+ ## Prior requests
50
+
51
+ - #42 β€” "Add dark mode support"
52
+ - #87 β€” "Night theme for accessibility"
53
+ - #134 β€” "Dark theme option"
54
+ ```
55
+
56
+ ### Naming the file
57
+
58
+ Use a short, descriptive kebab-case name for the concept: `dark-mode.md`, `plugin-system.md`, `graphql-api.md`. The name should be recognizable enough that someone browsing the directory understands what was rejected without opening the file.
59
+
60
+ ### Writing the reason
61
+
62
+ The reason should be substantive β€” not "we don't want this" but why. Good reasons reference:
63
+
64
+ - Project scope or philosophy ("This project focuses on X; theming is a downstream concern")
65
+ - Technical constraints ("Supporting this would require Y, which conflicts with our Z architecture")
66
+ - Strategic decisions ("We chose to use A instead of B because...")
67
+
68
+ The reason should be durable. Avoid referencing temporary circumstances ("we're too busy right now") β€” those aren't real rejections, they're deferrals.
69
+
70
+ ## When to check `.out-of-scope/`
71
+
72
+ During triage (Step 1: Gather context), read all files in `.out-of-scope/`. When evaluating a new issue:
73
+
74
+ - Check if the request matches an existing out-of-scope concept
75
+ - Matching is by concept similarity, not keyword β€” "night theme" matches `dark-mode.md`
76
+ - If there's a match, surface it to the maintainer: "This is similar to `.out-of-scope/dark-mode.md` β€” we rejected this before because [reason]. Do you still feel the same way?"
77
+
78
+ The maintainer may:
79
+
80
+ - **Confirm** β€” the new issue gets added to the existing file's "Prior requests" list, then closed
81
+ - **Reconsider** β€” the out-of-scope file gets deleted or updated, and the issue proceeds through normal triage
82
+ - **Disagree** β€” the issues are related but distinct, proceed with normal triage
83
+
84
+ ## When to write to `.out-of-scope/`
85
+
86
+ Only when an **enhancement** (not a bug) is *rejected* as `wontfix`. This applies to enhancement PRs exactly as it does to issues β€” a rejected PR is recorded here so the same request doesn't return as fresh code.
87
+
88
+ Do **not** write here when something is closed as `wontfix` because it's **already implemented**. That's a built feature, not a rejected one; recording it would poison the dedup checks with false rejections. Instead, the closing comment points to where the feature already lives.
89
+
90
+ The flow:
91
+
92
+ 1. Maintainer decides a feature request is out of scope
93
+ 2. Check if a matching `.out-of-scope/` file already exists
94
+ 3. If yes: append the new issue to the "Prior requests" list
95
+ 4. If no: create a new file with the concept name, decision, reason, and first prior request
96
+ 5. Post a comment on the issue explaining the decision and mentioning the `.out-of-scope/` file
97
+ 6. Close the issue with the `wontfix` label
98
+
99
+ ## Updating or removing out-of-scope files
100
+
101
+ If the maintainer changes their mind about a previously rejected concept:
102
+
103
+ - Delete the `.out-of-scope/` file
104
+ - The skill does not need to reopen old issues β€” they're historical records
105
+ - The new issue that triggered the reconsideration proceeds through normal triage