@roomi-fields/grillhouse 0.34.2 → 0.35.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/.claude-plugin/plugin.json +1 -1
- package/CHANGELOG.md +21 -13
- package/cadre/templates/projet/.claude/settings.json +0 -1
- package/charte.md +4 -4
- package/docs/ARCHITECTURE.md +10 -4
- package/docs/INTERFACE.md +4 -3
- package/hooks/crochet.mjs +0 -6
- package/package.json +1 -1
- package/scripts/activites.mjs +41 -7
- package/scripts/circuit.mjs +10 -2
- package/scripts/enveloppe/enveloppe.mjs +44 -14
- package/scripts/enveloppe/lancer.sh +5 -1
- package/scripts/enveloppe/paquets-du-plan.mjs +3 -0
- package/scripts/flux-des-paquets.mjs +22 -8
- package/scripts/grillhouse-maj.mjs +19 -0
- package/scripts/mesure/base-de-passe.mjs +7 -0
- package/scripts/migrations/0.35.0-greffon-mattpocock-retire.mjs +41 -0
- package/scripts/migrations.mjs +2 -0
- package/scripts/places-du-serveur.mjs +12 -2
- package/scripts/seances.mjs +24 -2
- package/scripts/superviseur.mjs +6 -1
- package/scripts/tableau.mjs +19 -2
- package/scripts/verrous/verrou.mjs +7 -0
- 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/grill/SKILL.md +4 -5
- package/skills/grilling/SKILL.md +30 -0
- package/skills/pitmaster/SKILL.md +4 -3
- package/skills/pitmaster/references/cadre.md +1 -1
- package/skills/redacteur/SKILL.md +1 -1
- package/skills/testwriter/SKILL.md +7 -4
- package/skills/writing-for-agents/SKILL-MECHANICS.md +22 -0
- package/skills/writing-for-agents/SKILL.md +81 -0
|
@@ -69,9 +69,19 @@ export async function avecReprises(
|
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
|
+
/**
|
|
73
|
+
* Whether the socket <s> is connected to itself: its local end is its remote end, as Linux opens a
|
|
74
|
+
* connection to a free local port whose source port happens to be that port (TCP simultaneous
|
|
75
|
+
* open; go-redis and Go's PostgreSQL driver tell it the same way).
|
|
76
|
+
* @param {import('node:net').Socket} s
|
|
77
|
+
*/
|
|
78
|
+
export const connecteeASoi = s =>
|
|
79
|
+
s.localPort === s.remotePort && s.localAddress === s.remoteAddress;
|
|
80
|
+
|
|
72
81
|
/**
|
|
73
82
|
* Whether something listens on <adresse> (`hote:port`): false when the connection is refused (no
|
|
74
|
-
* server), true when it opens or does not
|
|
83
|
+
* server) or opens on itself (`connecteeASoi`), true when it opens on another end or does not
|
|
84
|
+
* answer within <delaiMs> (a server busy).
|
|
75
85
|
* @param {string} adresse
|
|
76
86
|
* @param {number} [delaiMs]
|
|
77
87
|
* @returns {Promise<boolean>}
|
|
@@ -84,7 +94,7 @@ export function ecoute(adresse, delaiMs = 2_000) {
|
|
|
84
94
|
s.destroy();
|
|
85
95
|
ok(r);
|
|
86
96
|
};
|
|
87
|
-
s.once('connect', () => fin(
|
|
97
|
+
s.once('connect', () => fin(!connecteeASoi(s)));
|
|
88
98
|
s.once('error', () => fin(false));
|
|
89
99
|
s.setTimeout(delaiMs, () => fin(true));
|
|
90
100
|
});
|
package/scripts/seances.mjs
CHANGED
|
@@ -134,6 +134,7 @@ export function rangDeLaSeance(ctx, id) {
|
|
|
134
134
|
fin: path.join(dossier, 'fin'),
|
|
135
135
|
resultat: path.join(dossier, 'resultat.json'),
|
|
136
136
|
horsPlan: path.join(dossier, 'hors-plan'),
|
|
137
|
+
horsPlanFait: path.join(dossier, 'hors-plan.json'),
|
|
137
138
|
};
|
|
138
139
|
}
|
|
139
140
|
|
|
@@ -147,6 +148,7 @@ function resultatRange(rang, id) {
|
|
|
147
148
|
seance: Number(readFileSync(rang.fin, 'utf8').trim()),
|
|
148
149
|
bloque: false,
|
|
149
150
|
horsPlan: existsSync(rang.horsPlan) ? lire(rang.horsPlan).trim() : null,
|
|
151
|
+
ecriture: ecritureRangee(rang),
|
|
150
152
|
erreur: null,
|
|
151
153
|
sortie: lire(rang.resultat).trim(),
|
|
152
154
|
id,
|
|
@@ -244,6 +246,7 @@ export async function lancer(
|
|
|
244
246
|
rmSync(rang.fin, { force: true });
|
|
245
247
|
rmSync(rang.resultat, { force: true });
|
|
246
248
|
rmSync(rang.horsPlan, { force: true });
|
|
249
|
+
rmSync(rang.horsPlanFait, { force: true });
|
|
247
250
|
inscrire(ctx, {
|
|
248
251
|
role: AUTEUR_DU_CIRCUIT,
|
|
249
252
|
lancement: { role, seance: id, ...(objet ? { objet } : {}) },
|
|
@@ -373,6 +376,7 @@ export async function lancer(
|
|
|
373
376
|
let seance;
|
|
374
377
|
let sortie;
|
|
375
378
|
let horsPlan = null;
|
|
379
|
+
let ecriture = null;
|
|
376
380
|
if (horsEnveloppe) {
|
|
377
381
|
seance = existsSync(rang.fin)
|
|
378
382
|
? Number(readFileSync(rang.fin, 'utf8').trim())
|
|
@@ -389,12 +393,14 @@ export async function lancer(
|
|
|
389
393
|
seance = existsSync(rang.fin) ? Number(readFileSync(rang.fin, 'utf8').trim()) : null;
|
|
390
394
|
sortie = lire(rang.resultat).trim();
|
|
391
395
|
horsPlan = existsSync(rang.horsPlan) ? lire(rang.horsPlan).trim() : null;
|
|
396
|
+
ecriture = ecritureRangee(rang);
|
|
392
397
|
}
|
|
393
398
|
return {
|
|
394
399
|
code: r.code,
|
|
395
400
|
seance,
|
|
396
401
|
bloque: r.bloque,
|
|
397
402
|
horsPlan,
|
|
403
|
+
ecriture,
|
|
398
404
|
erreur: r.erreur ?? lire(erreurs),
|
|
399
405
|
sortie,
|
|
400
406
|
id,
|
|
@@ -747,15 +753,31 @@ function avecLesReponses(constats, fiche) {
|
|
|
747
753
|
});
|
|
748
754
|
}
|
|
749
755
|
|
|
756
|
+
// The write the lock stopped, `{ chemin, paquet, racine }`, as it ranged it at <rang>
|
|
757
|
+
// (`hors-plan.json`), or null without it.
|
|
758
|
+
function ecritureRangee(rang) {
|
|
759
|
+
return existsSync(rang.horsPlanFait) ? JSON.parse(lire(rang.horsPlanFait)) : null;
|
|
760
|
+
}
|
|
761
|
+
|
|
750
762
|
// The launch <r> of a session of <role>, or the Arret it is: a session its lock stopped on a
|
|
751
763
|
// write out of the plan (« hors-plan », the write as its piece), a motionless session
|
|
752
764
|
// (« bloqué »), a launch that stops before its session (« lancement »).
|
|
753
765
|
export function seanceLancee(ctx, role, r) {
|
|
754
766
|
if (r.horsPlan) {
|
|
767
|
+
// The lock's structured write: the first line of the report names the path and its package;
|
|
768
|
+
// the question carries the command (none for the root, which no package holds).
|
|
769
|
+
const ecriture = r.ecriture;
|
|
770
|
+
const nom = ecriture ? (ecriture.racine ? 'la racine du dépôt' : ecriture.paquet) : null;
|
|
771
|
+
const dit = ecriture ? `${ecriture.chemin} est dans ${nom}` : null;
|
|
772
|
+
const question = !ecriture
|
|
773
|
+
? null
|
|
774
|
+
: ecriture.racine
|
|
775
|
+
? `La séance écrit ${ecriture.chemin}, que tient la racine du dépôt, hors du plan du ticket : aucun paquet ne le porte, l'écriture est-elle refusée (\`--reprendre\` avec son contexte) ?`
|
|
776
|
+
: `La séance écrit ${ecriture.chemin}, que tient ${ecriture.paquet}, hors du plan du ticket : le plan s'étend-il à ce paquet (\`--etendre ${ecriture.paquet}\`), ou l'écriture est-elle refusée (\`--reprendre\` avec son contexte) ?`;
|
|
755
777
|
throw new Arret(
|
|
756
778
|
'hors-plan',
|
|
757
|
-
`Le crochet de la séance du ${nomDuRole(role)} l'arrête sur une écriture hors du plan du ticket (ses paquets : ${ctx.paquets.join(', ')}) :\n\n${r.horsPlan}`,
|
|
758
|
-
{ piece: r.horsPlan }
|
|
779
|
+
`${dit ? `${dit}, hors du plan du ticket (ses paquets : ${ctx.paquets.join(', ')}).\n\n` : ''}Le crochet de la séance du ${nomDuRole(role)} l'arrête sur une écriture hors du plan du ticket (ses paquets : ${ctx.paquets.join(', ')}) :\n\n${r.horsPlan}`,
|
|
780
|
+
{ piece: r.horsPlan, ...(question ? { question } : {}) }
|
|
759
781
|
);
|
|
760
782
|
}
|
|
761
783
|
if (r.bloque) {
|
package/scripts/superviseur.mjs
CHANGED
|
@@ -111,6 +111,11 @@ function seance(depart = process.ppid) {
|
|
|
111
111
|
return depart;
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
+
// The time in ms of <texte>, a `defer_until` as Beads writes it: the local wall time of the
|
|
115
|
+
// machine, followed by a « Z » it does not mean (`bd update --defer 17:30` gives `…T17:30:00Z`);
|
|
116
|
+
// NaN without one.
|
|
117
|
+
const heureMurale = texte => Date.parse(String(texte ?? '').replace(/Z$/, ''));
|
|
118
|
+
|
|
114
119
|
/**
|
|
115
120
|
* Of the tickets <tickets> (as `bd show --json` gives them), the ids of those whose question does
|
|
116
121
|
* not wait for the supervisor at <maintenant> (ms): closed, or deferred to a later time
|
|
@@ -123,7 +128,7 @@ function seance(depart = process.ppid) {
|
|
|
123
128
|
export function horsAttente(tickets, maintenant) {
|
|
124
129
|
return new Set(
|
|
125
130
|
tickets
|
|
126
|
-
.filter(t => t.status === 'closed' ||
|
|
131
|
+
.filter(t => t.status === 'closed' || heureMurale(t.defer_until) > maintenant)
|
|
127
132
|
.map(t => t.id)
|
|
128
133
|
);
|
|
129
134
|
}
|
package/scripts/tableau.mjs
CHANGED
|
@@ -1525,7 +1525,9 @@ export function lignes(t, nom, largeur = LARGEUR, groupes = {}) {
|
|
|
1525
1525
|
const colonneDe = etiquette => `[${etiquette}]`.padEnd(large);
|
|
1526
1526
|
L(nom.toUpperCase(), TONS.titre);
|
|
1527
1527
|
if (plusieurs) {
|
|
1528
|
-
//
|
|
1528
|
+
// The three lines of states of each project, as one project's board says them: the first
|
|
1529
|
+
// under its label, the two others aligned below it; or the fault that keeps its board out.
|
|
1530
|
+
const retrait = ' '.repeat(large);
|
|
1529
1531
|
for (const p of t.projets) {
|
|
1530
1532
|
if (p.erreur) {
|
|
1531
1533
|
L(cadre(`${colonneDe(p.etiquette)}⚠ ${p.erreur}`, '', largeur), TONS.panne);
|
|
@@ -1534,11 +1536,26 @@ export function lignes(t, nom, largeur = LARGEUR, groupes = {}) {
|
|
|
1534
1536
|
const c = p.compteurs;
|
|
1535
1537
|
L(
|
|
1536
1538
|
cadre(
|
|
1537
|
-
`${colonneDe(p.etiquette)}▶ ${c.enCours} en cours ·
|
|
1539
|
+
`${colonneDe(p.etiquette)}▶ ${c.enCours} en cours · ${c.bloques ?? 0} bloqués · ${c.fermes} faits`,
|
|
1538
1540
|
'',
|
|
1539
1541
|
largeur
|
|
1540
1542
|
)
|
|
1541
1543
|
);
|
|
1544
|
+
L(
|
|
1545
|
+
cadre(
|
|
1546
|
+
`${retrait}⏭ file : ${c.enAttente} en circuit · ${c.fileDirecte ?? 0} en direct`,
|
|
1547
|
+
'',
|
|
1548
|
+
largeur
|
|
1549
|
+
)
|
|
1550
|
+
);
|
|
1551
|
+
L(
|
|
1552
|
+
cadre(
|
|
1553
|
+
`${retrait}${c.sansGo ?? 0} sans go · ${c.aValider ?? 0} à valider · ${c.reportes ?? 0} reportés`,
|
|
1554
|
+
'',
|
|
1555
|
+
largeur
|
|
1556
|
+
),
|
|
1557
|
+
c.sansGo ? TONS.sansGo : c.aValider ? TONS.aValider : TONS.reportes
|
|
1558
|
+
);
|
|
1542
1559
|
}
|
|
1543
1560
|
// The discoveries of the day, summed across the projects (grillhouse-3uv.96, criterion 14).
|
|
1544
1561
|
const d96 = t.decouvertes ?? { new: 0, check: 0, rejetes: 0, valides: 0 };
|
|
@@ -40,6 +40,7 @@ import { pathToFileURL } from 'node:url';
|
|
|
40
40
|
import {
|
|
41
41
|
ecritsDuPlan,
|
|
42
42
|
MARQUE_HORS_PLAN,
|
|
43
|
+
MARQUE_HORS_PLAN_FAIT,
|
|
43
44
|
paquetQuiTient,
|
|
44
45
|
paquetsDeLEnveloppe,
|
|
45
46
|
paquetsDuLangage,
|
|
@@ -125,6 +126,8 @@ export function horsDuPlan(input, { tmp = tmpdir(), env = process.env, role = nu
|
|
|
125
126
|
const paquet = tenant === '.' ? 'la racine du dépôt' : tenant;
|
|
126
127
|
return {
|
|
127
128
|
paquet,
|
|
129
|
+
chemin: rel,
|
|
130
|
+
racine: tenant === '.',
|
|
128
131
|
raison: `⛔ hors-plan — ${rel} est dans ${paquet}, hors des paquets du plan (${plan.join(', ')}) : ta séance s'arrête là, et le superviseur étend le plan ou refuse l'écriture.`,
|
|
129
132
|
};
|
|
130
133
|
}
|
|
@@ -267,6 +270,10 @@ if (import.meta.url === pathToFileURL(process.argv[1] ?? '').href) {
|
|
|
267
270
|
// The mark for the circuit; the stop below is the hook's answer, mark or not.
|
|
268
271
|
try {
|
|
269
272
|
writeFileSync(path.join(tmpdir(), MARQUE_HORS_PLAN), stop.raison);
|
|
273
|
+
writeFileSync(
|
|
274
|
+
path.join(tmpdir(), MARQUE_HORS_PLAN_FAIT),
|
|
275
|
+
JSON.stringify({ chemin: stop.chemin, paquet: stop.paquet, racine: stop.racine })
|
|
276
|
+
);
|
|
270
277
|
} catch {
|
|
271
278
|
// A working directory gone leaves no mark; the session still stops.
|
|
272
279
|
}
|
|
@@ -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 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).
|
package/skills/grill/SKILL.md
CHANGED
|
@@ -63,7 +63,7 @@ une passe longue : lance-la en tâche de fond et relis son code à la fin. Le pr
|
|
|
63
63
|
lui), une raison de changer, une donnée qui traverse. Une fusion se justifie de même : deux
|
|
64
64
|
parties qui changent toujours ensemble, qu'aucun consommateur ne sépare. Ainsi chaque frontière
|
|
65
65
|
découle de l'architecture.
|
|
66
|
-
- **Les mots de la structure** : tu charges `
|
|
66
|
+
- **Les mots de la structure** : tu charges `grillhouse:codebase-design` avant le grill et tu
|
|
67
67
|
emploies ses mots (module, interface, profondeur, jointure). Ainsi le responsable et les agents
|
|
68
68
|
parlent de la structure avec les mêmes mots.
|
|
69
69
|
- **Chaque recommandation cite sa référence mature** : elle dit ce que ferait le produit mature du
|
|
@@ -98,8 +98,7 @@ ce qui doit être. Ainsi chaque décision part de l'état réel du code.
|
|
|
98
98
|
|
|
99
99
|
## 4. Le grill d'initialisation
|
|
100
100
|
|
|
101
|
-
Charge `
|
|
102
|
-
signale au responsable que le greffon `mattpocock-skills` manque) : des tours numérotés, chaque
|
|
101
|
+
Charge `grillhouse:grilling` et suis-le : des tours numérotés, chaque
|
|
103
102
|
question avec ta recommandation et ses pièces, la frontière de l'arbre des décisions à chaque tour.
|
|
104
103
|
**Le grill se mène en entier**, par tours, même quand le responsable pose la question en une
|
|
105
104
|
phrase. Ainsi chaque décision de structure passe par l'architecture, et une réponse directe ne
|
|
@@ -161,7 +160,7 @@ remplace jamais le grill. Les branches de l'arbre :
|
|
|
161
160
|
10. **L'architecture** — les trois ou quatre choix qui commandent le reste, chacun avec sa raison et
|
|
162
161
|
l'objectif qu'il sert ; les données centrales ; où le code tourne.
|
|
163
162
|
11. **Le lexique** — les mots du domaine dont la définition change du code
|
|
164
|
-
(`
|
|
163
|
+
(`grillhouse:domain-modeling`).
|
|
165
164
|
12. **Le premier chantier** — ce qui se construit d'abord, et ce qui attend.
|
|
166
165
|
|
|
167
166
|
**La fin du grill** : le grill est fini quand la frontière est vide, que chaque composant et chaque
|
|
@@ -172,7 +171,7 @@ ensuite. Ainsi les documents écrivent des décisions prises.
|
|
|
172
171
|
## 5. Écrire
|
|
173
172
|
|
|
174
173
|
- Les documents lus par un humain s'écrivent avec la compétence `redacteur` (référence
|
|
175
|
-
« Les documents d'un composant ») ; la charte avec `
|
|
174
|
+
« Les documents d'un composant ») ; la charte avec `grillhouse:writing-for-agents`.
|
|
176
175
|
- **Les champs de la charte** : chaque champ `<…>` de la charte modèle reçoit sa valeur. Ainsi la
|
|
177
176
|
charte cadre les agents dès la séance suivante.
|
|
178
177
|
- `package.json` (nom, description, auteur, dépôt), `README.md`, `LICENSE`, `CREDITS.md`,
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: grilling
|
|
3
|
+
description: Grill the user relentlessly about a plan, decision, or idea. Use when the user wants to stress-test their thinking, or uses any 'grill' trigger phrases.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Interview the user relentlessly until you reach a shared understanding. Map this as a **design tree**: every decision branches into the decisions that hang off it.
|
|
7
|
+
|
|
8
|
+
Work the tree in **rounds**. The **frontier** is every decision whose prerequisites are already settled: the questions you can ask _now_ without guessing at answers you haven't heard yet. Ask the whole frontier in one round: number each question and give your recommended answer. Then wait for the user's answers before the next round.
|
|
9
|
+
|
|
10
|
+
Format a round like so:
|
|
11
|
+
|
|
12
|
+
```
|
|
13
|
+
❓ **Q1** - **<question title>**: <question body, might be multiple paragraphs, including multiple choices>
|
|
14
|
+
|
|
15
|
+
➡️ <your recommended answer>
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
❓ **Q2** - **<question title>**: <question body, might be multiple paragraphs, including multiple choices>
|
|
20
|
+
|
|
21
|
+
➡️ <your recommended answer>
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Word each question so "yes" accepts your recommended answer.
|
|
25
|
+
|
|
26
|
+
Each round the user answers reshapes the tree: settled decisions push the frontier outward and unblock questions that depended on them. Recompute the frontier and ask the next round. A question whose answer depends on another question still open in this round belongs to a _later_ round, not this one.
|
|
27
|
+
|
|
28
|
+
Finding _facts_ is your job, never the user's. When a frontier question needs a fact from the environment (filesystem, tools, etc.), dispatch a sub-agent to find it; don't ask the user for anything you could look up yourself. Don't block on it: a running exploration is an unsettled prerequisite, so only the questions downstream of it wait for the sub-agent to report; ask the rest of the frontier now. The _decisions_ are the user's: put each to them and wait.
|
|
29
|
+
|
|
30
|
+
The session is done when the frontier is empty: every branch of the design tree visited, nothing left silently assumed. Do not act on it until the user confirms you have reached a shared understanding.
|