bigpowers 1.0.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.
Files changed (96) hide show
  1. package/.gitmessage +5 -0
  2. package/.releaserc.json +17 -0
  3. package/CHANGELOG.md +61 -0
  4. package/CLAUDE.md +61 -0
  5. package/CONVENTIONS.md +140 -0
  6. package/GEMINI.md +53 -0
  7. package/LICENSE +21 -0
  8. package/README.md +116 -0
  9. package/RELEASE.md +108 -0
  10. package/SKILL-INDEX.md +146 -0
  11. package/assess-impact/SKILL.md +76 -0
  12. package/audit-code/HEURISTICS.md +43 -0
  13. package/audit-code/SKILL.md +81 -0
  14. package/bin/bigpowers.js +27 -0
  15. package/change-request/REFERENCE.md +60 -0
  16. package/change-request/SKILL.md +42 -0
  17. package/commit-message/REFERENCE.md +81 -0
  18. package/commit-message/SKILL.md +39 -0
  19. package/countable-story-format.md +293 -0
  20. package/craft-skill/REFERENCE.md +88 -0
  21. package/craft-skill/SKILL.md +55 -0
  22. package/deepen-architecture/DEEPENING.md +37 -0
  23. package/deepen-architecture/INTERFACE-DESIGN.md +44 -0
  24. package/deepen-architecture/LANGUAGE.md +53 -0
  25. package/deepen-architecture/SKILL.md +76 -0
  26. package/define-language/SKILL.md +75 -0
  27. package/define-success/SKILL.md +60 -0
  28. package/delegate-task/SKILL.md +70 -0
  29. package/design-interface/SKILL.md +94 -0
  30. package/develop-tdd/SKILL.md +160 -0
  31. package/develop-tdd/deep-modules.md +33 -0
  32. package/develop-tdd/interface-design.md +31 -0
  33. package/develop-tdd/mocking.md +59 -0
  34. package/develop-tdd/refactoring.md +10 -0
  35. package/develop-tdd/tests.md +71 -0
  36. package/dispatch-agents/SKILL.md +72 -0
  37. package/edit-document/SKILL.md +14 -0
  38. package/elaborate-spec/SKILL.md +79 -0
  39. package/enforce-first/SKILL.md +75 -0
  40. package/execute-plan/SKILL.md +84 -0
  41. package/grill-me/REFERENCE.md +63 -0
  42. package/grill-me/SKILL.md +25 -0
  43. package/guard-git/REFERENCE.md +136 -0
  44. package/guard-git/SKILL.md +39 -0
  45. package/guard-git/scripts/block-dangerous-git.sh +41 -0
  46. package/guard-git/scripts/lib/git-guardrails-core.sh +29 -0
  47. package/hook-commits/SKILL.md +91 -0
  48. package/hooks/pre-tool-use.sh +130 -0
  49. package/index.js +6 -0
  50. package/inspect-quality/SKILL.md +101 -0
  51. package/investigate-bug/SKILL.md +111 -0
  52. package/kickoff-branch/SKILL.md +87 -0
  53. package/map-codebase/SKILL.md +66 -0
  54. package/migrate-spec/REFERENCE-GSD.md +137 -0
  55. package/migrate-spec/REFERENCE.md +186 -0
  56. package/migrate-spec/SKILL.md +150 -0
  57. package/model-domain/ADR-FORMAT.md +47 -0
  58. package/model-domain/CONTEXT-FORMAT.md +77 -0
  59. package/model-domain/SKILL.md +82 -0
  60. package/opencode.json +4 -0
  61. package/orchestrate-project/REFERENCE.md +89 -0
  62. package/orchestrate-project/SKILL.md +59 -0
  63. package/organize-workspace/REFERENCE.md +80 -0
  64. package/organize-workspace/SKILL.md +74 -0
  65. package/package.json +45 -0
  66. package/plan-refactor/SKILL.md +75 -0
  67. package/plan-release/SKILL.md +75 -0
  68. package/plan-work/SKILL.md +124 -0
  69. package/playwright.config.ts +56 -0
  70. package/release-branch/SKILL.md +116 -0
  71. package/request-review/SKILL.md +70 -0
  72. package/respond-review/SKILL.md +68 -0
  73. package/scripts/audit-compliance.sh +256 -0
  74. package/scripts/cleanup-worktrees.sh +44 -0
  75. package/scripts/install-cursor-skills-local.sh +13 -0
  76. package/scripts/install-cursor-skills.sh +34 -0
  77. package/scripts/install.sh +240 -0
  78. package/scripts/project-survey.sh +54 -0
  79. package/scripts/sync-skills.sh +110 -0
  80. package/seed-conventions/SKILL.md +185 -0
  81. package/session-state/SKILL.md +69 -0
  82. package/skills-lock.json +157 -0
  83. package/spike-prototype/SKILL.md +92 -0
  84. package/survey-context/SKILL.md +93 -0
  85. package/terse-mode/SKILL.md +35 -0
  86. package/trace-requirement/SKILL.md +68 -0
  87. package/using-bigpowers/SKILL.md +65 -0
  88. package/validate-fix/SKILL.md +93 -0
  89. package/visual-dashboard/SKILL.md +49 -0
  90. package/visual-dashboard/scripts/frame-template.html +189 -0
  91. package/visual-dashboard/scripts/helper.js +83 -0
  92. package/visual-dashboard/scripts/server.cjs +345 -0
  93. package/visual-dashboard/scripts/start-server.sh +121 -0
  94. package/visual-dashboard/scripts/stop-server.sh +46 -0
  95. package/wire-observability/SKILL.md +90 -0
  96. package/write-document/SKILL.md +63 -0
@@ -0,0 +1,293 @@
1
+ # Countable Story Format
2
+
3
+ The canonical format for stories and bug-fix specs that need to be **countable** — i.e., readable by automated counters that score scope, sizing, and non-functional coverage. Every spec-producing skill in bigpowers writes output in this format.
4
+
5
+ This is a structural contract. Counters key off the exact section names and order. Section omissions are not equivalent to "no content here" — they make the spec uncountable. Use `Not applicable` instead.
6
+
7
+ ---
8
+
9
+ ## Hard rules
10
+
11
+ 1. **Every section must be present.** Empty sections are written as `Not applicable` with a one-line reason. Deleting a section caps maturity at 3.
12
+ 2. **Section names and order are fixed.** Do not rename, merge, or reorder. Counters do not infer location.
13
+ 3. **Sections 14, 15, 16 are tagged `*NFR*`** in their heading. The NFR ratio = (§14 + §15 + §16 content) / total content. The tag must be present even when the section is `Not applicable`.
14
+ 4. **Sizing uses Fibonacci only.** XS=1, S=2, M=3, L=5, XL=8. Any other value is invalid.
15
+ 5. **Acceptance criteria are Gherkin only** (`Scenario / Given / When / Then`) and live in §17.
16
+ 6. **Acceptance criteria must cover the main flow (§5) plus every alternative/exception listed in §6.** One scenario per branch, minimum.
17
+ 7. **Multiple occurrences of the same dimension are listed separately**, each with its own one-line rationale. Do not collapse.
18
+
19
+ ## Maturity rubric (self-score in the header)
20
+
21
+ | Score | Label | Definition |
22
+ |------|-------|------------|
23
+ | 1 | Napkin | Only §1, §2, §17 populated. |
24
+ | 2 | Sketch | §1–§6 populated; data model implicit. |
25
+ | **3** | **Countable** | **§1–§16 populated. Counter runs cleanly. Wording may still be loose.** |
26
+ | 4 | Refined | §1–§20 populated. Gherkin covers every business rule. Open questions tracked but non-blocking. |
27
+ | 5 | Implementation-ready | All sections final. Data model precise enough for codegen. No open questions. References complete. |
28
+
29
+ **Sprint commitment gate:** maturity ≥ 4 recommended. Anything below 3 is blocked from sprint commit unless risk is explicitly accepted.
30
+
31
+ ---
32
+
33
+ ## Header block (mandatory)
34
+
35
+ ```
36
+ STORY KEY: <PROJECT-NNN>
37
+ TITLE: <short imperative title>
38
+ TYPE: Story | Spike | Bug | Enabler
39
+ PARENT: <epic key or N/A>
40
+ STATUS: Draft | Ready for refinement | Refined | Counted | In sprint
41
+ AUTHOR: <name> DATE: <YYYY-MM-DD>
42
+ MATURITY: <self-score 1-5>
43
+ SIZE: XS | S | M | L | XL (Fibonacci 1/2/3/5/8)
44
+ ```
45
+
46
+ `SIZE` is optional at maturity 3; required at maturity 4+.
47
+
48
+ ---
49
+
50
+ ## The 20 sections
51
+
52
+ Headings appear verbatim, including the numbers.
53
+
54
+ ### 1. Business narrative
55
+
56
+ Two to four paragraphs of plain business prose. No solution language. No `As a / I want` phrasing — that belongs in §2. Describe the situation, the friction, and the desired outcome from the business point of view.
57
+
58
+ ### 2. Value statement
59
+
60
+ A single line:
61
+ ```
62
+ As a <actor>, I want <capability>, so that <outcome>.
63
+ ```
64
+ Retained for portfolio-level skim. One line, no expansion.
65
+
66
+ ### 3. Actors and permissions
67
+
68
+ List of actors and what they are allowed to do. Mark each as `internal | external | system`.
69
+
70
+ ### 4. Trigger and preconditions
71
+
72
+ What event starts this flow. What must be true before it can run.
73
+
74
+ ### 5. Main flow and business logic
75
+
76
+ Numbered steps describing the happy path. Decision points are explicit. Include the line `Interruption point: <where the flow can be paused/resumed or N/A>`.
77
+
78
+ ### 6. Alternative flows and exceptions
79
+
80
+ Numbered list of every branch and every error path. Each entry must be referenced by a Gherkin scenario in §17.
81
+
82
+ ### 7. Interface elements
83
+
84
+ ```
85
+ Context: new | existing
86
+ Static elements: <list>
87
+ Dynamic elements: <list>
88
+ ```
89
+ Max five elements per cluster. If more, split into clusters.
90
+
91
+ ### 8. Domain model
92
+
93
+ Entities touched, entities created, relationships changed. Reference `specs/CONTEXT.md` and `specs/UBIQUITOUS_LANGUAGE.md` where applicable.
94
+
95
+ ### 9. Integrations and boundaries
96
+
97
+ Each integration tagged `perennial | ethereal` and `direction: in | out | both`.
98
+
99
+ ### 10. Background processes
100
+
101
+ Each tagged `event | scheduled | manual+scheduled | external`.
102
+
103
+ ### 11. Notifications
104
+
105
+ One entry per notification: channel, recipient, trigger event.
106
+
107
+ ### 12. Audit and logging
108
+
109
+ Audited entities and the audit fields captured.
110
+
111
+ ### 13. Solution variabilities
112
+
113
+ For each parameter: source (`config | tenant | feature flag | role`) and behaviour per value.
114
+
115
+ ### 14. Quality attributes *NFR*
116
+
117
+ Concrete service-level targets: p95 latency, uptime, scale ceiling, reliability. Numbers only — no adjectives.
118
+
119
+ ### 15. Security and compliance *NFR*
120
+
121
+ AuthN method, AuthZ model, data classification, applicable regulations, controls in place.
122
+
123
+ ### 16. UX and accessibility *NFR*
124
+
125
+ WCAG level, i18n scope, supported modalities, branding constraints.
126
+
127
+ ### 17. Acceptance criteria
128
+
129
+ Gherkin scenarios:
130
+ ```
131
+ Scenario: <name>
132
+ Given <precondition>
133
+ When <action>
134
+ Then <outcome>
135
+ ```
136
+ At least one scenario for the main flow (§5) and one per branch in §6.
137
+
138
+ ### 18. Out of scope
139
+
140
+ Explicit non-goals. Phrased as full sentences, not single words.
141
+
142
+ ### 19. Open questions
143
+
144
+ ```
145
+ - <question> — owner: <name>, needed by: <YYYY-MM-DD>
146
+ ```
147
+ A non-empty §19 caps maturity at 3.
148
+
149
+ ### 20. References
150
+
151
+ Links to design docs, RFCs, ADRs, prior stories, datasets, prototypes.
152
+
153
+ ---
154
+
155
+ ## Bug-fix specs (DIAGNOSIS.md)
156
+
157
+ Bug fixes use the same header block and the same 20 sections. The minimum required for "Countable" on a bug fix:
158
+
159
+ - §1 — describe actual vs. expected behavior and reproduction.
160
+ - §5 — the verified root-cause flow (output of the 4-phase RCA).
161
+ - §6 — alternative hypotheses ruled out.
162
+ - §17 — Gherkin: at least one regression scenario that fails before the fix and passes after.
163
+ - §18 — what this fix deliberately does not change.
164
+ - §19 — anything still unverified.
165
+
166
+ Sections 2–4, 7–16, 20 are marked `Not applicable — <reason>` if the fix is purely behavioral.
167
+
168
+ ---
169
+
170
+ ## Refactors and spikes
171
+
172
+ Refactors and spikes are not user stories and do **not** use this format. They keep their existing lightweight templates (`specs/REFACTOR.md`, `specs/SPIKE-<name>.md`). They are not counted.
173
+
174
+ ---
175
+
176
+ ## Worked example (minimal countable story)
177
+
178
+ ```
179
+ STORY KEY: ACME-101
180
+ TITLE: Self-serve password reset
181
+ TYPE: Story
182
+ PARENT: ACME-EPIC-7
183
+ STATUS: Draft
184
+ AUTHOR: dvm DATE: 2026-05-23
185
+ MATURITY: 3
186
+ SIZE: M
187
+
188
+ ### 1. Business narrative
189
+ Customer-support handles ~120 password reset tickets per week. Each ticket
190
+ costs an average of 8 minutes of agent time. Customers wait 4 hours on
191
+ average for a reply. Both numbers are unacceptable for our SLA tier.
192
+
193
+ ### 2. Value statement
194
+ As a signed-out customer, I want to reset my own password, so that I can
195
+ get back into my account without contacting support.
196
+
197
+ ### 3. Actors and permissions
198
+ - Customer (external) — initiate reset, set new password.
199
+ - Auth service (system) — issue and verify reset tokens.
200
+
201
+ ### 4. Trigger and preconditions
202
+ Trigger: customer clicks "Forgot password" on the sign-in screen.
203
+ Precondition: an account with the supplied email exists and is not locked.
204
+
205
+ ### 5. Main flow and business logic
206
+ 1. Customer submits email.
207
+ 2. System creates single-use reset token (TTL 30 min).
208
+ 3. System emails token link to the registered address.
209
+ 4. Customer opens link and submits new password.
210
+ 5. System verifies token, updates password hash, invalidates token.
211
+ 6. System redirects to sign-in.
212
+ Interruption point: between steps 3 and 4 (link sent, not yet clicked).
213
+
214
+ ### 6. Alternative flows and exceptions
215
+ 6a. Email not registered — respond identically to success path (do not leak).
216
+ 6b. Token expired — display generic "request a new link" message.
217
+ 6c. Account locked — redirect to support contact page; do not issue token.
218
+
219
+ ### 7. Interface elements
220
+ Context: existing.
221
+ Static elements: page title, email input, submit button.
222
+ Dynamic elements: validation message, throttle banner.
223
+
224
+ ### 8. Domain model
225
+ Entities touched: User, AuthCredential. New entity: PasswordResetToken
226
+ (user_id, token_hash, expires_at, used_at).
227
+
228
+ ### 9. Integrations and boundaries
229
+ - Email provider (perennial, direction: out).
230
+
231
+ ### 10. Background processes
232
+ - Token sweeper (scheduled, hourly) — purges expired tokens.
233
+
234
+ ### 11. Notifications
235
+ - Email — recipient: registered user — trigger: token issued.
236
+
237
+ ### 12. Audit and logging
238
+ Audited entity: PasswordResetToken. Fields: issued_at, used_at, ip.
239
+
240
+ ### 13. Solution variabilities
241
+ - TTL (config) — default 30 min, override per tenant.
242
+
243
+ ### 14. Quality attributes *NFR*
244
+ - p95 reset-flow end-to-end < 60 s including email delivery.
245
+ - 99.9% monthly uptime on the reset endpoint.
246
+
247
+ ### 15. Security and compliance *NFR*
248
+ - AuthN: anonymous on request, token-based on completion.
249
+ - AuthZ: token bound to user_id; single use.
250
+ - Data class: PII (email).
251
+ - Controls: rate-limit 5/hour/IP; token-hash at rest.
252
+
253
+ ### 16. UX and accessibility *NFR*
254
+ - WCAG 2.1 AA.
255
+ - i18n: en, pt-BR at launch.
256
+
257
+ ### 17. Acceptance criteria
258
+ Scenario: Happy path
259
+ Given a registered customer at the sign-in screen
260
+ When the customer requests a password reset for their email
261
+ Then an email with a single-use link is sent within 60 seconds
262
+
263
+ Scenario: Unknown email (6a)
264
+ Given an email that is not registered
265
+ When the customer requests a password reset
266
+ Then the UI shows the same confirmation as the happy path
267
+ And no email is sent
268
+
269
+ Scenario: Expired token (6b)
270
+ Given a reset token older than 30 minutes
271
+ When the customer opens the link
272
+ Then the UI shows "request a new link"
273
+
274
+ Scenario: Locked account (6c)
275
+ Given an account marked locked
276
+ When the customer requests a password reset
277
+ Then no token is issued
278
+ And the UI redirects to the support contact page
279
+
280
+ ### 18. Out of scope
281
+ - Passwordless / magic-link sign-in.
282
+ - Forced password rotation policy.
283
+ - Admin-initiated resets.
284
+
285
+ ### 19. Open questions
286
+ - Confirm rate-limit threshold with SecOps — owner: dvm, needed by: 2026-05-30.
287
+
288
+ ### 20. References
289
+ - ADR-0014 (token strategy).
290
+ - specs/CONTEXT.md (User aggregate).
291
+ ```
292
+
293
+ This example scores 3 (Countable). To reach 4, resolve §19 and add NFR coverage for §16 i18n test plan.
@@ -0,0 +1,88 @@
1
+ # Craft Skill — Reference
2
+
3
+ ## Naming Rules (full)
4
+
5
+ Every skill name must be a **two-word verb-noun pair**:
6
+ - First word: a verb (survey, model, define, develop, audit…)
7
+ - Second word: a noun from PMBOK 6 / Agile vocabulary (context, domain, language, tdd, code…)
8
+ - Pronounceable in any language, searchable, no noise words, no encodings
9
+ - Exception precedent: `grill-me` — kept for recognizability
10
+
11
+ Good: `survey-context`, `audit-code`, `validate-fix`
12
+ Bad: `context-surveyor`, `code-auditing-skill`, `fix-validator`
13
+
14
+ Any new naming exception requires an entry in CONVENTIONS.md before the skill is published.
15
+
16
+ ## Skill Structure
17
+
18
+ ```
19
+ skill-name/
20
+ ├── SKILL.md # Main instructions (required)
21
+ ├── REFERENCE.md # Detailed docs (if needed)
22
+ ├── EXAMPLES.md # Usage examples (if needed)
23
+ └── scripts/ # Utility scripts (if needed)
24
+ └── helper.sh
25
+ ```
26
+
27
+ ## SKILL.md Template
28
+
29
+ ```md
30
+ ---
31
+ name: skill-name
32
+ description: Brief description of capability. Use when [specific triggers].
33
+ ---
34
+
35
+ # Skill Name
36
+
37
+ ## Quick start
38
+
39
+ [Minimal working example]
40
+
41
+ ## Workflows
42
+
43
+ [Step-by-step processes with checklists for complex tasks]
44
+
45
+ ## Advanced features
46
+
47
+ [Link to separate files: See [REFERENCE.md](REFERENCE.md)]
48
+ ```
49
+
50
+ ## Description Requirements
51
+
52
+ The description is **the only thing your agent sees** when deciding which skill to load.
53
+
54
+ **Format**:
55
+ - Max 1024 chars
56
+ - Write in third person
57
+ - First sentence: what it does
58
+ - Second sentence: "Use when [specific triggers]"
59
+
60
+ **Good example**:
61
+ ```
62
+ Investigate a bug by exploring the codebase to find root cause, then write a TDD-based fix plan to specs/DIAGNOSIS.md. Use when user reports a bug, wants to investigate a problem, or mentions "triage".
63
+ ```
64
+
65
+ ## When to Add Scripts
66
+
67
+ Add utility scripts when:
68
+ - Operation is deterministic (validation, formatting)
69
+ - Same code would be generated repeatedly
70
+ - Errors need explicit handling
71
+
72
+ ## When to Split Files
73
+
74
+ Split into separate files when:
75
+ - SKILL.md exceeds 100 lines
76
+ - Content has distinct domains
77
+ - Advanced features are rarely needed
78
+
79
+ ## sync-skills.sh Propagation
80
+
81
+ After adding a new skill directory with SKILL.md, run `scripts/sync-skills.sh` from the bigpowers repo root. This automatically generates:
82
+ - `.cursor/rules/<name>.mdc` — for Cursor
83
+ - `.gemini/extensions/bigpowers/skills/<name>/SKILL.md` — Agent Skill
84
+ - `.gemini/extensions/bigpowers/commands/<name>.toml` — Slash Command
85
+ - `.gemini/extensions/bigpowers/commands/prompts/<name>.md` — Command Prompt
86
+ - Updated `gemini-extension.json`
87
+
88
+ verify: `bash scripts/sync-skills.sh 2>&1 | grep "skills synced"`
@@ -0,0 +1,55 @@
1
+ ---
2
+ name: craft-skill
3
+ description: Create new bigpowers skills with proper structure, progressive disclosure, and bundled resources. Use when user wants to create, write, or build a new skill for the bigpowers lifecycle.
4
+ ---
5
+
6
+ # Craft Skill
7
+
8
+ > **HARD GATE** — Do NOT name a skill without a two-word verb-noun pair. Do NOT merge a new skill without running `sync-skills.sh` — the generated `.cursor/rules/` and `.gemini/` artifacts must match the source SKILL.md.
9
+
10
+ ## Process
11
+
12
+ 1. **Gather requirements** — ask user about:
13
+ - What task/domain does the skill cover?
14
+ - What specific use cases should it handle?
15
+ - Does it need executable scripts or just instructions?
16
+ - Any reference materials to include?
17
+ - What specs/ output does it produce (if any)?
18
+
19
+ 2. **Verify Principles** — Ensure the skill aligns with [PRINCIPLES.md](../docs/PRINCIPLES.md):
20
+ - Is it atomic (verb-noun)?
21
+ - Is it "deep" (simple interface, complex internal logic)?
22
+ - Does it include Hard Gates?
23
+ - Is it verifiable with a `.feature` file?
24
+
25
+ 3. **Draft the skill** — create:
26
+ - SKILL.md with concise instructions (see [REFERENCE.md](REFERENCE.md) for template)
27
+ - Additional reference files if content exceeds 100 lines
28
+ - Utility scripts if deterministic operations needed
29
+
30
+ > **STREAM CONTINUITY** — When writing file content, output in continuous chunks of ~200 lines. Do not pause. Continue immediately until complete. If you need time, emit a placeholder comment rather than going silent.
31
+
32
+ 4. **Review with user** — present draft and ask:
33
+ - Does this cover your use cases?
34
+ - Anything missing or unclear?
35
+ - Should any section be more/less detailed?
36
+
37
+ ## Naming Rules
38
+
39
+ Every skill name must be a **two-word verb-noun pair**. See [REFERENCE.md](REFERENCE.md) for full rules, examples, and documented exceptions.
40
+
41
+ ## specs/ Output
42
+
43
+ If the skill produces written output, it goes in `specs/` at the project root. Document the output file path in the skill body and in CONVENTIONS.md's output files table.
44
+
45
+ ## Review Checklist
46
+
47
+ After drafting, verify:
48
+
49
+ - [ ] Name is a two-word verb-noun pair (or follows grill-me exception)
50
+ - [ ] Description includes triggers ("Use when...")
51
+ - [ ] SKILL.md under 100 lines
52
+ - [ ] No time-sensitive info
53
+ - [ ] Consistent terminology with CONVENTIONS.md
54
+ - [ ] specs/ output documented if applicable
55
+ - [ ] `sync-skills.sh` run to propagate to Cursor/Gemini
@@ -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,76 @@
1
+ ---
2
+ name: deepen-architecture
3
+ description: Find deepening opportunities in a codebase, informed by the domain language in specs/CONTEXT.md and the decisions in specs/adr/. Use when the user wants to improve architecture, find refactoring opportunities, consolidate tightly-coupled modules, or make a codebase more testable and AI-navigable.
4
+ ---
5
+
6
+ # Deepen 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.
9
+
10
+ ## Glossary
11
+
12
+ 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).
13
+
14
+ - **Module** — anything with an interface and an implementation (function, class, package, slice).
15
+ - **Interface** — everything a caller must know to use the module: types, invariants, error modes, ordering, config. Not just the type signature.
16
+ - **Implementation** — the code inside.
17
+ - **Depth** — leverage at the interface: a lot of behaviour behind a small interface. **Deep** = high leverage. **Shallow** = interface nearly as complex as the implementation.
18
+ - **Seam** — where an interface lives; a place behaviour can be altered without editing in place. (Use this, not "boundary.")
19
+ - **Adapter** — a concrete thing satisfying an interface at a seam.
20
+ - **Leverage** — what callers get from depth.
21
+ - **Locality** — what maintainers get from depth: change, bugs, knowledge concentrated in one place.
22
+
23
+ Key principles (see [LANGUAGE.md](LANGUAGE.md) for the full list):
24
+
25
+ - **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.
26
+ - **The interface is the test surface.**
27
+ - **One adapter = hypothetical seam. Two adapters = real seam.**
28
+
29
+ This skill is _informed_ by the project's domain model — `specs/CONTEXT.md` and any `specs/adr/`. The domain language gives names to good seams; ADRs record decisions the skill should not re-litigate. See [CONTEXT-FORMAT.md](../model-domain/CONTEXT-FORMAT.md) and [ADR-FORMAT.md](../model-domain/ADR-FORMAT.md).
30
+
31
+ ## Process
32
+
33
+ ### 1. Explore
34
+
35
+ Read existing documentation first:
36
+
37
+ - `specs/CONTEXT.md` (or `specs/CONTEXT-MAP.md` + each `specs/CONTEXT.md` in a multi-context repo)
38
+ - Relevant ADRs in `specs/adr/`
39
+
40
+ If any of these files don't exist, proceed silently — don't flag their absence or suggest creating them upfront.
41
+
42
+ 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:
43
+
44
+ - Where does understanding one concept require bouncing between many small modules?
45
+ - Where are modules **shallow** — interface nearly as complex as the implementation?
46
+ - Where have pure functions been extracted just for testability, but the real bugs hide in how they're called?
47
+ - Where do tightly-coupled modules leak across their seams?
48
+ - Which parts of the codebase are untested, or hard to test through their current interface?
49
+
50
+ Apply the **deletion test** to anything you suspect is shallow.
51
+
52
+ ### 2. Present candidates
53
+
54
+ Present a numbered list of deepening opportunities. For each candidate:
55
+
56
+ - **Files** — which files/modules are involved
57
+ - **Problem** — why the current architecture is causing friction
58
+ - **Solution** — plain English description of what would change
59
+ - **Benefits** — explained in terms of locality and leverage, and how tests would improve
60
+
61
+ **Use `specs/CONTEXT.md` vocabulary for the domain, and [LANGUAGE.md](LANGUAGE.md) vocabulary for the architecture.**
62
+
63
+ **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. Don't list every theoretical refactor an ADR forbids.
64
+
65
+ Do NOT propose interfaces yet. Ask the user: "Which of these would you like to explore?"
66
+
67
+ ### 3. Grilling loop
68
+
69
+ 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.
70
+
71
+ Side effects happen inline as decisions crystallize:
72
+
73
+ - **Naming a deepened module after a concept not in `specs/CONTEXT.md`?** Add the term to `specs/CONTEXT.md` — same discipline as `model-domain` (see [CONTEXT-FORMAT.md](../model-domain/CONTEXT-FORMAT.md)). Create the file lazily if it doesn't exist.
74
+ - **Sharpening a fuzzy term during the conversation?** Update `specs/CONTEXT.md` right there.
75
+ - **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. See [ADR-FORMAT.md](../model-domain/ADR-FORMAT.md).
76
+ - **Want to explore alternative interfaces for the deepened module?** See [INTERFACE-DESIGN.md](INTERFACE-DESIGN.md).