@dennisrongo/skills 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +230 -0
- package/bin/claude-skills.js +189 -0
- package/lib/install.js +111 -0
- package/lib/list.js +63 -0
- package/lib/paths.js +39 -0
- package/lib/remove.js +52 -0
- package/lib/skills.js +121 -0
- package/package.json +48 -0
- package/skills/_template/SKILL.md +34 -0
- package/skills/conventional-commits/SKILL.md +136 -0
- package/skills/diagnose/SKILL.md +140 -0
- package/skills/dotnet-onion-api/SKILL.md +267 -0
- package/skills/dotnet-onion-api/references/anti-patterns.md +155 -0
- package/skills/dotnet-onion-api/references/solution-layout.md +113 -0
- package/skills/dotnet-onion-api/references/templates/appsettings.md +75 -0
- package/skills/dotnet-onion-api/references/templates/base-controller.cs.md +90 -0
- package/skills/dotnet-onion-api/references/templates/csproj-files.md +178 -0
- package/skills/dotnet-onion-api/references/templates/dbcontext.cs.md +149 -0
- package/skills/dotnet-onion-api/references/templates/exception-middleware.cs.md +101 -0
- package/skills/dotnet-onion-api/references/templates/feature-slice.md +349 -0
- package/skills/dotnet-onion-api/references/templates/program-cs.md +171 -0
- package/skills/dotnet-onion-api/references/templates/worker-program.cs.md +166 -0
- package/skills/grill-with-docs/SKILL.md +203 -0
- package/skills/handoff/SKILL.md +155 -0
- package/skills/improve-codebase-architecture/DEEPENING.md +37 -0
- package/skills/improve-codebase-architecture/INTERFACE-DESIGN.md +44 -0
- package/skills/improve-codebase-architecture/LANGUAGE.md +53 -0
- package/skills/improve-codebase-architecture/SKILL.md +121 -0
- package/skills/nextjs-app-router/SKILL.md +328 -0
- package/skills/nextjs-app-router/references/anti-patterns.md +203 -0
- package/skills/nextjs-app-router/references/folder-layout.md +151 -0
- package/skills/nextjs-app-router/references/good-patterns.md +212 -0
- package/skills/nextjs-app-router/references/templates/api-base.md +62 -0
- package/skills/nextjs-app-router/references/templates/api-slice.md +75 -0
- package/skills/nextjs-app-router/references/templates/auth-slice.md +95 -0
- package/skills/nextjs-app-router/references/templates/ci-and-hooks.md +94 -0
- package/skills/nextjs-app-router/references/templates/components-json.md +41 -0
- package/skills/nextjs-app-router/references/templates/env-and-utils.md +110 -0
- package/skills/nextjs-app-router/references/templates/eslint-prettier.md +82 -0
- package/skills/nextjs-app-router/references/templates/feature-slice.md +184 -0
- package/skills/nextjs-app-router/references/templates/form-with-zod.md +192 -0
- package/skills/nextjs-app-router/references/templates/middleware.md +88 -0
- package/skills/nextjs-app-router/references/templates/next-config.md +42 -0
- package/skills/nextjs-app-router/references/templates/package.md +99 -0
- package/skills/nextjs-app-router/references/templates/providers-and-store.md +79 -0
- package/skills/nextjs-app-router/references/templates/root-layout.md +146 -0
- package/skills/nextjs-app-router/references/templates/route-group-layouts.md +90 -0
- package/skills/nextjs-app-router/references/templates/tailwind-config.md +89 -0
- package/skills/nextjs-app-router/references/templates/testing.md +137 -0
- package/skills/nextjs-app-router/references/templates/tsconfig.md +40 -0
- package/skills/plan-and-build/SKILL.md +214 -0
- package/skills/pr-review/SKILL.md +132 -0
- package/skills/write-a-skill/SKILL.md +191 -0
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: grill-with-docs
|
|
3
|
+
description: Interview-driven design review. Stress-tests a plan, idea, RFC, or feature description against the project's existing domain model, terminology, and documented decisions — and crystallises the resolution into `CONTEXT.md` (glossary) and `docs/adr/` (ADRs) inline as terms settle. No production code is written. Use this skill whenever the user says "grill me", "grill this", "stress-test this plan", "challenge this design", "validate against the domain", "sharpen the terminology", "review the docs", "/grill-with-docs", or pastes a design / RFC / feature idea and wants it pressure-tested before any implementation — even if they don't name the skill.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Grill with Docs
|
|
7
|
+
|
|
8
|
+
A pre-implementation design review. Sit across the table from the user, ask one sharp question at a time, cross-reference the answers against the codebase and the project's documented decisions, and update the canonical docs in-flight as terms harden. The output is a sharper plan and tightened documentation — not code.
|
|
9
|
+
|
|
10
|
+
## When to use this skill
|
|
11
|
+
|
|
12
|
+
Trigger on any of:
|
|
13
|
+
|
|
14
|
+
- "grill me" / "grill this plan" / "stress-test this"
|
|
15
|
+
- "challenge this design" / "validate against the domain"
|
|
16
|
+
- "sharpen the terminology" / "review the language"
|
|
17
|
+
- "/grill-with-docs"
|
|
18
|
+
- The user pastes a design doc, RFC, ticket, or feature spec and asks for review **before** building
|
|
19
|
+
- The user is exploring whether an approach fits the existing model and isn't ready to commit to implementation
|
|
20
|
+
|
|
21
|
+
Do **not** use this skill for:
|
|
22
|
+
|
|
23
|
+
- A request to actually build the feature — use [`plan-and-build`](../plan-and-build/SKILL.md) (its Phase 1 grills, then it implements).
|
|
24
|
+
- A bug or regression — use [`diagnose`](../diagnose/SKILL.md).
|
|
25
|
+
- A one-line clarification question. Just answer it.
|
|
26
|
+
|
|
27
|
+
If the user wants to build *after* grilling, hand off to `plan-and-build` and let it open Plan Mode with the sharpened spec.
|
|
28
|
+
|
|
29
|
+
## Core principles
|
|
30
|
+
|
|
31
|
+
- **One question at a time.** Always use `AskUserQuestion` with 2–4 concrete options and a recommended pick first (matches the convention used by [`plan-and-build`](../plan-and-build/SKILL.md)). Never stack three questions in one message — the user can only think clearly about one branch of the design tree at a time.
|
|
32
|
+
- **Explore before asking.** If the answer is in the code, read it. Don't ask the user what `OrderService.Cancel` does when you can open the file. Ask only the questions the code can't answer.
|
|
33
|
+
- **Terminology rigor.** Surface conflicts between the user's words and the glossary on the spot. Challenge vague or overloaded terms with the canonical alternative. If the user says "account", check whether the glossary distinguishes `Customer` from `User` — and force a choice.
|
|
34
|
+
- **Probe with concrete scenarios.** Invent edge cases that make abstract language fail. "What happens when two users press *Cancel* on the same order within 50ms?"
|
|
35
|
+
- **Contradiction surfacing.** When stated intent contradicts what the code already does, name the discrepancy explicitly and ask which wins. Don't paper over it.
|
|
36
|
+
- **In-the-moment doc updates.** The moment a fuzzy term resolves, write the glossary entry into `CONTEXT.md`. Don't batch — batched updates get dropped.
|
|
37
|
+
- **No code.** This skill writes only to `CONTEXT.md`, `CONTEXT-MAP.md`, and `docs/adr/*.md`. Never edit source files, never run migrations, never run tests. If the conversation reveals a code-level bug, note it and stop — that's a separate task.
|
|
38
|
+
|
|
39
|
+
## Phase 1 — Locate the canonical docs
|
|
40
|
+
|
|
41
|
+
Before the first question, find the project's documentation seams. Use `Glob` / `Grep` / `Read` in parallel:
|
|
42
|
+
|
|
43
|
+
- `CONTEXT.md` at the repo root — the glossary of canonical domain terms.
|
|
44
|
+
- `CONTEXT-MAP.md` at the root — for multi-bounded-context repos: how contexts relate, which terms are translated at boundaries.
|
|
45
|
+
- `src/<context>/CONTEXT.md` — per-context glossaries when the repo is multi-context.
|
|
46
|
+
- `docs/adr/` (or `docs/decisions/`, `docs/architecture/decisions/`) — Architecture Decision Records.
|
|
47
|
+
- `README.md`, `ARCHITECTURE.md`, `CLAUDE.md` — secondary sources for project-specific language.
|
|
48
|
+
|
|
49
|
+
Record what exists. **Do not create any of these files yet.** Only create them when a Phase 2 conversation produces a definite entry to put in them.
|
|
50
|
+
|
|
51
|
+
If **none** of these exist, that's fine — flag it once to the user, propose the lightest-weight convention (`CONTEXT.md` at root), and proceed. Don't lecture.
|
|
52
|
+
|
|
53
|
+
## Phase 2 — Grill
|
|
54
|
+
|
|
55
|
+
Walk down the design tree one decision at a time, resolving dependencies before moving on. The areas below are a checklist — skip the ones the user's input has already nailed, and dig into the ones it hasn't.
|
|
56
|
+
|
|
57
|
+
- **Intent.** What problem does this solve, for whom, and what observable outcome proves it worked?
|
|
58
|
+
- **Terminology.** Every noun and every verb the user used. Does it match the glossary? If not — does the glossary need to change, or does the user's language?
|
|
59
|
+
- **Boundaries.** Which bounded context owns this? Does it cross a context boundary, and if so, what's the translation?
|
|
60
|
+
- **Domain shape.** Which entities, value objects, aggregates are involved. Existing or new. If new, why isn't it an extension of an existing one?
|
|
61
|
+
- **Behaviour vs. data.** Is the user describing a state change, a query, an event, or a process? "Cancel" is a verb that hides three different operations.
|
|
62
|
+
- **Authorization.** Who's allowed to do this, and under what conditions? Tenant scoping?
|
|
63
|
+
- **Side effects.** Emails, queue messages, audit log entries, cache invalidation, webhooks. Each is a design decision.
|
|
64
|
+
- **Concurrency.** What happens under simultaneous calls, retries, partial failure?
|
|
65
|
+
- **Edge cases.** Empty inputs, max sizes, unicode, timezones, deleted-but-referenced rows.
|
|
66
|
+
- **Observability.** What gets logged / traced / metricked, and what's the alert threshold?
|
|
67
|
+
- **Trade-offs.** For any choice with more than one defensible answer, name the alternative and the reason for the pick. This is what makes the conversation ADR-worthy.
|
|
68
|
+
|
|
69
|
+
### How to phrase the questions
|
|
70
|
+
|
|
71
|
+
Use `AskUserQuestion`. Lead with the recommendation, append "(Recommended)" to its label, and keep options mutually exclusive. Examples:
|
|
72
|
+
|
|
73
|
+
- "Is `priority` a boolean flag or an ordered priority (1–N)?" — options: *Boolean* (Recommended), *Ordered 1–N*, *Bucketed (low/med/high)*.
|
|
74
|
+
- "What does *cancel* mean for an order?" — options: *Status transition to `Cancelled`, row retained* (Recommended), *Soft-delete with `DeletedAt`*, *Hard-delete row*.
|
|
75
|
+
- "Which role can call this?" — options: *`Owner` only* (Recommended), *`Owner` or `Admin`*, *Anyone authenticated*.
|
|
76
|
+
|
|
77
|
+
If the user goes off-piste or picks "Other", absorb their answer, restate it in canonical terms, and continue.
|
|
78
|
+
|
|
79
|
+
## Phase 3 — Update docs in-flight
|
|
80
|
+
|
|
81
|
+
As decisions crystallise, write them immediately. Two artefacts only.
|
|
82
|
+
|
|
83
|
+
### `CONTEXT.md` — pure glossary
|
|
84
|
+
|
|
85
|
+
`CONTEXT.md` is a **glossary**, not a spec. Each entry is a canonical term plus a one- or two-sentence definition. No implementation details, no API shapes, no diagrams.
|
|
86
|
+
|
|
87
|
+
```markdown
|
|
88
|
+
## Order
|
|
89
|
+
|
|
90
|
+
A customer's request for one or more SKUs at an agreed price. Distinct from a **Cart** (pre-confirmation) and a **Shipment** (post-fulfilment). An `Order` is identified by `OrderId` and is owned by exactly one `Customer`.
|
|
91
|
+
|
|
92
|
+
## Cancel (an Order)
|
|
93
|
+
|
|
94
|
+
A status transition from `Pending` → `Cancelled`. The row is retained for audit. Does not delete child `OrderLine` rows. Triggers an `OrderCancelled` domain event.
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Rules for `CONTEXT.md`:
|
|
98
|
+
|
|
99
|
+
- Alphabetical or grouped by aggregate — pick one and stick with it.
|
|
100
|
+
- One sentence is plenty. Two if a contrast with another term is load-bearing.
|
|
101
|
+
- Cross-link related terms in **bold** when first introduced in another entry.
|
|
102
|
+
- Never restate code — if the reader needs the field list, they read the type.
|
|
103
|
+
- Add to it in the same response that resolves a fuzzy term. Don't queue updates.
|
|
104
|
+
|
|
105
|
+
### ADRs — only when all three conditions hold
|
|
106
|
+
|
|
107
|
+
Create an ADR only when **all** of:
|
|
108
|
+
|
|
109
|
+
1. **Hard to reverse.** Changing the decision later would require coordinated migration, data backfill, or breaking API consumers.
|
|
110
|
+
2. **Non-obvious.** A future reader, given only the code, would not see why this choice was made.
|
|
111
|
+
3. **Real trade-offs.** There was at least one defensible alternative that was rejected for a stated reason.
|
|
112
|
+
|
|
113
|
+
If any one of those is missing, don't write an ADR. A glossary entry or a code comment is enough.
|
|
114
|
+
|
|
115
|
+
#### ADR template
|
|
116
|
+
|
|
117
|
+
Drop into `docs/adr/NNNN-short-title-kebab.md`, numbered sequentially after the highest existing ADR:
|
|
118
|
+
|
|
119
|
+
```markdown
|
|
120
|
+
# NNNN. <Short imperative title>
|
|
121
|
+
|
|
122
|
+
- **Status:** Proposed | Accepted | Superseded by [ADR-XXXX](XXXX-other.md)
|
|
123
|
+
- **Date:** YYYY-MM-DD
|
|
124
|
+
- **Deciders:** <names / roles>
|
|
125
|
+
|
|
126
|
+
## Context
|
|
127
|
+
|
|
128
|
+
What forces are in play? What constraint, incident, or new requirement triggered this decision? Two to five sentences.
|
|
129
|
+
|
|
130
|
+
## Decision
|
|
131
|
+
|
|
132
|
+
The choice, stated in the active voice. "We will <do X>." One paragraph.
|
|
133
|
+
|
|
134
|
+
## Consequences
|
|
135
|
+
|
|
136
|
+
What becomes easier, what becomes harder, what we now have to maintain. Bullet points.
|
|
137
|
+
|
|
138
|
+
## Alternatives considered
|
|
139
|
+
|
|
140
|
+
- **<Option A>** — why rejected (one sentence).
|
|
141
|
+
- **<Option B>** — why rejected (one sentence).
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
Keep ADRs immutable once accepted. If the decision changes, write a new ADR that supersedes the old one and mark the old one `Superseded by`.
|
|
145
|
+
|
|
146
|
+
## Phase 4 — Exit criteria
|
|
147
|
+
|
|
148
|
+
Stop grilling when **any** of these are true. Don't pad the conversation.
|
|
149
|
+
|
|
150
|
+
- Further questions stop changing the design — the next question's answer wouldn't move a file or change a name.
|
|
151
|
+
- All terms in the user's spec have a matching `CONTEXT.md` entry (existing or just-added) and no contradictions remain.
|
|
152
|
+
- The user explicitly signals "good enough" — accept it, but quickly note any genuinely open questions you can see.
|
|
153
|
+
- The conversation has revealed that the right next step is **not** to grill further but to prototype, diagnose, or pick a different scope. Say so and stop.
|
|
154
|
+
|
|
155
|
+
When you stop, produce a short closing summary:
|
|
156
|
+
|
|
157
|
+
- **Decisions captured:** glossary entries added/updated (paths), ADRs created (paths and titles).
|
|
158
|
+
- **Resolved terminology:** a 1–2 line list of the terms that changed meaning during the session.
|
|
159
|
+
- **Open questions:** anything the user deferred — name them so they're not lost.
|
|
160
|
+
- **Suggested next step:** usually a handoff to [`plan-and-build`](../plan-and-build/SKILL.md), occasionally [`diagnose`](../diagnose/SKILL.md), occasionally "ship a spike first".
|
|
161
|
+
|
|
162
|
+
## Anti-patterns
|
|
163
|
+
|
|
164
|
+
- Asking three questions in one message. One at a time, with options.
|
|
165
|
+
- Asking the user something the codebase already answers. Read first, ask second.
|
|
166
|
+
- Letting a vague term ("account", "user", "delete", "cancel", "process") slide because the user used it confidently.
|
|
167
|
+
- Adding code, tests, or migrations during this skill. Out of scope.
|
|
168
|
+
- Writing an ADR for a decision that's easily reversed, obvious from the code, or had no real alternative.
|
|
169
|
+
- Padding `CONTEXT.md` with field-by-field type breakdowns. It's a glossary, not a schema dump.
|
|
170
|
+
- Continuing to grill after the user has clearly signalled they have enough to proceed.
|
|
171
|
+
- Batching glossary updates "until the end". They get forgotten.
|
|
172
|
+
|
|
173
|
+
## Examples
|
|
174
|
+
|
|
175
|
+
### Example 1: Stress-testing a "priority orders" idea
|
|
176
|
+
|
|
177
|
+
**User:** "We want customers to mark orders as priority. Grill me before I build it."
|
|
178
|
+
|
|
179
|
+
**Claude:**
|
|
180
|
+
1. **Phase 1.** Reads `CONTEXT.md` (finds `Order`, `Customer`, no `Priority` term) and the most recent ADR (`docs/adr/0007-soft-delete-orders.md`).
|
|
181
|
+
2. **Phase 2.** Asks via `AskUserQuestion`: *"Is `priority` a boolean flag or an ordered priority (1–N)?"* — recommends *Boolean*. User picks Boolean. Next: *"What does 'priority' actually change — sort order in API responses, or routing in the background processor?"* User: *both*. Next: *"Can a non-Owner role set priority?"* — checks `[Authorize]` usage on `OrdersController`, sees `Owner`-only convention, recommends *Owner only*. User agrees. Next: *"Is setting priority idempotent — does setting it twice produce one audit row or two?"* — recommends *idempotent, one audit row*. User picks that. Surfaces contradiction: *"You said 'bump in the queue' but `BackgroundOrderProcessor` is FIFO with no priority hook — adding one is a separate change. In scope or out?"* User: out of scope for v1.
|
|
182
|
+
3. **Phase 3.** Adds `Priority` and `SetPriority` entries to `CONTEXT.md`. Decides *not* to write an ADR — the choice is easily reversed (drop the column) and the alternative (numeric priority) was a one-sentence rejection.
|
|
183
|
+
4. **Phase 4.** Closes with: glossary updated, no ADR needed, one open question (queue routing deferred), suggests handing off to `plan-and-build` for implementation.
|
|
184
|
+
|
|
185
|
+
### Example 2: A decision that *does* warrant an ADR
|
|
186
|
+
|
|
187
|
+
**User:** "We're thinking of moving from synchronous webhook delivery to a queue. Grill me."
|
|
188
|
+
|
|
189
|
+
**Claude:** Grills around: delivery guarantees, ordering, retry policy, poison-message handling, observability, cost. Discovers user wants at-least-once with idempotency keys. Surfaces that the existing `WebhookDispatcher` is synchronous and that consumers currently assume in-order delivery. Updates `CONTEXT.md` with `WebhookDelivery` and `IdempotencyKey` entries. Writes `docs/adr/0012-async-webhook-delivery-via-queue.md` — hard to reverse (consumers must handle out-of-order), non-obvious (sync was the obvious default), and there were genuine alternatives (sync with retries, outbox pattern, hosted webhook service). Hands off to `plan-and-build`.
|
|
190
|
+
|
|
191
|
+
### Example 3: User pushes back on the grilling
|
|
192
|
+
|
|
193
|
+
**User:** "I just want to add a `DeletedAt` column. You don't need to grill me."
|
|
194
|
+
|
|
195
|
+
**Claude:** Compresses to the questions whose answers actually change the design: *"Soft-delete or hard-delete?"*, *"Should existing queries opt in to seeing deleted rows or opt out?"*, *"Cascade to child entities?"* Adds the resolved `Delete (a User)` entry to `CONTEXT.md`. Skips the ADR (easily reversed). Closes in three turns and points to `plan-and-build`.
|
|
196
|
+
|
|
197
|
+
## Notes
|
|
198
|
+
|
|
199
|
+
- **Composes with** [`plan-and-build`](../plan-and-build/SKILL.md): grill first, then hand off the sharpened spec. `plan-and-build`'s Phase 1 self-contains a grill for small features; this skill is for the larger / fuzzier ones that deserve a standalone pass.
|
|
200
|
+
- **Composes with** [`diagnose`](../diagnose/SKILL.md) only loosely — if grilling reveals the real problem is "something is broken" rather than "we want to design something new", stop and switch skills.
|
|
201
|
+
- If `CONTEXT.md` doesn't exist yet and the user agrees to start one, seed it with the terms surfaced in the first session — don't dump every domain noun in the codebase. Glossaries earn their entries.
|
|
202
|
+
- ADRs are immutable once accepted. If the decision later changes, write a new ADR that supersedes it. Don't edit history.
|
|
203
|
+
- Adapted from Matt Pocock's [`grill-with-docs`](https://github.com/mattpocock/skills/blob/main/skills/engineering/grill-with-docs/SKILL.md) — interview rigor, terminology focus, in-flight doc updates, selective ADRs — and extended with explicit triggers, `AskUserQuestion` conventions, exit criteria, an ADR template, and composition with this library's other skills.
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: handoff
|
|
3
|
+
description: Capture a session hand-off so work can resume cleanly in a new Claude session before context runs out. Writes a canonical dated Markdown file (objective, progress, decisions, files, open issues, and a ready-to-paste "Next Session Prompt") AND a lightweight project-memory pointer to it. Use this skill whenever the user says "/handoff", "hand off", "handoff", "save context", "preserve context", "running out of context", "wrap up for next session", "before we lose context", or otherwise asks to snapshot the current state for a fresh session — even if they don't say "skill".
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Handoff
|
|
7
|
+
|
|
8
|
+
Preserve everything the next Claude session needs to pick up where this one left off. The hand-off is a real artifact (a Markdown file in the repo) plus a small memory pointer so future sessions auto-discover it.
|
|
9
|
+
|
|
10
|
+
## When to use this skill
|
|
11
|
+
|
|
12
|
+
- The user runs `/handoff` or types "handoff" / "hand off".
|
|
13
|
+
- The user says any of: "save context", "preserve context", "running out of context", "before we lose context", "wrap up for next session", "snapshot where we are", "I need to start a new session".
|
|
14
|
+
- The user signals they're about to compact, switch machines, or hand the work to another teammate / another Claude session.
|
|
15
|
+
- You notice the conversation has accumulated significant state (many files touched, several decisions made) and the user explicitly asks to checkpoint.
|
|
16
|
+
|
|
17
|
+
Do **not** auto-trigger when the user just says "let's stop here" without asking for continuity. Wait for an explicit hand-off cue.
|
|
18
|
+
|
|
19
|
+
## Output: two artifacts
|
|
20
|
+
|
|
21
|
+
Every invocation produces BOTH:
|
|
22
|
+
|
|
23
|
+
### 1. Canonical Markdown file (the source of truth)
|
|
24
|
+
|
|
25
|
+
- **Path:** `.claude/handoffs/<YYYY-MM-DD>-<short-slug>.md` in the current project root.
|
|
26
|
+
- Date is today's date, ISO format.
|
|
27
|
+
- Slug is 2–4 kebab-case words describing the work (e.g. `oauth-account-linking`, `cache-invalidation-fix`).
|
|
28
|
+
- If a file with that exact name already exists, append `-2`, `-3`, etc.
|
|
29
|
+
- **Create the parent directory if missing** (`.claude/handoffs/`).
|
|
30
|
+
- Use the exact section structure below.
|
|
31
|
+
|
|
32
|
+
### 2. Lightweight memory pointer (for future-session discovery)
|
|
33
|
+
|
|
34
|
+
Write a **project**-type memory entry per the auto-memory system. Keep it short — its only job is to surface the hand-off file:
|
|
35
|
+
|
|
36
|
+
```markdown
|
|
37
|
+
---
|
|
38
|
+
name: handoff-<short-slug>
|
|
39
|
+
description: Hand-off doc for <one-line topic> — see file for full state.
|
|
40
|
+
metadata:
|
|
41
|
+
type: project
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
Active hand-off for <topic> at `<relative path to handoff file>`.
|
|
45
|
+
|
|
46
|
+
**Why:** Session was checkpointed on <YYYY-MM-DD> to resume work cleanly in a new context.
|
|
47
|
+
**How to apply:** When the user opens a new session and references this topic, read the hand-off file first before doing anything else. Remove this memory entry once the work is finished or superseded.
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Then add the standard one-line pointer to `MEMORY.md`.
|
|
51
|
+
|
|
52
|
+
## Required sections in the hand-off file
|
|
53
|
+
|
|
54
|
+
Use these headings in this order, with this phrasing. Skip a section only if it would be empty AND irrelevant — don't pad.
|
|
55
|
+
|
|
56
|
+
```markdown
|
|
57
|
+
# Handoff: <topic> — <YYYY-MM-DD>
|
|
58
|
+
|
|
59
|
+
## Objective
|
|
60
|
+
|
|
61
|
+
<1–3 sentences: what are we building / fixing / investigating, and why.>
|
|
62
|
+
|
|
63
|
+
## Progress
|
|
64
|
+
|
|
65
|
+
**Completed:**
|
|
66
|
+
- <done item>
|
|
67
|
+
- <done item>
|
|
68
|
+
|
|
69
|
+
**In Progress:**
|
|
70
|
+
- <what's mid-flight, with enough context to resume>
|
|
71
|
+
|
|
72
|
+
**Blocked:**
|
|
73
|
+
- <blocker> — <on whom / what>
|
|
74
|
+
|
|
75
|
+
## Decisions
|
|
76
|
+
|
|
77
|
+
- <decision> — <why; the reasoning matters more than the choice>
|
|
78
|
+
- <decision> — <why>
|
|
79
|
+
|
|
80
|
+
## Important Files
|
|
81
|
+
|
|
82
|
+
- `<path>` — <one line on what changed or why it matters>
|
|
83
|
+
- `<path>` — <one line>
|
|
84
|
+
|
|
85
|
+
## Open Issues
|
|
86
|
+
|
|
87
|
+
- <unresolved bug, race condition, or question>
|
|
88
|
+
- <unresolved bug, race condition, or question>
|
|
89
|
+
|
|
90
|
+
## Next Session Prompt
|
|
91
|
+
|
|
92
|
+
> Copy-paste this into the new session.
|
|
93
|
+
|
|
94
|
+
Read `.claude/handoffs/<this-filename>.md` first.
|
|
95
|
+
|
|
96
|
+
**Goal:** <one-sentence resume goal>
|
|
97
|
+
|
|
98
|
+
**Start by reviewing:**
|
|
99
|
+
1. `<path>`
|
|
100
|
+
2. `<path>`
|
|
101
|
+
|
|
102
|
+
**Then:**
|
|
103
|
+
- <next concrete step>
|
|
104
|
+
- <next concrete step>
|
|
105
|
+
- <verification command, e.g. `pnpm test auth`>
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
The **Next Session Prompt** is the most important section — it's what the user pastes into the new chat to bootstrap continuity. Write it so a fresh Claude with no prior context can act on it immediately.
|
|
109
|
+
|
|
110
|
+
## Workflow
|
|
111
|
+
|
|
112
|
+
1. **Scan the current conversation** for: the stated objective, files you've read or edited, decisions made (and the reasoning), commands run, errors hit, and open threads.
|
|
113
|
+
2. **Cross-check against the repo state** — run `git status` and `git diff --stat` to confirm which files actually changed in this session. Don't trust memory alone; verify.
|
|
114
|
+
3. **Draft the file content** using the section template above. Pull the *why* behind each decision from the conversation, not just the *what*.
|
|
115
|
+
4. **Pick the filename** — today's date + short slug.
|
|
116
|
+
5. **Create `.claude/handoffs/` if missing**, then write the file with the Write tool.
|
|
117
|
+
6. **Write the memory pointer** to the auto-memory directory and index it in `MEMORY.md`.
|
|
118
|
+
7. **Report back**: tell the user the file path, the slug, and quote the Next Session Prompt so they can copy it without opening the file.
|
|
119
|
+
|
|
120
|
+
## Verifying before you write
|
|
121
|
+
|
|
122
|
+
- If you reference a file path, confirm it exists (or that you created it this session).
|
|
123
|
+
- If you reference a command, make sure it's the one that actually works in this repo (check `package.json`, `Makefile`, etc.).
|
|
124
|
+
- If a decision in the conversation was reversed later, record the final decision — not the abandoned one.
|
|
125
|
+
|
|
126
|
+
## Examples
|
|
127
|
+
|
|
128
|
+
### Example 1: Mid-feature checkpoint
|
|
129
|
+
|
|
130
|
+
**User:** "ok let's handoff, I'm running low on context"
|
|
131
|
+
|
|
132
|
+
**Claude:**
|
|
133
|
+
1. Runs `git status`, scans recent edits.
|
|
134
|
+
2. Writes `.claude/handoffs/2026-05-15-oauth-account-linking.md` with all six sections filled in.
|
|
135
|
+
3. Writes memory pointer `handoff-oauth-account-linking.md` and updates `MEMORY.md`.
|
|
136
|
+
4. Replies with: file path, a one-line summary, and the Next Session Prompt block ready to paste.
|
|
137
|
+
|
|
138
|
+
### Example 2: User pastes the Next Session Prompt into a fresh chat
|
|
139
|
+
|
|
140
|
+
The new session reads the referenced hand-off file first, confirms files still exist, and resumes from the **Next Session Prompt** to-do list — no rediscovery needed.
|
|
141
|
+
|
|
142
|
+
## Anti-patterns
|
|
143
|
+
|
|
144
|
+
- Writing the hand-off without checking `git status` — drift between conversation memory and actual repo state.
|
|
145
|
+
- Vague "next steps" like "continue the work" — write concrete actions tied to specific files.
|
|
146
|
+
- Recording every micro-decision — keep **Decisions** to choices that would be re-litigated otherwise.
|
|
147
|
+
- Dumping the entire conversation transcript — hand-off is a synthesis, not a log.
|
|
148
|
+
- Forgetting the memory pointer — without it, the next session won't know the hand-off exists unless the user remembers to paste the prompt.
|
|
149
|
+
- Skipping the **Next Session Prompt** section — that's the single highest-value piece of the doc.
|
|
150
|
+
|
|
151
|
+
## Notes
|
|
152
|
+
|
|
153
|
+
- Hand-off files are project-scoped and **should be git-ignored or committed deliberately** — they may contain in-progress reasoning the team doesn't want in history. Add `.claude/handoffs/` to `.gitignore` unless the project has explicitly opted in to committing them.
|
|
154
|
+
- Once a hand-off is superseded (work finished, or a newer hand-off written for the same topic), delete the memory pointer so it doesn't accumulate stale entries. The Markdown file can stay as historical record.
|
|
155
|
+
- If the project already has a different conventional location for session notes (e.g. `docs/handoffs/`, `NOTES.md`), prefer that location and tell the user you're using it.
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Deepening
|
|
2
|
+
|
|
3
|
+
How to deepen a cluster of shallow modules safely, given its dependencies. Assumes the vocabulary in [LANGUAGE.md](LANGUAGE.md) — **module**, **interface**, **seam**, **adapter**.
|
|
4
|
+
|
|
5
|
+
## Dependency categories
|
|
6
|
+
|
|
7
|
+
When assessing a candidate for deepening, classify its dependencies. The category determines how the deepened module is tested across its seam.
|
|
8
|
+
|
|
9
|
+
### 1. In-process
|
|
10
|
+
|
|
11
|
+
Pure computation, in-memory state, no I/O. Always deepenable — merge the modules and test through the new interface directly. No adapter needed.
|
|
12
|
+
|
|
13
|
+
### 2. Local-substitutable
|
|
14
|
+
|
|
15
|
+
Dependencies that have local test stand-ins (PGLite for Postgres, in-memory filesystem). Deepenable if the stand-in exists. The deepened module is tested with the stand-in running in the test suite. The seam is internal; no port at the module's external interface.
|
|
16
|
+
|
|
17
|
+
### 3. Remote but owned (Ports & Adapters)
|
|
18
|
+
|
|
19
|
+
Your own services across a network boundary (microservices, internal APIs). Define a **port** (interface) at the seam. The deep module owns the logic; the transport is injected as an **adapter**. Tests use an in-memory adapter. Production uses an HTTP/gRPC/queue adapter.
|
|
20
|
+
|
|
21
|
+
Recommendation shape: *"Define a port at the seam, implement an HTTP adapter for production and an in-memory adapter for testing, so the logic sits in one deep module even though it's deployed across a network."*
|
|
22
|
+
|
|
23
|
+
### 4. True external (Mock)
|
|
24
|
+
|
|
25
|
+
Third-party services (Stripe, Twilio, etc.) you don't control. The deepened module takes the external dependency as an injected port; tests provide a mock adapter.
|
|
26
|
+
|
|
27
|
+
## Seam discipline
|
|
28
|
+
|
|
29
|
+
- **One adapter means a hypothetical seam. Two adapters means a real one.** Don't introduce a port unless at least two adapters are justified (typically production + test). A single-adapter seam is just indirection.
|
|
30
|
+
- **Internal seams vs external seams.** A deep module can have internal seams (private to its implementation, used by its own tests) as well as the external seam at its interface. Don't expose internal seams through the interface just because tests use them.
|
|
31
|
+
|
|
32
|
+
## Testing strategy: replace, don't layer
|
|
33
|
+
|
|
34
|
+
- Old unit tests on shallow modules become waste once tests at the deepened module's interface exist — delete them.
|
|
35
|
+
- Write new tests at the deepened module's interface. The **interface is the test surface**.
|
|
36
|
+
- Tests assert on observable outcomes through the interface, not internal state.
|
|
37
|
+
- Tests should survive internal refactors — they describe behaviour, not implementation. If a test has to change when the implementation changes, it's testing past the interface.
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# Interface Design
|
|
2
|
+
|
|
3
|
+
When the user wants to explore alternative interfaces for a chosen deepening candidate, use this parallel sub-agent pattern. Based on "Design It Twice" (Ousterhout) — your first idea is unlikely to be the best.
|
|
4
|
+
|
|
5
|
+
Uses the vocabulary in [LANGUAGE.md](LANGUAGE.md) — **module**, **interface**, **seam**, **adapter**, **leverage**.
|
|
6
|
+
|
|
7
|
+
## Process
|
|
8
|
+
|
|
9
|
+
### 1. Frame the problem space
|
|
10
|
+
|
|
11
|
+
Before spawning sub-agents, write a user-facing explanation of the problem space for the chosen candidate:
|
|
12
|
+
|
|
13
|
+
- The constraints any new interface would need to satisfy
|
|
14
|
+
- The dependencies it would rely on, and which category they fall into (see [DEEPENING.md](DEEPENING.md))
|
|
15
|
+
- A rough illustrative code sketch to ground the constraints — not a proposal, just a way to make the constraints concrete
|
|
16
|
+
|
|
17
|
+
Show this to the user, then immediately proceed to Step 2. The user reads and thinks while the sub-agents work in parallel.
|
|
18
|
+
|
|
19
|
+
### 2. Spawn sub-agents
|
|
20
|
+
|
|
21
|
+
Spawn 3+ sub-agents in parallel using the Agent tool. Each must produce a **radically different** interface for the deepened module.
|
|
22
|
+
|
|
23
|
+
Prompt each sub-agent with a separate technical brief (file paths, coupling details, dependency category from [DEEPENING.md](DEEPENING.md), what sits behind the seam). The brief is independent of the user-facing problem-space explanation in Step 1. Give each agent a different design constraint:
|
|
24
|
+
|
|
25
|
+
- Agent 1: "Minimize the interface — aim for 1–3 entry points max. Maximise leverage per entry point."
|
|
26
|
+
- Agent 2: "Maximise flexibility — support many use cases and extension."
|
|
27
|
+
- Agent 3: "Optimise for the most common caller — make the default case trivial."
|
|
28
|
+
- Agent 4 (if applicable): "Design around ports & adapters for cross-seam dependencies."
|
|
29
|
+
|
|
30
|
+
Include both [LANGUAGE.md](LANGUAGE.md) vocabulary and `CONTEXT.md` vocabulary in the brief so each sub-agent names things consistently with the architecture language and the project's domain language.
|
|
31
|
+
|
|
32
|
+
Each sub-agent outputs:
|
|
33
|
+
|
|
34
|
+
1. Interface (types, methods, params — plus invariants, ordering, error modes)
|
|
35
|
+
2. Usage example showing how callers use it
|
|
36
|
+
3. What the implementation hides behind the seam
|
|
37
|
+
4. Dependency strategy and adapters (see [DEEPENING.md](DEEPENING.md))
|
|
38
|
+
5. Trade-offs — where leverage is high, where it's thin
|
|
39
|
+
|
|
40
|
+
### 3. Present and compare
|
|
41
|
+
|
|
42
|
+
Present designs sequentially so the user can absorb each one, then compare them in prose. Contrast by **depth** (leverage at the interface), **locality** (where change concentrates), and **seam placement**.
|
|
43
|
+
|
|
44
|
+
After comparing, give your own recommendation: which design you think is strongest and why. If elements from different designs would combine well, propose a hybrid. Be opinionated — the user wants a strong read, not a menu.
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# Language
|
|
2
|
+
|
|
3
|
+
Shared vocabulary for every suggestion this skill makes. Use these terms exactly — don't substitute "component," "service," "API," or "boundary." Consistent language is the whole point.
|
|
4
|
+
|
|
5
|
+
## Terms
|
|
6
|
+
|
|
7
|
+
**Module**
|
|
8
|
+
Anything with an interface and an implementation. Deliberately scale-agnostic — applies equally to a function, class, package, or tier-spanning slice.
|
|
9
|
+
_Avoid_: unit, component, service.
|
|
10
|
+
|
|
11
|
+
**Interface**
|
|
12
|
+
Everything a caller must know to use the module correctly. Includes the type signature, but also invariants, ordering constraints, error modes, required configuration, and performance characteristics.
|
|
13
|
+
_Avoid_: API, signature (too narrow — those refer only to the type-level surface).
|
|
14
|
+
|
|
15
|
+
**Implementation**
|
|
16
|
+
What's inside a module — its body of code. Distinct from **Adapter**: a thing can be a small adapter with a large implementation (a Postgres repo) or a large adapter with a small implementation (an in-memory fake). Reach for "adapter" when the seam is the topic; "implementation" otherwise.
|
|
17
|
+
|
|
18
|
+
**Depth**
|
|
19
|
+
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. A module is **shallow** when the interface is nearly as complex as the implementation.
|
|
20
|
+
|
|
21
|
+
**Seam** _(from Michael Feathers)_
|
|
22
|
+
A place where you can alter behaviour without editing in that place. The *location* at which a module's interface lives. Choosing where to put the seam is its own design decision, distinct from what goes behind it.
|
|
23
|
+
_Avoid_: boundary (overloaded with DDD's bounded context).
|
|
24
|
+
|
|
25
|
+
**Adapter**
|
|
26
|
+
A concrete thing that satisfies an interface at a seam. Describes *role* (what slot it fills), not substance (what's inside).
|
|
27
|
+
|
|
28
|
+
**Leverage**
|
|
29
|
+
What callers get from depth. More capability per unit of interface they have to learn. One implementation pays back across N call sites and M tests.
|
|
30
|
+
|
|
31
|
+
**Locality**
|
|
32
|
+
What maintainers get from depth. Change, bugs, knowledge, and verification concentrate at one place rather than spreading across callers. Fix once, fixed everywhere.
|
|
33
|
+
|
|
34
|
+
## Principles
|
|
35
|
+
|
|
36
|
+
- **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.
|
|
37
|
+
- **The deletion test.** Imagine deleting the module. If complexity vanishes, the module wasn't hiding anything (it was a pass-through). If complexity reappears across N callers, the module was earning its keep.
|
|
38
|
+
- **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.
|
|
39
|
+
- **One adapter means a hypothetical seam. Two adapters means a real one.** Don't introduce a seam unless something actually varies across it.
|
|
40
|
+
|
|
41
|
+
## Relationships
|
|
42
|
+
|
|
43
|
+
- A **Module** has exactly one **Interface** (the surface it presents to callers and tests).
|
|
44
|
+
- **Depth** is a property of a **Module**, measured against its **Interface**.
|
|
45
|
+
- A **Seam** is where a **Module**'s **Interface** lives.
|
|
46
|
+
- An **Adapter** sits at a **Seam** and satisfies the **Interface**.
|
|
47
|
+
- **Depth** produces **Leverage** for callers and **Locality** for maintainers.
|
|
48
|
+
|
|
49
|
+
## Rejected framings
|
|
50
|
+
|
|
51
|
+
- **Depth as ratio of implementation-lines to interface-lines** (Ousterhout): rewards padding the implementation. We use depth-as-leverage instead.
|
|
52
|
+
- **"Interface" as the TypeScript `interface` keyword or a class's public methods**: too narrow — interface here includes every fact a caller must know.
|
|
53
|
+
- **"Boundary"**: overloaded with DDD's bounded context. Say **seam** or **interface**.
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: improve-codebase-architecture
|
|
3
|
+
description: Surface architectural friction in a codebase and propose **deepening opportunities** — refactors that turn shallow modules into deep ones, informed by the project's `CONTEXT.md` glossary and `docs/adr/` decisions. Walks the codebase with an Explore sub-agent, applies the **deletion test** to suspected pass-through modules, presents a numbered list of candidates with files / problem / solution / benefits, and drops into a grilling loop once the user picks one — naming new concepts into `CONTEXT.md` inline and offering an ADR only when a rejection is load-bearing. Composes with `grill-with-docs` (glossary + ADR discipline) and `plan-and-build` (implementation handoff). Writes no production code. Use this skill whenever the user says "improve architecture", "improve the architecture", "architecture review", "find refactoring opportunities", "find deepening opportunities", "find shallow modules", "make this more testable", "this code is hard to navigate", or invokes `/improve-codebase-architecture` — even if they don't name the skill.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Improve Codebase Architecture
|
|
7
|
+
|
|
8
|
+
Surface architectural friction and propose **deepening opportunities** — refactors that turn shallow modules into deep ones. The aim is testability and AI-navigability. This skill is _informed_ by the project's domain model: the domain language in `CONTEXT.md` gives names to good seams; the ADRs in `docs/adr/` record decisions the skill should not re-litigate.
|
|
9
|
+
|
|
10
|
+
## When to use this skill
|
|
11
|
+
|
|
12
|
+
Trigger on any of:
|
|
13
|
+
|
|
14
|
+
- "improve architecture" / "improve the architecture" / "architecture review"
|
|
15
|
+
- "find refactoring opportunities" / "find deepening opportunities" / "find shallow modules"
|
|
16
|
+
- "make this more testable" / "this code is hard to navigate" / "AI-navigable"
|
|
17
|
+
- `/improve-codebase-architecture`
|
|
18
|
+
- The user has an area of the codebase they want pressure-tested for refactor opportunities, ideally with the domain already documented (`CONTEXT.md`) and key decisions captured (`docs/adr/`), and wants a deliberate architecture-review pass rather than an ad-hoc code review.
|
|
19
|
+
|
|
20
|
+
Do **not** auto-trigger for:
|
|
21
|
+
|
|
22
|
+
- A request to *implement* a specific refactor — use [`plan-and-build`](../plan-and-build/SKILL.md).
|
|
23
|
+
- A request to *design* a new feature — use [`grill-with-docs`](../grill-with-docs/SKILL.md), then `plan-and-build`.
|
|
24
|
+
- A bug or regression — use [`diagnose`](../diagnose/SKILL.md).
|
|
25
|
+
- A line-by-line review of a specific diff — use [`pr-review`](../pr-review/SKILL.md).
|
|
26
|
+
|
|
27
|
+
## Glossary
|
|
28
|
+
|
|
29
|
+
Use these terms exactly in every suggestion. Consistent language is the point — don't drift into "component," "service," "API," or "boundary." Full definitions in [LANGUAGE.md](LANGUAGE.md).
|
|
30
|
+
|
|
31
|
+
- **Module** — anything with an interface and an implementation (function, class, package, slice).
|
|
32
|
+
- **Interface** — everything a caller must know to use the module: types, invariants, error modes, ordering, config. Not just the type signature.
|
|
33
|
+
- **Implementation** — the code inside.
|
|
34
|
+
- **Depth** — leverage at the interface: a lot of behaviour behind a small interface. **Deep** = high leverage. **Shallow** = interface nearly as complex as the implementation.
|
|
35
|
+
- **Seam** — where an interface lives; a place behaviour can be altered without editing in place. (Use this, not "boundary.")
|
|
36
|
+
- **Adapter** — a concrete thing satisfying an interface at a seam.
|
|
37
|
+
- **Leverage** — what callers get from depth.
|
|
38
|
+
- **Locality** — what maintainers get from depth: change, bugs, knowledge concentrated in one place.
|
|
39
|
+
|
|
40
|
+
Key principles (see [LANGUAGE.md](LANGUAGE.md) for the full list):
|
|
41
|
+
|
|
42
|
+
- **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.
|
|
43
|
+
- **The interface is the test surface.**
|
|
44
|
+
- **One adapter = hypothetical seam. Two adapters = real seam.**
|
|
45
|
+
|
|
46
|
+
## Process
|
|
47
|
+
|
|
48
|
+
### 1. Explore
|
|
49
|
+
|
|
50
|
+
Read the project's domain glossary (`CONTEXT.md`) and any ADRs in the area you're touching first.
|
|
51
|
+
|
|
52
|
+
Then use the Agent tool with `subagent_type=Explore` to walk the codebase. Don't follow rigid heuristics — explore organically and note where you experience friction:
|
|
53
|
+
|
|
54
|
+
- Where does understanding one concept require bouncing between many small modules?
|
|
55
|
+
- Where are modules **shallow** — interface nearly as complex as the implementation?
|
|
56
|
+
- Where have pure functions been extracted just for testability, but the real bugs hide in how they're called (no **locality**)?
|
|
57
|
+
- Where do tightly-coupled modules leak across their seams?
|
|
58
|
+
- Which parts of the codebase are untested, or hard to test through their current interface?
|
|
59
|
+
|
|
60
|
+
Apply the **deletion test** to anything you suspect is shallow: would deleting it concentrate complexity, or just move it? A "yes, concentrates" is the signal you want.
|
|
61
|
+
|
|
62
|
+
### 2. Present candidates
|
|
63
|
+
|
|
64
|
+
Present a numbered list of deepening opportunities. For each candidate:
|
|
65
|
+
|
|
66
|
+
- **Files** — which files/modules are involved
|
|
67
|
+
- **Problem** — why the current architecture is causing friction
|
|
68
|
+
- **Solution** — plain English description of what would change
|
|
69
|
+
- **Benefits** — explained in terms of locality and leverage, and also in how tests would improve
|
|
70
|
+
|
|
71
|
+
**Use `CONTEXT.md` vocabulary for the domain, and [LANGUAGE.md](LANGUAGE.md) vocabulary for the architecture.** If `CONTEXT.md` defines "Order," talk about "the Order intake module" — not "the FooBarHandler," and not "the Order service."
|
|
72
|
+
|
|
73
|
+
**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 (e.g. _"contradicts ADR-0007 — but worth reopening because…"_). Don't list every theoretical refactor an ADR forbids.
|
|
74
|
+
|
|
75
|
+
Do NOT propose interfaces yet. Ask the user: "Which of these would you like to explore?"
|
|
76
|
+
|
|
77
|
+
### 3. Grilling loop
|
|
78
|
+
|
|
79
|
+
Once the user picks a candidate, drop into a grilling conversation. Walk the design tree with them — constraints, dependencies, the shape of the deepened module, what sits behind the seam, what tests survive.
|
|
80
|
+
|
|
81
|
+
Side effects happen inline as decisions crystallize:
|
|
82
|
+
|
|
83
|
+
- **Naming a deepened module after a concept not in `CONTEXT.md`?** Add the term to `CONTEXT.md` with the same discipline as [`grill-with-docs`](../grill-with-docs/SKILL.md) Phase 3 (`CONTEXT.md — pure glossary`). Create the file lazily if it doesn't exist.
|
|
84
|
+
- **Sharpening a fuzzy term during the conversation?** Update `CONTEXT.md` right there. Don't batch.
|
|
85
|
+
- **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. Use the ADR template from [`grill-with-docs`](../grill-with-docs/SKILL.md) Phase 3.
|
|
86
|
+
- **Want to explore alternative interfaces for the deepened module?** See [INTERFACE-DESIGN.md](INTERFACE-DESIGN.md).
|
|
87
|
+
- **Need to choose how to test across a dependency?** See [DEEPENING.md](DEEPENING.md) for the four dependency categories and the test strategy each demands.
|
|
88
|
+
|
|
89
|
+
## Examples
|
|
90
|
+
|
|
91
|
+
### Example 1: A shallow validator cluster
|
|
92
|
+
|
|
93
|
+
**User:** `/improve-codebase-architecture` — focused on `src/orders/validation/`
|
|
94
|
+
|
|
95
|
+
**Claude:**
|
|
96
|
+
1. **Explore.** Reads `CONTEXT.md` (sees `Order`, `OrderLine`, `Cart`) and `docs/adr/0004-validation-pipeline.md`. Spawns Explore on `src/orders/validation/` and finds 11 single-function modules (`validateSku.ts`, `validateQty.ts`, …) each called from one place in `OrderIntake`.
|
|
97
|
+
2. **Candidates.** Presents one numbered candidate: "Collapse the `validate*` cluster into a deep `OrderIntakeValidator` module — current shallow validators have interface nearly as complex as implementation; the real bugs hide in how `OrderIntake` *composes* them, where no test exercises the seam." Files / Problem / Solution / Benefits. Notes: does not contradict ADR-0004 (which is about *when* to validate, not *how* to compose validators).
|
|
98
|
+
3. **Grilling.** User picks the candidate. Walks the design tree: dependency category (in-process, [DEEPENING.md](DEEPENING.md) §1), seam placement (one external seam at `OrderIntakeValidator`, internal validators stay private), test surface (assert at `validate(order) → Result<Order, ValidationError[]>`, delete the 11 per-function tests). Adds `OrderIntakeValidator` to `CONTEXT.md`.
|
|
99
|
+
|
|
100
|
+
### Example 2: A candidate that contradicts an ADR — but worth reopening
|
|
101
|
+
|
|
102
|
+
**User:** `/improve-codebase-architecture`
|
|
103
|
+
|
|
104
|
+
**Claude:** Surfaces a candidate to merge `WebhookDispatcher` and `WebhookRetryQueue`. Notes _"contradicts ADR-0012 — but worth reopening because the original split was justified by sync delivery, and the codebase has since moved to async."_ User confirms ADR-0012 is stale. Hands off the actual merge to [`plan-and-build`](../plan-and-build/SKILL.md); updates `CONTEXT.md` with the unified `WebhookDelivery` term and notes that ADR-0012 needs a superseding ADR (best written via [`grill-with-docs`](../grill-with-docs/SKILL.md) if the user wants the rationale captured).
|
|
105
|
+
|
|
106
|
+
## Anti-patterns
|
|
107
|
+
|
|
108
|
+
- ❌ Proposing a refactor without applying the **deletion test** — leads to suggestions that just move complexity instead of concentrating it.
|
|
109
|
+
- ❌ Naming things "FooHandler" / "BarService" / "BazManager" when `CONTEXT.md` already names the concept. Use the domain term.
|
|
110
|
+
- ❌ Introducing a port + adapter for a dependency with only one implementation. **One adapter = hypothetical seam.**
|
|
111
|
+
- ❌ Re-litigating an ADR without explicit cause. ADRs are decisions the skill should _not_ reopen unless the constraint that drove them is gone.
|
|
112
|
+
- ❌ Proposing interfaces in Step 2. Step 2 is candidates only — interface design happens after the user picks one, and benefits from the parallel sub-agent process in [INTERFACE-DESIGN.md](INTERFACE-DESIGN.md).
|
|
113
|
+
- ❌ Letting old shallow-module tests survive alongside new deep-module tests. The interface is the test surface — replace, don't layer (see [DEEPENING.md](DEEPENING.md)).
|
|
114
|
+
- ✅ Architecture-language vocabulary used consistently, candidates measured by the deletion test, interfaces designed twice, tests at the new seam only.
|
|
115
|
+
|
|
116
|
+
## Notes
|
|
117
|
+
|
|
118
|
+
- **Composes with** [`grill-with-docs`](../grill-with-docs/SKILL.md): the grilling loop in Step 3 uses the same `CONTEXT.md` and ADR discipline; reach for `grill-with-docs` if a deepening conversation reveals fuzzy domain terminology that needs a dedicated pass.
|
|
119
|
+
- **Composes with** [`plan-and-build`](../plan-and-build/SKILL.md): hand off the chosen candidate (with its decided interface) to `plan-and-build` for the implementation. This skill writes no production code.
|
|
120
|
+
- **Composes with** [`pr-review`](../pr-review/SKILL.md): use `pr-review` for line-by-line review of a specific diff; this skill is for surfacing architecture-level refactors *before* any diff exists.
|
|
121
|
+
- Adapted from Matt Pocock's [`improve-codebase-architecture`](https://github.com/mattpocock/skills/tree/main/skills/engineering/improve-codebase-architecture) — same architecture vocabulary, deletion test, deepening process, and parallel interface design. Adapted to point at this repo's [`grill-with-docs`](../grill-with-docs/SKILL.md) for `CONTEXT.md` and ADR format conventions (which mattpocock/skills splits into separate files), and to compose with the other skills in this library.
|