heimdall-agent 1.1.0 → 1.2.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/README.md +13 -13
- package/README.pt-BR.md +36 -22
- package/agents/code-sentinel.md +7 -1
- package/agents/modernizer.md +4 -2
- package/agents/orchestrator.md +20 -7
- package/agents/reviewer.md +2 -0
- package/config/agents.json +11 -1
- package/config/mcp.json +1 -1
- package/config/profiles.json +1 -1
- package/config/skills.json +762 -683
- package/docs/SKILLS.md +96 -74
- package/docs/runs/skill-audit/2026-11-12-compare-report.json +1028 -0
- package/docs/runs/skill-audit/2026-11-12-upstream-audit.json +275 -0
- package/doctrine/AGENTS.md +4 -1
- package/lib/catalog-sync.cjs +8 -3
- package/package.json +1 -1
- package/playbooks/01-interactive-grilling-gate.md +14 -10
- package/playbooks/03-adversarial-code-review.md +12 -4
- package/playbooks/05-canonical-plan-template.md +3 -1
- package/setup.mjs +2 -2
- package/skills/antislop-copywriting/SKILL.md +36 -1
- package/skills/brainstorming/SKILL.md +60 -38
- package/skills/codebase-design/DEEPENING.md +37 -0
- package/skills/codebase-design/DESIGN-IT-TWICE.md +44 -0
- package/skills/codebase-design/SKILL.md +114 -0
- package/skills/domain-modeling/ADR-FORMAT.md +47 -0
- package/skills/domain-modeling/GLOSSARY-FORMAT.md +60 -0
- package/skills/domain-modeling/SKILL.md +74 -0
- package/skills/executing-plans/SKILL.md +6 -4
- package/skills/grill-me/SKILL.md +65 -0
- package/skills/handoff/SKILL.md +64 -0
- package/skills/improve-codebase-architecture/HTML-REPORT.md +123 -0
- package/skills/improve-codebase-architecture/SKILL.md +71 -0
- package/skills/owasp-security/reference/config-and-supply-chain.md +346 -344
- package/skills/owasp-security/reference/languages.md +378 -372
- package/skills/owasp-security/reference/owasp-report.md +1144 -1140
- package/skills/owasp-security/reference/review-checklist.md +134 -132
- package/skills/subagent-driven-development/SKILL.md +7 -4
- package/skills/to-spec/SKILL.md +75 -0
- package/skills/to-tickets/SKILL.md +105 -0
- package/skills/wayfinder/SKILL.md +128 -0
|
@@ -31,6 +31,10 @@ Before you start implementing, you must, in order:
|
|
|
31
31
|
3. Get their approval of that doc.
|
|
32
32
|
4. Invoke the superpowers:writing-plans skill.
|
|
33
33
|
|
|
34
|
+
If nothing is open when you write your first message and there's one
|
|
35
|
+
sensible way, steps 1 to 3 happen in that message (see Your First
|
|
36
|
+
Message).
|
|
37
|
+
|
|
34
38
|
Two things aren't implementing: a spike they said yes to (see Spike to
|
|
35
39
|
feel things out), and doing what they asked once they've opted out of
|
|
36
40
|
the questions.
|
|
@@ -42,7 +46,8 @@ a handoff, files they pointed at, earlier conversation), dig in before your
|
|
|
42
46
|
first message. Read what they referred to and the code or material it
|
|
43
47
|
connects to, and keep reading until you can explain how the relevant
|
|
44
48
|
parts work today and what this change would touch. Never ask what the
|
|
45
|
-
project or their context already answers
|
|
49
|
+
project or their context already answers, or reopen what they've
|
|
50
|
+
already decided.
|
|
46
51
|
|
|
47
52
|
## Your First Message
|
|
48
53
|
|
|
@@ -58,8 +63,17 @@ Move the work forward, with one of these:
|
|
|
58
63
|
has to be built, like a constraint, a conflict, or a cheaper path, say
|
|
59
64
|
so plainly. How to build it comes later, once you understand what they
|
|
60
65
|
want (see Lay out the approaches). End with one line inviting
|
|
61
|
-
corrections,
|
|
62
|
-
|
|
66
|
+
corrections. Then, if they haven't told you why they want it, even if
|
|
67
|
+
you can guess, ask about that: one open question in their own terms,
|
|
68
|
+
with nothing to pick from. If they have told you, and their request
|
|
69
|
+
and the project leave open something whose answer would change what
|
|
70
|
+
gets built, ask about the one that would change it most; when its
|
|
71
|
+
choices can be named, sketch each concretely, with what it trades off
|
|
72
|
+
and which you'd pick. If nothing like that is open, there's one
|
|
73
|
+
sensible way: end with the short design itself (the approach, a line on
|
|
74
|
+
why the others don't fit, and the design in a few lines) and ask them
|
|
75
|
+
to approve it. Their approval covers the approach and the design: write
|
|
76
|
+
the short design doc as approved and go on to the plan.
|
|
63
77
|
Specs are often incomplete, so confirm before you build on one.
|
|
64
78
|
- **They haven't:** one open question, in their own terms, about the
|
|
65
79
|
biggest thing their request leaves unsettled. Say why you're asking:
|
|
@@ -72,10 +86,9 @@ How the message ends depends on whether their message asked for
|
|
|
72
86
|
brainstorming:
|
|
73
87
|
|
|
74
88
|
- **They asked for it** (by name, by invoking it, or by asking for a
|
|
75
|
-
design discussion): end
|
|
76
|
-
|
|
77
|
-
-
|
|
78
|
-
question, add a light, one-line offer to just get going instead, like
|
|
89
|
+
design discussion): end there. They want this conversation.
|
|
90
|
+
- **They didn't:** they may not want a conversation at all. End with a
|
|
91
|
+
light, one-line offer to just get going instead, like
|
|
79
92
|
"Or if you'd rather I just dive in, say so." If they take you up on
|
|
80
93
|
it, this skill is done: state any significant how-it-gets-made choice
|
|
81
94
|
(platform, language, medium) in one plain line, then do what they
|
|
@@ -85,28 +98,33 @@ That's the whole message.
|
|
|
85
98
|
|
|
86
99
|
## The Conversation
|
|
87
100
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
101
|
+
Ask a question only when the answer would change what gets built and
|
|
102
|
+
neither the request nor the project answers it. Otherwise, state your
|
|
103
|
+
call and your reason as a proposal they can correct, and move the work
|
|
104
|
+
forward. Process steps are always your calls: writing things up, where
|
|
105
|
+
files go, looking further, how to show something. Do them and say so.
|
|
106
|
+
Ask one at a time. Use plain language, pitched just a little above where
|
|
107
|
+
your human partner is. Match their vocabulary; never use process jargon.
|
|
108
|
+
You never need to quote this skill to your human partner.
|
|
93
109
|
|
|
94
110
|
Be clear and concise. Lead with what matters. Avoid jargon. When you
|
|
95
111
|
report what you found, give them the most important findings and offer
|
|
96
112
|
the rest.
|
|
97
113
|
|
|
98
|
-
**Get them describing.**
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
114
|
+
**Get them describing.** Until you know why they want it, ask open
|
|
115
|
+
questions, with no example answers attached. Their own words carry
|
|
116
|
+
intent that your options can't. Once you know why, when a decision has
|
|
117
|
+
choices you can name, sketch each concretely, with what it trades off
|
|
118
|
+
and which you'd pick. When they say "just guess" or "what do you think?",
|
|
119
|
+
propose something concrete.
|
|
102
120
|
|
|
103
121
|
**How it gets made.** Every project rests on choices about medium, tools,
|
|
104
122
|
materials, and resources: the platform, programming language, and
|
|
105
|
-
libraries for an app; the medium for a piece of art.
|
|
106
|
-
of those choices they want to make
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
123
|
+
libraries for an app; the medium for a piece of art. Read from how they
|
|
124
|
+
talk which of those choices they want to make. Someone who raises the how
|
|
125
|
+
or asks about trade-offs wants the options with your pick. Someone who
|
|
126
|
+
talks about outcomes is handing you the how: make those calls and state
|
|
127
|
+
each in a line. When there's existing work, build on what it already
|
|
110
128
|
uses. Any choice you make goes in the design as your call, never as
|
|
111
129
|
something they agreed to.
|
|
112
130
|
|
|
@@ -131,24 +149,26 @@ already plain, say what you're hoping to learn or what the answer would
|
|
|
131
149
|
change. A proposal they can correct, plus your reason for it, often
|
|
132
150
|
beats a question.
|
|
133
151
|
|
|
134
|
-
**
|
|
135
|
-
would help,
|
|
136
|
-
|
|
137
|
-
decide whether you go.
|
|
152
|
+
**Do recon.** Once you have a bit of grounding and looking further
|
|
153
|
+
would help, go look: deeper into their codebase or project, their own
|
|
154
|
+
files and data, or the web. Say what you looked for and what you found.
|
|
138
155
|
|
|
139
156
|
**Lay out the approaches.** Once you understand what they want, and
|
|
140
157
|
before you write anything up, put the ways of building it in a message
|
|
141
158
|
of its own. Come up with several real alternatives and drop the weak
|
|
142
159
|
ones, including any that work against why they want it and any the
|
|
143
|
-
existing work rules out.
|
|
144
|
-
|
|
145
|
-
Recommend one and say why, then ask which way they want
|
|
146
|
-
|
|
147
|
-
|
|
160
|
+
existing work rules out. Sketch the two or three that remain concretely
|
|
161
|
+
enough to picture, grounded in what the project actually does, with what
|
|
162
|
+
each trades off. Recommend one and say why, then ask which way they want
|
|
163
|
+
to go; if they've handed you the how, say you'll go with your pick
|
|
164
|
+
instead. When there's genuinely one sensible way, say so in that
|
|
165
|
+
message and explain why the others don't fit; the design comes in the
|
|
166
|
+
next one. This is for how it gets built; for what they want, get them
|
|
148
167
|
describing first.
|
|
149
168
|
|
|
150
|
-
**Show, don't tell.**
|
|
151
|
-
|
|
169
|
+
**Show, don't tell.** Whenever seeing would help more than reading,
|
|
170
|
+
sketch it in text: a few lines of what they'd see. Offer the visual
|
|
171
|
+
companion (below) when the look itself is theirs to decide:
|
|
152
172
|
|
|
153
173
|
- something they'll look at: a screen, a page, a printout, a sign
|
|
154
174
|
- a layout or arrangement: of a screen, a room, a schedule
|
|
@@ -180,10 +200,11 @@ as your proposal, with your reason. End each chunk by asking what's wrong
|
|
|
180
200
|
or missing.
|
|
181
201
|
|
|
182
202
|
Before you send a chunk, check it: does it describe something they'll
|
|
183
|
-
look at, like a page, a screen, a schedule, or a printout? If so,
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
203
|
+
look at, like a page, a screen, a schedule, or a printout? If so, put a
|
|
204
|
+
text sketch next to the description. If the look itself is theirs to
|
|
205
|
+
decide and they haven't seen the visual companion offer yet, send the
|
|
206
|
+
offer instead (its own message, below) and hold the chunk for the next
|
|
207
|
+
message. Once they've accepted, put a mockup next to the description.
|
|
187
208
|
|
|
188
209
|
## Size the Work
|
|
189
210
|
|
|
@@ -223,7 +244,8 @@ builder check.
|
|
|
223
244
|
|
|
224
245
|
**Where it goes:** in a software repo,
|
|
225
246
|
`docs/superpowers/specs/YYYY-MM-DD-<topic>-design.md`, committed.
|
|
226
|
-
Otherwise,
|
|
247
|
+
Otherwise, pick a sensible place and say where. Your human partner's
|
|
248
|
+
preferences override both.
|
|
227
249
|
|
|
228
250
|
**Builder check** (for a project): dispatch a fresh subagent with
|
|
229
251
|
`builder-check-prompt.md` in this directory. When you tell your human
|
|
@@ -266,7 +288,7 @@ superpowers:writing-plans and no other skill.
|
|
|
266
288
|
|---------|---------|
|
|
267
289
|
| "I'll offer a menu of what they might want" | Options steer. Ask them to describe it first. |
|
|
268
290
|
| "I'll fill in sensible defaults" | Good. Say them out loud. A default they never heard is one they couldn't reject. |
|
|
269
|
-
| "I've answered their questions, so I'll write the doc" | Lay out the approaches first, in a message of their own. |
|
|
291
|
+
| "I've answered their questions, so I'll write the doc" | Lay out the approaches first, in a message of their own (or, when nothing was open from the start, in your first message's short design). |
|
|
270
292
|
| "I should explain the process first" | Ask your question. The process shows itself. |
|
|
271
293
|
| "They said 'sounds good' to the idea" | Approval covers what you showed them. A design doc you haven't written isn't approved. |
|
|
272
294
|
| "The spike works, I'll keep building on it" | Keeping it is a new request. Back through the gate. |
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Deepening
|
|
2
|
+
|
|
3
|
+
How to deepen a cluster of shallow modules safely, given its dependencies. Assumes the vocabulary in [SKILL.md](SKILL.md): **module**, **interface**, **seam**, **adapter**.
|
|
4
|
+
|
|
5
|
+
## Dependency categories
|
|
6
|
+
|
|
7
|
+
When assessing a candidate for deepening, classify its dependencies. The category determines how the deepened module is tested across its seam.
|
|
8
|
+
|
|
9
|
+
### 1. In-process
|
|
10
|
+
|
|
11
|
+
Pure computation, in-memory state, no I/O. Always deepenable: merge the modules and test through the new interface directly. No adapter needed.
|
|
12
|
+
|
|
13
|
+
### 2. Local-substitutable
|
|
14
|
+
|
|
15
|
+
Dependencies that have local test stand-ins (PGLite for Postgres, in-memory filesystem). Deepenable if the stand-in exists. The deepened module is tested with the stand-in running in the test suite. The seam is internal; no port at the module's external interface.
|
|
16
|
+
|
|
17
|
+
### 3. Remote but owned (Ports & Adapters)
|
|
18
|
+
|
|
19
|
+
Your own services across a network boundary (microservices, internal APIs). Define a **port** (interface) at the seam. The deep module owns the logic; the transport is injected as an **adapter**. Tests use an in-memory adapter. Production uses an HTTP/gRPC/queue adapter.
|
|
20
|
+
|
|
21
|
+
Recommendation shape: *"Define a port at the seam, implement an HTTP adapter for production and an in-memory adapter for testing, so the logic sits in one deep module even though it's deployed across a network."*
|
|
22
|
+
|
|
23
|
+
### 4. True external (Mock)
|
|
24
|
+
|
|
25
|
+
Third-party services (Stripe, Twilio, etc.) you don't control. The deepened module takes the external dependency as an injected port; tests provide a mock adapter.
|
|
26
|
+
|
|
27
|
+
## Seam discipline
|
|
28
|
+
|
|
29
|
+
- **One adapter means a hypothetical seam. Two adapters means a real one.** Don't introduce a port unless at least two adapters are justified (typically production + test). A single-adapter seam is just indirection.
|
|
30
|
+
- **Internal seams vs external seams.** A deep module can have internal seams (private to its implementation, used by its own tests) as well as the external seam at its interface. Don't expose internal seams through the interface just because tests use them.
|
|
31
|
+
|
|
32
|
+
## Testing strategy: replace, don't layer
|
|
33
|
+
|
|
34
|
+
- Old unit tests on shallow modules become waste once tests at the deepened module's interface exist; delete them.
|
|
35
|
+
- Write new tests at the deepened module's interface. The **interface is the test surface**.
|
|
36
|
+
- Tests assert on observable outcomes through the interface, not internal state.
|
|
37
|
+
- Tests should survive internal refactors, since 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
|
+
# Design It Twice
|
|
2
|
+
|
|
3
|
+
When the user wants to explore alternative interfaces for a chosen deepening candidate, use this parallel sub-agent pattern. Based on "Design It Twice" (Ousterhout): your first idea is unlikely to be the best.
|
|
4
|
+
|
|
5
|
+
Uses the vocabulary in [SKILL.md](SKILL.md): **module**, **interface**, **seam**, **adapter**, **leverage**.
|
|
6
|
+
|
|
7
|
+
## Process
|
|
8
|
+
|
|
9
|
+
### 1. Frame the problem space
|
|
10
|
+
|
|
11
|
+
Before spawning sub-agents, write a user-facing explanation of the problem space for the chosen candidate:
|
|
12
|
+
|
|
13
|
+
- The constraints any new interface would need to satisfy
|
|
14
|
+
- The dependencies it would rely on, and which category they fall into (see [DEEPENING.md](DEEPENING.md))
|
|
15
|
+
- A rough illustrative code sketch to ground the constraints, not a proposal, just a way to make the constraints concrete
|
|
16
|
+
|
|
17
|
+
Show this to the user, then immediately proceed to Step 2. The user reads and thinks while the sub-agents work in parallel.
|
|
18
|
+
|
|
19
|
+
### 2. Spawn sub-agents
|
|
20
|
+
|
|
21
|
+
Spawn 3+ sub-agents in parallel, each with a fresh context window. Each must produce a **radically different** interface for the deepened module.
|
|
22
|
+
|
|
23
|
+
Prompt each sub-agent with a separate technical brief (file paths, coupling details, dependency category from [DEEPENING.md](DEEPENING.md), what sits behind the seam). The brief is independent of the user-facing problem-space explanation in Step 1. Give each agent a different design constraint:
|
|
24
|
+
|
|
25
|
+
- Agent 1: "Minimize the interface: aim for 1–3 entry points max. Maximise leverage per entry point."
|
|
26
|
+
- Agent 2: "Maximise flexibility: support many use cases and extension."
|
|
27
|
+
- Agent 3: "Optimise for the most common caller: make the default case trivial."
|
|
28
|
+
- Agent 4 (if applicable): "Design around ports & adapters for cross-seam dependencies."
|
|
29
|
+
|
|
30
|
+
Include both [SKILL.md](SKILL.md) vocabulary and GLOSSARY.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,114 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: codebase-design
|
|
3
|
+
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.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Codebase Design
|
|
7
|
+
|
|
8
|
+
Design **deep modules**: a lot of behaviour behind a small interface, placed at a clean seam, testable through that interface. Use this language and these principles wherever code is being designed or restructured. The aim is leverage for callers, locality for maintainers, and testability for everyone.
|
|
9
|
+
|
|
10
|
+
## Glossary
|
|
11
|
+
|
|
12
|
+
Use these terms exactly: don't substitute "component," "service," "API," or "boundary." Consistent language is the whole point.
|
|
13
|
+
|
|
14
|
+
**Module**: anything with an interface and an implementation. Deliberately scale-agnostic: a function, class, package, or tier-spanning slice. _Avoid_: unit, component, service.
|
|
15
|
+
|
|
16
|
+
**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).
|
|
17
|
+
|
|
18
|
+
**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.
|
|
19
|
+
|
|
20
|
+
**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.
|
|
21
|
+
|
|
22
|
+
**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).
|
|
23
|
+
|
|
24
|
+
**Adapter**: a concrete thing that satisfies an interface at a seam. Describes *role* (what slot it fills), not substance (what's inside).
|
|
25
|
+
|
|
26
|
+
**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.
|
|
27
|
+
|
|
28
|
+
**Locality**: what maintainers get from depth. Change, bugs, knowledge, and verification concentrate in one place rather than spreading across callers. Fix once, fixed everywhere.
|
|
29
|
+
|
|
30
|
+
## Deep vs shallow
|
|
31
|
+
|
|
32
|
+
**Deep module** = small interface + lots of implementation:
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
┌─────────────────────┐
|
|
36
|
+
│ Small Interface │ ← Few methods, simple params
|
|
37
|
+
├─────────────────────┤
|
|
38
|
+
│ │
|
|
39
|
+
│ Deep Implementation│ ← Complex logic hidden
|
|
40
|
+
│ │
|
|
41
|
+
└─────────────────────┘
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
**Shallow module** = large interface + little implementation (avoid):
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
┌─────────────────────────────────┐
|
|
48
|
+
│ Large Interface │ ← Many methods, complex params
|
|
49
|
+
├─────────────────────────────────┤
|
|
50
|
+
│ Thin Implementation │ ← Just passes through
|
|
51
|
+
└─────────────────────────────────┘
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
When designing an interface, ask:
|
|
55
|
+
|
|
56
|
+
- Can I reduce the number of methods?
|
|
57
|
+
- Can I simplify the parameters?
|
|
58
|
+
- Can I hide more complexity inside?
|
|
59
|
+
|
|
60
|
+
## Principles
|
|
61
|
+
|
|
62
|
+
- **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.
|
|
63
|
+
- **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.
|
|
64
|
+
- **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.
|
|
65
|
+
- **One adapter means a hypothetical seam. Two adapters means a real one.** Don't introduce a seam unless something actually varies across it.
|
|
66
|
+
|
|
67
|
+
## Designing for testability
|
|
68
|
+
|
|
69
|
+
Good interfaces make testing natural:
|
|
70
|
+
|
|
71
|
+
1. **Accept dependencies, don't create them.**
|
|
72
|
+
|
|
73
|
+
```typescript
|
|
74
|
+
// Testable
|
|
75
|
+
function processOrder(order, paymentGateway) {}
|
|
76
|
+
|
|
77
|
+
// Hard to test
|
|
78
|
+
function processOrder(order) {
|
|
79
|
+
const gateway = new StripeGateway();
|
|
80
|
+
}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
2. **Return results, don't produce side effects.**
|
|
84
|
+
|
|
85
|
+
```typescript
|
|
86
|
+
// Testable
|
|
87
|
+
function calculateDiscount(cart): Discount {}
|
|
88
|
+
|
|
89
|
+
// Hard to test
|
|
90
|
+
function applyDiscount(cart): void {
|
|
91
|
+
cart.total -= discount;
|
|
92
|
+
}
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
3. **Small surface area.** Fewer methods = fewer tests needed. Fewer params = simpler test setup.
|
|
96
|
+
|
|
97
|
+
## Relationships
|
|
98
|
+
|
|
99
|
+
- A **Module** has exactly one **Interface** (the surface it presents to callers and tests).
|
|
100
|
+
- **Depth** is a property of a **Module**, measured against its **Interface**.
|
|
101
|
+
- A **Seam** is where a **Module**'s **Interface** lives.
|
|
102
|
+
- An **Adapter** sits at a **Seam** and satisfies the **Interface**.
|
|
103
|
+
- **Depth** produces **Leverage** for callers and **Locality** for maintainers.
|
|
104
|
+
|
|
105
|
+
## Rejected framings
|
|
106
|
+
|
|
107
|
+
- **Depth as ratio of implementation-lines to interface-lines** (Ousterhout): rewards padding the implementation. We use depth-as-leverage instead.
|
|
108
|
+
- **"Interface" as the TypeScript `interface` keyword or a class's public methods**: too narrow: interface here includes every fact a caller must know.
|
|
109
|
+
- **"Boundary"**: overloaded with DDD's bounded context. Say **seam** or **interface**.
|
|
110
|
+
|
|
111
|
+
## Going deeper
|
|
112
|
+
|
|
113
|
+
- **Deepening a cluster given its dependencies**, see [DEEPENING.md](DEEPENING.md): dependency categories, seam discipline, and replace-don't-layer testing.
|
|
114
|
+
- **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.
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# ADR Format
|
|
2
|
+
|
|
3
|
+
ADRs live in `docs/adr/` and use sequential numbering: `0001-slug.md`, `0002-slug.md`, etc.
|
|
4
|
+
|
|
5
|
+
Create the `docs/adr/` directory lazily: only when the first ADR is needed.
|
|
6
|
+
|
|
7
|
+
## Template
|
|
8
|
+
|
|
9
|
+
```md
|
|
10
|
+
# {Short title of the decision}
|
|
11
|
+
|
|
12
|
+
{1-3 sentences: what's the context, what did we decide, and why.}
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
That's it. An ADR can be a single paragraph. The value is in recording *that* a decision was made and *why*, not in filling out sections.
|
|
16
|
+
|
|
17
|
+
## Optional sections
|
|
18
|
+
|
|
19
|
+
Only include these when they add genuine value. Most ADRs won't need them.
|
|
20
|
+
|
|
21
|
+
- **Status** frontmatter (`proposed | accepted | deprecated | superseded by ADR-NNNN`): useful when decisions are revisited
|
|
22
|
+
- **Considered Options**: only when the rejected alternatives are worth remembering
|
|
23
|
+
- **Consequences**: only when non-obvious downstream effects need to be called out
|
|
24
|
+
|
|
25
|
+
## Numbering
|
|
26
|
+
|
|
27
|
+
Scan `docs/adr/` for the highest existing number and increment by one.
|
|
28
|
+
|
|
29
|
+
## When to offer an ADR
|
|
30
|
+
|
|
31
|
+
All three of these must be true:
|
|
32
|
+
|
|
33
|
+
1. **Hard to reverse**: the cost of changing your mind later is meaningful
|
|
34
|
+
2. **Surprising without context**: a future reader will look at the code and wonder "why on earth did they do it this way?"
|
|
35
|
+
3. **The result of a real trade-off**: there were genuine alternatives and you picked one for specific reasons
|
|
36
|
+
|
|
37
|
+
If a decision is easy to reverse, skip it: you'll just reverse it. If it's not surprising, nobody will wonder why. If there was no real alternative, there's nothing to record beyond "we did the obvious thing."
|
|
38
|
+
|
|
39
|
+
### What qualifies
|
|
40
|
+
|
|
41
|
+
- **Architectural shape.** "We're using a monorepo." "The write model is event-sourced, the read model is projected into Postgres."
|
|
42
|
+
- **Integration patterns between contexts.** "Ordering and Billing communicate via domain events, not synchronous HTTP."
|
|
43
|
+
- **Technology choices that carry lock-in.** Database, message bus, auth provider, deployment target. Not every library: just the ones that would take a quarter to swap out.
|
|
44
|
+
- **Boundary and scope decisions.** "Customer data is owned by the Customer context; other contexts reference it by ID only." The explicit no-s are as valuable as the yes-s.
|
|
45
|
+
- **Deliberate deviations from the obvious path.** "We're using manual SQL instead of an ORM because X." Anything where a reasonable reader would assume the opposite. These stop the next engineer from "fixing" something that was deliberate.
|
|
46
|
+
- **Constraints not visible in the code.** "We can't use AWS because of compliance requirements." "Response times must be under 200ms because of the partner API contract."
|
|
47
|
+
- **Rejected alternatives when the rejection is non-obvious.** If you considered GraphQL and picked REST for subtle reasons, record it; otherwise someone will suggest GraphQL again in six months.
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# GLOSSARY.md Format
|
|
2
|
+
|
|
3
|
+
## Structure
|
|
4
|
+
|
|
5
|
+
```md
|
|
6
|
+
# {Context Name}
|
|
7
|
+
|
|
8
|
+
{One or two sentence description of what this context is and why it exists.}
|
|
9
|
+
|
|
10
|
+
## Language
|
|
11
|
+
|
|
12
|
+
**Order**:
|
|
13
|
+
{A one or two sentence description of the term}
|
|
14
|
+
_Avoid_: Purchase, transaction
|
|
15
|
+
|
|
16
|
+
**Invoice**:
|
|
17
|
+
A request for payment sent to a customer after delivery.
|
|
18
|
+
_Avoid_: Bill, payment request
|
|
19
|
+
|
|
20
|
+
**Customer**:
|
|
21
|
+
A person or organization that places orders.
|
|
22
|
+
_Avoid_: Client, buyer, account
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Rules
|
|
26
|
+
|
|
27
|
+
- **Be opinionated.** When multiple words exist for the same concept, pick the best one and list the others under `_Avoid_`.
|
|
28
|
+
- **Keep definitions tight.** One or two sentences max. Define what it IS, not what it does.
|
|
29
|
+
- **Only include terms specific to this project's context.** General programming concepts (timeouts, error types, utility patterns) don't belong even if the project uses them extensively. Before adding a term, ask: is this a concept unique to this context, or a general programming concept? Only the former belongs.
|
|
30
|
+
- **Group terms under subheadings** when natural clusters emerge. If all terms belong to a single cohesive area, a flat list is fine.
|
|
31
|
+
|
|
32
|
+
## Single vs multi-context repos
|
|
33
|
+
|
|
34
|
+
**Single context (most repos):** One `GLOSSARY.md` at the repo root.
|
|
35
|
+
|
|
36
|
+
**Multiple contexts:** A `GLOSSARY-MAP.md` at the repo root lists the contexts, where they live, and how they relate to each other:
|
|
37
|
+
|
|
38
|
+
```md
|
|
39
|
+
# Glossary Map
|
|
40
|
+
|
|
41
|
+
## Contexts
|
|
42
|
+
|
|
43
|
+
- [Ordering](./src/ordering/GLOSSARY.md): receives and tracks customer orders
|
|
44
|
+
- [Billing](./src/billing/GLOSSARY.md): generates invoices and processes payments
|
|
45
|
+
- [Fulfillment](./src/fulfillment/GLOSSARY.md): manages warehouse picking and shipping
|
|
46
|
+
|
|
47
|
+
## Relationships
|
|
48
|
+
|
|
49
|
+
- **Ordering → Fulfillment**: Ordering emits `OrderPlaced` events; Fulfillment consumes them to start picking
|
|
50
|
+
- **Fulfillment → Billing**: Fulfillment emits `ShipmentDispatched` events; Billing consumes them to generate invoices
|
|
51
|
+
- **Ordering ↔ Billing**: Shared types for `CustomerId` and `Money`
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
The skill infers which structure applies:
|
|
55
|
+
|
|
56
|
+
- If `GLOSSARY-MAP.md` exists, read it to find contexts
|
|
57
|
+
- If only a root `GLOSSARY.md` exists, single context
|
|
58
|
+
- If neither exists, create a root `GLOSSARY.md` lazily when the first term is resolved
|
|
59
|
+
|
|
60
|
+
When multiple contexts exist, infer which one the current topic relates to. If unclear, ask.
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: domain-modeling
|
|
3
|
+
description: Build and sharpen a project's domain model. Use when discussing codebase terminology, writing or editing a GLOSSARY.md, or recording or editing an ADR.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Domain Modeling
|
|
7
|
+
|
|
8
|
+
Actively build and sharpen the project's domain model as you design. This is the *active* discipline: challenging terms, inventing edge-case scenarios, and writing the glossary and decisions down the moment they crystallise. (Merely *reading* `GLOSSARY.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.)
|
|
9
|
+
|
|
10
|
+
## File structure
|
|
11
|
+
|
|
12
|
+
Most repos have a single context:
|
|
13
|
+
|
|
14
|
+
```
|
|
15
|
+
/
|
|
16
|
+
├── GLOSSARY.md
|
|
17
|
+
├── docs/
|
|
18
|
+
│ └── adr/
|
|
19
|
+
│ ├── 0001-event-sourced-orders.md
|
|
20
|
+
│ └── 0002-postgres-for-write-model.md
|
|
21
|
+
└── src/
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
If a `GLOSSARY-MAP.md` exists at the root, the repo has multiple contexts. The map points to where each one lives:
|
|
25
|
+
|
|
26
|
+
```
|
|
27
|
+
/
|
|
28
|
+
├── GLOSSARY-MAP.md
|
|
29
|
+
├── docs/
|
|
30
|
+
│ └── adr/ ← system-wide decisions
|
|
31
|
+
├── src/
|
|
32
|
+
│ ├── ordering/
|
|
33
|
+
│ │ ├── GLOSSARY.md
|
|
34
|
+
│ │ └── docs/adr/ ← context-specific decisions
|
|
35
|
+
│ └── billing/
|
|
36
|
+
│ ├── GLOSSARY.md
|
|
37
|
+
│ └── docs/adr/
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Create files lazily: only when you have something to write. If no `GLOSSARY.md` exists, create one when the first term is resolved. If no `docs/adr/` exists, create it when the first ADR is needed.
|
|
41
|
+
|
|
42
|
+
## During the session
|
|
43
|
+
|
|
44
|
+
### Challenge against the glossary
|
|
45
|
+
|
|
46
|
+
When the user uses a term that conflicts with the existing language in `GLOSSARY.md`, call it out immediately. "Your glossary defines 'cancellation' as X, but you seem to mean Y. Which is it?"
|
|
47
|
+
|
|
48
|
+
### Sharpen fuzzy language
|
|
49
|
+
|
|
50
|
+
When the user uses vague or overloaded terms, propose a precise canonical term. "You're saying 'account': do you mean the Customer or the User? Those are different things."
|
|
51
|
+
|
|
52
|
+
### Discuss concrete scenarios
|
|
53
|
+
|
|
54
|
+
When domain relationships are being discussed, stress-test them with specific scenarios. Invent scenarios that probe edge cases and force the user to be precise about the boundaries between concepts.
|
|
55
|
+
|
|
56
|
+
### Cross-reference with code
|
|
57
|
+
|
|
58
|
+
When the user states how something works, check whether the code agrees. If you find a contradiction, surface it: "Your code cancels entire Orders, but you just said partial cancellation is possible. Which is right?"
|
|
59
|
+
|
|
60
|
+
### Update GLOSSARY.md inline
|
|
61
|
+
|
|
62
|
+
When a term is resolved, update `GLOSSARY.md` right there. Don't batch these up: capture them as they happen. Use the format in [GLOSSARY-FORMAT.md](./GLOSSARY-FORMAT.md).
|
|
63
|
+
|
|
64
|
+
`GLOSSARY.md` should be totally devoid of implementation details. Do not treat `GLOSSARY.md` as a spec, a scratch pad, or a repository for implementation decisions. It is a glossary and nothing else.
|
|
65
|
+
|
|
66
|
+
### Offer ADRs sparingly
|
|
67
|
+
|
|
68
|
+
Only offer to create an ADR when all three are true:
|
|
69
|
+
|
|
70
|
+
1. **Hard to reverse**: the cost of changing your mind later is meaningful
|
|
71
|
+
2. **Surprising without context**: a future reader will wonder "why did they do it this way?"
|
|
72
|
+
3. **The result of a real trade-off**: there were genuine alternatives and you picked one for specific reasons
|
|
73
|
+
|
|
74
|
+
If any of the three is missing, skip the ADR. Use the format in [ADR-FORMAT.md](./ADR-FORMAT.md).
|
|
@@ -123,7 +123,8 @@ The workspace and ledger are shared with superpowers:subagent-driven-development
|
|
|
123
123
|
and the new one resumes from the same ledger.
|
|
124
124
|
|
|
125
125
|
- Each plan owns a workspace: at skill start, run
|
|
126
|
-
`../subagent-driven-development/scripts/sdd-workspace PLAN_FILE`
|
|
126
|
+
`../subagent-driven-development/scripts/sdd-workspace PLAN_FILE` by its
|
|
127
|
+
absolute path, from the working tree you're executing in — it
|
|
127
128
|
prints the plan's git-ignored directory
|
|
128
129
|
(`<repo-root>/.superpowers/sdd/<plan-basename>/`), home to every
|
|
129
130
|
artifact for THIS plan: ledger, briefs, review packages. Another plan's
|
|
@@ -169,7 +170,8 @@ in the workspace and read its tail; read a brief, not the whole plan.
|
|
|
169
170
|
|
|
170
171
|
### 1. Take the task
|
|
171
172
|
|
|
172
|
-
- Run this skill's `scripts/task-start PLAN_FILE N
|
|
173
|
+
- Run this skill's `scripts/task-start PLAN_FILE N` by its absolute path,
|
|
174
|
+
from the working tree you're executing in. It prints the brief
|
|
173
175
|
path and BASE (the commit the task's range is cut from) in one call.
|
|
174
176
|
Read the brief for every task, including ones you remember from setup:
|
|
175
177
|
what you remember is a summary, the brief has the exact values,
|
|
@@ -222,7 +224,7 @@ the claim. If any item is missing, the task is not complete: finish it.
|
|
|
222
224
|
### 4. Complete the task
|
|
223
225
|
|
|
224
226
|
Run this skill's `scripts/task-done PLAN_FILE N BASE -- <test command>`
|
|
225
|
-
with the test command the brief names for the whole task. It runs the
|
|
227
|
+
by its absolute path, from the working tree you're executing in, with the test command the brief names for the whole task. It runs the
|
|
226
228
|
tests, keeps the full output in the workspace, prints the tail, and — only
|
|
227
229
|
if they pass — appends the completion line to the ledger:
|
|
228
230
|
|
|
@@ -234,7 +236,7 @@ mark the todo complete and take the next task.
|
|
|
234
236
|
## Final Review
|
|
235
237
|
|
|
236
238
|
Run `../subagent-driven-development/scripts/review-package PLAN_FILE MERGE_BASE HEAD`
|
|
237
|
-
(MERGE_BASE = the commit the branch started from, e.g.
|
|
239
|
+
by its absolute path, from the working tree you're executing in (MERGE_BASE = the commit the branch started from, e.g.
|
|
238
240
|
`git merge-base main HEAD`) and review from the file it prints.
|
|
239
241
|
|
|
240
242
|
**With a subagent tool:** dispatch the reviewer on the most capable
|