@ai-agent-lead/skills 1.3.0 → 1.5.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 +30 -0
- package/package.json +1 -1
- package/skills/README.md +29 -20
- package/skills/SKILL-TEMPLATE.md +9 -3
- package/skills/TRIGGERS.md +3 -3
- package/skills/WORKFLOWS.md +17 -16
- package/skills/bench/SKILL.md +20 -4
- package/skills/bootstrap/SKILL.md +24 -15
- package/skills/caveman/SKILL.md +1 -3
- package/skills/debug/SKILL.md +0 -2
- package/skills/design/ILLEGAL-STATES.md +12 -1
- package/skills/design/SKILL.md +10 -3
- package/skills/design/templates/design-note.md +47 -0
- package/skills/feature-doc/SKILL.md +12 -20
- package/skills/{code-hygiene/SKILL.md → formats/CODE-HYGIENE.md} +24 -29
- package/skills/formats/CONTEXT-FORMAT.md +5 -5
- package/skills/formats/CONTEXT-MAP-FORMAT.md +14 -3
- package/skills/formats/CONVENTION-FORMAT.md +40 -0
- package/skills/formats/DOC-DRIFT-AUDIT.md +56 -0
- package/skills/formats/OKF.md +13 -9
- package/skills/formats/{STYLE-comments.md → STYLE-COMMENTS.md} +1 -1
- package/skills/grill-plan/SKILL.md +5 -3
- package/skills/improve-codebase-architecture/INTERFACE-DESIGN.md +1 -1
- package/skills/improve-codebase-architecture/SKILL.md +7 -18
- package/skills/investigate/SKILL.md +14 -2
- package/skills/pr-review/SKILL.md +7 -22
- package/skills/prod-ready/SKILL.md +16 -17
- package/skills/security-review/SKILL.md +12 -4
- package/skills/simplify/SKILL.md +6 -15
- package/skills/system-design/SKILL.md +29 -19
- package/skills/tdd/SKILL.md +5 -6
- package/skills/tdd-rounds/COMMITS.md +4 -4
- package/skills/tdd-rounds/SKILL.md +33 -9
- package/skills/tdd-rounds/templates/builder-brief.md +4 -4
- package/skills/verify-real-deps/SKILL.md +16 -4
- package/skills/verify-real-deps/templates/known-issues.md +33 -28
- package/skills/zoom-out/SKILL.md +1 -3
- package/skills/sync-check/SKILL.md +0 -69
- /package/skills/{design → formats}/OBSERVABILITY.md +0 -0
- /package/skills/{design → formats}/PERSONAS.md +0 -0
package/README.md
CHANGED
|
@@ -16,6 +16,36 @@ The goal: turn engineering discipline from something I have to enforce into some
|
|
|
16
16
|
|
|
17
17
|
- [`skills/`](./skills/) — the skill set. See [`skills/README.md`](./skills/README.md) for the index, the role/trigger taxonomy, and how skills compose into workflows.
|
|
18
18
|
|
|
19
|
+
## What the skills produce
|
|
20
|
+
|
|
21
|
+
Run the skill set on a project and a self-documenting `docs/` tree accumulates. Every file is created **lazily** — on first use, never up front — and carries [OKF](https://github.com/GoogleCloudPlatform/knowledge-catalog/tree/main/okf) frontmatter, so the whole tree is a consumable knowledge bundle. The canonical registry of doc kinds is [`skills/formats/OKF.md`](./skills/formats/OKF.md) §2; the artifacts table in [`skills/WORKFLOWS.md`](./skills/WORKFLOWS.md) maps each kind to the workflow step that emits it. The shape the tree converges to:
|
|
22
|
+
|
|
23
|
+
```
|
|
24
|
+
repo-root/
|
|
25
|
+
├── CHANGELOG.md ← prod-ready (the bundle's OKF log)
|
|
26
|
+
└── docs/ ← the OKF bundle root
|
|
27
|
+
├── index.md ← bundle listing / feature manifest (no frontmatter)
|
|
28
|
+
├── CONTEXT.md ← bootstrap, grill-plan [type: context]
|
|
29
|
+
├── CONTEXT-MAP.md ← bootstrap (multi-context repos) [type: context-map]
|
|
30
|
+
├── CONVENTIONS.md ← bootstrap [type: convention]
|
|
31
|
+
├── architecture.md ← system-design [type: architecture]
|
|
32
|
+
├── known-issues.md ← verify-real-deps, tdd-rounds [type: known-issues]
|
|
33
|
+
├── adr/
|
|
34
|
+
│ └── NNNN-<slug>.md ← grill-plan, improve-codebase-architecture [type: adr]
|
|
35
|
+
├── features/
|
|
36
|
+
│ ├── <name>.md ← feature-doc [type: feature]
|
|
37
|
+
│ ├── <name>.design.md ← design (optional) [type: design]
|
|
38
|
+
│ └── <name>.state.md ← tdd-rounds (one per feature) [type: state]
|
|
39
|
+
├── research/
|
|
40
|
+
│ └── <topic>.md ← investigate, debug [type: research]
|
|
41
|
+
├── security/
|
|
42
|
+
│ └── <feature>.md ← security-review (high-stakes) [type: security]
|
|
43
|
+
└── benchmarks/
|
|
44
|
+
└── <feature>.md ← bench [type: benchmark]
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
The three feature siblings — `<name>.md` (the contract), `<name>.design.md` (the module shape), `<name>.state.md` (the round-by-round state) — share a stem so a feature's contract, design, and progress sit together. There is no global state file; `docs/index.md` is the manifest.
|
|
48
|
+
|
|
19
49
|
## Installation
|
|
20
50
|
|
|
21
51
|
You can install all the skills in this repository directly using `npx`:
|
package/package.json
CHANGED
package/skills/README.md
CHANGED
|
@@ -25,23 +25,23 @@ Grouped by role. Trigger phrases are in each skill's `description` frontmatter.
|
|
|
25
25
|
| `system-design` | Greenfield system architecture — modules, dependency direction, seams | `docs/architecture.md` (system map) | [system-design/](./system-design/) |
|
|
26
26
|
| `design` | Designing a module or public API before implementation | Guidance only — optional `docs/features/<feature>.design.md` for non-trivial shapes | [design/](./design/) |
|
|
27
27
|
| `improve-codebase-architecture` | Finding deepening opportunities — turning shallow modules into deep ones | Numbered candidate list, optional ADR / CONTEXT.md updates | [improve-codebase-architecture/](./improve-codebase-architecture/) |
|
|
28
|
-
| `code-hygiene` | Line/function-level coding discipline (boring, naming, YAGNI, rule of 3, locality) | Guidance only — applied as a lens during `simplify` and `pr-review` | [code-hygiene/](./code-hygiene/) |
|
|
29
28
|
| `zoom-out` | User-invoked: ask for higher-level context when unfamiliar with an area | Map of relevant modules and callers in `CONTEXT.md` vocabulary | [zoom-out/](./zoom-out/) |
|
|
30
29
|
|
|
30
|
+
The `code-hygiene` line-level lens is no longer a routable skill — it lives at [`formats/CODE-HYGIENE.md`](./formats/CODE-HYGIENE.md) and is applied during `simplify` and `pr-review` §3f.
|
|
31
|
+
|
|
31
32
|
### Implementation
|
|
32
33
|
|
|
33
34
|
| Skill | Trigger | Produces | Location |
|
|
34
35
|
| --- | --- | --- | --- |
|
|
35
36
|
| `debug` | Non-trivial bug whose root cause isn't obvious — runs **before** `tdd` | Reproduction + named root cause; optional `docs/research/<bug>.md` | [debug/](./debug/) |
|
|
36
37
|
| `tdd` | Implementing a feature or fixing a bug, test-first | Test-first code | [tdd/](./tdd/) |
|
|
37
|
-
| `tdd-rounds` | Multi-round TDD orchestration via Builder sub-agents (≥10 ACs / multi-package) | Builder briefs + reports + `docs/
|
|
38
|
-
| `simplify` | End-of-slice / end-of-round sweep — reuse, quality, efficiency, test relevance | Tightened diff + a separate `simplify` commit | [simplify/](./simplify/) |
|
|
38
|
+
| `tdd-rounds` | Multi-round TDD orchestration via Builder sub-agents (≥10 ACs / multi-package) | Builder briefs + reports + `docs/features/<name>.state.md` | [tdd-rounds/](./tdd-rounds/) |
|
|
39
|
+
| `simplify` | End-of-slice / end-of-round sweep — reuse, quality, efficiency, test relevance, telemetry | Tightened diff + a separate `simplify` commit | [simplify/](./simplify/) |
|
|
39
40
|
|
|
40
41
|
### Pre-merge gates & review
|
|
41
42
|
|
|
42
43
|
| Skill | Trigger | Produces | Location |
|
|
43
44
|
| --- | --- | --- | --- |
|
|
44
|
-
| `sync-check` | Before pr-review or after refactor | Terminology/ADR drift report | [sync-check/](./sync-check/) |
|
|
45
45
|
| `prod-ready` | After tdd green, before merge | Verified pre-merge checklist (incl. doc drift) | [prod-ready/](./prod-ready/) |
|
|
46
46
|
| `security-review` | Surface-changing work — new entry points, identity flows, authz, sensitive data, external deps | Threat model + verified controls; appended to feature doc, or `docs/security/<feature>.md` for high-stakes | [security-review/](./security-review/) |
|
|
47
47
|
| `pr-review` | Reviewing someone else's PR (or self-reviewing before opening) | Structured review with severity-classified findings (blocker / suggestion / nit / question) | [pr-review/](./pr-review/) |
|
|
@@ -55,14 +55,14 @@ Orthogonal axis. The trigger-phrase index above tells you *when* a skill fires;
|
|
|
55
55
|
| --- | --- | --- |
|
|
56
56
|
| **Doc-producing** (writes a durable artifact under `docs/`) | `feature-doc`, `investigate`, `system-design`, `grill-plan`, `debug` (optional), `security-review` (optional), `verify-real-deps`, `bench`, `bootstrap` | Output survives the conversation. The discipline of writing it is the value. |
|
|
57
57
|
| **Build** (writes code) | `tdd`, `tdd-rounds`, `simplify` | Diff-producing. Always behind a contract (feature doc + ACs). |
|
|
58
|
-
| **Gate** (verifies before merge / tag) | `prod-ready`, `security-review`, `pr-review`, `verify-real-deps
|
|
59
|
-
| **Diagnose** (no code, no doc — just analysis) | `debug`, `zoom-out
|
|
58
|
+
| **Gate** (verifies before merge / tag) | `prod-ready`, `security-review`, `pr-review`, `verify-real-deps` | Pre-merge or pre-tag — refuse to advance until the checklist passes. |
|
|
59
|
+
| **Diagnose** (no code, no doc — just analysis) | `debug`, `zoom-out` | Run *before* a build skill when the input isn't yet clear. |
|
|
60
60
|
| **Shape** (decides module / topology) | `design`, `system-design`, `improve-codebase-architecture` | Greenfield-module / greenfield-system / brownfield. Same vocabulary ([`LANGUAGE.md`](./LANGUAGE.md)). |
|
|
61
|
-
| **Lens** (applied during other skills, not invoked alone) | `code-hygiene
|
|
61
|
+
| **Lens** (applied during other skills, not invoked alone) | `caveman` skill; `code-hygiene` reference ([`formats/CODE-HYGIENE.md`](./formats/CODE-HYGIENE.md)) | Principles you carry into any turn to maintain quality or efficiency. The line-level lens is a shared reference, not a routable skill. |
|
|
62
62
|
|
|
63
63
|
## Skill relationship map
|
|
64
64
|
|
|
65
|
-
The
|
|
65
|
+
The skill set + its dependencies. Lateral edges are vocabulary / lens; vertical edges are workflow flow.
|
|
66
66
|
|
|
67
67
|
```
|
|
68
68
|
┌─────────────────────────────────────────────┐
|
|
@@ -81,7 +81,7 @@ The 20 skills + their dependencies. Lateral edges are vocabulary / lens; vertica
|
|
|
81
81
|
│ │ ▲ │ │ prod-ready│
|
|
82
82
|
│ │ │ │ │ │ │
|
|
83
83
|
│ └──────────────┘ │ │ ▼ │
|
|
84
|
-
│ │ │
|
|
84
|
+
│ │ │ │ │
|
|
85
85
|
│ system-design ──► design (per mod) ─┘ │ │ │
|
|
86
86
|
│ │ │ ▼ │
|
|
87
87
|
│ ▼ │ pr-review │
|
|
@@ -97,24 +97,23 @@ The 20 skills + their dependencies. Lateral edges are vocabulary / lens; vertica
|
|
|
97
97
|
│ │ (when bug) (when surface) │
|
|
98
98
|
│ │
|
|
99
99
|
│ ┌────────────── LENSES & UTILITIES ──────────────┐ │
|
|
100
|
-
│ │ code-hygiene
|
|
101
|
-
│ │ caveman
|
|
100
|
+
│ │ code-hygiene (formats/) -> line-level lens │ │
|
|
101
|
+
│ │ caveman -> token lens, any code reading │ │
|
|
102
102
|
│ │ │ │
|
|
103
|
-
│ │ zoom-out
|
|
103
|
+
│ │ zoom-out -> interrupts any workflow, │ │
|
|
104
104
|
│ │ maps unfamiliar areas │ │
|
|
105
105
|
│ └────────────────────────────────────────────────┘ │
|
|
106
106
|
└──────────────────────────────────────────────────────────────────┘
|
|
107
107
|
```
|
|
108
108
|
|
|
109
|
-
**
|
|
109
|
+
**Six things the map shows:**
|
|
110
110
|
|
|
111
|
-
1. `
|
|
111
|
+
1. `caveman` and `zoom-out` are not nodes in any flow — they're a lens / utility applied across. The `code-hygiene` line-level lens is the same idea, now a shared reference ([`formats/CODE-HYGIENE.md`](./formats/CODE-HYGIENE.md)) rather than a routable skill.
|
|
112
112
|
2. `grill-plan` is the only skill invoked from three upstreams (`investigate`, `feature-doc`, `improve-codebase-architecture`) — it's the shared pressure-test step.
|
|
113
113
|
3. `tdd-rounds` is the only multi-callee orchestrator — dispatches `design`, `tdd`, `simplify`, `prod-ready`, `verify-real-deps` to Builders.
|
|
114
|
-
4. `pr-review` is the reviewer-side mirror of `prod-ready` — Section 7 doc-drift
|
|
115
|
-
5. `
|
|
116
|
-
6.
|
|
117
|
-
7. The shared substrate ([LANGUAGE.md](./LANGUAGE.md), [formats/](./formats/), [TRIGGERS.md](./TRIGGERS.md)) is referenced everywhere — never copy-paste the content into a skill.
|
|
114
|
+
4. `pr-review` is the reviewer-side mirror of `prod-ready` — the Section 7 / §3e doc-drift audit is single-sourced in [`formats/DOC-DRIFT-AUDIT.md`](./formats/DOC-DRIFT-AUDIT.md) (the former `sync-check` skill) and run from both sides.
|
|
115
|
+
5. `system-design` and `improve-codebase-architecture` are duals — same [LANGUAGE.md](./LANGUAGE.md), greenfield vs brownfield.
|
|
116
|
+
6. The shared substrate ([LANGUAGE.md](./LANGUAGE.md), [formats/](./formats/), [TRIGGERS.md](./TRIGGERS.md)) is referenced everywhere — never copy-paste the content into a skill.
|
|
118
117
|
|
|
119
118
|
|
|
120
119
|
## Workflows
|
|
@@ -135,12 +134,22 @@ The skills compose into canonical workflows (greenfield feature, large feature,
|
|
|
135
134
|
|
|
136
135
|
- [`formats/ADR-FORMAT.md`](./formats/ADR-FORMAT.md) — ADR template, numbering, when-to-write criteria.
|
|
137
136
|
- [`formats/CONTEXT-FORMAT.md`](./formats/CONTEXT-FORMAT.md) — `CONTEXT.md` structure, single-vs-multi-context layout, minimal example.
|
|
137
|
+
- [`formats/CONVENTION-FORMAT.md`](./formats/CONVENTION-FORMAT.md) — `CONVENTIONS.md` structure (branches, commits, naming, code style). Seeded by `bootstrap`.
|
|
138
|
+
- [`formats/CODE-HYGIENE.md`](./formats/CODE-HYGIENE.md) — the line-level lens (boring code, naming, YAGNI, rule of 3, locality, comments, constants placement). Applied during `simplify` and `pr-review` §3f.
|
|
139
|
+
- [`formats/DOC-DRIFT-AUDIT.md`](./formats/DOC-DRIFT-AUDIT.md) — the terminology / ADR / doc-map audit. Run from `prod-ready` §7 (author), `pr-review` §3e (reviewer), or standalone (the former `sync-check`).
|
|
140
|
+
- [`formats/OKF.md`](./formats/OKF.md) — frontmatter contract for produced `docs/` files. [`formats/STYLE-COMMENTS.md`](./formats/STYLE-COMMENTS.md) — the comment bar.
|
|
141
|
+
- [`formats/OBSERVABILITY.md`](./formats/OBSERVABILITY.md) — the observability-by-design lens (what to instrument, log levels, telemetry placement). Applied during `simplify`'s telemetry pass.
|
|
142
|
+
- [`formats/PERSONAS.md`](./formats/PERSONAS.md) — design-exploration personas (the Minimalist, the Extensible, …) for assigning distinct lenses to parallel sub-agents. Used by `improve-codebase-architecture`'s interface-design step.
|
|
138
143
|
|
|
139
|
-
Used by `grill-plan`, `improve-codebase-architecture`, `system-design`, `investigate`, and (lazily) `feature-doc`.
|
|
144
|
+
Used by `grill-plan`, `improve-codebase-architecture`, `system-design`, `investigate`, `simplify`, `prod-ready`, `pr-review`, and (lazily) `feature-doc`.
|
|
140
145
|
|
|
141
146
|
## Conventions
|
|
142
147
|
|
|
143
|
-
- **File naming
|
|
148
|
+
- **File naming — the one rule (canonical; other docs link here).** Case signals *role*:
|
|
149
|
+
- **`UPPERCASE-KEBAB.md`** — *standing references you read by a fixed name.* All skill machinery and supporting docs under `skills/` (`SKILL.md`, `LANGUAGE.md`, `WORKFLOWS.md`, per-skill `BOOTSTRAP.md` / `COMMITS.md` / `TESTS.md` / …, and everything in [`formats/`](./formats/)); **plus** the produced bundle's repo-wide **orientation / governance** layer — the files you read to *speak, navigate, and track the whole repo*: `docs/CONTEXT.md`, `docs/CONTEXT-MAP.md`, `docs/CONVENTIONS.md`, and root `CHANGELOG.md`.
|
|
150
|
+
- **`lowercase-kebab.md`** — *fill-in skeletons and produced work-products.* Templates in `<skill>/templates/`; and every doc a skill emits as a deliverable — `docs/architecture.md`, `docs/known-issues.md`, and all instances under `adr/`, `features/`, `research/`, `security/`, `benchmarks/` (named after their subject).
|
|
151
|
+
- **Reserved:** `index.md` and `log.md` stay lowercase — OKF reserves them.
|
|
152
|
+
- **The test:** *does this file govern how you read / name / track the whole repo (UPPERCASE), or is it something a skill produced — a map, a contract, a decision, a ledger, a manifest (lowercase)?* `docs/architecture.md` is lowercase because it's a produced deliverable, like a feature doc — not part of the orientation layer the way `CONTEXT.md` is.
|
|
144
153
|
- Output artifacts live under `docs/` in the repo root, never inside `.claude/`.
|
|
145
154
|
- Status enums, frontmatter shape, and cross-doc linking rules are in [`docs/CONVENTIONS.md`](../docs/CONVENTIONS.md).
|
|
146
155
|
- Domain vocabulary is in [`docs/CONTEXT.md`](../docs/CONTEXT.md). Terms there beat synonyms invented at the keyboard.
|
package/skills/SKILL-TEMPLATE.md
CHANGED
|
@@ -2,10 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
Canonical scaffold for every skill in this set. Copy the body below into a new `<skill-name>/SKILL.md`, fill it in, then prune sections that genuinely don't apply (rather than leaving placeholders).
|
|
4
4
|
|
|
5
|
+
**Before you create one:** apply the test in [ADR-0003](../docs/adr/0003-lenses-as-shared-references.md). A discipline applied only *inside* other skills — a lens or diagnostic never invoked on its own — belongs in [`formats/`](formats/) as a shared reference, not a `SKILL.md`. A `SKILL.md` is earned by a routable phase a user or another skill invokes directly.
|
|
6
|
+
|
|
5
7
|
The order is load-bearing. Claude scans top-to-bottom — `When to use` / `When to skip` should hit early so routing is decided before the reader gets to the body.
|
|
6
8
|
|
|
7
9
|
## Naming and placement
|
|
8
10
|
|
|
11
|
+
The full file-naming rule (skills **and** produced docs) is single-sourced in [`README.md` §Conventions](README.md#conventions). The essentials for a skill directory:
|
|
12
|
+
|
|
9
13
|
- File path: `skills/<skill-name>/SKILL.md` (lowercase, hyphenated directory).
|
|
10
14
|
- Supporting reference docs in the same directory go UPPERCASE (`MOTIVATION.md`, `DEEPENING.md`, etc.).
|
|
11
15
|
- Templates that callers fill in go in `<skill-name>/templates/` and stay lowercase (`feature-template.md`).
|
|
@@ -28,6 +32,8 @@ The `description` is the routing signal. It should:
|
|
|
28
32
|
|
|
29
33
|
A `description` that names only the happy path will route falsely. Always name what to skip.
|
|
30
34
|
|
|
35
|
+
**Optional frontmatter.** Add `disable-model-invocation: true` for a user-only utility that should never auto-fire (e.g. `zoom-out`); the skill then runs only on explicit invocation. No other keys are read by the harness — `name` and `description` are the whole routing contract. Don't add decorative metadata (`complexity`, `expected_duration`, etc.); it isn't consumed and only drifts.
|
|
36
|
+
|
|
31
37
|
## Canonical body shape
|
|
32
38
|
|
|
33
39
|
```md
|
|
@@ -50,7 +56,7 @@ A `description` that names only the happy path will route falsely. Always name w
|
|
|
50
56
|
- <case where a different skill is the right answer; name that skill>
|
|
51
57
|
- <case where no skill is needed at all — "just fix it">
|
|
52
58
|
|
|
53
|
-
## Phases (or **Process**,
|
|
59
|
+
## Phases (or **Process**, **Workflow**, **Steps**, **Principles**, **The N lenses** — pick the one descriptive heading that fits the skill, and use only one)
|
|
54
60
|
|
|
55
61
|
### 1. <Phase name — verb-leading>
|
|
56
62
|
|
|
@@ -90,7 +96,7 @@ A `description` that names only the happy path will route falsely. Always name w
|
|
|
90
96
|
| Why this skill exists | optional | Include for *teaching* skills (discipline being taught). Skip for *orchestration* and *utility* skills. |
|
|
91
97
|
| When to use | yes | Body section, not just frontmatter. Frontmatter alone is too easy to skim past. |
|
|
92
98
|
| When to skip | yes | Body section. Mirror the description — explicit, not implied. |
|
|
93
|
-
|
|
|
99
|
+
| The "how it works" body | yes | Its **position** (after `When to skip`, before `Anti-patterns`) is canonical; its **name** is not. Use the heading that fits — `Phases`, `Process`, `Workflow`, `Steps`, `Principles`, `The N lenses`. One such section (a set of same-kind sub-sections — e.g. `Principle 1…N` — counts as one); don't mix different kinds. |
|
|
94
100
|
| Anti-patterns | recommended | Skip only if the skill is so simple there are none. |
|
|
95
101
|
| Pairing with other skills | yes | At minimum name 1 upstream and 1 downstream. |
|
|
96
102
|
| Done when | yes | Verifiable conditions, not vibes. |
|
|
@@ -98,7 +104,7 @@ A `description` that names only the happy path will route falsely. Always name w
|
|
|
98
104
|
|
|
99
105
|
## Voice and length
|
|
100
106
|
|
|
101
|
-
- **Body length matches role**, not importance. Teaching skills run long (debug, security-review, tdd). Orchestration / utility
|
|
107
|
+
- **Body length matches role**, not importance. Teaching skills run long (debug, security-review, tdd). Orchestration / utility skills run short (tdd-rounds, simplify, caveman). Don't pad an orchestration skill to match a teaching skill — it adds noise.
|
|
102
108
|
- **No hedging.** "Sometimes consider maybe doing X" is dead text. Pick a recommendation.
|
|
103
109
|
- **No corporate voice.** Direct sentences. The reader is a fast-reading senior engineer or an LLM, not an executive.
|
|
104
110
|
- **Cite paths**: `path:line` or `[link](relative/path.md)`. Don't say "see the auth module"; say `src/auth/session.go:42`.
|
package/skills/TRIGGERS.md
CHANGED
|
@@ -13,7 +13,7 @@ If a phrase appears in multiple rows, the disambiguation column names how to cho
|
|
|
13
13
|
| "before any non-trivial feature", "let's spec this out", "write a feature doc" | [`feature-doc`](feature-doc/SKILL.md) | Skip for typo / dep bump / pure refactor. |
|
|
14
14
|
| "grill me on this", "stress-test this plan", "walk me through this", "is this consistent with our model" | [`grill-plan`](grill-plan/SKILL.md) | A plan exists; you want it pressure-tested. |
|
|
15
15
|
| "benchmark", "performance test", "measure latency", "profile" | [`bench`](bench/SKILL.md) | Performance verification. |
|
|
16
|
-
| "is the naming right?", "does this match our glossary?", "audit terminology", "sync check", "context audit" | [`
|
|
16
|
+
| "is the naming right?", "does this match our glossary?", "audit terminology", "sync check", "context audit" | doc-drift audit ([`formats/DOC-DRIFT-AUDIT.md`](formats/DOC-DRIFT-AUDIT.md)) | The former `sync-check` skill — now a shared reference. Run standalone, or from `prod-ready` §7 / `pr-review` §3e. |
|
|
17
17
|
|
|
18
18
|
## Design & architecture
|
|
19
19
|
|
|
@@ -22,7 +22,7 @@ If a phrase appears in multiple rows, the disambiguation column names how to cho
|
|
|
22
22
|
| "system architecture", "module boundaries", "service boundaries", "how should I structure this system", "draw the architecture", "topology" | [`system-design`](system-design/SKILL.md) | Greenfield, multi-module. For single-module work → `design`. For reorganising an existing codebase → `improve-codebase-architecture`. |
|
|
23
23
|
| "how should I structure this", "deep modules", "testability", "API design", "design this module" | [`design`](design/SKILL.md) | Single module / public API, NEW code. For existing code → `improve-codebase-architecture`. |
|
|
24
24
|
| "improve architecture", "find refactoring opportunities", "consolidate", "deepen these modules", "make this more testable" | [`improve-codebase-architecture`](improve-codebase-architecture/SKILL.md) | EXISTING code, cross-module. For local single-module refactor → `design` or just refactor inline. |
|
|
25
|
-
| "simpler", "boring", "naming", "YAGNI", "premature abstraction", "over-engineered", "clean this up at line level" | [`code-hygiene`](
|
|
25
|
+
| "simpler", "boring", "naming", "YAGNI", "premature abstraction", "over-engineered", "clean this up at line level" | [`code-hygiene`](formats/CODE-HYGIENE.md) lens (via `simplify`) | A shared reference, not a routable skill — applies during `simplify`, `pr-review` §3f, or whenever you re-read code. |
|
|
26
26
|
| "I'm lost", "give me higher-level context", "zoom out", "I don't know this area" | [`zoom-out`](zoom-out/SKILL.md) | User-invoked utility (`disable-model-invocation`). |
|
|
27
27
|
|
|
28
28
|
## Utilities & efficiency
|
|
@@ -55,7 +55,7 @@ Some phrases overlap. Pick by the disambiguator:
|
|
|
55
55
|
|
|
56
56
|
- **"design"** alone — almost always [`design`](design/SKILL.md). If the user means "system design", that phrase routes to [`system-design`](system-design/SKILL.md).
|
|
57
57
|
- **"refactor"** — [`improve-codebase-architecture`](improve-codebase-architecture/SKILL.md) for cross-module; [`design`](design/SKILL.md) or just inline edits for one-module shape; [`simplify`](simplify/SKILL.md) for end-of-round line-level cleanup.
|
|
58
|
-
- **"clean up"** — [`code-hygiene`](
|
|
58
|
+
- **"clean up"** — the [`code-hygiene`](formats/CODE-HYGIENE.md) lens; [`simplify`](simplify/SKILL.md) as the end-of-round action; [`improve-codebase-architecture`](improve-codebase-architecture/SKILL.md) if the cleanup is structural.
|
|
59
59
|
- **"test"** — [`tdd`](tdd/SKILL.md) for writing tests against new behavior; [`debug`](debug/SKILL.md) when the test you'd write isn't obvious yet (root cause unclear); [`simplify`](simplify/SKILL.md)'s lens 4 for assessing existing tests.
|
|
60
60
|
- **"ship"** — [`prod-ready`](prod-ready/SKILL.md) for the gate; [`verify-real-deps`](verify-real-deps/SKILL.md) for tagged release with third-party APIs.
|
|
61
61
|
|
package/skills/WORKFLOWS.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Workflows
|
|
2
2
|
|
|
3
|
-
How the
|
|
3
|
+
How the skill set composes into the common paths users actually walk.
|
|
4
4
|
|
|
5
5
|
The skills aren't a flat menu — they form a workflow with branching. This file maps the canonical paths so you can see where to enter, what to expect, and what produces what.
|
|
6
6
|
|
|
@@ -32,7 +32,7 @@ Got a task? Pick by what you have in front of you:
|
|
|
32
32
|
│ Surface-changing work (auth, public │ /security-review (gate, runs │
|
|
33
33
|
│ API, sensitive data, new entry pt)│ alongside Workflow 1/2/6) │
|
|
34
34
|
├─────────────────────────────────────┼──────────────────────────────────┤
|
|
35
|
-
│ Audit terminology or ADR compliance │
|
|
35
|
+
│ Audit terminology or ADR compliance │ doc-drift audit (DOC-DRIFT-AUDIT)│
|
|
36
36
|
├─────────────────────────────────────┼──────────────────────────────────┤
|
|
37
37
|
│ Lost in unfamiliar area, mid-task │ /zoom-out (utility, anytime) │
|
|
38
38
|
└─────────────────────────────────────┴──────────────────────────────────┘
|
|
@@ -73,9 +73,7 @@ For a single-package feature with a manageable acceptance-criteria count.
|
|
|
73
73
|
│
|
|
74
74
|
▼
|
|
75
75
|
prod-ready ──── 7-section checklist
|
|
76
|
-
│
|
|
77
|
-
▼
|
|
78
|
-
sync-check ──── terminology and ADR audit
|
|
76
|
+
│ (§7 = doc-drift audit: terminology + ADR + doc-map)
|
|
79
77
|
│
|
|
80
78
|
▼
|
|
81
79
|
(optional) pr-review ── self-check against the diff before opening
|
|
@@ -96,7 +94,7 @@ For a single-package feature with a manageable acceptance-criteria count.
|
|
|
96
94
|
│
|
|
97
95
|
▼
|
|
98
96
|
┌──────── Round N ────────┐
|
|
99
|
-
│ Parent writes brief │ ◄─── self-contained, references docs/
|
|
97
|
+
│ Parent writes brief │ ◄─── self-contained, references docs/features/<name>.state.md
|
|
100
98
|
│ │ │
|
|
101
99
|
│ ▼ │
|
|
102
100
|
│ Builder is dispatched │
|
|
@@ -115,7 +113,7 @@ For a single-package feature with a manageable acceptance-criteria count.
|
|
|
115
113
|
│ ▼ │
|
|
116
114
|
│ Parent reviews diff, │
|
|
117
115
|
│ runs tests independently,
|
|
118
|
-
│ appends to
|
|
116
|
+
│ appends to state file │
|
|
119
117
|
└──────────┬───────────────┘
|
|
120
118
|
│
|
|
121
119
|
▼
|
|
@@ -334,7 +332,7 @@ A few things that happen across all workflows:
|
|
|
334
332
|
|
|
335
333
|
3. **`design` doesn't have a workflow of its own** — it's a sub-step inside Workflow 1, 2, and 4. Always paired with `tdd` (or implicitly with `tdd-rounds`). Optional sibling artifact `docs/features/<name>.design.md` when the module shape is non-trivial.
|
|
336
334
|
|
|
337
|
-
4. **`code-hygiene` is a lens, not a phase
|
|
335
|
+
4. **`code-hygiene` is a lens, not a phase** — and now a shared reference ([`formats/CODE-HYGIENE.md`](./formats/CODE-HYGIENE.md)), not a routable skill. Apply it during the simplify sweep that follows TDD green, during `pr-review` §3f, or whenever you re-read code and pause to understand it. Especially relevant in Workflows 1, 2, 4, and 5.
|
|
338
336
|
|
|
339
337
|
5. **`caveman` is an efficiency lens.** Apply it whenever token optimization is needed, particularly in Builder reports or long sessions. It doesn't change the workflow but compresses the communication.
|
|
340
338
|
|
|
@@ -352,9 +350,9 @@ A few things that happen across all workflows:
|
|
|
352
350
|
|
|
353
351
|
12. **Vocabulary is shared.** All architecture-talking skills (`design`, `system-design`, `improve-codebase-architecture`, `pr-review`, `grill-plan`) read from [`skills/LANGUAGE.md`](./LANGUAGE.md). Format references (ADRs, CONTEXT.md) live in [`skills/formats/`](./formats/). Domain vocabulary (Customer, Order, etc.) lives in `docs/CONTEXT.md`. Keep them distinct.
|
|
354
352
|
|
|
355
|
-
13. **Bootstrap mode for greenfield repos** is documented in one place — [`
|
|
353
|
+
13. **Bootstrap mode for greenfield repos** is documented in one place — [`bootstrap/BOOTSTRAP.md`](./bootstrap/BOOTSTRAP.md). `feature-doc`, `system-design`, and `improve-codebase-architecture` defer there rather than re-explaining the rules.
|
|
356
354
|
|
|
357
|
-
14. **`simplify` is the end-of-slice / end-of-round sweep.** Runs after every `tdd` slice goes green; in `tdd-rounds`, lands as its own commit per [`tdd-rounds/COMMITS.md` rule 4](./tdd-rounds/COMMITS.md). Applies the `code-hygiene` lens to the changed files, plus a test-relevance check. Distinct from `code-hygiene`
|
|
355
|
+
14. **`simplify` is the end-of-slice / end-of-round sweep.** Runs after every `tdd` slice goes green; in `tdd-rounds`, lands as its own commit per [`tdd-rounds/COMMITS.md` rule 4](./tdd-rounds/COMMITS.md). Applies the [`code-hygiene`](./formats/CODE-HYGIENE.md) lens to the changed files, plus a test-relevance and telemetry check. Distinct from the `code-hygiene` lens reference itself and from `improve-codebase-architecture` (the structural escalation when simplify finds bigger issues).
|
|
358
356
|
|
|
359
357
|
15. **Artifacts accumulate in `docs/`:**
|
|
360
358
|
|
|
@@ -363,15 +361,18 @@ A few things that happen across all workflows:
|
|
|
363
361
|
| `docs/features/<name>.md` | `feature-doc` | One per feature |
|
|
364
362
|
| `docs/features/<name>.design.md` | `design` (optional) | One per feature with non-trivial module shape |
|
|
365
363
|
| `docs/research/<topic>.md` | `investigate`, `debug` (optional) | One per investigation or non-trivial bug |
|
|
366
|
-
| `docs/adr/<n>-<topic>.md` | `grill-plan`, `improve-codebase-architecture` | One per architectural decision |
|
|
367
|
-
| `docs/CONTEXT.md` | `grill-plan`, `improve-codebase-architecture` (inline updates) | One per repo / context |
|
|
364
|
+
| `docs/adr/<n>-<topic>.md` | `grill-plan`, `bootstrap`, `investigate` (handoff), `improve-codebase-architecture` | One per architectural decision |
|
|
365
|
+
| `docs/CONTEXT.md` | `bootstrap` (seed), `grill-plan`, `improve-codebase-architecture` (inline updates) | One per repo / context |
|
|
366
|
+
| `docs/CONTEXT-MAP.md` | `bootstrap` | One per repo with >1 bounded context |
|
|
367
|
+
| `docs/CONVENTIONS.md` | `bootstrap` | One per repo; structure & process rules |
|
|
368
368
|
| `docs/architecture.md` | `system-design` | One per system (the system map) |
|
|
369
|
-
| `docs/features/<name
|
|
370
|
-
| `docs/features/<name>/state/rounds/*.md` | `tdd-rounds` Builder | Immutable round logs (target end-state per ADR-0001) |
|
|
371
|
-
| `docs/STATE.md` | `tdd-rounds` parent | Currently the single running summary; ADR-0001 demotes it to a global manifest after migration. |
|
|
369
|
+
| `docs/features/<name>.state.md` | `tdd-rounds` parent | One living, append-only state file per feature — `## Round N` sections, sibling to the contract and design note (per ADR-0001). |
|
|
372
370
|
| `docs/security/<feature>.md` | `security-review` (high-stakes only) | One per surface-changing feature where a feature-doc section isn't enough |
|
|
373
371
|
| `docs/benchmarks/<feature>.md` | `bench` | One per performance-critical feature |
|
|
374
|
-
| `docs/known-issues.md` | `verify-real-deps` | One per repo (post-mortem record); also holds follow-up tracking for accepted-but-unimplemented ADRs. |
|
|
372
|
+
| `docs/known-issues.md` | `verify-real-deps`, `tdd-rounds` | One per repo (post-mortem record); also holds follow-up tracking for accepted-but-unimplemented ADRs. |
|
|
373
|
+
| `docs/index.md` | doc-drift audit (maintained; reserved OKF name, no frontmatter) | Bundle manifest — lists every produced doc |
|
|
375
374
|
| `CHANGELOG.md` | `prod-ready` Section 7 | One per repo; `[Unreleased]` accumulates between releases. |
|
|
376
375
|
All `docs/` files are created **lazily** — they don't have to pre-exist for a workflow to run. The skill creates them on first use.
|
|
377
376
|
|
|
377
|
+
The canonical registry of produced-doc kinds and their `type` values is [`formats/OKF.md` §2](./formats/OKF.md); this table maps each kind to the workflow step that emits it.
|
|
378
|
+
|
package/skills/bench/SKILL.md
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: bench
|
|
3
|
-
description: Performance benchmarking discipline
|
|
4
|
-
complexity: medium
|
|
5
|
-
expected_duration: 30 minutes
|
|
3
|
+
description: Performance benchmarking discipline — measures latency and throughput against a recorded baseline environment. Triggered by phrases like "benchmark", "performance test", "measure latency", "profile". Skip when there's no performance AC or suspected regression. Pairs with `feature-doc` (the perf AC it verifies) and `prod-ready` (the pre-merge gate the result feeds).
|
|
6
4
|
---
|
|
7
5
|
|
|
8
6
|
# Benchmark
|
|
@@ -19,6 +17,12 @@ Performance claims are often "vibes-based" or measured on a developer's machine
|
|
|
19
17
|
- Identifying regressions or improvements after a major refactor.
|
|
20
18
|
- Profiling hot paths to guide optimization.
|
|
21
19
|
|
|
20
|
+
## When to skip
|
|
21
|
+
|
|
22
|
+
- No performance AC and no suspected regression — don't benchmark for its own sake.
|
|
23
|
+
- Cold paths users rarely hit — measure where the load actually is.
|
|
24
|
+
- Functional-only changes with no latency / throughput / memory claim to verify.
|
|
25
|
+
|
|
22
26
|
## Process
|
|
23
27
|
|
|
24
28
|
### 1. Establish Baseline
|
|
@@ -31,7 +35,19 @@ Run the same test against the changed code. Ensure identical environment conditi
|
|
|
31
35
|
|
|
32
36
|
### 3. Record Findings
|
|
33
37
|
|
|
34
|
-
Create a report in `docs/benchmarks/<feature>.md` using
|
|
38
|
+
Create a report in `docs/benchmarks/<feature>.md` using [`templates/benchmark-report.md`](templates/benchmark-report.md).
|
|
39
|
+
|
|
40
|
+
## Anti-patterns
|
|
41
|
+
|
|
42
|
+
- **Baseline-free numbers.** "40ms faster" with nothing to compare against — record the before-measurement and the environment, or the figure is meaningless.
|
|
43
|
+
- **Noisy-machine benchmarking.** Measuring on a laptop mid-build — pin hardware, load, and concurrency and keep them identical across runs.
|
|
44
|
+
- **Reporting the warmup.** Quoting the first cold-cache iteration — discard warmup and report steady-state percentiles (p50 / p95 / p99).
|
|
45
|
+
|
|
46
|
+
## Pairing with other skills
|
|
47
|
+
|
|
48
|
+
- **[`feature-doc`](../feature-doc/SKILL.md)** — runs *before*. The performance AC it pins is what this skill verifies.
|
|
49
|
+
- **[`tdd`](../tdd/SKILL.md)** — runs *alongside* for functional correctness; `bench` covers the perf AC tests can't assert.
|
|
50
|
+
- **[`prod-ready`](../prod-ready/SKILL.md)** — runs *after*. The benchmark result feeds the pre-merge gate for performance-sensitive work.
|
|
35
51
|
|
|
36
52
|
## Done when
|
|
37
53
|
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: bootstrap
|
|
3
|
-
description: Initializes a greenfield repository
|
|
4
|
-
complexity: low
|
|
5
|
-
expected_duration: 10 minutes
|
|
3
|
+
description: Initializes a greenfield repository — creates the docs/ directory, the initial CONTEXT.md, an optional CONVENTIONS.md, and the first ADR. Triggered by phrases like "new project", "initialize", "bootstrap". Skip when docs/CONTEXT.md and a docs/ structure already exist. Pairs with `feature-doc`, `system-design`, and `improve-codebase-architecture` (which defer here for greenfield setup, per BOOTSTRAP.md) and `grill-plan` (bootstrap mode seeds CONTEXT.md / ADRs lazily during grilling).
|
|
6
4
|
---
|
|
7
5
|
|
|
8
6
|
# Bootstrap
|
|
@@ -24,24 +22,35 @@ Starting from a blank slate often leads to inconsistent documentation structure.
|
|
|
24
22
|
|
|
25
23
|
## Process
|
|
26
24
|
|
|
27
|
-
|
|
25
|
+
Everything below is created **lazily** — only when first needed (see [`BOOTSTRAP.md`](BOOTSTRAP.md)). No file or directory is required to pre-exist.
|
|
28
26
|
|
|
29
|
-
|
|
30
|
-
- `docs/`
|
|
31
|
-
- `docs/adr/`
|
|
32
|
-
- `docs/features/`
|
|
33
|
-
- `docs/research/`
|
|
27
|
+
### 1. Seed CONTEXT.md
|
|
34
28
|
|
|
35
|
-
|
|
29
|
+
Ask the user for 3-7 core domain terms. Create `docs/CONTEXT.md` using the canonical format ([`../formats/CONTEXT-FORMAT.md`](../formats/CONTEXT-FORMAT.md)). The `docs/` directory comes into being with it.
|
|
36
30
|
|
|
37
|
-
|
|
31
|
+
### 2. Seed CONVENTIONS.md (optional)
|
|
38
32
|
|
|
39
|
-
|
|
33
|
+
If the repo has decided structure / process rules worth recording (branch model, commit style, file naming), create `docs/CONVENTIONS.md` using [`../formats/CONVENTION-FORMAT.md`](../formats/CONVENTION-FORMAT.md). Skip if nothing is decided yet — like everything else, it's created lazily.
|
|
40
34
|
|
|
41
|
-
|
|
35
|
+
### 3. Record the first ADR (only if warranted)
|
|
36
|
+
|
|
37
|
+
If a major architectural decision is made during initialization — and it meets all three [`ADR-FORMAT`](../formats/ADR-FORMAT.md) criteria (hard-to-reverse / surprising / real trade-off) — record it as `docs/adr/0001-<slug>.md`. ADR numbering starts at `0001` and is monotonic; create `docs/adr/` lazily with it.
|
|
38
|
+
|
|
39
|
+
Other directories (`docs/features/`, `docs/research/`, …) are created by the skills that first write into them, not here.
|
|
40
|
+
|
|
41
|
+
## Anti-patterns
|
|
42
|
+
|
|
43
|
+
- **Eager scaffolding.** Creating empty `docs/features/`, `docs/research/`, etc. up front — directories are born when a skill first writes into them, not here.
|
|
44
|
+
- **Implementation terms in `CONTEXT.md`.** Seeding the glossary with framework / storage nouns instead of the domain terms a domain expert would recognise.
|
|
45
|
+
- **Forcing ADR 0001.** Writing an ADR when no decision meets all three criteria (hard-to-reverse / surprising / real trade-off) — skip it; ADRs are earned.
|
|
46
|
+
|
|
47
|
+
## Pairing with other skills
|
|
48
|
+
|
|
49
|
+
- **[`feature-doc`](../feature-doc/SKILL.md)** / **[`system-design`](../system-design/SKILL.md)** / **[`improve-codebase-architecture`](../improve-codebase-architecture/SKILL.md)** — defer *here* for greenfield setup rather than re-explaining the rules (see [`BOOTSTRAP.md`](BOOTSTRAP.md)).
|
|
50
|
+
- **[`grill-plan`](../grill-plan/SKILL.md)** — runs *after* in bootstrap mode, seeding `CONTEXT.md` / ADRs lazily as terms and decisions crystallise.
|
|
42
51
|
|
|
43
52
|
## Done when
|
|
44
53
|
|
|
45
|
-
- `docs/` directory exists with the required subdirectories.
|
|
46
54
|
- `docs/CONTEXT.md` is seeded with core domain terms.
|
|
47
|
-
- (Optional) `docs/
|
|
55
|
+
- (Optional) `docs/CONVENTIONS.md` exists if the repo has decided structure / process rules.
|
|
56
|
+
- (Optional) `docs/adr/0001-<slug>.md` exists if a qualifying decision was made.
|
package/skills/caveman/SKILL.md
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: caveman
|
|
3
|
-
description: Ultra-concise communication utility for token optimization. Use when the user mentions "caveman mode", "be concise", "save tokens", or "ooga booga". Strips articles, pleasantries, and filler words to maximize efficiency. Skip when the user explicitly requests professional or detailed explanations.
|
|
4
|
-
complexity: low
|
|
5
|
-
expected_duration: 5 minutes
|
|
3
|
+
description: Ultra-concise communication utility for token optimization. Use when the user mentions "caveman mode", "be concise", "save tokens", or "ooga booga". Strips articles, pleasantries, and filler words to maximize efficiency. Skip when the user explicitly requests professional or detailed explanations. Pairs with `simplify` (the quality / efficiency kin) and applies inside `tdd-rounds` Builder reports.
|
|
6
4
|
---
|
|
7
5
|
|
|
8
6
|
# Caveman Mode (Token Optimizer)
|
package/skills/debug/SKILL.md
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: debug
|
|
3
3
|
description: Disciplined reproduction, isolation, and hypothesis-testing for non-trivial bugs — runs BEFORE `tdd` when the failing assertion isn't yet known. Use when the user reports a bug whose root cause is not obvious from the symptom — triggered by phrases like "it's broken", "this is failing", "intermittent", "flaky", "regression", "not sure why", "production issue", "doesn't work in <env>". Skip for typos, clear stack traces with one-step fixes, or bugs whose fix is obvious from reading the message. Pairs with `tdd` (downstream — the failing test crystallises once the bug is reproduced) and `zoom-out` (upstream, when the area is unfamiliar).
|
|
4
|
-
complexity: high
|
|
5
|
-
expected_duration: 45 minutes
|
|
6
4
|
---
|
|
7
5
|
|
|
8
6
|
# Debug
|
|
@@ -4,6 +4,15 @@ The single highest-leverage application of the type system: prevent bad states a
|
|
|
4
4
|
|
|
5
5
|
The pattern: take a runtime invariant ("a verified user must have a verification timestamp") and encode it in the types. The bad state can no longer be constructed.
|
|
6
6
|
|
|
7
|
+
## This is simplicity, not ceremony — bounded by "boring beats clever"
|
|
8
|
+
|
|
9
|
+
If you prefer simple code, this principle is *on your side*. Constructive typing **deletes** code: the `if (!x) throw` guards repeated across call sites, the `// invariant:` comments that rot. Making a bad state uncompilable is fewer moving parts than defending against it at runtime, not more.
|
|
10
|
+
|
|
11
|
+
The tension people feel is with *defensive* typing — casts, assertions, validate-everywhere, generics for their own sake. That's not this. The rule that keeps the two apart is [`CODE-HYGIENE`](../formats/CODE-HYGIENE.md) Principle 1, applied at the type level:
|
|
12
|
+
|
|
13
|
+
- **Reach for the boring tools first:** sum types / discriminated unions, a narrow domain type where the distinction earns its keep (`Email` vs raw `string`), parse-at-the-boundary then trust, exhaustive matching.
|
|
14
|
+
- **Treat the clever tools as advanced:** phantom types, conditional / mapped-type gymnastics, deep generics, type-level programming. Reach for them only when the invariant is load-bearing *and* the boring encoding can't carry it — the same "is this worth the puzzle?" bar as any clever code. When in doubt, validate at construction (see "Limits" below) instead.
|
|
15
|
+
|
|
7
16
|
## Example 1 — Optional fields that should move together
|
|
8
17
|
|
|
9
18
|
WEAK
|
|
@@ -34,7 +43,9 @@ type User =
|
|
|
34
43
|
|
|
35
44
|
Each state names itself. Pattern matching is exhaustive. The fourth (incoherent) state cannot compile.
|
|
36
45
|
|
|
37
|
-
## Example 2 — Phantom types for pipeline stages
|
|
46
|
+
## Example 2 — Phantom types for pipeline stages *(advanced — reach for only when load-bearing)*
|
|
47
|
+
|
|
48
|
+
Phantom types are the "clever" end of the spectrum: powerful, but a tax on every reader. Use this only when the *ordering* invariant is genuinely load-bearing (a security-sensitive sanitize-before-persist flow) and the cost of getting the order wrong is high. For an ordinary pipeline, a sum type plus validation at the boundary is the boring, sufficient choice.
|
|
38
49
|
|
|
39
50
|
When the same data flows through stages (e.g. `RawInput` → `Validated` → `Sanitized`), encode the stage in the type:
|
|
40
51
|
|
package/skills/design/SKILL.md
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: design
|
|
3
3
|
description: Module and interface design principles — deep modules and testable interfaces. Use when designing a NEW module, class, or public API; deciding what to expose vs hide; reviewing an interface before implementation; or when the user asks "how should I structure this", mentions "deep modules", "testability", or "API design". Use for NEW code shape; for finding deepening opportunities in EXISTING code, use `improve-codebase-architecture`. Skip for trivial glue, getters/setters, or single-call wrappers. Pairs with the tdd skill — good design is what makes TDD pleasant.
|
|
4
|
-
complexity: medium
|
|
5
|
-
expected_duration: 20 minutes
|
|
6
4
|
---
|
|
7
5
|
|
|
8
6
|
# Module and Interface Design
|
|
@@ -14,6 +12,8 @@ Principles that make code easier to understand, change, and test.
|
|
|
14
12
|
3. **Illegal states unrepresentable** — encode runtime invariants in the type system.
|
|
15
13
|
4. **Functional core, imperative shell** — pure logic at the center, side effects at the edges.
|
|
16
14
|
|
|
15
|
+
The architecture vocabulary here — **module**, **interface**, **depth** (deep / shallow), **seam** — is canonical in [`LANGUAGE.md`](../LANGUAGE.md); this skill teaches how to *apply* it and links there rather than redefining it.
|
|
16
|
+
|
|
17
17
|
## When to use
|
|
18
18
|
|
|
19
19
|
- Before writing a new module, class, or public function.
|
|
@@ -118,6 +118,13 @@ If TDD feels painful — tests need elaborate setup, mocks of internals, or peek
|
|
|
118
118
|
- `design` decides *what the interface should be*.
|
|
119
119
|
- `tdd` decides *how to build it test-first*.
|
|
120
120
|
|
|
121
|
+
## Pairing with other skills
|
|
122
|
+
|
|
123
|
+
- **[`system-design`](../system-design/SKILL.md)** — runs *before*. It says which modules should exist; `design` shapes each one's interface.
|
|
124
|
+
- **[`tdd`](../tdd/SKILL.md)** — runs *after* (see *How this connects to TDD* above). `design` decides the interface; `tdd` builds it test-first.
|
|
125
|
+
- **[`tdd-rounds`](../tdd-rounds/SKILL.md)** — *invokes* `design` on rounds that introduce a new package or non-trivial interface.
|
|
126
|
+
- **[`improve-codebase-architecture`](../improve-codebase-architecture/SKILL.md)** — the *brownfield* sibling: same vocabulary, but for deepening existing modules rather than shaping new ones.
|
|
127
|
+
|
|
121
128
|
## Done when
|
|
122
129
|
|
|
123
130
|
The interface is small enough that you can describe it in one sentence, and the testability rules hold:
|
|
@@ -136,4 +143,4 @@ Most of the time `design` is guidance only — the shape lives in the code that
|
|
|
136
143
|
- The interface decisions are load-bearing for downstream rounds of `tdd-rounds`.
|
|
137
144
|
- A `prod-ready` reviewer will need to verify "module map / public-interface signatures / test boundaries" against something explicit (per [prod-ready Section 7](../prod-ready/SKILL.md)).
|
|
138
145
|
|
|
139
|
-
When captured, save as a sibling to the feature doc: `docs/features/<feature>.design.md
|
|
146
|
+
When captured, save as a sibling to the feature doc: `docs/features/<feature>.design.md` — copy [`templates/design-note.md`](templates/design-note.md), which opens with OKF frontmatter (`type: design`) per [`skills/formats/OKF.md`](../formats/OKF.md). Skip when the interface is small enough that the code is the design.
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
---
|
|
2
|
+
type: design
|
|
3
|
+
title: "<Feature Name> — design note"
|
|
4
|
+
description: <one sentence — the module shape this note pins down>
|
|
5
|
+
tags: [<area>, design]
|
|
6
|
+
timestamp: YYYY-MM-DD
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
<!-- Frontmatter is OKF per skills/formats/OKF.md (`type: design`).
|
|
10
|
+
Save as a sibling to the contract: docs/features/<name>.design.md. -->
|
|
11
|
+
|
|
12
|
+
# <Feature Name> — design note
|
|
13
|
+
|
|
14
|
+
The module shape decided before code. Sibling to the contract (`<name>.md`); the round-by-round log lives in `<name>.state.md`.
|
|
15
|
+
|
|
16
|
+
## Modules
|
|
17
|
+
|
|
18
|
+
| Module | Responsibility (one sentence) | Depth |
|
|
19
|
+
| --- | --- | --- |
|
|
20
|
+
| `<name>` | <what it does> | deep / shallow-but-justified |
|
|
21
|
+
|
|
22
|
+
## Public interface
|
|
23
|
+
|
|
24
|
+
What every caller and test must know — types, invariants, error modes, ordering, required config. Not just the signatures.
|
|
25
|
+
|
|
26
|
+
```
|
|
27
|
+
<the signature(s) — the seam callers cross>
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## What's hidden behind the seam
|
|
31
|
+
|
|
32
|
+
The complexity the interface keeps out of callers' heads. If nothing is hidden, the module is shallow — reconsider the shape.
|
|
33
|
+
|
|
34
|
+
## Interface options considered
|
|
35
|
+
|
|
36
|
+
- **Option A — <name>:** <one line>. Chosen / rejected because <reason>.
|
|
37
|
+
- **Option B — <name>:** <one line>. Chosen / rejected because <reason>.
|
|
38
|
+
|
|
39
|
+
## Test boundaries
|
|
40
|
+
|
|
41
|
+
- What is exercised through the public interface (the seam).
|
|
42
|
+
- Which collaborators are real vs faked, and where the fake sits.
|
|
43
|
+
|
|
44
|
+
## Related
|
|
45
|
+
|
|
46
|
+
- Contract: [`<name>.md`](./<name>.md)
|
|
47
|
+
- ADRs: [`ADR-NNNN`](../adr/NNNN-slug.md) — load-bearing constraints this shape respects
|