@mriekki/lean 0.4.1 → 0.4.3
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 +3 -3
- package/assets/core/distribution.json +3 -0
- package/assets/generated/ASSEMBLY.json +24 -9
- package/assets/generated/core/core/learning/ENGINEERING_LEARNING_WORKBOOK.md +4 -1
- package/assets/generated/core/core/learning/LEARNING_MAP.md +22 -0
- package/assets/generated/core/core/learning/SQL_DRILLS.md +80 -17
- package/assets/generated/core/core/process/COACHING_GUIDE.md +3 -1
- package/assets/generated/core/core/process/DATABASE_LEARNING_WORKBENCH.md +346 -0
- package/assets/generated/core/core/skills/coach/SKILL.md +12 -1
- package/assets/generated/core/core/skills/db-lab/SKILL.md +202 -0
- package/assets/generated/core/tools/db_lab/sqlite_workbench.py +463 -0
- package/assets/generated/deployment/src/lean_poc_deployment/registry_access.py +2 -0
- package/package.json +1 -1
|
@@ -64,6 +64,8 @@ Use installed learning assets when present; do not assume they exist.
|
|
|
64
64
|
|
|
65
65
|
For a structured walkthrough of implementation changes across a Git/PR/commit change set, prefer `/code-walkthrough`. Coach remains available for ad-hoc explanation of a file, symbol, concept, design choice, or selected code block.
|
|
66
66
|
|
|
67
|
+
For database learning, use `/coach` for concept teaching, adaptive questioning, gap assessment, and interview pressure. When the task needs concrete repository/database evidence — schema exploration, ORM-to-SQL tracing, query plans, migrations, database debugging, or query-to-ERD highlighting — route to `/db-lab` when that skill is installed.
|
|
68
|
+
|
|
67
69
|
## 5. Continuous adaptive cadence
|
|
68
70
|
|
|
69
71
|
```text
|
|
@@ -108,9 +110,18 @@ Do not reveal the solution immediately.
|
|
|
108
110
|
SQL/database:
|
|
109
111
|
|
|
110
112
|
```text
|
|
111
|
-
schema/query problem
|
|
113
|
+
requirements/schema/query problem
|
|
114
|
+
→ human models or writes SQL
|
|
115
|
+
→ correctness
|
|
116
|
+
→ edge cases/invariants
|
|
117
|
+
→ access patterns + indexing/query plan
|
|
118
|
+
→ transactions/concurrency when relevant
|
|
119
|
+
→ ORM translation when useful
|
|
120
|
+
→ design/interview defense
|
|
112
121
|
```
|
|
113
122
|
|
|
123
|
+
Treat relational modeling, constraints, normalization, querying, indexes/plans, transactions, ORM translation, migrations, debugging, and design defense as separate competencies rather than one SQL score. Prefer `/db-lab` for hands-on evidence.
|
|
124
|
+
|
|
114
125
|
System design: start from the actual repository, ask one question at a time, and make the human drive the design.
|
|
115
126
|
|
|
116
127
|
Interview drill: critique correctness, depth, credibility, structure, concision, overstatement, and missed follow-ups.
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
---
|
|
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]"
|
|
5
|
+
user-invocable: true
|
|
6
|
+
disable-model-invocation: true
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Database Lab
|
|
10
|
+
|
|
11
|
+
`/db-lab` is an optional hands-on database learning surface. It complements `/coach`; it does not replace the engineering workflow or authorize implementation changes.
|
|
12
|
+
|
|
13
|
+
For detailed usage and examples, read `docs/process/DATABASE_LEARNING_WORKBENCH.md` in a greenfield consumer (or the canonical `core/process/DATABASE_LEARNING_WORKBENCH.md`).
|
|
14
|
+
|
|
15
|
+
## 1. Boundaries
|
|
16
|
+
|
|
17
|
+
- Start from the actual repository and its documented development/test database configuration.
|
|
18
|
+
- Prefer read-only inspection. Do not mutate application data, apply migrations, add/drop indexes, or change production code while in Database Lab mode.
|
|
19
|
+
- Never inspect Production credentials or Production data.
|
|
20
|
+
- Do not invent schema, SQL, query-plan behavior, ORM translation, or index usage. Distinguish inferred behavior from captured evidence.
|
|
21
|
+
- 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 allowed only as disposable local output from read-only evidence; do not commit them unless the human explicitly asks for a durable artifact.
|
|
23
|
+
- Discovered implementation defects return to the normal engineering workflow; do not silently fix them here.
|
|
24
|
+
- Learning is optional and never blocks delivery.
|
|
25
|
+
|
|
26
|
+
## 2. Database competencies
|
|
27
|
+
|
|
28
|
+
Use the common L1-L6 learning levels across independent database areas:
|
|
29
|
+
|
|
30
|
+
```text
|
|
31
|
+
relational modeling
|
|
32
|
+
keys + integrity constraints
|
|
33
|
+
normalization + data anomalies
|
|
34
|
+
SQL query construction
|
|
35
|
+
indexes + access patterns
|
|
36
|
+
query plans + performance reasoning
|
|
37
|
+
transactions + concurrency
|
|
38
|
+
ORM translation + abstraction leaks
|
|
39
|
+
schema evolution + migrations
|
|
40
|
+
database debugging
|
|
41
|
+
design defense + interview communication
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Do not collapse these into one generic "SQL level". A developer may be strong in query syntax and weak in relational design, indexing, transactions, or ORM translation.
|
|
45
|
+
|
|
46
|
+
## 3. Schema mode
|
|
47
|
+
|
|
48
|
+
Build an evidence-backed view from the best available sources:
|
|
49
|
+
|
|
50
|
+
```text
|
|
51
|
+
physical database metadata
|
|
52
|
+
ORM model/configuration
|
|
53
|
+
migration history
|
|
54
|
+
schema SQL / DDL
|
|
55
|
+
project architecture and requirements
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Show tables/entities, columns, types, nullability, primary keys, foreign keys, unique/check constraints, indexes, relationship cardinality, cascade behavior, and relevant ORM mappings when evidence exists.
|
|
59
|
+
|
|
60
|
+
When useful, distinguish:
|
|
61
|
+
|
|
62
|
+
```text
|
|
63
|
+
DOMAIN MODEL — what the application/domain expresses
|
|
64
|
+
ORM MODEL — what the ORM maps and tracks
|
|
65
|
+
PHYSICAL MODEL — what the relational database actually stores/enforces
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## 4. Query trace mode
|
|
69
|
+
|
|
70
|
+
Trace a real application query without guessing:
|
|
71
|
+
|
|
72
|
+
```text
|
|
73
|
+
application/ORM expression
|
|
74
|
+
→ ORM translation preview when available
|
|
75
|
+
→ actual executed SQL when captured
|
|
76
|
+
→ parameters
|
|
77
|
+
→ tables/relationships touched
|
|
78
|
+
→ query plan when available
|
|
79
|
+
→ indexes actually chosen by the planner
|
|
80
|
+
→ materialized/application result
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Keep translation preview and actual executed command distinct when the framework exposes both.
|
|
84
|
+
|
|
85
|
+
## 5. Query-to-ERD highlighting
|
|
86
|
+
|
|
87
|
+
When the distributed SQLite workbench or another compatible viewer is available, a selected query should drive a linked ERD view:
|
|
88
|
+
|
|
89
|
+
- highlight tables referenced by the SQL;
|
|
90
|
+
- highlight FK edges when both related tables participate in the selected query;
|
|
91
|
+
- highlight qualified query columns when they can be resolved to a table;
|
|
92
|
+
- distinguish candidate indexes from indexes actually selected by the query planner;
|
|
93
|
+
- show query-plan evidence alongside the diagram;
|
|
94
|
+
- allow table/column/index selection for deeper explanation.
|
|
95
|
+
|
|
96
|
+
Never claim the planner used an index merely because it exists or looks relevant.
|
|
97
|
+
|
|
98
|
+
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
|
+
|
|
100
|
+
## 6. SQLite workbench
|
|
101
|
+
|
|
102
|
+
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
|
+
|
|
104
|
+
The tool:
|
|
105
|
+
|
|
106
|
+
- opens the SQLite database in `mode=ro`;
|
|
107
|
+
- introspects tables/views, columns, primary keys, foreign keys, indexes, and DDL;
|
|
108
|
+
- accepts optional captured-query JSON containing `name`, `sql`, and optional `parameters`;
|
|
109
|
+
- uses `EXPLAIN QUERY PLAN` only for `SELECT`/`WITH` queries;
|
|
110
|
+
- generates self-contained `index.html` plus `workbench.json` learning artifacts;
|
|
111
|
+
- supports interactive table/index inspection and query-to-ERD highlighting.
|
|
112
|
+
|
|
113
|
+
Generate output in an explicitly selected disposable/temp location. Do not write it into tracked project paths by default.
|
|
114
|
+
|
|
115
|
+
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
|
+
|
|
117
|
+
## 7. Query-plan/performance mode
|
|
118
|
+
|
|
119
|
+
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
|
+
|
|
121
|
+
```text
|
|
122
|
+
query/access pattern
|
|
123
|
+
→ developer prediction
|
|
124
|
+
→ plan evidence
|
|
125
|
+
→ explain scan/search/join behavior
|
|
126
|
+
→ developer proposes index/query change
|
|
127
|
+
→ predict changed plan
|
|
128
|
+
→ compare evidence in a safe sandbox when available
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
Do not teach "add an index" without connecting it to a concrete access pattern, selectivity/order needs, write cost, and plan evidence.
|
|
132
|
+
|
|
133
|
+
## 8. Debug mode
|
|
134
|
+
|
|
135
|
+
```text
|
|
136
|
+
symptom
|
|
137
|
+
→ database hypotheses
|
|
138
|
+
→ distinguishing evidence
|
|
139
|
+
→ SQL / parameters
|
|
140
|
+
→ plan / constraints / transaction state
|
|
141
|
+
→ root cause
|
|
142
|
+
→ fix concept
|
|
143
|
+
→ prevention
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
The human should diagnose before the lab reveals the answer unless they explicitly request explanation-first coaching.
|
|
147
|
+
|
|
148
|
+
## 9. Migration mode
|
|
149
|
+
|
|
150
|
+
Connect:
|
|
151
|
+
|
|
152
|
+
```text
|
|
153
|
+
ORM migration/change
|
|
154
|
+
↔ generated DDL/SQL when available
|
|
155
|
+
↔ schema before
|
|
156
|
+
↔ schema after
|
|
157
|
+
↔ data-safety implications
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
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
|
+
|
|
162
|
+
## 10. Interview/design mode
|
|
163
|
+
|
|
164
|
+
Use the active project domain as context, but perturb requirements so the developer must reason rather than reproduce the existing schema.
|
|
165
|
+
|
|
166
|
+
Drive one material question at a time through:
|
|
167
|
+
|
|
168
|
+
```text
|
|
169
|
+
requirements clarification
|
|
170
|
+
→ entities
|
|
171
|
+
→ relationships/cardinality
|
|
172
|
+
→ keys
|
|
173
|
+
→ constraints
|
|
174
|
+
→ normalization
|
|
175
|
+
→ access patterns
|
|
176
|
+
→ indexes
|
|
177
|
+
→ transactions/concurrency
|
|
178
|
+
→ evolution/scaling
|
|
179
|
+
→ design defense
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
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
|
+
|
|
184
|
+
## 11. ORM-specific evidence
|
|
185
|
+
|
|
186
|
+
When Entity Framework Core is present, distinguish:
|
|
187
|
+
|
|
188
|
+
- LINQ/application expression;
|
|
189
|
+
- translation preview such as `ToQueryString()` when appropriate;
|
|
190
|
+
- actual executed `DbCommand` from supported logging/interception evidence;
|
|
191
|
+
- generated migration SQL;
|
|
192
|
+
- entity/change-tracking state versus physical SQL operations.
|
|
193
|
+
|
|
194
|
+
Do not present a translation preview as proof of the exact command that executed.
|
|
195
|
+
|
|
196
|
+
For other ORMs, apply the same principle using framework-supported evidence instead of guessing.
|
|
197
|
+
|
|
198
|
+
## 12. Tooling
|
|
199
|
+
|
|
200
|
+
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
|
+
|
|
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.
|