@mriekki/lean 0.4.2 → 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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
3
  "package": "@mriekki/lean",
4
- "version": "0.4.2",
4
+ "version": "0.4.4",
5
5
  "defaultProfile": "greenfield-poc",
6
6
  "profiles": {
7
7
  "greenfield-poc": {
@@ -14,7 +14,7 @@
14
14
  "components": {
15
15
  "core": {
16
16
  "repository": "mriekki/lean-agentic-core",
17
- "commit": "7d6b6ce00d83063775d7491626fe6b253b9c51c8",
17
+ "commit": "c2d9538cdbb5ddb46527133fefae698e25a6e603",
18
18
  "version": "1.13.0",
19
19
  "distribution": "greenfield-workspace",
20
20
  "descriptor": "assets/core/distribution.json",
@@ -24,6 +24,8 @@
24
24
  {"source":"core/skills/deploy/SKILL.md","destination":".github/skills/deploy/SKILL.md"},
25
25
  {"source":"core/skills/tear-down/SKILL.md","destination":".github/skills/tear-down/SKILL.md"},
26
26
  {"source":"core/skills/coach/SKILL.md","destination":".github/skills/coach/SKILL.md"},
27
+ {"source":"core/skills/db-lab/SKILL.md","destination":".github/skills/db-lab/SKILL.md"},
28
+ {"source":"core/skills/system-lab/SKILL.md","destination":".github/skills/system-lab/SKILL.md"},
27
29
  {"source":"core/skills/code-walkthrough/SKILL.md","destination":".github/skills/code-walkthrough/SKILL.md"},
28
30
  {"source":"core/skills/learning-review/SKILL.md","destination":".github/skills/learning-review/SKILL.md"},
29
31
  {"source":"core/process/WORK_ITEM_MODEL.md","destination":"docs/process/WORK_ITEM_MODEL.md"},
@@ -33,6 +35,8 @@
33
35
  {"source":"core/process/GUIDED_NEXT_STEPS.md","destination":"docs/process/GUIDED_NEXT_STEPS.md"},
34
36
  {"source":"core/process/INTERACTIVE_SESSION_GUIDE.md","destination":"docs/process/INTERACTIVE_SESSION_GUIDE.md"},
35
37
  {"source":"core/process/COACHING_GUIDE.md","destination":"docs/process/COACHING_GUIDE.md"},
38
+ {"source":"core/process/DATABASE_LEARNING_WORKBENCH.md","destination":"docs/process/DATABASE_LEARNING_WORKBENCH.md"},
39
+ {"source":"core/process/SYSTEM_DESIGN_LEARNING_WORKBENCH.md","destination":"docs/process/SYSTEM_DESIGN_LEARNING_WORKBENCH.md"},
36
40
  {"source":"core/process/SETUP_ACCEPTANCE_CHECKLIST.md","destination":"docs/process/SETUP_ACCEPTANCE_CHECKLIST.md"},
37
41
  {"source":"core/templates/PULL_REQUEST_TEMPLATE.md","destination":".github/PULL_REQUEST_TEMPLATE.md"},
38
42
  {"source":"core/templates/PRODUCT_BRIEF_TEMPLATE.md","destination":"docs/templates/PRODUCT_BRIEF_TEMPLATE.md"},
@@ -46,6 +50,8 @@
46
50
  {"source":"core/learning/SYSTEM_DESIGN_DRILLS.md","destination":"learning/SYSTEM_DESIGN_DRILLS.md"},
47
51
  {"source":"core/learning/DIAGRAM_GUIDE.md","destination":"learning/DIAGRAM_GUIDE.md"},
48
52
  {"source":"core/learning/RESOURCE_CATALOG.md","destination":"learning/RESOURCE_CATALOG.md"},
53
+ {"source":"tools/db_lab/sqlite_workbench.py","destination":"tools/lean-db-lab/sqlite-workbench.py"},
54
+ {"source":"tools/system_lab/system_workbench.py","destination":"tools/lean-system-lab/system-workbench.py"},
49
55
  {"source":"tools/package/check_baseline.py","destination":"tools/lean-core/check-core-baseline.py"},
50
56
  {"source":"tools/package/check_upstream.py","destination":"tools/lean-core/check-core-upstream.py"}
51
57
  ]
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
3
  "package": "@mriekki/lean",
4
- "version": "0.4.2",
4
+ "version": "0.4.4",
5
5
  "components": {
6
6
  "core": {
7
7
  "repository": "mriekki/lean-agentic-core",
8
- "commit": "7d6b6ce00d83063775d7491626fe6b253b9c51c8",
8
+ "commit": "c2d9538cdbb5ddb46527133fefae698e25a6e603",
9
9
  "version": "1.13.0",
10
10
  "distribution": "greenfield-workspace",
11
11
  "files": [
@@ -62,12 +62,12 @@
62
62
  {
63
63
  "source": "core/skills/next-step/SKILL.md",
64
64
  "destination": ".github/skills/next-step/SKILL.md",
65
- "sha256": "6fb5275cc098f3124c85bb20ccf713affac23ebd5b96962558504936f2b891d4"
65
+ "sha256": "833b015a795dee2fa8eaefd8b7ea7dda42951390846cf3bc8c2c2eb2ea3451bf"
66
66
  },
67
67
  {
68
68
  "source": "core/skills/deliver/SKILL.md",
69
69
  "destination": ".github/skills/deliver/SKILL.md",
70
- "sha256": "2c97f86bedf4baf1fb287cdc7b509975bd556861e9739713db85f1c5ee87c6eb"
70
+ "sha256": "5fe9875fb32a1e63a181342556f975522bf3a1e29d399567d905c51a83fa2750"
71
71
  },
72
72
  {
73
73
  "source": "core/skills/cleanup-branches/SKILL.md",
@@ -117,7 +117,17 @@
117
117
  {
118
118
  "source": "core/skills/coach/SKILL.md",
119
119
  "destination": ".github/skills/coach/SKILL.md",
120
- "sha256": "123983c51bd2d9958d8a6593101dc57eb6e4974cc9678d17c434ac61d29e4378"
120
+ "sha256": "68c28d5b9a55eedbf4261d12f1cd06f86b905e973b7ed7973fa4c49cf5338091"
121
+ },
122
+ {
123
+ "source": "core/skills/db-lab/SKILL.md",
124
+ "destination": ".github/skills/db-lab/SKILL.md",
125
+ "sha256": "1ad8ec01411abcd576f9486a9a1aab83c844d27eaa8f70d1001676d2047e2c67"
126
+ },
127
+ {
128
+ "source": "core/skills/system-lab/SKILL.md",
129
+ "destination": ".github/skills/system-lab/SKILL.md",
130
+ "sha256": "1ec8c3f46cca6e2e72be1a85aae1adad0c32872e531d80baf12b1e49f2b780fc"
121
131
  },
122
132
  {
123
133
  "source": "core/skills/code-walkthrough/SKILL.md",
@@ -162,7 +172,17 @@
162
172
  {
163
173
  "source": "core/process/COACHING_GUIDE.md",
164
174
  "destination": "docs/process/COACHING_GUIDE.md",
165
- "sha256": "0ccadef39db53f85a5092cb4d1343ed3c1fe13291291afd33c59d5a60fd22905"
175
+ "sha256": "cf141525e71467b189b18283ba8616859c665bba632f92de80e94f2de2e8f7b4"
176
+ },
177
+ {
178
+ "source": "core/process/DATABASE_LEARNING_WORKBENCH.md",
179
+ "destination": "docs/process/DATABASE_LEARNING_WORKBENCH.md",
180
+ "sha256": "282566eca21d777614810d37403c0093efff4cee7f561874e5b0482ebd27d4fb"
181
+ },
182
+ {
183
+ "source": "core/process/SYSTEM_DESIGN_LEARNING_WORKBENCH.md",
184
+ "destination": "docs/process/SYSTEM_DESIGN_LEARNING_WORKBENCH.md",
185
+ "sha256": "eb0f613717d6bfdaecbb9d3a8ecb6323fa27331e429f5c5781c5c5a0289a8091"
166
186
  },
167
187
  {
168
188
  "source": "core/process/SETUP_ACCEPTANCE_CHECKLIST.md",
@@ -192,17 +212,17 @@
192
212
  {
193
213
  "source": "core/learning/ENGINEERING_LEARNING_WORKBOOK.md",
194
214
  "destination": "learning/ENGINEERING_LEARNING_WORKBOOK.md",
195
- "sha256": "fd9d6b3561c5d433be4a58ad2d8c74f30e2c831d7de6cd7296a1b3f8999c55da"
215
+ "sha256": "e065342b6a5fb8a5f39ec616c1f59b7417cf3cba4238d01b0fee6d23ba881af6"
196
216
  },
197
217
  {
198
218
  "source": "core/learning/LEARNING_MAP.md",
199
219
  "destination": "learning/LEARNING_MAP.md",
200
- "sha256": "48985521dd22213add526910ead486db2ca54e88533d49bd35cd6bcda5f92180"
220
+ "sha256": "c1e3b565b57fa0cced6a0a1abe66cbbe67c7cd4960ff9c0307564cf1e2c76470"
201
221
  },
202
222
  {
203
223
  "source": "core/learning/LEARNING_PROGRESS.md",
204
224
  "destination": "learning/LEARNING_PROGRESS.md",
205
- "sha256": "c47e5ff009a789046998d67dae1d67dfca8a7ada2f963362747faea0edb11e1e"
225
+ "sha256": "50a19d3d3c7da4c2082ab7f5832c1ed5f90b54495db6c4aced3cb3a07ad78f89"
206
226
  },
207
227
  {
208
228
  "source": "core/learning/CODING_DRILLS.md",
@@ -212,23 +232,33 @@
212
232
  {
213
233
  "source": "core/learning/SQL_DRILLS.md",
214
234
  "destination": "learning/SQL_DRILLS.md",
215
- "sha256": "22075d135afbee73aabb11a33077946a0444362ff3f678495386b0996da6a95c"
235
+ "sha256": "696b9c97d3c1bd7adc7be1a43dcd655056bbf55ab58bc7741c59225d52f8c239"
216
236
  },
217
237
  {
218
238
  "source": "core/learning/SYSTEM_DESIGN_DRILLS.md",
219
239
  "destination": "learning/SYSTEM_DESIGN_DRILLS.md",
220
- "sha256": "4d197fe4bf2f618dcc212db304fd18f450ed3955fdce4ac2722371ee52b12a58"
240
+ "sha256": "1fbcd5b0cebfb1fa0ba3051cb019ef110790190b06e034075a37109711963154"
221
241
  },
222
242
  {
223
243
  "source": "core/learning/DIAGRAM_GUIDE.md",
224
244
  "destination": "learning/DIAGRAM_GUIDE.md",
225
- "sha256": "c4626c30f3d0f8212b9a8b0d3e4f2ead4ff067bc4e015e801d8c35b00838e365"
245
+ "sha256": "a2c9a3475dca76f2192b0ad2250ae20731c6ab213204b364e2305e37bf867e84"
226
246
  },
227
247
  {
228
248
  "source": "core/learning/RESOURCE_CATALOG.md",
229
249
  "destination": "learning/RESOURCE_CATALOG.md",
230
250
  "sha256": "88fc894dd51da7280aabd3df439bcbda337f437ece43640d86dfc0842dd0f91e"
231
251
  },
252
+ {
253
+ "source": "tools/db_lab/sqlite_workbench.py",
254
+ "destination": "tools/lean-db-lab/sqlite-workbench.py",
255
+ "sha256": "a5bb99a3f67f88f00b99c10b2c0698710b6b2fa302becc6ff3435c4321cdd4d3"
256
+ },
257
+ {
258
+ "source": "tools/system_lab/system_workbench.py",
259
+ "destination": "tools/lean-system-lab/system-workbench.py",
260
+ "sha256": "25b507bacb05b938bee299bcb44a5476a6fc5ecb9143f5561773adc7ff987fcc"
261
+ },
232
262
  {
233
263
  "source": "tools/package/check_baseline.py",
234
264
  "destination": "tools/lean-core/check-core-baseline.py",
@@ -1,6 +1,12 @@
1
1
  # Diagram Guide
2
2
 
3
- Coach may use Mermaid diagrams in chat for:
3
+ Diagrams are learning views, not architecture authorities.
4
+
5
+ Use current repository/runtime/database evidence first. Generated diagrams are disposable projections and should normally be regenerated from current evidence when the relevant lab is invoked rather than manually maintained.
6
+
7
+ ## Lightweight diagrams
8
+
9
+ Coach may use ephemeral Mermaid/text diagrams in chat for:
4
10
 
5
11
  - architecture,
6
12
  - request flow,
@@ -9,11 +15,45 @@ Coach may use Mermaid diagrams in chat for:
9
15
  - ER/data relationships,
10
16
  - CI/CD,
11
17
  - deployment,
12
- - concurrency.
18
+ - concurrency,
19
+ - messaging timelines,
20
+ - failure propagation.
21
+
22
+ Only save them as durable project artifacts when explicitly requested.
23
+
24
+ ## Interactive diagrams
25
+
26
+ Prefer `/db-lab` when the learning question needs schema/query/index/ORM/plan evidence. Prefer `/system-lab` when it needs architecture/runtime/API/dependency/failure/scale/observability/security/deployment evidence.
27
+
28
+ Interactive views should support learning, not merely look attractive. Useful interactions include:
29
+
30
+ - select a scenario and highlight participating nodes/edges;
31
+ - click a component/table/dependency for evidence and responsibilities;
32
+ - show query/index/plan relationships;
33
+ - show work-item change overlays;
34
+ - show failure or scale perturbations;
35
+ - link system database nodes to `/db-lab` depth;
36
+ - distinguish current evidence from inferred topology.
37
+
38
+ ## Evidence provenance
39
+
40
+ Use explicit labels where ambiguity matters:
41
+
42
+ ```text
43
+ CONFIRMED BY CODE
44
+ CONFIRMED BY RUNTIME
45
+ DOCUMENTED INTENT
46
+ INFERRED
47
+ UNKNOWN
48
+ LEARNER ASSUMPTION
49
+ ```
50
+
51
+ A static dependency edge is not automatically proof that the call occurred at runtime. A generated ERD is not more authoritative than the physical database metadata from which it was generated.
52
+
53
+ ## Learning behavior
13
54
 
14
- Diagrams are ephemeral by default.
55
+ After a diagram, ask the developer to explain the relevant flow, state, failure path, boundary, scaling concern, or tradeoff.
15
56
 
16
- Only save them when explicitly requested.
57
+ For advanced exercises, ask the learner to predict a failure/plan/scale consequence before revealing the overlay when useful.
17
58
 
18
- After a diagram, ask the developer to explain the flow, failure path, boundary,
19
- and tradeoff.
59
+ Never require the human to "refresh" or "rebuild" a learning diagram as routine maintenance. Running the lab means inspect current evidence and create/show the current view.
@@ -12,10 +12,14 @@ Use the learning tools for different purposes:
12
12
  /code-walkthrough — instructional walkthrough of actual implementation changes
13
13
  /learning-review — assessment of whether the developer can explain and defend the implementation
14
14
  /coach — targeted concept learning, debugging practice, design discussion, drills, and deeper follow-up
15
+ /db-lab — evidence-backed database/schema/ORM/query-plan/change exploration and database interview practice
16
+ /system-lab — evidence-backed architecture/runtime/failure/scale/change exploration and system-design interview practice
15
17
  ```
16
18
 
17
19
  All learning activity is optional and never an engineering delivery gate.
18
20
 
21
+ For database usage examples, see `docs/process/DATABASE_LEARNING_WORKBENCH.md` in a greenfield consumer. For advanced system-design usage, see `docs/process/SYSTEM_DESIGN_LEARNING_WORKBENCH.md`.
22
+
19
23
  ## Preferred project-first sequence
20
24
 
21
25
  When an implementation is stable enough to study, a useful optional sequence is:
@@ -24,9 +28,11 @@ When an implementation is stable enough to study, a useful optional sequence is:
24
28
  implementation
25
29
  → /code-walkthrough
26
30
  → /learning-review
27
- → targeted /coach follow-up where gaps remain
31
+ → targeted /coach, /db-lab, or /system-lab where gaps remain
28
32
  ```
29
33
 
34
+ After successful delivery, the workflow may surface the relevant evidence labs again while the change is fresh. A work item that changed persistence may make `/db-lab changes <work-item>` especially useful; one that changed APIs, dependencies, messaging, runtime topology, security, observability, performance or failure behavior may make `/system-lab changes <work-item>` especially useful. These are recommendations, not gates.
35
+
30
36
  A code walkthrough should connect two views of every meaningful change:
31
37
 
32
38
  ```text
@@ -39,7 +45,26 @@ Which files, classes, functions, data structures, framework mechanisms, tests, a
39
45
 
40
46
  Then connect the files into an end-to-end flow such as request, data, state, event, persistence, UI, or operational behavior. Use the repository's actual architecture rather than forcing a generic sequence.
41
47
 
42
- During a walkthrough, deeper learning can branch into tracing, diagrams, debugging discussion, design tradeoffs, quizzes, or interview-style explanation. The walkthrough remains read-only; discovered implementation issues return to the normal engineering workflow rather than being silently fixed inside learning mode.
48
+ During a walkthrough, deeper learning can branch into tracing, interactive diagrams, debugging discussion, design tradeoffs, quizzes, capacity/failure reasoning, or interview-style explanation. The walkthrough and labs remain read-only; discovered implementation issues return to the normal engineering workflow rather than being silently fixed inside learning mode.
49
+
50
+ ## Advanced learning pattern
51
+
52
+ Evidence labs should favor active reasoning:
53
+
54
+ ```text
55
+ current evidence
56
+ → learner prediction/assumption
57
+ → reveal strongest available evidence
58
+ → explain discrepancy
59
+ → trace/apply/debug
60
+ → defend tradeoff
61
+ → change one constraint
62
+ → reason again
63
+ ```
64
+
65
+ Use explanation-first when the human asks for it. Do not turn every learning interaction into a quiz.
66
+
67
+ Generated workbench diagrams are disposable projections. The repository/database/runtime evidence remains authoritative, and invoking a lab should rebuild its view from current evidence automatically.
43
68
 
44
69
  ## Suggested practice loop
45
70
 
@@ -64,9 +89,10 @@ concept or changed code
64
89
  - CI/CD/deployment/operations,
65
90
  - security and data protection,
66
91
  - architecture/system design,
92
+ - capacity/performance/reliability,
67
93
  - coding/DSA interview patterns.
68
94
 
69
- Use `LEARNING_MAP.md` to choose a small number of high-value topics and the drill files for focused practice. Learning progress is optional and never an engineering gate.
95
+ Use `LEARNING_MAP.md` to choose a small number of high-value topics and the drill files for focused practice. Database and system-design depth should be tracked by independent competencies rather than one broad score. Learning progress is optional and never an engineering gate.
70
96
 
71
97
  ## Experience credibility
72
98
 
@@ -79,4 +105,4 @@ studied/practiced
79
105
  not yet understood
80
106
  ```
81
107
 
82
- A code walkthrough can help move AI-assisted implementation toward reviewed/understood code, but it does not by itself prove mastery or professional experience. Learning must not become a false claim of professional experience.
108
+ A code walkthrough or lab can help move AI-assisted implementation toward reviewed/understood code, but it does not by itself prove mastery or professional experience. Generated diagrams and completed exercises must not become false claims of professional experience.
@@ -28,6 +28,57 @@ L5 Defend / Design
28
28
  L6 Interview Ready
29
29
  ```
30
30
 
31
+ ## Database learning is multi-dimensional
32
+
33
+ Do not reduce database learning to one "SQL" level. When database depth matters, assess the relevant areas independently:
34
+
35
+ ```text
36
+ relational modeling
37
+ keys + integrity constraints
38
+ normalization + anomalies
39
+ SQL query construction
40
+ indexes + access patterns
41
+ query plans + performance reasoning
42
+ transactions + concurrency
43
+ ORM translation
44
+ schema evolution + migrations
45
+ database debugging
46
+ design defense / interview communication
47
+ ```
48
+
49
+ Use `/db-lab` for evidence-backed exploration of the current project's schema, queries, ORM translation, query plans, migrations, change impact, and query-to-ERD relationships. Invoking the lab means inspect current evidence; generated views are disposable rather than manually maintained diagrams. Use `/coach` for adaptive teaching and reinforcement.
50
+
51
+ ## System-design learning is multi-dimensional
52
+
53
+ Do not reduce system design to one generic architecture score. Assess the relevant areas independently:
54
+
55
+ ```text
56
+ requirements + scope framing
57
+ capacity estimation + workload modeling
58
+ API + contract design
59
+ service/module decomposition
60
+ data/storage selection
61
+ caching
62
+ messaging + asynchronous workflows
63
+ consistency + distributed coordination
64
+ scaling + partitioning
65
+ availability + fault tolerance
66
+ latency + performance
67
+ runtime/deployment topology
68
+ observability + SLO reasoning
69
+ security + abuse resistance
70
+ cost/complexity awareness
71
+ architecture evolution
72
+ incident/debug reasoning
73
+ testing/verification strategy
74
+ tradeoff defense
75
+ interview communication
76
+ ```
77
+
78
+ Use `/system-lab` for evidence-backed exploration of the current project's architecture, runtime/data/event flows, dependencies, failure behavior, capacity/performance, observability, security, messaging, deployment, testing, work-item architecture impact, evolution, and interview practice. Generated interactive diagrams are disposable projections of current evidence; they are not a second architecture authority and should be regenerated from current evidence when the lab is invoked.
79
+
80
+ Use `/coach system design` for conceptual teaching, adaptive questions, and transfer practice. Prefer prediction-before-reveal for plans, failures, scale changes, consistency situations, and design perturbations when that improves learning.
81
+
31
82
  ## How real-code learning maps to the levels
32
83
 
33
84
  A structured `/code-walkthrough` is especially useful for the first three levels:
@@ -46,6 +97,12 @@ L5 Defend / Design — explain choices, alternatives, tradeoffs, and architectur
46
97
  L6 Interview Ready — explain the implementation clearly under follow-up questioning
47
98
  ```
48
99
 
49
- Use `/learning-review` to assess understanding after a walkthrough. Use `/coach` for targeted reinforcement, practice, or deeper exploration. These activities are optional and do not affect engineering delivery state.
100
+ For database work, L4-L6 should include evidence-based reasoning about schema choices, constraints, access patterns, indexes/plans, transactions, ORM behavior, migration safety, and credible alternatives where relevant.
101
+
102
+ For system-design work, L4-L6 should include evidence-based reasoning about workload assumptions, boundaries, APIs/data flows, failure propagation, consistency, latency, scaling, reliability, observability, security, deployment, testing, cost/complexity, architecture evolution, and credible simpler alternatives.
103
+
104
+ A learner can be L5 in API design and L2 in distributed consistency, or strong in SQL construction and weak in indexing. Preserve that shape instead of averaging it away.
105
+
106
+ Use `/learning-review` to assess understanding after a walkthrough. Use `/coach` for targeted reinforcement, practice, or deeper exploration. Use `/db-lab` and `/system-lab` when concrete project evidence is the learning material. These activities are optional and do not affect engineering delivery state.
50
107
 
51
108
  Coach should recommend only a small number of next topics based on the actual repository/work item.
@@ -18,14 +18,22 @@ This file is optional and never an engineering gate.
18
18
 
19
19
  Record evidence only when the human explicitly chooses to update learning progress. Useful evidence can include:
20
20
 
21
- - completed `/code-walkthrough` of a real implementation change set,
22
- - explained the functional and technical purpose of important changed files,
23
- - traced a request/data/state/event path across the implementation,
24
- - explained a design choice and a credible alternative,
25
- - reasoned through a failure mode or debugging approach,
26
- - passed a `/learning-review` question at a demonstrated level,
21
+ - completed `/code-walkthrough` of a real implementation change set;
22
+ - explained the functional and technical purpose of important changed files;
23
+ - traced a request/data/state/event path across the implementation;
24
+ - explained a design choice and a credible alternative;
25
+ - reasoned through a failure mode or debugging approach;
26
+ - predicted then explained query-plan/index behavior using `/db-lab` evidence;
27
+ - explained schema/ORM/migration consequences from `/db-lab changes <work-item>`;
28
+ - traced an evidence-backed runtime/dependency path using `/system-lab`;
29
+ - predicted failure propagation, bottlenecks, consistency behavior, or latency consequences and reconciled the prediction with evidence;
30
+ - defended an architecture choice against a simpler credible alternative;
31
+ - adapted a design after an interview-style scale/reliability/security constraint changed;
32
+ - passed a `/learning-review` question at a demonstrated level;
27
33
  - completed a focused `/coach` exercise or drill.
28
34
 
29
- A walkthrough is evidence of review/understanding activity, not automatic proof of mastery. Record the demonstrated level conservatively.
35
+ For database and system-design depth, prefer recording the demonstrated competency rather than one broad level. For example, capacity estimation, distributed consistency, API design, relational modeling and query-plan reasoning can legitimately be at different levels.
36
+
37
+ A walkthrough, generated workbench, or completed lab invocation is evidence of learning/review activity, not automatic proof of mastery. Record demonstrated understanding conservatively.
30
38
 
31
39
  Do not update automatically.
@@ -1,27 +1,90 @@
1
- # SQL / Database Drills
1
+ # SQL / Database Learning and Drills
2
2
 
3
- Optional practice areas:
3
+ Use the actual repository and domain whenever possible. SQL syntax is only one database competency; do not let query fluency hide weak relational design, indexing, transaction, or ORM reasoning.
4
4
 
5
- - joins,
6
- - aggregates,
7
- - GROUP BY/HAVING,
8
- - pagination,
9
- - deterministic sorting,
10
- - indexes,
11
- - query plans,
12
- - constraints,
13
- - transactions,
14
- - concurrency,
15
- - N+1,
16
- - ORM translation.
5
+ For evidence-backed hands-on exploration use `/db-lab`. For adaptive explanation, questioning, and reinforcement use `/coach`.
17
6
 
18
- Preferred flow:
7
+ ## Competencies
8
+
9
+ Assess independently using the common L1-L6 learning levels:
10
+
11
+ - relational modeling and cardinality;
12
+ - primary/foreign/candidate keys and integrity constraints;
13
+ - normalization, anomalies, and deliberate denormalization;
14
+ - query construction: joins, aggregates, GROUP BY/HAVING, subqueries/CTEs, pagination, deterministic sorting;
15
+ - indexes and access-pattern reasoning;
16
+ - query-plan interpretation and performance diagnosis;
17
+ - transactions, isolation, concurrency, and failure behavior;
18
+ - ORM translation, N+1 behavior, tracking/materialization, and abstraction leaks;
19
+ - schema evolution and migration safety;
20
+ - database debugging;
21
+ - design defense and interview communication.
22
+
23
+ ## Query drill
19
24
 
20
25
  ```text
21
26
  problem
22
- → developer writes SQL
27
+ → developer writes/predicts SQL
23
28
  → correctness
24
29
  → edge cases
30
+ → access pattern
25
31
  → indexing/query-plan follow-up
26
- → ORM discussion
32
+ → ORM translation when useful
33
+ → interview-style defense when useful
34
+ ```
35
+
36
+ Do not reveal the complete query immediately unless the developer asks for explanation-first teaching.
37
+
38
+ ## Design drill
39
+
40
+ ```text
41
+ requirements
42
+ → entities
43
+ → relationships/cardinality
44
+ → keys
45
+ → constraints
46
+ → normalization
47
+ → expected queries
48
+ → indexes
49
+ → transactions/concurrency
50
+ → migration/evolution concerns
51
+ → defend tradeoffs
52
+ ```
53
+
54
+ Prefer practical anomaly questions over memorized normalization definitions.
55
+
56
+ ## Debugging drill
57
+
58
+ ```text
59
+ symptom
60
+ → hypotheses
61
+ → SQL + parameters
62
+ → plan / constraints / transaction evidence
63
+ → root cause
64
+ → fix concept
65
+ → prevention
27
66
  ```
67
+
68
+ Use provider-native plan evidence where available and distinguish candidate indexes from indexes actually selected by the planner.
69
+
70
+ ## ORM drill
71
+
72
+ Trace both directions:
73
+
74
+ ```text
75
+ ORM/LINQ expression → generated/captured SQL → plan → result materialization
76
+ SQL/schema constraint → ORM behavior/error → application-visible effect
77
+ ```
78
+
79
+ When a framework exposes both a translation preview and actual executed commands, keep them distinct.
80
+
81
+ ## Suggested interview prompts
82
+
83
+ - Model a many-to-many relationship that later needs attributes on the relationship itself.
84
+ - Explain where uniqueness, nullability, and referential-integrity rules should be enforced.
85
+ - Given three common queries, design only the indexes you can justify.
86
+ - Diagnose why a query performs a scan instead of the expected indexed search.
87
+ - Explain an N+1 problem and two credible fixes with tradeoffs.
88
+ - Design a safe migration from nullable to required data.
89
+ - Define a transaction boundary for a multi-table operation and discuss concurrency failure modes.
90
+ - Defend when a surrogate key is preferable to a natural/composite key and when it is not.