thomas-agentkit 0.8.0 → 0.9.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,133 @@
1
+ # agentkit doctor (skill workflow)
2
+
3
+ Audit AgentKit guidance quality against the current repository context and `references/file-contract.md`. This workflow is read-only by default.
4
+
5
+ Use doctor when the user asks to audit, review, check, validate, diagnose, or inspect AgentKit guidance.
6
+
7
+ ## Preconditions
8
+
9
+ - Read `references/file-contract.md` before auditing.
10
+ - Read `agentkit.config.json` when present.
11
+ - Inspect repository facts before judging guidance quality.
12
+ - Do not edit files unless the user explicitly asks for fixes after the audit.
13
+
14
+ ## Non-negotiables
15
+
16
+ - Report findings before suggesting fixes.
17
+ - Do not modify guidance files by default.
18
+ - Do not modify application source files, lockfiles, package manifests, or CI config.
19
+ - Never invent missing scripts or assume commands exist.
20
+ - Treat malformed managed blocks as blocking issues for update/refresh on that file.
21
+
22
+ ## Procedure
23
+
24
+ ### 1. Build Repo Profile
25
+
26
+ Collect:
27
+
28
+ - Project name and description from `package.json`, README, or directory name
29
+ - Package manager from lockfiles
30
+ - Scripts from `package.json`
31
+ - Framework/runtime signals, such as Next.js, SvelteKit, Express, Convex, Vite, React, Node, TypeScript
32
+ - Source layout, such as `src/`, `app/`, `pages/`, `convex/`, `test/`, `docs/`
33
+ - Test, lint, build, typecheck, and dev tooling
34
+ - UI/design system signals
35
+ - Backend/data/auth signals
36
+ - Existing docs, workflow files, PR templates, and agent guidance files
37
+
38
+ Prefer repository facts over config personalization.
39
+
40
+ ### 2. Read AgentKit State
41
+
42
+ Inspect:
43
+
44
+ - `agentkit.config.json`
45
+ - `AGENTS.md`
46
+ - `STACK.md`
47
+ - companion guidance files
48
+ - AI tool adapters
49
+ - managed block markers in every AgentKit guidance file
50
+
51
+ Record:
52
+
53
+ - Files present
54
+ - Files missing for configured `templateSet`, `preset`, and `aiTools`
55
+ - Files with valid managed blocks
56
+ - Files without managed blocks
57
+ - Files with malformed managed blocks
58
+ - Companion references in `AGENTS.md`
59
+
60
+ ### 3. Audit Checks
61
+
62
+ Check for:
63
+
64
+ - Missing `AGENTS.md`
65
+ - Missing files required by configured `templateSet`
66
+ - Missing `STACK.md` when `preset` is configured or stack is confidently inferred
67
+ - Missing AI adapters required by `aiTools`
68
+ - Invalid or unknown config values
69
+ - `installMode: template` when the user expects a skill-path workflow
70
+ - Malformed managed block markers
71
+ - Unmanaged existing guidance files that cannot be safely updated
72
+ - Bracket placeholders left in AgentKit-managed content
73
+ - Commands that do not match `package.json` scripts or explicit config/user personalization
74
+ - Stale project name, description, source layout, stack, design, testing, security, or workflow guidance
75
+ - `AGENTS.md` references to missing companion files
76
+ - AI adapters that duplicate operating rules instead of pointing to `AGENTS.md`
77
+ - Generic guidance that ignores obvious repository facts
78
+
79
+ ### 4. Severity
80
+
81
+ Classify findings:
82
+
83
+ - `Critical`: Update/refresh is unsafe or blocked, such as malformed managed blocks, missing `AGENTS.md`, or destructive-risk instructions.
84
+ - `High`: Guidance is likely wrong in daily use, such as invalid commands, broken routing, missing required configured files, or adapter duplication.
85
+ - `Medium`: Guidance is incomplete or stale, such as outdated stack/design/test/workflow details or missing optional companions.
86
+ - `Low`: Polish issues, unclear assumptions, minor generic language, or non-blocking placeholders.
87
+
88
+ If there are no findings, report that AgentKit guidance looks healthy and mention any residual uncertainty.
89
+
90
+ ### 5. Recommended Next Action
91
+
92
+ Recommend one primary next action:
93
+
94
+ - `/agentkit init` when configured guidance files are missing.
95
+ - `/agentkit update` when managed guidance exists but facts are stale.
96
+ - `/agentkit repair` when malformed managed blocks block safe updates.
97
+ - Manual config edit when `agentkit.config.json` values are wrong.
98
+ - No action when guidance is healthy.
99
+
100
+ Do not perform the recommended action unless the user asks.
101
+
102
+ ### 6. Report Format
103
+
104
+ Use this concise format:
105
+
106
+ ```md
107
+ ## AgentKit Doctor
108
+
109
+ Status: Healthy | Needs attention | Blocked
110
+
111
+ Critical
112
+ - ...
113
+
114
+ High
115
+ - ...
116
+
117
+ Medium
118
+ - ...
119
+
120
+ Low
121
+ - ...
122
+
123
+ Recommended next action:
124
+ - ...
125
+
126
+ Checked:
127
+ - Config values used
128
+ - Stack and package manager inferred
129
+ - Commands inferred
130
+ - Files inspected
131
+ ```
132
+
133
+ Omit empty severity sections.
@@ -0,0 +1,163 @@
1
+ # AgentKit File Contract
2
+
3
+ Read this before creating, updating, auditing, or repairing any AgentKit-managed guidance file.
4
+
5
+ This contract is the shared rulebook for AgentKit guidance-edit workflows. Route files define procedure; this file defines the invariants every route must preserve.
6
+
7
+ ## Config
8
+
9
+ Read `agentkit.config.json` from the repository root when present:
10
+
11
+ | Field | Use |
12
+ | --- | --- |
13
+ | `installMode` | `"skill"` confirms a skill-path project; missing values are treated as template-path unless the user explicitly invokes the skill workflow |
14
+ | `agentkitVersion` | Package version at skill install; informational |
15
+ | `templateSet` | `minimal`, `standard`, or `full`; determines configured guidance inventory |
16
+ | `preset` | Stack preset (`next`, `sveltekit`, `express`, `convex`, `fullstack`) used for `STACK.md` |
17
+ | `aiTools` | Which thin adapter files to create (`codex`, `cursor`, `claude`, `copilot`) |
18
+ | `designSystem` | `linear` or `apple`; style lens for `DESIGN-SYSTEM.md` |
19
+ | `personalization` | Fallback defaults for project name, commands, and paths; repo facts win when available |
20
+
21
+ Prefer repository facts over config personalization. Use config values as defaults, not as a reason to ignore visible codebase reality.
22
+
23
+ ## Route Behavior
24
+
25
+ - `agentkit init`: create missing configured guidance files from repo context; skip existing files by default.
26
+ - `agentkit update`: refresh valid AgentKit managed blocks and create missing configured files; skip unmanaged files by default.
27
+ - `agentkit doctor`: audit guidance quality and report findings; do not edit by default.
28
+ - `agentkit learn`: teach recent codebase changes; do not edit or create files by default.
29
+ - Refresh, conversion, repair, or wholesale regeneration requires an explicit user request.
30
+
31
+ ## File Inventory
32
+
33
+ ### Template sets
34
+
35
+ `minimal`:
36
+
37
+ - `AGENTS.md`
38
+
39
+ `standard`:
40
+
41
+ - `AGENTS.md`
42
+ - `CHANGE-EXPLANATION.md`
43
+ - `CODE-QUALITY.md`
44
+ - `DESIGN-SYSTEM.md`
45
+ - `.github/pull_request_template.md`
46
+
47
+ `full`:
48
+
49
+ - Everything in `standard`
50
+ - `TESTING.md`
51
+ - `SECURITY-CHECKLIST.md`
52
+ - `WORKFLOWS.md`
53
+ - `PRD-TEMPLATE.md`
54
+ - `IMPLEMENTATION-BRIEF-TEMPLATE.md`
55
+
56
+ ### AI tool adapters
57
+
58
+ Adapters are additive and controlled by `aiTools` or explicit user request. Do not create adapters for unselected tools just because `templateSet` is `full`.
59
+
60
+ | Tool | File |
61
+ | --- | --- |
62
+ | `codex` | Uses `AGENTS.md` directly; no adapter file |
63
+ | `cursor` | `.cursor/rules/agentkit.md` |
64
+ | `claude` | `CLAUDE.md` |
65
+ | `copilot` | `.github/copilot-instructions.md` |
66
+
67
+ Adapters are thin pointers to `AGENTS.md`. Do not duplicate operating rules.
68
+
69
+ ### Stack guidance
70
+
71
+ Create or update `STACK.md` when:
72
+
73
+ - `preset` is set in config
74
+ - the user explicitly asks for stack guidance
75
+ - stack signals are strong enough to infer a preset confidently
76
+
77
+ When `STACK.md` exists or will be created, `AGENTS.md` should tell agents to read `STACK.md` before stack-specific changes.
78
+
79
+ ## File Roles
80
+
81
+ - `AGENTS.md`: source-of-truth router; project purpose, project map, real commands, workflow expectations, companion-doc routing, safety rules, and before-finishing checklist.
82
+ - `STACK.md`: stack-specific guidance based on repo facts and configured or inferred preset.
83
+ - `CHANGE-EXPLANATION.md`: handoff, summary, and change-explanation expectations.
84
+ - `CODE-QUALITY.md`: review, refactor, and maintainability guidance; reference commands from `AGENTS.md`.
85
+ - `DESIGN-SYSTEM.md`: UI/design guidance for detected or configured UI surfaces.
86
+ - `.github/pull_request_template.md`: concise PR checklist; do not over-personalize per-work-item templates.
87
+ - `TESTING.md`: detected test tools, test locations, and real test commands.
88
+ - `SECURITY-CHECKLIST.md`: project-relevant security boundaries such as auth, secrets, API inputs, and data access.
89
+ - `WORKFLOWS.md`: repo-specific planning, review, release, and development workflows.
90
+ - `PRD-TEMPLATE.md`: reusable product requirements template; do not fill with current work.
91
+ - `IMPLEMENTATION-BRIEF-TEMPLATE.md`: reusable implementation planning template; do not fill with current work.
92
+ - AI adapters: thin pointers to `AGENTS.md`.
93
+
94
+ ## Managed Blocks
95
+
96
+ AgentKit-owned content must be wrapped in paired markers:
97
+
98
+ ```html
99
+ <!-- agentkit:start <id> -->
100
+ Generated content
101
+ <!-- agentkit:end <id> -->
102
+ ```
103
+
104
+ Rules:
105
+
106
+ - Use stable ids, such as `agents`, `stack`, `design-system`, `testing`, or `security-checklist`.
107
+ - For new files, usually wrap the full AgentKit-generated body in one top-level managed block.
108
+ - Adapters can be fully managed because they should only point to `AGENTS.md`.
109
+ - Preserve all user edits before and after managed blocks.
110
+ - Replace only valid managed block content during update or refresh.
111
+ - Skip unmanaged existing files unless the user explicitly asks to convert them.
112
+ - Malformed managed block markers block edits to that file; defer and recommend repair.
113
+
114
+ ## Repository Inspection
115
+
116
+ Inspect before writing or auditing:
117
+
118
+ 1. `package.json` for name, description, and scripts
119
+ 2. Lockfiles for package manager
120
+ 3. Framework signals, such as `next.config.*`, `svelte.config.*`, `convex/`, `vite.config.*`, `app/`, or `pages/`
121
+ 4. Source layout, such as `src/`, `test/`, `tests/`, `docs/`, `.github/`
122
+ 5. Test runner and tooling config, such as Vitest, Jest, Playwright, ESLint, TypeScript, or build config
123
+ 6. UI/design signals, such as Tailwind config, CSS files, component folders, or design docs
124
+ 7. Backend/data/auth signals, such as API routes, schema files, auth packages, or server modules
125
+ 8. Existing guidance files and managed block markers
126
+
127
+ Prefer repo facts over config personalization when they conflict.
128
+
129
+ ## Placeholder And Command Rules
130
+
131
+ Replace bracket placeholders with real values from the repo or omit the placeholder-dependent section:
132
+
133
+ | Placeholder | Source |
134
+ | --- | --- |
135
+ | `[Project Name]` | `package.json` name or directory name |
136
+ | `[short project description]` | `package.json` description or README first paragraph |
137
+ | `[issue tracker, e.g. Linear or GitHub Issues]` | `personalization.issueTracker` or infer from `.github/` |
138
+ | `[design system path, e.g. docs/design-system.md]` | `personalization.designSystemPath`, existing design docs, or `DESIGN-SYSTEM.md` |
139
+ | `[briefs path, e.g. docs/briefs]` | `personalization.briefsPath`, existing docs path, or omit |
140
+ | Project commands | Real scripts from `package.json` or explicit user/config personalization |
141
+
142
+ Never invent scripts. If a command is not present and not explicitly provided, omit it or describe that it is not configured.
143
+
144
+ ## Healthy Guidance Criteria
145
+
146
+ AgentKit guidance is healthy when:
147
+
148
+ - Required files for the configured inventory exist or are intentionally deferred.
149
+ - `AGENTS.md` is present and acts as the router/source of truth.
150
+ - Managed block markers are paired and stable.
151
+ - Commands match `package.json` scripts or explicit user/config personalization.
152
+ - No `[Project Name]`-style placeholders remain in AgentKit-managed content.
153
+ - `AGENTS.md` references only companion files that exist or are being created.
154
+ - `STACK.md` exists when configured or confidently inferred, and `AGENTS.md` references it.
155
+ - AI adapters point to `AGENTS.md` and do not duplicate full operating rules.
156
+ - Generated guidance reflects visible repo facts instead of generic filler.
157
+
158
+ ## Edit Boundaries
159
+
160
+ - Do not modify application source code, lockfiles, package manifests, or CI config during AgentKit workflows.
161
+ - Do not delete user-written content outside managed blocks.
162
+ - Do not run `git commit`, `git push`, or destructive shell commands.
163
+ - Docs-only and learn workflows do not require running project test/build commands.
@@ -0,0 +1,212 @@
1
+ # agentkit init (skill workflow)
2
+
3
+ Create AgentKit guidance files from the current repository context. This workflow runs **inside the agent** after `agentkit skill install`; it is not the CLI `agentkit init` template installer.
4
+
5
+ The skill path is context-aware. Do not copy generic templates when repository facts are available. Use AgentKit's file contract as structure, then author guidance from the codebase in front of you.
6
+
7
+ ## Preconditions
8
+
9
+ - Read `references/file-contract.md` before editing any AgentKit-managed file.
10
+ - Prefer `agentkit.config.json` when present.
11
+ - If config is missing but the user explicitly requested `/agentkit init`, continue with safe defaults:
12
+ - `templateSet: standard`
13
+ - `aiTools: ["codex"]`
14
+ - infer `preset` from repository signals when obvious
15
+ - infer `designSystem` only when UI/design signals exist
16
+
17
+ ## Non-negotiables
18
+
19
+ - Create missing guidance files only by default.
20
+ - Skip existing files unless the user explicitly asks to refresh or regenerate them.
21
+ - Preserve user content outside AgentKit managed blocks.
22
+ - Never invent commands. Commands must come from `package.json` scripts or explicit user/config personalization.
23
+ - Replace all bracket placeholders with real values or omit the placeholder-dependent section.
24
+ - Do not modify application source files, lockfiles, or CI config during init.
25
+ - Keep `AGENTS.md` as the source-of-truth router; adapters stay thin pointers.
26
+
27
+ ## Procedure
28
+
29
+ ### 1. Build Repo Profile
30
+
31
+ Inspect the repository before choosing file content.
32
+
33
+ Collect:
34
+
35
+ - Project name and description from `package.json`, README, or directory name
36
+ - Package manager from lockfiles
37
+ - Scripts from `package.json`
38
+ - Framework/runtime signals, such as Next.js, SvelteKit, Express, Convex, Vite, React, Node, TypeScript
39
+ - Source layout, such as `src/`, `app/`, `pages/`, `convex/`, `test/`, `docs/`
40
+ - Test, lint, build, typecheck, and dev tooling
41
+ - UI/design system signals, such as Tailwind, CSS files, component folders, design docs
42
+ - Backend/data/auth signals, such as API routes, database/schema files, auth packages
43
+ - Existing docs, briefs, PR templates, workflow docs, or agent guidance files
44
+ - Issue tracker/workflow hints from `.github/`, Linear docs, or config personalization
45
+
46
+ Prefer repository facts over config personalization. Use config personalization only as fallback.
47
+
48
+ ### 2. Resolve AgentKit Config
49
+
50
+ Read `agentkit.config.json` when present.
51
+
52
+ Use:
53
+
54
+ - `installMode`
55
+ - `agentkitVersion`
56
+ - `templateSet`
57
+ - `preset`
58
+ - `aiTools`
59
+ - `designSystem`
60
+ - `personalization`
61
+
62
+ If values are missing:
63
+
64
+ - Default `templateSet` to `standard`
65
+ - Default `aiTools` to `["codex"]`
66
+ - Infer `preset` only when repo signals are strong
67
+ - Use `designSystem` only for standard/full installs or when UI guidance is clearly useful
68
+
69
+ Configs without `installMode` are treated as template-path installs, but if the user explicitly invoked this skill workflow, continue carefully and report the assumption.
70
+
71
+ ### 3. Decide File Inventory
72
+
73
+ Use `references/file-contract.md` as the source of truth.
74
+
75
+ Inventory rules:
76
+
77
+ - `minimal`
78
+ - `AGENTS.md`
79
+
80
+ - `standard`
81
+ - `AGENTS.md`
82
+ - `CHANGE-EXPLANATION.md`
83
+ - `CODE-QUALITY.md`
84
+ - `DESIGN-SYSTEM.md`
85
+ - `.github/pull_request_template.md`
86
+
87
+ - `full`
88
+ - everything in `standard`
89
+ - `TESTING.md`
90
+ - `SECURITY-CHECKLIST.md`
91
+ - `WORKFLOWS.md`
92
+ - `PRD-TEMPLATE.md`
93
+ - `IMPLEMENTATION-BRIEF-TEMPLATE.md`
94
+ - selected AI tool adapters
95
+
96
+ - `preset` set or confidently inferred
97
+ - add `STACK.md`
98
+
99
+ - `aiTools`
100
+ - `codex`: no adapter; uses `AGENTS.md`
101
+ - `cursor`: `.cursor/rules/agentkit.md`
102
+ - `claude`: `CLAUDE.md`
103
+ - `copilot`: `.github/copilot-instructions.md`
104
+
105
+ Before writing, briefly tell the user which missing files will be created and which existing files will be skipped.
106
+
107
+ ### 4. Author Missing Files
108
+
109
+ Create only files that do not already exist.
110
+
111
+ For each created file:
112
+
113
+ - Create parent directories if needed.
114
+ - Wrap AgentKit-owned content in managed block markers from `references/file-contract.md`.
115
+ - Use project-specific facts from the repo profile.
116
+ - Avoid generic filler.
117
+ - Keep guidance concise and operational.
118
+
119
+ File roles:
120
+
121
+ - `AGENTS.md`
122
+ - Primary router and source of truth
123
+ - Include project purpose, project map, real commands, workflow expectations, companion-doc routing, safety rules, and before-finishing checklist
124
+ - Reference `STACK.md` when created
125
+ - Reference companion files only when they exist or are part of this init
126
+
127
+ - `STACK.md`
128
+ - Stack-specific guidance based on repo facts and configured/inferred preset
129
+ - Include framework boundaries, source layout, validation points, and relevant checks
130
+ - Do not include generic framework advice that does not apply to the repo
131
+
132
+ - `CHANGE-EXPLANATION.md`
133
+ - Handoff and change-summary expectations
134
+ - Keep tied to this project's likely workflows and changed-file surfaces
135
+
136
+ - `CODE-QUALITY.md`
137
+ - Review, refactor, and maintainability guidance
138
+ - Reference real project commands from `AGENTS.md`
139
+ - Avoid duplicating large command tables
140
+
141
+ - `DESIGN-SYSTEM.md`
142
+ - Only include design guidance appropriate to the detected UI surface
143
+ - Use configured `designSystem` as a style lens
144
+ - Mention real component/style paths when visible
145
+
146
+ - `.github/pull_request_template.md`
147
+ - Keep concise and generally useful
148
+ - Do not over-personalize per-work-item templates
149
+
150
+ - `TESTING.md`
151
+ - Include detected test tools and where tests live
152
+ - Include real test commands only
153
+
154
+ - `SECURITY-CHECKLIST.md`
155
+ - Include project-relevant security boundaries such as auth, secrets, API inputs, and data access
156
+ - Avoid irrelevant compliance boilerplate
157
+
158
+ - `WORKFLOWS.md`
159
+ - Capture repo-specific development workflows, planning docs, release steps, or review flow when visible
160
+
161
+ - `PRD-TEMPLATE.md` and `IMPLEMENTATION-BRIEF-TEMPLATE.md`
162
+ - Keep as reusable work-item templates
163
+ - Do not fill them with current project facts beyond light path references
164
+
165
+ - AI adapters
166
+ - Keep thin
167
+ - Point to `AGENTS.md`
168
+ - Do not duplicate operating rules
169
+
170
+ ### 5. Existing Files And Refresh Requests
171
+
172
+ Default behavior:
173
+
174
+ - Skip existing guidance files.
175
+ - Report them as skipped.
176
+ - Do not edit managed blocks during normal init.
177
+
178
+ If the user explicitly asks to refresh or regenerate existing files:
179
+
180
+ - Preserve all content outside managed blocks.
181
+ - Replace only AgentKit managed blocks.
182
+ - Stop and recommend `agentkit doctor` or `agentkit repair` if managed block markers are malformed.
183
+ - Never overwrite unmanaged user-written files wholesale unless the user explicitly confirms the exact file.
184
+
185
+ ### 6. Verify
186
+
187
+ Before finishing, check:
188
+
189
+ - Every planned missing file was created or explicitly deferred with a reason.
190
+ - Existing files were not overwritten by default.
191
+ - Managed block markers are paired and use stable ids.
192
+ - No `[Project Name]`-style placeholders remain.
193
+ - Commands in guidance match `package.json` scripts or explicit config/user personalization.
194
+ - `AGENTS.md` references `STACK.md` only when `STACK.md` exists.
195
+ - AI adapters point to `AGENTS.md` and do not duplicate full guidance.
196
+ - No application source files, lockfiles, or CI files were modified.
197
+
198
+ Docs-only init does not require running the project's test/build commands.
199
+
200
+ ### 7. Report
201
+
202
+ Tell the user:
203
+
204
+ - Files created
205
+ - Files skipped because they already existed
206
+ - Stack and package manager inferred
207
+ - Commands inferred
208
+ - Config values used
209
+ - Assumptions made
210
+ - Any deferred files and why
211
+
212
+ Keep the report concise.
@@ -0,0 +1,149 @@
1
+ # agentkit learn (skill workflow)
2
+
3
+ Teach the user what changed in the codebase and help them build durable understanding after an implementation, bug fix, refactor, or agent session.
4
+
5
+ This workflow is read-only by default. Do not create Markdown notes, edit guidance files, or modify repo state unless the user explicitly asks.
6
+
7
+ ## Preconditions
8
+
9
+ - Inspect the change context before explaining.
10
+ - Prefer current repo facts, diffs, changed files, and test output over memory of the session.
11
+ - If there are no visible changes, ask which change, branch, commit, or files the user wants to learn.
12
+ - Do not run mutating commands, formatters, code generators, or file writes during learn.
13
+
14
+ ## Non-negotiables
15
+
16
+ - Teach incrementally; do not dump the whole explanation at once.
17
+ - Start by asking the user to restate their current understanding.
18
+ - Explain the problem before the solution.
19
+ - Cover why, what, and how: motivation, root cause, design choices, business logic, edge cases, validation, and impact.
20
+ - Use real code references and short snippets when useful.
21
+ - Keep the running learning checklist in the conversation, not in a file, unless the user explicitly asks for notes.
22
+ - Check understanding before moving to the next stage, but let the user skip ahead if they ask.
23
+
24
+ ## Procedure
25
+
26
+ ### 1. Build Change Context
27
+
28
+ Inspect the repository enough to teach accurately.
29
+
30
+ Use available context such as:
31
+
32
+ - `git status --short`
33
+ - `git diff --stat`
34
+ - `git diff`
35
+ - changed files relevant to the user's question
36
+ - recent commits only when the user asks about committed work or no working-tree diff exists
37
+ - test, build, or check output when relevant
38
+
39
+ Identify:
40
+
41
+ - What changed
42
+ - What problem the change addressed
43
+ - Why the problem existed
44
+ - What branches, cases, or constraints mattered
45
+ - What solution was chosen
46
+ - What tradeoffs were accepted
47
+ - What edge cases or risks remain
48
+ - What tests or checks validate the change
49
+ - What broader behavior, workflow, or maintenance impact exists
50
+
51
+ ### 2. Start With The User's Current Understanding
52
+
53
+ Before teaching, ask a short calibration question:
54
+
55
+ ```md
56
+ Before I explain, tell me your current read: what problem do you think we solved, and what changed?
57
+ ```
58
+
59
+ Use the answer to fill gaps instead of repeating what the user already understands.
60
+
61
+ If the user asks for a specific level, adapt to it:
62
+
63
+ - `ELI5`: plain language and analogies, minimal code
64
+ - `ELI14`: plain language plus simple technical terms
65
+ - `intern`: practical engineering detail, with code walkthroughs
66
+ - `engineer`: concise, precise, tradeoff-aware
67
+ - `expert`: focus on invariants, edge cases, and design alternatives
68
+
69
+ ### 3. Teach In Stages
70
+
71
+ Use this order:
72
+
73
+ 1. Problem
74
+ - What was wrong or missing
75
+ - Why it mattered
76
+ - Why it existed
77
+ - What branches or cases were involved
78
+
79
+ 2. Solution
80
+ - What changed
81
+ - Why this approach was chosen
82
+ - What alternatives were avoided
83
+ - What behavior is now explicit
84
+
85
+ 3. Code walkthrough
86
+ - Important files and functions
87
+ - How data or control flows through the changed code
88
+ - Business logic and edge cases
89
+ - Short snippets or file references where helpful
90
+
91
+ 4. Validation and impact
92
+ - Tests or checks that support the change
93
+ - What users or developers will notice
94
+ - What remains unchanged
95
+ - What follow-up work or risks remain
96
+
97
+ After each stage, ask the user to restate the key idea or answer a small check question before continuing.
98
+
99
+ ### 4. Maintain A Conversation Checklist
100
+
101
+ Keep a visible checklist in the conversation:
102
+
103
+ ```md
104
+ Learning checklist
105
+
106
+ - [ ] The original problem and why it existed
107
+ - [ ] The main solution and why this design was chosen
108
+ - [ ] The changed files and how code flows through them
109
+ - [ ] The business logic and edge cases
110
+ - [ ] The tests or checks that validate the behavior
111
+ - [ ] The broader impact and maintenance implications
112
+ ```
113
+
114
+ Mark items as understood only after the user demonstrates understanding or asks to move on.
115
+
116
+ ### 5. Use Code Well
117
+
118
+ When discussing code:
119
+
120
+ - Cite real files and line numbers when possible.
121
+ - Prefer short snippets over large pasted sections.
122
+ - Show before/after comparisons when they clarify the change.
123
+ - Trace one important value, branch, or request through the code when useful.
124
+ - Avoid overwhelming the user with every changed line.
125
+
126
+ ### 6. Mastery Checks
127
+
128
+ Use lightweight checks such as:
129
+
130
+ - "Can you explain why this bug happened in your own words?"
131
+ - "What would break if we removed this branch?"
132
+ - "Which file would you inspect first if this regressed?"
133
+ - "What edge case is this guard protecting?"
134
+ - "Why did this solution fit better than the simpler alternative?"
135
+
136
+ If the user struggles, explain again at a simpler level and ask a narrower question.
137
+
138
+ ### 7. Final Recap
139
+
140
+ End with a concise recap:
141
+
142
+ - What changed
143
+ - Why it changed
144
+ - How it works
145
+ - What validates it
146
+ - What to watch for
147
+ - What the user now understands
148
+
149
+ Do not create files unless explicitly requested.