{"owner":"GreyDGL","repo":"PentestGPT","hasSkills":true,"totalSkillsCount":41,"totalTokensCount":37382,"categories":["anthropic-skill","claude-rule","project-spec"],"hasMcp":false,"mcpConfig":null,"found":[".agents/skills/ask-matt/SKILL.md",".agents/skills/codebase-design/DEEPENING.md",".agents/skills/codebase-design/DESIGN-IT-TWICE.md",".agents/skills/codebase-design/SKILL.md",".agents/skills/diagnosing-bugs/SKILL.md",".agents/skills/domain-modeling/ADR-FORMAT.md",".agents/skills/domain-modeling/CONTEXT-FORMAT.md",".agents/skills/domain-modeling/SKILL.md",".agents/skills/grill-me/SKILL.md",".agents/skills/grill-with-docs/SKILL.md",".agents/skills/grilling/SKILL.md",".agents/skills/handoff/SKILL.md",".agents/skills/improve-codebase-architecture/HTML-REPORT.md",".agents/skills/improve-codebase-architecture/SKILL.md",".agents/skills/prototype/LOGIC.md",".agents/skills/prototype/SKILL.md",".agents/skills/prototype/UI.md",".agents/skills/setup-matt-pocock-skills/SKILL.md",".agents/skills/setup-matt-pocock-skills/domain.md",".agents/skills/setup-matt-pocock-skills/issue-tracker-github.md",".agents/skills/setup-matt-pocock-skills/issue-tracker-gitlab.md",".agents/skills/setup-matt-pocock-skills/issue-tracker-local.md",".agents/skills/setup-matt-pocock-skills/triage-labels.md",".agents/skills/tdd/SKILL.md",".agents/skills/tdd/mocking.md",".agents/skills/tdd/refactoring.md",".agents/skills/tdd/tests.md",".agents/skills/teach/GLOSSARY-FORMAT.md",".agents/skills/teach/LEARNING-RECORD-FORMAT.md",".agents/skills/teach/MISSION-FORMAT.md",".agents/skills/teach/RESOURCES-FORMAT.md",".agents/skills/teach/SKILL.md",".agents/skills/to-issues/SKILL.md",".agents/skills/to-prd/SKILL.md",".agents/skills/triage/AGENT-BRIEF.md",".agents/skills/triage/OUT-OF-SCOPE.md",".agents/skills/triage/SKILL.md",".agents/skills/writing-great-skills/GLOSSARY.md",".agents/skills/writing-great-skills/SKILL.md","CLAUDE.md","docs/architecture.md"],"skills":{".agents/skills/ask-matt/SKILL.md":"---\nname: ask-matt\ndescription: Ask which skill or flow fits your situation. A router over the user-invoked skills in this repo.\ndisable-model-invocation: true\n---\n\n# Ask Matt\n\nYou don't remember every skill, so ask.\n\nA **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.\n\n## The main flow: idea → ship\n\nThe route most work travels. You have an idea and want it built.\n\n1. **`/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.)\n2. **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):\n   - **`/handoff`** out, then open a fresh session against that file,\n   - **`/prototype`** to answer the question with throwaway code,\n   - **`/handoff`** back what you learned, and reference it from the original idea thread.\n3. **Branch — is this a multi-session build?**\n   - **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.\n   - **No** → **`/implement`** right here, in the same context window.\n\n### Context hygiene\n\nKeep 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.\n\nThe 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.\n\n## On-ramps\n\nA starting situation that generates work, then merges onto the main flow.\n\n- **Bugs and requests piling up** → **`/triage`**. It moves issues through triage roles and produces agent-ready issues, which **`/implement`** later picks up.\n\n  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**.\n\n## Codebase health\n\nNot feature work — upkeep.\n\n- **`/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`.\n\n## Crossing sessions\n\n- **`/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**.\n- **`/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.\n\n## Standalone\n\nOff the main flow entirely.\n\n- **`/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.\n- **`/teach`** — learn a concept over multiple sessions, using the current directory as a stateful workspace.\n- **`/writing-great-skills`** — reference for writing and editing skills well.\n\n## Precondition\n\n**`/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.\n",".agents/skills/codebase-design/DEEPENING.md":"# Deepening\n\nHow to deepen a cluster of shallow modules safely, given its dependencies. Assumes the vocabulary in [SKILL.md](SKILL.md) — **module**, **interface**, **seam**, **adapter**.\n\n## Dependency categories\n\nWhen assessing a candidate for deepening, classify its dependencies. The category determines how the deepened module is tested across its seam.\n\n### 1. In-process\n\nPure computation, in-memory state, no I/O. Always deepenable — merge the modules and test through the new interface directly. No adapter needed.\n\n### 2. Local-substitutable\n\nDependencies 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.\n\n### 3. Remote but owned (Ports & Adapters)\n\nYour 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.\n\nRecommendation 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.\"*\n\n### 4. True external (Mock)\n\nThird-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.\n\n## Seam discipline\n\n- **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.\n- **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.\n\n## Testing strategy: replace, don't layer\n\n- Old unit tests on shallow modules become waste once tests at the deepened module's interface exist — delete them.\n- Write new tests at the deepened module's interface. The **interface is the test surface**.\n- Tests assert on observable outcomes through the interface, not internal state.\n- 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.\n",".agents/skills/codebase-design/DESIGN-IT-TWICE.md":"# Design It Twice\n\nWhen 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.\n\nUses the vocabulary in [SKILL.md](SKILL.md) — **module**, **interface**, **seam**, **adapter**, **leverage**.\n\n## Process\n\n### 1. Frame the problem space\n\nBefore spawning sub-agents, write a user-facing explanation of the problem space for the chosen candidate:\n\n- The constraints any new interface would need to satisfy\n- The dependencies it would rely on, and which category they fall into (see [DEEPENING.md](DEEPENING.md))\n- A rough illustrative code sketch to ground the constraints — not a proposal, just a way to make the constraints concrete\n\nShow this to the user, then immediately proceed to Step 2. The user reads and thinks while the sub-agents work in parallel.\n\n### 2. Spawn sub-agents\n\nSpawn 3+ sub-agents in parallel using the Agent tool. Each must produce a **radically different** interface for the deepened module.\n\nPrompt 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:\n\n- Agent 1: \"Minimize the interface — aim for 1–3 entry points max. Maximise leverage per entry point.\"\n- Agent 2: \"Maximise flexibility — support many use cases and extension.\"\n- Agent 3: \"Optimise for the most common caller — make the default case trivial.\"\n- Agent 4 (if applicable): \"Design around ports & adapters for cross-seam dependencies.\"\n\nInclude 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.\n\nEach sub-agent outputs:\n\n1. Interface (types, methods, params — plus invariants, ordering, error modes)\n2. Usage example showing how callers use it\n3. What the implementation hides behind the seam\n4. Dependency strategy and adapters (see [DEEPENING.md](DEEPENING.md))\n5. Trade-offs — where leverage is high, where it's thin\n\n### 3. Present and compare\n\nPresent 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**.\n\nAfter 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.\n",".agents/skills/codebase-design/SKILL.md":"---\nname: codebase-design\ndescription: 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.\n---\n\n# Codebase Design\n\nDesign **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.\n\n## Glossary\n\nUse these terms exactly — don't substitute \"component,\" \"service,\" \"API,\" or \"boundary.\" Consistent language is the whole point.\n\n**Module** — anything with an interface and an implementation. Deliberately scale-agnostic: a function, class, package, or tier-spanning slice. _Avoid_: unit, component, service.\n\n**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).\n\n**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.\n\n**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.\n\n**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).\n\n**Adapter** — a concrete thing that satisfies an interface at a seam. Describes *role* (what slot it fills), not substance (what's inside).\n\n**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.\n\n**Locality** — what maintainers get from depth: change, bugs, knowledge, and verification concentrate in one place rather than spreading across callers. Fix once, fixed everywhere.\n\n## Deep vs shallow\n\n**Deep module** = small interface + lots of implementation:\n\n```\n┌─────────────────────┐\n│   Small Interface   │  ← Few methods, simple params\n├─────────────────────┤\n│                     │\n│  Deep Implementation│  ← Complex logic hidden\n│                     │\n└─────────────────────┘\n```\n\n**Shallow module** = large interface + little implementation (avoid):\n\n```\n┌─────────────────────────────────┐\n│       Large Interface           │  ← Many methods, complex params\n├─────────────────────────────────┤\n│  Thin Implementation            │  ← Just passes through\n└─────────────────────────────────┘\n```\n\nWhen designing an interface, ask:\n\n- Can I reduce the number of methods?\n- Can I simplify the parameters?\n- Can I hide more complexity inside?\n\n## Principles\n\n- **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.\n- **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.\n- **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.\n- **One adapter means a hypothetical seam. Two adapters means a real one.** Don't introduce a seam unless something actually varies across it.\n\n## Designing for testability\n\nGood interfaces make testing natural:\n\n1. **Accept dependencies, don't create them.**\n\n   ```typescript\n   // Testable\n   function processOrder(order, paymentGateway) {}\n\n   // Hard to test\n   function processOrder(order) {\n     const gateway = new StripeGateway();\n   }\n   ```\n\n2. **Return results, don't produce side effects.**\n\n   ```typescript\n   // Testable\n   function calculateDiscount(cart): Discount {}\n\n   // Hard to test\n   function applyDiscount(cart): void {\n     cart.total -= discount;\n   }\n   ```\n\n3. **Small surface area.** Fewer methods = fewer tests needed. Fewer params = simpler test setup.\n\n## Relationships\n\n- A **Module** has exactly one **Interface** (the surface it presents to callers and tests).\n- **Depth** is a property of a **Module**, measured against its **Interface**.\n- A **Seam** is where a **Module**'s **Interface** lives.\n- An **Adapter** sits at a **Seam** and satisfies the **Interface**.\n- **Depth** produces **Leverage** for callers and **Locality** for maintainers.\n\n## Rejected framings\n\n- **Depth as ratio of implementation-lines to interface-lines** (Ousterhout): rewards padding the implementation. We use depth-as-leverage instead.\n- **\"Interface\" as the TypeScript `interface` keyword or a class's public methods**: too narrow — interface here includes every fact a caller must know.\n- **\"Boundary\"**: overloaded with DDD's bounded context. Say **seam** or **interface**.\n\n## Going deeper\n\n- **Deepening a cluster given its dependencies** — see [DEEPENING.md](DEEPENING.md): dependency categories, seam discipline, and replace-don't-layer testing.\n- **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.\n",".agents/skills/diagnosing-bugs/SKILL.md":"---\nname: diagnosing-bugs\ndescription: Diagnosis loop for hard bugs and performance regressions. Use when the user says \"diagnose\"/\"debug this\", or reports something broken/throwing/failing/slow.\n---\n\n# Diagnosing Bugs\n\nA discipline for hard bugs. Skip phases only when explicitly justified.\n\nWhen 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.\n\n## Phase 1 — Build a feedback loop\n\n**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.\n\nSpend disproportionate effort here. **Be aggressive. Be creative. Refuse to give up.**\n\n### Ways to construct one — try them in roughly this order\n\n1. **Failing test** at whatever seam reaches the bug — unit, integration, e2e.\n2. **Curl / HTTP script** against a running dev server.\n3. **CLI invocation** with a fixture input, diffing stdout against a known-good snapshot.\n4. **Headless browser script** (Playwright / Puppeteer) — drives the UI, asserts on DOM/console/network.\n5. **Replay a captured trace.** Save a real network request / payload / event log to disk; replay it through the code path in isolation.\n6. **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.\n7. **Property / fuzz loop.** If the bug is \"sometimes wrong output\", run 1000 random inputs and look for the failure mode.\n8. **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.\n9. **Differential loop.** Run the same input through old-version vs new-version (or two configs) and diff outputs.\n10. **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.\n\nBuild the right feedback loop, and the bug is 90% fixed.\n\n### Tighten the loop\n\nTreat the loop as a product. Once you have _a_ loop, **tighten** it:\n\n- Can I make it faster? (Cache setup, skip unrelated init, narrow the test scope.)\n- Can I make the signal sharper? (Assert on the specific symptom, not \"didn't crash\".)\n- Can I make it more deterministic? (Pin time, seed RNG, isolate filesystem, freeze network.)\n\nA 30-second flaky loop is barely better than no loop; a 2-second deterministic one is tight — a debugging superpower.\n\n### Non-deterministic bugs\n\nThe 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.\n\n### When you genuinely cannot build a loop\n\nStop 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.\n\n### Completion criterion — a tight loop that goes red\n\nPhase 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:\n\n- [ ] **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_.\n- [ ] **Deterministic** — same verdict every run (flaky bugs: a pinned, high reproduction rate, per above).\n- [ ] **Fast** — seconds, not minutes.\n- [ ] **Agent-runnable** — you can run it unattended; a human in the loop only via `scripts/hitl-loop.template.sh`.\n\nIf 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.\n\n## Phase 2 — Reproduce + minimise\n\nRun the loop. Watch it go red — the bug appears.\n\nConfirm:\n\n- [ ] The loop produces the failure mode the **user** described — not a different failure that happens to be nearby. Wrong bug = wrong fix.\n- [ ] The failure is reproducible across multiple runs (or, for non-deterministic bugs, reproducible at a high enough rate to debug against).\n- [ ] You have captured the exact symptom (error message, wrong output, slow timing) so later phases can verify the fix actually addresses it.\n\n### Minimise\n\nOnce 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.\n\nWhy 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.\n\nDone when **every remaining element is load-bearing** — removing any one of them makes the loop go green.\n\nDo not proceed until you have reproduced **and** minimised.\n\n## Phase 3 — Hypothesise\n\nGenerate **3–5 ranked hypotheses** before testing any of them. Single-hypothesis generation anchors on the first plausible idea.\n\nEach hypothesis must be **falsifiable**: state the prediction it makes.\n\n> Format: \"If <X> is the cause, then <changing Y> will make the bug disappear / <changing Z> will make it worse.\"\n\nIf you cannot state the prediction, the hypothesis is a vibe — discard or sharpen it.\n\n**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.\n\n## Phase 4 — Instrument\n\nEach probe must map to a specific prediction from Phase 3. **Change one variable at a time.**\n\nTool preference:\n\n1. **Debugger / REPL inspection** if the env supports it. One breakpoint beats ten logs.\n2. **Targeted logs** at the boundaries that distinguish hypotheses.\n3. Never \"log everything and grep\".\n\n**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.\n\n**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.\n\n## Phase 5 — Fix + regression test\n\nWrite the regression test **before the fix** — but only if there is a **correct seam** for it.\n\nA 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.\n\n**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.\n\nIf a correct seam exists:\n\n1. Turn the minimised repro into a failing test at that seam.\n2. Watch it fail.\n3. Apply the fix.\n4. Watch it pass.\n5. Re-run the Phase 1 feedback loop against the original (un-minimised) scenario.\n\n## Phase 6 — Cleanup + post-mortem\n\nRequired before declaring done:\n\n- [ ] Original repro no longer reproduces (re-run the Phase 1 loop)\n- [ ] Regression test passes (or absence of seam is documented)\n- [ ] All `[DEBUG-...]` instrumentation removed (`grep` the prefix)\n- [ ] Throwaway prototypes deleted (or moved to a clearly-marked debug location)\n- [ ] The hypothesis that turned out correct is stated in the commit / PR message — so the next debugger learns\n\n**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.\n",".agents/skills/domain-modeling/ADR-FORMAT.md":"# ADR Format\n\nADRs live in `docs/adr/` and use sequential numbering: `0001-slug.md`, `0002-slug.md`, etc.\n\nCreate the `docs/adr/` directory lazily — only when the first ADR is needed.\n\n## Template\n\n```md\n# {Short title of the decision}\n\n{1-3 sentences: what's the context, what did we decide, and why.}\n```\n\nThat'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.\n\n## Optional sections\n\nOnly include these when they add genuine value. Most ADRs won't need them.\n\n- **Status** frontmatter (`proposed | accepted | deprecated | superseded by ADR-NNNN`) — useful when decisions are revisited\n- **Considered Options** — only when the rejected alternatives are worth remembering\n- **Consequences** — only when non-obvious downstream effects need to be called out\n\n## Numbering\n\nScan `docs/adr/` for the highest existing number and increment by one.\n\n## When to offer an ADR\n\nAll three of these must be true:\n\n1. **Hard to reverse** — the cost of changing your mind later is meaningful\n2. **Surprising without context** — a future reader will look at the code and wonder \"why on earth did they do it this way?\"\n3. **The result of a real trade-off** — there were genuine alternatives and you picked one for specific reasons\n\nIf 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.\"\n\n### What qualifies\n\n- **Architectural shape.** \"We're using a monorepo.\" \"The write model is event-sourced, the read model is projected into Postgres.\"\n- **Integration patterns between contexts.** \"Ordering and Billing communicate via domain events, not synchronous HTTP.\"\n- **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.\n- **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.\n- **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.\n- **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.\"\n- **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.\n",".agents/skills/domain-modeling/CONTEXT-FORMAT.md":"# CONTEXT.md Format\n\n## Structure\n\n```md\n# {Context Name}\n\n{One or two sentence description of what this context is and why it exists.}\n\n## Language\n\n**Order**:\n{A one or two sentence description of the term}\n_Avoid_: Purchase, transaction\n\n**Invoice**:\nA request for payment sent to a customer after delivery.\n_Avoid_: Bill, payment request\n\n**Customer**:\nA person or organization that places orders.\n_Avoid_: Client, buyer, account\n```\n\n## Rules\n\n- **Be opinionated.** When multiple words exist for the same concept, pick the best one and list the others under `_Avoid_`.\n- **Keep definitions tight.** One or two sentences max. Define what it IS, not what it does.\n- **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.\n- **Group terms under subheadings** when natural clusters emerge. If all terms belong to a single cohesive area, a flat list is fine.\n\n## Single vs multi-context repos\n\n**Single context (most repos):** One `CONTEXT.md` at the repo root.\n\n**Multiple contexts:** A `CONTEXT-MAP.md` at the repo root lists the contexts, where they live, and how they relate to each other:\n\n```md\n# Context Map\n\n## Contexts\n\n- [Ordering](./src/ordering/CONTEXT.md) — receives and tracks customer orders\n- [Billing](./src/billing/CONTEXT.md) — generates invoices and processes payments\n- [Fulfillment](./src/fulfillment/CONTEXT.md) — manages warehouse picking and shipping\n\n## Relationships\n\n- **Ordering → Fulfillment**: Ordering emits `OrderPlaced` events; Fulfillment consumes them to start picking\n- **Fulfillment → Billing**: Fulfillment emits `ShipmentDispatched` events; Billing consumes them to generate invoices\n- **Ordering ↔ Billing**: Shared types for `CustomerId` and `Money`\n```\n\nThe skill infers which structure applies:\n\n- If `CONTEXT-MAP.md` exists, read it to find contexts\n- If only a root `CONTEXT.md` exists, single context\n- If neither exists, create a root `CONTEXT.md` lazily when the first term is resolved\n\nWhen multiple contexts exist, infer which one the current topic relates to. If unclear, ask.\n",".agents/skills/domain-modeling/SKILL.md":"---\nname: domain-modeling\ndescription: 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.\n---\n\n# Domain Modeling\n\nActively 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.)\n\n## File structure\n\nMost repos have a single context:\n\n```\n/\n├── CONTEXT.md\n├── docs/\n│   └── adr/\n│       ├── 0001-event-sourced-orders.md\n│       └── 0002-postgres-for-write-model.md\n└── src/\n```\n\nIf a `CONTEXT-MAP.md` exists at the root, the repo has multiple contexts. The map points to where each one lives:\n\n```\n/\n├── CONTEXT-MAP.md\n├── docs/\n│   └── adr/                          ← system-wide decisions\n├── src/\n│   ├── ordering/\n│   │   ├── CONTEXT.md\n│   │   └── docs/adr/                 ← context-specific decisions\n│   └── billing/\n│       ├── CONTEXT.md\n│       └── docs/adr/\n```\n\nCreate 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.\n\n## During the session\n\n### Challenge against the glossary\n\nWhen 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?\"\n\n### Sharpen fuzzy language\n\nWhen 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.\"\n\n### Discuss concrete scenarios\n\nWhen 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.\n\n### Cross-reference with code\n\nWhen 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?\"\n\n### Update CONTEXT.md inline\n\nWhen 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).\n\n`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.\n\n### Offer ADRs sparingly\n\nOnly offer to create an ADR when all three are true:\n\n1. **Hard to reverse** — the cost of changing your mind later is meaningful\n2. **Surprising without context** — a future reader will wonder \"why did they do it this way?\"\n3. **The result of a real trade-off** — there were genuine alternatives and you picked one for specific reasons\n\nIf any of the three is missing, skip the ADR. Use the format in [ADR-FORMAT.md](./ADR-FORMAT.md).\n",".agents/skills/grill-me/SKILL.md":"---\nname: grill-me\ndescription: A relentless interview to sharpen a plan or design.\ndisable-model-invocation: true\n---\n\nRun a `/grilling` session.\n",".agents/skills/grill-with-docs/SKILL.md":"---\nname: grill-with-docs\ndescription: A relentless interview to sharpen a plan or design, which also creates docs (ADR's and glossary) as we go.\ndisable-model-invocation: true\n---\n\nRun a `/grilling` session, using the `/domain-modeling` skill.\n",".agents/skills/grilling/SKILL.md":"---\nname: grilling\ndescription: 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.\n---\n\nInterview 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.\n\nAsk the questions one at a time, waiting for feedback on each question before continuing. Asking multiple questions at once is bewildering.\n\nIf a question can be answered by exploring the codebase, explore the codebase instead.\n",".agents/skills/handoff/SKILL.md":"---\nname: handoff\ndescription: Compact the current conversation into a handoff document for another agent to pick up.\nargument-hint: \"What will the next session be used for?\"\ndisable-model-invocation: true\n---\n\nWrite 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.\n\nInclude a \"suggested skills\" section in the document, which suggests skills that the agent should invoke.\n\nDo not duplicate content already captured in other artifacts (PRDs, plans, ADRs, issues, commits, diffs). Reference them by path or URL instead.\n\nRedact any sensitive information, such as API keys, passwords, or personally identifiable information.\n\nIf the user passed arguments, treat them as a description of what the next session will focus on and tailor the doc accordingly.\n",".agents/skills/improve-codebase-architecture/HTML-REPORT.md":"# HTML Report Format\n\nThe 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.\n\n## Scaffold\n\n```html\n<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"utf-8\" />\n    <title>Architecture review — {{repo name}}</title>\n    <script src=\"https://cdn.tailwindcss.com\"></script>\n    <script type=\"module\">\n      import mermaid from \"https://cdn.jsdelivr.net/npm/mermaid@11/dist/mermaid.esm.min.mjs\";\n      mermaid.initialize({ startOnLoad: true, theme: \"neutral\", securityLevel: \"loose\" });\n    </script>\n    <style>\n      /* small custom layer for things Tailwind doesn't cover cleanly:\n         dashed seam lines, hand-drawn-feeling arrow heads, etc. */\n      .seam { stroke-dasharray: 4 4; }\n      .leak { stroke: #dc2626; }\n      .deep { background: linear-gradient(135deg, #0f172a, #1e293b); }\n    </style>\n  </head>\n  <body class=\"bg-stone-50 text-slate-900 font-sans\">\n    <main class=\"max-w-5xl mx-auto px-6 py-12 space-y-12\">\n      <header>...</header>\n      <section id=\"candidates\" class=\"space-y-10\">...</section>\n      <section id=\"top-recommendation\">...</section>\n    </main>\n  </body>\n</html>\n```\n\n## Header\n\nRepo 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.\n\n## Candidate card\n\nThe diagrams carry the weight. Prose is sparse, plain, and uses the glossary terms (from the `/codebase-design` skill) without ceremony.\n\nEach candidate is one `<article>`:\n\n- **Title** — short, names the deepening (e.g. \"Collapse the Order intake pipeline\").\n- **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`).\n- **Files** — monospaced list, `font-mono text-sm`.\n- **Before / After diagram** — the centrepiece. Two columns, side by side. See patterns below.\n- **Problem** — one sentence. What hurts.\n- **Solution** — one sentence. What changes.\n- **Wins** — bullets, ≤6 words each. e.g. \"Tests hit one interface\", \"Pricing logic stops leaking\", \"Delete 4 shallow wrappers\".\n- **ADR callout** (if applicable) — one line in an amber-tinted box.\n\nNo paragraphs of explanation. If the diagram needs a paragraph to be understood, redraw the diagram.\n\n## Diagram patterns\n\nPick the pattern that fits the candidate. Mix them. Don't make every diagram look the same — variety is part of the point.\n\n### Mermaid graph (the workhorse for dependencies / call flow)\n\nUse 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.\"\n\n```html\n<div class=\"rounded-lg border border-slate-200 bg-white p-4\">\n  <pre class=\"mermaid\">\n    flowchart LR\n      A[OrderHandler] --> B[OrderValidator]\n      B --> C[OrderRepo]\n      C -.leak.-> D[PricingClient]\n      classDef leak stroke:#dc2626,stroke-width:2px;\n      class C,D leak\n  </pre>\n</div>\n```\n\n### Hand-built boxes-and-arrows (when Mermaid's layout fights you)\n\nModules 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.\n\n### Cross-section (good for layered shallowness)\n\nStack 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.\n\n### Mass diagram (good for \"interface as wide as implementation\")\n\nTwo 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).\n\n### Call-graph collapse\n\nBefore: 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.\n\n## Style guidance\n\n- Lean editorial, not corporate-dashboard. Generous whitespace. Serif optional for headings (`font-serif` works well with stone/slate).\n- Colour sparingly: one accent (emerald or indigo) plus red for leakage and amber for warnings.\n- Keep diagrams ~320px tall so before/after sits comfortably side by side without scrolling.\n- Use `text-xs uppercase tracking-wider` for module labels inside diagrams — they should read as schematic, not as UI.\n- 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.\n\n## Top recommendation section\n\nOne larger card. Candidate name, one sentence on why, anchor link to its card. That's it.\n\n## Tone\n\nPlain English, concise — but the architectural nouns and verbs come straight from the `/codebase-design` skill. Concision is not an excuse to drift.\n\n**Use exactly:** module, interface, implementation, depth, deep, shallow, seam, adapter, leverage, locality.\n\n**Never substitute:** component, service, unit (for module) · API, signature (for interface) · boundary (for seam) · layer, wrapper (for module, when you mean module).\n\n**Phrasings that fit the style:**\n\n- \"Order intake module is shallow — interface nearly matches the implementation.\"\n- \"Pricing leaks across the seam.\"\n- \"Deepen: one interface, one place to test.\"\n- \"Two adapters justify the seam: HTTP in prod, in-memory in tests.\"\n\n**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.\n\nNo 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.\n",".agents/skills/improve-codebase-architecture/SKILL.md":"---\nname: improve-codebase-architecture\ndescription: Scan a codebase for deepening opportunities, present them as a visual HTML report, then grill through whichever one you pick.\ndisable-model-invocation: true\n---\n\n# Improve Codebase Architecture\n\nSurface architectural friction and propose **deepening opportunities** — refactors that turn shallow modules into deep ones. The aim is testability and AI-navigability.\n\nThis command is _informed_ by the project's domain model and built on a shared design vocabulary:\n\n- 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.\"\n- The domain language in `CONTEXT.md` gives names to good seams; ADRs in `docs/adr/` record decisions this command should not re-litigate.\n\n## Process\n\n### 1. Explore\n\nRead the project's domain glossary (`CONTEXT.md`) and any ADRs in the area you're touching first.\n\nThen 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:\n\n- Where does understanding one concept require bouncing between many small modules?\n- Where are modules **shallow** — interface nearly as complex as the implementation?\n- Where have pure functions been extracted just for testability, but the real bugs hide in how they're called (no **locality**)?\n- Where do tightly-coupled modules leak across their seams?\n- Which parts of the codebase are untested, or hard to test through their current interface?\n\nApply 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.\n\n### 2. Present candidates as an HTML report\n\nWrite 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.\n\nThe 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.\n\nFor each candidate, render a card with:\n\n- **Files** — which files/modules are involved\n- **Problem** — why the current architecture is causing friction\n- **Solution** — plain English description of what would change\n- **Benefits** — explained in terms of locality and leverage, and how tests would improve\n- **Before / After diagram** — side-by-side, custom-drawn, illustrating the shallowness and the deepening\n- **Recommendation strength** — one of `Strong`, `Worth exploring`, `Speculative`, rendered as a badge\n\nEnd the report with a **Top recommendation** section: which candidate you'd tackle first and why.\n\n**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.\"\n\n**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.\n\nSee [HTML-REPORT.md](HTML-REPORT.md) for the full HTML scaffold, diagram patterns, and styling guidance.\n\nDo NOT propose interfaces yet. After the file is written, ask the user: \"Which of these would you like to explore?\"\n\n### 3. Grilling loop\n\nOnce 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.\n\nSide effects happen inline as decisions crystallize — run the `/domain-modeling` skill to keep the domain model current as you go:\n\n- **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.\n- **Sharpening a fuzzy term during the conversation?** Update `CONTEXT.md` right there.\n- **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.\n- **Want to explore alternative interfaces for the deepened module?** Run the `/codebase-design` skill and use its design-it-twice parallel sub-agent pattern.\n",".agents/skills/prototype/LOGIC.md":"# Logic Prototype\n\nA 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.\n\n## When this is the right shape\n\n- \"I'm not sure if this state machine handles the edge case where X then Y.\"\n- \"Does this data model actually let me represent the case where...\"\n- \"I want to feel out what the API should look like before writing it.\"\n- Anything where the user wants to **press buttons and watch state change**.\n\nIf the question is \"what should this look like\" — wrong branch. Use [UI.md](UI.md).\n\n## Process\n\n### 1. State the question\n\nBefore 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.\n\n### 2. Pick the language\n\nUse whatever the host project uses. If the project has no obvious runtime (e.g. a docs repo), ask.\n\nMatch the project's existing conventions for tooling — don't add a new package manager or runtime just for the prototype.\n\n### 3. Isolate the logic in a portable module\n\nPut 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.\n\nThe right shape depends on the question:\n\n- **A pure reducer** — `(state, action) => state`. Good when actions are discrete events and state is a single value.\n- **A state machine** — explicit states and transitions. Good when \"which actions are even legal right now\" is part of the question.\n- **A small set of pure functions** over a plain data type. Good when there's no implicit current state — just transformations.\n- **A class or module with a clear method surface** when the logic genuinely owns ongoing internal state.\n\nPick 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.\n\nThis 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.\n\n### 4. Build the smallest TUI that exposes the state\n\nBuild 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.\n\nEach frame has two parts, in this order:\n\n1. **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.\n2. **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.\n\nBehaviour:\n\n1. **Initialise state** — a single in-memory object/struct. Render the first frame on start.\n2. **Read one keystroke (or one line)** at a time, dispatch to a handler that mutates state.\n3. **Re-render** the full frame after every action — don't append, replace.\n4. **Loop until quit.**\n\nThe whole frame should fit on one screen.\n\n### 5. Make it runnable in one command\n\nAdd 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.\n\nIf the host project has no task runner, just put the command at the top of the prototype's README.\n\n### 6. Hand it over\n\nGive 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.\n\n### 7. Capture the answer\n\nWhen 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.\n\n## Anti-patterns\n\n- **Don't add tests.** A prototype that needs tests is no longer a prototype.\n- **Don't wire it to the real database.** Use an in-memory store unless the question is specifically about persistence.\n- **Don't generalise.** No \"what if we wanted to support X later.\" The prototype answers one question.\n- **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.\n- **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.\n",".agents/skills/prototype/SKILL.md":"---\nname: prototype\ndescription: Build a throwaway prototype to flesh out a design — a runnable terminal app for state/business-logic questions, or several radically different UI variations toggleable from one route.\ndisable-model-invocation: true\n---\n\n# Prototype\n\nA prototype is **throwaway code that answers a question**. The question decides the shape.\n\n## Pick a branch\n\nIdentify which question is being answered — from the user's prompt, the surrounding code, or by asking if the user is around:\n\n- **\"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.\n- **\"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.\n\nThe 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.\n\n## Rules that apply to both\n\n1. **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.\n2. **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.\n3. **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.\n4. **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.\n5. **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.\n6. **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.\n\n## When done\n\nThe _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.\n",".agents/skills/prototype/UI.md":"# UI Prototype\n\nGenerate **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.\n\nIf the question is about logic/state rather than what something looks like — wrong branch. Use [LOGIC.md](LOGIC.md).\n\n## When this is the right shape\n\n- \"What should this page look like?\"\n- \"I want to see a few options for this dashboard before committing.\"\n- \"Try a different layout for the settings screen.\"\n- Any time the user would otherwise spend a day picking between three vague mockups in their head.\n\n## Two sub-shapes — strongly prefer sub-shape A\n\nA 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.\n\n### Sub-shape A — adjustment to an existing page (preferred)\n\nThe 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.\n\nIf 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.\n\n### Sub-shape B — a new page (last resort)\n\nOnly 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.\n\nCreate 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.\n\nBefore 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.\n\nIn both sub-shapes the floating bottom bar is identical.\n\n## Process\n\n### 1. State the question and pick N\n\nDefault to **3 variants**. More than 5 stops being radically different and starts being noise — cap there.\n\nWrite down the plan in one line, in the prototype's location or a top-of-file comment:\n\n> \"Three variants of the settings page, switchable via `?variant=`, on the existing `/settings` route.\"\n\nThis works whether the user is here to push back or not.\n\n### 2. Generate radically different variants\n\nDraft each variant. Hold each one to:\n\n- The page's purpose and the data it has access to.\n- The project's component library / styling system (TailwindCSS, shadcn, MUI, plain CSS, whatever).\n- A clear exported component name, e.g. `VariantA`, `VariantB`, `VariantC`.\n\nVariants 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.\n\n### 3. Wire them together\n\nCreate a single switcher component on the route:\n\n```tsx\n// pseudo-code — adapt to the project's framework\nconst variant = searchParams.get('variant') ?? 'A';\nreturn (\n  <>\n    {variant === 'A' && <VariantA {...data} />}\n    {variant === 'B' && <VariantB {...data} />}\n    {variant === 'C' && <VariantC {...data} />}\n    <PrototypeSwitcher variants={['A','B','C']} current={variant} />\n  </>\n);\n```\n\nFor sub-shape A (existing page): keep all the existing data fetching above the switcher; only the rendered subtree changes per variant.\n\nFor sub-shape B (new page): the throwaway route under `/prototype/<name>` mounts the same switcher.\n\n### 4. Build the floating switcher\n\nA small fixed-position bar at the bottom-centre of the screen with three pieces:\n\n- **Left arrow** — cycles to the previous variant (wraps around).\n- **Variant label** — shows the current variant key and, if the variant exports a name, that name too. e.g. `B — Sidebar layout`.\n- **Right arrow** — cycles forward (wraps around).\n\nBehaviour:\n\n- 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.\n- Keyboard: `←` and `→` arrow keys also cycle. Don't intercept arrow keys when an `<input>`, `<textarea>`, or `[contenteditable]` is focused.\n- Visually distinct from the page (e.g. high-contrast pill, subtle shadow) so it's obviously not part of the design being evaluated.\n- 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.\n\nPut the switcher in a single shared component so both sub-shapes can reuse it. Locate it wherever shared UI lives in the project.\n\n### 5. Hand it over\n\nSurface 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.\n\n### 6. Capture the answer and clean up\n\nOnce 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:\n\n- **Sub-shape A** — delete the losing variants and the switcher; fold the winner into the existing page.\n- **Sub-shape B** — promote the winning variant to a real route, delete the throwaway route and the switcher.\n\nDon't leave variant components or the switcher lying around. They rot fast and confuse the next reader.\n\n## Anti-patterns\n\n- **Variants that differ only in colour or copy.** That's a tweak, not a prototype. Real variants disagree about structure.\n- **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.\n- **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\".\n- **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.\n",".agents/skills/setup-matt-pocock-skills/SKILL.md":"---\nname: setup-matt-pocock-skills\ndescription: 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.\ndisable-model-invocation: true\n---\n\n# Setup Matt Pocock's Skills\n\nScaffold the per-repo configuration that the engineering skills assume:\n\n- **Issue tracker** — where issues live (GitHub by default; local markdown is also supported out of the box)\n- **Triage labels** — the strings used for the five canonical triage roles\n- **Domain docs** — where `CONTEXT.md` and ADRs live, and the consumer rules for reading them\n\nThis is a prompt-driven skill, not a deterministic script. Explore, present what you found, confirm with the user, then write.\n\n## Process\n\n### 1. Explore\n\nLook at the current repo to understand its starting state. Read whatever exists; don't assume:\n\n- `git remote -v` and `.git/config` — is this a GitHub repo? Which one?\n- `AGENTS.md` and `CLAUDE.md` at the repo root — does either exist? Is there already an `## Agent skills` section in either?\n- `CONTEXT.md` and `CONTEXT-MAP.md` at the repo root\n- `docs/adr/` and any `src/*/docs/adr/` directories\n- `docs/agents/` — does this skill's prior output already exist?\n- `.scratch/` — sign that a local-markdown issue tracker convention is already in use\n\n### 2. Present findings and ask\n\nSummarise 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.\n\nAssume 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.\n\n**Section A — Issue tracker.**\n\n> 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.\n\nDefault 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:\n\n- **GitHub** — issues live in the repo's GitHub Issues (uses the `gh` CLI)\n- **GitLab** — issues live in the repo's GitLab Issues (uses the [`glab`](https://gitlab.com/gitlab-org/cli) CLI)\n- **Local markdown** — issues live as files under `.scratch/<feature>/` in this repo (good for solo projects or repos without a remote)\n- **Other** (Jira, Linear, etc.) — ask the user to describe the workflow in one paragraph; the skill will record it as freeform prose\n\nIf — and only if — the user picked **GitHub** or **GitLab**, ask one follow-up:\n\n> 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.\n\n- **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.\n\n**Section B — Triage label vocabulary.**\n\n> 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.\n\nThe five canonical roles:\n\n- `needs-triage` — maintainer needs to evaluate\n- `needs-info` — waiting on reporter\n- `ready-for-agent` — fully specified, AFK-ready (an agent can pick it up with no human context)\n- `ready-for-human` — needs human implementation\n- `wontfix` — will not be actioned\n\nDefault: 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.\n\n**Section C — Domain docs.**\n\n> 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.\n\nConfirm the layout:\n\n- **Single-context** — one `CONTEXT.md` + `docs/adr/` at the repo root. Most repos are this.\n- **Multi-context** — `CONTEXT-MAP.md` at the root pointing to per-context `CONTEXT.md` files (typically a monorepo).\n\n### 3. Confirm and edit\n\nShow the user a draft of:\n\n- The `## Agent skills` block to add to whichever of `CLAUDE.md` / `AGENTS.md` is being edited (see step 4 for selection rules)\n- The contents of `docs/agents/issue-tracker.md`, `docs/agents/triage-labels.md`, `docs/agents/domain.md`\n\nLet them edit before writing.\n\n### 4. Write\n\n**Pick the file to edit:**\n\n- If `CLAUDE.md` exists, edit it.\n- Else if `AGENTS.md` exists, edit it.\n- If neither exists, ask the user which one to create — don't pick for them.\n\nNever create `AGENTS.md` when `CLAUDE.md` already exists (or vice versa) — always edit the one that's already there.\n\nIf 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.\n\nThe block:\n\n```markdown\n## Agent skills\n\n### Issue tracker\n\n[one-line summary of where issues are tracked, plus whether external PRs are a triage surface]. See `docs/agents/issue-tracker.md`.\n\n### Triage labels\n\n[one-line summary of the label vocabulary]. See `docs/agents/triage-labels.md`.\n\n### Domain docs\n\n[one-line summary of layout — \"single-context\" or \"multi-context\"]. See `docs/agents/domain.md`.\n```\n\nThen write the three docs files using the seed templates in this skill folder as a starting point:\n\n- [issue-tracker-github.md](./issue-tracker-github.md) — GitHub issue tracker\n- [issue-tracker-gitlab.md](./issue-tracker-gitlab.md) — GitLab issue tracker\n- [issue-tracker-local.md](./issue-tracker-local.md) — local-markdown issue tracker\n- [triage-labels.md](./triage-labels.md) — label mapping\n- [domain.md](./domain.md) — domain doc consumer rules + layout\n\nFor \"other\" issue trackers, write `docs/agents/issue-tracker.md` from scratch using the user's description.\n\n### 5. Done\n\nTell 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.\n",".agents/skills/setup-matt-pocock-skills/domain.md":"# Domain Docs\n\nHow the engineering skills should consume this repo's domain documentation when exploring the codebase.\n\n## Before exploring, read these\n\n- **`CONTEXT.md`** at the repo root, or\n- **`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.\n- **`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.\n\nIf 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.\n\n## File structure\n\nSingle-context repo (most repos):\n\n```\n/\n├── CONTEXT.md\n├── docs/adr/\n│   ├── 0001-event-sourced-orders.md\n│   └── 0002-postgres-for-write-model.md\n└── src/\n```\n\nMulti-context repo (presence of `CONTEXT-MAP.md` at the root):\n\n```\n/\n├── CONTEXT-MAP.md\n├── docs/adr/                          ← system-wide decisions\n└── src/\n    ├── ordering/\n    │   ├── CONTEXT.md\n    │   └── docs/adr/                  ← context-specific decisions\n    └── billing/\n        ├── CONTEXT.md\n        └── docs/adr/\n```\n\n## Use the glossary's vocabulary\n\nWhen 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.\n\nIf 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`).\n\n## Flag ADR conflicts\n\nIf your output contradicts an existing ADR, surface it explicitly rather than silently overriding:\n\n> _Contradicts ADR-0007 (event-sourced orders) — but worth reopening because…_\n",".agents/skills/setup-matt-pocock-skills/issue-tracker-github.md":"# Issue tracker: GitHub\n\nIssues and PRDs for this repo live as GitHub issues. Use the `gh` CLI for all operations.\n\n## Conventions\n\n- **Create an issue**: `gh issue create --title \"...\" --body \"...\"`. Use a heredoc for multi-line bodies.\n- **Read an issue**: `gh issue view <number> --comments`, filtering comments by `jq` and also fetching labels.\n- **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.\n- **Comment on an issue**: `gh issue comment <number> --body \"...\"`\n- **Apply / remove labels**: `gh issue edit <number> --add-label \"...\"` / `--remove-label \"...\"`\n- **Close**: `gh issue close <number> --comment \"...\"`\n\nInfer the repo from `git remote -v` — `gh` does this automatically when run inside a clone.\n\n## Pull requests as a triage surface\n\n**PRs as a request surface: no.** _(Set to `yes` if this repo treats external PRs as feature requests; `/triage` reads this flag.)_\n\nWhen set to `yes`, PRs run through the same labels and states as issues, using the `gh pr` equivalents:\n\n- **Read a PR**: `gh pr view <number> --comments` and `gh pr diff <number>` for the diff.\n- **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`).\n- **Comment / label / close**: `gh pr comment`, `gh pr edit --add-label`/`--remove-label`, `gh pr close`.\n\nGitHub 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`.\n\n## When a skill says \"publish to the issue tracker\"\n\nCreate a GitHub issue.\n\n## When a skill says \"fetch the relevant ticket\"\n\nRun `gh issue view <number> --comments`.\n",".agents/skills/setup-matt-pocock-skills/issue-tracker-gitlab.md":"# Issue tracker: GitLab\n\nIssues and PRDs for this repo live as GitLab issues. Use the [`glab`](https://gitlab.com/gitlab-org/cli) CLI for all operations.\n\n## Conventions\n\n- **Create an issue**: `glab issue create --title \"...\" --description \"...\"`. Use a heredoc for multi-line descriptions. Pass `--description -` to open an editor.\n- **Read an issue**: `glab issue view <number> --comments`. Use `-F json` for machine-readable output.\n- **List issues**: `glab issue list -F json` with appropriate `--label` filters.\n- **Comment on an issue**: `glab issue note <number> --message \"...\"`. GitLab calls comments \"notes\".\n- **Apply / remove labels**: `glab issue update <number> --label \"...\"` / `--unlabel \"...\"`. Multiple labels can be comma-separated or by repeating the flag.\n- **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.\n- **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`.\n\nInfer the repo from `git remote -v` — `glab` does this automatically when run inside a clone.\n\n## Merge requests as a triage surface\n\n**MRs as a request surface: no.** _(Set to `yes` if this repo treats external merge requests as feature requests; `/triage` reads this flag.)_\n\nWhen set to `yes`, MRs run through the same labels and states as issues, using the `glab mr` equivalents:\n\n- **Read an MR**: `glab mr view <number> --comments` and `glab mr diff <number>` for the diff.\n- **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).\n- **Comment / label / close**: `glab mr note`, `glab mr update --label`/`--unlabel`, `glab mr close`.\n\nUnlike GitHub, GitLab numbers issues and MRs separately, so `#42` is unambiguous once you know which surface the maintainer means.\n\n## When a skill says \"publish to the issue tracker\"\n\nCreate a GitLab issue.\n\n## When a skill says \"fetch the relevant ticket\"\n\nRun `glab issue view <number> --comments`.\n",".agents/skills/setup-matt-pocock-skills/issue-tracker-local.md":"# Issue tracker: Local Markdown\n\nIssues and PRDs for this repo live as markdown files in `.scratch/`.\n\n## Conventions\n\n- One feature per directory: `.scratch/<feature-slug>/`\n- The PRD is `.scratch/<feature-slug>/PRD.md`\n- Implementation issues are `.scratch/<feature-slug>/issues/<NN>-<slug>.md`, numbered from `01`\n- Triage state is recorded as a `Status:` line near the top of each issue file (see `triage-labels.md` for the role strings)\n- Comments and conversation history append to the bottom of the file under a `## Comments` heading\n\n## When a skill says \"publish to the issue tracker\"\n\nCreate a new file under `.scratch/<feature-slug>/` (creating the directory if needed).\n\n## When a skill says \"fetch the relevant ticket\"\n\nRead the file at the referenced path. The user will normally pass the path or the issue number directly.\n",".agents/skills/setup-matt-pocock-skills/triage-labels.md":"# Triage Labels\n\nThe 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.\n\n| Label in mattpocock/skills | Label in our tracker | Meaning                                  |\n| -------------------------- | -------------------- | ---------------------------------------- |\n| `needs-triage`             | `needs-triage`       | Maintainer needs to evaluate this issue  |\n| `needs-info`               | `needs-info`         | Waiting on reporter for more information |\n| `ready-for-agent`          | `ready-for-agent`    | Fully specified, ready for an AFK agent  |\n| `ready-for-human`          | `ready-for-human`    | Requires human implementation            |\n| `wontfix`                  | `wontfix`            | Will not be actioned                     |\n\nWhen a skill mentions a role (e.g. \"apply the AFK-ready triage label\"), use the corresponding label string from this table.\n\nEdit the right-hand column to match whatever vocabulary you actually use.\n",".agents/skills/tdd/SKILL.md":"---\nname: tdd\ndescription: Test-driven development. Use when the user wants to build features or fix bugs test-first, mentions \"red-green-refactor\", or wants integration tests.\n---\n\n# Test-Driven Development\n\n## Philosophy\n\n**Core principle**: Tests should verify behavior through public interfaces, not implementation details. Code can change entirely; tests shouldn't.\n\n**Good tests** are integration-style: they exercise real code paths through public APIs. They describe _what_ the system does, not _how_ it does it. A good test reads like a specification - \"user can checkout with valid cart\" tells you exactly what capability exists. These tests survive refactors because they don't care about internal structure.\n\n**Bad tests** are coupled to implementation. They mock internal collaborators, test private methods, or verify through external means (like querying a database directly instead of using the interface). The warning sign: your test breaks when you refactor, but behavior hasn't changed. If you rename an internal function and tests fail, those tests were testing implementation, not behavior.\n\nSee [tests.md](tests.md) for examples and [mocking.md](mocking.md) for mocking guidelines.\n\n## Anti-Pattern: Horizontal Slices\n\n**DO NOT write all tests first, then all implementation.** This is \"horizontal slicing\" - treating RED as \"write all tests\" and GREEN as \"write all code.\"\n\nThis produces **crap tests**:\n\n- Tests written in bulk test _imagined_ behavior, not _actual_ behavior\n- You end up testing the _shape_ of things (data structures, function signatures) rather than user-facing behavior\n- Tests become insensitive to real changes - they pass when behavior breaks, fail when behavior is fine\n- You outrun your headlights, committing to test structure before understanding the implementation\n\n**Correct approach**: Vertical slices via tracer bullets. One test → one implementation → repeat. Each test responds to what you learned from the previous cycle. Because you just wrote the code, you know exactly what behavior matters and how to verify it.\n\n```\nWRONG (horizontal):\n  RED:   test1, test2, test3, test4, test5\n  GREEN: impl1, impl2, impl3, impl4, impl5\n\nRIGHT (vertical):\n  RED→GREEN: test1→impl1\n  RED→GREEN: test2→impl2\n  RED→GREEN: test3→impl3\n  ...\n```\n\n## Workflow\n\n### 1. Planning\n\nWhen exploring the codebase, read `CONTEXT.md` (if it exists) so that test names and interface vocabulary match the project's domain language, and respect ADRs in the area you're touching.\n\nBefore writing any code:\n\n- [ ] Confirm with user what interface changes are needed\n- [ ] Confirm with user which behaviors to test (prioritize)\n- [ ] Identify opportunities for deep modules (small interface, deep implementation) — run the `/codebase-design` skill for the vocabulary and the testability checks\n- [ ] List the behaviors to test (not implementation steps)\n- [ ] Get user approval on the plan\n\nAsk: \"What should the public interface look like? Which behaviors are most important to test?\"\n\n**You can't test everything.** Confirm with the user exactly which behaviors matter most. Focus testing effort on critical paths and complex logic, not every possible edge case.\n\n### 2. Tracer Bullet\n\nWrite ONE test that confirms ONE thing about the system:\n\n```\nRED:   Write test for first behavior → test fails\nGREEN: Write minimal code to pass → test passes\n```\n\nThis is your tracer bullet - proves the path works end-to-end.\n\n### 3. Incremental Loop\n\nFor each remaining behavior:\n\n```\nRED:   Write next test → fails\nGREEN: Minimal code to pass → passes\n```\n\nRules:\n\n- One test at a time\n- Only enough code to pass current test\n- Don't anticipate future tests\n- Keep tests focused on observable behavior\n\n### 4. Refactor\n\nAfter all tests pass, look for [refactor candidates](refactoring.md):\n\n- [ ] Extract duplication\n- [ ] Deepen modules (move complexity behind simple interfaces)\n- [ ] Apply SOLID principles where natural\n- [ ] Consider what new code reveals about existing code\n- [ ] Run tests after each refactor step\n\n**Never refactor while RED.** Get to GREEN first.\n\n## Checklist Per Cycle\n\n```\n[ ] Test describes behavior, not implementation\n[ ] Test uses public interface only\n[ ] Test would survive internal refactor\n[ ] Code is minimal for this test\n[ ] No speculative features added\n```\n",".agents/skills/tdd/mocking.md":"# When to Mock\n\nMock at **system boundaries** only:\n\n- External APIs (payment, email, etc.)\n- Databases (sometimes - prefer test DB)\n- Time/randomness\n- File system (sometimes)\n\nDon't mock:\n\n- Your own classes/modules\n- Internal collaborators\n- Anything you control\n\n## Designing for Mockability\n\nAt system boundaries, design interfaces that are easy to mock:\n\n**1. Use dependency injection**\n\nPass external dependencies in rather than creating them internally:\n\n```typescript\n// Easy to mock\nfunction processPayment(order, paymentClient) {\n  return paymentClient.charge(order.total);\n}\n\n// Hard to mock\nfunction processPayment(order) {\n  const client = new StripeClient(process.env.STRIPE_KEY);\n  return client.charge(order.total);\n}\n```\n\n**2. Prefer SDK-style interfaces over generic fetchers**\n\nCreate specific functions for each external operation instead of one generic function with conditional logic:\n\n```typescript\n// GOOD: Each function is independently mockable\nconst api = {\n  getUser: (id) => fetch(`/users/${id}`),\n  getOrders: (userId) => fetch(`/users/${userId}/orders`),\n  createOrder: (data) => fetch('/orders', { method: 'POST', body: data }),\n};\n\n// BAD: Mocking requires conditional logic inside the mock\nconst api = {\n  fetch: (endpoint, options) => fetch(endpoint, options),\n};\n```\n\nThe SDK approach means:\n- Each mock returns one specific shape\n- No conditional logic in test setup\n- Easier to see which endpoints a test exercises\n- Type safety per endpoint\n",".agents/skills/tdd/refactoring.md":"# Refactor Candidates\n\nAfter TDD cycle, look for:\n\n- **Duplication** → Extract function/class\n- **Long methods** → Break into private helpers (keep tests on public interface)\n- **Shallow modules** → Combine or deepen\n- **Feature envy** → Move logic to where data lives\n- **Primitive obsession** → Introduce value objects\n- **Existing code** the new code reveals as problematic\n",".agents/skills/tdd/tests.md":"# Good and Bad Tests\n\n## Good Tests\n\n**Integration-style**: Test through real interfaces, not mocks of internal parts.\n\n```typescript\n// GOOD: Tests observable behavior\ntest(\"user can checkout with valid cart\", async () => {\n  const cart = createCart();\n  cart.add(product);\n  const result = await checkout(cart, paymentMethod);\n  expect(result.status).toBe(\"confirmed\");\n});\n```\n\nCharacteristics:\n\n- Tests behavior users/callers care about\n- Uses public API only\n- Survives internal refactors\n- Describes WHAT, not HOW\n- One logical assertion per test\n\n## Bad Tests\n\n**Implementation-detail tests**: Coupled to internal structure.\n\n```typescript\n// BAD: Tests implementation details\ntest(\"checkout calls paymentService.process\", async () => {\n  const mockPayment = jest.mock(paymentService);\n  await checkout(cart, payment);\n  expect(mockPayment.process).toHaveBeenCalledWith(cart.total);\n});\n```\n\nRed flags:\n\n- Mocking internal collaborators\n- Testing private methods\n- Asserting on call counts/order\n- Test breaks when refactoring without behavior change\n- Test name describes HOW not WHAT\n- Verifying through external means instead of interface\n\n```typescript\n// BAD: Bypasses interface to verify\ntest(\"createUser saves to database\", async () => {\n  await createUser({ name: \"Alice\" });\n  const row = await db.query(\"SELECT * FROM users WHERE name = ?\", [\"Alice\"]);\n  expect(row).toBeDefined();\n});\n\n// GOOD: Verifies through interface\ntest(\"createUser makes user retrievable\", async () => {\n  const user = await createUser({ name: \"Alice\" });\n  const retrieved = await getUser(user.id);\n  expect(retrieved.name).toBe(\"Alice\");\n});\n```\n",".agents/skills/teach/GLOSSARY-FORMAT.md":"# GLOSSARY.md Format\n\n`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.\n\n## Structure\n\n```md\n# {Topic} Glossary\n\n{One or two sentence description of the topic this glossary covers.}\n\n## Terms\n\n**Hypertrophy**:\nMuscle growth driven by mechanical tension and metabolic stress over repeated training sessions.\n_Avoid_: Bulking, getting big\n\n**Progressive overload**:\nSystematically increasing the demand on a muscle over time — via load, volume, or intensity.\n_Avoid_: Pushing harder, levelling up\n\n**RPE (Rate of Perceived Exertion)**:\nA 1–10 self-rating of how hard a set felt, where 10 is failure and 8 means two reps left in the tank.\n_Avoid_: Effort score, intensity rating\n```\n\n## Rules\n\n- **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.\n- **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.\n- **Keep definitions tight.** One or two sentences. Define what the term IS, not what it does or how to do it.\n- **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.\n- **Group under subheadings** when natural clusters emerge (e.g. `## Anatomy`, `## Programming`). A flat list is fine when terms cohere.\n- **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.\"\n- **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.\n",".agents/skills/teach/LEARNING-RECORD-FORMAT.md":"# Learning Record Format\n\nLearning 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.\n\nThey 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.\n\n## Template\n\n```md\n# {Short title of what was learned or established}\n\n{1-3 sentences: what was learned (or what prior knowledge was established), and why it matters for future sessions.}\n```\n\nThat 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.\n\n## Optional sections\n\nOnly include these when they add genuine value. Most records won't need them.\n\n- **Status** frontmatter (`active | superseded by LR-NNNN`) — useful when an earlier understanding turns out to be wrong and is replaced.\n- **Evidence** — how the user demonstrated the understanding (a question answered, an exercise completed, prior experience cited). Useful when the claim might be revisited.\n- **Implications** — what this unlocks or rules out for future sessions. Worth recording when non-obvious.\n\n## Numbering\n\nScan `./learning-records/` for the highest existing number and increment by one.\n\n## When to write a learning record\n\nWrite one when any of these is true:\n\n1. **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.\n2. **The user disclosed prior knowledge** — \"I already know X.\" Record it so future sessions don't re-teach it. Also record the _depth_ claimed.\n3. **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.\n4. **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.\n\n### What does _not_ qualify\n\n- Material that was merely covered. Coverage is not learning. Wait for evidence.\n- Anything already captured tersely in [[GLOSSARY.md]] as a term definition. Don't duplicate.\n- Session-by-session activity logs. Learning records are not a journal — they are decision-grade insights.\n\n## Supersession\n\nWhen 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.\n",".agents/skills/teach/MISSION-FORMAT.md":"# MISSION.md Format\n\n`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.\n\n## Template\n\n```md\n# Mission: {Topic}\n\n## Why\n{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.}\n\n## Success looks like\n- {A specific, observable thing the user will be able to do}\n- {Another specific thing}\n- {…}\n\n## Constraints\n- {Time, budget, prior commitments, learning preferences, anything that bounds the approach}\n\n## Out of scope\n- {Adjacent topics the user explicitly does not want to chase right now — protects the zone of proximal development}\n```\n\n## Rules\n\n- **One mission per workspace.** If the user wants to learn two unrelated things, that is two workspaces.\n- **Concrete over abstract.** \"Run a half marathon by October\" beats \"get fitter.\" \"Ship a Rust CLI to my team\" beats \"learn Rust.\"\n- **Push back on vagueness.** If the user cannot articulate why, interview them before writing anything. A bad mission is worse than no mission.\n- **Revise when reality shifts.** Missions change. When the user's goal moves, update this file — don't leave a stale mission steering future sessions.\n- **Keep it short.** If `MISSION.md` runs past a screen, it has stopped being a compass and started being a plan.\n",".agents/skills/teach/RESOURCES-FORMAT.md":"# RESOURCES.md Format\n\n`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.\n\n## Structure\n\n```md\n# {Topic} Resources\n\n## Knowledge\n\n- [Book: _The Science and Practice of Strength Training_ — Zatsiorsky & Kraemer](https://example.com)\n  Foundational text on programming and adaptation. Use for: anything to do with periodisation, recovery, intensity zones.\n- [Article: \"How Much Should I Train?\" — Greg Nuckols (Stronger By Science)](https://example.com)\n  Evidence-based review of volume landmarks. Use for: weekly set targets per muscle group.\n\n## Wisdom (Communities)\n\n- [r/weightroom](https://reddit.com/r/weightroom)\n  High-signal subreddit, moderated against bro-science. Use for: programme critique, plateau troubleshooting.\n- Local: Tuesday strength class at {gym name}\n  Use for: real-time coaching feedback on lifts.\n```\n\n## Rules\n\n- **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.\n- **Annotate every entry.** A bare link is useless in three months. Add one line: what it covers and when to reach for it.\n- **Group by Knowledge / Wisdom.** Mirrors the philosophy in [SKILL.md](./SKILL.md). It is fine for a resource to appear in only one group.\n- **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.\n- **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.\n- **Record community preferences.** If the user has opted out of joining communities, note it here so future sessions don't keep proposing them.\n",".agents/skills/teach/SKILL.md":"---\nname: teach\ndescription: Teach the user a new skill or concept, within this workspace.\ndisable-model-invocation: true\nargument-hint: \"What would you like to learn about?\"\n---\n\nThe user has asked you to teach them something. This is a stateful request - they intend to learn the topic over multiple sessions.\n\n## Teaching Workspace\n\nTreat the current directory as a teaching workspace. The state of their learning is captured in this directory in several files:\n\n- `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).\n- `./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.\n- `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).\n- `./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).\n- `./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.\n- `./assets/*`: Reusable **components** shared across lessons. See [Assets](#assets).\n- `NOTES.md`: A scratchpad for you to jot down user preferences, or working notes.\n\n## Philosophy\n\nTo learn at a deep level, the user needs three things:\n\n- **Knowledge**, captured from high-quality, high-trust resources\n- **Skills**, acquired through highly-relevant interactive lessons devised by you, based on the knowledge\n- **Wisdom**, which comes from interacting with other learners and practitioners\n\nBefore 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.\n\nSome topics may require more skills than knowledge. Learning more about theoretical physics might be more knowledge-based. For yoga, more skills-based.\n\n### Fluency vs Storage Strength\n\nYou should be careful to split between two types of learning:\n\n- **Fluency strength**: in-the-moment retrieval of knowledge\n- **Storage strength**: long-term retention of knowledge\n\nFluency 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:\n\n- Using retrieval practice (recall from memory)\n- Spacing (distributing practice over time)\n- Interleaving (mixing up different but related topics in practice - for skills practice only)\n\n## Lessons\n\nA 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.\n\nA lesson should be **beautiful** — clean, readable typography and layout — since the user will return to these later to review. Think Tufte.\n\nThe 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.\n\nIf possible, open the lesson file for the user by running a CLI command.\n\nEach lesson should link via HTML anchors to other lessons and reference documents.\n\nEach 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.\n\nEach 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.\n\n## Assets\n\nLessons are built from reusable **components**, stored in `./assets/`: stylesheets, quiz widgets, simulators, diagram helpers — anything a second lesson could reuse.\n\nReuse 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.\n\nA 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.\n\n## The Mission\n\nEvery lesson should be tied into the mission - the reason that the user is interested in learning about the topic.\n\nIf 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.\n\nFailing 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.\n\nMissions 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.\n\n## Zone Of Proximal Development\n\nEach lesson, the user should always feel as if they are being challenged 'just enough'.\n\nThe user may specify an exact thing they want to learn. If they don't, figure out their zone of proximal development by:\n\n- Reading their `learning-records`\n- Figuring out the right thing to teach them based on their mission\n- Teach the most relevant thing that fits in their zone of proximal development\n\n## Knowledge\n\nLessons 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.\n\nKnowledge 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.\n\nFor acquiring knowledge, difficulty is the enemy. It eats working memory you need for understanding.\n\n## Skills\n\nIf knowledge is all about acquisition, skills are about durability and flexibility. Make the knowledge stick.\n\nFor 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:\n\n- Interactive lessons, using quizzes and light in-browser tasks\n- Lessons which guide the user through a list of real-world steps to take (for instance, yoga poses)\n\nEach 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.\n\nFor 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.\n\n## Acquiring Wisdom\n\nWisdom comes from true real-world interaction - testing your skills outside the learning environment.\n\nWhen 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**.\n\nA 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.\n\nYou 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.\n\n## Reference Documents\n\nWhile 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.\n\nLessons 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.\n\nSome learning topics lend themselves to reference:\n\n- Syntax and code snippets for programming\n- Algorithms and flowcharts for processes\n- Yoga poses and sequences for yoga\n- Exercises and routines for fitness\n- Glossaries for any topic with its own nomenclature\n\nGlossaries, in particular, are an essential reference. Once one is created, it should be adhered to in every lesson.\n\n## `NOTES.md`\n\nThe 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.\n",".agents/skills/to-issues/SKILL.md":"---\nname: to-issues\ndescription: Break a plan, spec, or PRD into independently-grabbable issues on the project issue tracker using tracer-bullet vertical slices.\ndisable-model-invocation: true\n---\n\n# To Issues\n\nBreak a plan into independently-grabbable issues using vertical slices (tracer bullets).\n\nThe issue tracker and triage label vocabulary should have been provided to you — run `/setup-matt-pocock-skills` if not.\n\n## Process\n\n### 1. Gather context\n\nWork 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.\n\n### 2. Explore the codebase (optional)\n\nIf 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.\n\nLook for opportunities to prefactor the code to make the implementation easier. \"Make the change easy, then make the easy change.\"\n\n### 3. Draft vertical slices\n\nBreak 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.\n\n<vertical-slice-rules>\n\n- Each slice delivers a narrow but COMPLETE path through every layer (schema, API, UI, tests)\n- A completed slice is demoable or verifiable on its own\n- Any prefactoring should be done first\n\n</vertical-slice-rules>\n\n### 4. Quiz the user\n\nPresent the proposed breakdown as a numbered list. For each slice, show:\n\n- **Title**: short descriptive name\n- **Blocked by**: which other slices (if any) must complete first\n- **User stories covered**: which user stories this addresses (if the source material has them)\n\nAsk the user:\n\n- Does the granularity feel right? (too coarse / too fine)\n- Are the dependency relationships correct?\n- Should any slices be merged or split further?\n\nIterate until the user approves the breakdown.\n\n### 5. Publish the issues to the issue tracker\n\nFor 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.\n\nPublish issues in dependency order (blockers first) so you can reference real issue identifiers in the \"Blocked by\" field.\n\n<issue-template>\n## Parent\n\nA reference to the parent issue on the issue tracker (if the source was an existing issue, otherwise omit this section).\n\n## What to build\n\nA concise description of this vertical slice. Describe the end-to-end behavior, not layer-by-layer implementation.\n\nAvoid 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.\n\n## Acceptance criteria\n\n- [ ] Criterion 1\n- [ ] Criterion 2\n- [ ] Criterion 3\n\n## Blocked by\n\n- A reference to the blocking ticket (if any)\n\nOr \"None - can start immediately\" if no blockers.\n\n</issue-template>\n\nDo NOT close or modify any parent issue.\n",".agents/skills/to-prd/SKILL.md":"---\nname: to-prd\ndescription: 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.\ndisable-model-invocation: true\n---\n\nThis skill takes the current conversation context and codebase understanding and produces a PRD. Do NOT interview the user — just synthesize what you already know.\n\nThe issue tracker and triage label vocabulary should have been provided to you — run `/setup-matt-pocock-skills` if not.\n\n## Process\n\n1. 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.\n\n2. 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.\n\nCheck with the user that these seams match their expectations.\n\n3. 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.\n\n<prd-template>\n\n## Problem Statement\n\nThe problem that the user is facing, from the user's perspective.\n\n## Solution\n\nThe solution to the problem, from the user's perspective.\n\n## User Stories\n\nA LONG, numbered list of user stories. Each user story should be in the format of:\n\n1. As an <actor>, I want a <feature>, so that <benefit>\n\n<user-story-example>\n1. As a mobile bank customer, I want to see balance on my accounts, so that I can make better informed decisions about my spending\n</user-story-example>\n\nThis list of user stories should be extremely extensive and cover all aspects of the feature.\n\n## Implementation Decisions\n\nA list of implementation decisions that were made. This can include:\n\n- The modules that will be built/modified\n- The interfaces of those modules that will be modified\n- Technical clarifications from the developer\n- Architectural decisions\n- Schema changes\n- API contracts\n- Specific interactions\n\nDo NOT include specific file paths or code snippets. They may end up being outdated very quickly.\n\nException: 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.\n\n## Testing Decisions\n\nA list of testing decisions that were made. Include:\n\n- A description of what makes a good test (only test external behavior, not implementation details)\n- Which modules will be tested\n- Prior art for the tests (i.e. similar types of tests in the codebase)\n\n## Out of Scope\n\nA description of the things that are out of scope for this PRD.\n\n## Further Notes\n\nAny further notes about the feature.\n\n</prd-template>\n",".agents/skills/triage/AGENT-BRIEF.md":"# Writing Agent Briefs\n\nAn 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.\n\nThe 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.\n\n## Principles\n\n### Durability over precision\n\nThe 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.\n\n- **Do** describe interfaces, types, and behavioral contracts\n- **Do** name specific types, function signatures, or config shapes that the agent should look for or modify\n- **Don't** reference file paths — they go stale\n- **Don't** reference line numbers\n- **Don't** assume the current implementation structure will remain the same\n\n### Behavioral, not procedural\n\nDescribe **what** the system should do, not **how** to implement it. The agent will explore the codebase fresh and make its own implementation decisions.\n\n- **Good:** \"The `SkillConfig` type should accept an optional `schedule` field of type `CronExpression`\"\n- **Bad:** \"Open src/types/skill.ts and add a schedule field on line 42\"\n- **Good:** \"When a user runs `/triage` with no arguments, they should see a summary of issues needing attention\"\n- **Bad:** \"Add a switch statement in the main handler function\"\n\n### Complete acceptance criteria\n\nThe agent needs to know when it's done. Every agent brief must have concrete, testable acceptance criteria. Each criterion should be independently verifiable.\n\n- **Good:** \"Running `gh issue list --label needs-triage` returns issues that have been through initial classification\"\n- **Bad:** \"Triage should work correctly\"\n\n### Explicit scope boundaries\n\nState what is out of scope. This prevents the agent from gold-plating or making assumptions about adjacent features.\n\n## Template\n\n```markdown\n## Agent Brief\n\n**Category:** bug / enhancement\n**Summary:** one-line description of what needs to happen\n\n**Current behavior:**\nDescribe what happens now. For bugs, this is the broken behavior.\nFor enhancements, this is the status quo the feature builds on.\n\n**Desired behavior:**\nDescribe what should happen after the agent's work is complete.\nBe specific about edge cases and error conditions.\n\n**Key interfaces:**\n- `TypeName` — what needs to change and why\n- `functionName()` return type — what it currently returns vs what it should return\n- Config shape — any new configuration options needed\n\n**Acceptance criteria:**\n- [ ] Specific, testable criterion 1\n- [ ] Specific, testable criterion 2\n- [ ] Specific, testable criterion 3\n\n**Out of scope:**\n- Thing that should NOT be changed or addressed in this issue\n- Adjacent feature that might seem related but is separate\n```\n\n## Examples\n\n### Good agent brief (bug)\n\n```markdown\n## Agent Brief\n\n**Category:** bug\n**Summary:** Skill description truncation drops mid-word, producing broken output\n\n**Current behavior:**\nWhen a skill description exceeds 1024 characters, it is truncated at exactly\n1024 characters regardless of word boundaries. This produces descriptions\nthat end mid-word (e.g. \"Use when the user wants to confi\").\n\n**Desired behavior:**\nTruncation should break at the last word boundary before 1024 characters\nand append \"...\" to indicate truncation.\n\n**Key interfaces:**\n- The `SkillMetadata` type's `description` field — no type change needed,\n  but the validation/processing logic that populates it needs to respect\n  word boundaries\n- Any function that reads SKILL.md frontmatter and extracts the description\n\n**Acceptance criteria:**\n- [ ] Descriptions under 1024 chars are unchanged\n- [ ] Descriptions over 1024 chars are truncated at the last word boundary\n      before 1024 chars\n- [ ] Truncated descriptions end with \"...\"\n- [ ] The total length including \"...\" does not exceed 1024 chars\n\n**Out of scope:**\n- Changing the 1024 char limit itself\n- Multi-line description support\n```\n\n### Good agent brief (enhancement)\n\n```markdown\n## Agent Brief\n\n**Category:** enhancement\n**Summary:** Add `.out-of-scope/` directory support for tracking rejected feature requests\n\n**Current behavior:**\nWhen a feature request is rejected, the issue is closed with a `wontfix` label\nand a comment. There is no persistent record of the decision or reasoning.\nFuture similar requests require the maintainer to recall or search for the\nprior discussion.\n\n**Desired behavior:**\nRejected feature requests should be documented in `.out-of-scope/<concept>.md`\nfiles that capture the decision, reasoning, and links to all issues that\nrequested the feature. When triaging new issues, these files should be\nchecked for matches.\n\n**Key interfaces:**\n- Markdown file format in `.out-of-scope/` — each file should have a\n  `# Concept Name` heading, a `**Decision:**` line, a `**Reason:**` line,\n  and a `**Prior requests:**` list with issue links\n- The triage workflow should read all `.out-of-scope/*.md` files early\n  and match incoming issues against them by concept similarity\n\n**Acceptance criteria:**\n- [ ] Closing a feature as wontfix creates/updates a file in `.out-of-scope/`\n- [ ] The file includes the decision, reasoning, and link to the closed issue\n- [ ] If a matching `.out-of-scope/` file already exists, the new issue is\n      appended to its \"Prior requests\" list rather than creating a duplicate\n- [ ] During triage, existing `.out-of-scope/` files are checked and surfaced\n      when a new issue matches a prior rejection\n\n**Out of scope:**\n- Automated matching (human confirms the match)\n- Reopening previously rejected features\n- Bug reports (only enhancement rejections go to `.out-of-scope/`)\n```\n\n### Good agent brief (PR)\n\nFor 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.\n\n```markdown\n## Agent Brief\n\n**Category:** enhancement\n**Summary:** Finish the contributor's `--json` output flag for `triage list`\n\n**Current behavior:**\nThe PR adds a `--json` flag that serializes the issue list to JSON. The happy\npath works and the diff matches the project's command structure. Two gaps\nremain: errors are still printed as human text (not JSON), and the new flag has\nno test coverage.\n\n**Desired behavior:**\nWith `--json`, all output — including errors — is well-formed JSON on stdout,\nand the command's exit codes are unchanged. The existing human-readable output\nis untouched when the flag is absent.\n\n**Key interfaces:**\n- The command's error path should emit `{ \"error\": string }` under `--json`\n  instead of the plain-text error\n- Reuse the existing serializer the PR already added; don't introduce a second\n\n**Acceptance criteria:**\n- [ ] `triage list --json` emits valid JSON for both success and error cases\n- [ ] Exit codes match the non-JSON command\n- [ ] A test covers the `--json` success output and one error case\n- [ ] Default (non-JSON) output is byte-for-byte unchanged\n\n**Out of scope:**\n- Adding `--json` to any other command\n- Changing the JSON shape of the success payload the PR already defined\n```\n\n### Bad agent brief\n\n```markdown\n## Agent Brief\n\n**Summary:** Fix the triage bug\n\n**What to do:**\nThe triage thing is broken. Look at the main file and fix it.\nThe function around line 150 has the issue.\n\n**Files to change:**\n- src/triage/handler.ts (line 150)\n- src/types.ts (line 42)\n```\n\nThis is bad because:\n- No category\n- Vague description (\"the triage thing is broken\")\n- References file paths and line numbers that will go stale\n- No acceptance criteria\n- No scope boundaries\n- No description of current vs desired behavior\n",".agents/skills/triage/OUT-OF-SCOPE.md":"# Out-of-Scope Knowledge Base\n\nThe `.out-of-scope/` directory in a repo stores persistent records of rejected feature requests. It serves two purposes:\n\n1. **Institutional memory** — why a feature was rejected, so the reasoning isn't lost when the issue is closed\n2. **Deduplication** — when a new issue comes in that matches a prior rejection, the skill can surface the previous decision instead of re-litigating it\n\n## Directory structure\n\n```\n.out-of-scope/\n├── dark-mode.md\n├── plugin-system.md\n└── graphql-api.md\n```\n\nOne file per **concept**, not per issue. Multiple issues requesting the same thing are grouped under one file.\n\n## File format\n\nThe 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.\n\n```markdown\n# Dark Mode\n\nThis project does not support dark mode or user-facing theming.\n\n## Why this is out of scope\n\nThe rendering pipeline assumes a single color palette defined in\n`ThemeConfig`. Supporting multiple themes would require:\n\n- A theme context provider wrapping the entire component tree\n- Per-component theme-aware style resolution\n- A persistence layer for user theme preferences\n\nThis is a significant architectural change that doesn't align with the\nproject's focus on content authoring. Theming is a concern for downstream\nconsumers who embed or redistribute the output.\n\n```ts\n// The current ThemeConfig interface is not designed for runtime switching:\ninterface ThemeConfig {\n  colors: ColorPalette; // single palette, resolved at build time\n  fonts: FontStack;\n}\n```\n\n## Prior requests\n\n- #42 — \"Add dark mode support\"\n- #87 — \"Night theme for accessibility\"\n- #134 — \"Dark theme option\"\n```\n\n### Naming the file\n\nUse 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.\n\n### Writing the reason\n\nThe reason should be substantive — not \"we don't want this\" but why. Good reasons reference:\n\n- Project scope or philosophy (\"This project focuses on X; theming is a downstream concern\")\n- Technical constraints (\"Supporting this would require Y, which conflicts with our Z architecture\")\n- Strategic decisions (\"We chose to use A instead of B because...\")\n\nThe reason should be durable. Avoid referencing temporary circumstances (\"we're too busy right now\") — those aren't real rejections, they're deferrals.\n\n## When to check `.out-of-scope/`\n\nDuring triage (Step 1: Gather context), read all files in `.out-of-scope/`. When evaluating a new issue:\n\n- Check if the request matches an existing out-of-scope concept\n- Matching is by concept similarity, not keyword — \"night theme\" matches `dark-mode.md`\n- 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?\"\n\nThe maintainer may:\n\n- **Confirm** — the new issue gets added to the existing file's \"Prior requests\" list, then closed\n- **Reconsider** — the out-of-scope file gets deleted or updated, and the issue proceeds through normal triage\n- **Disagree** — the issues are related but distinct, proceed with normal triage\n\n## When to write to `.out-of-scope/`\n\nOnly 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.\n\nDo **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.\n\nThe flow:\n\n1. Maintainer decides a feature request is out of scope\n2. Check if a matching `.out-of-scope/` file already exists\n3. If yes: append the new issue to the \"Prior requests\" list\n4. If no: create a new file with the concept name, decision, reason, and first prior request\n5. Post a comment on the issue explaining the decision and mentioning the `.out-of-scope/` file\n6. Close the issue with the `wontfix` label\n\n## Updating or removing out-of-scope files\n\nIf the maintainer changes their mind about a previously rejected concept:\n\n- Delete the `.out-of-scope/` file\n- The skill does not need to reopen old issues — they're historical records\n- The new issue that triggered the reconsideration proceeds through normal triage\n",".agents/skills/triage/SKILL.md":"---\nname: triage\ndescription: Move issues and external PRs through a state machine of triage roles — categorise, verify, grill if needed, and write agent-ready briefs.\ndisable-model-invocation: true\n---\n\n# Triage\n\nMove issues on the project issue tracker through a small state machine of triage roles.\n\nIf this repo treats external pull requests as a request surface (see the issue-tracker config), triage covers them too: **a PR is an issue with attached code** — same roles, same states, same machine, with a few deltas marked \"for a PR\" below. Resolve a bare `#42` to an issue or PR per the tracker config.\n\nEvery comment or issue posted to the issue tracker during triage **must** start with this disclaimer:\n\n```\n> *This was generated by AI during triage.*\n```\n\n## Reference docs\n\n- [AGENT-BRIEF.md](AGENT-BRIEF.md) — how to write durable agent briefs\n- [OUT-OF-SCOPE.md](OUT-OF-SCOPE.md) — how the `.out-of-scope/` knowledge base works\n\n## Roles\n\nTwo **category** roles:\n\n- `bug` — something is broken\n- `enhancement` — new feature or improvement\n\nFive **state** roles:\n\n- `needs-triage` — maintainer needs to evaluate\n- `needs-info` — waiting on reporter for more information\n- `ready-for-agent` — fully specified, ready for an AFK agent\n- `ready-for-human` — needs human implementation\n- `wontfix` — will not be actioned\n\nFor a PR, the same states read against the attached code: `ready-for-agent` means a brief is attached and an agent should take the next step on the diff; `ready-for-human` means it's ready for a human to merge.\n\nEvery triaged issue should carry exactly one category role and one state role. If state roles conflict, flag it and ask the maintainer before doing anything else.\n\nThese are canonical role names — the actual label strings used in the issue tracker may differ. The mapping should have been provided to you - run `/setup-matt-pocock-skills` if not.\n\nState transitions: an unlabeled issue normally goes to `needs-triage` first; from there it moves to `needs-info`, `ready-for-agent`, `ready-for-human`, or `wontfix`. `needs-info` returns to `needs-triage` once the reporter replies. The maintainer can override at any time — flag transitions that look unusual and ask before proceeding.\n\n## Invocation\n\nThe maintainer invokes `/triage` and describes what they want in natural language. Interpret the request and act. Examples:\n\n- \"Show me anything that needs my attention\"\n- \"Let's look at #42\" (issue or PR)\n- \"Move #42 to ready-for-agent\"\n- \"What's ready for agents to pick up?\"\n\n## Show what needs attention\n\nQuery the issue tracker and present three buckets, oldest first:\n\n1. **Unlabeled** — never triaged.\n2. **`needs-triage`** — evaluation in progress.\n3. **`needs-info` with reporter activity since the last triage notes** — needs re-evaluation.\n\nWhen PRs are in scope, include external PRs in these buckets and tag each line `[PR]` or `[issue]`. Discovery surfaces only *external* PRs (the tracker config defines who counts as external) — a collaborator's in-flight PR is not triage work. This filter is discovery-only; an explicitly named PR is always triaged regardless of author.\n\nShow counts and a one-line summary per item. Let the maintainer pick.\n\n## Triage a specific issue or PR\n\n1. **Gather context.** Read the full issue or PR (body, comments, labels, author, dates; for a PR, the diff too). Parse any prior triage notes so you don't re-ask resolved questions. Explore the codebase using the project's domain glossary, respecting ADRs in the area. Run two checks against the codebase: (a) **redundancy** — search for an existing implementation of the requested behavior by domain concept (not just the request's wording), and report where you looked. If found, it's an already-implemented `wontfix` (step 5). (b) **prior rejection** — read `.out-of-scope/*.md` and surface any that resembles this request.\n\n2. **Recommend.** Tell the maintainer your category and state recommendation with reasoning, plus a brief codebase summary relevant to the request — including whether it's already implemented. Wait for direction.\n\n3. **Verify the claim.** Before any grilling, check that the claim holds up. For a bug, reproduce it from the reporter's steps. For a PR, confirm the diff does what it claims — check it out, run the relevant tests or commands. Report what happened: confirmed (with code path), failed, or insufficient detail (a strong `needs-info` signal). A confirmed verification makes a much stronger agent brief.\n\n4. **Grill (if needed).** If the request needs fleshing out, run the `/grilling` and `/domain-modeling` skills together — grill it into shape one question at a time, sharpening domain terms and updating `CONTEXT.md`/ADRs inline as decisions land.\n\n5. **Apply the outcome:**\n   - `ready-for-agent` — post an agent brief comment ([AGENT-BRIEF.md](AGENT-BRIEF.md)).\n   - `ready-for-human` — same structure as an agent brief, but note why it can't be delegated (judgment calls, external access, design decisions, manual testing).\n   - `needs-info` — post triage notes (template below).\n   - `wontfix` — close, with the comment depending on *why*:\n     - **Already implemented** — the change already exists in the codebase. Point to where it lives; do **not** write to `.out-of-scope/` (that KB is for *rejected* requests, not built ones).\n     - **Rejected (bug)** — polite explanation, then close.\n     - **Rejected (enhancement)** — write to `.out-of-scope/`, link to it from a comment, then close ([OUT-OF-SCOPE.md](OUT-OF-SCOPE.md)).\n   - `needs-triage` — apply the role. Optional comment if there's partial progress.\n\n## Quick state override\n\nIf the maintainer says \"move #42 to ready-for-agent\", trust them and apply the role directly. Confirm what you're about to do (role changes, comment, close), then act. Skip grilling. If moving to `ready-for-agent` without a grilling session, ask whether they want to write an agent brief.\n\n## Needs-info template\n\n```markdown\n## Triage Notes\n\n**What we've established so far:**\n\n- point 1\n- point 2\n\n**What we still need from you (@reporter):**\n\n- question 1\n- question 2\n```\n\nCapture everything resolved during grilling under \"established so far\" so the work isn't lost. Questions must be specific and actionable, not \"please provide more info\".\n\n## Resuming a previous session\n\nIf prior triage notes exist on the issue or PR, read them, check whether the reporter has answered any outstanding questions, and present an updated picture before continuing. Don't re-ask resolved questions.\n",".agents/skills/writing-great-skills/GLOSSARY.md":"# Glossary — Building Great Skills\n\nThe domain model for what makes a skill great. A skill exists to wrangle determinism out of a stochastic system; the root virtue is **Predictability**, and every term below is a lever on it. This is the disclosed reference for [`writing-great-skills`](SKILL.md).\n\nThe terms are grouped by axis: **Invocation** (how a skill is reached), **Information Hierarchy** (how its content is arranged), **Steering** (how the agent's runtime behaviour is shaped), and **Pruning** (how it is kept lean). Each **failure mode** lives beside the lever that cures it, tagged _failure mode_.\n\n**Bold terms** in any definition are themselves defined in this glossary; find them by their heading.\n\n## Predictability\n\nThe degree to which a skill makes the agent behave the same _way_ on every run — the same process, not the same output (a brainstorming skill should _predictably_ diverge; its tokens vary, its behaviour doesn't). The root virtue every other term serves — cost and maintainability are symptoms of it, not rivals.\n\n_Avoid_: consistency, reliability, robustness, output-determinism\n\n## Invocation\n\nHow a skill is reached — and the two loads you pay for the choice.\n\n### Model-Invoked\n\nA skill that keeps its **description** field, so the agent can see it and fire it autonomously — and the human can still type its name, so model-invocation always _includes_ user reach. There is no model-only state: a description only ever _adds_ agent discovery, never removes the human's. Pays a permanent **context load** on every turn in exchange for that discoverability. Reachable by other skills, because the description that makes it agent-discoverable makes it invocable. A model-invoked skill whose content is all **reference** is also one home for shared reference: another skill can invoke it, so reference needed by several skills lives in one place. Pick model-invocation only when the agent must reach the skill on its own; if it never fires except by hand, drop the description and pay no context load.\n\n_Avoid_: ability, tool, capability\n\n### User-Invoked\n\nA skill with its **description** stripped — invisible to the agent and reachable only by the human typing its name (user-_only_, where **model-invoked** is user-_and-agent_). Trades agent-discoverability for zero **context load**. Because it has no description, nothing but the human can reach it: no other skill can fire it.\n\n_Avoid_: procedure, workflow, command\n\n### Description\n\nThe skill's machine-readable trigger, and the one **context pointer** a **model-invoked** skill is forced to keep loaded at all times. Its mere presence _is_ the invocation axis: keep it and the skill is model-invoked (and reachable by other skills); delete it and the skill is **user-invoked**, reachable only by the human. The source of a model-invoked skill's **context load**.\n\n_Avoid_: frontmatter, summary\n\n### Context Pointer\n\nA reference held in the agent's context that names some out-of-context material and encodes the condition for reaching it. The **description** is the top-level context pointer (context window → skill); pointers to disclosed files are the same object one level down. Its wording, not the target, decides _when_ the agent reaches — and _how reliably_. A must-have target behind a weakly worded pointer is a variance bug: fix the wording first, and inline the material only if sharpening fails.\n\n_Avoid_: link, reference, import\n\n### Context Load\n\nThe cost a **model-invoked** skill imposes on the agent's context window — its **description**, always loaded, spending both tokens and attention. What **user-invoked** skills escape by having no description, and the brake on splitting into more model-invoked skills.\n\n_Avoid_: token cost, context bloat\n\n### Cognitive Load\n\nThe cost a **user-invoked** skill imposes on the human — what they must hold in their head: which skills exist and when to reach for each (the human is the index). What **model-invocation** removes by being agent-discoverable, and the brake on splitting into more user-invoked skills. Not a cost to minimise: it is the price of human agency, the reason some skills stay user-invoked. Spend it where human judgement matters; remove it where it does not.\n\n_Avoid_: human index, burden, overhead\n\n### Router Skill\n\nA **user-invoked** skill whose job is to point at your other user-invoked skills — naming each and when to reach for it — so the human has one skill to remember instead of many. It can only hint, never fire them: user-invoked skills have no **description**, so nothing but the human can reach them. The cure for **cognitive load** when user-invoked skills multiply.\n\n_Avoid_: dispatcher, menu, registry, index, router procedure\n\n### Granularity\n\nHow finely you divide skills. Finer division spends one of the two loads: more **model-invoked** skills spend **context load** (more descriptions crowding the window and competing for attention); more **user-invoked** skills spend **cognitive load** (more for the human to remember and reach for). Two cuts guide the division. By **invocation**, split off a model-invoked skill where you have a distinct **leading word** to trigger it — a trigger word you actually use in your prompts. By **sequence**, split a run of **steps** where a step's **post-completion steps** need hiding, since isolating it in its own context clears what follows. Beware the reverse: merging sequences exposes each step's post-completion steps to what follows, inviting premature completion.\n\n_Avoid_: chunking, modularity\n\n## Information Hierarchy\n\nHow a skill's content is arranged, and how far down the ladder each piece sits.\n\n### Information Hierarchy\n\nA skill's content ranked by how immediately the agent needs it — a single ladder, produced by two cuts: in-file or behind a pointer, and step or reference. The rungs:\n\n- **Steps** — in-file, primary\n- **Reference**, in-file — secondary\n- **Reference**, disclosed — behind a **context pointer**\n\nA skill with no **steps** uses just the bottom two rungs — often a legitimately flat peer-set (e.g. every rule of a review on one rung), which is a fine arrangement, not a smell. The hierarchy is independent of invocation: a skill can be model- or user-invoked whether it is all steps, all reference, or both. When a skill has steps, in-file reference that should be disclosed buries them and turns attending to them into a coin-flip — a variance lever, not just a legibility one. Keep the top of the ladder legible; push down it whatever you can.\n\n_Avoid_: structure, organization, layout\n\n### Steps\n\nThe ordered actions the agent performs — when a skill has them, the primary tier of its content, and the part that earns its place in SKILL.md. Not every skill has steps: a skill can be all steps (`tdd`), all **reference** (a review), or both, independent of invocation. Every step ends on a **completion criterion**, clear or vague.\n\n_Avoid_: workflow, instructions, choreography\n\n### Reference\n\nMaterial the agent refers to on demand — definitions, facts, parameters, examples, conditional instructions. When a skill has **steps** it is secondary to them; when a skill has none it is the entire content; or it lives outside any skill entirely — see **External Reference**. Reached via **context pointers**, and the prime candidate for **progressive disclosure**.\n\n_Avoid_: supporting material, docs, background\n\n### External Reference\n\n**Reference** that lives outside the skill system — a plain file, no **description**, no **steps**, not invocable — that any skill can point at. The home for shared reference that needn't fire on its own, and the only shared home two **user-invoked** skills can use, since neither has a description and so neither can fire the other.\n\n_Avoid_: doc, resource, knowledge base\n\n### Progressive Disclosure\n\nMoving **reference** down the ladder — out of SKILL.md and behind a **context pointer** — so the top stays legible. Not primarily a token optimisation; it is how the **information hierarchy** is protected. Licensed by **branching**: disclose what only some branches need, inline what every path needs, and if a pointer fires unreliably on must-have material, sharpen its wording, and pull it back inline only if that fails.\n\n_Avoid_: lazy loading, chunking\n\n### Co-location\n\nKeeping the material an agent needs at once in one place — a concept's definition, rules, and caveats under a single heading, not scattered across the file — so reading one part brings its neighbours with it. The within-file companion to the **Information Hierarchy**: the hierarchy ranks _how far down_ a piece sits; co-location decides _what sits beside it_ once there. There is no formula for the right format of a body of **reference**; the test is that a skill should read like documentation written for the agent, and grouped material reads that way where scattered material does not. Distinct from **Duplication**: that repeats one meaning in two places, where scattering fragments a single meaning across many.\n\n_Avoid_: grouping, clustering, cohesion\n\n### Sprawl\n\n_Failure mode._ A skill that is simply too long — too many lines in SKILL.md — independent of whether they are stale or repeated. Even an all-live, all-unique skill can sprawl. It costs readability (the agent wades through more before it can act, and attention thins across the excess), maintainability (every extra line is one more to keep **relevant**), and tokens. The cure is the **information hierarchy**: push **reference** down behind **context pointers**, and split by **branch** or sequence so each path carries only what it needs. Distinct from **sediment** (length from stale accumulation) and **duplication** (length from repeated meaning) — sprawl is length itself, whatever its cause.\n\n_Avoid_: bloat, length, size, verbosity\n\n## Steering\n\nThe levers that shape the agent's runtime behaviour toward **Predictability**.\n\n### Branch\n\nA distinct way a skill can be invoked — a case the skill handles — so different runs take different paths through it. A skill with many steps may carry many branches; a linear one has none.\n\n_Avoid_: path, case, fork\n\n### Leading Word\n\nA compact concept — also called a _Leitwort_ — already living in the model's pretraining, that the agent thinks with while running the skill. It encodes a behavioural principle in the fewest possible tokens by invoking priors the model already holds (e.g. _lesson_, _proximal zone of development_, _fog of war_, _tracer bullets_). Repeated as a token, never as a sentence, it accumulates a distributed definition across the skill and anchors a whole region of behaviour. Coining your own works if you define it clearly, but a made-up word recruits no priors — you pay in definition tokens what a pretrained word gives free. Reach for an existing word first.\n\nA leading word serves **predictability** twice. In the body it anchors **execution** — the agent reaches for the same behaviour every time the concept appears, and inside flat reference it focuses attention on a class of thing to look for, recruiting the right checks each run. In the **description** it anchors **invocation** — and not only within the skill: when the same word lives in your prompts, your docs, and your codebase, the agent links that shared language to the skill and fires it more reliably. Word a description with the leading words you actually use when you want the skill.\n\n_Avoid_: keyword, term, motif\n\n### Completion Criterion\n\nThe condition that tells the agent a unit of work is done — the target it judges against. Two properties make it a lever, not just a quality. Its **clarity** (can the agent tell done from not-done?) resists **premature completion** — a vague bound (\"understanding reached\") lets the agent declare done and slip to the next step; this axis needs _steps_ to bite, since premature completion is a between-steps failure. Its **demand** (how much it requires) sets **legwork** — \"every modified model accounted for\" forces thorough work where \"produce a change list\" does not — and this axis is _not_ step-bound: it can bind a body of flat reference too, which is how a skill with no steps still carries an exhaustiveness bar (\"every rule applied\"). The strongest criteria are both checkable and exhaustive.\n\n_Avoid_: done condition, exit condition, stopping rule\n\n### Legwork\n\nThe work an agent does behind the scenes within a single step — reading files, exploring the codebase, making changes, digging up what it needs rather than offloading to the user. It lives below the step structure: never written as its own step, latent in the wording, controlled by the agent rather than the skill. The within-step counterpart to **post-completion steps**' across-step pull. Raised by a **leading word** (_comprehensive_, _thorough_) or a **completion criterion** that demands the work be exhaustive — including the demand axis applied to flat reference, which is what drives a skill of flat reference to cover all its rungs. Goes thin either when that demand is missing or when **premature completion** cuts the step short.\n\n_Avoid_: scope, effort, diligence, coverage\n\n### Post-Completion Steps\n\nThe **steps** that follow the current step. Visible, they pull the agent forward into **premature completion** — the more it sees, the stronger the tug; the defence is to hide them by splitting the sequence of steps into two.\n\n_Avoid_: horizon, fog of war, lookahead\n\n### Premature Completion\n\n_Failure mode._ Ending the current step before it is genuinely done, because the agent's attention slips to being done rather than to the work. A between-steps failure: it needs **steps** to occur — a skill with no steps that quits early isn't premature completion but thin **legwork** under an unmet demand. A tug-of-war between two forces: visible **post-completion steps** (the pull forward) and the **completion criterion**'s clarity (the resistance — a sharp, checkable bar holds; a vague one gives way). Fuzziness is the necessary condition: a sharp bound resists the pull no matter how many later steps are visible, so a step that never rushes needs no defending. Two levers hold a step that does, but reach for them in order: **sharpen the bound first** — it is local and cheap. Only when the criterion is irreducibly fuzzy _and_ you actually observe the rush do you **hide the later steps** — and hiding only works across a real context boundary (a user-invoked hand-off or a subagent dispatch; an inline model-invoked call leaves the later steps in context and clears nothing). One cause of thin legwork, but distinct from it: legwork can be thin even when a step runs to full completion.\n\n_Avoid_: premature closure, the rush, rushing, shortcutting\n\n## Pruning\n\nKeeping a skill lean — each remedy paired with the failure it cures.\n\n### Single Source of Truth\n\nThe desired state where each meaning lives in exactly one authoritative place, so a change to the skill's behaviour is a change in one place. **Duplication** is its violation.\n\n_Avoid_: home, canonical location\n\n### Duplication\n\n_Failure mode._ The same meaning given more than one **single source of truth**. It costs maintenance (change one place, you must change the others), costs tokens, and inflates prominence — repeating a meaning weights it on the ladder past its real rank. The accidental inverse of a **leading word**, which raises attention on purpose by repeating a token, never the meaning.\n\n_Avoid_: repetition, redundancy\n\n### Relevance\n\nWhether a line still bears on what the skill does — the lens for what to keep. A line loses relevance either by never bearing on the task (mere exposition, or a **branch** that should be disclosed) or by going stale: drifting out of date as the behaviour or world it describes changes. Shorter skills are easier to keep relevant, because each line is cheaper to check. Distinct from **no-op**: relevance asks whether a line bears on the task, not whether it changes behaviour.\n\n_Avoid_: load-bearing, staleness, freshness\n\n### Sediment\n\n_Failure mode._ Layers of old content that settle in a skill and are never cleared, because adding feels safe and removing feels risky — so stale and irrelevant lines accumulate and you must core down through them to find what is still live. The default fate of any skill without a pruning discipline; the slow erosion of **relevance**, as opposed to **duplication**'s repeated meaning.\n\n_Avoid_: accretion, bloat, cruft, rot\n\n### No-Op\n\n_Failure mode._ An instruction that changes nothing because the model already does it by default — you pay load to tell the agent what it would do anyway. The test: does a line change behaviour versus the default? A line can be perfectly **relevant** and still be a no-op. The same priors that make a **leading word** free make a no-op worthless.\n\nA leading word is a _technique_; No-Op is a _verdict_ on a line — and they cross. A leading word too weak to beat the default is a no-op (_be thorough_ when the agent is already thorough-ish), and the fix is a stronger word that passes the verdict (_relentless_), not a different technique. So the No-Op test — does it change behaviour versus the default? — is also how you grade whether a leading word is earning its repetitions. This is model-relative, not reader-relative: two people disagreeing over whether a line is a no-op disagree about the default, and settle it by running the skill, not by debate.\n\n_Avoid_: redundant instruction, restating the obvious, belaboring\n",".agents/skills/writing-great-skills/SKILL.md":"---\nname: writing-great-skills\ndescription: Reference for writing and editing skills well — the vocabulary and principles that make a skill predictable.\ndisable-model-invocation: true\n---\n\nA skill exists to wrangle determinism out of a stochastic system. **Predictability** — the agent taking the same _process_ every run, not producing the same output — is the root virtue; every lever below serves it.\n\n**Bold terms** are defined in [`GLOSSARY.md`](GLOSSARY.md); look them up there for the full meaning.\n\n## Invocation\n\nTwo choices, trading different costs:\n\n- A **model-invoked** skill keeps a **description**, so the agent can fire it autonomously _and_ other skills can reach it (you can still type its name too). It contributes to **context load** — the description sits in the window every turn. Mechanics: omit `disable-model-invocation`, and write a model-facing description with rich trigger phrasing (\"Use when the user wants…, mentions…\").\n- A **user-invoked** skill strips the description from the agent's reach: only you, typing its name, can invoke it — and no other skill can. Zero context load, but it spends **cognitive load**: _you_ are the index that must remember it exists. Mechanics: set `disable-model-invocation: true`; the `description` becomes human-facing — a one-line summary, trigger lists stripped.\n\nPick model-invocation only when the agent must reach the skill on its own, or another skill must. If it only ever fires by hand, make it user-invoked and pay no context load.\n\nWhen user-invoked skills multiply past what you can remember, that piled-up cognitive load is cured by a **router skill**: one user-invoked skill that names the others and when to reach for each.\n\n## Writing the description\n\nA model-invoked **description** does two jobs — state what the skill is, and list the **branches** that should trigger it. Every word increases **context load**, so a description earns even harder pruning than the body:\n\n- **Front-load the skill's leading word** — the description is where it does its invocation work.\n- **One trigger per branch.** Synonyms that rename a single branch are **duplication** — \"build features using TDD … asks for test-first development\" is one branch written twice. Collapse them; keep only genuinely distinct branches.\n- **Cut identity that's already in the body.** Keep the description to triggers, plus any \"when another skill needs…\" reach clause.\n\n## Information hierarchy\n\nA skill is built from two content types — **steps** and **reference** — that mix freely: a skill can be all steps, all reference, or both. The core decision is which to use and where each sits on the **information hierarchy**, a ladder ranked by how immediately the agent needs the material:\n\n1. **In-skill step** — an ordered action in `SKILL.md`, the primary tier: what the agent does, in order. Each step ends on a **completion criterion**, the condition that tells the agent the work is done. Make it _checkable_ (can the agent tell done from not-done?) and, where it matters, _exhaustive_ (\"every modified model accounted for\", not \"produce a change list\") — a vague criterion invites **premature completion**.\n2. **In-skill reference** — a definition, rule, or fact in `SKILL.md`, consulted on demand. Often a legitimately flat peer-set (every rule of a review on one rung) — a fine arrangement, not a smell. _This skill is all reference._\n3. **External reference** — reference pushed out of `SKILL.md` into a separate file, reached by a **context pointer**, loaded only when the pointer fires. (Spans _disclosed_ reference — a sibling file like `GLOSSARY.md`, still part of the skill — through fully **external reference** that lives outside the skill system and any skill can point at.)\n\nA demanding completion criterion drives thorough **legwork** — the digging the agent does within the work — whether the skill has steps or not, since \"every rule applied\" binds flat reference just as \"every step done\" binds a sequence.\n\nPush too little down and the top bloats; push too much and you hide material the agent actually needs. That tension is the whole decision.\n\n**Progressive disclosure** is the move down the ladder — out of `SKILL.md` into a linked file — so the top stays legible. Mechanics: a linked `.md` file in the skill folder, named for what it holds (this skill discloses its full definitions to `GLOSSARY.md`). Some skills are used in more than one way, and each distinct way is a **branch** — different runs taking different paths through the skill. Branching is the cleanest disclosure test: inline what every branch needs, and push behind a pointer what only some branches reach. A **context pointer**'s _wording_, not its target, decides when and how reliably the agent reaches the material.\n\nWhere the ladder decides _how far down_ a piece sits, **co-location** decides _what sits beside it_ once there: keep a concept's definition, rules, and caveats under one heading rather than scattered, so reading one part brings its neighbours with it.\n\n## When to split\n\n**Granularity** is how finely you divide skills, and each cut spends one of the two loads, so split only when the cut earns it. Two cuts:\n\n- **By invocation** — split off a **model-invoked** skill when you have a distinct **leading word** that should trigger it on its own, or another skill must reach it. You pay **context load** for the new always-loaded **description**, so that independent reach has to be worth it.\n- **By sequence** — split a run of **steps** when the steps still ahead (a step's **post-completion steps**) tempt the agent to rush the one in front of it (**premature completion**). Keeping them out of view encourages the agent to do more **legwork** on the current task.\n\n## Pruning\n\nKeep each meaning in a **single source of truth**: one authoritative place, so changing the behaviour is a one-place edit.\n\nCheck every line for **relevance**: does it still bear on what the skill does?\n\nThen hunt **no-ops** sentence by sentence, not just line by line: run the no-op test on each sentence in isolation, and when one fails, delete the whole sentence rather than trim words from it. Be aggressive — most prose that fails should go, not be rewritten.\n\n## Leading words\n\nA **leading word** is a compact concept already living in the model's pretraining that the agent thinks with while running the skill (e.g. _lesson_, _fog of war_, _tracer bullets_). Repeated throughout the text (though not necessarily - a strong leading word might only be needed once), it accumulates a distributed definition and anchors a whole region of behaviour in the fewest tokens, by recruiting priors the model already holds.\n\nIt serves predictability twice. In the body it anchors _execution_: the agent reaches for the same behaviour every time the word appears. In the description it anchors _invocation_: when the same word lives in your prompts, docs, and code, the agent links that shared language to the skill and fires it more reliably.\n\nHunt for opportunities to refactor skills to use leading words. A triad spelled out at three sites (**duplication**), a description spending a sentence to gesture at one idea — each is a passage begging to **collapse** into a single token. Examples include:\n\n- \"fast, deterministic, low-overhead\" -> _tight_ — one quality restated across a phase — into a single pretrained word (a _tight_ loop).\n- \"a loop you believe in\" -> _red_ — converts a fuzzy gate into a binary observable state (the loop goes _red_ on the bug, or it doesn't).\n\nYou win twice over: fewer tokens, _and_ a sharper hook for the agent to hang its thinking on. Assume every skill is carrying restatements that leading words retire — go find them.\n\n## Failure modes\n\nUse these to diagnose issues the user may be having with the skill.\n\n- **Premature completion** — ending a step before it's genuinely done, attention slipping to _being done_. Defence, in order: sharpen the completion criterion first (cheap, local); only if it is irreducibly fuzzy _and_ you observe the rush, hide the post-completion steps by splitting (the sequence cut).\n- **Duplication** — the same meaning in more than one place. Costs maintenance and tokens, and inflates a meaning's prominence on the ladder past its real rank.\n- **Sediment** — stale layers that settle because adding feels safe and removing feels risky. The default fate of any skill without a pruning discipline.\n- **Sprawl** — a skill simply too long, even when every line is live and unique. Hurts readability and maintainability and wastes tokens. The cure is the ladder: disclose **reference** behind pointers, and split by **branch** or sequence so each path carries only what it needs.\n- **No-op** — a line the model already obeys by default, so you pay load to say nothing. The test: does it change behaviour versus the default? A weak leading word (_be thorough_ when the agent is already thorough-ish) is a no-op; the fix is a stronger word (_relentless_), not a different technique.\n","CLAUDE.md":"# Claude guide\n\nInternal instructions for Claude Code in this repository. Read\n[`docs/architecture.md`](docs/architecture.md) before architecture work. The root `README.md` is the\npublic project page and must not be edited unless the user explicitly requests that separate review.\n\n## Active project map\n\n- `pentestgpt_agent/` — maintained autonomous Supervisor/Executor framework; nested uv project.\n- `pentestgpt_legacy/` — maintained human-driven USEN-2024-style client.\n- `../UnifedAgentWrapper/` — canonical `unified-agent` package used by the framework.\n- `../xbow-benchmark/` — reference-only benchmark harness and historical results; it is not a\n  supported `pentestgpt-agent` CLI, CI, or runtime integration.\n- `unified_agent/` — obsolete compatibility copy retained by root packaging/Docker only. Do not add\n  features here or confuse it with the framework dependency.\n\nThe old fixed-stage `pentestgpt/` package and the previous ledger-centered\nInstructor/Executor/Judge implementation are gone. Historical reports may still name them.\n\n## Runtime contract\n\n- The Supervisor and Executor both use `SandboxPolicy.FULL_ACCESS`; deployment isolation is the\n  security boundary.\n- Each episode is fresh. SQLite and exact trace receipts—not provider conversation history—are\n  memory.\n- Deterministic code owns scope, plan validation, leases, evidence, retries, completion bases, and\n  revisions.\n- Provider action and file activity is logged but is not an audit failure.\n- Keep the core at two LLM roles. Do not add an always-on judge, RAG layer, or scheduler without\n  trace evidence that the current deterministic seam cannot solve the problem.\n\n## Commands\n\nFramework work runs inside the nested project:\n\n```bash\ncd pentestgpt_agent\nuv sync --extra claude          # or codex / all\nuv run python -m pytest -q\nuv run ruff check src tests\nuv run ruff format --check src tests\nuv run mypy src\nuv lock --check\nuv build\n```\n\nFrom the repository root:\n\n```bash\nmake run TARGET=http://127.0.0.1:8000 BACKEND=claude\nmake check\nmake ci\nmake docker-build\nmake docker-login\nmake docker-auth-status\n```\n\nThe root Docker image does not currently contain `pentestgpt_agent`; treat `make docker-run` as\npending runtime wiring. The sibling XBOW checkout is retained only as a reference and is not a\nproduct verification path.\n\n## Documentation map\n\n- `docs/architecture.md` — current repository and module decisions.\n- `pentestgpt_agent/CONTEXT.md` — domain language and invariants.\n- `pentestgpt_agent/README.md` — framework development and operation.\n- `docs/docker-dev-plan.md` — current Docker/auth status and known gap.\n- `PENTESTGPT_AGENT_NEW_*` — compact historical migration/qualification records.\n- `pentestgpt_agent/HTB_ENIGMA_QUALIFICATION_20260712.md` — failed remote qualification evidence.\n\n## Editing rules\n\n- Preserve unrelated and concurrent worktree changes. Never restore or modify files merely because\n  they appear as changes you did not create.\n- Do not edit the root public `README.md` during internal documentation cleanup.\n- Do not put benchmark runners or generated result archives back into this repository.\n- Keep application imports as `unified_agent`; change dependency source configuration rather than\n  copying the wrapper into `pentestgpt_agent`.\n- Add focused replay or interface-level tests for behavior changes before live runs.\n- Never expose provider credentials, VPN files, HTB tokens, flags, or raw sensitive traces.\n","docs/architecture.md":"# PentestGPT architecture\n\nStatus: 2026-07-12\n\nThis is the internal source of truth for the current repository shape. The root `README.md` is the\npublic project page and is intentionally being revised separately.\n\n## Repository family\n\n```text\nPentestGPT_Project/\n├── PentestGPT/          # framework, legacy interactive client, and tool image\n├── UnifedAgentWrapper/  # canonical unified-agent package\n└── xbow-benchmark/      # reference-only benchmark harness and historical results\n```\n\nThe three directories are independent Git repositories. The XBOW checkout is retained as a\nreference corpus only; the product CLI, runtime, and CI do not depend on it. Benchmark logic and\nresult archives must not be added here.\n\n## Maintained runtime\n\n`pentestgpt_agent/` is the autonomous framework. It is a nested uv project with its own lockfile and\nenvironment. The loop deliberately has only two LLM roles:\n\n```text\nRunSnapshot -> Supervisor -> compile_plan -> one TaskLease\n                                             |\nTraceStore <- EpisodeRunner <- Executor <----+\n     |                              |\n     +---- compile_execution -------+\n                    |\n               MemoryKernel\n```\n\n- The Supervisor chooses one task or proposes completion.\n- The Executor performs one leased task and returns a typed result.\n- Both roles use fresh provider sessions and `FULL_ACCESS`. The deployment environment is the\n  isolation boundary; PentestGPT does not maintain a second tool or filesystem sandbox.\n- Deterministic code owns scope validation, leases, evidence provenance, retries, revisions, and\n  canonical state.\n- SQLite is canonical memory. Provider transcripts are diagnostic traces, not memory.\n- There is no always-on judge, RAG service, speculative backlog, or parallel scheduler.\n\n`pentestgpt_legacy/` is the maintained human-driven implementation of the USENIX 2024 workflow. It\nhas its own lightweight provider clients and does not use `unified_agent`.\n\n## Why unified-agent remains useful\n\nThe external `UnifedAgentWrapper` is a real seam with two production adapters: Claude Code and\nCodex. PentestGPT depends on its small interface for:\n\n- provider selection, model, effort, workspace, and permission configuration;\n- structured-output invocation;\n- normalized command, tool, file, session, usage, cost, and terminal events;\n- shared task rendering and provider error handling.\n\nRemoving that module would duplicate provider SDK churn inside `pentestgpt_agent.trace` and\n`pentestgpt_agent.trial`. It therefore earns its place as a deep module. PentestGPT policy must stay\noutside it: task kinds, memory, evidence, scope, scheduling, and completion belong to this repo.\n\nThe dependency is pinned to a commit of the public package in `pentestgpt_agent/pyproject.toml`, and\n`tests/test_dependency.py` verifies that the nested project imports the installed dependency rather\nthan the repository-root copy.\n\n## Root unified_agent copy\n\nThe root `unified_agent/` is an older, drifted compatibility copy. No maintained PentestGPT runtime\nimports it:\n\n- `pentestgpt_agent` uses the external package;\n- `pentestgpt_legacy` uses its own provider clients;\n- only root packaging, its duplicate tests, and the current tool-image health check retain it.\n\nDo not develop features in this copy. Removing it is desirable, but it is a separate public-package\ncleanup because the root wheel currently exports the package and the Docker image copies it. That\ncleanup must update the root package metadata, Docker health tests, lockfile, and public README in\none deliberate change.\n\n## Deep modules\n\n| Module | Interface | Hidden implementation |\n|---|---|---|\n| `PentestLoop` | `run(RunSpec) -> RunSnapshot` | recovery ordering, retries, episode identity, failure settlement |\n| `MemoryKernel` | create/open/snapshot and atomic commits | SQLite schema, transactions, revisions, leases, dependency liveness |\n| `compile_plan` | decision + snapshot -> valid plan | scope, dependency, phase, completion, and size validation |\n| `compile_execution` | result + lease + trace -> valid execution | exact receipt matching, evidence fallback, identity, recovery rules |\n| `EpisodeRunner` | one typed episode -> normalized result | provider invocation and durable append-only trace files |\n| external `UnifiedAgent` | one task over Claude or Codex | SDK differences, native options, event normalization |\n\nThese interfaces are the preferred test surfaces. New provider behavior belongs behind\n`UnifiedAgent`; new canonical-state behavior belongs behind the Memory Kernel or compilers.\n\n## Memory and retrieval\n\nStored state is complete and retrieval is bounded. The Supervisor receives the open working set,\nrecent closed work, required basis/dependency context, selected observations, history counts, and\nrecent diagnostics. The Executor receives one task, explicit basis, same-task evidence, and a retry\ndiagnostic. A future retriever may select canonical IDs, but it must not replace SQLite or turn\nsummaries into evidence.\n\nThe current controller weakness is convergence, not database capacity: long runs can lose compact\ncoverage information and revisit completed surfaces. The next design slice should improve the\ndeterministic strategy projection and duplicate/branch policy before adding another agent or RAG.\n\n## Runtime and benchmark ownership\n\n- Local framework development runs from `pentestgpt_agent/`.\n- The root Docker image supplies pentest tools, provider CLIs, legacy code, and persisted auth. It\n  does not currently bake in the maintained framework.\n- The sibling `xbow-benchmark` checkout is a historical/reference artifact, not a supported runtime\n  or verification path. PentestGPT owns no XBOW runner.\n- HTB execution happens only on the authorized remote attack box described in the parent project\n  guide, never directly from the development Mac.\n\n## Current design priorities\n\n1. Preserve the two-role loop and deterministic memory authority.\n2. Improve Supervisor coverage retrieval and convergence using saved-trace replay tests.\n3. Keep both roles fully enabled inside a restricted deployment environment.\n4. Remove the root `unified_agent` compatibility copy in a coordinated public-package cleanup.\n5. Add a goal-specific verifier only when non-CTF completion semantics require it.\n"},"files":{".agents/skills/ask-matt/SKILL.md":"---\nname: ask-matt\ndescription: Ask which skill or flow fits your situation. A router over the user-invoked skills in this repo.\ndisable-model-invocation: true\n---\n\n# Ask Matt\n\nYou don't remember every skill, so ask.\n\nA **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.\n\n## The main flow: idea → ship\n\nThe route most work travels. You have an idea and want it built.\n\n1. **`/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.)\n2. **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):\n   - **`/handoff`** out, then open a fresh session against that file,\n   - **`/prototype`** to answer the question with throwaway code,\n   - **`/handoff`** back what you learned, and reference it from the original idea thread.\n3. **Branch — is this a multi-session build?**\n   - **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.\n   - **No** → **`/implement`** right here, in the same context window.\n\n### Context hygiene\n\nKeep 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.\n\nThe 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.\n\n## On-ramps\n\nA starting situation that generates work, then merges onto the main flow.\n\n- **Bugs and requests piling up** → **`/triage`**. It moves issues through triage roles and produces agent-ready issues, which **`/implement`** later picks up.\n\n  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**.\n\n## Codebase health\n\nNot feature work — upkeep.\n\n- **`/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`.\n\n## Crossing sessions\n\n- **`/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**.\n- **`/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.\n\n## Standalone\n\nOff the main flow entirely.\n\n- **`/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.\n- **`/teach`** — learn a concept over multiple sessions, using the current directory as a stateful workspace.\n- **`/writing-great-skills`** — reference for writing and editing skills well.\n\n## Precondition\n\n**`/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.\n",".agents/skills/codebase-design/DEEPENING.md":"# Deepening\n\nHow to deepen a cluster of shallow modules safely, given its dependencies. Assumes the vocabulary in [SKILL.md](SKILL.md) — **module**, **interface**, **seam**, **adapter**.\n\n## Dependency categories\n\nWhen assessing a candidate for deepening, classify its dependencies. The category determines how the deepened module is tested across its seam.\n\n### 1. In-process\n\nPure computation, in-memory state, no I/O. Always deepenable — merge the modules and test through the new interface directly. No adapter needed.\n\n### 2. Local-substitutable\n\nDependencies 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.\n\n### 3. Remote but owned (Ports & Adapters)\n\nYour 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.\n\nRecommendation 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.\"*\n\n### 4. True external (Mock)\n\nThird-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.\n\n## Seam discipline\n\n- **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.\n- **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.\n\n## Testing strategy: replace, don't layer\n\n- Old unit tests on shallow modules become waste once tests at the deepened module's interface exist — delete them.\n- Write new tests at the deepened module's interface. The **interface is the test surface**.\n- Tests assert on observable outcomes through the interface, not internal state.\n- 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.\n",".agents/skills/codebase-design/DESIGN-IT-TWICE.md":"# Design It Twice\n\nWhen 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.\n\nUses the vocabulary in [SKILL.md](SKILL.md) — **module**, **interface**, **seam**, **adapter**, **leverage**.\n\n## Process\n\n### 1. Frame the problem space\n\nBefore spawning sub-agents, write a user-facing explanation of the problem space for the chosen candidate:\n\n- The constraints any new interface would need to satisfy\n- The dependencies it would rely on, and which category they fall into (see [DEEPENING.md](DEEPENING.md))\n- A rough illustrative code sketch to ground the constraints — not a proposal, just a way to make the constraints concrete\n\nShow this to the user, then immediately proceed to Step 2. The user reads and thinks while the sub-agents work in parallel.\n\n### 2. Spawn sub-agents\n\nSpawn 3+ sub-agents in parallel using the Agent tool. Each must produce a **radically different** interface for the deepened module.\n\nPrompt 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:\n\n- Agent 1: \"Minimize the interface — aim for 1–3 entry points max. Maximise leverage per entry point.\"\n- Agent 2: \"Maximise flexibility — support many use cases and extension.\"\n- Agent 3: \"Optimise for the most common caller — make the default case trivial.\"\n- Agent 4 (if applicable): \"Design around ports & adapters for cross-seam dependencies.\"\n\nInclude 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.\n\nEach sub-agent outputs:\n\n1. Interface (types, methods, params — plus invariants, ordering, error modes)\n2. Usage example showing how callers use it\n3. What the implementation hides behind the seam\n4. Dependency strategy and adapters (see [DEEPENING.md](DEEPENING.md))\n5. Trade-offs — where leverage is high, where it's thin\n\n### 3. Present and compare\n\nPresent 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**.\n\nAfter 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.\n",".agents/skills/codebase-design/SKILL.md":"---\nname: codebase-design\ndescription: 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.\n---\n\n# Codebase Design\n\nDesign **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.\n\n## Glossary\n\nUse these terms exactly — don't substitute \"component,\" \"service,\" \"API,\" or \"boundary.\" Consistent language is the whole point.\n\n**Module** — anything with an interface and an implementation. Deliberately scale-agnostic: a function, class, package, or tier-spanning slice. _Avoid_: unit, component, service.\n\n**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).\n\n**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.\n\n**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.\n\n**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).\n\n**Adapter** — a concrete thing that satisfies an interface at a seam. Describes *role* (what slot it fills), not substance (what's inside).\n\n**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.\n\n**Locality** — what maintainers get from depth: change, bugs, knowledge, and verification concentrate in one place rather than spreading across callers. Fix once, fixed everywhere.\n\n## Deep vs shallow\n\n**Deep module** = small interface + lots of implementation:\n\n```\n┌─────────────────────┐\n│   Small Interface   │  ← Few methods, simple params\n├─────────────────────┤\n│                     │\n│  Deep Implementation│  ← Complex logic hidden\n│                     │\n└─────────────────────┘\n```\n\n**Shallow module** = large interface + little implementation (avoid):\n\n```\n┌─────────────────────────────────┐\n│       Large Interface           │  ← Many methods, complex params\n├─────────────────────────────────┤\n│  Thin Implementation            │  ← Just passes through\n└─────────────────────────────────┘\n```\n\nWhen designing an interface, ask:\n\n- Can I reduce the number of methods?\n- Can I simplify the parameters?\n- Can I hide more complexity inside?\n\n## Principles\n\n- **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.\n- **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.\n- **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.\n- **One adapter means a hypothetical seam. Two adapters means a real one.** Don't introduce a seam unless something actually varies across it.\n\n## Designing for testability\n\nGood interfaces make testing natural:\n\n1. **Accept dependencies, don't create them.**\n\n   ```typescript\n   // Testable\n   function processOrder(order, paymentGateway) {}\n\n   // Hard to test\n   function processOrder(order) {\n     const gateway = new StripeGateway();\n   }\n   ```\n\n2. **Return results, don't produce side effects.**\n\n   ```typescript\n   // Testable\n   function calculateDiscount(cart): Discount {}\n\n   // Hard to test\n   function applyDiscount(cart): void {\n     cart.total -= discount;\n   }\n   ```\n\n3. **Small surface area.** Fewer methods = fewer tests needed. Fewer params = simpler test setup.\n\n## Relationships\n\n- A **Module** has exactly one **Interface** (the surface it presents to callers and tests).\n- **Depth** is a property of a **Module**, measured against its **Interface**.\n- A **Seam** is where a **Module**'s **Interface** lives.\n- An **Adapter** sits at a **Seam** and satisfies the **Interface**.\n- **Depth** produces **Leverage** for callers and **Locality** for maintainers.\n\n## Rejected framings\n\n- **Depth as ratio of implementation-lines to interface-lines** (Ousterhout): rewards padding the implementation. We use depth-as-leverage instead.\n- **\"Interface\" as the TypeScript `interface` keyword or a class's public methods**: too narrow — interface here includes every fact a caller must know.\n- **\"Boundary\"**: overloaded with DDD's bounded context. Say **seam** or **interface**.\n\n## Going deeper\n\n- **Deepening a cluster given its dependencies** — see [DEEPENING.md](DEEPENING.md): dependency categories, seam discipline, and replace-don't-layer testing.\n- **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.\n",".agents/skills/diagnosing-bugs/SKILL.md":"---\nname: diagnosing-bugs\ndescription: Diagnosis loop for hard bugs and performance regressions. Use when the user says \"diagnose\"/\"debug this\", or reports something broken/throwing/failing/slow.\n---\n\n# Diagnosing Bugs\n\nA discipline for hard bugs. Skip phases only when explicitly justified.\n\nWhen 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.\n\n## Phase 1 — Build a feedback loop\n\n**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.\n\nSpend disproportionate effort here. **Be aggressive. Be creative. Refuse to give up.**\n\n### Ways to construct one — try them in roughly this order\n\n1. **Failing test** at whatever seam reaches the bug — unit, integration, e2e.\n2. **Curl / HTTP script** against a running dev server.\n3. **CLI invocation** with a fixture input, diffing stdout against a known-good snapshot.\n4. **Headless browser script** (Playwright / Puppeteer) — drives the UI, asserts on DOM/console/network.\n5. **Replay a captured trace.** Save a real network request / payload / event log to disk; replay it through the code path in isolation.\n6. **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.\n7. **Property / fuzz loop.** If the bug is \"sometimes wrong output\", run 1000 random inputs and look for the failure mode.\n8. **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.\n9. **Differential loop.** Run the same input through old-version vs new-version (or two configs) and diff outputs.\n10. **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.\n\nBuild the right feedback loop, and the bug is 90% fixed.\n\n### Tighten the loop\n\nTreat the loop as a product. Once you have _a_ loop, **tighten** it:\n\n- Can I make it faster? (Cache setup, skip unrelated init, narrow the test scope.)\n- Can I make the signal sharper? (Assert on the specific symptom, not \"didn't crash\".)\n- Can I make it more deterministic? (Pin time, seed RNG, isolate filesystem, freeze network.)\n\nA 30-second flaky loop is barely better than no loop; a 2-second deterministic one is tight — a debugging superpower.\n\n### Non-deterministic bugs\n\nThe 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.\n\n### When you genuinely cannot build a loop\n\nStop 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.\n\n### Completion criterion — a tight loop that goes red\n\nPhase 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:\n\n- [ ] **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_.\n- [ ] **Deterministic** — same verdict every run (flaky bugs: a pinned, high reproduction rate, per above).\n- [ ] **Fast** — seconds, not minutes.\n- [ ] **Agent-runnable** — you can run it unattended; a human in the loop only via `scripts/hitl-loop.template.sh`.\n\nIf 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.\n\n## Phase 2 — Reproduce + minimise\n\nRun the loop. Watch it go red — the bug appears.\n\nConfirm:\n\n- [ ] The loop produces the failure mode the **user** described — not a different failure that happens to be nearby. Wrong bug = wrong fix.\n- [ ] The failure is reproducible across multiple runs (or, for non-deterministic bugs, reproducible at a high enough rate to debug against).\n- [ ] You have captured the exact symptom (error message, wrong output, slow timing) so later phases can verify the fix actually addresses it.\n\n### Minimise\n\nOnce 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.\n\nWhy 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.\n\nDone when **every remaining element is load-bearing** — removing any one of them makes the loop go green.\n\nDo not proceed until you have reproduced **and** minimised.\n\n## Phase 3 — Hypothesise\n\nGenerate **3–5 ranked hypotheses** before testing any of them. Single-hypothesis generation anchors on the first plausible idea.\n\nEach hypothesis must be **falsifiable**: state the prediction it makes.\n\n> Format: \"If <X> is the cause, then <changing Y> will make the bug disappear / <changing Z> will make it worse.\"\n\nIf you cannot state the prediction, the hypothesis is a vibe — discard or sharpen it.\n\n**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.\n\n## Phase 4 — Instrument\n\nEach probe must map to a specific prediction from Phase 3. **Change one variable at a time.**\n\nTool preference:\n\n1. **Debugger / REPL inspection** if the env supports it. One breakpoint beats ten logs.\n2. **Targeted logs** at the boundaries that distinguish hypotheses.\n3. Never \"log everything and grep\".\n\n**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.\n\n**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.\n\n## Phase 5 — Fix + regression test\n\nWrite the regression test **before the fix** — but only if there is a **correct seam** for it.\n\nA 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.\n\n**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.\n\nIf a correct seam exists:\n\n1. Turn the minimised repro into a failing test at that seam.\n2. Watch it fail.\n3. Apply the fix.\n4. Watch it pass.\n5. Re-run the Phase 1 feedback loop against the original (un-minimised) scenario.\n\n## Phase 6 — Cleanup + post-mortem\n\nRequired before declaring done:\n\n- [ ] Original repro no longer reproduces (re-run the Phase 1 loop)\n- [ ] Regression test passes (or absence of seam is documented)\n- [ ] All `[DEBUG-...]` instrumentation removed (`grep` the prefix)\n- [ ] Throwaway prototypes deleted (or moved to a clearly-marked debug location)\n- [ ] The hypothesis that turned out correct is stated in the commit / PR message — so the next debugger learns\n\n**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.\n",".agents/skills/domain-modeling/ADR-FORMAT.md":"# ADR Format\n\nADRs live in `docs/adr/` and use sequential numbering: `0001-slug.md`, `0002-slug.md`, etc.\n\nCreate the `docs/adr/` directory lazily — only when the first ADR is needed.\n\n## Template\n\n```md\n# {Short title of the decision}\n\n{1-3 sentences: what's the context, what did we decide, and why.}\n```\n\nThat'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.\n\n## Optional sections\n\nOnly include these when they add genuine value. Most ADRs won't need them.\n\n- **Status** frontmatter (`proposed | accepted | deprecated | superseded by ADR-NNNN`) — useful when decisions are revisited\n- **Considered Options** — only when the rejected alternatives are worth remembering\n- **Consequences** — only when non-obvious downstream effects need to be called out\n\n## Numbering\n\nScan `docs/adr/` for the highest existing number and increment by one.\n\n## When to offer an ADR\n\nAll three of these must be true:\n\n1. **Hard to reverse** — the cost of changing your mind later is meaningful\n2. **Surprising without context** — a future reader will look at the code and wonder \"why on earth did they do it this way?\"\n3. **The result of a real trade-off** — there were genuine alternatives and you picked one for specific reasons\n\nIf 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.\"\n\n### What qualifies\n\n- **Architectural shape.** \"We're using a monorepo.\" \"The write model is event-sourced, the read model is projected into Postgres.\"\n- **Integration patterns between contexts.** \"Ordering and Billing communicate via domain events, not synchronous HTTP.\"\n- **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.\n- **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.\n- **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.\n- **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.\"\n- **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.\n",".agents/skills/domain-modeling/CONTEXT-FORMAT.md":"# CONTEXT.md Format\n\n## Structure\n\n```md\n# {Context Name}\n\n{One or two sentence description of what this context is and why it exists.}\n\n## Language\n\n**Order**:\n{A one or two sentence description of the term}\n_Avoid_: Purchase, transaction\n\n**Invoice**:\nA request for payment sent to a customer after delivery.\n_Avoid_: Bill, payment request\n\n**Customer**:\nA person or organization that places orders.\n_Avoid_: Client, buyer, account\n```\n\n## Rules\n\n- **Be opinionated.** When multiple words exist for the same concept, pick the best one and list the others under `_Avoid_`.\n- **Keep definitions tight.** One or two sentences max. Define what it IS, not what it does.\n- **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.\n- **Group terms under subheadings** when natural clusters emerge. If all terms belong to a single cohesive area, a flat list is fine.\n\n## Single vs multi-context repos\n\n**Single context (most repos):** One `CONTEXT.md` at the repo root.\n\n**Multiple contexts:** A `CONTEXT-MAP.md` at the repo root lists the contexts, where they live, and how they relate to each other:\n\n```md\n# Context Map\n\n## Contexts\n\n- [Ordering](./src/ordering/CONTEXT.md) — receives and tracks customer orders\n- [Billing](./src/billing/CONTEXT.md) — generates invoices and processes payments\n- [Fulfillment](./src/fulfillment/CONTEXT.md) — manages warehouse picking and shipping\n\n## Relationships\n\n- **Ordering → Fulfillment**: Ordering emits `OrderPlaced` events; Fulfillment consumes them to start picking\n- **Fulfillment → Billing**: Fulfillment emits `ShipmentDispatched` events; Billing consumes them to generate invoices\n- **Ordering ↔ Billing**: Shared types for `CustomerId` and `Money`\n```\n\nThe skill infers which structure applies:\n\n- If `CONTEXT-MAP.md` exists, read it to find contexts\n- If only a root `CONTEXT.md` exists, single context\n- If neither exists, create a root `CONTEXT.md` lazily when the first term is resolved\n\nWhen multiple contexts exist, infer which one the current topic relates to. If unclear, ask.\n",".agents/skills/domain-modeling/SKILL.md":"---\nname: domain-modeling\ndescription: 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.\n---\n\n# Domain Modeling\n\nActively 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.)\n\n## File structure\n\nMost repos have a single context:\n\n```\n/\n├── CONTEXT.md\n├── docs/\n│   └── adr/\n│       ├── 0001-event-sourced-orders.md\n│       └── 0002-postgres-for-write-model.md\n└── src/\n```\n\nIf a `CONTEXT-MAP.md` exists at the root, the repo has multiple contexts. The map points to where each one lives:\n\n```\n/\n├── CONTEXT-MAP.md\n├── docs/\n│   └── adr/                          ← system-wide decisions\n├── src/\n│   ├── ordering/\n│   │   ├── CONTEXT.md\n│   │   └── docs/adr/                 ← context-specific decisions\n│   └── billing/\n│       ├── CONTEXT.md\n│       └── docs/adr/\n```\n\nCreate 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.\n\n## During the session\n\n### Challenge against the glossary\n\nWhen 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?\"\n\n### Sharpen fuzzy language\n\nWhen 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.\"\n\n### Discuss concrete scenarios\n\nWhen 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.\n\n### Cross-reference with code\n\nWhen 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?\"\n\n### Update CONTEXT.md inline\n\nWhen 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).\n\n`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.\n\n### Offer ADRs sparingly\n\nOnly offer to create an ADR when all three are true:\n\n1. **Hard to reverse** — the cost of changing your mind later is meaningful\n2. **Surprising without context** — a future reader will wonder \"why did they do it this way?\"\n3. **The result of a real trade-off** — there were genuine alternatives and you picked one for specific reasons\n\nIf any of the three is missing, skip the ADR. Use the format in [ADR-FORMAT.md](./ADR-FORMAT.md).\n",".agents/skills/grill-me/SKILL.md":"---\nname: grill-me\ndescription: A relentless interview to sharpen a plan or design.\ndisable-model-invocation: true\n---\n\nRun a `/grilling` session.\n",".agents/skills/grill-with-docs/SKILL.md":"---\nname: grill-with-docs\ndescription: A relentless interview to sharpen a plan or design, which also creates docs (ADR's and glossary) as we go.\ndisable-model-invocation: true\n---\n\nRun a `/grilling` session, using the `/domain-modeling` skill.\n",".agents/skills/grilling/SKILL.md":"---\nname: grilling\ndescription: 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.\n---\n\nInterview 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.\n\nAsk the questions one at a time, waiting for feedback on each question before continuing. Asking multiple questions at once is bewildering.\n\nIf a question can be answered by exploring the codebase, explore the codebase instead.\n",".agents/skills/handoff/SKILL.md":"---\nname: handoff\ndescription: Compact the current conversation into a handoff document for another agent to pick up.\nargument-hint: \"What will the next session be used for?\"\ndisable-model-invocation: true\n---\n\nWrite 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.\n\nInclude a \"suggested skills\" section in the document, which suggests skills that the agent should invoke.\n\nDo not duplicate content already captured in other artifacts (PRDs, plans, ADRs, issues, commits, diffs). Reference them by path or URL instead.\n\nRedact any sensitive information, such as API keys, passwords, or personally identifiable information.\n\nIf the user passed arguments, treat them as a description of what the next session will focus on and tailor the doc accordingly.\n",".agents/skills/improve-codebase-architecture/HTML-REPORT.md":"# HTML Report Format\n\nThe 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.\n\n## Scaffold\n\n```html\n<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"utf-8\" />\n    <title>Architecture review — {{repo name}}</title>\n    <script src=\"https://cdn.tailwindcss.com\"></script>\n    <script type=\"module\">\n      import mermaid from \"https://cdn.jsdelivr.net/npm/mermaid@11/dist/mermaid.esm.min.mjs\";\n      mermaid.initialize({ startOnLoad: true, theme: \"neutral\", securityLevel: \"loose\" });\n    </script>\n    <style>\n      /* small custom layer for things Tailwind doesn't cover cleanly:\n         dashed seam lines, hand-drawn-feeling arrow heads, etc. */\n      .seam { stroke-dasharray: 4 4; }\n      .leak { stroke: #dc2626; }\n      .deep { background: linear-gradient(135deg, #0f172a, #1e293b); }\n    </style>\n  </head>\n  <body class=\"bg-stone-50 text-slate-900 font-sans\">\n    <main class=\"max-w-5xl mx-auto px-6 py-12 space-y-12\">\n      <header>...</header>\n      <section id=\"candidates\" class=\"space-y-10\">...</section>\n      <section id=\"top-recommendation\">...</section>\n    </main>\n  </body>\n</html>\n```\n\n## Header\n\nRepo 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.\n\n## Candidate card\n\nThe diagrams carry the weight. Prose is sparse, plain, and uses the glossary terms (from the `/codebase-design` skill) without ceremony.\n\nEach candidate is one `<article>`:\n\n- **Title** — short, names the deepening (e.g. \"Collapse the Order intake pipeline\").\n- **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`).\n- **Files** — monospaced list, `font-mono text-sm`.\n- **Before / After diagram** — the centrepiece. Two columns, side by side. See patterns below.\n- **Problem** — one sentence. What hurts.\n- **Solution** — one sentence. What changes.\n- **Wins** — bullets, ≤6 words each. e.g. \"Tests hit one interface\", \"Pricing logic stops leaking\", \"Delete 4 shallow wrappers\".\n- **ADR callout** (if applicable) — one line in an amber-tinted box.\n\nNo paragraphs of explanation. If the diagram needs a paragraph to be understood, redraw the diagram.\n\n## Diagram patterns\n\nPick the pattern that fits the candidate. Mix them. Don't make every diagram look the same — variety is part of the point.\n\n### Mermaid graph (the workhorse for dependencies / call flow)\n\nUse 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.\"\n\n```html\n<div class=\"rounded-lg border border-slate-200 bg-white p-4\">\n  <pre class=\"mermaid\">\n    flowchart LR\n      A[OrderHandler] --> B[OrderValidator]\n      B --> C[OrderRepo]\n      C -.leak.-> D[PricingClient]\n      classDef leak stroke:#dc2626,stroke-width:2px;\n      class C,D leak\n  </pre>\n</div>\n```\n\n### Hand-built boxes-and-arrows (when Mermaid's layout fights you)\n\nModules 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.\n\n### Cross-section (good for layered shallowness)\n\nStack 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.\n\n### Mass diagram (good for \"interface as wide as implementation\")\n\nTwo 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).\n\n### Call-graph collapse\n\nBefore: 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.\n\n## Style guidance\n\n- Lean editorial, not corporate-dashboard. Generous whitespace. Serif optional for headings (`font-serif` works well with stone/slate).\n- Colour sparingly: one accent (emerald or indigo) plus red for leakage and amber for warnings.\n- Keep diagrams ~320px tall so before/after sits comfortably side by side without scrolling.\n- Use `text-xs uppercase tracking-wider` for module labels inside diagrams — they should read as schematic, not as UI.\n- 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.\n\n## Top recommendation section\n\nOne larger card. Candidate name, one sentence on why, anchor link to its card. That's it.\n\n## Tone\n\nPlain English, concise — but the architectural nouns and verbs come straight from the `/codebase-design` skill. Concision is not an excuse to drift.\n\n**Use exactly:** module, interface, implementation, depth, deep, shallow, seam, adapter, leverage, locality.\n\n**Never substitute:** component, service, unit (for module) · API, signature (for interface) · boundary (for seam) · layer, wrapper (for module, when you mean module).\n\n**Phrasings that fit the style:**\n\n- \"Order intake module is shallow — interface nearly matches the implementation.\"\n- \"Pricing leaks across the seam.\"\n- \"Deepen: one interface, one place to test.\"\n- \"Two adapters justify the seam: HTTP in prod, in-memory in tests.\"\n\n**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.\n\nNo 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.\n",".agents/skills/improve-codebase-architecture/SKILL.md":"---\nname: improve-codebase-architecture\ndescription: Scan a codebase for deepening opportunities, present them as a visual HTML report, then grill through whichever one you pick.\ndisable-model-invocation: true\n---\n\n# Improve Codebase Architecture\n\nSurface architectural friction and propose **deepening opportunities** — refactors that turn shallow modules into deep ones. The aim is testability and AI-navigability.\n\nThis command is _informed_ by the project's domain model and built on a shared design vocabulary:\n\n- 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.\"\n- The domain language in `CONTEXT.md` gives names to good seams; ADRs in `docs/adr/` record decisions this command should not re-litigate.\n\n## Process\n\n### 1. Explore\n\nRead the project's domain glossary (`CONTEXT.md`) and any ADRs in the area you're touching first.\n\nThen 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:\n\n- Where does understanding one concept require bouncing between many small modules?\n- Where are modules **shallow** — interface nearly as complex as the implementation?\n- Where have pure functions been extracted just for testability, but the real bugs hide in how they're called (no **locality**)?\n- Where do tightly-coupled modules leak across their seams?\n- Which parts of the codebase are untested, or hard to test through their current interface?\n\nApply 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.\n\n### 2. Present candidates as an HTML report\n\nWrite 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.\n\nThe 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.\n\nFor each candidate, render a card with:\n\n- **Files** — which files/modules are involved\n- **Problem** — why the current architecture is causing friction\n- **Solution** — plain English description of what would change\n- **Benefits** — explained in terms of locality and leverage, and how tests would improve\n- **Before / After diagram** — side-by-side, custom-drawn, illustrating the shallowness and the deepening\n- **Recommendation strength** — one of `Strong`, `Worth exploring`, `Speculative`, rendered as a badge\n\nEnd the report with a **Top recommendation** section: which candidate you'd tackle first and why.\n\n**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.\"\n\n**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.\n\nSee [HTML-REPORT.md](HTML-REPORT.md) for the full HTML scaffold, diagram patterns, and styling guidance.\n\nDo NOT propose interfaces yet. After the file is written, ask the user: \"Which of these would you like to explore?\"\n\n### 3. Grilling loop\n\nOnce 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.\n\nSide effects happen inline as decisions crystallize — run the `/domain-modeling` skill to keep the domain model current as you go:\n\n- **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.\n- **Sharpening a fuzzy term during the conversation?** Update `CONTEXT.md` right there.\n- **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.\n- **Want to explore alternative interfaces for the deepened module?** Run the `/codebase-design` skill and use its design-it-twice parallel sub-agent pattern.\n",".agents/skills/prototype/LOGIC.md":"# Logic Prototype\n\nA 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.\n\n## When this is the right shape\n\n- \"I'm not sure if this state machine handles the edge case where X then Y.\"\n- \"Does this data model actually let me represent the case where...\"\n- \"I want to feel out what the API should look like before writing it.\"\n- Anything where the user wants to **press buttons and watch state change**.\n\nIf the question is \"what should this look like\" — wrong branch. Use [UI.md](UI.md).\n\n## Process\n\n### 1. State the question\n\nBefore 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.\n\n### 2. Pick the language\n\nUse whatever the host project uses. If the project has no obvious runtime (e.g. a docs repo), ask.\n\nMatch the project's existing conventions for tooling — don't add a new package manager or runtime just for the prototype.\n\n### 3. Isolate the logic in a portable module\n\nPut 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.\n\nThe right shape depends on the question:\n\n- **A pure reducer** — `(state, action) => state`. Good when actions are discrete events and state is a single value.\n- **A state machine** — explicit states and transitions. Good when \"which actions are even legal right now\" is part of the question.\n- **A small set of pure functions** over a plain data type. Good when there's no implicit current state — just transformations.\n- **A class or module with a clear method surface** when the logic genuinely owns ongoing internal state.\n\nPick 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.\n\nThis 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.\n\n### 4. Build the smallest TUI that exposes the state\n\nBuild 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.\n\nEach frame has two parts, in this order:\n\n1. **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.\n2. **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.\n\nBehaviour:\n\n1. **Initialise state** — a single in-memory object/struct. Render the first frame on start.\n2. **Read one keystroke (or one line)** at a time, dispatch to a handler that mutates state.\n3. **Re-render** the full frame after every action — don't append, replace.\n4. **Loop until quit.**\n\nThe whole frame should fit on one screen.\n\n### 5. Make it runnable in one command\n\nAdd 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.\n\nIf the host project has no task runner, just put the command at the top of the prototype's README.\n\n### 6. Hand it over\n\nGive 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.\n\n### 7. Capture the answer\n\nWhen 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.\n\n## Anti-patterns\n\n- **Don't add tests.** A prototype that needs tests is no longer a prototype.\n- **Don't wire it to the real database.** Use an in-memory store unless the question is specifically about persistence.\n- **Don't generalise.** No \"what if we wanted to support X later.\" The prototype answers one question.\n- **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.\n- **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.\n",".agents/skills/prototype/SKILL.md":"---\nname: prototype\ndescription: Build a throwaway prototype to flesh out a design — a runnable terminal app for state/business-logic questions, or several radically different UI variations toggleable from one route.\ndisable-model-invocation: true\n---\n\n# Prototype\n\nA prototype is **throwaway code that answers a question**. The question decides the shape.\n\n## Pick a branch\n\nIdentify which question is being answered — from the user's prompt, the surrounding code, or by asking if the user is around:\n\n- **\"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.\n- **\"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.\n\nThe 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.\n\n## Rules that apply to both\n\n1. **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.\n2. **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.\n3. **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.\n4. **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.\n5. **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.\n6. **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.\n\n## When done\n\nThe _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.\n",".agents/skills/prototype/UI.md":"# UI Prototype\n\nGenerate **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.\n\nIf the question is about logic/state rather than what something looks like — wrong branch. Use [LOGIC.md](LOGIC.md).\n\n## When this is the right shape\n\n- \"What should this page look like?\"\n- \"I want to see a few options for this dashboard before committing.\"\n- \"Try a different layout for the settings screen.\"\n- Any time the user would otherwise spend a day picking between three vague mockups in their head.\n\n## Two sub-shapes — strongly prefer sub-shape A\n\nA 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.\n\n### Sub-shape A — adjustment to an existing page (preferred)\n\nThe 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.\n\nIf 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.\n\n### Sub-shape B — a new page (last resort)\n\nOnly 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.\n\nCreate 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.\n\nBefore 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.\n\nIn both sub-shapes the floating bottom bar is identical.\n\n## Process\n\n### 1. State the question and pick N\n\nDefault to **3 variants**. More than 5 stops being radically different and starts being noise — cap there.\n\nWrite down the plan in one line, in the prototype's location or a top-of-file comment:\n\n> \"Three variants of the settings page, switchable via `?variant=`, on the existing `/settings` route.\"\n\nThis works whether the user is here to push back or not.\n\n### 2. Generate radically different variants\n\nDraft each variant. Hold each one to:\n\n- The page's purpose and the data it has access to.\n- The project's component library / styling system (TailwindCSS, shadcn, MUI, plain CSS, whatever).\n- A clear exported component name, e.g. `VariantA`, `VariantB`, `VariantC`.\n\nVariants 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.\n\n### 3. Wire them together\n\nCreate a single switcher component on the route:\n\n```tsx\n// pseudo-code — adapt to the project's framework\nconst variant = searchParams.get('variant') ?? 'A';\nreturn (\n  <>\n    {variant === 'A' && <VariantA {...data} />}\n    {variant === 'B' && <VariantB {...data} />}\n    {variant === 'C' && <VariantC {...data} />}\n    <PrototypeSwitcher variants={['A','B','C']} current={variant} />\n  </>\n);\n```\n\nFor sub-shape A (existing page): keep all the existing data fetching above the switcher; only the rendered subtree changes per variant.\n\nFor sub-shape B (new page): the throwaway route under `/prototype/<name>` mounts the same switcher.\n\n### 4. Build the floating switcher\n\nA small fixed-position bar at the bottom-centre of the screen with three pieces:\n\n- **Left arrow** — cycles to the previous variant (wraps around).\n- **Variant label** — shows the current variant key and, if the variant exports a name, that name too. e.g. `B — Sidebar layout`.\n- **Right arrow** — cycles forward (wraps around).\n\nBehaviour:\n\n- 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.\n- Keyboard: `←` and `→` arrow keys also cycle. Don't intercept arrow keys when an `<input>`, `<textarea>`, or `[contenteditable]` is focused.\n- Visually distinct from the page (e.g. high-contrast pill, subtle shadow) so it's obviously not part of the design being evaluated.\n- 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.\n\nPut the switcher in a single shared component so both sub-shapes can reuse it. Locate it wherever shared UI lives in the project.\n\n### 5. Hand it over\n\nSurface 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.\n\n### 6. Capture the answer and clean up\n\nOnce 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:\n\n- **Sub-shape A** — delete the losing variants and the switcher; fold the winner into the existing page.\n- **Sub-shape B** — promote the winning variant to a real route, delete the throwaway route and the switcher.\n\nDon't leave variant components or the switcher lying around. They rot fast and confuse the next reader.\n\n## Anti-patterns\n\n- **Variants that differ only in colour or copy.** That's a tweak, not a prototype. Real variants disagree about structure.\n- **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.\n- **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\".\n- **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.\n",".agents/skills/setup-matt-pocock-skills/SKILL.md":"---\nname: setup-matt-pocock-skills\ndescription: 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.\ndisable-model-invocation: true\n---\n\n# Setup Matt Pocock's Skills\n\nScaffold the per-repo configuration that the engineering skills assume:\n\n- **Issue tracker** — where issues live (GitHub by default; local markdown is also supported out of the box)\n- **Triage labels** — the strings used for the five canonical triage roles\n- **Domain docs** — where `CONTEXT.md` and ADRs live, and the consumer rules for reading them\n\nThis is a prompt-driven skill, not a deterministic script. Explore, present what you found, confirm with the user, then write.\n\n## Process\n\n### 1. Explore\n\nLook at the current repo to understand its starting state. Read whatever exists; don't assume:\n\n- `git remote -v` and `.git/config` — is this a GitHub repo? Which one?\n- `AGENTS.md` and `CLAUDE.md` at the repo root — does either exist? Is there already an `## Agent skills` section in either?\n- `CONTEXT.md` and `CONTEXT-MAP.md` at the repo root\n- `docs/adr/` and any `src/*/docs/adr/` directories\n- `docs/agents/` — does this skill's prior output already exist?\n- `.scratch/` — sign that a local-markdown issue tracker convention is already in use\n\n### 2. Present findings and ask\n\nSummarise 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.\n\nAssume 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.\n\n**Section A — Issue tracker.**\n\n> 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.\n\nDefault 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:\n\n- **GitHub** — issues live in the repo's GitHub Issues (uses the `gh` CLI)\n- **GitLab** — issues live in the repo's GitLab Issues (uses the [`glab`](https://gitlab.com/gitlab-org/cli) CLI)\n- **Local markdown** — issues live as files under `.scratch/<feature>/` in this repo (good for solo projects or repos without a remote)\n- **Other** (Jira, Linear, etc.) — ask the user to describe the workflow in one paragraph; the skill will record it as freeform prose\n\nIf — and only if — the user picked **GitHub** or **GitLab**, ask one follow-up:\n\n> 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.\n\n- **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.\n\n**Section B — Triage label vocabulary.**\n\n> 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.\n\nThe five canonical roles:\n\n- `needs-triage` — maintainer needs to evaluate\n- `needs-info` — waiting on reporter\n- `ready-for-agent` — fully specified, AFK-ready (an agent can pick it up with no human context)\n- `ready-for-human` — needs human implementation\n- `wontfix` — will not be actioned\n\nDefault: 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.\n\n**Section C — Domain docs.**\n\n> 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.\n\nConfirm the layout:\n\n- **Single-context** — one `CONTEXT.md` + `docs/adr/` at the repo root. Most repos are this.\n- **Multi-context** — `CONTEXT-MAP.md` at the root pointing to per-context `CONTEXT.md` files (typically a monorepo).\n\n### 3. Confirm and edit\n\nShow the user a draft of:\n\n- The `## Agent skills` block to add to whichever of `CLAUDE.md` / `AGENTS.md` is being edited (see step 4 for selection rules)\n- The contents of `docs/agents/issue-tracker.md`, `docs/agents/triage-labels.md`, `docs/agents/domain.md`\n\nLet them edit before writing.\n\n### 4. Write\n\n**Pick the file to edit:**\n\n- If `CLAUDE.md` exists, edit it.\n- Else if `AGENTS.md` exists, edit it.\n- If neither exists, ask the user which one to create — don't pick for them.\n\nNever create `AGENTS.md` when `CLAUDE.md` already exists (or vice versa) — always edit the one that's already there.\n\nIf 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.\n\nThe block:\n\n```markdown\n## Agent skills\n\n### Issue tracker\n\n[one-line summary of where issues are tracked, plus whether external PRs are a triage surface]. See `docs/agents/issue-tracker.md`.\n\n### Triage labels\n\n[one-line summary of the label vocabulary]. See `docs/agents/triage-labels.md`.\n\n### Domain docs\n\n[one-line summary of layout — \"single-context\" or \"multi-context\"]. See `docs/agents/domain.md`.\n```\n\nThen write the three docs files using the seed templates in this skill folder as a starting point:\n\n- [issue-tracker-github.md](./issue-tracker-github.md) — GitHub issue tracker\n- [issue-tracker-gitlab.md](./issue-tracker-gitlab.md) — GitLab issue tracker\n- [issue-tracker-local.md](./issue-tracker-local.md) — local-markdown issue tracker\n- [triage-labels.md](./triage-labels.md) — label mapping\n- [domain.md](./domain.md) — domain doc consumer rules + layout\n\nFor \"other\" issue trackers, write `docs/agents/issue-tracker.md` from scratch using the user's description.\n\n### 5. Done\n\nTell 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.\n",".agents/skills/setup-matt-pocock-skills/domain.md":"# Domain Docs\n\nHow the engineering skills should consume this repo's domain documentation when exploring the codebase.\n\n## Before exploring, read these\n\n- **`CONTEXT.md`** at the repo root, or\n- **`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.\n- **`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.\n\nIf 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.\n\n## File structure\n\nSingle-context repo (most repos):\n\n```\n/\n├── CONTEXT.md\n├── docs/adr/\n│   ├── 0001-event-sourced-orders.md\n│   └── 0002-postgres-for-write-model.md\n└── src/\n```\n\nMulti-context repo (presence of `CONTEXT-MAP.md` at the root):\n\n```\n/\n├── CONTEXT-MAP.md\n├── docs/adr/                          ← system-wide decisions\n└── src/\n    ├── ordering/\n    │   ├── CONTEXT.md\n    │   └── docs/adr/                  ← context-specific decisions\n    └── billing/\n        ├── CONTEXT.md\n        └── docs/adr/\n```\n\n## Use the glossary's vocabulary\n\nWhen 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.\n\nIf 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`).\n\n## Flag ADR conflicts\n\nIf your output contradicts an existing ADR, surface it explicitly rather than silently overriding:\n\n> _Contradicts ADR-0007 (event-sourced orders) — but worth reopening because…_\n",".agents/skills/setup-matt-pocock-skills/issue-tracker-github.md":"# Issue tracker: GitHub\n\nIssues and PRDs for this repo live as GitHub issues. Use the `gh` CLI for all operations.\n\n## Conventions\n\n- **Create an issue**: `gh issue create --title \"...\" --body \"...\"`. Use a heredoc for multi-line bodies.\n- **Read an issue**: `gh issue view <number> --comments`, filtering comments by `jq` and also fetching labels.\n- **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.\n- **Comment on an issue**: `gh issue comment <number> --body \"...\"`\n- **Apply / remove labels**: `gh issue edit <number> --add-label \"...\"` / `--remove-label \"...\"`\n- **Close**: `gh issue close <number> --comment \"...\"`\n\nInfer the repo from `git remote -v` — `gh` does this automatically when run inside a clone.\n\n## Pull requests as a triage surface\n\n**PRs as a request surface: no.** _(Set to `yes` if this repo treats external PRs as feature requests; `/triage` reads this flag.)_\n\nWhen set to `yes`, PRs run through the same labels and states as issues, using the `gh pr` equivalents:\n\n- **Read a PR**: `gh pr view <number> --comments` and `gh pr diff <number>` for the diff.\n- **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`).\n- **Comment / label / close**: `gh pr comment`, `gh pr edit --add-label`/`--remove-label`, `gh pr close`.\n\nGitHub 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`.\n\n## When a skill says \"publish to the issue tracker\"\n\nCreate a GitHub issue.\n\n## When a skill says \"fetch the relevant ticket\"\n\nRun `gh issue view <number> --comments`.\n",".agents/skills/setup-matt-pocock-skills/issue-tracker-gitlab.md":"# Issue tracker: GitLab\n\nIssues and PRDs for this repo live as GitLab issues. Use the [`glab`](https://gitlab.com/gitlab-org/cli) CLI for all operations.\n\n## Conventions\n\n- **Create an issue**: `glab issue create --title \"...\" --description \"...\"`. Use a heredoc for multi-line descriptions. Pass `--description -` to open an editor.\n- **Read an issue**: `glab issue view <number> --comments`. Use `-F json` for machine-readable output.\n- **List issues**: `glab issue list -F json` with appropriate `--label` filters.\n- **Comment on an issue**: `glab issue note <number> --message \"...\"`. GitLab calls comments \"notes\".\n- **Apply / remove labels**: `glab issue update <number> --label \"...\"` / `--unlabel \"...\"`. Multiple labels can be comma-separated or by repeating the flag.\n- **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.\n- **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`.\n\nInfer the repo from `git remote -v` — `glab` does this automatically when run inside a clone.\n\n## Merge requests as a triage surface\n\n**MRs as a request surface: no.** _(Set to `yes` if this repo treats external merge requests as feature requests; `/triage` reads this flag.)_\n\nWhen set to `yes`, MRs run through the same labels and states as issues, using the `glab mr` equivalents:\n\n- **Read an MR**: `glab mr view <number> --comments` and `glab mr diff <number>` for the diff.\n- **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).\n- **Comment / label / close**: `glab mr note`, `glab mr update --label`/`--unlabel`, `glab mr close`.\n\nUnlike GitHub, GitLab numbers issues and MRs separately, so `#42` is unambiguous once you know which surface the maintainer means.\n\n## When a skill says \"publish to the issue tracker\"\n\nCreate a GitLab issue.\n\n## When a skill says \"fetch the relevant ticket\"\n\nRun `glab issue view <number> --comments`.\n",".agents/skills/setup-matt-pocock-skills/issue-tracker-local.md":"# Issue tracker: Local Markdown\n\nIssues and PRDs for this repo live as markdown files in `.scratch/`.\n\n## Conventions\n\n- One feature per directory: `.scratch/<feature-slug>/`\n- The PRD is `.scratch/<feature-slug>/PRD.md`\n- Implementation issues are `.scratch/<feature-slug>/issues/<NN>-<slug>.md`, numbered from `01`\n- Triage state is recorded as a `Status:` line near the top of each issue file (see `triage-labels.md` for the role strings)\n- Comments and conversation history append to the bottom of the file under a `## Comments` heading\n\n## When a skill says \"publish to the issue tracker\"\n\nCreate a new file under `.scratch/<feature-slug>/` (creating the directory if needed).\n\n## When a skill says \"fetch the relevant ticket\"\n\nRead the file at the referenced path. The user will normally pass the path or the issue number directly.\n",".agents/skills/setup-matt-pocock-skills/triage-labels.md":"# Triage Labels\n\nThe 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.\n\n| Label in mattpocock/skills | Label in our tracker | Meaning                                  |\n| -------------------------- | -------------------- | ---------------------------------------- |\n| `needs-triage`             | `needs-triage`       | Maintainer needs to evaluate this issue  |\n| `needs-info`               | `needs-info`         | Waiting on reporter for more information |\n| `ready-for-agent`          | `ready-for-agent`    | Fully specified, ready for an AFK agent  |\n| `ready-for-human`          | `ready-for-human`    | Requires human implementation            |\n| `wontfix`                  | `wontfix`            | Will not be actioned                     |\n\nWhen a skill mentions a role (e.g. \"apply the AFK-ready triage label\"), use the corresponding label string from this table.\n\nEdit the right-hand column to match whatever vocabulary you actually use.\n",".agents/skills/tdd/SKILL.md":"---\nname: tdd\ndescription: Test-driven development. Use when the user wants to build features or fix bugs test-first, mentions \"red-green-refactor\", or wants integration tests.\n---\n\n# Test-Driven Development\n\n## Philosophy\n\n**Core principle**: Tests should verify behavior through public interfaces, not implementation details. Code can change entirely; tests shouldn't.\n\n**Good tests** are integration-style: they exercise real code paths through public APIs. They describe _what_ the system does, not _how_ it does it. A good test reads like a specification - \"user can checkout with valid cart\" tells you exactly what capability exists. These tests survive refactors because they don't care about internal structure.\n\n**Bad tests** are coupled to implementation. They mock internal collaborators, test private methods, or verify through external means (like querying a database directly instead of using the interface). The warning sign: your test breaks when you refactor, but behavior hasn't changed. If you rename an internal function and tests fail, those tests were testing implementation, not behavior.\n\nSee [tests.md](tests.md) for examples and [mocking.md](mocking.md) for mocking guidelines.\n\n## Anti-Pattern: Horizontal Slices\n\n**DO NOT write all tests first, then all implementation.** This is \"horizontal slicing\" - treating RED as \"write all tests\" and GREEN as \"write all code.\"\n\nThis produces **crap tests**:\n\n- Tests written in bulk test _imagined_ behavior, not _actual_ behavior\n- You end up testing the _shape_ of things (data structures, function signatures) rather than user-facing behavior\n- Tests become insensitive to real changes - they pass when behavior breaks, fail when behavior is fine\n- You outrun your headlights, committing to test structure before understanding the implementation\n\n**Correct approach**: Vertical slices via tracer bullets. One test → one implementation → repeat. Each test responds to what you learned from the previous cycle. Because you just wrote the code, you know exactly what behavior matters and how to verify it.\n\n```\nWRONG (horizontal):\n  RED:   test1, test2, test3, test4, test5\n  GREEN: impl1, impl2, impl3, impl4, impl5\n\nRIGHT (vertical):\n  RED→GREEN: test1→impl1\n  RED→GREEN: test2→impl2\n  RED→GREEN: test3→impl3\n  ...\n```\n\n## Workflow\n\n### 1. Planning\n\nWhen exploring the codebase, read `CONTEXT.md` (if it exists) so that test names and interface vocabulary match the project's domain language, and respect ADRs in the area you're touching.\n\nBefore writing any code:\n\n- [ ] Confirm with user what interface changes are needed\n- [ ] Confirm with user which behaviors to test (prioritize)\n- [ ] Identify opportunities for deep modules (small interface, deep implementation) — run the `/codebase-design` skill for the vocabulary and the testability checks\n- [ ] List the behaviors to test (not implementation steps)\n- [ ] Get user approval on the plan\n\nAsk: \"What should the public interface look like? Which behaviors are most important to test?\"\n\n**You can't test everything.** Confirm with the user exactly which behaviors matter most. Focus testing effort on critical paths and complex logic, not every possible edge case.\n\n### 2. Tracer Bullet\n\nWrite ONE test that confirms ONE thing about the system:\n\n```\nRED:   Write test for first behavior → test fails\nGREEN: Write minimal code to pass → test passes\n```\n\nThis is your tracer bullet - proves the path works end-to-end.\n\n### 3. Incremental Loop\n\nFor each remaining behavior:\n\n```\nRED:   Write next test → fails\nGREEN: Minimal code to pass → passes\n```\n\nRules:\n\n- One test at a time\n- Only enough code to pass current test\n- Don't anticipate future tests\n- Keep tests focused on observable behavior\n\n### 4. Refactor\n\nAfter all tests pass, look for [refactor candidates](refactoring.md):\n\n- [ ] Extract duplication\n- [ ] Deepen modules (move complexity behind simple interfaces)\n- [ ] Apply SOLID principles where natural\n- [ ] Consider what new code reveals about existing code\n- [ ] Run tests after each refactor step\n\n**Never refactor while RED.** Get to GREEN first.\n\n## Checklist Per Cycle\n\n```\n[ ] Test describes behavior, not implementation\n[ ] Test uses public interface only\n[ ] Test would survive internal refactor\n[ ] Code is minimal for this test\n[ ] No speculative features added\n```\n",".agents/skills/tdd/mocking.md":"# When to Mock\n\nMock at **system boundaries** only:\n\n- External APIs (payment, email, etc.)\n- Databases (sometimes - prefer test DB)\n- Time/randomness\n- File system (sometimes)\n\nDon't mock:\n\n- Your own classes/modules\n- Internal collaborators\n- Anything you control\n\n## Designing for Mockability\n\nAt system boundaries, design interfaces that are easy to mock:\n\n**1. Use dependency injection**\n\nPass external dependencies in rather than creating them internally:\n\n```typescript\n// Easy to mock\nfunction processPayment(order, paymentClient) {\n  return paymentClient.charge(order.total);\n}\n\n// Hard to mock\nfunction processPayment(order) {\n  const client = new StripeClient(process.env.STRIPE_KEY);\n  return client.charge(order.total);\n}\n```\n\n**2. Prefer SDK-style interfaces over generic fetchers**\n\nCreate specific functions for each external operation instead of one generic function with conditional logic:\n\n```typescript\n// GOOD: Each function is independently mockable\nconst api = {\n  getUser: (id) => fetch(`/users/${id}`),\n  getOrders: (userId) => fetch(`/users/${userId}/orders`),\n  createOrder: (data) => fetch('/orders', { method: 'POST', body: data }),\n};\n\n// BAD: Mocking requires conditional logic inside the mock\nconst api = {\n  fetch: (endpoint, options) => fetch(endpoint, options),\n};\n```\n\nThe SDK approach means:\n- Each mock returns one specific shape\n- No conditional logic in test setup\n- Easier to see which endpoints a test exercises\n- Type safety per endpoint\n",".agents/skills/tdd/refactoring.md":"# Refactor Candidates\n\nAfter TDD cycle, look for:\n\n- **Duplication** → Extract function/class\n- **Long methods** → Break into private helpers (keep tests on public interface)\n- **Shallow modules** → Combine or deepen\n- **Feature envy** → Move logic to where data lives\n- **Primitive obsession** → Introduce value objects\n- **Existing code** the new code reveals as problematic\n",".agents/skills/tdd/tests.md":"# Good and Bad Tests\n\n## Good Tests\n\n**Integration-style**: Test through real interfaces, not mocks of internal parts.\n\n```typescript\n// GOOD: Tests observable behavior\ntest(\"user can checkout with valid cart\", async () => {\n  const cart = createCart();\n  cart.add(product);\n  const result = await checkout(cart, paymentMethod);\n  expect(result.status).toBe(\"confirmed\");\n});\n```\n\nCharacteristics:\n\n- Tests behavior users/callers care about\n- Uses public API only\n- Survives internal refactors\n- Describes WHAT, not HOW\n- One logical assertion per test\n\n## Bad Tests\n\n**Implementation-detail tests**: Coupled to internal structure.\n\n```typescript\n// BAD: Tests implementation details\ntest(\"checkout calls paymentService.process\", async () => {\n  const mockPayment = jest.mock(paymentService);\n  await checkout(cart, payment);\n  expect(mockPayment.process).toHaveBeenCalledWith(cart.total);\n});\n```\n\nRed flags:\n\n- Mocking internal collaborators\n- Testing private methods\n- Asserting on call counts/order\n- Test breaks when refactoring without behavior change\n- Test name describes HOW not WHAT\n- Verifying through external means instead of interface\n\n```typescript\n// BAD: Bypasses interface to verify\ntest(\"createUser saves to database\", async () => {\n  await createUser({ name: \"Alice\" });\n  const row = await db.query(\"SELECT * FROM users WHERE name = ?\", [\"Alice\"]);\n  expect(row).toBeDefined();\n});\n\n// GOOD: Verifies through interface\ntest(\"createUser makes user retrievable\", async () => {\n  const user = await createUser({ name: \"Alice\" });\n  const retrieved = await getUser(user.id);\n  expect(retrieved.name).toBe(\"Alice\");\n});\n```\n",".agents/skills/teach/GLOSSARY-FORMAT.md":"# GLOSSARY.md Format\n\n`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.\n\n## Structure\n\n```md\n# {Topic} Glossary\n\n{One or two sentence description of the topic this glossary covers.}\n\n## Terms\n\n**Hypertrophy**:\nMuscle growth driven by mechanical tension and metabolic stress over repeated training sessions.\n_Avoid_: Bulking, getting big\n\n**Progressive overload**:\nSystematically increasing the demand on a muscle over time — via load, volume, or intensity.\n_Avoid_: Pushing harder, levelling up\n\n**RPE (Rate of Perceived Exertion)**:\nA 1–10 self-rating of how hard a set felt, where 10 is failure and 8 means two reps left in the tank.\n_Avoid_: Effort score, intensity rating\n```\n\n## Rules\n\n- **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.\n- **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.\n- **Keep definitions tight.** One or two sentences. Define what the term IS, not what it does or how to do it.\n- **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.\n- **Group under subheadings** when natural clusters emerge (e.g. `## Anatomy`, `## Programming`). A flat list is fine when terms cohere.\n- **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.\"\n- **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.\n",".agents/skills/teach/LEARNING-RECORD-FORMAT.md":"# Learning Record Format\n\nLearning 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.\n\nThey 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.\n\n## Template\n\n```md\n# {Short title of what was learned or established}\n\n{1-3 sentences: what was learned (or what prior knowledge was established), and why it matters for future sessions.}\n```\n\nThat 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.\n\n## Optional sections\n\nOnly include these when they add genuine value. Most records won't need them.\n\n- **Status** frontmatter (`active | superseded by LR-NNNN`) — useful when an earlier understanding turns out to be wrong and is replaced.\n- **Evidence** — how the user demonstrated the understanding (a question answered, an exercise completed, prior experience cited). Useful when the claim might be revisited.\n- **Implications** — what this unlocks or rules out for future sessions. Worth recording when non-obvious.\n\n## Numbering\n\nScan `./learning-records/` for the highest existing number and increment by one.\n\n## When to write a learning record\n\nWrite one when any of these is true:\n\n1. **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.\n2. **The user disclosed prior knowledge** — \"I already know X.\" Record it so future sessions don't re-teach it. Also record the _depth_ claimed.\n3. **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.\n4. **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.\n\n### What does _not_ qualify\n\n- Material that was merely covered. Coverage is not learning. Wait for evidence.\n- Anything already captured tersely in [[GLOSSARY.md]] as a term definition. Don't duplicate.\n- Session-by-session activity logs. Learning records are not a journal — they are decision-grade insights.\n\n## Supersession\n\nWhen 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.\n",".agents/skills/teach/MISSION-FORMAT.md":"# MISSION.md Format\n\n`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.\n\n## Template\n\n```md\n# Mission: {Topic}\n\n## Why\n{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.}\n\n## Success looks like\n- {A specific, observable thing the user will be able to do}\n- {Another specific thing}\n- {…}\n\n## Constraints\n- {Time, budget, prior commitments, learning preferences, anything that bounds the approach}\n\n## Out of scope\n- {Adjacent topics the user explicitly does not want to chase right now — protects the zone of proximal development}\n```\n\n## Rules\n\n- **One mission per workspace.** If the user wants to learn two unrelated things, that is two workspaces.\n- **Concrete over abstract.** \"Run a half marathon by October\" beats \"get fitter.\" \"Ship a Rust CLI to my team\" beats \"learn Rust.\"\n- **Push back on vagueness.** If the user cannot articulate why, interview them before writing anything. A bad mission is worse than no mission.\n- **Revise when reality shifts.** Missions change. When the user's goal moves, update this file — don't leave a stale mission steering future sessions.\n- **Keep it short.** If `MISSION.md` runs past a screen, it has stopped being a compass and started being a plan.\n",".agents/skills/teach/RESOURCES-FORMAT.md":"# RESOURCES.md Format\n\n`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.\n\n## Structure\n\n```md\n# {Topic} Resources\n\n## Knowledge\n\n- [Book: _The Science and Practice of Strength Training_ — Zatsiorsky & Kraemer](https://example.com)\n  Foundational text on programming and adaptation. Use for: anything to do with periodisation, recovery, intensity zones.\n- [Article: \"How Much Should I Train?\" — Greg Nuckols (Stronger By Science)](https://example.com)\n  Evidence-based review of volume landmarks. Use for: weekly set targets per muscle group.\n\n## Wisdom (Communities)\n\n- [r/weightroom](https://reddit.com/r/weightroom)\n  High-signal subreddit, moderated against bro-science. Use for: programme critique, plateau troubleshooting.\n- Local: Tuesday strength class at {gym name}\n  Use for: real-time coaching feedback on lifts.\n```\n\n## Rules\n\n- **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.\n- **Annotate every entry.** A bare link is useless in three months. Add one line: what it covers and when to reach for it.\n- **Group by Knowledge / Wisdom.** Mirrors the philosophy in [SKILL.md](./SKILL.md). It is fine for a resource to appear in only one group.\n- **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.\n- **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.\n- **Record community preferences.** If the user has opted out of joining communities, note it here so future sessions don't keep proposing them.\n",".agents/skills/teach/SKILL.md":"---\nname: teach\ndescription: Teach the user a new skill or concept, within this workspace.\ndisable-model-invocation: true\nargument-hint: \"What would you like to learn about?\"\n---\n\nThe user has asked you to teach them something. This is a stateful request - they intend to learn the topic over multiple sessions.\n\n## Teaching Workspace\n\nTreat the current directory as a teaching workspace. The state of their learning is captured in this directory in several files:\n\n- `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).\n- `./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.\n- `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).\n- `./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).\n- `./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.\n- `./assets/*`: Reusable **components** shared across lessons. See [Assets](#assets).\n- `NOTES.md`: A scratchpad for you to jot down user preferences, or working notes.\n\n## Philosophy\n\nTo learn at a deep level, the user needs three things:\n\n- **Knowledge**, captured from high-quality, high-trust resources\n- **Skills**, acquired through highly-relevant interactive lessons devised by you, based on the knowledge\n- **Wisdom**, which comes from interacting with other learners and practitioners\n\nBefore 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.\n\nSome topics may require more skills than knowledge. Learning more about theoretical physics might be more knowledge-based. For yoga, more skills-based.\n\n### Fluency vs Storage Strength\n\nYou should be careful to split between two types of learning:\n\n- **Fluency strength**: in-the-moment retrieval of knowledge\n- **Storage strength**: long-term retention of knowledge\n\nFluency 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:\n\n- Using retrieval practice (recall from memory)\n- Spacing (distributing practice over time)\n- Interleaving (mixing up different but related topics in practice - for skills practice only)\n\n## Lessons\n\nA 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.\n\nA lesson should be **beautiful** — clean, readable typography and layout — since the user will return to these later to review. Think Tufte.\n\nThe 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.\n\nIf possible, open the lesson file for the user by running a CLI command.\n\nEach lesson should link via HTML anchors to other lessons and reference documents.\n\nEach 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.\n\nEach 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.\n\n## Assets\n\nLessons are built from reusable **components**, stored in `./assets/`: stylesheets, quiz widgets, simulators, diagram helpers — anything a second lesson could reuse.\n\nReuse 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.\n\nA 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.\n\n## The Mission\n\nEvery lesson should be tied into the mission - the reason that the user is interested in learning about the topic.\n\nIf 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.\n\nFailing 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.\n\nMissions 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.\n\n## Zone Of Proximal Development\n\nEach lesson, the user should always feel as if they are being challenged 'just enough'.\n\nThe user may specify an exact thing they want to learn. If they don't, figure out their zone of proximal development by:\n\n- Reading their `learning-records`\n- Figuring out the right thing to teach them based on their mission\n- Teach the most relevant thing that fits in their zone of proximal development\n\n## Knowledge\n\nLessons 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.\n\nKnowledge 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.\n\nFor acquiring knowledge, difficulty is the enemy. It eats working memory you need for understanding.\n\n## Skills\n\nIf knowledge is all about acquisition, skills are about durability and flexibility. Make the knowledge stick.\n\nFor 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:\n\n- Interactive lessons, using quizzes and light in-browser tasks\n- Lessons which guide the user through a list of real-world steps to take (for instance, yoga poses)\n\nEach 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.\n\nFor 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.\n\n## Acquiring Wisdom\n\nWisdom comes from true real-world interaction - testing your skills outside the learning environment.\n\nWhen 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**.\n\nA 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.\n\nYou 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.\n\n## Reference Documents\n\nWhile 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.\n\nLessons 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.\n\nSome learning topics lend themselves to reference:\n\n- Syntax and code snippets for programming\n- Algorithms and flowcharts for processes\n- Yoga poses and sequences for yoga\n- Exercises and routines for fitness\n- Glossaries for any topic with its own nomenclature\n\nGlossaries, in particular, are an essential reference. Once one is created, it should be adhered to in every lesson.\n\n## `NOTES.md`\n\nThe 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.\n",".agents/skills/to-issues/SKILL.md":"---\nname: to-issues\ndescription: Break a plan, spec, or PRD into independently-grabbable issues on the project issue tracker using tracer-bullet vertical slices.\ndisable-model-invocation: true\n---\n\n# To Issues\n\nBreak a plan into independently-grabbable issues using vertical slices (tracer bullets).\n\nThe issue tracker and triage label vocabulary should have been provided to you — run `/setup-matt-pocock-skills` if not.\n\n## Process\n\n### 1. Gather context\n\nWork 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.\n\n### 2. Explore the codebase (optional)\n\nIf 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.\n\nLook for opportunities to prefactor the code to make the implementation easier. \"Make the change easy, then make the easy change.\"\n\n### 3. Draft vertical slices\n\nBreak 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.\n\n<vertical-slice-rules>\n\n- Each slice delivers a narrow but COMPLETE path through every layer (schema, API, UI, tests)\n- A completed slice is demoable or verifiable on its own\n- Any prefactoring should be done first\n\n</vertical-slice-rules>\n\n### 4. Quiz the user\n\nPresent the proposed breakdown as a numbered list. For each slice, show:\n\n- **Title**: short descriptive name\n- **Blocked by**: which other slices (if any) must complete first\n- **User stories covered**: which user stories this addresses (if the source material has them)\n\nAsk the user:\n\n- Does the granularity feel right? (too coarse / too fine)\n- Are the dependency relationships correct?\n- Should any slices be merged or split further?\n\nIterate until the user approves the breakdown.\n\n### 5. Publish the issues to the issue tracker\n\nFor 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.\n\nPublish issues in dependency order (blockers first) so you can reference real issue identifiers in the \"Blocked by\" field.\n\n<issue-template>\n## Parent\n\nA reference to the parent issue on the issue tracker (if the source was an existing issue, otherwise omit this section).\n\n## What to build\n\nA concise description of this vertical slice. Describe the end-to-end behavior, not layer-by-layer implementation.\n\nAvoid 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.\n\n## Acceptance criteria\n\n- [ ] Criterion 1\n- [ ] Criterion 2\n- [ ] Criterion 3\n\n## Blocked by\n\n- A reference to the blocking ticket (if any)\n\nOr \"None - can start immediately\" if no blockers.\n\n</issue-template>\n\nDo NOT close or modify any parent issue.\n",".agents/skills/to-prd/SKILL.md":"---\nname: to-prd\ndescription: 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.\ndisable-model-invocation: true\n---\n\nThis skill takes the current conversation context and codebase understanding and produces a PRD. Do NOT interview the user — just synthesize what you already know.\n\nThe issue tracker and triage label vocabulary should have been provided to you — run `/setup-matt-pocock-skills` if not.\n\n## Process\n\n1. 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.\n\n2. 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.\n\nCheck with the user that these seams match their expectations.\n\n3. 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.\n\n<prd-template>\n\n## Problem Statement\n\nThe problem that the user is facing, from the user's perspective.\n\n## Solution\n\nThe solution to the problem, from the user's perspective.\n\n## User Stories\n\nA LONG, numbered list of user stories. Each user story should be in the format of:\n\n1. As an <actor>, I want a <feature>, so that <benefit>\n\n<user-story-example>\n1. As a mobile bank customer, I want to see balance on my accounts, so that I can make better informed decisions about my spending\n</user-story-example>\n\nThis list of user stories should be extremely extensive and cover all aspects of the feature.\n\n## Implementation Decisions\n\nA list of implementation decisions that were made. This can include:\n\n- The modules that will be built/modified\n- The interfaces of those modules that will be modified\n- Technical clarifications from the developer\n- Architectural decisions\n- Schema changes\n- API contracts\n- Specific interactions\n\nDo NOT include specific file paths or code snippets. They may end up being outdated very quickly.\n\nException: 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.\n\n## Testing Decisions\n\nA list of testing decisions that were made. Include:\n\n- A description of what makes a good test (only test external behavior, not implementation details)\n- Which modules will be tested\n- Prior art for the tests (i.e. similar types of tests in the codebase)\n\n## Out of Scope\n\nA description of the things that are out of scope for this PRD.\n\n## Further Notes\n\nAny further notes about the feature.\n\n</prd-template>\n",".agents/skills/triage/AGENT-BRIEF.md":"# Writing Agent Briefs\n\nAn 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.\n\nThe 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.\n\n## Principles\n\n### Durability over precision\n\nThe 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.\n\n- **Do** describe interfaces, types, and behavioral contracts\n- **Do** name specific types, function signatures, or config shapes that the agent should look for or modify\n- **Don't** reference file paths — they go stale\n- **Don't** reference line numbers\n- **Don't** assume the current implementation structure will remain the same\n\n### Behavioral, not procedural\n\nDescribe **what** the system should do, not **how** to implement it. The agent will explore the codebase fresh and make its own implementation decisions.\n\n- **Good:** \"The `SkillConfig` type should accept an optional `schedule` field of type `CronExpression`\"\n- **Bad:** \"Open src/types/skill.ts and add a schedule field on line 42\"\n- **Good:** \"When a user runs `/triage` with no arguments, they should see a summary of issues needing attention\"\n- **Bad:** \"Add a switch statement in the main handler function\"\n\n### Complete acceptance criteria\n\nThe agent needs to know when it's done. Every agent brief must have concrete, testable acceptance criteria. Each criterion should be independently verifiable.\n\n- **Good:** \"Running `gh issue list --label needs-triage` returns issues that have been through initial classification\"\n- **Bad:** \"Triage should work correctly\"\n\n### Explicit scope boundaries\n\nState what is out of scope. This prevents the agent from gold-plating or making assumptions about adjacent features.\n\n## Template\n\n```markdown\n## Agent Brief\n\n**Category:** bug / enhancement\n**Summary:** one-line description of what needs to happen\n\n**Current behavior:**\nDescribe what happens now. For bugs, this is the broken behavior.\nFor enhancements, this is the status quo the feature builds on.\n\n**Desired behavior:**\nDescribe what should happen after the agent's work is complete.\nBe specific about edge cases and error conditions.\n\n**Key interfaces:**\n- `TypeName` — what needs to change and why\n- `functionName()` return type — what it currently returns vs what it should return\n- Config shape — any new configuration options needed\n\n**Acceptance criteria:**\n- [ ] Specific, testable criterion 1\n- [ ] Specific, testable criterion 2\n- [ ] Specific, testable criterion 3\n\n**Out of scope:**\n- Thing that should NOT be changed or addressed in this issue\n- Adjacent feature that might seem related but is separate\n```\n\n## Examples\n\n### Good agent brief (bug)\n\n```markdown\n## Agent Brief\n\n**Category:** bug\n**Summary:** Skill description truncation drops mid-word, producing broken output\n\n**Current behavior:**\nWhen a skill description exceeds 1024 characters, it is truncated at exactly\n1024 characters regardless of word boundaries. This produces descriptions\nthat end mid-word (e.g. \"Use when the user wants to confi\").\n\n**Desired behavior:**\nTruncation should break at the last word boundary before 1024 characters\nand append \"...\" to indicate truncation.\n\n**Key interfaces:**\n- The `SkillMetadata` type's `description` field — no type change needed,\n  but the validation/processing logic that populates it needs to respect\n  word boundaries\n- Any function that reads SKILL.md frontmatter and extracts the description\n\n**Acceptance criteria:**\n- [ ] Descriptions under 1024 chars are unchanged\n- [ ] Descriptions over 1024 chars are truncated at the last word boundary\n      before 1024 chars\n- [ ] Truncated descriptions end with \"...\"\n- [ ] The total length including \"...\" does not exceed 1024 chars\n\n**Out of scope:**\n- Changing the 1024 char limit itself\n- Multi-line description support\n```\n\n### Good agent brief (enhancement)\n\n```markdown\n## Agent Brief\n\n**Category:** enhancement\n**Summary:** Add `.out-of-scope/` directory support for tracking rejected feature requests\n\n**Current behavior:**\nWhen a feature request is rejected, the issue is closed with a `wontfix` label\nand a comment. There is no persistent record of the decision or reasoning.\nFuture similar requests require the maintainer to recall or search for the\nprior discussion.\n\n**Desired behavior:**\nRejected feature requests should be documented in `.out-of-scope/<concept>.md`\nfiles that capture the decision, reasoning, and links to all issues that\nrequested the feature. When triaging new issues, these files should be\nchecked for matches.\n\n**Key interfaces:**\n- Markdown file format in `.out-of-scope/` — each file should have a\n  `# Concept Name` heading, a `**Decision:**` line, a `**Reason:**` line,\n  and a `**Prior requests:**` list with issue links\n- The triage workflow should read all `.out-of-scope/*.md` files early\n  and match incoming issues against them by concept similarity\n\n**Acceptance criteria:**\n- [ ] Closing a feature as wontfix creates/updates a file in `.out-of-scope/`\n- [ ] The file includes the decision, reasoning, and link to the closed issue\n- [ ] If a matching `.out-of-scope/` file already exists, the new issue is\n      appended to its \"Prior requests\" list rather than creating a duplicate\n- [ ] During triage, existing `.out-of-scope/` files are checked and surfaced\n      when a new issue matches a prior rejection\n\n**Out of scope:**\n- Automated matching (human confirms the match)\n- Reopening previously rejected features\n- Bug reports (only enhancement rejections go to `.out-of-scope/`)\n```\n\n### Good agent brief (PR)\n\nFor 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.\n\n```markdown\n## Agent Brief\n\n**Category:** enhancement\n**Summary:** Finish the contributor's `--json` output flag for `triage list`\n\n**Current behavior:**\nThe PR adds a `--json` flag that serializes the issue list to JSON. The happy\npath works and the diff matches the project's command structure. Two gaps\nremain: errors are still printed as human text (not JSON), and the new flag has\nno test coverage.\n\n**Desired behavior:**\nWith `--json`, all output — including errors — is well-formed JSON on stdout,\nand the command's exit codes are unchanged. The existing human-readable output\nis untouched when the flag is absent.\n\n**Key interfaces:**\n- The command's error path should emit `{ \"error\": string }` under `--json`\n  instead of the plain-text error\n- Reuse the existing serializer the PR already added; don't introduce a second\n\n**Acceptance criteria:**\n- [ ] `triage list --json` emits valid JSON for both success and error cases\n- [ ] Exit codes match the non-JSON command\n- [ ] A test covers the `--json` success output and one error case\n- [ ] Default (non-JSON) output is byte-for-byte unchanged\n\n**Out of scope:**\n- Adding `--json` to any other command\n- Changing the JSON shape of the success payload the PR already defined\n```\n\n### Bad agent brief\n\n```markdown\n## Agent Brief\n\n**Summary:** Fix the triage bug\n\n**What to do:**\nThe triage thing is broken. Look at the main file and fix it.\nThe function around line 150 has the issue.\n\n**Files to change:**\n- src/triage/handler.ts (line 150)\n- src/types.ts (line 42)\n```\n\nThis is bad because:\n- No category\n- Vague description (\"the triage thing is broken\")\n- References file paths and line numbers that will go stale\n- No acceptance criteria\n- No scope boundaries\n- No description of current vs desired behavior\n",".agents/skills/triage/OUT-OF-SCOPE.md":"# Out-of-Scope Knowledge Base\n\nThe `.out-of-scope/` directory in a repo stores persistent records of rejected feature requests. It serves two purposes:\n\n1. **Institutional memory** — why a feature was rejected, so the reasoning isn't lost when the issue is closed\n2. **Deduplication** — when a new issue comes in that matches a prior rejection, the skill can surface the previous decision instead of re-litigating it\n\n## Directory structure\n\n```\n.out-of-scope/\n├── dark-mode.md\n├── plugin-system.md\n└── graphql-api.md\n```\n\nOne file per **concept**, not per issue. Multiple issues requesting the same thing are grouped under one file.\n\n## File format\n\nThe 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.\n\n```markdown\n# Dark Mode\n\nThis project does not support dark mode or user-facing theming.\n\n## Why this is out of scope\n\nThe rendering pipeline assumes a single color palette defined in\n`ThemeConfig`. Supporting multiple themes would require:\n\n- A theme context provider wrapping the entire component tree\n- Per-component theme-aware style resolution\n- A persistence layer for user theme preferences\n\nThis is a significant architectural change that doesn't align with the\nproject's focus on content authoring. Theming is a concern for downstream\nconsumers who embed or redistribute the output.\n\n```ts\n// The current ThemeConfig interface is not designed for runtime switching:\ninterface ThemeConfig {\n  colors: ColorPalette; // single palette, resolved at build time\n  fonts: FontStack;\n}\n```\n\n## Prior requests\n\n- #42 — \"Add dark mode support\"\n- #87 — \"Night theme for accessibility\"\n- #134 — \"Dark theme option\"\n```\n\n### Naming the file\n\nUse 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.\n\n### Writing the reason\n\nThe reason should be substantive — not \"we don't want this\" but why. Good reasons reference:\n\n- Project scope or philosophy (\"This project focuses on X; theming is a downstream concern\")\n- Technical constraints (\"Supporting this would require Y, which conflicts with our Z architecture\")\n- Strategic decisions (\"We chose to use A instead of B because...\")\n\nThe reason should be durable. Avoid referencing temporary circumstances (\"we're too busy right now\") — those aren't real rejections, they're deferrals.\n\n## When to check `.out-of-scope/`\n\nDuring triage (Step 1: Gather context), read all files in `.out-of-scope/`. When evaluating a new issue:\n\n- Check if the request matches an existing out-of-scope concept\n- Matching is by concept similarity, not keyword — \"night theme\" matches `dark-mode.md`\n- 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?\"\n\nThe maintainer may:\n\n- **Confirm** — the new issue gets added to the existing file's \"Prior requests\" list, then closed\n- **Reconsider** — the out-of-scope file gets deleted or updated, and the issue proceeds through normal triage\n- **Disagree** — the issues are related but distinct, proceed with normal triage\n\n## When to write to `.out-of-scope/`\n\nOnly 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.\n\nDo **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.\n\nThe flow:\n\n1. Maintainer decides a feature request is out of scope\n2. Check if a matching `.out-of-scope/` file already exists\n3. If yes: append the new issue to the \"Prior requests\" list\n4. If no: create a new file with the concept name, decision, reason, and first prior request\n5. Post a comment on the issue explaining the decision and mentioning the `.out-of-scope/` file\n6. Close the issue with the `wontfix` label\n\n## Updating or removing out-of-scope files\n\nIf the maintainer changes their mind about a previously rejected concept:\n\n- Delete the `.out-of-scope/` file\n- The skill does not need to reopen old issues — they're historical records\n- The new issue that triggered the reconsideration proceeds through normal triage\n",".agents/skills/triage/SKILL.md":"---\nname: triage\ndescription: Move issues and external PRs through a state machine of triage roles — categorise, verify, grill if needed, and write agent-ready briefs.\ndisable-model-invocation: true\n---\n\n# Triage\n\nMove issues on the project issue tracker through a small state machine of triage roles.\n\nIf this repo treats external pull requests as a request surface (see the issue-tracker config), triage covers them too: **a PR is an issue with attached code** — same roles, same states, same machine, with a few deltas marked \"for a PR\" below. Resolve a bare `#42` to an issue or PR per the tracker config.\n\nEvery comment or issue posted to the issue tracker during triage **must** start with this disclaimer:\n\n```\n> *This was generated by AI during triage.*\n```\n\n## Reference docs\n\n- [AGENT-BRIEF.md](AGENT-BRIEF.md) — how to write durable agent briefs\n- [OUT-OF-SCOPE.md](OUT-OF-SCOPE.md) — how the `.out-of-scope/` knowledge base works\n\n## Roles\n\nTwo **category** roles:\n\n- `bug` — something is broken\n- `enhancement` — new feature or improvement\n\nFive **state** roles:\n\n- `needs-triage` — maintainer needs to evaluate\n- `needs-info` — waiting on reporter for more information\n- `ready-for-agent` — fully specified, ready for an AFK agent\n- `ready-for-human` — needs human implementation\n- `wontfix` — will not be actioned\n\nFor a PR, the same states read against the attached code: `ready-for-agent` means a brief is attached and an agent should take the next step on the diff; `ready-for-human` means it's ready for a human to merge.\n\nEvery triaged issue should carry exactly one category role and one state role. If state roles conflict, flag it and ask the maintainer before doing anything else.\n\nThese are canonical role names — the actual label strings used in the issue tracker may differ. The mapping should have been provided to you - run `/setup-matt-pocock-skills` if not.\n\nState transitions: an unlabeled issue normally goes to `needs-triage` first; from there it moves to `needs-info`, `ready-for-agent`, `ready-for-human`, or `wontfix`. `needs-info` returns to `needs-triage` once the reporter replies. The maintainer can override at any time — flag transitions that look unusual and ask before proceeding.\n\n## Invocation\n\nThe maintainer invokes `/triage` and describes what they want in natural language. Interpret the request and act. Examples:\n\n- \"Show me anything that needs my attention\"\n- \"Let's look at #42\" (issue or PR)\n- \"Move #42 to ready-for-agent\"\n- \"What's ready for agents to pick up?\"\n\n## Show what needs attention\n\nQuery the issue tracker and present three buckets, oldest first:\n\n1. **Unlabeled** — never triaged.\n2. **`needs-triage`** — evaluation in progress.\n3. **`needs-info` with reporter activity since the last triage notes** — needs re-evaluation.\n\nWhen PRs are in scope, include external PRs in these buckets and tag each line `[PR]` or `[issue]`. Discovery surfaces only *external* PRs (the tracker config defines who counts as external) — a collaborator's in-flight PR is not triage work. This filter is discovery-only; an explicitly named PR is always triaged regardless of author.\n\nShow counts and a one-line summary per item. Let the maintainer pick.\n\n## Triage a specific issue or PR\n\n1. **Gather context.** Read the full issue or PR (body, comments, labels, author, dates; for a PR, the diff too). Parse any prior triage notes so you don't re-ask resolved questions. Explore the codebase using the project's domain glossary, respecting ADRs in the area. Run two checks against the codebase: (a) **redundancy** — search for an existing implementation of the requested behavior by domain concept (not just the request's wording), and report where you looked. If found, it's an already-implemented `wontfix` (step 5). (b) **prior rejection** — read `.out-of-scope/*.md` and surface any that resembles this request.\n\n2. **Recommend.** Tell the maintainer your category and state recommendation with reasoning, plus a brief codebase summary relevant to the request — including whether it's already implemented. Wait for direction.\n\n3. **Verify the claim.** Before any grilling, check that the claim holds up. For a bug, reproduce it from the reporter's steps. For a PR, confirm the diff does what it claims — check it out, run the relevant tests or commands. Report what happened: confirmed (with code path), failed, or insufficient detail (a strong `needs-info` signal). A confirmed verification makes a much stronger agent brief.\n\n4. **Grill (if needed).** If the request needs fleshing out, run the `/grilling` and `/domain-modeling` skills together — grill it into shape one question at a time, sharpening domain terms and updating `CONTEXT.md`/ADRs inline as decisions land.\n\n5. **Apply the outcome:**\n   - `ready-for-agent` — post an agent brief comment ([AGENT-BRIEF.md](AGENT-BRIEF.md)).\n   - `ready-for-human` — same structure as an agent brief, but note why it can't be delegated (judgment calls, external access, design decisions, manual testing).\n   - `needs-info` — post triage notes (template below).\n   - `wontfix` — close, with the comment depending on *why*:\n     - **Already implemented** — the change already exists in the codebase. Point to where it lives; do **not** write to `.out-of-scope/` (that KB is for *rejected* requests, not built ones).\n     - **Rejected (bug)** — polite explanation, then close.\n     - **Rejected (enhancement)** — write to `.out-of-scope/`, link to it from a comment, then close ([OUT-OF-SCOPE.md](OUT-OF-SCOPE.md)).\n   - `needs-triage` — apply the role. Optional comment if there's partial progress.\n\n## Quick state override\n\nIf the maintainer says \"move #42 to ready-for-agent\", trust them and apply the role directly. Confirm what you're about to do (role changes, comment, close), then act. Skip grilling. If moving to `ready-for-agent` without a grilling session, ask whether they want to write an agent brief.\n\n## Needs-info template\n\n```markdown\n## Triage Notes\n\n**What we've established so far:**\n\n- point 1\n- point 2\n\n**What we still need from you (@reporter):**\n\n- question 1\n- question 2\n```\n\nCapture everything resolved during grilling under \"established so far\" so the work isn't lost. Questions must be specific and actionable, not \"please provide more info\".\n\n## Resuming a previous session\n\nIf prior triage notes exist on the issue or PR, read them, check whether the reporter has answered any outstanding questions, and present an updated picture before continuing. Don't re-ask resolved questions.\n",".agents/skills/writing-great-skills/GLOSSARY.md":"# Glossary — Building Great Skills\n\nThe domain model for what makes a skill great. A skill exists to wrangle determinism out of a stochastic system; the root virtue is **Predictability**, and every term below is a lever on it. This is the disclosed reference for [`writing-great-skills`](SKILL.md).\n\nThe terms are grouped by axis: **Invocation** (how a skill is reached), **Information Hierarchy** (how its content is arranged), **Steering** (how the agent's runtime behaviour is shaped), and **Pruning** (how it is kept lean). Each **failure mode** lives beside the lever that cures it, tagged _failure mode_.\n\n**Bold terms** in any definition are themselves defined in this glossary; find them by their heading.\n\n## Predictability\n\nThe degree to which a skill makes the agent behave the same _way_ on every run — the same process, not the same output (a brainstorming skill should _predictably_ diverge; its tokens vary, its behaviour doesn't). The root virtue every other term serves — cost and maintainability are symptoms of it, not rivals.\n\n_Avoid_: consistency, reliability, robustness, output-determinism\n\n## Invocation\n\nHow a skill is reached — and the two loads you pay for the choice.\n\n### Model-Invoked\n\nA skill that keeps its **description** field, so the agent can see it and fire it autonomously — and the human can still type its name, so model-invocation always _includes_ user reach. There is no model-only state: a description only ever _adds_ agent discovery, never removes the human's. Pays a permanent **context load** on every turn in exchange for that discoverability. Reachable by other skills, because the description that makes it agent-discoverable makes it invocable. A model-invoked skill whose content is all **reference** is also one home for shared reference: another skill can invoke it, so reference needed by several skills lives in one place. Pick model-invocation only when the agent must reach the skill on its own; if it never fires except by hand, drop the description and pay no context load.\n\n_Avoid_: ability, tool, capability\n\n### User-Invoked\n\nA skill with its **description** stripped — invisible to the agent and reachable only by the human typing its name (user-_only_, where **model-invoked** is user-_and-agent_). Trades agent-discoverability for zero **context load**. Because it has no description, nothing but the human can reach it: no other skill can fire it.\n\n_Avoid_: procedure, workflow, command\n\n### Description\n\nThe skill's machine-readable trigger, and the one **context pointer** a **model-invoked** skill is forced to keep loaded at all times. Its mere presence _is_ the invocation axis: keep it and the skill is model-invoked (and reachable by other skills); delete it and the skill is **user-invoked**, reachable only by the human. The source of a model-invoked skill's **context load**.\n\n_Avoid_: frontmatter, summary\n\n### Context Pointer\n\nA reference held in the agent's context that names some out-of-context material and encodes the condition for reaching it. The **description** is the top-level context pointer (context window → skill); pointers to disclosed files are the same object one level down. Its wording, not the target, decides _when_ the agent reaches — and _how reliably_. A must-have target behind a weakly worded pointer is a variance bug: fix the wording first, and inline the material only if sharpening fails.\n\n_Avoid_: link, reference, import\n\n### Context Load\n\nThe cost a **model-invoked** skill imposes on the agent's context window — its **description**, always loaded, spending both tokens and attention. What **user-invoked** skills escape by having no description, and the brake on splitting into more model-invoked skills.\n\n_Avoid_: token cost, context bloat\n\n### Cognitive Load\n\nThe cost a **user-invoked** skill imposes on the human — what they must hold in their head: which skills exist and when to reach for each (the human is the index). What **model-invocation** removes by being agent-discoverable, and the brake on splitting into more user-invoked skills. Not a cost to minimise: it is the price of human agency, the reason some skills stay user-invoked. Spend it where human judgement matters; remove it where it does not.\n\n_Avoid_: human index, burden, overhead\n\n### Router Skill\n\nA **user-invoked** skill whose job is to point at your other user-invoked skills — naming each and when to reach for it — so the human has one skill to remember instead of many. It can only hint, never fire them: user-invoked skills have no **description**, so nothing but the human can reach them. The cure for **cognitive load** when user-invoked skills multiply.\n\n_Avoid_: dispatcher, menu, registry, index, router procedure\n\n### Granularity\n\nHow finely you divide skills. Finer division spends one of the two loads: more **model-invoked** skills spend **context load** (more descriptions crowding the window and competing for attention); more **user-invoked** skills spend **cognitive load** (more for the human to remember and reach for). Two cuts guide the division. By **invocation**, split off a model-invoked skill where you have a distinct **leading word** to trigger it — a trigger word you actually use in your prompts. By **sequence**, split a run of **steps** where a step's **post-completion steps** need hiding, since isolating it in its own context clears what follows. Beware the reverse: merging sequences exposes each step's post-completion steps to what follows, inviting premature completion.\n\n_Avoid_: chunking, modularity\n\n## Information Hierarchy\n\nHow a skill's content is arranged, and how far down the ladder each piece sits.\n\n### Information Hierarchy\n\nA skill's content ranked by how immediately the agent needs it — a single ladder, produced by two cuts: in-file or behind a pointer, and step or reference. The rungs:\n\n- **Steps** — in-file, primary\n- **Reference**, in-file — secondary\n- **Reference**, disclosed — behind a **context pointer**\n\nA skill with no **steps** uses just the bottom two rungs — often a legitimately flat peer-set (e.g. every rule of a review on one rung), which is a fine arrangement, not a smell. The hierarchy is independent of invocation: a skill can be model- or user-invoked whether it is all steps, all reference, or both. When a skill has steps, in-file reference that should be disclosed buries them and turns attending to them into a coin-flip — a variance lever, not just a legibility one. Keep the top of the ladder legible; push down it whatever you can.\n\n_Avoid_: structure, organization, layout\n\n### Steps\n\nThe ordered actions the agent performs — when a skill has them, the primary tier of its content, and the part that earns its place in SKILL.md. Not every skill has steps: a skill can be all steps (`tdd`), all **reference** (a review), or both, independent of invocation. Every step ends on a **completion criterion**, clear or vague.\n\n_Avoid_: workflow, instructions, choreography\n\n### Reference\n\nMaterial the agent refers to on demand — definitions, facts, parameters, examples, conditional instructions. When a skill has **steps** it is secondary to them; when a skill has none it is the entire content; or it lives outside any skill entirely — see **External Reference**. Reached via **context pointers**, and the prime candidate for **progressive disclosure**.\n\n_Avoid_: supporting material, docs, background\n\n### External Reference\n\n**Reference** that lives outside the skill system — a plain file, no **description**, no **steps**, not invocable — that any skill can point at. The home for shared reference that needn't fire on its own, and the only shared home two **user-invoked** skills can use, since neither has a description and so neither can fire the other.\n\n_Avoid_: doc, resource, knowledge base\n\n### Progressive Disclosure\n\nMoving **reference** down the ladder — out of SKILL.md and behind a **context pointer** — so the top stays legible. Not primarily a token optimisation; it is how the **information hierarchy** is protected. Licensed by **branching**: disclose what only some branches need, inline what every path needs, and if a pointer fires unreliably on must-have material, sharpen its wording, and pull it back inline only if that fails.\n\n_Avoid_: lazy loading, chunking\n\n### Co-location\n\nKeeping the material an agent needs at once in one place — a concept's definition, rules, and caveats under a single heading, not scattered across the file — so reading one part brings its neighbours with it. The within-file companion to the **Information Hierarchy**: the hierarchy ranks _how far down_ a piece sits; co-location decides _what sits beside it_ once there. There is no formula for the right format of a body of **reference**; the test is that a skill should read like documentation written for the agent, and grouped material reads that way where scattered material does not. Distinct from **Duplication**: that repeats one meaning in two places, where scattering fragments a single meaning across many.\n\n_Avoid_: grouping, clustering, cohesion\n\n### Sprawl\n\n_Failure mode._ A skill that is simply too long — too many lines in SKILL.md — independent of whether they are stale or repeated. Even an all-live, all-unique skill can sprawl. It costs readability (the agent wades through more before it can act, and attention thins across the excess), maintainability (every extra line is one more to keep **relevant**), and tokens. The cure is the **information hierarchy**: push **reference** down behind **context pointers**, and split by **branch** or sequence so each path carries only what it needs. Distinct from **sediment** (length from stale accumulation) and **duplication** (length from repeated meaning) — sprawl is length itself, whatever its cause.\n\n_Avoid_: bloat, length, size, verbosity\n\n## Steering\n\nThe levers that shape the agent's runtime behaviour toward **Predictability**.\n\n### Branch\n\nA distinct way a skill can be invoked — a case the skill handles — so different runs take different paths through it. A skill with many steps may carry many branches; a linear one has none.\n\n_Avoid_: path, case, fork\n\n### Leading Word\n\nA compact concept — also called a _Leitwort_ — already living in the model's pretraining, that the agent thinks with while running the skill. It encodes a behavioural principle in the fewest possible tokens by invoking priors the model already holds (e.g. _lesson_, _proximal zone of development_, _fog of war_, _tracer bullets_). Repeated as a token, never as a sentence, it accumulates a distributed definition across the skill and anchors a whole region of behaviour. Coining your own works if you define it clearly, but a made-up word recruits no priors — you pay in definition tokens what a pretrained word gives free. Reach for an existing word first.\n\nA leading word serves **predictability** twice. In the body it anchors **execution** — the agent reaches for the same behaviour every time the concept appears, and inside flat reference it focuses attention on a class of thing to look for, recruiting the right checks each run. In the **description** it anchors **invocation** — and not only within the skill: when the same word lives in your prompts, your docs, and your codebase, the agent links that shared language to the skill and fires it more reliably. Word a description with the leading words you actually use when you want the skill.\n\n_Avoid_: keyword, term, motif\n\n### Completion Criterion\n\nThe condition that tells the agent a unit of work is done — the target it judges against. Two properties make it a lever, not just a quality. Its **clarity** (can the agent tell done from not-done?) resists **premature completion** — a vague bound (\"understanding reached\") lets the agent declare done and slip to the next step; this axis needs _steps_ to bite, since premature completion is a between-steps failure. Its **demand** (how much it requires) sets **legwork** — \"every modified model accounted for\" forces thorough work where \"produce a change list\" does not — and this axis is _not_ step-bound: it can bind a body of flat reference too, which is how a skill with no steps still carries an exhaustiveness bar (\"every rule applied\"). The strongest criteria are both checkable and exhaustive.\n\n_Avoid_: done condition, exit condition, stopping rule\n\n### Legwork\n\nThe work an agent does behind the scenes within a single step — reading files, exploring the codebase, making changes, digging up what it needs rather than offloading to the user. It lives below the step structure: never written as its own step, latent in the wording, controlled by the agent rather than the skill. The within-step counterpart to **post-completion steps**' across-step pull. Raised by a **leading word** (_comprehensive_, _thorough_) or a **completion criterion** that demands the work be exhaustive — including the demand axis applied to flat reference, which is what drives a skill of flat reference to cover all its rungs. Goes thin either when that demand is missing or when **premature completion** cuts the step short.\n\n_Avoid_: scope, effort, diligence, coverage\n\n### Post-Completion Steps\n\nThe **steps** that follow the current step. Visible, they pull the agent forward into **premature completion** — the more it sees, the stronger the tug; the defence is to hide them by splitting the sequence of steps into two.\n\n_Avoid_: horizon, fog of war, lookahead\n\n### Premature Completion\n\n_Failure mode._ Ending the current step before it is genuinely done, because the agent's attention slips to being done rather than to the work. A between-steps failure: it needs **steps** to occur — a skill with no steps that quits early isn't premature completion but thin **legwork** under an unmet demand. A tug-of-war between two forces: visible **post-completion steps** (the pull forward) and the **completion criterion**'s clarity (the resistance — a sharp, checkable bar holds; a vague one gives way). Fuzziness is the necessary condition: a sharp bound resists the pull no matter how many later steps are visible, so a step that never rushes needs no defending. Two levers hold a step that does, but reach for them in order: **sharpen the bound first** — it is local and cheap. Only when the criterion is irreducibly fuzzy _and_ you actually observe the rush do you **hide the later steps** — and hiding only works across a real context boundary (a user-invoked hand-off or a subagent dispatch; an inline model-invoked call leaves the later steps in context and clears nothing). One cause of thin legwork, but distinct from it: legwork can be thin even when a step runs to full completion.\n\n_Avoid_: premature closure, the rush, rushing, shortcutting\n\n## Pruning\n\nKeeping a skill lean — each remedy paired with the failure it cures.\n\n### Single Source of Truth\n\nThe desired state where each meaning lives in exactly one authoritative place, so a change to the skill's behaviour is a change in one place. **Duplication** is its violation.\n\n_Avoid_: home, canonical location\n\n### Duplication\n\n_Failure mode._ The same meaning given more than one **single source of truth**. It costs maintenance (change one place, you must change the others), costs tokens, and inflates prominence — repeating a meaning weights it on the ladder past its real rank. The accidental inverse of a **leading word**, which raises attention on purpose by repeating a token, never the meaning.\n\n_Avoid_: repetition, redundancy\n\n### Relevance\n\nWhether a line still bears on what the skill does — the lens for what to keep. A line loses relevance either by never bearing on the task (mere exposition, or a **branch** that should be disclosed) or by going stale: drifting out of date as the behaviour or world it describes changes. Shorter skills are easier to keep relevant, because each line is cheaper to check. Distinct from **no-op**: relevance asks whether a line bears on the task, not whether it changes behaviour.\n\n_Avoid_: load-bearing, staleness, freshness\n\n### Sediment\n\n_Failure mode._ Layers of old content that settle in a skill and are never cleared, because adding feels safe and removing feels risky — so stale and irrelevant lines accumulate and you must core down through them to find what is still live. The default fate of any skill without a pruning discipline; the slow erosion of **relevance**, as opposed to **duplication**'s repeated meaning.\n\n_Avoid_: accretion, bloat, cruft, rot\n\n### No-Op\n\n_Failure mode._ An instruction that changes nothing because the model already does it by default — you pay load to tell the agent what it would do anyway. The test: does a line change behaviour versus the default? A line can be perfectly **relevant** and still be a no-op. The same priors that make a **leading word** free make a no-op worthless.\n\nA leading word is a _technique_; No-Op is a _verdict_ on a line — and they cross. A leading word too weak to beat the default is a no-op (_be thorough_ when the agent is already thorough-ish), and the fix is a stronger word that passes the verdict (_relentless_), not a different technique. So the No-Op test — does it change behaviour versus the default? — is also how you grade whether a leading word is earning its repetitions. This is model-relative, not reader-relative: two people disagreeing over whether a line is a no-op disagree about the default, and settle it by running the skill, not by debate.\n\n_Avoid_: redundant instruction, restating the obvious, belaboring\n",".agents/skills/writing-great-skills/SKILL.md":"---\nname: writing-great-skills\ndescription: Reference for writing and editing skills well — the vocabulary and principles that make a skill predictable.\ndisable-model-invocation: true\n---\n\nA skill exists to wrangle determinism out of a stochastic system. **Predictability** — the agent taking the same _process_ every run, not producing the same output — is the root virtue; every lever below serves it.\n\n**Bold terms** are defined in [`GLOSSARY.md`](GLOSSARY.md); look them up there for the full meaning.\n\n## Invocation\n\nTwo choices, trading different costs:\n\n- A **model-invoked** skill keeps a **description**, so the agent can fire it autonomously _and_ other skills can reach it (you can still type its name too). It contributes to **context load** — the description sits in the window every turn. Mechanics: omit `disable-model-invocation`, and write a model-facing description with rich trigger phrasing (\"Use when the user wants…, mentions…\").\n- A **user-invoked** skill strips the description from the agent's reach: only you, typing its name, can invoke it — and no other skill can. Zero context load, but it spends **cognitive load**: _you_ are the index that must remember it exists. Mechanics: set `disable-model-invocation: true`; the `description` becomes human-facing — a one-line summary, trigger lists stripped.\n\nPick model-invocation only when the agent must reach the skill on its own, or another skill must. If it only ever fires by hand, make it user-invoked and pay no context load.\n\nWhen user-invoked skills multiply past what you can remember, that piled-up cognitive load is cured by a **router skill**: one user-invoked skill that names the others and when to reach for each.\n\n## Writing the description\n\nA model-invoked **description** does two jobs — state what the skill is, and list the **branches** that should trigger it. Every word increases **context load**, so a description earns even harder pruning than the body:\n\n- **Front-load the skill's leading word** — the description is where it does its invocation work.\n- **One trigger per branch.** Synonyms that rename a single branch are **duplication** — \"build features using TDD … asks for test-first development\" is one branch written twice. Collapse them; keep only genuinely distinct branches.\n- **Cut identity that's already in the body.** Keep the description to triggers, plus any \"when another skill needs…\" reach clause.\n\n## Information hierarchy\n\nA skill is built from two content types — **steps** and **reference** — that mix freely: a skill can be all steps, all reference, or both. The core decision is which to use and where each sits on the **information hierarchy**, a ladder ranked by how immediately the agent needs the material:\n\n1. **In-skill step** — an ordered action in `SKILL.md`, the primary tier: what the agent does, in order. Each step ends on a **completion criterion**, the condition that tells the agent the work is done. Make it _checkable_ (can the agent tell done from not-done?) and, where it matters, _exhaustive_ (\"every modified model accounted for\", not \"produce a change list\") — a vague criterion invites **premature completion**.\n2. **In-skill reference** — a definition, rule, or fact in `SKILL.md`, consulted on demand. Often a legitimately flat peer-set (every rule of a review on one rung) — a fine arrangement, not a smell. _This skill is all reference._\n3. **External reference** — reference pushed out of `SKILL.md` into a separate file, reached by a **context pointer**, loaded only when the pointer fires. (Spans _disclosed_ reference — a sibling file like `GLOSSARY.md`, still part of the skill — through fully **external reference** that lives outside the skill system and any skill can point at.)\n\nA demanding completion criterion drives thorough **legwork** — the digging the agent does within the work — whether the skill has steps or not, since \"every rule applied\" binds flat reference just as \"every step done\" binds a sequence.\n\nPush too little down and the top bloats; push too much and you hide material the agent actually needs. That tension is the whole decision.\n\n**Progressive disclosure** is the move down the ladder — out of `SKILL.md` into a linked file — so the top stays legible. Mechanics: a linked `.md` file in the skill folder, named for what it holds (this skill discloses its full definitions to `GLOSSARY.md`). Some skills are used in more than one way, and each distinct way is a **branch** — different runs taking different paths through the skill. Branching is the cleanest disclosure test: inline what every branch needs, and push behind a pointer what only some branches reach. A **context pointer**'s _wording_, not its target, decides when and how reliably the agent reaches the material.\n\nWhere the ladder decides _how far down_ a piece sits, **co-location** decides _what sits beside it_ once there: keep a concept's definition, rules, and caveats under one heading rather than scattered, so reading one part brings its neighbours with it.\n\n## When to split\n\n**Granularity** is how finely you divide skills, and each cut spends one of the two loads, so split only when the cut earns it. Two cuts:\n\n- **By invocation** — split off a **model-invoked** skill when you have a distinct **leading word** that should trigger it on its own, or another skill must reach it. You pay **context load** for the new always-loaded **description**, so that independent reach has to be worth it.\n- **By sequence** — split a run of **steps** when the steps still ahead (a step's **post-completion steps**) tempt the agent to rush the one in front of it (**premature completion**). Keeping them out of view encourages the agent to do more **legwork** on the current task.\n\n## Pruning\n\nKeep each meaning in a **single source of truth**: one authoritative place, so changing the behaviour is a one-place edit.\n\nCheck every line for **relevance**: does it still bear on what the skill does?\n\nThen hunt **no-ops** sentence by sentence, not just line by line: run the no-op test on each sentence in isolation, and when one fails, delete the whole sentence rather than trim words from it. Be aggressive — most prose that fails should go, not be rewritten.\n\n## Leading words\n\nA **leading word** is a compact concept already living in the model's pretraining that the agent thinks with while running the skill (e.g. _lesson_, _fog of war_, _tracer bullets_). Repeated throughout the text (though not necessarily - a strong leading word might only be needed once), it accumulates a distributed definition and anchors a whole region of behaviour in the fewest tokens, by recruiting priors the model already holds.\n\nIt serves predictability twice. In the body it anchors _execution_: the agent reaches for the same behaviour every time the word appears. In the description it anchors _invocation_: when the same word lives in your prompts, docs, and code, the agent links that shared language to the skill and fires it more reliably.\n\nHunt for opportunities to refactor skills to use leading words. A triad spelled out at three sites (**duplication**), a description spending a sentence to gesture at one idea — each is a passage begging to **collapse** into a single token. Examples include:\n\n- \"fast, deterministic, low-overhead\" -> _tight_ — one quality restated across a phase — into a single pretrained word (a _tight_ loop).\n- \"a loop you believe in\" -> _red_ — converts a fuzzy gate into a binary observable state (the loop goes _red_ on the bug, or it doesn't).\n\nYou win twice over: fewer tokens, _and_ a sharper hook for the agent to hang its thinking on. Assume every skill is carrying restatements that leading words retire — go find them.\n\n## Failure modes\n\nUse these to diagnose issues the user may be having with the skill.\n\n- **Premature completion** — ending a step before it's genuinely done, attention slipping to _being done_. Defence, in order: sharpen the completion criterion first (cheap, local); only if it is irreducibly fuzzy _and_ you observe the rush, hide the post-completion steps by splitting (the sequence cut).\n- **Duplication** — the same meaning in more than one place. Costs maintenance and tokens, and inflates a meaning's prominence on the ladder past its real rank.\n- **Sediment** — stale layers that settle because adding feels safe and removing feels risky. The default fate of any skill without a pruning discipline.\n- **Sprawl** — a skill simply too long, even when every line is live and unique. Hurts readability and maintainability and wastes tokens. The cure is the ladder: disclose **reference** behind pointers, and split by **branch** or sequence so each path carries only what it needs.\n- **No-op** — a line the model already obeys by default, so you pay load to say nothing. The test: does it change behaviour versus the default? A weak leading word (_be thorough_ when the agent is already thorough-ish) is a no-op; the fix is a stronger word (_relentless_), not a different technique.\n","CLAUDE.md":"# Claude guide\n\nInternal instructions for Claude Code in this repository. Read\n[`docs/architecture.md`](docs/architecture.md) before architecture work. The root `README.md` is the\npublic project page and must not be edited unless the user explicitly requests that separate review.\n\n## Active project map\n\n- `pentestgpt_agent/` — maintained autonomous Supervisor/Executor framework; nested uv project.\n- `pentestgpt_legacy/` — maintained human-driven USEN-2024-style client.\n- `../UnifedAgentWrapper/` — canonical `unified-agent` package used by the framework.\n- `../xbow-benchmark/` — reference-only benchmark harness and historical results; it is not a\n  supported `pentestgpt-agent` CLI, CI, or runtime integration.\n- `unified_agent/` — obsolete compatibility copy retained by root packaging/Docker only. Do not add\n  features here or confuse it with the framework dependency.\n\nThe old fixed-stage `pentestgpt/` package and the previous ledger-centered\nInstructor/Executor/Judge implementation are gone. Historical reports may still name them.\n\n## Runtime contract\n\n- The Supervisor and Executor both use `SandboxPolicy.FULL_ACCESS`; deployment isolation is the\n  security boundary.\n- Each episode is fresh. SQLite and exact trace receipts—not provider conversation history—are\n  memory.\n- Deterministic code owns scope, plan validation, leases, evidence, retries, completion bases, and\n  revisions.\n- Provider action and file activity is logged but is not an audit failure.\n- Keep the core at two LLM roles. Do not add an always-on judge, RAG layer, or scheduler without\n  trace evidence that the current deterministic seam cannot solve the problem.\n\n## Commands\n\nFramework work runs inside the nested project:\n\n```bash\ncd pentestgpt_agent\nuv sync --extra claude          # or codex / all\nuv run python -m pytest -q\nuv run ruff check src tests\nuv run ruff format --check src tests\nuv run mypy src\nuv lock --check\nuv build\n```\n\nFrom the repository root:\n\n```bash\nmake run TARGET=http://127.0.0.1:8000 BACKEND=claude\nmake check\nmake ci\nmake docker-build\nmake docker-login\nmake docker-auth-status\n```\n\nThe root Docker image does not currently contain `pentestgpt_agent`; treat `make docker-run` as\npending runtime wiring. The sibling XBOW checkout is retained only as a reference and is not a\nproduct verification path.\n\n## Documentation map\n\n- `docs/architecture.md` — current repository and module decisions.\n- `pentestgpt_agent/CONTEXT.md` — domain language and invariants.\n- `pentestgpt_agent/README.md` — framework development and operation.\n- `docs/docker-dev-plan.md` — current Docker/auth status and known gap.\n- `PENTESTGPT_AGENT_NEW_*` — compact historical migration/qualification records.\n- `pentestgpt_agent/HTB_ENIGMA_QUALIFICATION_20260712.md` — failed remote qualification evidence.\n\n## Editing rules\n\n- Preserve unrelated and concurrent worktree changes. Never restore or modify files merely because\n  they appear as changes you did not create.\n- Do not edit the root public `README.md` during internal documentation cleanup.\n- Do not put benchmark runners or generated result archives back into this repository.\n- Keep application imports as `unified_agent`; change dependency source configuration rather than\n  copying the wrapper into `pentestgpt_agent`.\n- Add focused replay or interface-level tests for behavior changes before live runs.\n- Never expose provider credentials, VPN files, HTB tokens, flags, or raw sensitive traces.\n","docs/architecture.md":"# PentestGPT architecture\n\nStatus: 2026-07-12\n\nThis is the internal source of truth for the current repository shape. The root `README.md` is the\npublic project page and is intentionally being revised separately.\n\n## Repository family\n\n```text\nPentestGPT_Project/\n├── PentestGPT/          # framework, legacy interactive client, and tool image\n├── UnifedAgentWrapper/  # canonical unified-agent package\n└── xbow-benchmark/      # reference-only benchmark harness and historical results\n```\n\nThe three directories are independent Git repositories. The XBOW checkout is retained as a\nreference corpus only; the product CLI, runtime, and CI do not depend on it. Benchmark logic and\nresult archives must not be added here.\n\n## Maintained runtime\n\n`pentestgpt_agent/` is the autonomous framework. It is a nested uv project with its own lockfile and\nenvironment. The loop deliberately has only two LLM roles:\n\n```text\nRunSnapshot -> Supervisor -> compile_plan -> one TaskLease\n                                             |\nTraceStore <- EpisodeRunner <- Executor <----+\n     |                              |\n     +---- compile_execution -------+\n                    |\n               MemoryKernel\n```\n\n- The Supervisor chooses one task or proposes completion.\n- The Executor performs one leased task and returns a typed result.\n- Both roles use fresh provider sessions and `FULL_ACCESS`. The deployment environment is the\n  isolation boundary; PentestGPT does not maintain a second tool or filesystem sandbox.\n- Deterministic code owns scope validation, leases, evidence provenance, retries, revisions, and\n  canonical state.\n- SQLite is canonical memory. Provider transcripts are diagnostic traces, not memory.\n- There is no always-on judge, RAG service, speculative backlog, or parallel scheduler.\n\n`pentestgpt_legacy/` is the maintained human-driven implementation of the USENIX 2024 workflow. It\nhas its own lightweight provider clients and does not use `unified_agent`.\n\n## Why unified-agent remains useful\n\nThe external `UnifedAgentWrapper` is a real seam with two production adapters: Claude Code and\nCodex. PentestGPT depends on its small interface for:\n\n- provider selection, model, effort, workspace, and permission configuration;\n- structured-output invocation;\n- normalized command, tool, file, session, usage, cost, and terminal events;\n- shared task rendering and provider error handling.\n\nRemoving that module would duplicate provider SDK churn inside `pentestgpt_agent.trace` and\n`pentestgpt_agent.trial`. It therefore earns its place as a deep module. PentestGPT policy must stay\noutside it: task kinds, memory, evidence, scope, scheduling, and completion belong to this repo.\n\nThe dependency is pinned to a commit of the public package in `pentestgpt_agent/pyproject.toml`, and\n`tests/test_dependency.py` verifies that the nested project imports the installed dependency rather\nthan the repository-root copy.\n\n## Root unified_agent copy\n\nThe root `unified_agent/` is an older, drifted compatibility copy. No maintained PentestGPT runtime\nimports it:\n\n- `pentestgpt_agent` uses the external package;\n- `pentestgpt_legacy` uses its own provider clients;\n- only root packaging, its duplicate tests, and the current tool-image health check retain it.\n\nDo not develop features in this copy. Removing it is desirable, but it is a separate public-package\ncleanup because the root wheel currently exports the package and the Docker image copies it. That\ncleanup must update the root package metadata, Docker health tests, lockfile, and public README in\none deliberate change.\n\n## Deep modules\n\n| Module | Interface | Hidden implementation |\n|---|---|---|\n| `PentestLoop` | `run(RunSpec) -> RunSnapshot` | recovery ordering, retries, episode identity, failure settlement |\n| `MemoryKernel` | create/open/snapshot and atomic commits | SQLite schema, transactions, revisions, leases, dependency liveness |\n| `compile_plan` | decision + snapshot -> valid plan | scope, dependency, phase, completion, and size validation |\n| `compile_execution` | result + lease + trace -> valid execution | exact receipt matching, evidence fallback, identity, recovery rules |\n| `EpisodeRunner` | one typed episode -> normalized result | provider invocation and durable append-only trace files |\n| external `UnifiedAgent` | one task over Claude or Codex | SDK differences, native options, event normalization |\n\nThese interfaces are the preferred test surfaces. New provider behavior belongs behind\n`UnifiedAgent`; new canonical-state behavior belongs behind the Memory Kernel or compilers.\n\n## Memory and retrieval\n\nStored state is complete and retrieval is bounded. The Supervisor receives the open working set,\nrecent closed work, required basis/dependency context, selected observations, history counts, and\nrecent diagnostics. The Executor receives one task, explicit basis, same-task evidence, and a retry\ndiagnostic. A future retriever may select canonical IDs, but it must not replace SQLite or turn\nsummaries into evidence.\n\nThe current controller weakness is convergence, not database capacity: long runs can lose compact\ncoverage information and revisit completed surfaces. The next design slice should improve the\ndeterministic strategy projection and duplicate/branch policy before adding another agent or RAG.\n\n## Runtime and benchmark ownership\n\n- Local framework development runs from `pentestgpt_agent/`.\n- The root Docker image supplies pentest tools, provider CLIs, legacy code, and persisted auth. It\n  does not currently bake in the maintained framework.\n- The sibling `xbow-benchmark` checkout is a historical/reference artifact, not a supported runtime\n  or verification path. PentestGPT owns no XBOW runner.\n- HTB execution happens only on the authorized remote attack box described in the parent project\n  guide, never directly from the development Mac.\n\n## Current design priorities\n\n1. Preserve the two-role loop and deterministic memory authority.\n2. Improve Supervisor coverage retrieval and convergence using saved-trace replay tests.\n3. Keep both roles fully enabled inside a restricted deployment environment.\n4. Remove the root `unified_agent` compatibility copy in a coordinated public-package cleanup.\n5. Add a goal-specific verifier only when non-CTF completion semantics require it.\n"},"items":[{"name":"CLAUDE.md","path":"CLAUDE.md","rawUrl":"https://raw.githubusercontent.com/GreyDGL/PentestGPT/HEAD/CLAUDE.md","title":"Claude Agent Guidelines & System Prompt","category":"claude-rule","format":"markdown","content":"# Claude guide\n\nInternal instructions for Claude Code in this repository. Read\n[`docs/architecture.md`](docs/architecture.md) before architecture work. The root `README.md` is the\npublic project page and must not be edited unless the user explicitly requests that separate review.\n\n## Active project map\n\n- `pentestgpt_agent/` — maintained autonomous Supervisor/Executor framework; nested uv project.\n- `pentestgpt_legacy/` — maintained human-driven USEN-2024-style client.\n- `../UnifedAgentWrapper/` — canonical `unified-agent` package used by the framework.\n- `../xbow-benchmark/` — reference-only benchmark harness and historical results; it is not a\n  supported `pentestgpt-agent` CLI, CI, or runtime integration.\n- `unified_agent/` — obsolete compatibility copy retained by root packaging/Docker only. Do not add\n  features here or confuse it with the framework dependency.\n\nThe old fixed-stage `pentestgpt/` package and the previous ledger-centered\nInstructor/Executor/Judge implementation are gone. Historical reports may still name them.\n\n## Runtime contract\n\n- The Supervisor and Executor both use `SandboxPolicy.FULL_ACCESS`; deployment isolation is the\n  security boundary.\n- Each episode is fresh. SQLite and exact trace receipts—not provider conversation history—are\n  memory.\n- Deterministic code owns scope, plan validation, leases, evidence, retries, completion bases, and\n  revisions.\n- Provider action and file activity is logged but is not an audit failure.\n- Keep the core at two LLM roles. Do not add an always-on judge, RAG layer, or scheduler without\n  trace evidence that the current deterministic seam cannot solve the problem.\n\n## Commands\n\nFramework work runs inside the nested project:\n\n```bash\ncd pentestgpt_agent\nuv sync --extra claude          # or codex / all\nuv run python -m pytest -q\nuv run ruff check src tests\nuv run ruff format --check src tests\nuv run mypy src\nuv lock --check\nuv build\n```\n\nFrom the repository root:\n\n```bash\nmake run TARGET=http://127.0.0.1:8000 BACKEND=claude\nmake check\nmake ci\nmake docker-build\nmake docker-login\nmake docker-auth-status\n```\n\nThe root Docker image does not currently contain `pentestgpt_agent`; treat `make docker-run` as\npending runtime wiring. The sibling XBOW checkout is retained only as a reference and is not a\nproduct verification path.\n\n## Documentation map\n\n- `docs/architecture.md` — current repository and module decisions.\n- `pentestgpt_agent/CONTEXT.md` — domain language and invariants.\n- `pentestgpt_agent/README.md` — framework development and operation.\n- `docs/docker-dev-plan.md` — current Docker/auth status and known gap.\n- `PENTESTGPT_AGENT_NEW_*` — compact historical migration/qualification records.\n- `pentestgpt_agent/HTB_ENIGMA_QUALIFICATION_20260712.md` — failed remote qualification evidence.\n\n## Editing rules\n\n- Preserve unrelated and concurrent worktree changes. Never restore or modify files merely because\n  they appear as changes you did not create.\n- Do not edit the root public `README.md` during internal documentation cleanup.\n- Do not put benchmark runners or generated result archives back into this repository.\n- Keep application imports as `unified_agent`; change dependency source configuration rather than\n  copying the wrapper into `pentestgpt_agent`.\n- Add focused replay or interface-level tests for behavior changes before live runs.\n- Never expose provider credentials, VPN files, HTB tokens, flags, or raw sensitive traces.\n","isInternal":false,"tokens":778,"sizeBytes":3477},{"name":"SKILL.md","path":".agents/skills/ask-matt/SKILL.md","rawUrl":"https://raw.githubusercontent.com/GreyDGL/PentestGPT/HEAD/.agents/skills/ask-matt/SKILL.md","title":"ask-matt","category":"anthropic-skill","format":"markdown","content":"---\nname: ask-matt\ndescription: Ask which skill or flow fits your situation. A router over the user-invoked skills in this repo.\ndisable-model-invocation: true\n---\n\n# Ask Matt\n\nYou don't remember every skill, so ask.\n\nA **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.\n\n## The main flow: idea → ship\n\nThe route most work travels. You have an idea and want it built.\n\n1. **`/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.)\n2. **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):\n   - **`/handoff`** out, then open a fresh session against that file,\n   - **`/prototype`** to answer the question with throwaway code,\n   - **`/handoff`** back what you learned, and reference it from the original idea thread.\n3. **Branch — is this a multi-session build?**\n   - **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.\n   - **No** → **`/implement`** right here, in the same context window.\n\n### Context hygiene\n\nKeep 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.\n\nThe 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.\n\n## On-ramps\n\nA starting situation that generates work, then merges onto the main flow.\n\n- **Bugs and requests piling up** → **`/triage`**. It moves issues through triage roles and produces agent-ready issues, which **`/implement`** later picks up.\n\n  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**.\n\n## Codebase health\n\nNot feature work — upkeep.\n\n- **`/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`.\n\n## Crossing sessions\n\n- **`/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**.\n- **`/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.\n\n## Standalone\n\nOff the main flow entirely.\n\n- **`/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.\n- **`/teach`** — learn a concept over multiple sessions, using the current directory as a stateful workspace.\n- **`/writing-great-skills`** — reference for writing and editing skills well.\n\n## Precondition\n\n**`/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.\n","frontmatter":{"name":"ask-matt","description":"Ask which skill or flow fits your situation. A router over the user-invoked skills in this repo.","disable-model-invocation":true,"disableModelInvocation":true},"isInternal":false,"tokens":1074,"sizeBytes":4388},{"name":"DEEPENING.md","path":".agents/skills/codebase-design/DEEPENING.md","rawUrl":"https://raw.githubusercontent.com/GreyDGL/PentestGPT/HEAD/.agents/skills/codebase-design/DEEPENING.md","title":"Codebase-design Skill","category":"anthropic-skill","format":"markdown","content":"# Deepening\n\nHow to deepen a cluster of shallow modules safely, given its dependencies. Assumes the vocabulary in [SKILL.md](SKILL.md) — **module**, **interface**, **seam**, **adapter**.\n\n## Dependency categories\n\nWhen assessing a candidate for deepening, classify its dependencies. The category determines how the deepened module is tested across its seam.\n\n### 1. In-process\n\nPure computation, in-memory state, no I/O. Always deepenable — merge the modules and test through the new interface directly. No adapter needed.\n\n### 2. Local-substitutable\n\nDependencies 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.\n\n### 3. Remote but owned (Ports & Adapters)\n\nYour 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.\n\nRecommendation 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.\"*\n\n### 4. True external (Mock)\n\nThird-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.\n\n## Seam discipline\n\n- **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.\n- **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.\n\n## Testing strategy: replace, don't layer\n\n- Old unit tests on shallow modules become waste once tests at the deepened module's interface exist — delete them.\n- Write new tests at the deepened module's interface. The **interface is the test surface**.\n- Tests assert on observable outcomes through the interface, not internal state.\n- 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.\n","isInternal":false,"tokens":542,"sizeBytes":2559},{"name":"DESIGN-IT-TWICE.md","path":".agents/skills/codebase-design/DESIGN-IT-TWICE.md","rawUrl":"https://raw.githubusercontent.com/GreyDGL/PentestGPT/HEAD/.agents/skills/codebase-design/DESIGN-IT-TWICE.md","title":"Codebase-design Skill","category":"anthropic-skill","format":"markdown","content":"# Design It Twice\n\nWhen 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.\n\nUses the vocabulary in [SKILL.md](SKILL.md) — **module**, **interface**, **seam**, **adapter**, **leverage**.\n\n## Process\n\n### 1. Frame the problem space\n\nBefore spawning sub-agents, write a user-facing explanation of the problem space for the chosen candidate:\n\n- The constraints any new interface would need to satisfy\n- The dependencies it would rely on, and which category they fall into (see [DEEPENING.md](DEEPENING.md))\n- A rough illustrative code sketch to ground the constraints — not a proposal, just a way to make the constraints concrete\n\nShow this to the user, then immediately proceed to Step 2. The user reads and thinks while the sub-agents work in parallel.\n\n### 2. Spawn sub-agents\n\nSpawn 3+ sub-agents in parallel using the Agent tool. Each must produce a **radically different** interface for the deepened module.\n\nPrompt 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:\n\n- Agent 1: \"Minimize the interface — aim for 1–3 entry points max. Maximise leverage per entry point.\"\n- Agent 2: \"Maximise flexibility — support many use cases and extension.\"\n- Agent 3: \"Optimise for the most common caller — make the default case trivial.\"\n- Agent 4 (if applicable): \"Design around ports & adapters for cross-seam dependencies.\"\n\nInclude 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.\n\nEach sub-agent outputs:\n\n1. Interface (types, methods, params — plus invariants, ordering, error modes)\n2. Usage example showing how callers use it\n3. What the implementation hides behind the seam\n4. Dependency strategy and adapters (see [DEEPENING.md](DEEPENING.md))\n5. Trade-offs — where leverage is high, where it's thin\n\n### 3. Present and compare\n\nPresent 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**.\n\nAfter 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.\n","isInternal":false,"tokens":611,"sizeBytes":2712},{"name":"SKILL.md","path":".agents/skills/codebase-design/SKILL.md","rawUrl":"https://raw.githubusercontent.com/GreyDGL/PentestGPT/HEAD/.agents/skills/codebase-design/SKILL.md","title":"codebase-design","category":"anthropic-skill","format":"markdown","content":"---\nname: codebase-design\ndescription: 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.\n---\n\n# Codebase Design\n\nDesign **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.\n\n## Glossary\n\nUse these terms exactly — don't substitute \"component,\" \"service,\" \"API,\" or \"boundary.\" Consistent language is the whole point.\n\n**Module** — anything with an interface and an implementation. Deliberately scale-agnostic: a function, class, package, or tier-spanning slice. _Avoid_: unit, component, service.\n\n**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).\n\n**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.\n\n**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.\n\n**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).\n\n**Adapter** — a concrete thing that satisfies an interface at a seam. Describes *role* (what slot it fills), not substance (what's inside).\n\n**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.\n\n**Locality** — what maintainers get from depth: change, bugs, knowledge, and verification concentrate in one place rather than spreading across callers. Fix once, fixed everywhere.\n\n## Deep vs shallow\n\n**Deep module** = small interface + lots of implementation:\n\n```\n┌─────────────────────┐\n│   Small Interface   │  ← Few methods, simple params\n├─────────────────────┤\n│                     │\n│  Deep Implementation│  ← Complex logic hidden\n│                     │\n└─────────────────────┘\n```\n\n**Shallow module** = large interface + little implementation (avoid):\n\n```\n┌─────────────────────────────────┐\n│       Large Interface           │  ← Many methods, complex params\n├─────────────────────────────────┤\n│  Thin Implementation            │  ← Just passes through\n└─────────────────────────────────┘\n```\n\nWhen designing an interface, ask:\n\n- Can I reduce the number of methods?\n- Can I simplify the parameters?\n- Can I hide more complexity inside?\n\n## Principles\n\n- **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.\n- **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.\n- **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.\n- **One adapter means a hypothetical seam. Two adapters means a real one.** Don't introduce a seam unless something actually varies across it.\n\n## Designing for testability\n\nGood interfaces make testing natural:\n\n1. **Accept dependencies, don't create them.**\n\n   ```typescript\n   // Testable\n   function processOrder(order, paymentGateway) {}\n\n   // Hard to test\n   function processOrder(order) {\n     const gateway = new StripeGateway();\n   }\n   ```\n\n2. **Return results, don't produce side effects.**\n\n   ```typescript\n   // Testable\n   function calculateDiscount(cart): Discount {}\n\n   // Hard to test\n   function applyDiscount(cart): void {\n     cart.total -= discount;\n   }\n   ```\n\n3. **Small surface area.** Fewer methods = fewer tests needed. Fewer params = simpler test setup.\n\n## Relationships\n\n- A **Module** has exactly one **Interface** (the surface it presents to callers and tests).\n- **Depth** is a property of a **Module**, measured against its **Interface**.\n- A **Seam** is where a **Module**'s **Interface** lives.\n- An **Adapter** sits at a **Seam** and satisfies the **Interface**.\n- **Depth** produces **Leverage** for callers and **Locality** for maintainers.\n\n## Rejected framings\n\n- **Depth as ratio of implementation-lines to interface-lines** (Ousterhout): rewards padding the implementation. We use depth-as-leverage instead.\n- **\"Interface\" as the TypeScript `interface` keyword or a class's public methods**: too narrow — interface here includes every fact a caller must know.\n- **\"Boundary\"**: overloaded with DDD's bounded context. Say **seam** or **interface**.\n\n## Going deeper\n\n- **Deepening a cluster given its dependencies** — see [DEEPENING.md](DEEPENING.md): dependency categories, seam discipline, and replace-don't-layer testing.\n- **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.\n","frontmatter":{"name":"codebase-design","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."},"isInternal":false,"tokens":1366,"sizeBytes":6488},{"name":"SKILL.md","path":".agents/skills/diagnosing-bugs/SKILL.md","rawUrl":"https://raw.githubusercontent.com/GreyDGL/PentestGPT/HEAD/.agents/skills/diagnosing-bugs/SKILL.md","title":"diagnosing-bugs","category":"anthropic-skill","format":"markdown","content":"---\nname: diagnosing-bugs\ndescription: Diagnosis loop for hard bugs and performance regressions. Use when the user says \"diagnose\"/\"debug this\", or reports something broken/throwing/failing/slow.\n---\n\n# Diagnosing Bugs\n\nA discipline for hard bugs. Skip phases only when explicitly justified.\n\nWhen 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.\n\n## Phase 1 — Build a feedback loop\n\n**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.\n\nSpend disproportionate effort here. **Be aggressive. Be creative. Refuse to give up.**\n\n### Ways to construct one — try them in roughly this order\n\n1. **Failing test** at whatever seam reaches the bug — unit, integration, e2e.\n2. **Curl / HTTP script** against a running dev server.\n3. **CLI invocation** with a fixture input, diffing stdout against a known-good snapshot.\n4. **Headless browser script** (Playwright / Puppeteer) — drives the UI, asserts on DOM/console/network.\n5. **Replay a captured trace.** Save a real network request / payload / event log to disk; replay it through the code path in isolation.\n6. **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.\n7. **Property / fuzz loop.** If the bug is \"sometimes wrong output\", run 1000 random inputs and look for the failure mode.\n8. **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.\n9. **Differential loop.** Run the same input through old-version vs new-version (or two configs) and diff outputs.\n10. **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.\n\nBuild the right feedback loop, and the bug is 90% fixed.\n\n### Tighten the loop\n\nTreat the loop as a product. Once you have _a_ loop, **tighten** it:\n\n- Can I make it faster? (Cache setup, skip unrelated init, narrow the test scope.)\n- Can I make the signal sharper? (Assert on the specific symptom, not \"didn't crash\".)\n- Can I make it more deterministic? (Pin time, seed RNG, isolate filesystem, freeze network.)\n\nA 30-second flaky loop is barely better than no loop; a 2-second deterministic one is tight — a debugging superpower.\n\n### Non-deterministic bugs\n\nThe 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.\n\n### When you genuinely cannot build a loop\n\nStop 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.\n\n### Completion criterion — a tight loop that goes red\n\nPhase 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:\n\n- [ ] **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_.\n- [ ] **Deterministic** — same verdict every run (flaky bugs: a pinned, high reproduction rate, per above).\n- [ ] **Fast** — seconds, not minutes.\n- [ ] **Agent-runnable** — you can run it unattended; a human in the loop only via `scripts/hitl-loop.template.sh`.\n\nIf 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.\n\n## Phase 2 — Reproduce + minimise\n\nRun the loop. Watch it go red — the bug appears.\n\nConfirm:\n\n- [ ] The loop produces the failure mode the **user** described — not a different failure that happens to be nearby. Wrong bug = wrong fix.\n- [ ] The failure is reproducible across multiple runs (or, for non-deterministic bugs, reproducible at a high enough rate to debug against).\n- [ ] You have captured the exact symptom (error message, wrong output, slow timing) so later phases can verify the fix actually addresses it.\n\n### Minimise\n\nOnce 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.\n\nWhy 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.\n\nDone when **every remaining element is load-bearing** — removing any one of them makes the loop go green.\n\nDo not proceed until you have reproduced **and** minimised.\n\n## Phase 3 — Hypothesise\n\nGenerate **3–5 ranked hypotheses** before testing any of them. Single-hypothesis generation anchors on the first plausible idea.\n\nEach hypothesis must be **falsifiable**: state the prediction it makes.\n\n> Format: \"If <X> is the cause, then <changing Y> will make the bug disappear / <changing Z> will make it worse.\"\n\nIf you cannot state the prediction, the hypothesis is a vibe — discard or sharpen it.\n\n**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.\n\n## Phase 4 — Instrument\n\nEach probe must map to a specific prediction from Phase 3. **Change one variable at a time.**\n\nTool preference:\n\n1. **Debugger / REPL inspection** if the env supports it. One breakpoint beats ten logs.\n2. **Targeted logs** at the boundaries that distinguish hypotheses.\n3. Never \"log everything and grep\".\n\n**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.\n\n**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.\n\n## Phase 5 — Fix + regression test\n\nWrite the regression test **before the fix** — but only if there is a **correct seam** for it.\n\nA 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.\n\n**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.\n\nIf a correct seam exists:\n\n1. Turn the minimised repro into a failing test at that seam.\n2. Watch it fail.\n3. Apply the fix.\n4. Watch it pass.\n5. Re-run the Phase 1 feedback loop against the original (un-minimised) scenario.\n\n## Phase 6 — Cleanup + post-mortem\n\nRequired before declaring done:\n\n- [ ] Original repro no longer reproduces (re-run the Phase 1 loop)\n- [ ] Regression test passes (or absence of seam is documented)\n- [ ] All `[DEBUG-...]` instrumentation removed (`grep` the prefix)\n- [ ] Throwaway prototypes deleted (or moved to a clearly-marked debug location)\n- [ ] The hypothesis that turned out correct is stated in the commit / PR message — so the next debugger learns\n\n**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.\n","frontmatter":{"name":"diagnosing-bugs","description":"Diagnosis loop for hard bugs and performance regressions. Use when the user says \"diagnose\"/\"debug this\", or reports something broken/throwing/failing/slow."},"isInternal":false,"tokens":1997,"sizeBytes":8536},{"name":"ADR-FORMAT.md","path":".agents/skills/domain-modeling/ADR-FORMAT.md","rawUrl":"https://raw.githubusercontent.com/GreyDGL/PentestGPT/HEAD/.agents/skills/domain-modeling/ADR-FORMAT.md","title":"Domain-modeling Skill","category":"anthropic-skill","format":"markdown","content":"# ADR Format\n\nADRs live in `docs/adr/` and use sequential numbering: `0001-slug.md`, `0002-slug.md`, etc.\n\nCreate the `docs/adr/` directory lazily — only when the first ADR is needed.\n\n## Template\n\n```md\n# {Short title of the decision}\n\n{1-3 sentences: what's the context, what did we decide, and why.}\n```\n\nThat'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.\n\n## Optional sections\n\nOnly include these when they add genuine value. Most ADRs won't need them.\n\n- **Status** frontmatter (`proposed | accepted | deprecated | superseded by ADR-NNNN`) — useful when decisions are revisited\n- **Considered Options** — only when the rejected alternatives are worth remembering\n- **Consequences** — only when non-obvious downstream effects need to be called out\n\n## Numbering\n\nScan `docs/adr/` for the highest existing number and increment by one.\n\n## When to offer an ADR\n\nAll three of these must be true:\n\n1. **Hard to reverse** — the cost of changing your mind later is meaningful\n2. **Surprising without context** — a future reader will look at the code and wonder \"why on earth did they do it this way?\"\n3. **The result of a real trade-off** — there were genuine alternatives and you picked one for specific reasons\n\nIf 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.\"\n\n### What qualifies\n\n- **Architectural shape.** \"We're using a monorepo.\" \"The write model is event-sourced, the read model is projected into Postgres.\"\n- **Integration patterns between contexts.** \"Ordering and Billing communicate via domain events, not synchronous HTTP.\"\n- **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.\n- **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.\n- **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.\n- **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.\"\n- **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.\n","isInternal":false,"tokens":634,"sizeBytes":2766},{"name":"CONTEXT-FORMAT.md","path":".agents/skills/domain-modeling/CONTEXT-FORMAT.md","rawUrl":"https://raw.githubusercontent.com/GreyDGL/PentestGPT/HEAD/.agents/skills/domain-modeling/CONTEXT-FORMAT.md","title":"Domain-modeling Skill","category":"anthropic-skill","format":"markdown","content":"# CONTEXT.md Format\n\n## Structure\n\n```md\n# {Context Name}\n\n{One or two sentence description of what this context is and why it exists.}\n\n## Language\n\n**Order**:\n{A one or two sentence description of the term}\n_Avoid_: Purchase, transaction\n\n**Invoice**:\nA request for payment sent to a customer after delivery.\n_Avoid_: Bill, payment request\n\n**Customer**:\nA person or organization that places orders.\n_Avoid_: Client, buyer, account\n```\n\n## Rules\n\n- **Be opinionated.** When multiple words exist for the same concept, pick the best one and list the others under `_Avoid_`.\n- **Keep definitions tight.** One or two sentences max. Define what it IS, not what it does.\n- **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.\n- **Group terms under subheadings** when natural clusters emerge. If all terms belong to a single cohesive area, a flat list is fine.\n\n## Single vs multi-context repos\n\n**Single context (most repos):** One `CONTEXT.md` at the repo root.\n\n**Multiple contexts:** A `CONTEXT-MAP.md` at the repo root lists the contexts, where they live, and how they relate to each other:\n\n```md\n# Context Map\n\n## Contexts\n\n- [Ordering](./src/ordering/CONTEXT.md) — receives and tracks customer orders\n- [Billing](./src/billing/CONTEXT.md) — generates invoices and processes payments\n- [Fulfillment](./src/fulfillment/CONTEXT.md) — manages warehouse picking and shipping\n\n## Relationships\n\n- **Ordering → Fulfillment**: Ordering emits `OrderPlaced` events; Fulfillment consumes them to start picking\n- **Fulfillment → Billing**: Fulfillment emits `ShipmentDispatched` events; Billing consumes them to generate invoices\n- **Ordering ↔ Billing**: Shared types for `CustomerId` and `Money`\n```\n\nThe skill infers which structure applies:\n\n- If `CONTEXT-MAP.md` exists, read it to find contexts\n- If only a root `CONTEXT.md` exists, single context\n- If neither exists, create a root `CONTEXT.md` lazily when the first term is resolved\n\nWhen multiple contexts exist, infer which one the current topic relates to. If unclear, ask.\n","isInternal":false,"tokens":536,"sizeBytes":2299},{"name":"SKILL.md","path":".agents/skills/domain-modeling/SKILL.md","rawUrl":"https://raw.githubusercontent.com/GreyDGL/PentestGPT/HEAD/.agents/skills/domain-modeling/SKILL.md","title":"domain-modeling","category":"anthropic-skill","format":"markdown","content":"---\nname: domain-modeling\ndescription: 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.\n---\n\n# Domain Modeling\n\nActively 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.)\n\n## File structure\n\nMost repos have a single context:\n\n```\n/\n├── CONTEXT.md\n├── docs/\n│   └── adr/\n│       ├── 0001-event-sourced-orders.md\n│       └── 0002-postgres-for-write-model.md\n└── src/\n```\n\nIf a `CONTEXT-MAP.md` exists at the root, the repo has multiple contexts. The map points to where each one lives:\n\n```\n/\n├── CONTEXT-MAP.md\n├── docs/\n│   └── adr/                          ← system-wide decisions\n├── src/\n│   ├── ordering/\n│   │   ├── CONTEXT.md\n│   │   └── docs/adr/                 ← context-specific decisions\n│   └── billing/\n│       ├── CONTEXT.md\n│       └── docs/adr/\n```\n\nCreate 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.\n\n## During the session\n\n### Challenge against the glossary\n\nWhen 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?\"\n\n### Sharpen fuzzy language\n\nWhen 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.\"\n\n### Discuss concrete scenarios\n\nWhen 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.\n\n### Cross-reference with code\n\nWhen 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?\"\n\n### Update CONTEXT.md inline\n\nWhen 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).\n\n`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.\n\n### Offer ADRs sparingly\n\nOnly offer to create an ADR when all three are true:\n\n1. **Hard to reverse** — the cost of changing your mind later is meaningful\n2. **Surprising without context** — a future reader will wonder \"why did they do it this way?\"\n3. **The result of a real trade-off** — there were genuine alternatives and you picked one for specific reasons\n\nIf any of the three is missing, skip the ADR. Use the format in [ADR-FORMAT.md](./ADR-FORMAT.md).\n","frontmatter":{"name":"domain-modeling","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."},"isInternal":false,"tokens":769,"sizeBytes":3427},{"name":"SKILL.md","path":".agents/skills/grill-me/SKILL.md","rawUrl":"https://raw.githubusercontent.com/GreyDGL/PentestGPT/HEAD/.agents/skills/grill-me/SKILL.md","title":"grill-me","category":"anthropic-skill","format":"markdown","content":"---\nname: grill-me\ndescription: A relentless interview to sharpen a plan or design.\ndisable-model-invocation: true\n---\n\nRun a `/grilling` session.\n","frontmatter":{"name":"grill-me","description":"A relentless interview to sharpen a plan or design.","disable-model-invocation":true,"disableModelInvocation":true},"isInternal":false,"tokens":34,"sizeBytes":147},{"name":"SKILL.md","path":".agents/skills/grill-with-docs/SKILL.md","rawUrl":"https://raw.githubusercontent.com/GreyDGL/PentestGPT/HEAD/.agents/skills/grill-with-docs/SKILL.md","title":"grill-with-docs","category":"anthropic-skill","format":"markdown","content":"---\nname: grill-with-docs\ndescription: A relentless interview to sharpen a plan or design, which also creates docs (ADR's and glossary) as we go.\ndisable-model-invocation: true\n---\n\nRun a `/grilling` session, using the `/domain-modeling` skill.\n","frontmatter":{"name":"grill-with-docs","description":"A relentless interview to sharpen a plan or design, which also creates docs (ADR's and glossary) as we go.","disable-model-invocation":true,"disableModelInvocation":true},"isInternal":false,"tokens":60,"sizeBytes":245},{"name":"SKILL.md","path":".agents/skills/grilling/SKILL.md","rawUrl":"https://raw.githubusercontent.com/GreyDGL/PentestGPT/HEAD/.agents/skills/grilling/SKILL.md","title":"grilling","category":"anthropic-skill","format":"markdown","content":"---\nname: grilling\ndescription: 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.\n---\n\nInterview 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.\n\nAsk the questions one at a time, waiting for feedback on each question before continuing. Asking multiple questions at once is bewildering.\n\nIf a question can be answered by exploring the codebase, explore the codebase instead.\n","frontmatter":{"name":"grilling","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."},"isInternal":false,"tokens":128,"sizeBytes":666},{"name":"SKILL.md","path":".agents/skills/handoff/SKILL.md","rawUrl":"https://raw.githubusercontent.com/GreyDGL/PentestGPT/HEAD/.agents/skills/handoff/SKILL.md","title":"handoff","category":"anthropic-skill","format":"markdown","content":"---\nname: handoff\ndescription: Compact the current conversation into a handoff document for another agent to pick up.\nargument-hint: \"What will the next session be used for?\"\ndisable-model-invocation: true\n---\n\nWrite 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.\n\nInclude a \"suggested skills\" section in the document, which suggests skills that the agent should invoke.\n\nDo not duplicate content already captured in other artifacts (PRDs, plans, ADRs, issues, commits, diffs). Reference them by path or URL instead.\n\nRedact any sensitive information, such as API keys, passwords, or personally identifiable information.\n\nIf the user passed arguments, treat them as a description of what the next session will focus on and tailor the doc accordingly.\n","frontmatter":{"name":"handoff","description":"Compact the current conversation into a handoff document for another agent to pick up.","argument-hint":"What will the next session be used for?","disable-model-invocation":true,"disableModelInvocation":true},"isInternal":false,"tokens":178,"sizeBytes":878},{"name":"HTML-REPORT.md","path":".agents/skills/improve-codebase-architecture/HTML-REPORT.md","rawUrl":"https://raw.githubusercontent.com/GreyDGL/PentestGPT/HEAD/.agents/skills/improve-codebase-architecture/HTML-REPORT.md","title":"Improve-codebase-architecture Skill","category":"anthropic-skill","format":"markdown","content":"# HTML Report Format\n\nThe 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.\n\n## Scaffold\n\n```html\n<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"utf-8\" />\n    <title>Architecture review — {{repo name}}</title>\n    <script src=\"https://cdn.tailwindcss.com\"></script>\n    <script type=\"module\">\n      import mermaid from \"https://cdn.jsdelivr.net/npm/mermaid@11/dist/mermaid.esm.min.mjs\";\n      mermaid.initialize({ startOnLoad: true, theme: \"neutral\", securityLevel: \"loose\" });\n    </script>\n    <style>\n      /* small custom layer for things Tailwind doesn't cover cleanly:\n         dashed seam lines, hand-drawn-feeling arrow heads, etc. */\n      .seam { stroke-dasharray: 4 4; }\n      .leak { stroke: #dc2626; }\n      .deep { background: linear-gradient(135deg, #0f172a, #1e293b); }\n    </style>\n  </head>\n  <body class=\"bg-stone-50 text-slate-900 font-sans\">\n    <main class=\"max-w-5xl mx-auto px-6 py-12 space-y-12\">\n      <header>...</header>\n      <section id=\"candidates\" class=\"space-y-10\">...</section>\n      <section id=\"top-recommendation\">...</section>\n    </main>\n  </body>\n</html>\n```\n\n## Header\n\nRepo 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.\n\n## Candidate card\n\nThe diagrams carry the weight. Prose is sparse, plain, and uses the glossary terms (from the `/codebase-design` skill) without ceremony.\n\nEach candidate is one `<article>`:\n\n- **Title** — short, names the deepening (e.g. \"Collapse the Order intake pipeline\").\n- **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`).\n- **Files** — monospaced list, `font-mono text-sm`.\n- **Before / After diagram** — the centrepiece. Two columns, side by side. See patterns below.\n- **Problem** — one sentence. What hurts.\n- **Solution** — one sentence. What changes.\n- **Wins** — bullets, ≤6 words each. e.g. \"Tests hit one interface\", \"Pricing logic stops leaking\", \"Delete 4 shallow wrappers\".\n- **ADR callout** (if applicable) — one line in an amber-tinted box.\n\nNo paragraphs of explanation. If the diagram needs a paragraph to be understood, redraw the diagram.\n\n## Diagram patterns\n\nPick the pattern that fits the candidate. Mix them. Don't make every diagram look the same — variety is part of the point.\n\n### Mermaid graph (the workhorse for dependencies / call flow)\n\nUse 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.\"\n\n```html\n<div class=\"rounded-lg border border-slate-200 bg-white p-4\">\n  <pre class=\"mermaid\">\n    flowchart LR\n      A[OrderHandler] --> B[OrderValidator]\n      B --> C[OrderRepo]\n      C -.leak.-> D[PricingClient]\n      classDef leak stroke:#dc2626,stroke-width:2px;\n      class C,D leak\n  </pre>\n</div>\n```\n\n### Hand-built boxes-and-arrows (when Mermaid's layout fights you)\n\nModules 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.\n\n### Cross-section (good for layered shallowness)\n\nStack 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.\n\n### Mass diagram (good for \"interface as wide as implementation\")\n\nTwo 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).\n\n### Call-graph collapse\n\nBefore: 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.\n\n## Style guidance\n\n- Lean editorial, not corporate-dashboard. Generous whitespace. Serif optional for headings (`font-serif` works well with stone/slate).\n- Colour sparingly: one accent (emerald or indigo) plus red for leakage and amber for warnings.\n- Keep diagrams ~320px tall so before/after sits comfortably side by side without scrolling.\n- Use `text-xs uppercase tracking-wider` for module labels inside diagrams — they should read as schematic, not as UI.\n- 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.\n\n## Top recommendation section\n\nOne larger card. Candidate name, one sentence on why, anchor link to its card. That's it.\n\n## Tone\n\nPlain English, concise — but the architectural nouns and verbs come straight from the `/codebase-design` skill. Concision is not an excuse to drift.\n\n**Use exactly:** module, interface, implementation, depth, deep, shallow, seam, adapter, leverage, locality.\n\n**Never substitute:** component, service, unit (for module) · API, signature (for interface) · boundary (for seam) · layer, wrapper (for module, when you mean module).\n\n**Phrasings that fit the style:**\n\n- \"Order intake module is shallow — interface nearly matches the implementation.\"\n- \"Pricing leaks across the seam.\"\n- \"Deepen: one interface, one place to test.\"\n- \"Two adapters justify the seam: HTTP in prod, in-memory in tests.\"\n\n**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.\n\nNo 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.\n","isInternal":false,"tokens":1616,"sizeBytes":6685},{"name":"SKILL.md","path":".agents/skills/improve-codebase-architecture/SKILL.md","rawUrl":"https://raw.githubusercontent.com/GreyDGL/PentestGPT/HEAD/.agents/skills/improve-codebase-architecture/SKILL.md","title":"improve-codebase-architecture","category":"anthropic-skill","format":"markdown","content":"---\nname: improve-codebase-architecture\ndescription: Scan a codebase for deepening opportunities, present them as a visual HTML report, then grill through whichever one you pick.\ndisable-model-invocation: true\n---\n\n# Improve Codebase Architecture\n\nSurface architectural friction and propose **deepening opportunities** — refactors that turn shallow modules into deep ones. The aim is testability and AI-navigability.\n\nThis command is _informed_ by the project's domain model and built on a shared design vocabulary:\n\n- 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.\"\n- The domain language in `CONTEXT.md` gives names to good seams; ADRs in `docs/adr/` record decisions this command should not re-litigate.\n\n## Process\n\n### 1. Explore\n\nRead the project's domain glossary (`CONTEXT.md`) and any ADRs in the area you're touching first.\n\nThen 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:\n\n- Where does understanding one concept require bouncing between many small modules?\n- Where are modules **shallow** — interface nearly as complex as the implementation?\n- Where have pure functions been extracted just for testability, but the real bugs hide in how they're called (no **locality**)?\n- Where do tightly-coupled modules leak across their seams?\n- Which parts of the codebase are untested, or hard to test through their current interface?\n\nApply 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.\n\n### 2. Present candidates as an HTML report\n\nWrite 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.\n\nThe 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.\n\nFor each candidate, render a card with:\n\n- **Files** — which files/modules are involved\n- **Problem** — why the current architecture is causing friction\n- **Solution** — plain English description of what would change\n- **Benefits** — explained in terms of locality and leverage, and how tests would improve\n- **Before / After diagram** — side-by-side, custom-drawn, illustrating the shallowness and the deepening\n- **Recommendation strength** — one of `Strong`, `Worth exploring`, `Speculative`, rendered as a badge\n\nEnd the report with a **Top recommendation** section: which candidate you'd tackle first and why.\n\n**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.\"\n\n**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.\n\nSee [HTML-REPORT.md](HTML-REPORT.md) for the full HTML scaffold, diagram patterns, and styling guidance.\n\nDo NOT propose interfaces yet. After the file is written, ask the user: \"Which of these would you like to explore?\"\n\n### 3. Grilling loop\n\nOnce 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.\n\nSide effects happen inline as decisions crystallize — run the `/domain-modeling` skill to keep the domain model current as you go:\n\n- **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.\n- **Sharpening a fuzzy term during the conversation?** Update `CONTEXT.md` right there.\n- **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.\n- **Want to explore alternative interfaces for the deepened module?** Run the `/codebase-design` skill and use its design-it-twice parallel sub-agent pattern.\n","frontmatter":{"name":"improve-codebase-architecture","description":"Scan a codebase for deepening opportunities, present them as a visual HTML report, then grill through whichever one you pick.","disable-model-invocation":true,"disableModelInvocation":true},"isInternal":false,"tokens":1218,"sizeBytes":5421},{"name":"LOGIC.md","path":".agents/skills/prototype/LOGIC.md","rawUrl":"https://raw.githubusercontent.com/GreyDGL/PentestGPT/HEAD/.agents/skills/prototype/LOGIC.md","title":"Prototype Skill","category":"anthropic-skill","format":"markdown","content":"# Logic Prototype\n\nA 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.\n\n## When this is the right shape\n\n- \"I'm not sure if this state machine handles the edge case where X then Y.\"\n- \"Does this data model actually let me represent the case where...\"\n- \"I want to feel out what the API should look like before writing it.\"\n- Anything where the user wants to **press buttons and watch state change**.\n\nIf the question is \"what should this look like\" — wrong branch. Use [UI.md](UI.md).\n\n## Process\n\n### 1. State the question\n\nBefore 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.\n\n### 2. Pick the language\n\nUse whatever the host project uses. If the project has no obvious runtime (e.g. a docs repo), ask.\n\nMatch the project's existing conventions for tooling — don't add a new package manager or runtime just for the prototype.\n\n### 3. Isolate the logic in a portable module\n\nPut 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.\n\nThe right shape depends on the question:\n\n- **A pure reducer** — `(state, action) => state`. Good when actions are discrete events and state is a single value.\n- **A state machine** — explicit states and transitions. Good when \"which actions are even legal right now\" is part of the question.\n- **A small set of pure functions** over a plain data type. Good when there's no implicit current state — just transformations.\n- **A class or module with a clear method surface** when the logic genuinely owns ongoing internal state.\n\nPick 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.\n\nThis 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.\n\n### 4. Build the smallest TUI that exposes the state\n\nBuild 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.\n\nEach frame has two parts, in this order:\n\n1. **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.\n2. **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.\n\nBehaviour:\n\n1. **Initialise state** — a single in-memory object/struct. Render the first frame on start.\n2. **Read one keystroke (or one line)** at a time, dispatch to a handler that mutates state.\n3. **Re-render** the full frame after every action — don't append, replace.\n4. **Loop until quit.**\n\nThe whole frame should fit on one screen.\n\n### 5. Make it runnable in one command\n\nAdd 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.\n\nIf the host project has no task runner, just put the command at the top of the prototype's README.\n\n### 6. Hand it over\n\nGive 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.\n\n### 7. Capture the answer\n\nWhen 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.\n\n## Anti-patterns\n\n- **Don't add tests.** A prototype that needs tests is no longer a prototype.\n- **Don't wire it to the real database.** Use an in-memory store unless the question is specifically about persistence.\n- **Don't generalise.** No \"what if we wanted to support X later.\" The prototype answers one question.\n- **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.\n- **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.\n","isInternal":false,"tokens":1303,"sizeBytes":5594},{"name":"SKILL.md","path":".agents/skills/prototype/SKILL.md","rawUrl":"https://raw.githubusercontent.com/GreyDGL/PentestGPT/HEAD/.agents/skills/prototype/SKILL.md","title":"prototype","category":"anthropic-skill","format":"markdown","content":"---\nname: prototype\ndescription: Build a throwaway prototype to flesh out a design — a runnable terminal app for state/business-logic questions, or several radically different UI variations toggleable from one route.\ndisable-model-invocation: true\n---\n\n# Prototype\n\nA prototype is **throwaway code that answers a question**. The question decides the shape.\n\n## Pick a branch\n\nIdentify which question is being answered — from the user's prompt, the surrounding code, or by asking if the user is around:\n\n- **\"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.\n- **\"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.\n\nThe 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.\n\n## Rules that apply to both\n\n1. **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.\n2. **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.\n3. **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.\n4. **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.\n5. **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.\n6. **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.\n\n## When done\n\nThe _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.\n","frontmatter":{"name":"prototype","description":"Build a throwaway prototype to flesh out a design — a runnable terminal app for state/business-logic questions, or several radically different UI variations toggleable from one route.","disable-model-invocation":true,"disableModelInvocation":true},"isInternal":false,"tokens":665,"sizeBytes":3039},{"name":"UI.md","path":".agents/skills/prototype/UI.md","rawUrl":"https://raw.githubusercontent.com/GreyDGL/PentestGPT/HEAD/.agents/skills/prototype/UI.md","title":"Prototype Skill","category":"anthropic-skill","format":"markdown","content":"# UI Prototype\n\nGenerate **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.\n\nIf the question is about logic/state rather than what something looks like — wrong branch. Use [LOGIC.md](LOGIC.md).\n\n## When this is the right shape\n\n- \"What should this page look like?\"\n- \"I want to see a few options for this dashboard before committing.\"\n- \"Try a different layout for the settings screen.\"\n- Any time the user would otherwise spend a day picking between three vague mockups in their head.\n\n## Two sub-shapes — strongly prefer sub-shape A\n\nA 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.\n\n### Sub-shape A — adjustment to an existing page (preferred)\n\nThe 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.\n\nIf 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.\n\n### Sub-shape B — a new page (last resort)\n\nOnly 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.\n\nCreate 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.\n\nBefore 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.\n\nIn both sub-shapes the floating bottom bar is identical.\n\n## Process\n\n### 1. State the question and pick N\n\nDefault to **3 variants**. More than 5 stops being radically different and starts being noise — cap there.\n\nWrite down the plan in one line, in the prototype's location or a top-of-file comment:\n\n> \"Three variants of the settings page, switchable via `?variant=`, on the existing `/settings` route.\"\n\nThis works whether the user is here to push back or not.\n\n### 2. Generate radically different variants\n\nDraft each variant. Hold each one to:\n\n- The page's purpose and the data it has access to.\n- The project's component library / styling system (TailwindCSS, shadcn, MUI, plain CSS, whatever).\n- A clear exported component name, e.g. `VariantA`, `VariantB`, `VariantC`.\n\nVariants 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.\n\n### 3. Wire them together\n\nCreate a single switcher component on the route:\n\n```tsx\n// pseudo-code — adapt to the project's framework\nconst variant = searchParams.get('variant') ?? 'A';\nreturn (\n  <>\n    {variant === 'A' && <VariantA {...data} />}\n    {variant === 'B' && <VariantB {...data} />}\n    {variant === 'C' && <VariantC {...data} />}\n    <PrototypeSwitcher variants={['A','B','C']} current={variant} />\n  </>\n);\n```\n\nFor sub-shape A (existing page): keep all the existing data fetching above the switcher; only the rendered subtree changes per variant.\n\nFor sub-shape B (new page): the throwaway route under `/prototype/<name>` mounts the same switcher.\n\n### 4. Build the floating switcher\n\nA small fixed-position bar at the bottom-centre of the screen with three pieces:\n\n- **Left arrow** — cycles to the previous variant (wraps around).\n- **Variant label** — shows the current variant key and, if the variant exports a name, that name too. e.g. `B — Sidebar layout`.\n- **Right arrow** — cycles forward (wraps around).\n\nBehaviour:\n\n- 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.\n- Keyboard: `←` and `→` arrow keys also cycle. Don't intercept arrow keys when an `<input>`, `<textarea>`, or `[contenteditable]` is focused.\n- Visually distinct from the page (e.g. high-contrast pill, subtle shadow) so it's obviously not part of the design being evaluated.\n- 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.\n\nPut the switcher in a single shared component so both sub-shapes can reuse it. Locate it wherever shared UI lives in the project.\n\n### 5. Hand it over\n\nSurface 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.\n\n### 6. Capture the answer and clean up\n\nOnce 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:\n\n- **Sub-shape A** — delete the losing variants and the switcher; fold the winner into the existing page.\n- **Sub-shape B** — promote the winning variant to a real route, delete the throwaway route and the switcher.\n\nDon't leave variant components or the switcher lying around. They rot fast and confuse the next reader.\n\n## Anti-patterns\n\n- **Variants that differ only in colour or copy.** That's a tweak, not a prototype. Real variants disagree about structure.\n- **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.\n- **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\".\n- **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.\n","isInternal":false,"tokens":1554,"sizeBytes":6789},{"name":"domain.md","path":".agents/skills/setup-matt-pocock-skills/domain.md","rawUrl":"https://raw.githubusercontent.com/GreyDGL/PentestGPT/HEAD/.agents/skills/setup-matt-pocock-skills/domain.md","title":"Setup-matt-pocock-skills Skill","category":"anthropic-skill","format":"markdown","content":"# Domain Docs\n\nHow the engineering skills should consume this repo's domain documentation when exploring the codebase.\n\n## Before exploring, read these\n\n- **`CONTEXT.md`** at the repo root, or\n- **`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.\n- **`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.\n\nIf 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.\n\n## File structure\n\nSingle-context repo (most repos):\n\n```\n/\n├── CONTEXT.md\n├── docs/adr/\n│   ├── 0001-event-sourced-orders.md\n│   └── 0002-postgres-for-write-model.md\n└── src/\n```\n\nMulti-context repo (presence of `CONTEXT-MAP.md` at the root):\n\n```\n/\n├── CONTEXT-MAP.md\n├── docs/adr/                          ← system-wide decisions\n└── src/\n    ├── ordering/\n    │   ├── CONTEXT.md\n    │   └── docs/adr/                  ← context-specific decisions\n    └── billing/\n        ├── CONTEXT.md\n        └── docs/adr/\n```\n\n## Use the glossary's vocabulary\n\nWhen 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.\n\nIf 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`).\n\n## Flag ADR conflicts\n\nIf your output contradicts an existing ADR, surface it explicitly rather than silently overriding:\n\n> _Contradicts ADR-0007 (event-sourced orders) — but worth reopening because…_\n","isInternal":false,"tokens":496,"sizeBytes":2045},{"name":"issue-tracker-github.md","path":".agents/skills/setup-matt-pocock-skills/issue-tracker-github.md","rawUrl":"https://raw.githubusercontent.com/GreyDGL/PentestGPT/HEAD/.agents/skills/setup-matt-pocock-skills/issue-tracker-github.md","title":"Setup-matt-pocock-skills Skill","category":"anthropic-skill","format":"markdown","content":"# Issue tracker: GitHub\n\nIssues and PRDs for this repo live as GitHub issues. Use the `gh` CLI for all operations.\n\n## Conventions\n\n- **Create an issue**: `gh issue create --title \"...\" --body \"...\"`. Use a heredoc for multi-line bodies.\n- **Read an issue**: `gh issue view <number> --comments`, filtering comments by `jq` and also fetching labels.\n- **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.\n- **Comment on an issue**: `gh issue comment <number> --body \"...\"`\n- **Apply / remove labels**: `gh issue edit <number> --add-label \"...\"` / `--remove-label \"...\"`\n- **Close**: `gh issue close <number> --comment \"...\"`\n\nInfer the repo from `git remote -v` — `gh` does this automatically when run inside a clone.\n\n## Pull requests as a triage surface\n\n**PRs as a request surface: no.** _(Set to `yes` if this repo treats external PRs as feature requests; `/triage` reads this flag.)_\n\nWhen set to `yes`, PRs run through the same labels and states as issues, using the `gh pr` equivalents:\n\n- **Read a PR**: `gh pr view <number> --comments` and `gh pr diff <number>` for the diff.\n- **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`).\n- **Comment / label / close**: `gh pr comment`, `gh pr edit --add-label`/`--remove-label`, `gh pr close`.\n\nGitHub 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`.\n\n## When a skill says \"publish to the issue tracker\"\n\nCreate a GitHub issue.\n\n## When a skill says \"fetch the relevant ticket\"\n\nRun `gh issue view <number> --comments`.\n","isInternal":false,"tokens":525,"sizeBytes":1950},{"name":"issue-tracker-gitlab.md","path":".agents/skills/setup-matt-pocock-skills/issue-tracker-gitlab.md","rawUrl":"https://raw.githubusercontent.com/GreyDGL/PentestGPT/HEAD/.agents/skills/setup-matt-pocock-skills/issue-tracker-gitlab.md","title":"Setup-matt-pocock-skills Skill","category":"anthropic-skill","format":"markdown","content":"# Issue tracker: GitLab\n\nIssues and PRDs for this repo live as GitLab issues. Use the [`glab`](https://gitlab.com/gitlab-org/cli) CLI for all operations.\n\n## Conventions\n\n- **Create an issue**: `glab issue create --title \"...\" --description \"...\"`. Use a heredoc for multi-line descriptions. Pass `--description -` to open an editor.\n- **Read an issue**: `glab issue view <number> --comments`. Use `-F json` for machine-readable output.\n- **List issues**: `glab issue list -F json` with appropriate `--label` filters.\n- **Comment on an issue**: `glab issue note <number> --message \"...\"`. GitLab calls comments \"notes\".\n- **Apply / remove labels**: `glab issue update <number> --label \"...\"` / `--unlabel \"...\"`. Multiple labels can be comma-separated or by repeating the flag.\n- **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.\n- **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`.\n\nInfer the repo from `git remote -v` — `glab` does this automatically when run inside a clone.\n\n## Merge requests as a triage surface\n\n**MRs as a request surface: no.** _(Set to `yes` if this repo treats external merge requests as feature requests; `/triage` reads this flag.)_\n\nWhen set to `yes`, MRs run through the same labels and states as issues, using the `glab mr` equivalents:\n\n- **Read an MR**: `glab mr view <number> --comments` and `glab mr diff <number>` for the diff.\n- **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).\n- **Comment / label / close**: `glab mr note`, `glab mr update --label`/`--unlabel`, `glab mr close`.\n\nUnlike GitHub, GitLab numbers issues and MRs separately, so `#42` is unambiguous once you know which surface the maintainer means.\n\n## When a skill says \"publish to the issue tracker\"\n\nCreate a GitLab issue.\n\n## When a skill says \"fetch the relevant ticket\"\n\nRun `glab issue view <number> --comments`.\n","isInternal":false,"tokens":606,"sizeBytes":2264},{"name":"issue-tracker-local.md","path":".agents/skills/setup-matt-pocock-skills/issue-tracker-local.md","rawUrl":"https://raw.githubusercontent.com/GreyDGL/PentestGPT/HEAD/.agents/skills/setup-matt-pocock-skills/issue-tracker-local.md","title":"Setup-matt-pocock-skills Skill","category":"anthropic-skill","format":"markdown","content":"# Issue tracker: Local Markdown\n\nIssues and PRDs for this repo live as markdown files in `.scratch/`.\n\n## Conventions\n\n- One feature per directory: `.scratch/<feature-slug>/`\n- The PRD is `.scratch/<feature-slug>/PRD.md`\n- Implementation issues are `.scratch/<feature-slug>/issues/<NN>-<slug>.md`, numbered from `01`\n- Triage state is recorded as a `Status:` line near the top of each issue file (see `triage-labels.md` for the role strings)\n- Comments and conversation history append to the bottom of the file under a `## Comments` heading\n\n## When a skill says \"publish to the issue tracker\"\n\nCreate a new file under `.scratch/<feature-slug>/` (creating the directory if needed).\n\n## When a skill says \"fetch the relevant ticket\"\n\nRead the file at the referenced path. The user will normally pass the path or the issue number directly.\n","isInternal":false,"tokens":199,"sizeBytes":838},{"name":"SKILL.md","path":".agents/skills/setup-matt-pocock-skills/SKILL.md","rawUrl":"https://raw.githubusercontent.com/GreyDGL/PentestGPT/HEAD/.agents/skills/setup-matt-pocock-skills/SKILL.md","title":"setup-matt-pocock-skills","category":"anthropic-skill","format":"markdown","content":"---\nname: setup-matt-pocock-skills\ndescription: 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.\ndisable-model-invocation: true\n---\n\n# Setup Matt Pocock's Skills\n\nScaffold the per-repo configuration that the engineering skills assume:\n\n- **Issue tracker** — where issues live (GitHub by default; local markdown is also supported out of the box)\n- **Triage labels** — the strings used for the five canonical triage roles\n- **Domain docs** — where `CONTEXT.md` and ADRs live, and the consumer rules for reading them\n\nThis is a prompt-driven skill, not a deterministic script. Explore, present what you found, confirm with the user, then write.\n\n## Process\n\n### 1. Explore\n\nLook at the current repo to understand its starting state. Read whatever exists; don't assume:\n\n- `git remote -v` and `.git/config` — is this a GitHub repo? Which one?\n- `AGENTS.md` and `CLAUDE.md` at the repo root — does either exist? Is there already an `## Agent skills` section in either?\n- `CONTEXT.md` and `CONTEXT-MAP.md` at the repo root\n- `docs/adr/` and any `src/*/docs/adr/` directories\n- `docs/agents/` — does this skill's prior output already exist?\n- `.scratch/` — sign that a local-markdown issue tracker convention is already in use\n\n### 2. Present findings and ask\n\nSummarise 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.\n\nAssume 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.\n\n**Section A — Issue tracker.**\n\n> 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.\n\nDefault 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:\n\n- **GitHub** — issues live in the repo's GitHub Issues (uses the `gh` CLI)\n- **GitLab** — issues live in the repo's GitLab Issues (uses the [`glab`](https://gitlab.com/gitlab-org/cli) CLI)\n- **Local markdown** — issues live as files under `.scratch/<feature>/` in this repo (good for solo projects or repos without a remote)\n- **Other** (Jira, Linear, etc.) — ask the user to describe the workflow in one paragraph; the skill will record it as freeform prose\n\nIf — and only if — the user picked **GitHub** or **GitLab**, ask one follow-up:\n\n> 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.\n\n- **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.\n\n**Section B — Triage label vocabulary.**\n\n> 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.\n\nThe five canonical roles:\n\n- `needs-triage` — maintainer needs to evaluate\n- `needs-info` — waiting on reporter\n- `ready-for-agent` — fully specified, AFK-ready (an agent can pick it up with no human context)\n- `ready-for-human` — needs human implementation\n- `wontfix` — will not be actioned\n\nDefault: 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.\n\n**Section C — Domain docs.**\n\n> 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.\n\nConfirm the layout:\n\n- **Single-context** — one `CONTEXT.md` + `docs/adr/` at the repo root. Most repos are this.\n- **Multi-context** — `CONTEXT-MAP.md` at the root pointing to per-context `CONTEXT.md` files (typically a monorepo).\n\n### 3. Confirm and edit\n\nShow the user a draft of:\n\n- The `## Agent skills` block to add to whichever of `CLAUDE.md` / `AGENTS.md` is being edited (see step 4 for selection rules)\n- The contents of `docs/agents/issue-tracker.md`, `docs/agents/triage-labels.md`, `docs/agents/domain.md`\n\nLet them edit before writing.\n\n### 4. Write\n\n**Pick the file to edit:**\n\n- If `CLAUDE.md` exists, edit it.\n- Else if `AGENTS.md` exists, edit it.\n- If neither exists, ask the user which one to create — don't pick for them.\n\nNever create `AGENTS.md` when `CLAUDE.md` already exists (or vice versa) — always edit the one that's already there.\n\nIf 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.\n\nThe block:\n\n```markdown\n## Agent skills\n\n### Issue tracker\n\n[one-line summary of where issues are tracked, plus whether external PRs are a triage surface]. See `docs/agents/issue-tracker.md`.\n\n### Triage labels\n\n[one-line summary of the label vocabulary]. See `docs/agents/triage-labels.md`.\n\n### Domain docs\n\n[one-line summary of layout — \"single-context\" or \"multi-context\"]. See `docs/agents/domain.md`.\n```\n\nThen write the three docs files using the seed templates in this skill folder as a starting point:\n\n- [issue-tracker-github.md](./issue-tracker-github.md) — GitHub issue tracker\n- [issue-tracker-gitlab.md](./issue-tracker-gitlab.md) — GitLab issue tracker\n- [issue-tracker-local.md](./issue-tracker-local.md) — local-markdown issue tracker\n- [triage-labels.md](./triage-labels.md) — label mapping\n- [domain.md](./domain.md) — domain doc consumer rules + layout\n\nFor \"other\" issue trackers, write `docs/agents/issue-tracker.md` from scratch using the user's description.\n\n### 5. Done\n\nTell 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.\n","frontmatter":{"name":"setup-matt-pocock-skills","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.","disable-model-invocation":true,"disableModelInvocation":true},"isInternal":false,"tokens":1784,"sizeBytes":7307},{"name":"triage-labels.md","path":".agents/skills/setup-matt-pocock-skills/triage-labels.md","rawUrl":"https://raw.githubusercontent.com/GreyDGL/PentestGPT/HEAD/.agents/skills/setup-matt-pocock-skills/triage-labels.md","title":"Setup-matt-pocock-skills Skill","category":"anthropic-skill","format":"markdown","content":"# Triage Labels\n\nThe 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.\n\n| Label in mattpocock/skills | Label in our tracker | Meaning                                  |\n| -------------------------- | -------------------- | ---------------------------------------- |\n| `needs-triage`             | `needs-triage`       | Maintainer needs to evaluate this issue  |\n| `needs-info`               | `needs-info`         | Waiting on reporter for more information |\n| `ready-for-agent`          | `ready-for-agent`    | Fully specified, ready for an AFK agent  |\n| `ready-for-human`          | `ready-for-human`    | Requires human implementation            |\n| `wontfix`                  | `wontfix`            | Will not be actioned                     |\n\nWhen a skill mentions a role (e.g. \"apply the AFK-ready triage label\"), use the corresponding label string from this table.\n\nEdit the right-hand column to match whatever vocabulary you actually use.\n","isInternal":false,"tokens":216,"sizeBytes":1045},{"name":"mocking.md","path":".agents/skills/tdd/mocking.md","rawUrl":"https://raw.githubusercontent.com/GreyDGL/PentestGPT/HEAD/.agents/skills/tdd/mocking.md","title":"Tdd Skill","category":"anthropic-skill","format":"markdown","content":"# When to Mock\n\nMock at **system boundaries** only:\n\n- External APIs (payment, email, etc.)\n- Databases (sometimes - prefer test DB)\n- Time/randomness\n- File system (sometimes)\n\nDon't mock:\n\n- Your own classes/modules\n- Internal collaborators\n- Anything you control\n\n## Designing for Mockability\n\nAt system boundaries, design interfaces that are easy to mock:\n\n**1. Use dependency injection**\n\nPass external dependencies in rather than creating them internally:\n\n```typescript\n// Easy to mock\nfunction processPayment(order, paymentClient) {\n  return paymentClient.charge(order.total);\n}\n\n// Hard to mock\nfunction processPayment(order) {\n  const client = new StripeClient(process.env.STRIPE_KEY);\n  return client.charge(order.total);\n}\n```\n\n**2. Prefer SDK-style interfaces over generic fetchers**\n\nCreate specific functions for each external operation instead of one generic function with conditional logic:\n\n```typescript\n// GOOD: Each function is independently mockable\nconst api = {\n  getUser: (id) => fetch(`/users/${id}`),\n  getOrders: (userId) => fetch(`/users/${userId}/orders`),\n  createOrder: (data) => fetch('/orders', { method: 'POST', body: data }),\n};\n\n// BAD: Mocking requires conditional logic inside the mock\nconst api = {\n  fetch: (endpoint, options) => fetch(endpoint, options),\n};\n```\n\nThe SDK approach means:\n- Each mock returns one specific shape\n- No conditional logic in test setup\n- Easier to see which endpoints a test exercises\n- Type safety per endpoint\n","isInternal":false,"tokens":331,"sizeBytes":1481},{"name":"refactoring.md","path":".agents/skills/tdd/refactoring.md","rawUrl":"https://raw.githubusercontent.com/GreyDGL/PentestGPT/HEAD/.agents/skills/tdd/refactoring.md","title":"Tdd Skill","category":"anthropic-skill","format":"markdown","content":"# Refactor Candidates\n\nAfter TDD cycle, look for:\n\n- **Duplication** → Extract function/class\n- **Long methods** → Break into private helpers (keep tests on public interface)\n- **Shallow modules** → Combine or deepen\n- **Feature envy** → Move logic to where data lives\n- **Primitive obsession** → Introduce value objects\n- **Existing code** the new code reveals as problematic\n","isInternal":false,"tokens":87,"sizeBytes":387},{"name":"SKILL.md","path":".agents/skills/tdd/SKILL.md","rawUrl":"https://raw.githubusercontent.com/GreyDGL/PentestGPT/HEAD/.agents/skills/tdd/SKILL.md","title":"tdd","category":"anthropic-skill","format":"markdown","content":"---\nname: tdd\ndescription: Test-driven development. Use when the user wants to build features or fix bugs test-first, mentions \"red-green-refactor\", or wants integration tests.\n---\n\n# Test-Driven Development\n\n## Philosophy\n\n**Core principle**: Tests should verify behavior through public interfaces, not implementation details. Code can change entirely; tests shouldn't.\n\n**Good tests** are integration-style: they exercise real code paths through public APIs. They describe _what_ the system does, not _how_ it does it. A good test reads like a specification - \"user can checkout with valid cart\" tells you exactly what capability exists. These tests survive refactors because they don't care about internal structure.\n\n**Bad tests** are coupled to implementation. They mock internal collaborators, test private methods, or verify through external means (like querying a database directly instead of using the interface). The warning sign: your test breaks when you refactor, but behavior hasn't changed. If you rename an internal function and tests fail, those tests were testing implementation, not behavior.\n\nSee [tests.md](tests.md) for examples and [mocking.md](mocking.md) for mocking guidelines.\n\n## Anti-Pattern: Horizontal Slices\n\n**DO NOT write all tests first, then all implementation.** This is \"horizontal slicing\" - treating RED as \"write all tests\" and GREEN as \"write all code.\"\n\nThis produces **crap tests**:\n\n- Tests written in bulk test _imagined_ behavior, not _actual_ behavior\n- You end up testing the _shape_ of things (data structures, function signatures) rather than user-facing behavior\n- Tests become insensitive to real changes - they pass when behavior breaks, fail when behavior is fine\n- You outrun your headlights, committing to test structure before understanding the implementation\n\n**Correct approach**: Vertical slices via tracer bullets. One test → one implementation → repeat. Each test responds to what you learned from the previous cycle. Because you just wrote the code, you know exactly what behavior matters and how to verify it.\n\n```\nWRONG (horizontal):\n  RED:   test1, test2, test3, test4, test5\n  GREEN: impl1, impl2, impl3, impl4, impl5\n\nRIGHT (vertical):\n  RED→GREEN: test1→impl1\n  RED→GREEN: test2→impl2\n  RED→GREEN: test3→impl3\n  ...\n```\n\n## Workflow\n\n### 1. Planning\n\nWhen exploring the codebase, read `CONTEXT.md` (if it exists) so that test names and interface vocabulary match the project's domain language, and respect ADRs in the area you're touching.\n\nBefore writing any code:\n\n- [ ] Confirm with user what interface changes are needed\n- [ ] Confirm with user which behaviors to test (prioritize)\n- [ ] Identify opportunities for deep modules (small interface, deep implementation) — run the `/codebase-design` skill for the vocabulary and the testability checks\n- [ ] List the behaviors to test (not implementation steps)\n- [ ] Get user approval on the plan\n\nAsk: \"What should the public interface look like? Which behaviors are most important to test?\"\n\n**You can't test everything.** Confirm with the user exactly which behaviors matter most. Focus testing effort on critical paths and complex logic, not every possible edge case.\n\n### 2. Tracer Bullet\n\nWrite ONE test that confirms ONE thing about the system:\n\n```\nRED:   Write test for first behavior → test fails\nGREEN: Write minimal code to pass → test passes\n```\n\nThis is your tracer bullet - proves the path works end-to-end.\n\n### 3. Incremental Loop\n\nFor each remaining behavior:\n\n```\nRED:   Write next test → fails\nGREEN: Minimal code to pass → passes\n```\n\nRules:\n\n- One test at a time\n- Only enough code to pass current test\n- Don't anticipate future tests\n- Keep tests focused on observable behavior\n\n### 4. Refactor\n\nAfter all tests pass, look for [refactor candidates](refactoring.md):\n\n- [ ] Extract duplication\n- [ ] Deepen modules (move complexity behind simple interfaces)\n- [ ] Apply SOLID principles where natural\n- [ ] Consider what new code reveals about existing code\n- [ ] Run tests after each refactor step\n\n**Never refactor while RED.** Get to GREEN first.\n\n## Checklist Per Cycle\n\n```\n[ ] Test describes behavior, not implementation\n[ ] Test uses public interface only\n[ ] Test would survive internal refactor\n[ ] Code is minimal for this test\n[ ] No speculative features added\n```\n","frontmatter":{"name":"tdd","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."},"isInternal":false,"tokens":958,"sizeBytes":4345},{"name":"tests.md","path":".agents/skills/tdd/tests.md","rawUrl":"https://raw.githubusercontent.com/GreyDGL/PentestGPT/HEAD/.agents/skills/tdd/tests.md","title":"Tdd Skill","category":"anthropic-skill","format":"markdown","content":"# Good and Bad Tests\n\n## Good Tests\n\n**Integration-style**: Test through real interfaces, not mocks of internal parts.\n\n```typescript\n// GOOD: Tests observable behavior\ntest(\"user can checkout with valid cart\", async () => {\n  const cart = createCart();\n  cart.add(product);\n  const result = await checkout(cart, paymentMethod);\n  expect(result.status).toBe(\"confirmed\");\n});\n```\n\nCharacteristics:\n\n- Tests behavior users/callers care about\n- Uses public API only\n- Survives internal refactors\n- Describes WHAT, not HOW\n- One logical assertion per test\n\n## Bad Tests\n\n**Implementation-detail tests**: Coupled to internal structure.\n\n```typescript\n// BAD: Tests implementation details\ntest(\"checkout calls paymentService.process\", async () => {\n  const mockPayment = jest.mock(paymentService);\n  await checkout(cart, payment);\n  expect(mockPayment.process).toHaveBeenCalledWith(cart.total);\n});\n```\n\nRed flags:\n\n- Mocking internal collaborators\n- Testing private methods\n- Asserting on call counts/order\n- Test breaks when refactoring without behavior change\n- Test name describes HOW not WHAT\n- Verifying through external means instead of interface\n\n```typescript\n// BAD: Bypasses interface to verify\ntest(\"createUser saves to database\", async () => {\n  await createUser({ name: \"Alice\" });\n  const row = await db.query(\"SELECT * FROM users WHERE name = ?\", [\"Alice\"]);\n  expect(row).toBeDefined();\n});\n\n// GOOD: Verifies through interface\ntest(\"createUser makes user retrievable\", async () => {\n  const user = await createUser({ name: \"Alice\" });\n  const retrieved = await getUser(user.id);\n  expect(retrieved.name).toBe(\"Alice\");\n});\n```\n","isInternal":false,"tokens":359,"sizeBytes":1640},{"name":"GLOSSARY-FORMAT.md","path":".agents/skills/teach/GLOSSARY-FORMAT.md","rawUrl":"https://raw.githubusercontent.com/GreyDGL/PentestGPT/HEAD/.agents/skills/teach/GLOSSARY-FORMAT.md","title":"Teach Skill","category":"anthropic-skill","format":"markdown","content":"# GLOSSARY.md Format\n\n`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.\n\n## Structure\n\n```md\n# {Topic} Glossary\n\n{One or two sentence description of the topic this glossary covers.}\n\n## Terms\n\n**Hypertrophy**:\nMuscle growth driven by mechanical tension and metabolic stress over repeated training sessions.\n_Avoid_: Bulking, getting big\n\n**Progressive overload**:\nSystematically increasing the demand on a muscle over time — via load, volume, or intensity.\n_Avoid_: Pushing harder, levelling up\n\n**RPE (Rate of Perceived Exertion)**:\nA 1–10 self-rating of how hard a set felt, where 10 is failure and 8 means two reps left in the tank.\n_Avoid_: Effort score, intensity rating\n```\n\n## Rules\n\n- **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.\n- **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.\n- **Keep definitions tight.** One or two sentences. Define what the term IS, not what it does or how to do it.\n- **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.\n- **Group under subheadings** when natural clusters emerge (e.g. `## Anatomy`, `## Programming`). A flat list is fine when terms cohere.\n- **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.\"\n- **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.\n","isInternal":false,"tokens":488,"sizeBytes":2131},{"name":"LEARNING-RECORD-FORMAT.md","path":".agents/skills/teach/LEARNING-RECORD-FORMAT.md","rawUrl":"https://raw.githubusercontent.com/GreyDGL/PentestGPT/HEAD/.agents/skills/teach/LEARNING-RECORD-FORMAT.md","title":"Teach Skill","category":"anthropic-skill","format":"markdown","content":"# Learning Record Format\n\nLearning 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.\n\nThey 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.\n\n## Template\n\n```md\n# {Short title of what was learned or established}\n\n{1-3 sentences: what was learned (or what prior knowledge was established), and why it matters for future sessions.}\n```\n\nThat 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.\n\n## Optional sections\n\nOnly include these when they add genuine value. Most records won't need them.\n\n- **Status** frontmatter (`active | superseded by LR-NNNN`) — useful when an earlier understanding turns out to be wrong and is replaced.\n- **Evidence** — how the user demonstrated the understanding (a question answered, an exercise completed, prior experience cited). Useful when the claim might be revisited.\n- **Implications** — what this unlocks or rules out for future sessions. Worth recording when non-obvious.\n\n## Numbering\n\nScan `./learning-records/` for the highest existing number and increment by one.\n\n## When to write a learning record\n\nWrite one when any of these is true:\n\n1. **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.\n2. **The user disclosed prior knowledge** — \"I already know X.\" Record it so future sessions don't re-teach it. Also record the _depth_ claimed.\n3. **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.\n4. **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.\n\n### What does _not_ qualify\n\n- Material that was merely covered. Coverage is not learning. Wait for evidence.\n- Anything already captured tersely in [[GLOSSARY.md]] as a term definition. Don't duplicate.\n- Session-by-session activity logs. Learning records are not a journal — they are decision-grade insights.\n\n## Supersession\n\nWhen 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.\n","isInternal":false,"tokens":592,"sizeBytes":2777},{"name":"MISSION-FORMAT.md","path":".agents/skills/teach/MISSION-FORMAT.md","rawUrl":"https://raw.githubusercontent.com/GreyDGL/PentestGPT/HEAD/.agents/skills/teach/MISSION-FORMAT.md","title":"Teach Skill","category":"anthropic-skill","format":"markdown","content":"# MISSION.md Format\n\n`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.\n\n## Template\n\n```md\n# Mission: {Topic}\n\n## Why\n{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.}\n\n## Success looks like\n- {A specific, observable thing the user will be able to do}\n- {Another specific thing}\n- {…}\n\n## Constraints\n- {Time, budget, prior commitments, learning preferences, anything that bounds the approach}\n\n## Out of scope\n- {Adjacent topics the user explicitly does not want to chase right now — protects the zone of proximal development}\n```\n\n## Rules\n\n- **One mission per workspace.** If the user wants to learn two unrelated things, that is two workspaces.\n- **Concrete over abstract.** \"Run a half marathon by October\" beats \"get fitter.\" \"Ship a Rust CLI to my team\" beats \"learn Rust.\"\n- **Push back on vagueness.** If the user cannot articulate why, interview them before writing anything. A bad mission is worse than no mission.\n- **Revise when reality shifts.** Missions change. When the user's goal moves, update this file — don't leave a stale mission steering future sessions.\n- **Keep it short.** If `MISSION.md` runs past a screen, it has stopped being a compass and started being a plan.\n","isInternal":false,"tokens":355,"sizeBytes":1553},{"name":"RESOURCES-FORMAT.md","path":".agents/skills/teach/RESOURCES-FORMAT.md","rawUrl":"https://raw.githubusercontent.com/GreyDGL/PentestGPT/HEAD/.agents/skills/teach/RESOURCES-FORMAT.md","title":"Teach Skill","category":"anthropic-skill","format":"markdown","content":"# RESOURCES.md Format\n\n`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.\n\n## Structure\n\n```md\n# {Topic} Resources\n\n## Knowledge\n\n- [Book: _The Science and Practice of Strength Training_ — Zatsiorsky & Kraemer](https://example.com)\n  Foundational text on programming and adaptation. Use for: anything to do with periodisation, recovery, intensity zones.\n- [Article: \"How Much Should I Train?\" — Greg Nuckols (Stronger By Science)](https://example.com)\n  Evidence-based review of volume landmarks. Use for: weekly set targets per muscle group.\n\n## Wisdom (Communities)\n\n- [r/weightroom](https://reddit.com/r/weightroom)\n  High-signal subreddit, moderated against bro-science. Use for: programme critique, plateau troubleshooting.\n- Local: Tuesday strength class at {gym name}\n  Use for: real-time coaching feedback on lifts.\n```\n\n## Rules\n\n- **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.\n- **Annotate every entry.** A bare link is useless in three months. Add one line: what it covers and when to reach for it.\n- **Group by Knowledge / Wisdom.** Mirrors the philosophy in [SKILL.md](./SKILL.md). It is fine for a resource to appear in only one group.\n- **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.\n- **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.\n- **Record community preferences.** If the user has opted out of joining communities, note it here so future sessions don't keep proposing them.\n","isInternal":false,"tokens":441,"sizeBytes":1926},{"name":"SKILL.md","path":".agents/skills/teach/SKILL.md","rawUrl":"https://raw.githubusercontent.com/GreyDGL/PentestGPT/HEAD/.agents/skills/teach/SKILL.md","title":"teach","category":"anthropic-skill","format":"markdown","content":"---\nname: teach\ndescription: Teach the user a new skill or concept, within this workspace.\ndisable-model-invocation: true\nargument-hint: \"What would you like to learn about?\"\n---\n\nThe user has asked you to teach them something. This is a stateful request - they intend to learn the topic over multiple sessions.\n\n## Teaching Workspace\n\nTreat the current directory as a teaching workspace. The state of their learning is captured in this directory in several files:\n\n- `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).\n- `./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.\n- `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).\n- `./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).\n- `./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.\n- `./assets/*`: Reusable **components** shared across lessons. See [Assets](#assets).\n- `NOTES.md`: A scratchpad for you to jot down user preferences, or working notes.\n\n## Philosophy\n\nTo learn at a deep level, the user needs three things:\n\n- **Knowledge**, captured from high-quality, high-trust resources\n- **Skills**, acquired through highly-relevant interactive lessons devised by you, based on the knowledge\n- **Wisdom**, which comes from interacting with other learners and practitioners\n\nBefore 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.\n\nSome topics may require more skills than knowledge. Learning more about theoretical physics might be more knowledge-based. For yoga, more skills-based.\n\n### Fluency vs Storage Strength\n\nYou should be careful to split between two types of learning:\n\n- **Fluency strength**: in-the-moment retrieval of knowledge\n- **Storage strength**: long-term retention of knowledge\n\nFluency 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:\n\n- Using retrieval practice (recall from memory)\n- Spacing (distributing practice over time)\n- Interleaving (mixing up different but related topics in practice - for skills practice only)\n\n## Lessons\n\nA 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.\n\nA lesson should be **beautiful** — clean, readable typography and layout — since the user will return to these later to review. Think Tufte.\n\nThe 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.\n\nIf possible, open the lesson file for the user by running a CLI command.\n\nEach lesson should link via HTML anchors to other lessons and reference documents.\n\nEach 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.\n\nEach 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.\n\n## Assets\n\nLessons are built from reusable **components**, stored in `./assets/`: stylesheets, quiz widgets, simulators, diagram helpers — anything a second lesson could reuse.\n\nReuse 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.\n\nA 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.\n\n## The Mission\n\nEvery lesson should be tied into the mission - the reason that the user is interested in learning about the topic.\n\nIf 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.\n\nFailing 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.\n\nMissions 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.\n\n## Zone Of Proximal Development\n\nEach lesson, the user should always feel as if they are being challenged 'just enough'.\n\nThe user may specify an exact thing they want to learn. If they don't, figure out their zone of proximal development by:\n\n- Reading their `learning-records`\n- Figuring out the right thing to teach them based on their mission\n- Teach the most relevant thing that fits in their zone of proximal development\n\n## Knowledge\n\nLessons 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.\n\nKnowledge 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.\n\nFor acquiring knowledge, difficulty is the enemy. It eats working memory you need for understanding.\n\n## Skills\n\nIf knowledge is all about acquisition, skills are about durability and flexibility. Make the knowledge stick.\n\nFor 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:\n\n- Interactive lessons, using quizzes and light in-browser tasks\n- Lessons which guide the user through a list of real-world steps to take (for instance, yoga poses)\n\nEach 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.\n\nFor 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.\n\n## Acquiring Wisdom\n\nWisdom comes from true real-world interaction - testing your skills outside the learning environment.\n\nWhen 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**.\n\nA 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.\n\nYou 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.\n\n## Reference Documents\n\nWhile 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.\n\nLessons 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.\n\nSome learning topics lend themselves to reference:\n\n- Syntax and code snippets for programming\n- Algorithms and flowcharts for processes\n- Yoga poses and sequences for yoga\n- Exercises and routines for fitness\n- Glossaries for any topic with its own nomenclature\n\nGlossaries, in particular, are an essential reference. Once one is created, it should be adhered to in every lesson.\n\n## `NOTES.md`\n\nThe 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.\n","frontmatter":{"name":"teach","description":"Teach the user a new skill or concept, within this workspace.","disable-model-invocation":true,"argument-hint":"What would you like to learn about?","disableModelInvocation":true},"isInternal":false,"tokens":1951,"sizeBytes":9507},{"name":"SKILL.md","path":".agents/skills/to-issues/SKILL.md","rawUrl":"https://raw.githubusercontent.com/GreyDGL/PentestGPT/HEAD/.agents/skills/to-issues/SKILL.md","title":"to-issues","category":"anthropic-skill","format":"markdown","content":"---\nname: to-issues\ndescription: Break a plan, spec, or PRD into independently-grabbable issues on the project issue tracker using tracer-bullet vertical slices.\ndisable-model-invocation: true\n---\n\n# To Issues\n\nBreak a plan into independently-grabbable issues using vertical slices (tracer bullets).\n\nThe issue tracker and triage label vocabulary should have been provided to you — run `/setup-matt-pocock-skills` if not.\n\n## Process\n\n### 1. Gather context\n\nWork 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.\n\n### 2. Explore the codebase (optional)\n\nIf 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.\n\nLook for opportunities to prefactor the code to make the implementation easier. \"Make the change easy, then make the easy change.\"\n\n### 3. Draft vertical slices\n\nBreak 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.\n\n<vertical-slice-rules>\n\n- Each slice delivers a narrow but COMPLETE path through every layer (schema, API, UI, tests)\n- A completed slice is demoable or verifiable on its own\n- Any prefactoring should be done first\n\n</vertical-slice-rules>\n\n### 4. Quiz the user\n\nPresent the proposed breakdown as a numbered list. For each slice, show:\n\n- **Title**: short descriptive name\n- **Blocked by**: which other slices (if any) must complete first\n- **User stories covered**: which user stories this addresses (if the source material has them)\n\nAsk the user:\n\n- Does the granularity feel right? (too coarse / too fine)\n- Are the dependency relationships correct?\n- Should any slices be merged or split further?\n\nIterate until the user approves the breakdown.\n\n### 5. Publish the issues to the issue tracker\n\nFor 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.\n\nPublish issues in dependency order (blockers first) so you can reference real issue identifiers in the \"Blocked by\" field.\n\n<issue-template>\n## Parent\n\nA reference to the parent issue on the issue tracker (if the source was an existing issue, otherwise omit this section).\n\n## What to build\n\nA concise description of this vertical slice. Describe the end-to-end behavior, not layer-by-layer implementation.\n\nAvoid 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.\n\n## Acceptance criteria\n\n- [ ] Criterion 1\n- [ ] Criterion 2\n- [ ] Criterion 3\n\n## Blocked by\n\n- A reference to the blocking ticket (if any)\n\nOr \"None - can start immediately\" if no blockers.\n\n</issue-template>\n\nDo NOT close or modify any parent issue.\n","frontmatter":{"name":"to-issues","description":"Break a plan, spec, or PRD into independently-grabbable issues on the project issue tracker using tracer-bullet vertical slices.","disable-model-invocation":true,"disableModelInvocation":true},"isInternal":false,"tokens":718,"sizeBytes":3319},{"name":"SKILL.md","path":".agents/skills/to-prd/SKILL.md","rawUrl":"https://raw.githubusercontent.com/GreyDGL/PentestGPT/HEAD/.agents/skills/to-prd/SKILL.md","title":"to-prd","category":"anthropic-skill","format":"markdown","content":"---\nname: to-prd\ndescription: 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.\ndisable-model-invocation: true\n---\n\nThis skill takes the current conversation context and codebase understanding and produces a PRD. Do NOT interview the user — just synthesize what you already know.\n\nThe issue tracker and triage label vocabulary should have been provided to you — run `/setup-matt-pocock-skills` if not.\n\n## Process\n\n1. 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.\n\n2. 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.\n\nCheck with the user that these seams match their expectations.\n\n3. 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.\n\n<prd-template>\n\n## Problem Statement\n\nThe problem that the user is facing, from the user's perspective.\n\n## Solution\n\nThe solution to the problem, from the user's perspective.\n\n## User Stories\n\nA LONG, numbered list of user stories. Each user story should be in the format of:\n\n1. As an <actor>, I want a <feature>, so that <benefit>\n\n<user-story-example>\n1. As a mobile bank customer, I want to see balance on my accounts, so that I can make better informed decisions about my spending\n</user-story-example>\n\nThis list of user stories should be extremely extensive and cover all aspects of the feature.\n\n## Implementation Decisions\n\nA list of implementation decisions that were made. This can include:\n\n- The modules that will be built/modified\n- The interfaces of those modules that will be modified\n- Technical clarifications from the developer\n- Architectural decisions\n- Schema changes\n- API contracts\n- Specific interactions\n\nDo NOT include specific file paths or code snippets. They may end up being outdated very quickly.\n\nException: 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.\n\n## Testing Decisions\n\nA list of testing decisions that were made. Include:\n\n- A description of what makes a good test (only test external behavior, not implementation details)\n- Which modules will be tested\n- Prior art for the tests (i.e. similar types of tests in the codebase)\n\n## Out of Scope\n\nA description of the things that are out of scope for this PRD.\n\n## Further Notes\n\nAny further notes about the feature.\n\n</prd-template>\n","frontmatter":{"name":"to-prd","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.","disable-model-invocation":true,"disableModelInvocation":true},"isInternal":false,"tokens":644,"sizeBytes":3027},{"name":"AGENT-BRIEF.md","path":".agents/skills/triage/AGENT-BRIEF.md","rawUrl":"https://raw.githubusercontent.com/GreyDGL/PentestGPT/HEAD/.agents/skills/triage/AGENT-BRIEF.md","title":"Triage Skill","category":"anthropic-skill","format":"markdown","content":"# Writing Agent Briefs\n\nAn 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.\n\nThe 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.\n\n## Principles\n\n### Durability over precision\n\nThe 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.\n\n- **Do** describe interfaces, types, and behavioral contracts\n- **Do** name specific types, function signatures, or config shapes that the agent should look for or modify\n- **Don't** reference file paths — they go stale\n- **Don't** reference line numbers\n- **Don't** assume the current implementation structure will remain the same\n\n### Behavioral, not procedural\n\nDescribe **what** the system should do, not **how** to implement it. The agent will explore the codebase fresh and make its own implementation decisions.\n\n- **Good:** \"The `SkillConfig` type should accept an optional `schedule` field of type `CronExpression`\"\n- **Bad:** \"Open src/types/skill.ts and add a schedule field on line 42\"\n- **Good:** \"When a user runs `/triage` with no arguments, they should see a summary of issues needing attention\"\n- **Bad:** \"Add a switch statement in the main handler function\"\n\n### Complete acceptance criteria\n\nThe agent needs to know when it's done. Every agent brief must have concrete, testable acceptance criteria. Each criterion should be independently verifiable.\n\n- **Good:** \"Running `gh issue list --label needs-triage` returns issues that have been through initial classification\"\n- **Bad:** \"Triage should work correctly\"\n\n### Explicit scope boundaries\n\nState what is out of scope. This prevents the agent from gold-plating or making assumptions about adjacent features.\n\n## Template\n\n```markdown\n## Agent Brief\n\n**Category:** bug / enhancement\n**Summary:** one-line description of what needs to happen\n\n**Current behavior:**\nDescribe what happens now. For bugs, this is the broken behavior.\nFor enhancements, this is the status quo the feature builds on.\n\n**Desired behavior:**\nDescribe what should happen after the agent's work is complete.\nBe specific about edge cases and error conditions.\n\n**Key interfaces:**\n- `TypeName` — what needs to change and why\n- `functionName()` return type — what it currently returns vs what it should return\n- Config shape — any new configuration options needed\n\n**Acceptance criteria:**\n- [ ] Specific, testable criterion 1\n- [ ] Specific, testable criterion 2\n- [ ] Specific, testable criterion 3\n\n**Out of scope:**\n- Thing that should NOT be changed or addressed in this issue\n- Adjacent feature that might seem related but is separate\n```\n\n## Examples\n\n### Good agent brief (bug)\n\n```markdown\n## Agent Brief\n\n**Category:** bug\n**Summary:** Skill description truncation drops mid-word, producing broken output\n\n**Current behavior:**\nWhen a skill description exceeds 1024 characters, it is truncated at exactly\n1024 characters regardless of word boundaries. This produces descriptions\nthat end mid-word (e.g. \"Use when the user wants to confi\").\n\n**Desired behavior:**\nTruncation should break at the last word boundary before 1024 characters\nand append \"...\" to indicate truncation.\n\n**Key interfaces:**\n- The `SkillMetadata` type's `description` field — no type change needed,\n  but the validation/processing logic that populates it needs to respect\n  word boundaries\n- Any function that reads SKILL.md frontmatter and extracts the description\n\n**Acceptance criteria:**\n- [ ] Descriptions under 1024 chars are unchanged\n- [ ] Descriptions over 1024 chars are truncated at the last word boundary\n      before 1024 chars\n- [ ] Truncated descriptions end with \"...\"\n- [ ] The total length including \"...\" does not exceed 1024 chars\n\n**Out of scope:**\n- Changing the 1024 char limit itself\n- Multi-line description support\n```\n\n### Good agent brief (enhancement)\n\n```markdown\n## Agent Brief\n\n**Category:** enhancement\n**Summary:** Add `.out-of-scope/` directory support for tracking rejected feature requests\n\n**Current behavior:**\nWhen a feature request is rejected, the issue is closed with a `wontfix` label\nand a comment. There is no persistent record of the decision or reasoning.\nFuture similar requests require the maintainer to recall or search for the\nprior discussion.\n\n**Desired behavior:**\nRejected feature requests should be documented in `.out-of-scope/<concept>.md`\nfiles that capture the decision, reasoning, and links to all issues that\nrequested the feature. When triaging new issues, these files should be\nchecked for matches.\n\n**Key interfaces:**\n- Markdown file format in `.out-of-scope/` — each file should have a\n  `# Concept Name` heading, a `**Decision:**` line, a `**Reason:**` line,\n  and a `**Prior requests:**` list with issue links\n- The triage workflow should read all `.out-of-scope/*.md` files early\n  and match incoming issues against them by concept similarity\n\n**Acceptance criteria:**\n- [ ] Closing a feature as wontfix creates/updates a file in `.out-of-scope/`\n- [ ] The file includes the decision, reasoning, and link to the closed issue\n- [ ] If a matching `.out-of-scope/` file already exists, the new issue is\n      appended to its \"Prior requests\" list rather than creating a duplicate\n- [ ] During triage, existing `.out-of-scope/` files are checked and surfaced\n      when a new issue matches a prior rejection\n\n**Out of scope:**\n- Automated matching (human confirms the match)\n- Reopening previously rejected features\n- Bug reports (only enhancement rejections go to `.out-of-scope/`)\n```\n\n### Good agent brief (PR)\n\nFor 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.\n\n```markdown\n## Agent Brief\n\n**Category:** enhancement\n**Summary:** Finish the contributor's `--json` output flag for `triage list`\n\n**Current behavior:**\nThe PR adds a `--json` flag that serializes the issue list to JSON. The happy\npath works and the diff matches the project's command structure. Two gaps\nremain: errors are still printed as human text (not JSON), and the new flag has\nno test coverage.\n\n**Desired behavior:**\nWith `--json`, all output — including errors — is well-formed JSON on stdout,\nand the command's exit codes are unchanged. The existing human-readable output\nis untouched when the flag is absent.\n\n**Key interfaces:**\n- The command's error path should emit `{ \"error\": string }` under `--json`\n  instead of the plain-text error\n- Reuse the existing serializer the PR already added; don't introduce a second\n\n**Acceptance criteria:**\n- [ ] `triage list --json` emits valid JSON for both success and error cases\n- [ ] Exit codes match the non-JSON command\n- [ ] A test covers the `--json` success output and one error case\n- [ ] Default (non-JSON) output is byte-for-byte unchanged\n\n**Out of scope:**\n- Adding `--json` to any other command\n- Changing the JSON shape of the success payload the PR already defined\n```\n\n### Bad agent brief\n\n```markdown\n## Agent Brief\n\n**Summary:** Fix the triage bug\n\n**What to do:**\nThe triage thing is broken. Look at the main file and fix it.\nThe function around line 150 has the issue.\n\n**Files to change:**\n- src/triage/handler.ts (line 150)\n- src/types.ts (line 42)\n```\n\nThis is bad because:\n- No category\n- Vague description (\"the triage thing is broken\")\n- References file paths and line numbers that will go stale\n- No acceptance criteria\n- No scope boundaries\n- No description of current vs desired behavior\n","isInternal":false,"tokens":1825,"sizeBytes":7972},{"name":"OUT-OF-SCOPE.md","path":".agents/skills/triage/OUT-OF-SCOPE.md","rawUrl":"https://raw.githubusercontent.com/GreyDGL/PentestGPT/HEAD/.agents/skills/triage/OUT-OF-SCOPE.md","title":"Triage Skill","category":"anthropic-skill","format":"markdown","content":"# Out-of-Scope Knowledge Base\n\nThe `.out-of-scope/` directory in a repo stores persistent records of rejected feature requests. It serves two purposes:\n\n1. **Institutional memory** — why a feature was rejected, so the reasoning isn't lost when the issue is closed\n2. **Deduplication** — when a new issue comes in that matches a prior rejection, the skill can surface the previous decision instead of re-litigating it\n\n## Directory structure\n\n```\n.out-of-scope/\n├── dark-mode.md\n├── plugin-system.md\n└── graphql-api.md\n```\n\nOne file per **concept**, not per issue. Multiple issues requesting the same thing are grouped under one file.\n\n## File format\n\nThe 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.\n\n```markdown\n# Dark Mode\n\nThis project does not support dark mode or user-facing theming.\n\n## Why this is out of scope\n\nThe rendering pipeline assumes a single color palette defined in\n`ThemeConfig`. Supporting multiple themes would require:\n\n- A theme context provider wrapping the entire component tree\n- Per-component theme-aware style resolution\n- A persistence layer for user theme preferences\n\nThis is a significant architectural change that doesn't align with the\nproject's focus on content authoring. Theming is a concern for downstream\nconsumers who embed or redistribute the output.\n\n```ts\n// The current ThemeConfig interface is not designed for runtime switching:\ninterface ThemeConfig {\n  colors: ColorPalette; // single palette, resolved at build time\n  fonts: FontStack;\n}\n```\n\n## Prior requests\n\n- #42 — \"Add dark mode support\"\n- #87 — \"Night theme for accessibility\"\n- #134 — \"Dark theme option\"\n```\n\n### Naming the file\n\nUse 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.\n\n### Writing the reason\n\nThe reason should be substantive — not \"we don't want this\" but why. Good reasons reference:\n\n- Project scope or philosophy (\"This project focuses on X; theming is a downstream concern\")\n- Technical constraints (\"Supporting this would require Y, which conflicts with our Z architecture\")\n- Strategic decisions (\"We chose to use A instead of B because...\")\n\nThe reason should be durable. Avoid referencing temporary circumstances (\"we're too busy right now\") — those aren't real rejections, they're deferrals.\n\n## When to check `.out-of-scope/`\n\nDuring triage (Step 1: Gather context), read all files in `.out-of-scope/`. When evaluating a new issue:\n\n- Check if the request matches an existing out-of-scope concept\n- Matching is by concept similarity, not keyword — \"night theme\" matches `dark-mode.md`\n- 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?\"\n\nThe maintainer may:\n\n- **Confirm** — the new issue gets added to the existing file's \"Prior requests\" list, then closed\n- **Reconsider** — the out-of-scope file gets deleted or updated, and the issue proceeds through normal triage\n- **Disagree** — the issues are related but distinct, proceed with normal triage\n\n## When to write to `.out-of-scope/`\n\nOnly 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.\n\nDo **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.\n\nThe flow:\n\n1. Maintainer decides a feature request is out of scope\n2. Check if a matching `.out-of-scope/` file already exists\n3. If yes: append the new issue to the \"Prior requests\" list\n4. If no: create a new file with the concept name, decision, reason, and first prior request\n5. Post a comment on the issue explaining the decision and mentioning the `.out-of-scope/` file\n6. Close the issue with the `wontfix` label\n\n## Updating or removing out-of-scope files\n\nIf the maintainer changes their mind about a previously rejected concept:\n\n- Delete the `.out-of-scope/` file\n- The skill does not need to reopen old issues — they're historical records\n- The new issue that triggered the reconsideration proceeds through normal triage\n","isInternal":false,"tokens":1054,"sizeBytes":4712},{"name":"SKILL.md","path":".agents/skills/triage/SKILL.md","rawUrl":"https://raw.githubusercontent.com/GreyDGL/PentestGPT/HEAD/.agents/skills/triage/SKILL.md","title":"triage","category":"anthropic-skill","format":"markdown","content":"---\nname: triage\ndescription: Move issues and external PRs through a state machine of triage roles — categorise, verify, grill if needed, and write agent-ready briefs.\ndisable-model-invocation: true\n---\n\n# Triage\n\nMove issues on the project issue tracker through a small state machine of triage roles.\n\nIf this repo treats external pull requests as a request surface (see the issue-tracker config), triage covers them too: **a PR is an issue with attached code** — same roles, same states, same machine, with a few deltas marked \"for a PR\" below. Resolve a bare `#42` to an issue or PR per the tracker config.\n\nEvery comment or issue posted to the issue tracker during triage **must** start with this disclaimer:\n\n```\n> *This was generated by AI during triage.*\n```\n\n## Reference docs\n\n- [AGENT-BRIEF.md](AGENT-BRIEF.md) — how to write durable agent briefs\n- [OUT-OF-SCOPE.md](OUT-OF-SCOPE.md) — how the `.out-of-scope/` knowledge base works\n\n## Roles\n\nTwo **category** roles:\n\n- `bug` — something is broken\n- `enhancement` — new feature or improvement\n\nFive **state** roles:\n\n- `needs-triage` — maintainer needs to evaluate\n- `needs-info` — waiting on reporter for more information\n- `ready-for-agent` — fully specified, ready for an AFK agent\n- `ready-for-human` — needs human implementation\n- `wontfix` — will not be actioned\n\nFor a PR, the same states read against the attached code: `ready-for-agent` means a brief is attached and an agent should take the next step on the diff; `ready-for-human` means it's ready for a human to merge.\n\nEvery triaged issue should carry exactly one category role and one state role. If state roles conflict, flag it and ask the maintainer before doing anything else.\n\nThese are canonical role names — the actual label strings used in the issue tracker may differ. The mapping should have been provided to you - run `/setup-matt-pocock-skills` if not.\n\nState transitions: an unlabeled issue normally goes to `needs-triage` first; from there it moves to `needs-info`, `ready-for-agent`, `ready-for-human`, or `wontfix`. `needs-info` returns to `needs-triage` once the reporter replies. The maintainer can override at any time — flag transitions that look unusual and ask before proceeding.\n\n## Invocation\n\nThe maintainer invokes `/triage` and describes what they want in natural language. Interpret the request and act. Examples:\n\n- \"Show me anything that needs my attention\"\n- \"Let's look at #42\" (issue or PR)\n- \"Move #42 to ready-for-agent\"\n- \"What's ready for agents to pick up?\"\n\n## Show what needs attention\n\nQuery the issue tracker and present three buckets, oldest first:\n\n1. **Unlabeled** — never triaged.\n2. **`needs-triage`** — evaluation in progress.\n3. **`needs-info` with reporter activity since the last triage notes** — needs re-evaluation.\n\nWhen PRs are in scope, include external PRs in these buckets and tag each line `[PR]` or `[issue]`. Discovery surfaces only *external* PRs (the tracker config defines who counts as external) — a collaborator's in-flight PR is not triage work. This filter is discovery-only; an explicitly named PR is always triaged regardless of author.\n\nShow counts and a one-line summary per item. Let the maintainer pick.\n\n## Triage a specific issue or PR\n\n1. **Gather context.** Read the full issue or PR (body, comments, labels, author, dates; for a PR, the diff too). Parse any prior triage notes so you don't re-ask resolved questions. Explore the codebase using the project's domain glossary, respecting ADRs in the area. Run two checks against the codebase: (a) **redundancy** — search for an existing implementation of the requested behavior by domain concept (not just the request's wording), and report where you looked. If found, it's an already-implemented `wontfix` (step 5). (b) **prior rejection** — read `.out-of-scope/*.md` and surface any that resembles this request.\n\n2. **Recommend.** Tell the maintainer your category and state recommendation with reasoning, plus a brief codebase summary relevant to the request — including whether it's already implemented. Wait for direction.\n\n3. **Verify the claim.** Before any grilling, check that the claim holds up. For a bug, reproduce it from the reporter's steps. For a PR, confirm the diff does what it claims — check it out, run the relevant tests or commands. Report what happened: confirmed (with code path), failed, or insufficient detail (a strong `needs-info` signal). A confirmed verification makes a much stronger agent brief.\n\n4. **Grill (if needed).** If the request needs fleshing out, run the `/grilling` and `/domain-modeling` skills together — grill it into shape one question at a time, sharpening domain terms and updating `CONTEXT.md`/ADRs inline as decisions land.\n\n5. **Apply the outcome:**\n   - `ready-for-agent` — post an agent brief comment ([AGENT-BRIEF.md](AGENT-BRIEF.md)).\n   - `ready-for-human` — same structure as an agent brief, but note why it can't be delegated (judgment calls, external access, design decisions, manual testing).\n   - `needs-info` — post triage notes (template below).\n   - `wontfix` — close, with the comment depending on *why*:\n     - **Already implemented** — the change already exists in the codebase. Point to where it lives; do **not** write to `.out-of-scope/` (that KB is for *rejected* requests, not built ones).\n     - **Rejected (bug)** — polite explanation, then close.\n     - **Rejected (enhancement)** — write to `.out-of-scope/`, link to it from a comment, then close ([OUT-OF-SCOPE.md](OUT-OF-SCOPE.md)).\n   - `needs-triage` — apply the role. Optional comment if there's partial progress.\n\n## Quick state override\n\nIf the maintainer says \"move #42 to ready-for-agent\", trust them and apply the role directly. Confirm what you're about to do (role changes, comment, close), then act. Skip grilling. If moving to `ready-for-agent` without a grilling session, ask whether they want to write an agent brief.\n\n## Needs-info template\n\n```markdown\n## Triage Notes\n\n**What we've established so far:**\n\n- point 1\n- point 2\n\n**What we still need from you (@reporter):**\n\n- question 1\n- question 2\n```\n\nCapture everything resolved during grilling under \"established so far\" so the work isn't lost. Questions must be specific and actionable, not \"please provide more info\".\n\n## Resuming a previous session\n\nIf prior triage notes exist on the issue or PR, read them, check whether the reporter has answered any outstanding questions, and present an updated picture before continuing. Don't re-ask resolved questions.\n","frontmatter":{"name":"triage","description":"Move issues and external PRs through a state machine of triage roles — categorise, verify, grill if needed, and write agent-ready briefs.","disable-model-invocation":true,"disableModelInvocation":true},"isInternal":false,"tokens":1570,"sizeBytes":6574},{"name":"GLOSSARY.md","path":".agents/skills/writing-great-skills/GLOSSARY.md","rawUrl":"https://raw.githubusercontent.com/GreyDGL/PentestGPT/HEAD/.agents/skills/writing-great-skills/GLOSSARY.md","title":"Writing-great-skills Skill","category":"anthropic-skill","format":"markdown","content":"# Glossary — Building Great Skills\n\nThe domain model for what makes a skill great. A skill exists to wrangle determinism out of a stochastic system; the root virtue is **Predictability**, and every term below is a lever on it. This is the disclosed reference for [`writing-great-skills`](SKILL.md).\n\nThe terms are grouped by axis: **Invocation** (how a skill is reached), **Information Hierarchy** (how its content is arranged), **Steering** (how the agent's runtime behaviour is shaped), and **Pruning** (how it is kept lean). Each **failure mode** lives beside the lever that cures it, tagged _failure mode_.\n\n**Bold terms** in any definition are themselves defined in this glossary; find them by their heading.\n\n## Predictability\n\nThe degree to which a skill makes the agent behave the same _way_ on every run — the same process, not the same output (a brainstorming skill should _predictably_ diverge; its tokens vary, its behaviour doesn't). The root virtue every other term serves — cost and maintainability are symptoms of it, not rivals.\n\n_Avoid_: consistency, reliability, robustness, output-determinism\n\n## Invocation\n\nHow a skill is reached — and the two loads you pay for the choice.\n\n### Model-Invoked\n\nA skill that keeps its **description** field, so the agent can see it and fire it autonomously — and the human can still type its name, so model-invocation always _includes_ user reach. There is no model-only state: a description only ever _adds_ agent discovery, never removes the human's. Pays a permanent **context load** on every turn in exchange for that discoverability. Reachable by other skills, because the description that makes it agent-discoverable makes it invocable. A model-invoked skill whose content is all **reference** is also one home for shared reference: another skill can invoke it, so reference needed by several skills lives in one place. Pick model-invocation only when the agent must reach the skill on its own; if it never fires except by hand, drop the description and pay no context load.\n\n_Avoid_: ability, tool, capability\n\n### User-Invoked\n\nA skill with its **description** stripped — invisible to the agent and reachable only by the human typing its name (user-_only_, where **model-invoked** is user-_and-agent_). Trades agent-discoverability for zero **context load**. Because it has no description, nothing but the human can reach it: no other skill can fire it.\n\n_Avoid_: procedure, workflow, command\n\n### Description\n\nThe skill's machine-readable trigger, and the one **context pointer** a **model-invoked** skill is forced to keep loaded at all times. Its mere presence _is_ the invocation axis: keep it and the skill is model-invoked (and reachable by other skills); delete it and the skill is **user-invoked**, reachable only by the human. The source of a model-invoked skill's **context load**.\n\n_Avoid_: frontmatter, summary\n\n### Context Pointer\n\nA reference held in the agent's context that names some out-of-context material and encodes the condition for reaching it. The **description** is the top-level context pointer (context window → skill); pointers to disclosed files are the same object one level down. Its wording, not the target, decides _when_ the agent reaches — and _how reliably_. A must-have target behind a weakly worded pointer is a variance bug: fix the wording first, and inline the material only if sharpening fails.\n\n_Avoid_: link, reference, import\n\n### Context Load\n\nThe cost a **model-invoked** skill imposes on the agent's context window — its **description**, always loaded, spending both tokens and attention. What **user-invoked** skills escape by having no description, and the brake on splitting into more model-invoked skills.\n\n_Avoid_: token cost, context bloat\n\n### Cognitive Load\n\nThe cost a **user-invoked** skill imposes on the human — what they must hold in their head: which skills exist and when to reach for each (the human is the index). What **model-invocation** removes by being agent-discoverable, and the brake on splitting into more user-invoked skills. Not a cost to minimise: it is the price of human agency, the reason some skills stay user-invoked. Spend it where human judgement matters; remove it where it does not.\n\n_Avoid_: human index, burden, overhead\n\n### Router Skill\n\nA **user-invoked** skill whose job is to point at your other user-invoked skills — naming each and when to reach for it — so the human has one skill to remember instead of many. It can only hint, never fire them: user-invoked skills have no **description**, so nothing but the human can reach them. The cure for **cognitive load** when user-invoked skills multiply.\n\n_Avoid_: dispatcher, menu, registry, index, router procedure\n\n### Granularity\n\nHow finely you divide skills. Finer division spends one of the two loads: more **model-invoked** skills spend **context load** (more descriptions crowding the window and competing for attention); more **user-invoked** skills spend **cognitive load** (more for the human to remember and reach for). Two cuts guide the division. By **invocation**, split off a model-invoked skill where you have a distinct **leading word** to trigger it — a trigger word you actually use in your prompts. By **sequence**, split a run of **steps** where a step's **post-completion steps** need hiding, since isolating it in its own context clears what follows. Beware the reverse: merging sequences exposes each step's post-completion steps to what follows, inviting premature completion.\n\n_Avoid_: chunking, modularity\n\n## Information Hierarchy\n\nHow a skill's content is arranged, and how far down the ladder each piece sits.\n\n### Information Hierarchy\n\nA skill's content ranked by how immediately the agent needs it — a single ladder, produced by two cuts: in-file or behind a pointer, and step or reference. The rungs:\n\n- **Steps** — in-file, primary\n- **Reference**, in-file — secondary\n- **Reference**, disclosed — behind a **context pointer**\n\nA skill with no **steps** uses just the bottom two rungs — often a legitimately flat peer-set (e.g. every rule of a review on one rung), which is a fine arrangement, not a smell. The hierarchy is independent of invocation: a skill can be model- or user-invoked whether it is all steps, all reference, or both. When a skill has steps, in-file reference that should be disclosed buries them and turns attending to them into a coin-flip — a variance lever, not just a legibility one. Keep the top of the ladder legible; push down it whatever you can.\n\n_Avoid_: structure, organization, layout\n\n### Steps\n\nThe ordered actions the agent performs — when a skill has them, the primary tier of its content, and the part that earns its place in SKILL.md. Not every skill has steps: a skill can be all steps (`tdd`), all **reference** (a review), or both, independent of invocation. Every step ends on a **completion criterion**, clear or vague.\n\n_Avoid_: workflow, instructions, choreography\n\n### Reference\n\nMaterial the agent refers to on demand — definitions, facts, parameters, examples, conditional instructions. When a skill has **steps** it is secondary to them; when a skill has none it is the entire content; or it lives outside any skill entirely — see **External Reference**. Reached via **context pointers**, and the prime candidate for **progressive disclosure**.\n\n_Avoid_: supporting material, docs, background\n\n### External Reference\n\n**Reference** that lives outside the skill system — a plain file, no **description**, no **steps**, not invocable — that any skill can point at. The home for shared reference that needn't fire on its own, and the only shared home two **user-invoked** skills can use, since neither has a description and so neither can fire the other.\n\n_Avoid_: doc, resource, knowledge base\n\n### Progressive Disclosure\n\nMoving **reference** down the ladder — out of SKILL.md and behind a **context pointer** — so the top stays legible. Not primarily a token optimisation; it is how the **information hierarchy** is protected. Licensed by **branching**: disclose what only some branches need, inline what every path needs, and if a pointer fires unreliably on must-have material, sharpen its wording, and pull it back inline only if that fails.\n\n_Avoid_: lazy loading, chunking\n\n### Co-location\n\nKeeping the material an agent needs at once in one place — a concept's definition, rules, and caveats under a single heading, not scattered across the file — so reading one part brings its neighbours with it. The within-file companion to the **Information Hierarchy**: the hierarchy ranks _how far down_ a piece sits; co-location decides _what sits beside it_ once there. There is no formula for the right format of a body of **reference**; the test is that a skill should read like documentation written for the agent, and grouped material reads that way where scattered material does not. Distinct from **Duplication**: that repeats one meaning in two places, where scattering fragments a single meaning across many.\n\n_Avoid_: grouping, clustering, cohesion\n\n### Sprawl\n\n_Failure mode._ A skill that is simply too long — too many lines in SKILL.md — independent of whether they are stale or repeated. Even an all-live, all-unique skill can sprawl. It costs readability (the agent wades through more before it can act, and attention thins across the excess), maintainability (every extra line is one more to keep **relevant**), and tokens. The cure is the **information hierarchy**: push **reference** down behind **context pointers**, and split by **branch** or sequence so each path carries only what it needs. Distinct from **sediment** (length from stale accumulation) and **duplication** (length from repeated meaning) — sprawl is length itself, whatever its cause.\n\n_Avoid_: bloat, length, size, verbosity\n\n## Steering\n\nThe levers that shape the agent's runtime behaviour toward **Predictability**.\n\n### Branch\n\nA distinct way a skill can be invoked — a case the skill handles — so different runs take different paths through it. A skill with many steps may carry many branches; a linear one has none.\n\n_Avoid_: path, case, fork\n\n### Leading Word\n\nA compact concept — also called a _Leitwort_ — already living in the model's pretraining, that the agent thinks with while running the skill. It encodes a behavioural principle in the fewest possible tokens by invoking priors the model already holds (e.g. _lesson_, _proximal zone of development_, _fog of war_, _tracer bullets_). Repeated as a token, never as a sentence, it accumulates a distributed definition across the skill and anchors a whole region of behaviour. Coining your own works if you define it clearly, but a made-up word recruits no priors — you pay in definition tokens what a pretrained word gives free. Reach for an existing word first.\n\nA leading word serves **predictability** twice. In the body it anchors **execution** — the agent reaches for the same behaviour every time the concept appears, and inside flat reference it focuses attention on a class of thing to look for, recruiting the right checks each run. In the **description** it anchors **invocation** — and not only within the skill: when the same word lives in your prompts, your docs, and your codebase, the agent links that shared language to the skill and fires it more reliably. Word a description with the leading words you actually use when you want the skill.\n\n_Avoid_: keyword, term, motif\n\n### Completion Criterion\n\nThe condition that tells the agent a unit of work is done — the target it judges against. Two properties make it a lever, not just a quality. Its **clarity** (can the agent tell done from not-done?) resists **premature completion** — a vague bound (\"understanding reached\") lets the agent declare done and slip to the next step; this axis needs _steps_ to bite, since premature completion is a between-steps failure. Its **demand** (how much it requires) sets **legwork** — \"every modified model accounted for\" forces thorough work where \"produce a change list\" does not — and this axis is _not_ step-bound: it can bind a body of flat reference too, which is how a skill with no steps still carries an exhaustiveness bar (\"every rule applied\"). The strongest criteria are both checkable and exhaustive.\n\n_Avoid_: done condition, exit condition, stopping rule\n\n### Legwork\n\nThe work an agent does behind the scenes within a single step — reading files, exploring the codebase, making changes, digging up what it needs rather than offloading to the user. It lives below the step structure: never written as its own step, latent in the wording, controlled by the agent rather than the skill. The within-step counterpart to **post-completion steps**' across-step pull. Raised by a **leading word** (_comprehensive_, _thorough_) or a **completion criterion** that demands the work be exhaustive — including the demand axis applied to flat reference, which is what drives a skill of flat reference to cover all its rungs. Goes thin either when that demand is missing or when **premature completion** cuts the step short.\n\n_Avoid_: scope, effort, diligence, coverage\n\n### Post-Completion Steps\n\nThe **steps** that follow the current step. Visible, they pull the agent forward into **premature completion** — the more it sees, the stronger the tug; the defence is to hide them by splitting the sequence of steps into two.\n\n_Avoid_: horizon, fog of war, lookahead\n\n### Premature Completion\n\n_Failure mode._ Ending the current step before it is genuinely done, because the agent's attention slips to being done rather than to the work. A between-steps failure: it needs **steps** to occur — a skill with no steps that quits early isn't premature completion but thin **legwork** under an unmet demand. A tug-of-war between two forces: visible **post-completion steps** (the pull forward) and the **completion criterion**'s clarity (the resistance — a sharp, checkable bar holds; a vague one gives way). Fuzziness is the necessary condition: a sharp bound resists the pull no matter how many later steps are visible, so a step that never rushes needs no defending. Two levers hold a step that does, but reach for them in order: **sharpen the bound first** — it is local and cheap. Only when the criterion is irreducibly fuzzy _and_ you actually observe the rush do you **hide the later steps** — and hiding only works across a real context boundary (a user-invoked hand-off or a subagent dispatch; an inline model-invoked call leaves the later steps in context and clears nothing). One cause of thin legwork, but distinct from it: legwork can be thin even when a step runs to full completion.\n\n_Avoid_: premature closure, the rush, rushing, shortcutting\n\n## Pruning\n\nKeeping a skill lean — each remedy paired with the failure it cures.\n\n### Single Source of Truth\n\nThe desired state where each meaning lives in exactly one authoritative place, so a change to the skill's behaviour is a change in one place. **Duplication** is its violation.\n\n_Avoid_: home, canonical location\n\n### Duplication\n\n_Failure mode._ The same meaning given more than one **single source of truth**. It costs maintenance (change one place, you must change the others), costs tokens, and inflates prominence — repeating a meaning weights it on the ladder past its real rank. The accidental inverse of a **leading word**, which raises attention on purpose by repeating a token, never the meaning.\n\n_Avoid_: repetition, redundancy\n\n### Relevance\n\nWhether a line still bears on what the skill does — the lens for what to keep. A line loses relevance either by never bearing on the task (mere exposition, or a **branch** that should be disclosed) or by going stale: drifting out of date as the behaviour or world it describes changes. Shorter skills are easier to keep relevant, because each line is cheaper to check. Distinct from **no-op**: relevance asks whether a line bears on the task, not whether it changes behaviour.\n\n_Avoid_: load-bearing, staleness, freshness\n\n### Sediment\n\n_Failure mode._ Layers of old content that settle in a skill and are never cleared, because adding feels safe and removing feels risky — so stale and irrelevant lines accumulate and you must core down through them to find what is still live. The default fate of any skill without a pruning discipline; the slow erosion of **relevance**, as opposed to **duplication**'s repeated meaning.\n\n_Avoid_: accretion, bloat, cruft, rot\n\n### No-Op\n\n_Failure mode._ An instruction that changes nothing because the model already does it by default — you pay load to tell the agent what it would do anyway. The test: does a line change behaviour versus the default? A line can be perfectly **relevant** and still be a no-op. The same priors that make a **leading word** free make a no-op worthless.\n\nA leading word is a _technique_; No-Op is a _verdict_ on a line — and they cross. A leading word too weak to beat the default is a no-op (_be thorough_ when the agent is already thorough-ish), and the fix is a stronger word that passes the verdict (_relentless_), not a different technique. So the No-Op test — does it change behaviour versus the default? — is also how you grade whether a leading word is earning its repetitions. This is model-relative, not reader-relative: two people disagreeing over whether a line is a no-op disagree about the default, and settle it by running the skill, not by debate.\n\n_Avoid_: redundant instruction, restating the obvious, belaboring\n","isInternal":false,"tokens":3832,"sizeBytes":17569},{"name":"SKILL.md","path":".agents/skills/writing-great-skills/SKILL.md","rawUrl":"https://raw.githubusercontent.com/GreyDGL/PentestGPT/HEAD/.agents/skills/writing-great-skills/SKILL.md","title":"writing-great-skills","category":"anthropic-skill","format":"markdown","content":"---\nname: writing-great-skills\ndescription: Reference for writing and editing skills well — the vocabulary and principles that make a skill predictable.\ndisable-model-invocation: true\n---\n\nA skill exists to wrangle determinism out of a stochastic system. **Predictability** — the agent taking the same _process_ every run, not producing the same output — is the root virtue; every lever below serves it.\n\n**Bold terms** are defined in [`GLOSSARY.md`](GLOSSARY.md); look them up there for the full meaning.\n\n## Invocation\n\nTwo choices, trading different costs:\n\n- A **model-invoked** skill keeps a **description**, so the agent can fire it autonomously _and_ other skills can reach it (you can still type its name too). It contributes to **context load** — the description sits in the window every turn. Mechanics: omit `disable-model-invocation`, and write a model-facing description with rich trigger phrasing (\"Use when the user wants…, mentions…\").\n- A **user-invoked** skill strips the description from the agent's reach: only you, typing its name, can invoke it — and no other skill can. Zero context load, but it spends **cognitive load**: _you_ are the index that must remember it exists. Mechanics: set `disable-model-invocation: true`; the `description` becomes human-facing — a one-line summary, trigger lists stripped.\n\nPick model-invocation only when the agent must reach the skill on its own, or another skill must. If it only ever fires by hand, make it user-invoked and pay no context load.\n\nWhen user-invoked skills multiply past what you can remember, that piled-up cognitive load is cured by a **router skill**: one user-invoked skill that names the others and when to reach for each.\n\n## Writing the description\n\nA model-invoked **description** does two jobs — state what the skill is, and list the **branches** that should trigger it. Every word increases **context load**, so a description earns even harder pruning than the body:\n\n- **Front-load the skill's leading word** — the description is where it does its invocation work.\n- **One trigger per branch.** Synonyms that rename a single branch are **duplication** — \"build features using TDD … asks for test-first development\" is one branch written twice. Collapse them; keep only genuinely distinct branches.\n- **Cut identity that's already in the body.** Keep the description to triggers, plus any \"when another skill needs…\" reach clause.\n\n## Information hierarchy\n\nA skill is built from two content types — **steps** and **reference** — that mix freely: a skill can be all steps, all reference, or both. The core decision is which to use and where each sits on the **information hierarchy**, a ladder ranked by how immediately the agent needs the material:\n\n1. **In-skill step** — an ordered action in `SKILL.md`, the primary tier: what the agent does, in order. Each step ends on a **completion criterion**, the condition that tells the agent the work is done. Make it _checkable_ (can the agent tell done from not-done?) and, where it matters, _exhaustive_ (\"every modified model accounted for\", not \"produce a change list\") — a vague criterion invites **premature completion**.\n2. **In-skill reference** — a definition, rule, or fact in `SKILL.md`, consulted on demand. Often a legitimately flat peer-set (every rule of a review on one rung) — a fine arrangement, not a smell. _This skill is all reference._\n3. **External reference** — reference pushed out of `SKILL.md` into a separate file, reached by a **context pointer**, loaded only when the pointer fires. (Spans _disclosed_ reference — a sibling file like `GLOSSARY.md`, still part of the skill — through fully **external reference** that lives outside the skill system and any skill can point at.)\n\nA demanding completion criterion drives thorough **legwork** — the digging the agent does within the work — whether the skill has steps or not, since \"every rule applied\" binds flat reference just as \"every step done\" binds a sequence.\n\nPush too little down and the top bloats; push too much and you hide material the agent actually needs. That tension is the whole decision.\n\n**Progressive disclosure** is the move down the ladder — out of `SKILL.md` into a linked file — so the top stays legible. Mechanics: a linked `.md` file in the skill folder, named for what it holds (this skill discloses its full definitions to `GLOSSARY.md`). Some skills are used in more than one way, and each distinct way is a **branch** — different runs taking different paths through the skill. Branching is the cleanest disclosure test: inline what every branch needs, and push behind a pointer what only some branches reach. A **context pointer**'s _wording_, not its target, decides when and how reliably the agent reaches the material.\n\nWhere the ladder decides _how far down_ a piece sits, **co-location** decides _what sits beside it_ once there: keep a concept's definition, rules, and caveats under one heading rather than scattered, so reading one part brings its neighbours with it.\n\n## When to split\n\n**Granularity** is how finely you divide skills, and each cut spends one of the two loads, so split only when the cut earns it. Two cuts:\n\n- **By invocation** — split off a **model-invoked** skill when you have a distinct **leading word** that should trigger it on its own, or another skill must reach it. You pay **context load** for the new always-loaded **description**, so that independent reach has to be worth it.\n- **By sequence** — split a run of **steps** when the steps still ahead (a step's **post-completion steps**) tempt the agent to rush the one in front of it (**premature completion**). Keeping them out of view encourages the agent to do more **legwork** on the current task.\n\n## Pruning\n\nKeep each meaning in a **single source of truth**: one authoritative place, so changing the behaviour is a one-place edit.\n\nCheck every line for **relevance**: does it still bear on what the skill does?\n\nThen hunt **no-ops** sentence by sentence, not just line by line: run the no-op test on each sentence in isolation, and when one fails, delete the whole sentence rather than trim words from it. Be aggressive — most prose that fails should go, not be rewritten.\n\n## Leading words\n\nA **leading word** is a compact concept already living in the model's pretraining that the agent thinks with while running the skill (e.g. _lesson_, _fog of war_, _tracer bullets_). Repeated throughout the text (though not necessarily - a strong leading word might only be needed once), it accumulates a distributed definition and anchors a whole region of behaviour in the fewest tokens, by recruiting priors the model already holds.\n\nIt serves predictability twice. In the body it anchors _execution_: the agent reaches for the same behaviour every time the word appears. In the description it anchors _invocation_: when the same word lives in your prompts, docs, and code, the agent links that shared language to the skill and fires it more reliably.\n\nHunt for opportunities to refactor skills to use leading words. A triad spelled out at three sites (**duplication**), a description spending a sentence to gesture at one idea — each is a passage begging to **collapse** into a single token. Examples include:\n\n- \"fast, deterministic, low-overhead\" -> _tight_ — one quality restated across a phase — into a single pretrained word (a _tight_ loop).\n- \"a loop you believe in\" -> _red_ — converts a fuzzy gate into a binary observable state (the loop goes _red_ on the bug, or it doesn't).\n\nYou win twice over: fewer tokens, _and_ a sharper hook for the agent to hang its thinking on. Assume every skill is carrying restatements that leading words retire — go find them.\n\n## Failure modes\n\nUse these to diagnose issues the user may be having with the skill.\n\n- **Premature completion** — ending a step before it's genuinely done, attention slipping to _being done_. Defence, in order: sharpen the completion criterion first (cheap, local); only if it is irreducibly fuzzy _and_ you observe the rush, hide the post-completion steps by splitting (the sequence cut).\n- **Duplication** — the same meaning in more than one place. Costs maintenance and tokens, and inflates a meaning's prominence on the ladder past its real rank.\n- **Sediment** — stale layers that settle because adding feels safe and removing feels risky. The default fate of any skill without a pruning discipline.\n- **Sprawl** — a skill simply too long, even when every line is live and unique. Hurts readability and maintainability and wastes tokens. The cure is the ladder: disclose **reference** behind pointers, and split by **branch** or sequence so each path carries only what it needs.\n- **No-op** — a line the model already obeys by default, so you pay load to say nothing. The test: does it change behaviour versus the default? A weak leading word (_be thorough_ when the agent is already thorough-ish) is a no-op; the fix is a stronger word (_relentless_), not a different technique.\n","frontmatter":{"name":"writing-great-skills","description":"Reference for writing and editing skills well — the vocabulary and principles that make a skill predictable.","disable-model-invocation":true,"disableModelInvocation":true},"isInternal":false,"tokens":1989,"sizeBytes":9063},{"name":"architecture.md","path":"docs/architecture.md","rawUrl":"https://raw.githubusercontent.com/GreyDGL/PentestGPT/HEAD/docs/architecture.md","title":"docs - System Architecture & Module Boundaries","category":"project-spec","format":"markdown","content":"# PentestGPT architecture\n\nStatus: 2026-07-12\n\nThis is the internal source of truth for the current repository shape. The root `README.md` is the\npublic project page and is intentionally being revised separately.\n\n## Repository family\n\n```text\nPentestGPT_Project/\n├── PentestGPT/          # framework, legacy interactive client, and tool image\n├── UnifedAgentWrapper/  # canonical unified-agent package\n└── xbow-benchmark/      # reference-only benchmark harness and historical results\n```\n\nThe three directories are independent Git repositories. The XBOW checkout is retained as a\nreference corpus only; the product CLI, runtime, and CI do not depend on it. Benchmark logic and\nresult archives must not be added here.\n\n## Maintained runtime\n\n`pentestgpt_agent/` is the autonomous framework. It is a nested uv project with its own lockfile and\nenvironment. The loop deliberately has only two LLM roles:\n\n```text\nRunSnapshot -> Supervisor -> compile_plan -> one TaskLease\n                                             |\nTraceStore <- EpisodeRunner <- Executor <----+\n     |                              |\n     +---- compile_execution -------+\n                    |\n               MemoryKernel\n```\n\n- The Supervisor chooses one task or proposes completion.\n- The Executor performs one leased task and returns a typed result.\n- Both roles use fresh provider sessions and `FULL_ACCESS`. The deployment environment is the\n  isolation boundary; PentestGPT does not maintain a second tool or filesystem sandbox.\n- Deterministic code owns scope validation, leases, evidence provenance, retries, revisions, and\n  canonical state.\n- SQLite is canonical memory. Provider transcripts are diagnostic traces, not memory.\n- There is no always-on judge, RAG service, speculative backlog, or parallel scheduler.\n\n`pentestgpt_legacy/` is the maintained human-driven implementation of the USENIX 2024 workflow. It\nhas its own lightweight provider clients and does not use `unified_agent`.\n\n## Why unified-agent remains useful\n\nThe external `UnifedAgentWrapper` is a real seam with two production adapters: Claude Code and\nCodex. PentestGPT depends on its small interface for:\n\n- provider selection, model, effort, workspace, and permission configuration;\n- structured-output invocation;\n- normalized command, tool, file, session, usage, cost, and terminal events;\n- shared task rendering and provider error handling.\n\nRemoving that module would duplicate provider SDK churn inside `pentestgpt_agent.trace` and\n`pentestgpt_agent.trial`. It therefore earns its place as a deep module. PentestGPT policy must stay\noutside it: task kinds, memory, evidence, scope, scheduling, and completion belong to this repo.\n\nThe dependency is pinned to a commit of the public package in `pentestgpt_agent/pyproject.toml`, and\n`tests/test_dependency.py` verifies that the nested project imports the installed dependency rather\nthan the repository-root copy.\n\n## Root unified_agent copy\n\nThe root `unified_agent/` is an older, drifted compatibility copy. No maintained PentestGPT runtime\nimports it:\n\n- `pentestgpt_agent` uses the external package;\n- `pentestgpt_legacy` uses its own provider clients;\n- only root packaging, its duplicate tests, and the current tool-image health check retain it.\n\nDo not develop features in this copy. Removing it is desirable, but it is a separate public-package\ncleanup because the root wheel currently exports the package and the Docker image copies it. That\ncleanup must update the root package metadata, Docker health tests, lockfile, and public README in\none deliberate change.\n\n## Deep modules\n\n| Module | Interface | Hidden implementation |\n|---|---|---|\n| `PentestLoop` | `run(RunSpec) -> RunSnapshot` | recovery ordering, retries, episode identity, failure settlement |\n| `MemoryKernel` | create/open/snapshot and atomic commits | SQLite schema, transactions, revisions, leases, dependency liveness |\n| `compile_plan` | decision + snapshot -> valid plan | scope, dependency, phase, completion, and size validation |\n| `compile_execution` | result + lease + trace -> valid execution | exact receipt matching, evidence fallback, identity, recovery rules |\n| `EpisodeRunner` | one typed episode -> normalized result | provider invocation and durable append-only trace files |\n| external `UnifiedAgent` | one task over Claude or Codex | SDK differences, native options, event normalization |\n\nThese interfaces are the preferred test surfaces. New provider behavior belongs behind\n`UnifiedAgent`; new canonical-state behavior belongs behind the Memory Kernel or compilers.\n\n## Memory and retrieval\n\nStored state is complete and retrieval is bounded. The Supervisor receives the open working set,\nrecent closed work, required basis/dependency context, selected observations, history counts, and\nrecent diagnostics. The Executor receives one task, explicit basis, same-task evidence, and a retry\ndiagnostic. A future retriever may select canonical IDs, but it must not replace SQLite or turn\nsummaries into evidence.\n\nThe current controller weakness is convergence, not database capacity: long runs can lose compact\ncoverage information and revisit completed surfaces. The next design slice should improve the\ndeterministic strategy projection and duplicate/branch policy before adding another agent or RAG.\n\n## Runtime and benchmark ownership\n\n- Local framework development runs from `pentestgpt_agent/`.\n- The root Docker image supplies pentest tools, provider CLIs, legacy code, and persisted auth. It\n  does not currently bake in the maintained framework.\n- The sibling `xbow-benchmark` checkout is a historical/reference artifact, not a supported runtime\n  or verification path. PentestGPT owns no XBOW runner.\n- HTB execution happens only on the authorized remote attack box described in the parent project\n  guide, never directly from the development Mac.\n\n## Current design priorities\n\n1. Preserve the two-role loop and deterministic memory authority.\n2. Improve Supervisor coverage retrieval and convergence using saved-trace replay tests.\n3. Keep both roles fully enabled inside a restricted deployment environment.\n4. Remove the root `unified_agent` compatibility copy in a coordinated public-package cleanup.\n5. Add a goal-specific verifier only when non-CTF completion semantics require it.\n","isInternal":false,"tokens":1299,"sizeBytes":6321}],"systemPromptSnippet":"<yakaai_skills repo=\"GreyDGL/PentestGPT\">\n<!-- File: CLAUDE.md (Tokens: ~778 | Category: claude-rule) -->\n# Claude guide\n\nInternal instructions for Claude Code in this repository. Read\n[`docs/architecture.md`](docs/architecture.md) before architecture work. The root `README.md` is the\npublic project page and must not be edited unless the user explicitly requests that separate review.\n\n## Active project map\n\n- `pentestgpt_agent/` — maintained autonomous Supervisor/Executor framework; nested uv project.\n- `pentestgpt_legacy/` — maintained human-driven USEN-2024-style client.\n- `../UnifedAgentWrapper/` — canonical `unified-agent` package used by the framework.\n- `../xbow-benchmark/` — reference-only benchmark harness and historical results; it is not a\n  supported `pentestgpt-agent` CLI, CI, or runtime integration.\n- `unified_agent/` — obsolete compatibility copy retained by root packaging/Docker only. Do not add\n  features here or confuse it with the framework dependency.\n\nThe old fixed-stage `pentestgpt/` package and the previous ledger-centered\nInstructor/Executor/Judge implementation are gone. Historical reports may still name them.\n\n## Runtime contract\n\n- The Supervisor and Executor both use `SandboxPolicy.FULL_ACCESS`; deployment isolation is the\n  security boundary.\n- Each episode is fresh. SQLite and exact trace receipts—not provider conversation history—are\n  memory.\n- Deterministic code owns scope, plan validation, leases, evidence, retries, completion bases, and\n  revisions.\n- Provider action and file activity is logged but is not an audit failure.\n- Keep the core at two LLM roles. Do not add an always-on judge, RAG layer, or scheduler without\n  trace evidence that the current deterministic seam cannot solve the problem.\n\n## Commands\n\nFramework work runs inside the nested project:\n\n```bash\ncd pentestgpt_agent\nuv sync --extra claude          # or codex / all\nuv run python -m pytest -q\nuv run ruff check src tests\nuv run ruff format --check src tests\nuv run mypy src\nuv lock --check\nuv build\n```\n\nFrom the repository root:\n\n```bash\nmake run TARGET=http://127.0.0.1:8000 BACKEND=claude\nmake check\nmake ci\nmake docker-build\nmake docker-login\nmake docker-auth-status\n```\n\nThe root Docker image does not currently contain `pentestgpt_agent`; treat `make docker-run` as\npending runtime wiring. The sibling XBOW checkout is retained only as a reference and is not a\nproduct verification path.\n\n## Documentation map\n\n- `docs/architecture.md` — current repository and module decisions.\n- `pentestgpt_agent/CONTEXT.md` — domain language and invariants.\n- `pentestgpt_agent/README.md` — framework development and operation.\n- `docs/docker-dev-plan.md` — current Docker/auth status and known gap.\n- `PENTESTGPT_AGENT_NEW_*` — compact historical migration/qualification records.\n- `pentestgpt_agent/HTB_ENIGMA_QUALIFICATION_20260712.md` — failed remote qualification evidence.\n\n## Editing rules\n\n- Preserve unrelated and concurrent worktree changes. Never restore or modify files merely because\n  they appear as changes you did not create.\n- Do not edit the root public `README.md` during internal documentation cleanup.\n- Do not put benchmark runners or generated result archives back into this repository.\n- Keep application imports as `unified_agent`; change dependency source configuration rather than\n  copying the wrapper into `pentestgpt_agent`.\n- Add focused replay or interface-level tests for behavior changes before live runs.\n- Never expose provider credentials, VPN files, HTB tokens, flags, or raw sensitive traces.\n\n<!-- File: .agents/skills/ask-matt/SKILL.md (Tokens: ~1074 | Category: anthropic-skill) -->\n---\nname: ask-matt\ndescription: Ask which skill or flow fits your situation. A router over the user-invoked skills in this repo.\ndisable-model-invocation: true\n---\n\n# Ask Matt\n\nYou don't remember every skill, so ask.\n\nA **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.\n\n## The main flow: idea → ship\n\nThe route most work travels. You have an idea and want it built.\n\n1. **`/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.)\n2. **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):\n   - **`/handoff`** out, then open a fresh session against that file,\n   - **`/prototype`** to answer the question with throwaway code,\n   - **`/handoff`** back what you learned, and reference it from the original idea thread.\n3. **Branch — is this a multi-session build?**\n   - **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.\n   - **No** → **`/implement`** right here, in the same context window.\n\n### Context hygiene\n\nKeep 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.\n\nThe 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.\n\n## On-ramps\n\nA starting situation that generates work, then merges onto the main flow.\n\n- **Bugs and requests piling up** → **`/triage`**. It moves issues through triage roles and produces agent-ready issues, which **`/implement`** later picks up.\n\n  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**.\n\n## Codebase health\n\nNot feature work — upkeep.\n\n- **`/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`.\n\n## Crossing sessions\n\n- **`/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**.\n- **`/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.\n\n## Standalone\n\nOff the main flow entirely.\n\n- **`/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.\n- **`/teach`** — learn a concept over multiple sessions, using the current directory as a stateful workspace.\n- **`/writing-great-skills`** — reference for writing and editing skills well.\n\n## Precondition\n\n**`/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.\n\n<!-- File: .agents/skills/codebase-design/DEEPENING.md (Tokens: ~542 | Category: anthropic-skill) -->\n# Deepening\n\nHow to deepen a cluster of shallow modules safely, given its dependencies. Assumes the vocabulary in [SKILL.md](SKILL.md) — **module**, **interface**, **seam**, **adapter**.\n\n## Dependency categories\n\nWhen assessing a candidate for deepening, classify its dependencies. The category determines how the deepened module is tested across its seam.\n\n### 1. In-process\n\nPure computation, in-memory state, no I/O. Always deepenable — merge the modules and test through the new interface directly. No adapter needed.\n\n### 2. Local-substitutable\n\nDependencies 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.\n\n### 3. Remote but owned (Ports & Adapters)\n\nYour 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.\n\nRecommendation 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.\"*\n\n### 4. True external (Mock)\n\nThird-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.\n\n## Seam discipline\n\n- **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.\n- **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.\n\n## Testing strategy: replace, don't layer\n\n- Old unit tests on shallow modules become waste once tests at the deepened module's interface exist — delete them.\n- Write new tests at the deepened module's interface. The **interface is the test surface**.\n- Tests assert on observable outcomes through the interface, not internal state.\n- 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.\n\n<!-- File: .agents/skills/codebase-design/DESIGN-IT-TWICE.md (Tokens: ~611 | Category: anthropic-skill) -->\n# Design It Twice\n\nWhen 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.\n\nUses the vocabulary in [SKILL.md](SKILL.md) — **module**, **interface**, **seam**, **adapter**, **leverage**.\n\n## Process\n\n### 1. Frame the problem space\n\nBefore spawning sub-agents, write a user-facing explanation of the problem space for the chosen candidate:\n\n- The constraints any new interface would need to satisfy\n- The dependencies it would rely on, and which category they fall into (see [DEEPENING.md](DEEPENING.md))\n- A rough illustrative code sketch to ground the constraints — not a proposal, just a way to make the constraints concrete\n\nShow this to the user, then immediately proceed to Step 2. The user reads and thinks while the sub-agents work in parallel.\n\n### 2. Spawn sub-agents\n\nSpawn 3+ sub-agents in parallel using the Agent tool. Each must produce a **radically different** interface for the deepened module.\n\nPrompt 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:\n\n- Agent 1: \"Minimize the interface — aim for 1–3 entry points max. Maximise leverage per entry point.\"\n- Agent 2: \"Maximise flexibility — support many use cases and extension.\"\n- Agent 3: \"Optimise for the most common caller — make the default case trivial.\"\n- Agent 4 (if applicable): \"Design around ports & adapters for cross-seam dependencies.\"\n\nInclude 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.\n\nEach sub-agent outputs:\n\n1. Interface (types, methods, params — plus invariants, ordering, error modes)\n2. Usage example showing how callers use it\n3. What the implementation hides behind the seam\n4. Dependency strategy and adapters (see [DEEPENING.md](DEEPENING.md))\n5. Trade-offs — where leverage is high, where it's thin\n\n### 3. Present and compare\n\nPresent 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**.\n\nAfter 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.\n\n<!-- File: .agents/skills/codebase-design/SKILL.md (Tokens: ~1366 | Category: anthropic-skill) -->\n---\nname: codebase-design\ndescription: 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.\n---\n\n# Codebase Design\n\nDesign **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.\n\n## Glossary\n\nUse these terms exactly — don't substitute \"component,\" \"service,\" \"API,\" or \"boundary.\" Consistent language is the whole point.\n\n**Module** — anything with an interface and an implementation. Deliberately scale-agnostic: a function, class, package, or tier-spanning slice. _Avoid_: unit, component, service.\n\n**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).\n\n**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.\n\n**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.\n\n**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).\n\n**Adapter** — a concrete thing that satisfies an interface at a seam. Describes *role* (what slot it fills), not substance (what's inside).\n\n**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.\n\n**Locality** — what maintainers get from depth: change, bugs, knowledge, and verification concentrate in one place rather than spreading across callers. Fix once, fixed everywhere.\n\n## Deep vs shallow\n\n**Deep module** = small interface + lots of implementation:\n\n```\n┌─────────────────────┐\n│   Small Interface   │  ← Few methods, simple params\n├─────────────────────┤\n│                     │\n│  Deep Implementation│  ← Complex logic hidden\n│                     │\n└─────────────────────┘\n```\n\n**Shallow module** = large interface + little implementation (avoid):\n\n```\n┌─────────────────────────────────┐\n│       Large Interface           │  ← Many methods, complex params\n├─────────────────────────────────┤\n│  Thin Implementation            │  ← Just passes through\n└─────────────────────────────────┘\n```\n\nWhen designing an interface, ask:\n\n- Can I reduce the number of methods?\n- Can I simplify the parameters?\n- Can I hide more complexity inside?\n\n## Principles\n\n- **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.\n- **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.\n- **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.\n- **One adapter means a hypothetical seam. Two adapters means a real one.** Don't introduce a seam unless something actually varies across it.\n\n## Designing for testability\n\nGood interfaces make testing natural:\n\n1. **Accept dependencies, don't create them.**\n\n   ```typescript\n   // Testable\n   function processOrder(order, paymentGateway) {}\n\n   // Hard to test\n   function processOrder(order) {\n     const gateway = new StripeGateway();\n   }\n   ```\n\n2. **Return results, don't produce side effects.**\n\n   ```typescript\n   // Testable\n   function calculateDiscount(cart): Discount {}\n\n   // Hard to test\n   function applyDiscount(cart): void {\n     cart.total -= discount;\n   }\n   ```\n\n3. **Small surface area.** Fewer methods = fewer tests needed. Fewer params = simpler test setup.\n\n## Relationships\n\n- A **Module** has exactly one **Interface** (the surface it presents to callers and tests).\n- **Depth** is a property of a **Module**, measured against its **Interface**.\n- A **Seam** is where a **Module**'s **Interface** lives.\n- An **Adapter** sits at a **Seam** and satisfies the **Interface**.\n- **Depth** produces **Leverage** for callers and **Locality** for maintainers.\n\n## Rejected framings\n\n- **Depth as ratio of implementation-lines to interface-lines** (Ousterhout): rewards padding the implementation. We use depth-as-leverage instead.\n- **\"Interface\" as the TypeScript `interface` keyword or a class's public methods**: too narrow — interface here includes every fact a caller must know.\n- **\"Boundary\"**: overloaded with DDD's bounded context. Say **seam** or **interface**.\n\n## Going deeper\n\n- **Deepening a cluster given its dependencies** — see [DEEPENING.md](DEEPENING.md): dependency categories, seam discipline, and replace-don't-layer testing.\n- **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.\n\n<!-- File: .agents/skills/diagnosing-bugs/SKILL.md (Tokens: ~1997 | Category: anthropic-skill) -->\n---\nname: diagnosing-bugs\ndescription: Diagnosis loop for hard bugs and performance regressions. Use when the user says \"diagnose\"/\"debug this\", or reports something broken/throwing/failing/slow.\n---\n\n# Diagnosing Bugs\n\nA discipline for hard bugs. Skip phases only when explicitly justified.\n\nWhen 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.\n\n## Phase 1 — Build a feedback loop\n\n**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.\n\nSpend disproportionate effort here. **Be aggressive. Be creative. Refuse to give up.**\n\n### Ways to construct one — try them in roughly this order\n\n1. **Failing test** at whatever seam reaches the bug — unit, integration, e2e.\n2. **Curl / HTTP script** against a running dev server.\n3. **CLI invocation** with a fixture input, diffing stdout against a known-good snapshot.\n4. **Headless browser script** (Playwright / Puppeteer) — drives the UI, asserts on DOM/console/network.\n5. **Replay a captured trace.** Save a real network request / payload / event log to disk; replay it through the code path in isolation.\n6. **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.\n7. **Property / fuzz loop.** If the bug is \"sometimes wrong output\", run 1000 random inputs and look for the failure mode.\n8. **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.\n9. **Differential loop.** Run the same input through old-version vs new-version (or two configs) and diff outputs.\n10. **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.\n\nBuild the right feedback loop, and the bug is 90% fixed.\n\n### Tighten the loop\n\nTreat the loop as a product. Once you have _a_ loop, **tighten** it:\n\n- Can I make it faster? (Cache setup, skip unrelated init, narrow the test scope.)\n- Can I make the signal sharper? (Assert on the specific symptom, not \"didn't crash\".)\n- Can I make it more deterministic? (Pin time, seed RNG, isolate filesystem, freeze network.)\n\nA 30-second flaky loop is barely better than no loop; a 2-second deterministic one is tight — a debugging superpower.\n\n### Non-deterministic bugs\n\nThe 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.\n\n### When you genuinely cannot build a loop\n\nStop 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.\n\n### Completion criterion — a tight loop that goes red\n\nPhase 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:\n\n- [ ] **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_.\n- [ ] **Deterministic** — same verdict every run (flaky bugs: a pinned, high reproduction rate, per above).\n- [ ] **Fast** — seconds, not minutes.\n- [ ] **Agent-runnable** — you can run it unattended; a human in the loop only via `scripts/hitl-loop.template.sh`.\n\nIf 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.\n\n## Phase 2 — Reproduce + minimise\n\nRun the loop. Watch it go red — the bug appears.\n\nConfirm:\n\n- [ ] The loop produces the failure mode the **user** described — not a different failure that happens to be nearby. Wrong bug = wrong fix.\n- [ ] The failure is reproducible across multiple runs (or, for non-deterministic bugs, reproducible at a high enough rate to debug against).\n- [ ] You have captured the exact symptom (error message, wrong output, slow timing) so later phases can verify the fix actually addresses it.\n\n### Minimise\n\nOnce 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.\n\nWhy 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.\n\nDone when **every remaining element is load-bearing** — removing any one of them makes the loop go green.\n\nDo not proceed until you have reproduced **and** minimised.\n\n## Phase 3 — Hypothesise\n\nGenerate **3–5 ranked hypotheses** before testing any of them. Single-hypothesis generation anchors on the first plausible idea.\n\nEach hypothesis must be **falsifiable**: state the prediction it makes.\n\n> Format: \"If <X> is the cause, then <changing Y> will make the bug disappear / <changing Z> will make it worse.\"\n\nIf you cannot state the prediction, the hypothesis is a vibe — discard or sharpen it.\n\n**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.\n\n## Phase 4 — Instrument\n\nEach probe must map to a specific prediction from Phase 3. **Change one variable at a time.**\n\nTool preference:\n\n1. **Debugger / REPL inspection** if the env supports it. One breakpoint beats ten logs.\n2. **Targeted logs** at the boundaries that distinguish hypotheses.\n3. Never \"log everything and grep\".\n\n**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.\n\n**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.\n\n## Phase 5 — Fix + regression test\n\nWrite the regression test **before the fix** — but only if there is a **correct seam** for it.\n\nA 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.\n\n**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.\n\nIf a correct seam exists:\n\n1. Turn the minimised repro into a failing test at that seam.\n2. Watch it fail.\n3. Apply the fix.\n4. Watch it pass.\n5. Re-run the Phase 1 feedback loop against the original (un-minimised) scenario.\n\n## Phase 6 — Cleanup + post-mortem\n\nRequired before declaring done:\n\n- [ ] Original repro no longer reproduces (re-run the Phase 1 loop)\n- [ ] Regression test passes (or absence of seam is documented)\n- [ ] All `[DEBUG-...]` instrumentation removed (`grep` the prefix)\n- [ ] Throwaway prototypes deleted (or moved to a clearly-marked debug location)\n- [ ] The hypothesis that turned out correct is stated in the commit / PR message — so the next debugger learns\n\n**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.\n\n<!-- File: .agents/skills/domain-modeling/ADR-FORMAT.md (Tokens: ~634 | Category: anthropic-skill) -->\n# ADR Format\n\nADRs live in `docs/adr/` and use sequential numbering: `0001-slug.md`, `0002-slug.md`, etc.\n\nCreate the `docs/adr/` directory lazily — only when the first ADR is needed.\n\n## Template\n\n```md\n# {Short title of the decision}\n\n{1-3 sentences: what's the context, what did we decide, and why.}\n```\n\nThat'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.\n\n## Optional sections\n\nOnly include these when they add genuine value. Most ADRs won't need them.\n\n- **Status** frontmatter (`proposed | accepted | deprecated | superseded by ADR-NNNN`) — useful when decisions are revisited\n- **Considered Options** — only when the rejected alternatives are worth remembering\n- **Consequences** — only when non-obvious downstream effects need to be called out\n\n## Numbering\n\nScan `docs/adr/` for the highest existing number and increment by one.\n\n## When to offer an ADR\n\nAll three of these must be true:\n\n1. **Hard to reverse** — the cost of changing your mind later is meaningful\n2. **Surprising without context** — a future reader will look at the code and wonder \"why on earth did they do it this way?\"\n3. **The result of a real trade-off** — there were genuine alternatives and you picked one for specific reasons\n\nIf 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.\"\n\n### What qualifies\n\n- **Architectural shape.** \"We're using a monorepo.\" \"The write model is event-sourced, the read model is projected into Postgres.\"\n- **Integration patterns between contexts.** \"Ordering and Billing communicate via domain events, not synchronous HTTP.\"\n- **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.\n- **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.\n- **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.\n- **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.\"\n- **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.\n\n<!-- File: .agents/skills/domain-modeling/CONTEXT-FORMAT.md (Tokens: ~536 | Category: anthropic-skill) -->\n# CONTEXT.md Format\n\n## Structure\n\n```md\n# {Context Name}\n\n{One or two sentence description of what this context is and why it exists.}\n\n## Language\n\n**Order**:\n{A one or two sentence description of the term}\n_Avoid_: Purchase, transaction\n\n**Invoice**:\nA request for payment sent to a customer after delivery.\n_Avoid_: Bill, payment request\n\n**Customer**:\nA person or organization that places orders.\n_Avoid_: Client, buyer, account\n```\n\n## Rules\n\n- **Be opinionated.** When multiple words exist for the same concept, pick the best one and list the others under `_Avoid_`.\n- **Keep definitions tight.** One or two sentences max. Define what it IS, not what it does.\n- **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.\n- **Group terms under subheadings** when natural clusters emerge. If all terms belong to a single cohesive area, a flat list is fine.\n\n## Single vs multi-context repos\n\n**Single context (most repos):** One `CONTEXT.md` at the repo root.\n\n**Multiple contexts:** A `CONTEXT-MAP.md` at the repo root lists the contexts, where they live, and how they relate to each other:\n\n```md\n# Context Map\n\n## Contexts\n\n- [Ordering](./src/ordering/CONTEXT.md) — receives and tracks customer orders\n- [Billing](./src/billing/CONTEXT.md) — generates invoices and processes payments\n- [Fulfillment](./src/fulfillment/CONTEXT.md) — manages warehouse picking and shipping\n\n## Relationships\n\n- **Ordering → Fulfillment**: Ordering emits `OrderPlaced` events; Fulfillment consumes them to start picking\n- **Fulfillment → Billing**: Fulfillment emits `ShipmentDispatched` events; Billing consumes them to generate invoices\n- **Ordering ↔ Billing**: Shared types for `CustomerId` and `Money`\n```\n\nThe skill infers which structure applies:\n\n- If `CONTEXT-MAP.md` exists, read it to find contexts\n- If only a root `CONTEXT.md` exists, single context\n- If neither exists, create a root `CONTEXT.md` lazily when the first term is resolved\n\nWhen multiple contexts exist, infer which one the current topic relates to. If unclear, ask.\n\n<!-- File: .agents/skills/domain-modeling/SKILL.md (Tokens: ~769 | Category: anthropic-skill) -->\n---\nname: domain-modeling\ndescription: 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.\n---\n\n# Domain Modeling\n\nActively 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.)\n\n## File structure\n\nMost repos have a single context:\n\n```\n/\n├── CONTEXT.md\n├── docs/\n│   └── adr/\n│       ├── 0001-event-sourced-orders.md\n│       └── 0002-postgres-for-write-model.md\n└── src/\n```\n\nIf a `CONTEXT-MAP.md` exists at the root, the repo has multiple contexts. The map points to where each one lives:\n\n```\n/\n├── CONTEXT-MAP.md\n├── docs/\n│   └── adr/                          ← system-wide decisions\n├── src/\n│   ├── ordering/\n│   │   ├── CONTEXT.md\n│   │   └── docs/adr/                 ← context-specific decisions\n│   └── billing/\n│       ├── CONTEXT.md\n│       └── docs/adr/\n```\n\nCreate 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.\n\n## During the session\n\n### Challenge against the glossary\n\nWhen 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?\"\n\n### Sharpen fuzzy language\n\nWhen 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.\"\n\n### Discuss concrete scenarios\n\nWhen 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.\n\n### Cross-reference with code\n\nWhen 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?\"\n\n### Update CONTEXT.md inline\n\nWhen 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).\n\n`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.\n\n### Offer ADRs sparingly\n\nOnly offer to create an ADR when all three are true:\n\n1. **Hard to reverse** — the cost of changing your mind later is meaningful\n2. **Surprising without context** — a future reader will wonder \"why did they do it this way?\"\n3. **The result of a real trade-off** — there were genuine alternatives and you picked one for specific reasons\n\nIf any of the three is missing, skip the ADR. Use the format in [ADR-FORMAT.md](./ADR-FORMAT.md).\n\n<!-- File: .agents/skills/grill-me/SKILL.md (Tokens: ~34 | Category: anthropic-skill) -->\n---\nname: grill-me\ndescription: A relentless interview to sharpen a plan or design.\ndisable-model-invocation: true\n---\n\nRun a `/grilling` session.\n\n<!-- File: .agents/skills/grill-with-docs/SKILL.md (Tokens: ~60 | Category: anthropic-skill) -->\n---\nname: grill-with-docs\ndescription: A relentless interview to sharpen a plan or design, which also creates docs (ADR's and glossary) as we go.\ndisable-model-invocation: true\n---\n\nRun a `/grilling` session, using the `/domain-modeling` skill.\n\n<!-- File: .agents/skills/grilling/SKILL.md (Tokens: ~128 | Category: anthropic-skill) -->\n---\nname: grilling\ndescription: 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.\n---\n\nInterview 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.\n\nAsk the questions one at a time, waiting for feedback on each question before continuing. Asking multiple questions at once is bewildering.\n\nIf a question can be answered by exploring the codebase, explore the codebase instead.\n\n<!-- File: .agents/skills/handoff/SKILL.md (Tokens: ~178 | Category: anthropic-skill) -->\n---\nname: handoff\ndescription: Compact the current conversation into a handoff document for another agent to pick up.\nargument-hint: \"What will the next session be used for?\"\ndisable-model-invocation: true\n---\n\nWrite 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.\n\nInclude a \"suggested skills\" section in the document, which suggests skills that the agent should invoke.\n\nDo not duplicate content already captured in other artifacts (PRDs, plans, ADRs, issues, commits, diffs). Reference them by path or URL instead.\n\nRedact any sensitive information, such as API keys, passwords, or personally identifiable information.\n\nIf the user passed arguments, treat them as a description of what the next session will focus on and tailor the doc accordingly.\n\n<!-- File: .agents/skills/improve-codebase-architecture/HTML-REPORT.md (Tokens: ~1616 | Category: anthropic-skill) -->\n# HTML Report Format\n\nThe 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.\n\n## Scaffold\n\n```html\n<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"utf-8\" />\n    <title>Architecture review — {{repo name}}</title>\n    <script src=\"https://cdn.tailwindcss.com\"></script>\n    <script type=\"module\">\n      import mermaid from \"https://cdn.jsdelivr.net/npm/mermaid@11/dist/mermaid.esm.min.mjs\";\n      mermaid.initialize({ startOnLoad: true, theme: \"neutral\", securityLevel: \"loose\" });\n    </script>\n    <style>\n      /* small custom layer for things Tailwind doesn't cover cleanly:\n         dashed seam lines, hand-drawn-feeling arrow heads, etc. */\n      .seam { stroke-dasharray: 4 4; }\n      .leak { stroke: #dc2626; }\n      .deep { background: linear-gradient(135deg, #0f172a, #1e293b); }\n    </style>\n  </head>\n  <body class=\"bg-stone-50 text-slate-900 font-sans\">\n    <main class=\"max-w-5xl mx-auto px-6 py-12 space-y-12\">\n      <header>...</header>\n      <section id=\"candidates\" class=\"space-y-10\">...</section>\n      <section id=\"top-recommendation\">...</section>\n    </main>\n  </body>\n</html>\n```\n\n## Header\n\nRepo 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.\n\n## Candidate card\n\nThe diagrams carry the weight. Prose is sparse, plain, and uses the glossary terms (from the `/codebase-design` skill) without ceremony.\n\nEach candidate is one `<article>`:\n\n- **Title** — short, names the deepening (e.g. \"Collapse the Order intake pipeline\").\n- **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`).\n- **Files** — monospaced list, `font-mono text-sm`.\n- **Before / After diagram** — the centrepiece. Two columns, side by side. See patterns below.\n- **Problem** — one sentence. What hurts.\n- **Solution** — one sentence. What changes.\n- **Wins** — bullets, ≤6 words each. e.g. \"Tests hit one interface\", \"Pricing logic stops leaking\", \"Delete 4 shallow wrappers\".\n- **ADR callout** (if applicable) — one line in an amber-tinted box.\n\nNo paragraphs of explanation. If the diagram needs a paragraph to be understood, redraw the diagram.\n\n## Diagram patterns\n\nPick the pattern that fits the candidate. Mix them. Don't make every diagram look the same — variety is part of the point.\n\n### Mermaid graph (the workhorse for dependencies / call flow)\n\nUse 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.\"\n\n```html\n<div class=\"rounded-lg border border-slate-200 bg-white p-4\">\n  <pre class=\"mermaid\">\n    flowchart LR\n      A[OrderHandler] --> B[OrderValidator]\n      B --> C[OrderRepo]\n      C -.leak.-> D[PricingClient]\n      classDef leak stroke:#dc2626,stroke-width:2px;\n      class C,D leak\n  </pre>\n</div>\n```\n\n### Hand-built boxes-and-arrows (when Mermaid's layout fights you)\n\nModules 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.\n\n### Cross-section (good for layered shallowness)\n\nStack 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.\n\n### Mass diagram (good for \"interface as wide as implementation\")\n\nTwo 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).\n\n### Call-graph collapse\n\nBefore: 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.\n\n## Style guidance\n\n- Lean editorial, not corporate-dashboard. Generous whitespace. Serif optional for headings (`font-serif` works well with stone/slate).\n- Colour sparingly: one accent (emerald or indigo) plus red for leakage and amber for warnings.\n- Keep diagrams ~320px tall so before/after sits comfortably side by side without scrolling.\n- Use `text-xs uppercase tracking-wider` for module labels inside diagrams — they should read as schematic, not as UI.\n- 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.\n\n## Top recommendation section\n\nOne larger card. Candidate name, one sentence on why, anchor link to its card. That's it.\n\n## Tone\n\nPlain English, concise — but the architectural nouns and verbs come straight from the `/codebase-design` skill. Concision is not an excuse to drift.\n\n**Use exactly:** module, interface, implementation, depth, deep, shallow, seam, adapter, leverage, locality.\n\n**Never substitute:** component, service, unit (for module) · API, signature (for interface) · boundary (for seam) · layer, wrapper (for module, when you mean module).\n\n**Phrasings that fit the style:**\n\n- \"Order intake module is shallow — interface nearly matches the implementation.\"\n- \"Pricing leaks across the seam.\"\n- \"Deepen: one interface, one place to test.\"\n- \"Two adapters justify the seam: HTTP in prod, in-memory in tests.\"\n\n**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.\n\nNo 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.\n\n<!-- File: .agents/skills/improve-codebase-architecture/SKILL.md (Tokens: ~1218 | Category: anthropic-skill) -->\n---\nname: improve-codebase-architecture\ndescription: Scan a codebase for deepening opportunities, present them as a visual HTML report, then grill through whichever one you pick.\ndisable-model-invocation: true\n---\n\n# Improve Codebase Architecture\n\nSurface architectural friction and propose **deepening opportunities** — refactors that turn shallow modules into deep ones. The aim is testability and AI-navigability.\n\nThis command is _informed_ by the project's domain model and built on a shared design vocabulary:\n\n- 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.\"\n- The domain language in `CONTEXT.md` gives names to good seams; ADRs in `docs/adr/` record decisions this command should not re-litigate.\n\n## Process\n\n### 1. Explore\n\nRead the project's domain glossary (`CONTEXT.md`) and any ADRs in the area you're touching first.\n\nThen 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:\n\n- Where does understanding one concept require bouncing between many small modules?\n- Where are modules **shallow** — interface nearly as complex as the implementation?\n- Where have pure functions been extracted just for testability, but the real bugs hide in how they're called (no **locality**)?\n- Where do tightly-coupled modules leak across their seams?\n- Which parts of the codebase are untested, or hard to test through their current interface?\n\nApply 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.\n\n### 2. Present candidates as an HTML report\n\nWrite 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.\n\nThe 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.\n\nFor each candidate, render a card with:\n\n- **Files** — which files/modules are involved\n- **Problem** — why the current architecture is causing friction\n- **Solution** — plain English description of what would change\n- **Benefits** — explained in terms of locality and leverage, and how tests would improve\n- **Before / After diagram** — side-by-side, custom-drawn, illustrating the shallowness and the deepening\n- **Recommendation strength** — one of `Strong`, `Worth exploring`, `Speculative`, rendered as a badge\n\nEnd the report with a **Top recommendation** section: which candidate you'd tackle first and why.\n\n**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.\"\n\n**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.\n\nSee [HTML-REPORT.md](HTML-REPORT.md) for the full HTML scaffold, diagram patterns, and styling guidance.\n\nDo NOT propose interfaces yet. After the file is written, ask the user: \"Which of these would you like to explore?\"\n\n### 3. Grilling loop\n\nOnce 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.\n\nSide effects happen inline as decisions crystallize — run the `/domain-modeling` skill to keep the domain model current as you go:\n\n- **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.\n- **Sharpening a fuzzy term during the conversation?** Update `CONTEXT.md` right there.\n- **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.\n- **Want to explore alternative interfaces for the deepened module?** Run the `/codebase-design` skill and use its design-it-twice parallel sub-agent pattern.\n\n<!-- File: .agents/skills/prototype/LOGIC.md (Tokens: ~1303 | Category: anthropic-skill) -->\n# Logic Prototype\n\nA 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.\n\n## When this is the right shape\n\n- \"I'm not sure if this state machine handles the edge case where X then Y.\"\n- \"Does this data model actually let me represent the case where...\"\n- \"I want to feel out what the API should look like before writing it.\"\n- Anything where the user wants to **press buttons and watch state change**.\n\nIf the question is \"what should this look like\" — wrong branch. Use [UI.md](UI.md).\n\n## Process\n\n### 1. State the question\n\nBefore 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.\n\n### 2. Pick the language\n\nUse whatever the host project uses. If the project has no obvious runtime (e.g. a docs repo), ask.\n\nMatch the project's existing conventions for tooling — don't add a new package manager or runtime just for the prototype.\n\n### 3. Isolate the logic in a portable module\n\nPut 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.\n\nThe right shape depends on the question:\n\n- **A pure reducer** — `(state, action) => state`. Good when actions are discrete events and state is a single value.\n- **A state machine** — explicit states and transitions. Good when \"which actions are even legal right now\" is part of the question.\n- **A small set of pure functions** over a plain data type. Good when there's no implicit current state — just transformations.\n- **A class or module with a clear method surface** when the logic genuinely owns ongoing internal state.\n\nPick 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.\n\nThis 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.\n\n### 4. Build the smallest TUI that exposes the state\n\nBuild 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.\n\nEach frame has two parts, in this order:\n\n1. **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.\n2. **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.\n\nBehaviour:\n\n1. **Initialise state** — a single in-memory object/struct. Render the first frame on start.\n2. **Read one keystroke (or one line)** at a time, dispatch to a handler that mutates state.\n3. **Re-render** the full frame after every action — don't append, replace.\n4. **Loop until quit.**\n\nThe whole frame should fit on one screen.\n\n### 5. Make it runnable in one command\n\nAdd 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.\n\nIf the host project has no task runner, just put the command at the top of the prototype's README.\n\n### 6. Hand it over\n\nGive 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.\n\n### 7. Capture the answer\n\nWhen 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.\n\n## Anti-patterns\n\n- **Don't add tests.** A prototype that needs tests is no longer a prototype.\n- **Don't wire it to the real database.** Use an in-memory store unless the question is specifically about persistence.\n- **Don't generalise.** No \"what if we wanted to support X later.\" The prototype answers one question.\n- **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.\n- **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.\n\n<!-- File: .agents/skills/prototype/SKILL.md (Tokens: ~665 | Category: anthropic-skill) -->\n---\nname: prototype\ndescription: Build a throwaway prototype to flesh out a design — a runnable terminal app for state/business-logic questions, or several radically different UI variations toggleable from one route.\ndisable-model-invocation: true\n---\n\n# Prototype\n\nA prototype is **throwaway code that answers a question**. The question decides the shape.\n\n## Pick a branch\n\nIdentify which question is being answered — from the user's prompt, the surrounding code, or by asking if the user is around:\n\n- **\"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.\n- **\"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.\n\nThe 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.\n\n## Rules that apply to both\n\n1. **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.\n2. **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.\n3. **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.\n4. **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.\n5. **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.\n6. **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.\n\n## When done\n\nThe _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.\n\n<!-- File: .agents/skills/prototype/UI.md (Tokens: ~1554 | Category: anthropic-skill) -->\n# UI Prototype\n\nGenerate **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.\n\nIf the question is about logic/state rather than what something looks like — wrong branch. Use [LOGIC.md](LOGIC.md).\n\n## When this is the right shape\n\n- \"What should this page look like?\"\n- \"I want to see a few options for this dashboard before committing.\"\n- \"Try a different layout for the settings screen.\"\n- Any time the user would otherwise spend a day picking between three vague mockups in their head.\n\n## Two sub-shapes — strongly prefer sub-shape A\n\nA 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.\n\n### Sub-shape A — adjustment to an existing page (preferred)\n\nThe 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.\n\nIf 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.\n\n### Sub-shape B — a new page (last resort)\n\nOnly 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.\n\nCreate 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.\n\nBefore 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.\n\nIn both sub-shapes the floating bottom bar is identical.\n\n## Process\n\n### 1. State the question and pick N\n\nDefault to **3 variants**. More than 5 stops being radically different and starts being noise — cap there.\n\nWrite down the plan in one line, in the prototype's location or a top-of-file comment:\n\n> \"Three variants of the settings page, switchable via `?variant=`, on the existing `/settings` route.\"\n\nThis works whether the user is here to push back or not.\n\n### 2. Generate radically different variants\n\nDraft each variant. Hold each one to:\n\n- The page's purpose and the data it has access to.\n- The project's component library / styling system (TailwindCSS, shadcn, MUI, plain CSS, whatever).\n- A clear exported component name, e.g. `VariantA`, `VariantB`, `VariantC`.\n\nVariants 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.\n\n### 3. Wire them together\n\nCreate a single switcher component on the route:\n\n```tsx\n// pseudo-code — adapt to the project's framework\nconst variant = searchParams.get('variant') ?? 'A';\nreturn (\n  <>\n    {variant === 'A' && <VariantA {...data} />}\n    {variant === 'B' && <VariantB {...data} />}\n    {variant === 'C' && <VariantC {...data} />}\n    <PrototypeSwitcher variants={['A','B','C']} current={variant} />\n  </>\n);\n```\n\nFor sub-shape A (existing page): keep all the existing data fetching above the switcher; only the rendered subtree changes per variant.\n\nFor sub-shape B (new page): the throwaway route under `/prototype/<name>` mounts the same switcher.\n\n### 4. Build the floating switcher\n\nA small fixed-position bar at the bottom-centre of the screen with three pieces:\n\n- **Left arrow** — cycles to the previous variant (wraps around).\n- **Variant label** — shows the current variant key and, if the variant exports a name, that name too. e.g. `B — Sidebar layout`.\n- **Right arrow** — cycles forward (wraps around).\n\nBehaviour:\n\n- 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.\n- Keyboard: `←` and `→` arrow keys also cycle. Don't intercept arrow keys when an `<input>`, `<textarea>`, or `[contenteditable]` is focused.\n- Visually distinct from the page (e.g. high-contrast pill, subtle shadow) so it's obviously not part of the design being evaluated.\n- 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.\n\nPut the switcher in a single shared component so both sub-shapes can reuse it. Locate it wherever shared UI lives in the project.\n\n### 5. Hand it over\n\nSurface 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.\n\n### 6. Capture the answer and clean up\n\nOnce 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:\n\n- **Sub-shape A** — delete the losing variants and the switcher; fold the winner into the existing page.\n- **Sub-shape B** — promote the winning variant to a real route, delete the throwaway route and the switcher.\n\nDon't leave variant components or the switcher lying around. They rot fast and confuse the next reader.\n\n## Anti-patterns\n\n- **Variants that differ only in colour or copy.** That's a tweak, not a prototype. Real variants disagree about structure.\n- **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.\n- **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\".\n- **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.\n\n<!-- File: .agents/skills/setup-matt-pocock-skills/domain.md (Tokens: ~496 | Category: anthropic-skill) -->\n# Domain Docs\n\nHow the engineering skills should consume this repo's domain documentation when exploring the codebase.\n\n## Before exploring, read these\n\n- **`CONTEXT.md`** at the repo root, or\n- **`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.\n- **`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.\n\nIf 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.\n\n## File structure\n\nSingle-context repo (most repos):\n\n```\n/\n├── CONTEXT.md\n├── docs/adr/\n│   ├── 0001-event-sourced-orders.md\n│   └── 0002-postgres-for-write-model.md\n└── src/\n```\n\nMulti-context repo (presence of `CONTEXT-MAP.md` at the root):\n\n```\n/\n├── CONTEXT-MAP.md\n├── docs/adr/                          ← system-wide decisions\n└── src/\n    ├── ordering/\n    │   ├── CONTEXT.md\n    │   └── docs/adr/                  ← context-specific decisions\n    └── billing/\n        ├── CONTEXT.md\n        └── docs/adr/\n```\n\n## Use the glossary's vocabulary\n\nWhen 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.\n\nIf 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`).\n\n## Flag ADR conflicts\n\nIf your output contradicts an existing ADR, surface it explicitly rather than silently overriding:\n\n> _Contradicts ADR-0007 (event-sourced orders) — but worth reopening because…_\n\n<!-- File: .agents/skills/setup-matt-pocock-skills/issue-tracker-github.md (Tokens: ~525 | Category: anthropic-skill) -->\n# Issue tracker: GitHub\n\nIssues and PRDs for this repo live as GitHub issues. Use the `gh` CLI for all operations.\n\n## Conventions\n\n- **Create an issue**: `gh issue create --title \"...\" --body \"...\"`. Use a heredoc for multi-line bodies.\n- **Read an issue**: `gh issue view <number> --comments`, filtering comments by `jq` and also fetching labels.\n- **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.\n- **Comment on an issue**: `gh issue comment <number> --body \"...\"`\n- **Apply / remove labels**: `gh issue edit <number> --add-label \"...\"` / `--remove-label \"...\"`\n- **Close**: `gh issue close <number> --comment \"...\"`\n\nInfer the repo from `git remote -v` — `gh` does this automatically when run inside a clone.\n\n## Pull requests as a triage surface\n\n**PRs as a request surface: no.** _(Set to `yes` if this repo treats external PRs as feature requests; `/triage` reads this flag.)_\n\nWhen set to `yes`, PRs run through the same labels and states as issues, using the `gh pr` equivalents:\n\n- **Read a PR**: `gh pr view <number> --comments` and `gh pr diff <number>` for the diff.\n- **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`).\n- **Comment / label / close**: `gh pr comment`, `gh pr edit --add-label`/`--remove-label`, `gh pr close`.\n\nGitHub 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`.\n\n## When a skill says \"publish to the issue tracker\"\n\nCreate a GitHub issue.\n\n## When a skill says \"fetch the relevant ticket\"\n\nRun `gh issue view <number> --comments`.\n\n<!-- File: .agents/skills/setup-matt-pocock-skills/issue-tracker-gitlab.md (Tokens: ~606 | Category: anthropic-skill) -->\n# Issue tracker: GitLab\n\nIssues and PRDs for this repo live as GitLab issues. Use the [`glab`](https://gitlab.com/gitlab-org/cli) CLI for all operations.\n\n## Conventions\n\n- **Create an issue**: `glab issue create --title \"...\" --description \"...\"`. Use a heredoc for multi-line descriptions. Pass `--description -` to open an editor.\n- **Read an issue**: `glab issue view <number> --comments`. Use `-F json` for machine-readable output.\n- **List issues**: `glab issue list -F json` with appropriate `--label` filters.\n- **Comment on an issue**: `glab issue note <number> --message \"...\"`. GitLab calls comments \"notes\".\n- **Apply / remove labels**: `glab issue update <number> --label \"...\"` / `--unlabel \"...\"`. Multiple labels can be comma-separated or by repeating the flag.\n- **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.\n- **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`.\n\nInfer the repo from `git remote -v` — `glab` does this automatically when run inside a clone.\n\n## Merge requests as a triage surface\n\n**MRs as a request surface: no.** _(Set to `yes` if this repo treats external merge requests as feature requests; `/triage` reads this flag.)_\n\nWhen set to `yes`, MRs run through the same labels and states as issues, using the `glab mr` equivalents:\n\n- **Read an MR**: `glab mr view <number> --comments` and `glab mr diff <number>` for the diff.\n- **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).\n- **Comment / label / close**: `glab mr note`, `glab mr update --label`/`--unlabel`, `glab mr close`.\n\nUnlike GitHub, GitLab numbers issues and MRs separately, so `#42` is unambiguous once you know which surface the maintainer means.\n\n## When a skill says \"publish to the issue tracker\"\n\nCreate a GitLab issue.\n\n## When a skill says \"fetch the relevant ticket\"\n\nRun `glab issue view <number> --comments`.\n\n<!-- File: .agents/skills/setup-matt-pocock-skills/issue-tracker-local.md (Tokens: ~199 | Category: anthropic-skill) -->\n# Issue tracker: Local Markdown\n\nIssues and PRDs for this repo live as markdown files in `.scratch/`.\n\n## Conventions\n\n- One feature per directory: `.scratch/<feature-slug>/`\n- The PRD is `.scratch/<feature-slug>/PRD.md`\n- Implementation issues are `.scratch/<feature-slug>/issues/<NN>-<slug>.md`, numbered from `01`\n- Triage state is recorded as a `Status:` line near the top of each issue file (see `triage-labels.md` for the role strings)\n- Comments and conversation history append to the bottom of the file under a `## Comments` heading\n\n## When a skill says \"publish to the issue tracker\"\n\nCreate a new file under `.scratch/<feature-slug>/` (creating the directory if needed).\n\n## When a skill says \"fetch the relevant ticket\"\n\nRead the file at the referenced path. The user will normally pass the path or the issue number directly.\n\n<!-- File: .agents/skills/setup-matt-pocock-skills/SKILL.md (Tokens: ~1784 | Category: anthropic-skill) -->\n---\nname: setup-matt-pocock-skills\ndescription: 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.\ndisable-model-invocation: true\n---\n\n# Setup Matt Pocock's Skills\n\nScaffold the per-repo configuration that the engineering skills assume:\n\n- **Issue tracker** — where issues live (GitHub by default; local markdown is also supported out of the box)\n- **Triage labels** — the strings used for the five canonical triage roles\n- **Domain docs** — where `CONTEXT.md` and ADRs live, and the consumer rules for reading them\n\nThis is a prompt-driven skill, not a deterministic script. Explore, present what you found, confirm with the user, then write.\n\n## Process\n\n### 1. Explore\n\nLook at the current repo to understand its starting state. Read whatever exists; don't assume:\n\n- `git remote -v` and `.git/config` — is this a GitHub repo? Which one?\n- `AGENTS.md` and `CLAUDE.md` at the repo root — does either exist? Is there already an `## Agent skills` section in either?\n- `CONTEXT.md` and `CONTEXT-MAP.md` at the repo root\n- `docs/adr/` and any `src/*/docs/adr/` directories\n- `docs/agents/` — does this skill's prior output already exist?\n- `.scratch/` — sign that a local-markdown issue tracker convention is already in use\n\n### 2. Present findings and ask\n\nSummarise 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.\n\nAssume 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.\n\n**Section A — Issue tracker.**\n\n> 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.\n\nDefault 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:\n\n- **GitHub** — issues live in the repo's GitHub Issues (uses the `gh` CLI)\n- **GitLab** — issues live in the repo's GitLab Issues (uses the [`glab`](https://gitlab.com/gitlab-org/cli) CLI)\n- **Local markdown** — issues live as files under `.scratch/<feature>/` in this repo (good for solo projects or repos without a remote)\n- **Other** (Jira, Linear, etc.) — ask the user to describe the workflow in one paragraph; the skill will record it as freeform prose\n\nIf — and only if — the user picked **GitHub** or **GitLab**, ask one follow-up:\n\n> 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.\n\n- **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.\n\n**Section B — Triage label vocabulary.**\n\n> 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.\n\nThe five canonical roles:\n\n- `needs-triage` — maintainer needs to evaluate\n- `needs-info` — waiting on reporter\n- `ready-for-agent` — fully specified, AFK-ready (an agent can pick it up with no human context)\n- `ready-for-human` — needs human implementation\n- `wontfix` — will not be actioned\n\nDefault: 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.\n\n**Section C — Domain docs.**\n\n> 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.\n\nConfirm the layout:\n\n- **Single-context** — one `CONTEXT.md` + `docs/adr/` at the repo root. Most repos are this.\n- **Multi-context** — `CONTEXT-MAP.md` at the root pointing to per-context `CONTEXT.md` files (typically a monorepo).\n\n### 3. Confirm and edit\n\nShow the user a draft of:\n\n- The `## Agent skills` block to add to whichever of `CLAUDE.md` / `AGENTS.md` is being edited (see step 4 for selection rules)\n- The contents of `docs/agents/issue-tracker.md`, `docs/agents/triage-labels.md`, `docs/agents/domain.md`\n\nLet them edit before writing.\n\n### 4. Write\n\n**Pick the file to edit:**\n\n- If `CLAUDE.md` exists, edit it.\n- Else if `AGENTS.md` exists, edit it.\n- If neither exists, ask the user which one to create — don't pick for them.\n\nNever create `AGENTS.md` when `CLAUDE.md` already exists (or vice versa) — always edit the one that's already there.\n\nIf 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.\n\nThe block:\n\n```markdown\n## Agent skills\n\n### Issue tracker\n\n[one-line summary of where issues are tracked, plus whether external PRs are a triage surface]. See `docs/agents/issue-tracker.md`.\n\n### Triage labels\n\n[one-line summary of the label vocabulary]. See `docs/agents/triage-labels.md`.\n\n### Domain docs\n\n[one-line summary of layout — \"single-context\" or \"multi-context\"]. See `docs/agents/domain.md`.\n```\n\nThen write the three docs files using the seed templates in this skill folder as a starting point:\n\n- [issue-tracker-github.md](./issue-tracker-github.md) — GitHub issue tracker\n- [issue-tracker-gitlab.md](./issue-tracker-gitlab.md) — GitLab issue tracker\n- [issue-tracker-local.md](./issue-tracker-local.md) — local-markdown issue tracker\n- [triage-labels.md](./triage-labels.md) — label mapping\n- [domain.md](./domain.md) — domain doc consumer rules + layout\n\nFor \"other\" issue trackers, write `docs/agents/issue-tracker.md` from scratch using the user's description.\n\n### 5. Done\n\nTell 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.\n\n<!-- File: .agents/skills/setup-matt-pocock-skills/triage-labels.md (Tokens: ~216 | Category: anthropic-skill) -->\n# Triage Labels\n\nThe 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.\n\n| Label in mattpocock/skills | Label in our tracker | Meaning                                  |\n| -------------------------- | -------------------- | ---------------------------------------- |\n| `needs-triage`             | `needs-triage`       | Maintainer needs to evaluate this issue  |\n| `needs-info`               | `needs-info`         | Waiting on reporter for more information |\n| `ready-for-agent`          | `ready-for-agent`    | Fully specified, ready for an AFK agent  |\n| `ready-for-human`          | `ready-for-human`    | Requires human implementation            |\n| `wontfix`                  | `wontfix`            | Will not be actioned                     |\n\nWhen a skill mentions a role (e.g. \"apply the AFK-ready triage label\"), use the corresponding label string from this table.\n\nEdit the right-hand column to match whatever vocabulary you actually use.\n\n<!-- File: .agents/skills/tdd/mocking.md (Tokens: ~331 | Category: anthropic-skill) -->\n# When to Mock\n\nMock at **system boundaries** only:\n\n- External APIs (payment, email, etc.)\n- Databases (sometimes - prefer test DB)\n- Time/randomness\n- File system (sometimes)\n\nDon't mock:\n\n- Your own classes/modules\n- Internal collaborators\n- Anything you control\n\n## Designing for Mockability\n\nAt system boundaries, design interfaces that are easy to mock:\n\n**1. Use dependency injection**\n\nPass external dependencies in rather than creating them internally:\n\n```typescript\n// Easy to mock\nfunction processPayment(order, paymentClient) {\n  return paymentClient.charge(order.total);\n}\n\n// Hard to mock\nfunction processPayment(order) {\n  const client = new StripeClient(process.env.STRIPE_KEY);\n  return client.charge(order.total);\n}\n```\n\n**2. Prefer SDK-style interfaces over generic fetchers**\n\nCreate specific functions for each external operation instead of one generic function with conditional logic:\n\n```typescript\n// GOOD: Each function is independently mockable\nconst api = {\n  getUser: (id) => fetch(`/users/${id}`),\n  getOrders: (userId) => fetch(`/users/${userId}/orders`),\n  createOrder: (data) => fetch('/orders', { method: 'POST', body: data }),\n};\n\n// BAD: Mocking requires conditional logic inside the mock\nconst api = {\n  fetch: (endpoint, options) => fetch(endpoint, options),\n};\n```\n\nThe SDK approach means:\n- Each mock returns one specific shape\n- No conditional logic in test setup\n- Easier to see which endpoints a test exercises\n- Type safety per endpoint\n\n<!-- File: .agents/skills/tdd/refactoring.md (Tokens: ~87 | Category: anthropic-skill) -->\n# Refactor Candidates\n\nAfter TDD cycle, look for:\n\n- **Duplication** → Extract function/class\n- **Long methods** → Break into private helpers (keep tests on public interface)\n- **Shallow modules** → Combine or deepen\n- **Feature envy** → Move logic to where data lives\n- **Primitive obsession** → Introduce value objects\n- **Existing code** the new code reveals as problematic\n\n<!-- File: .agents/skills/tdd/SKILL.md (Tokens: ~958 | Category: anthropic-skill) -->\n---\nname: tdd\ndescription: Test-driven development. Use when the user wants to build features or fix bugs test-first, mentions \"red-green-refactor\", or wants integration tests.\n---\n\n# Test-Driven Development\n\n## Philosophy\n\n**Core principle**: Tests should verify behavior through public interfaces, not implementation details. Code can change entirely; tests shouldn't.\n\n**Good tests** are integration-style: they exercise real code paths through public APIs. They describe _what_ the system does, not _how_ it does it. A good test reads like a specification - \"user can checkout with valid cart\" tells you exactly what capability exists. These tests survive refactors because they don't care about internal structure.\n\n**Bad tests** are coupled to implementation. They mock internal collaborators, test private methods, or verify through external means (like querying a database directly instead of using the interface). The warning sign: your test breaks when you refactor, but behavior hasn't changed. If you rename an internal function and tests fail, those tests were testing implementation, not behavior.\n\nSee [tests.md](tests.md) for examples and [mocking.md](mocking.md) for mocking guidelines.\n\n## Anti-Pattern: Horizontal Slices\n\n**DO NOT write all tests first, then all implementation.** This is \"horizontal slicing\" - treating RED as \"write all tests\" and GREEN as \"write all code.\"\n\nThis produces **crap tests**:\n\n- Tests written in bulk test _imagined_ behavior, not _actual_ behavior\n- You end up testing the _shape_ of things (data structures, function signatures) rather than user-facing behavior\n- Tests become insensitive to real changes - they pass when behavior breaks, fail when behavior is fine\n- You outrun your headlights, committing to test structure before understanding the implementation\n\n**Correct approach**: Vertical slices via tracer bullets. One test → one implementation → repeat. Each test responds to what you learned from the previous cycle. Because you just wrote the code, you know exactly what behavior matters and how to verify it.\n\n```\nWRONG (horizontal):\n  RED:   test1, test2, test3, test4, test5\n  GREEN: impl1, impl2, impl3, impl4, impl5\n\nRIGHT (vertical):\n  RED→GREEN: test1→impl1\n  RED→GREEN: test2→impl2\n  RED→GREEN: test3→impl3\n  ...\n```\n\n## Workflow\n\n### 1. Planning\n\nWhen exploring the codebase, read `CONTEXT.md` (if it exists) so that test names and interface vocabulary match the project's domain language, and respect ADRs in the area you're touching.\n\nBefore writing any code:\n\n- [ ] Confirm with user what interface changes are needed\n- [ ] Confirm with user which behaviors to test (prioritize)\n- [ ] Identify opportunities for deep modules (small interface, deep implementation) — run the `/codebase-design` skill for the vocabulary and the testability checks\n- [ ] List the behaviors to test (not implementation steps)\n- [ ] Get user approval on the plan\n\nAsk: \"What should the public interface look like? Which behaviors are most important to test?\"\n\n**You can't test everything.** Confirm with the user exactly which behaviors matter most. Focus testing effort on critical paths and complex logic, not every possible edge case.\n\n### 2. Tracer Bullet\n\nWrite ONE test that confirms ONE thing about the system:\n\n```\nRED:   Write test for first behavior → test fails\nGREEN: Write minimal code to pass → test passes\n```\n\nThis is your tracer bullet - proves the path works end-to-end.\n\n### 3. Incremental Loop\n\nFor each remaining behavior:\n\n```\nRED:   Write next test → fails\nGREEN: Minimal code to pass → passes\n```\n\nRules:\n\n- One test at a time\n- Only enough code to pass current test\n- Don't anticipate future tests\n- Keep tests focused on observable behavior\n\n### 4. Refactor\n\nAfter all tests pass, look for [refactor candidates](refactoring.md):\n\n- [ ] Extract duplication\n- [ ] Deepen modules (move complexity behind simple interfaces)\n- [ ] Apply SOLID principles where natural\n- [ ] Consider what new code reveals about existing code\n- [ ] Run tests after each refactor step\n\n**Never refactor while RED.** Get to GREEN first.\n\n## Checklist Per Cycle\n\n```\n[ ] Test describes behavior, not implementation\n[ ] Test uses public interface only\n[ ] Test would survive internal refactor\n[ ] Code is minimal for this test\n[ ] No speculative features added\n```\n\n<!-- File: .agents/skills/tdd/tests.md (Tokens: ~359 | Category: anthropic-skill) -->\n# Good and Bad Tests\n\n## Good Tests\n\n**Integration-style**: Test through real interfaces, not mocks of internal parts.\n\n```typescript\n// GOOD: Tests observable behavior\ntest(\"user can checkout with valid cart\", async () => {\n  const cart = createCart();\n  cart.add(product);\n  const result = await checkout(cart, paymentMethod);\n  expect(result.status).toBe(\"confirmed\");\n});\n```\n\nCharacteristics:\n\n- Tests behavior users/callers care about\n- Uses public API only\n- Survives internal refactors\n- Describes WHAT, not HOW\n- One logical assertion per test\n\n## Bad Tests\n\n**Implementation-detail tests**: Coupled to internal structure.\n\n```typescript\n// BAD: Tests implementation details\ntest(\"checkout calls paymentService.process\", async () => {\n  const mockPayment = jest.mock(paymentService);\n  await checkout(cart, payment);\n  expect(mockPayment.process).toHaveBeenCalledWith(cart.total);\n});\n```\n\nRed flags:\n\n- Mocking internal collaborators\n- Testing private methods\n- Asserting on call counts/order\n- Test breaks when refactoring without behavior change\n- Test name describes HOW not WHAT\n- Verifying through external means instead of interface\n\n```typescript\n// BAD: Bypasses interface to verify\ntest(\"createUser saves to database\", async () => {\n  await createUser({ name: \"Alice\" });\n  const row = await db.query(\"SELECT * FROM users WHERE name = ?\", [\"Alice\"]);\n  expect(row).toBeDefined();\n});\n\n// GOOD: Verifies through interface\ntest(\"createUser makes user retrievable\", async () => {\n  const user = await createUser({ name: \"Alice\" });\n  const retrieved = await getUser(user.id);\n  expect(retrieved.name).toBe(\"Alice\");\n});\n```\n\n<!-- File: .agents/skills/teach/GLOSSARY-FORMAT.md (Tokens: ~488 | Category: anthropic-skill) -->\n# GLOSSARY.md Format\n\n`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.\n\n## Structure\n\n```md\n# {Topic} Glossary\n\n{One or two sentence description of the topic this glossary covers.}\n\n## Terms\n\n**Hypertrophy**:\nMuscle growth driven by mechanical tension and metabolic stress over repeated training sessions.\n_Avoid_: Bulking, getting big\n\n**Progressive overload**:\nSystematically increasing the demand on a muscle over time — via load, volume, or intensity.\n_Avoid_: Pushing harder, levelling up\n\n**RPE (Rate of Perceived Exertion)**:\nA 1–10 self-rating of how hard a set felt, where 10 is failure and 8 means two reps left in the tank.\n_Avoid_: Effort score, intensity rating\n```\n\n## Rules\n\n- **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.\n- **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.\n- **Keep definitions tight.** One or two sentences. Define what the term IS, not what it does or how to do it.\n- **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.\n- **Group under subheadings** when natural clusters emerge (e.g. `## Anatomy`, `## Programming`). A flat list is fine when terms cohere.\n- **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.\"\n- **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.\n\n<!-- File: .agents/skills/teach/LEARNING-RECORD-FORMAT.md (Tokens: ~592 | Category: anthropic-skill) -->\n# Learning Record Format\n\nLearning 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.\n\nThey 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.\n\n## Template\n\n```md\n# {Short title of what was learned or established}\n\n{1-3 sentences: what was learned (or what prior knowledge was established), and why it matters for future sessions.}\n```\n\nThat 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.\n\n## Optional sections\n\nOnly include these when they add genuine value. Most records won't need them.\n\n- **Status** frontmatter (`active | superseded by LR-NNNN`) — useful when an earlier understanding turns out to be wrong and is replaced.\n- **Evidence** — how the user demonstrated the understanding (a question answered, an exercise completed, prior experience cited). Useful when the claim might be revisited.\n- **Implications** — what this unlocks or rules out for future sessions. Worth recording when non-obvious.\n\n## Numbering\n\nScan `./learning-records/` for the highest existing number and increment by one.\n\n## When to write a learning record\n\nWrite one when any of these is true:\n\n1. **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.\n2. **The user disclosed prior knowledge** — \"I already know X.\" Record it so future sessions don't re-teach it. Also record the _depth_ claimed.\n3. **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.\n4. **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.\n\n### What does _not_ qualify\n\n- Material that was merely covered. Coverage is not learning. Wait for evidence.\n- Anything already captured tersely in [[GLOSSARY.md]] as a term definition. Don't duplicate.\n- Session-by-session activity logs. Learning records are not a journal — they are decision-grade insights.\n\n## Supersession\n\nWhen 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.\n\n<!-- ... +11 more modular skills available via /api/skills/GreyDGL/PentestGPT?path={path} -->\n</yakaai_skills>"}