@mriekki/lean 0.4.3 → 0.4.5

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 (35) hide show
  1. package/assets/components.json +3 -3
  2. package/assets/core/distribution.json +8 -0
  3. package/assets/deployment/distribution.json +2 -0
  4. package/assets/generated/ASSEMBLY.json +73 -23
  5. package/assets/generated/core/core/instructions/lean-docs.instructions.md +33 -2
  6. package/assets/generated/core/core/instructions/lean-workflow.instructions.md +42 -0
  7. package/assets/generated/core/core/learning/DIAGRAM_GUIDE.md +46 -6
  8. package/assets/generated/core/core/learning/ENGINEERING_LEARNING_WORKBOOK.md +29 -6
  9. package/assets/generated/core/core/learning/LEARNING_MAP.md +37 -2
  10. package/assets/generated/core/core/learning/LEARNING_PROGRESS.md +15 -7
  11. package/assets/generated/core/core/learning/SYSTEM_DESIGN_DRILLS.md +299 -19
  12. package/assets/generated/core/core/process/COACHING_GUIDE.md +35 -2
  13. package/assets/generated/core/core/process/DATABASE_LEARNING_WORKBENCH.md +153 -102
  14. package/assets/generated/core/core/process/DEPLOYMENT_ENABLEMENT.md +108 -71
  15. package/assets/generated/core/core/process/LEAN_ENGINEERING_GUIDE.md +317 -0
  16. package/assets/generated/core/core/process/PROJECT_DOCUMENTATION_FRAMEWORK.md +324 -0
  17. package/assets/generated/core/core/process/SYSTEM_DESIGN_LEARNING_WORKBENCH.md +520 -0
  18. package/assets/generated/core/core/skills/coach/SKILL.md +31 -4
  19. package/assets/generated/core/core/skills/db-lab/SKILL.md +59 -16
  20. package/assets/generated/core/core/skills/deliver/SKILL.md +77 -5
  21. package/assets/generated/core/core/skills/deploy/SKILL.md +164 -121
  22. package/assets/generated/core/core/skills/deployment-readiness/SKILL.md +223 -250
  23. package/assets/generated/core/core/skills/docs/SKILL.md +116 -0
  24. package/assets/generated/core/core/skills/next-step/SKILL.md +21 -6
  25. package/assets/generated/core/core/skills/system-lab/SKILL.md +333 -0
  26. package/assets/generated/core/core/skills/tear-down/SKILL.md +101 -61
  27. package/assets/generated/core/core/templates/ADR_TEMPLATE.md +41 -0
  28. package/assets/generated/core/tools/docs_site/docs_site.py +382 -0
  29. package/assets/generated/core/tools/system_lab/system_workbench.py +243 -0
  30. package/assets/generated/deployment/src/lean_poc_deployment/entrypoint.py +5 -1
  31. package/assets/generated/deployment/src/lean_poc_deployment/local_cli.py +112 -0
  32. package/assets/generated/deployment/src/lean_poc_deployment/local_runtime.py +523 -0
  33. package/assets/generated/deployment/src/lean_poc_deployment/teardown.py +49 -35
  34. package/assets/generated/deployment/src/lean_poc_deployment/teardown_cli.py +31 -12
  35. package/package.json +1 -1
@@ -1,21 +1,301 @@
1
1
  # System-Design Drills
2
2
 
3
- Start from the actual repository.
4
-
5
- Possible exercises:
6
-
7
- - explain current architecture,
8
- - scale users/tenants,
9
- - evolve persistence,
10
- - multi-instance concurrency,
11
- - caching,
12
- - messaging/events,
13
- - search,
14
- - file/object storage,
15
- - authentication/authorization,
16
- - observability,
17
- - backup/recovery,
18
- - incident response,
19
- - offline/synchronization.
20
-
21
- Ask one question at a time and make the developer drive the design.
3
+ Start from the actual repository whenever possible. Use `/system-lab` when concrete architecture/runtime evidence is needed and `/coach system design` for conceptual/adaptive practice.
4
+
5
+ Ask one material question at a time. Make the developer state assumptions and drive the design. For advanced exercises, prefer prediction before reveal.
6
+
7
+ ## Requirements and scope
8
+
9
+ - Identify functional versus non-functional requirements.
10
+ - Separate must-have V1 constraints from future scale assumptions.
11
+ - Ask which guarantees actually matter: latency, availability, durability, consistency, privacy, cost, recovery.
12
+ - Challenge unstated assumptions.
13
+ - Ask what is explicitly out of scope.
14
+
15
+ ## Capacity and workload
16
+
17
+ Give or elicit:
18
+
19
+ ```text
20
+ users / active users
21
+ requests per user
22
+ peak multiplier
23
+ read/write mix
24
+ payload size
25
+ retention
26
+ fan-out
27
+ latency target
28
+ availability target
29
+ ```
30
+
31
+ Have the learner estimate average/peak RPS, bandwidth, storage growth, and likely constrained resources before revealing calculated approximations.
32
+
33
+ Perturb the workload:
34
+ - 10x traffic;
35
+ - 100x traffic;
36
+ - read-heavy becomes write-heavy;
37
+ - one tenant dominates load;
38
+ - burst traffic replaces smooth traffic.
39
+
40
+ Ask which architectural change becomes justified first and what evidence would prove it.
41
+
42
+ ## Architecture and decomposition
43
+
44
+ - Explain current architecture from repository evidence.
45
+ - Identify module/service boundaries and why they exist.
46
+ - Propose a simpler architecture and defend why it is or is not sufficient.
47
+ - Compare monolith/modular monolith/services for the current constraints.
48
+ - Ask what would trigger extraction of a service rather than assuming microservices.
49
+ - Identify stateful versus stateless components.
50
+ - Identify synchronous versus asynchronous dependencies.
51
+
52
+ ## API and integration
53
+
54
+ - Trace one endpoint from caller to state/dependencies.
55
+ - Design request/response/error contracts.
56
+ - Discuss versioning and compatibility.
57
+ - Decide where validation/auth/idempotency belongs.
58
+ - Reason about pagination, partial failure, timeouts, cancellation and retries.
59
+ - Ask what happens when an external dependency is slow or unavailable.
60
+
61
+ ## Data and storage
62
+
63
+ - Choose between relational, document, key-value, search and object storage based on access/integrity requirements.
64
+ - Explain why the existing datastore is or is not enough.
65
+ - Identify ownership of state across components.
66
+ - Explore read replicas, partitioning/sharding and their complexity triggers.
67
+ - Route schema/query/index deep dives to `/db-lab`.
68
+
69
+ ## Caching
70
+
71
+ - What resource is the cache actually protecting?
72
+ - What is the cache key and eviction/invalidation strategy?
73
+ - What happens on stale data?
74
+ - What happens when the cache disappears?
75
+ - Could caching increase inconsistency or database stampede risk?
76
+ - Why not avoid the cache until measurement justifies it?
77
+
78
+ ## Messaging and asynchronous workflows
79
+
80
+ Use a timeline:
81
+
82
+ ```text
83
+ state change
84
+ → publish
85
+ → consume
86
+ → side effect
87
+ → acknowledge
88
+ ```
89
+
90
+ Perturb with:
91
+ - duplicate message;
92
+ - delayed message;
93
+ - reordered message;
94
+ - poison message;
95
+ - consumer crash before/after side effect;
96
+ - broker unavailable;
97
+ - growing consumer lag.
98
+
99
+ Ask where idempotency/deduplication belongs, what is durable at each step, and how retries/DLQ/compensation work.
100
+
101
+ ## Consistency and distributed coordination
102
+
103
+ Practice:
104
+ - strong versus eventual consistency;
105
+ - read-after-write requirements;
106
+ - optimistic concurrency;
107
+ - lost update/conflict handling;
108
+ - saga/compensation;
109
+ - transactional outbox/inbox;
110
+ - distributed locks only when justified;
111
+ - why "exactly once" claims need careful qualification.
112
+
113
+ Ask the learner to identify which business invariant requires which guarantee rather than choosing a consistency model by habit.
114
+
115
+ ## Failure and resilience
116
+
117
+ Inject one failure at a time:
118
+
119
+ ```text
120
+ database unavailable
121
+ cache unavailable
122
+ message delayed/duplicated
123
+ third party times out
124
+ one service becomes 5x slower
125
+ queue backs up
126
+ region unavailable
127
+ network partition
128
+ bad deployment
129
+ traffic spike
130
+ ```
131
+
132
+ Sequence:
133
+
134
+ ```text
135
+ learner predicts impact
136
+ → identify propagation path
137
+ → identify distinguishing evidence
138
+ → discuss timeouts/retries/bulkheads/circuit breakers/fallbacks
139
+ → user-visible effect
140
+ → prevention/alternative
141
+ ```
142
+
143
+ Challenge retry storms and hidden coupling.
144
+
145
+ ## Performance and latency
146
+
147
+ Give a latency target and component estimates. Have the learner construct the budget.
148
+
149
+ Perturb:
150
+ - one dependency doubles latency;
151
+ - fan-out increases;
152
+ - p50 is fine but p99 regresses;
153
+ - DB queries are fast but request latency is high;
154
+ - synchronous work can become background work.
155
+
156
+ Discuss tail latency, timeout budgets, parallelism, batching, queuing, caching and saturation.
157
+
158
+ ## Observability
159
+
160
+ Ask:
161
+ - Which metric detects the user-visible problem?
162
+ - Which signal distinguishes application, datastore and dependency latency?
163
+ - Where should trace spans exist?
164
+ - What identifiers correlate logs/events/requests?
165
+ - Which queue/saturation metrics matter?
166
+ - What SLO/error budget expresses the requirement?
167
+ - What cannot currently be diagnosed from available telemetry?
168
+
169
+ ## Security
170
+
171
+ Map trust boundaries and ask:
172
+ - Where are authentication and authorization enforced?
173
+ - Where does PII/sensitive data flow?
174
+ - How are secrets supplied without exposing values?
175
+ - Can requests/messages be replayed?
176
+ - What abuse/rate-limit controls are justified?
177
+ - Which components should not be publicly reachable?
178
+ - What changes under multi-tenant or data-residency requirements?
179
+
180
+ Missing evidence is a question first, not automatic proof of a vulnerability.
181
+
182
+ ## Deployment and operations
183
+
184
+ - Explain commit → CI → artifact → environment → running process/container.
185
+ - Identify health/readiness checks.
186
+ - Explain rollout and rollback strategy.
187
+ - Identify failure domains and scaling units.
188
+ - Explore regional deployment and recovery requirements.
189
+ - Ask what configuration is deployment-specific and how secrets differ from configuration.
190
+ - Separate merge from deployment authorization.
191
+
192
+ ## Testing and verification
193
+
194
+ - Map tests to components/contracts.
195
+ - Decide where unit/integration/contract/e2e tests provide useful confidence.
196
+ - Identify failure paths that require more than unit tests.
197
+ - Design a test for duplicate messaging, dependency timeout, rollout compatibility, or migration compatibility.
198
+ - Ask which architecture risks are currently untested.
199
+
200
+ Do not infer behavioral coverage from filenames alone.
201
+
202
+ ## Incident/debug drills
203
+
204
+ Begin with a symptom, then reveal evidence gradually.
205
+
206
+ Examples:
207
+ - checkout p95 rises from 250 ms to 3 s;
208
+ - error rate is stable but queue lag climbs;
209
+ - database CPU is normal while request timeouts rise;
210
+ - one region reports stale reads;
211
+ - duplicate notifications appear after retries.
212
+
213
+ Make the learner choose the next evidence source and explain what each observation rules in/out.
214
+
215
+ ## Architecture evolution
216
+
217
+ Start from the current/simple system. Add complexity only in response to changed requirements/evidence.
218
+
219
+ Explore:
220
+
221
+ ```text
222
+ monolith → horizontally scaled app
223
+ DB-only reads → justified cache
224
+ synchronous task → background job/queue
225
+ single DB → replicas/partitioning
226
+ single region → multi-region
227
+ shared module → extracted subsystem/service
228
+ ```
229
+
230
+ For every step ask:
231
+
232
+ ```text
233
+ What problem forces this change?
234
+ What evidence supports it?
235
+ What does it improve?
236
+ What complexity/failure modes does it add?
237
+ How would we migrate safely?
238
+ When should we NOT do it?
239
+ ```
240
+
241
+ ## Counterfactual and "why not?" drills
242
+
243
+ - What if Redis disappeared?
244
+ - What if this request became asynchronous?
245
+ - What if the queue were removed?
246
+ - What if everything stayed in the relational database?
247
+ - Why not keep a modular monolith?
248
+ - Why not Kafka?
249
+ - Why not retry here?
250
+ - Why not shard now?
251
+ - Why not cache everything?
252
+ - Why not make this strongly consistent?
253
+
254
+ The goal is to defend appropriate simplicity, not maximize the number of technologies.
255
+
256
+ ## Work-item change drills
257
+
258
+ After a delivered ticket, use `/system-lab changes <work-item>` when relevant.
259
+
260
+ Ask:
261
+ - Which components were touched?
262
+ - Which runtime/data/event paths may be affected?
263
+ - What new or changed failure modes deserve attention?
264
+ - Did security, observability, performance or test obligations change?
265
+ - Which claim is confirmed versus inferred?
266
+ - What architecture decision could now be defended in an interview?
267
+
268
+ Use `/db-lab changes <work-item>` for database-specific consequences.
269
+
270
+ ## Interview mode
271
+
272
+ Use a familiar project domain but change requirements enough that the learner cannot simply copy the repository.
273
+
274
+ Drive:
275
+
276
+ ```text
277
+ requirements
278
+ → scale assumptions
279
+ → API/contracts
280
+ → data/storage
281
+ → high-level architecture
282
+ → deep dive
283
+ → bottleneck/failure
284
+ → consistency/reliability
285
+ → security/observability
286
+ → evolution
287
+ → tradeoff defense
288
+ ```
289
+
290
+ Then perturb one constraint:
291
+ - traffic becomes 20x;
292
+ - multi-region required;
293
+ - data residency imposed;
294
+ - third party unreliable;
295
+ - p99 under 200 ms;
296
+ - zero-downtime schema evolution required;
297
+ - messages may duplicate;
298
+ - cost must materially fall;
299
+ - abuse threat increases.
300
+
301
+ Assess independent competencies, explanation quality, credibility and adaptability rather than one generic system-design score.
@@ -33,7 +33,25 @@ For a structured walkthrough of an implementation change set, use `/code-walkthr
33
33
 
34
34
  Use `/coach` for broader or ad-hoc concept learning. Use `/learning-review` when the primary goal is to assess whether the developer can explain and defend what was built.
35
35
 
36
- For hands-on database learning, `/db-lab` is the evidence-backed companion to Coach. Coach can teach database concepts, probe gaps, and run interview drills; Database Lab inspects the actual project schema/ORM/query/migration/query-plan evidence and can drive query-to-ERD highlighting when an interactive workbench is installed. See `DATABASE_LEARNING_WORKBENCH.md` for quick-start commands and examples.
36
+ For hands-on database learning, `/db-lab` is the evidence-backed companion to Coach. Coach can teach database concepts, probe gaps, and run interview drills; Database Lab inspects the current project schema/ORM/query/migration/query-plan evidence, supports change-focused learning, and can drive query-to-ERD highlighting when an interactive workbench is installed. See `DATABASE_LEARNING_WORKBENCH.md`.
37
+
38
+ For hands-on system-design learning, `/system-lab` is the evidence-backed companion to Coach. Coach can teach architecture/distributed-systems concepts, challenge assumptions, and run interview drills; System Lab inspects the current project architecture/runtime/API/dependency/messaging/deployment evidence and supports interactive scenario, failure, capacity, latency, security, observability, testing, evolution, and change-focused learning. See `SYSTEM_DESIGN_LEARNING_WORKBENCH.md`.
39
+
40
+ Use the labs as siblings:
41
+
42
+ ```text
43
+ system context / request-event flow / failure / scale
44
+ ↕
45
+ /system-lab
46
+ ↕
47
+ database component/node
48
+ ↕
49
+ /db-lab
50
+ ↕
51
+ schema / ORM / SQL / plans / migrations / constraints
52
+ ```
53
+
54
+ Generated lab views are disposable projections of current evidence. Invoking a lab means re-discover the current evidence; the learner should not manually maintain or refresh diagrams.
37
55
 
38
56
  ## Levels
39
57
 
@@ -51,9 +69,24 @@ A useful optional sequence after stable implementation is:
51
69
  ```text
52
70
  code walkthrough
53
71
  → learning review
54
- → targeted coaching / database lab as needed
72
+ → targeted coaching / database lab / system lab as needed
55
73
  ```
56
74
 
75
+ After delivery, relevant labs may be surfaced again while the work-item change is fresh. The reminder is visible but never mandatory.
76
+
77
+ For advanced DB/System learning, prefer prediction before reveal when practical:
78
+
79
+ ```text
80
+ learner predicts
81
+ → reveal evidence
82
+ → reconcile gap
83
+ → apply/debug
84
+ → defend tradeoff
85
+ → change constraint
86
+ ```
87
+
88
+ Explanation-first remains valid when requested.
89
+
57
90
  None of those learning activities is an engineering delivery gate.
58
91
 
59
92
  Once a coaching mode starts, continue automatically until stop or natural completion. Use the actual repository as the curriculum whenever possible. Learning trackers/resources remain optional.