@mriekki/lean 0.4.3 → 0.4.4
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/assets/components.json +2 -2
- package/assets/core/distribution.json +3 -0
- package/assets/generated/ASSEMBLY.json +28 -13
- package/assets/generated/core/core/learning/DIAGRAM_GUIDE.md +46 -6
- package/assets/generated/core/core/learning/ENGINEERING_LEARNING_WORKBOOK.md +29 -6
- package/assets/generated/core/core/learning/LEARNING_MAP.md +37 -2
- package/assets/generated/core/core/learning/LEARNING_PROGRESS.md +15 -7
- package/assets/generated/core/core/learning/SYSTEM_DESIGN_DRILLS.md +299 -19
- package/assets/generated/core/core/process/COACHING_GUIDE.md +35 -2
- package/assets/generated/core/core/process/DATABASE_LEARNING_WORKBENCH.md +153 -102
- package/assets/generated/core/core/process/SYSTEM_DESIGN_LEARNING_WORKBENCH.md +520 -0
- package/assets/generated/core/core/skills/coach/SKILL.md +31 -4
- package/assets/generated/core/core/skills/db-lab/SKILL.md +59 -16
- package/assets/generated/core/core/skills/deliver/SKILL.md +77 -5
- package/assets/generated/core/core/skills/next-step/SKILL.md +13 -3
- package/assets/generated/core/core/skills/system-lab/SKILL.md +333 -0
- package/assets/generated/core/tools/system_lab/system_workbench.py +243 -0
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: db-lab
|
|
3
|
-
description: "Optional project-aware database learning lab using actual schema, ORM, migration, query, and query-plan evidence for SQL, relational design, debugging, and interview practice."
|
|
4
|
-
argument-hint: "[schema|trace|plan|debug|migration|interview|topic] [light|focused|deep]"
|
|
3
|
+
description: "Optional project-aware database learning lab using actual schema, ORM, migration, query, and query-plan evidence for SQL, relational design, debugging, change exploration, and interview practice."
|
|
4
|
+
argument-hint: "[schema|changes|trace|plan|debug|migration|interview|topic] [work-item] [light|focused|deep]"
|
|
5
5
|
user-invocable: true
|
|
6
6
|
disable-model-invocation: true
|
|
7
7
|
---
|
|
@@ -14,12 +14,13 @@ For detailed usage and examples, read `docs/process/DATABASE_LEARNING_WORKBENCH.
|
|
|
14
14
|
|
|
15
15
|
## 1. Boundaries
|
|
16
16
|
|
|
17
|
-
- Start from the
|
|
17
|
+
- Start from the **current** repository and its documented development/test database configuration.
|
|
18
|
+
- Re-discover relevant database evidence whenever the lab is invoked. Running `/db-lab` means inspect current evidence and show the current view; do not make the human remember to refresh/rebuild an ERD.
|
|
18
19
|
- Prefer read-only inspection. Do not mutate application data, apply migrations, add/drop indexes, or change production code while in Database Lab mode.
|
|
19
20
|
- Never inspect Production credentials or Production data.
|
|
20
21
|
- Do not invent schema, SQL, query-plan behavior, ORM translation, or index usage. Distinguish inferred behavior from captured evidence.
|
|
21
22
|
- If safe local database/runtime evidence is unavailable, fall back to repository artifacts and say what could not be verified.
|
|
22
|
-
- Generated learning artifacts are
|
|
23
|
+
- Generated learning artifacts are disposable projections of current evidence. Generate in temp/cache output and do not commit them unless explicitly requested.
|
|
23
24
|
- Discovered implementation defects return to the normal engineering workflow; do not silently fix them here.
|
|
24
25
|
- Learning is optional and never blocks delivery.
|
|
25
26
|
|
|
@@ -45,7 +46,7 @@ Do not collapse these into one generic "SQL level". A developer may be strong in
|
|
|
45
46
|
|
|
46
47
|
## 3. Schema mode
|
|
47
48
|
|
|
48
|
-
Build an evidence-backed view from the best available sources:
|
|
49
|
+
Build an evidence-backed current view from the best available sources:
|
|
49
50
|
|
|
50
51
|
```text
|
|
51
52
|
physical database metadata
|
|
@@ -65,7 +66,25 @@ ORM MODEL — what the ORM maps and tracks
|
|
|
65
66
|
PHYSICAL MODEL — what the relational database actually stores/enforces
|
|
66
67
|
```
|
|
67
68
|
|
|
68
|
-
## 4.
|
|
69
|
+
## 4. Change-focused mode
|
|
70
|
+
|
|
71
|
+
`/db-lab changes <work-item>` should focus on the accepted/delivered change set when evidence is available.
|
|
72
|
+
|
|
73
|
+
Show relevant changes to:
|
|
74
|
+
|
|
75
|
+
- entities/tables and columns;
|
|
76
|
+
- keys, constraints, relationships and cascade behavior;
|
|
77
|
+
- indexes/access paths;
|
|
78
|
+
- ORM mappings and generated SQL behavior;
|
|
79
|
+
- migrations/schema evolution;
|
|
80
|
+
- affected query paths;
|
|
81
|
+
- transaction/concurrency assumptions.
|
|
82
|
+
|
|
83
|
+
Connect each material change to the learning implication. A changed ORM/model file is evidence that persistence code was touched, not proof that the physical database changed; verify against migrations/schema/database evidence.
|
|
84
|
+
|
|
85
|
+
When a previous disposable workbench snapshot exists, it may be used as a comparison aid. The current database/repository evidence remains authoritative.
|
|
86
|
+
|
|
87
|
+
## 5. Query trace mode
|
|
69
88
|
|
|
70
89
|
Trace a real application query without guessing:
|
|
71
90
|
|
|
@@ -82,7 +101,7 @@ application/ORM expression
|
|
|
82
101
|
|
|
83
102
|
Keep translation preview and actual executed command distinct when the framework exposes both.
|
|
84
103
|
|
|
85
|
-
##
|
|
104
|
+
## 6. Query-to-ERD highlighting
|
|
86
105
|
|
|
87
106
|
When the distributed SQLite workbench or another compatible viewer is available, a selected query should drive a linked ERD view:
|
|
88
107
|
|
|
@@ -97,7 +116,7 @@ Never claim the planner used an index merely because it exists or looks relevant
|
|
|
97
116
|
|
|
98
117
|
If no interactive viewer is available, provide a temporary Mermaid/text diagram using the same evidence and clearly label it as a fallback rather than a live ERD.
|
|
99
118
|
|
|
100
|
-
##
|
|
119
|
+
## 7. SQLite workbench
|
|
101
120
|
|
|
102
121
|
When `tools/lean-db-lab/sqlite-workbench.py` exists and a safe local development/test SQLite database is known, prefer it for physical-schema and query-plan evidence.
|
|
103
122
|
|
|
@@ -110,11 +129,11 @@ The tool:
|
|
|
110
129
|
- generates self-contained `index.html` plus `workbench.json` learning artifacts;
|
|
111
130
|
- supports interactive table/index inspection and query-to-ERD highlighting.
|
|
112
131
|
|
|
113
|
-
Generate output in
|
|
132
|
+
Generate output in a stable per-repository disposable/temp location when practical. Running the lab should regenerate the current view; an already-open older browser tab is not authoritative.
|
|
114
133
|
|
|
115
134
|
The workbench analyzes captured SQL; it does not itself capture Entity Framework commands. Obtain translation/execution evidence through supported framework mechanisms first, then pass the captured SQL into the workbench when useful.
|
|
116
135
|
|
|
117
|
-
##
|
|
136
|
+
## 8. Query-plan/performance mode
|
|
118
137
|
|
|
119
138
|
Use provider-native plan evidence where safely available. Ask the developer to predict likely scans/searches/joins/index behavior before revealing the plan when that improves learning.
|
|
120
139
|
|
|
@@ -130,7 +149,7 @@ query/access pattern
|
|
|
130
149
|
|
|
131
150
|
Do not teach "add an index" without connecting it to a concrete access pattern, selectivity/order needs, write cost, and plan evidence.
|
|
132
151
|
|
|
133
|
-
##
|
|
152
|
+
## 9. Debug mode
|
|
134
153
|
|
|
135
154
|
```text
|
|
136
155
|
symptom
|
|
@@ -145,7 +164,7 @@ symptom
|
|
|
145
164
|
|
|
146
165
|
The human should diagnose before the lab reveals the answer unless they explicitly request explanation-first coaching.
|
|
147
166
|
|
|
148
|
-
##
|
|
167
|
+
## 10. Migration mode
|
|
149
168
|
|
|
150
169
|
Connect:
|
|
151
170
|
|
|
@@ -159,7 +178,7 @@ ORM migration/change
|
|
|
159
178
|
|
|
160
179
|
Ask the developer to predict effects before showing generated SQL when useful. Discuss destructive changes, nullability transitions, backfills, constraint creation, and rollback limitations without applying migrations in learning mode.
|
|
161
180
|
|
|
162
|
-
##
|
|
181
|
+
## 11. Interview/design mode
|
|
163
182
|
|
|
164
183
|
Use the active project domain as context, but perturb requirements so the developer must reason rather than reproduce the existing schema.
|
|
165
184
|
|
|
@@ -181,7 +200,7 @@ requirements clarification
|
|
|
181
200
|
|
|
182
201
|
Challenge unsupported choices. Ask why a junction table exists, why a key was selected, what deletion means historically, which queries justify an index, and how changed requirements alter the design.
|
|
183
202
|
|
|
184
|
-
##
|
|
203
|
+
## 12. ORM-specific evidence
|
|
185
204
|
|
|
186
205
|
When Entity Framework Core is present, distinguish:
|
|
187
206
|
|
|
@@ -195,8 +214,32 @@ Do not present a translation preview as proof of the exact command that executed
|
|
|
195
214
|
|
|
196
215
|
For other ORMs, apply the same principle using framework-supported evidence instead of guessing.
|
|
197
216
|
|
|
198
|
-
##
|
|
217
|
+
## 13. Cross-lab navigation
|
|
218
|
+
|
|
219
|
+
Database Lab owns database depth; System Lab owns end-to-end system context.
|
|
220
|
+
|
|
221
|
+
When database exploration reaches service boundaries, request/event flow, traffic, availability, security, deployment, or system-wide failure behavior, offer `/system-lab` when installed.
|
|
222
|
+
|
|
223
|
+
When `/system-lab` reaches a database node and the learner needs schema/query/index/ORM/plan depth, return to `/db-lab`.
|
|
224
|
+
|
|
225
|
+
## 14. Delivery-completion visibility
|
|
226
|
+
|
|
227
|
+
After successful delivery, Lean may visibly recommend `/db-lab` while the change is fresh when the accepted diff changed database-related evidence such as entities, migrations, schema, SQL/query code, repository/persistence behavior, indexes, constraints, or transaction logic.
|
|
228
|
+
|
|
229
|
+
Prefer learner-facing wording such as:
|
|
230
|
+
|
|
231
|
+
```text
|
|
232
|
+
★ /db-lab changes WI-24
|
|
233
|
+
This work changed database structure or behavior.
|
|
234
|
+
Explore affected relationships, queries, indexes, constraints, and ORM behavior.
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
Do **not** say "rebuild the database diagram" or "refresh the model". Current evidence is part of invoking the lab.
|
|
238
|
+
|
|
239
|
+
Best-effort disposable workbench generation after delivery is allowed only when a safe development/test database is already known. Do not guess a database path, create/apply migrations, or touch Production just to generate a learning artifact. Generation failure never changes delivery state.
|
|
240
|
+
|
|
241
|
+
## 15. Tooling
|
|
199
242
|
|
|
200
243
|
Optional IDE/database extensions may improve exploration but are not workflow authority and must not become a required dependency unless the project explicitly owns that requirement.
|
|
201
244
|
|
|
202
|
-
Prefer provider/framework-native inspection plus repository evidence. The SQLite workbench is a reusable read-only learning aid; future provider/ORM adapters should preserve the same evidence and safety contract.
|
|
245
|
+
Prefer provider/framework-native inspection plus repository evidence. The SQLite workbench is a reusable read-only learning aid; future provider/ORM adapters should preserve the same evidence, current-by-default behavior, and safety contract.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: deliver
|
|
3
|
-
description: "Streamlined delivery after implementation review/approval: short-lived branch recovery/setup, selective commit/push/PR/CI mechanics, one explicit merge/finalize gate, post-merge CI,
|
|
3
|
+
description: "Streamlined delivery after implementation review/approval: short-lived branch recovery/setup, selective commit/push/PR/CI mechanics, one explicit merge/finalize gate, post-merge CI, safe delivered-branch cleanup, and optional non-blocking learning handoff."
|
|
4
4
|
argument-hint: "[optional work-item ID or external key]"
|
|
5
5
|
user-invocable: true
|
|
6
6
|
disable-model-invocation: true
|
|
@@ -49,8 +49,11 @@ D. MERGE + FINALIZE DECISION — one human gate
|
|
|
49
49
|
E. POST-MERGE DEFAULT-BRANCH CI — automatic observation
|
|
50
50
|
F. DELIVERED-BRANCH FINALIZATION — automatic when authorized and safe
|
|
51
51
|
G. DELIVERY COMPLETE
|
|
52
|
+
H. OPTIONAL LEARNING HANDOFF — visible, read-only/non-blocking
|
|
52
53
|
```
|
|
53
54
|
|
|
55
|
+
Phase H never changes whether engineering delivery is complete.
|
|
56
|
+
|
|
54
57
|
## 3. Resume-aware initial inspection
|
|
55
58
|
|
|
56
59
|
Inspect only what is needed to determine the furthest safe delivery state, such as:
|
|
@@ -281,9 +284,9 @@ Never use force deletion merely to bypass uncertainty.
|
|
|
281
284
|
|
|
282
285
|
If any safety condition fails, preserve the branch and report `BRANCH CLEANUP PENDING` with the exact reason instead of asking repetitive yes/no questions.
|
|
283
286
|
|
|
284
|
-
## 11. Delivery completion
|
|
287
|
+
## 11. Delivery completion and optional learning handoff
|
|
285
288
|
|
|
286
|
-
|
|
289
|
+
First report the observed engineering outcome:
|
|
287
290
|
|
|
288
291
|
```text
|
|
289
292
|
DELIVERY COMPLETE
|
|
@@ -302,6 +305,73 @@ DELIVERY COMPLETE — BRANCH CLEANUP PENDING
|
|
|
302
305
|
|
|
303
306
|
and preserve the branch.
|
|
304
307
|
|
|
308
|
+
After engineering delivery is complete, use the accepted PR/work-item diff to classify optional learning relevance. This classification is read-only and does not create another delivery state.
|
|
309
|
+
|
|
310
|
+
Database relevance can include observed changes to entities/models, migrations, DDL/schema, SQL/query/repository/persistence code, indexes/constraints, ORM mappings, or transaction/concurrency behavior.
|
|
311
|
+
|
|
312
|
+
System-design relevance can include observed changes to APIs/contracts, service/module boundaries, cross-component dependencies, external integrations, messaging/events, caches, security/auth boundaries, observability, deployment/runtime topology, infrastructure, scaling/performance behavior, or failure handling.
|
|
313
|
+
|
|
314
|
+
A changed file proves that evidence was touched; it does not by itself prove a physical-schema or runtime-behavior change. Use `changed`/`affected` wording conservatively and verify deeper claims through the corresponding lab.
|
|
315
|
+
|
|
316
|
+
### Best-effort disposable workbench preparation
|
|
317
|
+
|
|
318
|
+
After merge, satisfactory post-merge/default-branch evidence, and update to the delivered default-branch checkout, `/deliver` may prepare current disposable learning artifacts automatically when all prerequisites are already safe and unambiguous.
|
|
319
|
+
|
|
320
|
+
System Lab:
|
|
321
|
+
- when system-design relevance is present and `tools/lean-system-lab/system-workbench.py` exists, it may run the exporter against the current repository;
|
|
322
|
+
- use a stable per-repository temp/cache output directory so an older disposable `workbench.json` can be compared before replacement;
|
|
323
|
+
- pass the accepted changed-file list via `--changed-file` when practical;
|
|
324
|
+
- never write generated workbench output into tracked project paths by default.
|
|
325
|
+
|
|
326
|
+
Database Lab:
|
|
327
|
+
- when database relevance is present, `tools/lean-db-lab/sqlite-workbench.py` exists, and a safe local development/test SQLite database path is already known from project setup/configuration/evidence, it may generate the current DB workbench;
|
|
328
|
+
- do not guess a database path;
|
|
329
|
+
- do not create a database, apply migrations, mutate data, inspect Production, or change code merely to prepare a learning artifact.
|
|
330
|
+
|
|
331
|
+
For either lab:
|
|
332
|
+
- artifact generation is read-only/best-effort;
|
|
333
|
+
- failure/unavailability is reported briefly and never changes `DELIVERY COMPLETE`;
|
|
334
|
+
- generation does not mean the human performed the learning activity or demonstrated understanding;
|
|
335
|
+
- do not open browser/UI automatically unless normal repository/local-workflow conventions make that expected and non-disruptive.
|
|
336
|
+
|
|
337
|
+
### Visible optional learning reminder
|
|
338
|
+
|
|
339
|
+
Keep learning visible while the change is fresh. Prefer this order:
|
|
340
|
+
|
|
341
|
+
```text
|
|
342
|
+
OPTIONAL LEARNING — recommended while this change is fresh
|
|
343
|
+
|
|
344
|
+
★ /db-lab changes <work-item>
|
|
345
|
+
This work changed database structure or behavior.
|
|
346
|
+
Explore affected relationships, queries, indexes, constraints, and ORM behavior.
|
|
347
|
+
|
|
348
|
+
★ /system-lab changes <work-item>
|
|
349
|
+
This work changed system structure or runtime behavior.
|
|
350
|
+
Explore affected components, flows, dependencies, tradeoffs, and failure modes.
|
|
351
|
+
|
|
352
|
+
○ /code-walkthrough <work-item>
|
|
353
|
+
Walk through the implementation and changed-file flow.
|
|
354
|
+
|
|
355
|
+
○ /learning-review <work-item>
|
|
356
|
+
Test your understanding.
|
|
357
|
+
|
|
358
|
+
Learning is optional and does not affect delivery state.
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
Only use `★` for a lab supported by the accepted change evidence. If a lab is not especially relevant, keep it visible as an available option when useful, for example:
|
|
362
|
+
|
|
363
|
+
```text
|
|
364
|
+
○ /db-lab
|
|
365
|
+
Explore the current database schema, relationships, queries, indexes, and ORM behavior.
|
|
366
|
+
|
|
367
|
+
○ /system-lab
|
|
368
|
+
Explore the current architecture, runtime flows, dependencies, scaling, and failure behavior.
|
|
369
|
+
```
|
|
370
|
+
|
|
371
|
+
Do not tell the human to "rebuild", "refresh", or maintain a generated diagram. Invoking a lab means inspect current evidence and generate/show the current view.
|
|
372
|
+
|
|
373
|
+
Do not turn these reminders into approval prompts. The human may invoke one, continue to deployment work, start another work item, or do nothing.
|
|
374
|
+
|
|
305
375
|
## 12. Deployment handoff
|
|
306
376
|
|
|
307
377
|
If the delivered work item owns release/deployment engineering, successful engineering delivery may hand off to the selected environment's state-driven readiness workflow:
|
|
@@ -314,12 +384,14 @@ Readiness re-discovers current state and continues from the furthest safe point;
|
|
|
314
384
|
|
|
315
385
|
The readiness workflow is environment-generic. Production remains an environment role with stronger policy; merge approval never implies remote or production-deployment authorization.
|
|
316
386
|
|
|
387
|
+
The optional learning handoff does not block or replace deployment readiness when deployment is the sensible next engineering action.
|
|
388
|
+
|
|
317
389
|
## 13. Relationship to /start-work, /next-step, and /cleanup-branches
|
|
318
390
|
|
|
319
391
|
`/start-work` establishes the short-lived work branch as routine implementation setup once implementation is actually authorized.
|
|
320
392
|
|
|
321
|
-
`/next-step` answers `Where am I
|
|
393
|
+
`/next-step` answers `Where am I?` and may surface optional learning choices without creating learning-only workflow states.
|
|
322
394
|
|
|
323
|
-
`/deliver` takes reviewed/accepted work through routine branch/commit/push/PR/CI mechanics automatically, then stops once for the merge-and-finalize decision.
|
|
395
|
+
`/deliver` takes reviewed/accepted work through routine branch/commit/push/PR/CI mechanics automatically, then stops once for the merge-and-finalize decision. After successful engineering completion it may prepare disposable learning workbenches and shows an optional learning handoff without creating another gate.
|
|
324
396
|
|
|
325
397
|
`/cleanup-branches` is the standalone preview-first path for accumulated, previously retained, unrelated, or otherwise out-of-band branch housekeeping.
|
|
@@ -68,7 +68,7 @@ Use only states supported by observed evidence.
|
|
|
68
68
|
|
|
69
69
|
Do not add a separate final-PR-acceptance state when the PR still exactly matches the already accepted local implementation. In that normal case, `/deliver` combines final acceptance and merge into the single `MERGE_READY` decision. If PR evidence changed materially, describe the required final PR review explicitly before returning to `MERGE_READY`.
|
|
70
70
|
|
|
71
|
-
Do not add learning-only states such as `CODE_WALKTHROUGH_PENDING`. Optional coaching
|
|
71
|
+
Do not add learning-only states such as `CODE_WALKTHROUGH_PENDING`. Optional coaching and labs do not change engineering delivery state.
|
|
72
72
|
|
|
73
73
|
## 3. Output
|
|
74
74
|
|
|
@@ -96,9 +96,17 @@ When implementation is stable enough to learn from and the human appears interes
|
|
|
96
96
|
/code-walkthrough <scope> — guided changed-file explanation [READ ONLY]
|
|
97
97
|
/learning-review <scope> — understanding assessment [READ ONLY]
|
|
98
98
|
/coach <topic> — focused concept coaching [READ ONLY]
|
|
99
|
+
/db-lab [changes <work-item>] — current database/schema/query/ORM evidence [READ ONLY]
|
|
100
|
+
/system-lab [changes <work-item>] — current architecture/runtime/failure/design evidence [READ ONLY]
|
|
99
101
|
```
|
|
100
102
|
|
|
101
|
-
Prefer `/code-walkthrough` when the user wants to understand what changed across an implementation.
|
|
103
|
+
Prefer `/code-walkthrough` when the user wants to understand what changed across an implementation. Prefer `/db-lab` when the question depends on concrete schema/query/index/ORM evidence. Prefer `/system-lab` when it depends on architecture, runtime flows, APIs, dependencies, failure behavior, scale, messaging, observability, security, deployment, testing, or system-design tradeoffs.
|
|
104
|
+
|
|
105
|
+
When a known work-item diff materially touches one of those evidence areas, make the corresponding `changes <work-item>` option visibly relevant. Do not claim a runtime or physical-schema change solely because a file was touched.
|
|
106
|
+
|
|
107
|
+
Labs inspect current evidence when invoked. Do not tell the human to refresh or rebuild a generated diagram.
|
|
108
|
+
|
|
109
|
+
Do not recommend any learning activity as mandatory before `/deliver`.
|
|
102
110
|
|
|
103
111
|
## 5. Delivery handoff
|
|
104
112
|
|
|
@@ -140,7 +148,7 @@ Never merge from `/next-step` merely because CI is green.
|
|
|
140
148
|
After merge:
|
|
141
149
|
- if required default-branch CI is pending, return to `/deliver` to resume observation/finalization;
|
|
142
150
|
- if failed, inspect/diagnose;
|
|
143
|
-
- if green and branch finalization is safe/complete, report delivery complete.
|
|
151
|
+
- if green and branch finalization is safe/complete, report delivery complete and optional relevant learning follow-ups without changing the delivery state.
|
|
144
152
|
|
|
145
153
|
## 6. Deployment handoff
|
|
146
154
|
|
|
@@ -173,3 +181,5 @@ Do not infer readiness of one environment from another. Production is never an i
|
|
|
173
181
|
## 7. Keep it lean
|
|
174
182
|
|
|
175
183
|
Do not auto-run Reviewer, auto-run learning activities, auto-merge, auto-deploy, pin/select a model, or maintain duplicate workflow state outside Git/GitHub and the configured work-item/readiness authority.
|
|
184
|
+
|
|
185
|
+
Generating a disposable read-only learning workbench is not the same as auto-running a learning activity or proving understanding. `/deliver` may prepare such artifacts best-effort after successful delivery when safe and relevant; learning itself remains optional.
|
|
@@ -0,0 +1,333 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: system-lab
|
|
3
|
+
description: "Optional evidence-backed advanced system-design lab for architecture, runtime flows, APIs, failures, capacity, performance, observability, security, messaging, deployment, testing, evolution, debugging, and interview practice."
|
|
4
|
+
argument-hint: "[architecture|runtime|api|failure|capacity|performance|observability|security|messaging|deployment|testing|debug|changes|evolve|compare|interview|topic] [work-item]"
|
|
5
|
+
user-invocable: true
|
|
6
|
+
disable-model-invocation: true
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# System Lab
|
|
10
|
+
|
|
11
|
+
`/system-lab` is an optional advanced learning surface built from current repository/runtime evidence. It complements `/coach`; it does not replace the engineering workflow or authorize implementation changes.
|
|
12
|
+
|
|
13
|
+
For detailed usage, model semantics, and examples, read `docs/process/SYSTEM_DESIGN_LEARNING_WORKBENCH.md` in a greenfield consumer (or canonical `core/process/SYSTEM_DESIGN_LEARNING_WORKBENCH.md`).
|
|
14
|
+
|
|
15
|
+
## 1. Core contract
|
|
16
|
+
|
|
17
|
+
- Start from the current repository and the minimum safe evidence needed for the requested lens.
|
|
18
|
+
- Treat the repository/runtime/configuration evidence as authoritative; generated diagrams are disposable projections, never a second source of truth.
|
|
19
|
+
- Re-discover evidence whenever the lab is invoked. Do not make the human remember to refresh or rebuild a diagram.
|
|
20
|
+
- Prefer the distributed `tools/lean-system-lab/system-workbench.py` when present. It always rebuilds its model from current evidence and may compare with its prior disposable snapshot.
|
|
21
|
+
- Never inspect Production credentials, Production data, or secret values.
|
|
22
|
+
- Do not change production code, configuration, infrastructure, schemas, data, or deployment state while in System Lab mode.
|
|
23
|
+
- Do not claim runtime behavior from static topology alone. Label evidence precisely.
|
|
24
|
+
- Discovered implementation defects return to the normal engineering workflow; do not silently fix them here.
|
|
25
|
+
- Learning is optional and never blocks delivery.
|
|
26
|
+
|
|
27
|
+
## 2. Evidence labels
|
|
28
|
+
|
|
29
|
+
Use these labels consistently:
|
|
30
|
+
|
|
31
|
+
```text
|
|
32
|
+
CONFIRMED BY CODE — directly observed in source/configuration/tests
|
|
33
|
+
CONFIRMED BY RUNTIME — directly observed in safe runtime/telemetry evidence
|
|
34
|
+
DOCUMENTED INTENT — stated in project documentation/ADR/requirements
|
|
35
|
+
INFERRED — reasonable interpretation from incomplete evidence
|
|
36
|
+
UNKNOWN — evidence is insufficient
|
|
37
|
+
LEARNER ASSUMPTION — value supplied for a design/capacity exercise
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
A diagram edge is not automatically proof that a runtime call occurred. A dependency discovered from configuration/package references may still be only structural evidence.
|
|
41
|
+
|
|
42
|
+
## 3. System-design competencies
|
|
43
|
+
|
|
44
|
+
Assess independently rather than using one generic "system design level":
|
|
45
|
+
|
|
46
|
+
```text
|
|
47
|
+
requirements + scope framing
|
|
48
|
+
capacity estimation + workload modeling
|
|
49
|
+
API + contract design
|
|
50
|
+
service/module decomposition
|
|
51
|
+
data/storage selection
|
|
52
|
+
caching
|
|
53
|
+
messaging + asynchronous workflows
|
|
54
|
+
consistency + distributed coordination
|
|
55
|
+
scaling + partitioning
|
|
56
|
+
availability + fault tolerance
|
|
57
|
+
latency + performance
|
|
58
|
+
runtime/deployment topology
|
|
59
|
+
observability + SLO reasoning
|
|
60
|
+
security + abuse resistance
|
|
61
|
+
cost/complexity awareness
|
|
62
|
+
architecture evolution
|
|
63
|
+
incident/debug reasoning
|
|
64
|
+
testing/verification strategy
|
|
65
|
+
tradeoff defense
|
|
66
|
+
interview communication
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Use the common L1-L6 levels, but record evidence per competency.
|
|
70
|
+
|
|
71
|
+
## 4. Architecture lenses
|
|
72
|
+
|
|
73
|
+
Treat one system model as the basis for multiple views:
|
|
74
|
+
|
|
75
|
+
```text
|
|
76
|
+
STRUCTURE components and dependencies
|
|
77
|
+
RUNTIME request/event path for a scenario
|
|
78
|
+
API contracts, boundaries, callers, downstreams
|
|
79
|
+
DATA stateful components and data movement
|
|
80
|
+
SCALE load assumptions and bottleneck questions
|
|
81
|
+
FAILURE failure domains and propagation hypotheses
|
|
82
|
+
CONSISTENCY places state may disagree or ordering/idempotency matters
|
|
83
|
+
PERFORMANCE latency budgets, fan-out, saturation, timeout/retry behavior
|
|
84
|
+
OBSERVABILITY metrics/logs/traces/SLO evidence and gaps
|
|
85
|
+
SECURITY trust boundaries, authn/authz, secrets/PII exposure, abuse controls
|
|
86
|
+
MESSAGING producers/consumers, delivery semantics, ordering, retries, DLQ
|
|
87
|
+
DEPLOYMENT processes/containers/nodes/environments and rollout concerns
|
|
88
|
+
TESTING verification boundaries and untested risk
|
|
89
|
+
CHANGES architecture impact of the current/recent work item
|
|
90
|
+
EVOLUTION what complexity becomes justified as constraints change
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
If evidence for a lens is absent, show the gap instead of inventing detail.
|
|
94
|
+
|
|
95
|
+
## 5. Interactive workbench
|
|
96
|
+
|
|
97
|
+
When `tools/lean-system-lab/system-workbench.py` exists, prefer it for a current project snapshot.
|
|
98
|
+
|
|
99
|
+
The tool is read-only and dependency-free. It:
|
|
100
|
+
|
|
101
|
+
- scans current repository evidence for application/service/frontend/library/datastore/cache/messaging/external/deployment/test signals;
|
|
102
|
+
- records provenance for inferred components and dependencies;
|
|
103
|
+
- generates a stable evidence fingerprint and current Git commit when available;
|
|
104
|
+
- automatically compares with the prior disposable snapshot in the selected output directory;
|
|
105
|
+
- accepts optional explicit model JSON for richer known architecture, scenarios, failure behavior, decisions, SLOs, and metadata;
|
|
106
|
+
- accepts changed-file paths so a delivered work item can be overlaid on the architecture;
|
|
107
|
+
- creates self-contained `index.html` plus `workbench.json`;
|
|
108
|
+
- supports draggable nodes, search, zoom, clickable nodes/edges, scenario highlighting, lens switching, change overlays, failure exploration, capacity calculations, latency budgets, scale/evolution prompts, design drills, and interview perturbations.
|
|
109
|
+
|
|
110
|
+
Generate into a stable per-repository temp/cache directory so the prior disposable snapshot can be used for change comparison. Do not commit generated output unless explicitly requested.
|
|
111
|
+
|
|
112
|
+
## 6. Scenario-to-architecture tracing
|
|
113
|
+
|
|
114
|
+
For a scenario such as checkout, authentication, background processing, or notification:
|
|
115
|
+
|
|
116
|
+
```text
|
|
117
|
+
entry point
|
|
118
|
+
→ participating components
|
|
119
|
+
→ synchronous calls
|
|
120
|
+
→ state reads/writes
|
|
121
|
+
→ asynchronous messages
|
|
122
|
+
→ external dependencies
|
|
123
|
+
→ user-visible/result state
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
Highlight only evidence-backed participants. If the sequence is inferred from topology rather than captured runtime evidence, say so.
|
|
127
|
+
|
|
128
|
+
Ask the learner to explain the path before filling gaps when that improves learning.
|
|
129
|
+
|
|
130
|
+
## 7. Prediction before reveal
|
|
131
|
+
|
|
132
|
+
For advanced learning, default to making the human predict before revealing the explanation when practical.
|
|
133
|
+
|
|
134
|
+
Examples:
|
|
135
|
+
|
|
136
|
+
```text
|
|
137
|
+
What fails if this dependency times out?
|
|
138
|
+
Which component becomes the bottleneck at 10x traffic?
|
|
139
|
+
Where can duplicate delivery cause damage?
|
|
140
|
+
Which signal would distinguish database latency from downstream latency?
|
|
141
|
+
What consistency guarantee does the requirement actually need?
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
Do not turn every interaction into a quiz. Explanation-first remains valid when explicitly requested.
|
|
145
|
+
|
|
146
|
+
## 8. Failure and debugging mode
|
|
147
|
+
|
|
148
|
+
Failure mode should distinguish verified behavior from topological hypotheses.
|
|
149
|
+
|
|
150
|
+
```text
|
|
151
|
+
symptom/failure injection
|
|
152
|
+
→ learner predicts impact
|
|
153
|
+
→ identify failure boundary
|
|
154
|
+
→ likely propagation
|
|
155
|
+
→ distinguishing telemetry/evidence
|
|
156
|
+
→ resilience behavior
|
|
157
|
+
→ user-visible effect
|
|
158
|
+
→ prevention/design alternatives
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
Useful perturbations include database/cache/queue/dependency unavailability, slow dependency, duplicate/delayed/out-of-order messages, retry amplification, queue backlog, regional failure, network partition, bad deployment, and traffic spikes.
|
|
162
|
+
|
|
163
|
+
For `/system-lab debug`, reveal evidence incrementally and ask what evidence the learner would inspect next. Do not implement the fix in learning mode.
|
|
164
|
+
|
|
165
|
+
## 9. Capacity and performance mode
|
|
166
|
+
|
|
167
|
+
Use explicit learner/design assumptions, not invented production numbers.
|
|
168
|
+
|
|
169
|
+
Connect:
|
|
170
|
+
|
|
171
|
+
```text
|
|
172
|
+
DAU / active users
|
|
173
|
+
requests per user
|
|
174
|
+
peak multiplier
|
|
175
|
+
read/write mix
|
|
176
|
+
payload size
|
|
177
|
+
retention
|
|
178
|
+
fan-out
|
|
179
|
+
latency/SLO target
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
with derived average/peak RPS, write RPS, bandwidth, storage growth, and latency-budget reasoning. Explain simplifying assumptions.
|
|
183
|
+
|
|
184
|
+
A scale slider or changed workload is a prompt to re-evaluate bottlenecks and complexity; it is not proof that a specific technology is required.
|
|
185
|
+
|
|
186
|
+
## 10. Distributed-systems and messaging mode
|
|
187
|
+
|
|
188
|
+
Practice:
|
|
189
|
+
|
|
190
|
+
- strong/eventual/read-after-write consistency;
|
|
191
|
+
- optimistic concurrency and conflict handling;
|
|
192
|
+
- idempotency and deduplication;
|
|
193
|
+
- at-least-once delivery and the limits of "exactly once" claims;
|
|
194
|
+
- ordering and partitioning;
|
|
195
|
+
- retry/backoff/DLQ behavior;
|
|
196
|
+
- outbox/inbox patterns;
|
|
197
|
+
- sagas/compensation;
|
|
198
|
+
- distributed locks only when justified.
|
|
199
|
+
|
|
200
|
+
Use timelines when helpful. Make the learner reason about state before and after duplicate, delayed, failed, or reordered events.
|
|
201
|
+
|
|
202
|
+
## 11. API, security, observability, testing, and deployment lenses
|
|
203
|
+
|
|
204
|
+
API:
|
|
205
|
+
- contract shape, validation, versioning, auth, errors, pagination, idempotency, downstream coupling.
|
|
206
|
+
|
|
207
|
+
Security:
|
|
208
|
+
- trust boundaries, public exposure, authentication, authorization, secret handling, PII/data classification, replay/abuse/rate limiting.
|
|
209
|
+
|
|
210
|
+
Observability:
|
|
211
|
+
- logs, metrics, traces, SLOs, correlation, dependency health, saturation/queue depth, evidence gaps.
|
|
212
|
+
|
|
213
|
+
Testing:
|
|
214
|
+
- unit/integration/contract/e2e boundaries, failure-path coverage, architecture risks not currently exercised.
|
|
215
|
+
|
|
216
|
+
Deployment:
|
|
217
|
+
- artifact/process/container topology, environment/config boundaries, health/readiness, scaling, rollout/rollback, region/failure-domain assumptions.
|
|
218
|
+
|
|
219
|
+
Treat missing evidence as a learning question, not a defect by itself.
|
|
220
|
+
|
|
221
|
+
## 12. Architecture evolution and counterfactuals
|
|
222
|
+
|
|
223
|
+
Use the current system as the baseline and explore changes such as:
|
|
224
|
+
|
|
225
|
+
```text
|
|
226
|
+
remove the cache
|
|
227
|
+
make a synchronous path asynchronous
|
|
228
|
+
increase traffic 10x/100x
|
|
229
|
+
move from SQLite to a server database
|
|
230
|
+
introduce multi-region requirements
|
|
231
|
+
split or recombine a service
|
|
232
|
+
add a queue/search/object store/CDN
|
|
233
|
+
tighten latency/availability/privacy requirements
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
For each evolution:
|
|
237
|
+
|
|
238
|
+
```text
|
|
239
|
+
problem/evidence
|
|
240
|
+
→ change
|
|
241
|
+
→ expected benefit
|
|
242
|
+
→ new complexity/failure modes
|
|
243
|
+
→ migration path
|
|
244
|
+
→ when NOT to do it
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
Prefer evolutionary design over cargo-cult complexity.
|
|
248
|
+
|
|
249
|
+
## 13. Tradeoff and "why not?" drills
|
|
250
|
+
|
|
251
|
+
Challenge choices with credible alternatives:
|
|
252
|
+
|
|
253
|
+
```text
|
|
254
|
+
Why not a monolith?
|
|
255
|
+
Why not microservices?
|
|
256
|
+
Why not Kafka/a queue?
|
|
257
|
+
Why not synchronous HTTP?
|
|
258
|
+
Why not cache this?
|
|
259
|
+
Why not shard now?
|
|
260
|
+
Why not retry here?
|
|
261
|
+
Why not use the existing relational database?
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
The goal is to defend the simplest design that satisfies current constraints, then adapt when constraints materially change.
|
|
265
|
+
|
|
266
|
+
## 14. Architecture decisions
|
|
267
|
+
|
|
268
|
+
When ADRs or documented decisions exist, connect diagram components/edges to them. For each major choice discuss:
|
|
269
|
+
|
|
270
|
+
```text
|
|
271
|
+
context
|
|
272
|
+
chosen decision
|
|
273
|
+
alternatives
|
|
274
|
+
tradeoffs
|
|
275
|
+
consequences
|
|
276
|
+
revisit trigger
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
Do not silently create durable ADRs in learning mode.
|
|
280
|
+
|
|
281
|
+
## 15. Change-focused learning
|
|
282
|
+
|
|
283
|
+
`/system-lab changes <work-item>` should focus on the accepted/delivered change set when evidence is available.
|
|
284
|
+
|
|
285
|
+
Show:
|
|
286
|
+
|
|
287
|
+
- added/removed/changed components and dependencies;
|
|
288
|
+
- affected runtime/data/message paths;
|
|
289
|
+
- newly introduced or materially changed failure modes;
|
|
290
|
+
- new security/observability/performance/testing questions;
|
|
291
|
+
- architecture decisions or assumptions worth explaining.
|
|
292
|
+
|
|
293
|
+
A changed file is evidence that a component was touched, not proof that its runtime behavior changed. Keep that distinction visible.
|
|
294
|
+
|
|
295
|
+
## 16. Interview mode
|
|
296
|
+
|
|
297
|
+
Make the human drive:
|
|
298
|
+
|
|
299
|
+
```text
|
|
300
|
+
requirements
|
|
301
|
+
→ constraints + scale assumptions
|
|
302
|
+
→ API/contracts
|
|
303
|
+
→ data/storage
|
|
304
|
+
→ high-level architecture
|
|
305
|
+
→ deep dive
|
|
306
|
+
→ bottleneck/failure analysis
|
|
307
|
+
→ consistency/reliability
|
|
308
|
+
→ security/observability
|
|
309
|
+
→ evolution
|
|
310
|
+
→ tradeoff defense
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
Perturb one material constraint at a time: 20x traffic, multi-region, strict data residency, unreliable dependency, tighter p99, zero-downtime migration, duplicate delivery, cost pressure, or new abuse threat.
|
|
314
|
+
|
|
315
|
+
Score/coach the independent system-design competencies rather than assigning one generic score.
|
|
316
|
+
|
|
317
|
+
## 17. Cross-lab navigation
|
|
318
|
+
|
|
319
|
+
System Lab owns system context; Database Lab owns schema/query/ORM/plan depth.
|
|
320
|
+
|
|
321
|
+
When a system node represents a database, explicitly offer `/db-lab` for deeper relational/query evidence. When `/db-lab` reaches system-level concerns such as service boundaries, traffic, availability, or end-to-end runtime flow, offer `/system-lab`.
|
|
322
|
+
|
|
323
|
+
Do not duplicate database internals inside System Lab or architecture reasoning inside Database Lab.
|
|
324
|
+
|
|
325
|
+
## 18. Delivery-completion visibility
|
|
326
|
+
|
|
327
|
+
After successful delivery, Lean may recommend the labs as optional learning while the change is fresh.
|
|
328
|
+
|
|
329
|
+
- If database-related evidence changed, make `/db-lab` or `/db-lab changes <work-item>` visibly recommended.
|
|
330
|
+
- If architecture/runtime/API/messaging/deployment/security/observability behavior changed, make `/system-lab` or `/system-lab changes <work-item>` visibly recommended.
|
|
331
|
+
- If neither is especially relevant, the labs may remain visible as available options without claiming the ticket changed them.
|
|
332
|
+
- Never use user-facing wording such as "rebuild the diagram" or "refresh the database model". Running a lab already means inspect current evidence and generate the current view.
|
|
333
|
+
- Best-effort disposable artifact generation after delivery is allowed when safe and cheap, but failure to generate a learning artifact never changes delivery state.
|