@ngxtm/devkit 3.4.1 → 3.5.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.
- package/package.json +1 -1
- package/skills/learn/SKILL.md +476 -0
package/package.json
CHANGED
|
@@ -0,0 +1,476 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: learn
|
|
3
|
+
description: Interactive step-by-step learning mode. Teaches concepts from basics to advanced while solving real problems. Auto-detects language, verifies code at each step, creates markdown tutorials. Triggers on "/learn [topic]". Features: concept explanation, incremental coding with auto-verify, user checkpoints, optional quiz, saves tutorial to .claude/learn/.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Learn Mode - Interactive Step-by-Step Learning
|
|
7
|
+
|
|
8
|
+
> **Version 1.0.0** | Learn by Doing | Verified at Every Step
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## Overview
|
|
13
|
+
|
|
14
|
+
Learn Mode helps you understand concepts deeply while solving real problems. Instead of just giving you code, it:
|
|
15
|
+
|
|
16
|
+
1. Explains concepts from basics to advanced
|
|
17
|
+
2. Guides you through implementation step-by-step
|
|
18
|
+
3. Verifies code actually works at each step
|
|
19
|
+
4. Saves everything to a markdown tutorial for future reference
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## Activation
|
|
24
|
+
|
|
25
|
+
User invokes with: `/learn "topic or problem to solve"`
|
|
26
|
+
|
|
27
|
+
Examples:
|
|
28
|
+
- `/learn "implement debounce function in TypeScript"`
|
|
29
|
+
- `/learn "add JWT authentication to Express API"`
|
|
30
|
+
- `/learn "create custom React hook for form validation"`
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## Execution Flow
|
|
35
|
+
|
|
36
|
+
### Phase 0: INIT - Setup & Context Gathering
|
|
37
|
+
|
|
38
|
+
**Actions:**
|
|
39
|
+
1. Create output directory if not exists: `.claude/learn/`
|
|
40
|
+
2. Generate filename: `YYYY-MM-DD-{topic-slug}.md`
|
|
41
|
+
3. Scan project for language detection:
|
|
42
|
+
- Check for config files: `tsconfig.json`, `package.json`, `go.mod`, `Cargo.toml`, `requirements.txt`, `pyproject.toml`, `pom.xml`, `composer.json`, `Gemfile`, etc.
|
|
43
|
+
- Identify primary language(s)
|
|
44
|
+
4. Set verify strategy based on detected language
|
|
45
|
+
5. Read relevant existing code for context
|
|
46
|
+
|
|
47
|
+
**Language Detection & Verify Strategy:**
|
|
48
|
+
|
|
49
|
+
| Language | Config Files | Verify Command |
|
|
50
|
+
|----------|--------------|----------------|
|
|
51
|
+
| TypeScript | `tsconfig.json`, `*.ts`, `*.tsx` | `npx tsc --noEmit` |
|
|
52
|
+
| JavaScript | `package.json`, `*.js`, `*.mjs` | `node --check <file>` |
|
|
53
|
+
| Python | `requirements.txt`, `pyproject.toml`, `*.py` | `python -m py_compile <file>` |
|
|
54
|
+
| Go | `go.mod`, `*.go` | `go build ./...` |
|
|
55
|
+
| Rust | `Cargo.toml`, `*.rs` | `cargo check` |
|
|
56
|
+
| Java | `pom.xml`, `build.gradle`, `*.java` | `javac <file>` or `./gradlew compileJava` |
|
|
57
|
+
| C# | `*.csproj`, `*.cs` | `dotnet build --no-restore` |
|
|
58
|
+
| PHP | `composer.json`, `*.php` | `php -l <file>` |
|
|
59
|
+
| Ruby | `Gemfile`, `*.rb` | `ruby -c <file>` |
|
|
60
|
+
| Shell | `*.sh`, `*.bash` | `bash -n <file>` |
|
|
61
|
+
| C/C++ | `Makefile`, `CMakeLists.txt`, `*.c`, `*.cpp` | `make` or `cmake --build .` |
|
|
62
|
+
|
|
63
|
+
**If multiple languages detected:** Ask user which one to use for this session.
|
|
64
|
+
**If no language detected:** Ask user to specify.
|
|
65
|
+
|
|
66
|
+
**Markdown Header (write to file):**
|
|
67
|
+
```markdown
|
|
68
|
+
# Learn: {Topic}
|
|
69
|
+
|
|
70
|
+
> Generated: {YYYY-MM-DD HH:MM}
|
|
71
|
+
> Language: {detected_language}
|
|
72
|
+
> Project: {project_name}
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
### Phase 1: CONCEPT - Knowledge Foundation
|
|
80
|
+
|
|
81
|
+
**Goal:** Explain the underlying concepts before writing any code.
|
|
82
|
+
|
|
83
|
+
**Actions:**
|
|
84
|
+
1. Break down the topic into fundamental concepts
|
|
85
|
+
2. Explain each concept clearly:
|
|
86
|
+
- What is it?
|
|
87
|
+
- Why does it exist? What problem does it solve?
|
|
88
|
+
- How does it work (high-level)?
|
|
89
|
+
- Real-world analogies if helpful
|
|
90
|
+
3. Compare with related concepts (if applicable)
|
|
91
|
+
- e.g., debounce vs throttle
|
|
92
|
+
- e.g., JWT vs session-based auth
|
|
93
|
+
4. Show simple diagrams using ASCII if helpful
|
|
94
|
+
|
|
95
|
+
**Write to markdown:**
|
|
96
|
+
```markdown
|
|
97
|
+
## 1. Concepts
|
|
98
|
+
|
|
99
|
+
### What is {topic}?
|
|
100
|
+
{explanation}
|
|
101
|
+
|
|
102
|
+
### Why use {topic}?
|
|
103
|
+
{use cases and benefits}
|
|
104
|
+
|
|
105
|
+
### How it works
|
|
106
|
+
{mechanism explanation}
|
|
107
|
+
|
|
108
|
+
### Related Concepts
|
|
109
|
+
| Concept A | Concept B |
|
|
110
|
+
|-----------|-----------|
|
|
111
|
+
| ... | ... |
|
|
112
|
+
|
|
113
|
+
---
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
**User Checkpoint:**
|
|
117
|
+
```
|
|
118
|
+
Phase 1/5: CONCEPT complete.
|
|
119
|
+
|
|
120
|
+
Do you understand these concepts?
|
|
121
|
+
[ ] Yes, continue to planning
|
|
122
|
+
[ ] Need more explanation (specify what)
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
**STOP and wait for user response before proceeding.**
|
|
126
|
+
|
|
127
|
+
---
|
|
128
|
+
|
|
129
|
+
### Phase 2: PLAN - Implementation Strategy
|
|
130
|
+
|
|
131
|
+
**Goal:** Create a clear, step-by-step implementation plan.
|
|
132
|
+
|
|
133
|
+
**Actions:**
|
|
134
|
+
1. Break implementation into small, verifiable steps (3-7 steps typically)
|
|
135
|
+
2. Each step should:
|
|
136
|
+
- Have a clear goal
|
|
137
|
+
- Be independently verifiable
|
|
138
|
+
- Build on previous steps
|
|
139
|
+
3. Identify files to create/modify
|
|
140
|
+
4. Note any dependencies needed
|
|
141
|
+
|
|
142
|
+
**Write to markdown:**
|
|
143
|
+
```markdown
|
|
144
|
+
## 2. Implementation Plan
|
|
145
|
+
|
|
146
|
+
### Files
|
|
147
|
+
- `{path/to/file1}` - {purpose}
|
|
148
|
+
- `{path/to/file2}` - {purpose}
|
|
149
|
+
|
|
150
|
+
### Steps
|
|
151
|
+
1. **{Step 1 title}** - {brief description}
|
|
152
|
+
2. **{Step 2 title}** - {brief description}
|
|
153
|
+
3. **{Step 3 title}** - {brief description}
|
|
154
|
+
...
|
|
155
|
+
|
|
156
|
+
### Dependencies
|
|
157
|
+
- {dependency 1} - {why needed}
|
|
158
|
+
- {dependency 2} - {why needed}
|
|
159
|
+
|
|
160
|
+
---
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
**User Checkpoint:**
|
|
164
|
+
```
|
|
165
|
+
Phase 2/5: PLAN complete.
|
|
166
|
+
|
|
167
|
+
Ready to start coding?
|
|
168
|
+
[ ] Yes, let's code
|
|
169
|
+
[ ] Modify plan (specify changes)
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
**STOP and wait for user response before proceeding.**
|
|
173
|
+
|
|
174
|
+
---
|
|
175
|
+
|
|
176
|
+
### Phase 3: CODE + VERIFY - Incremental Implementation
|
|
177
|
+
|
|
178
|
+
**Goal:** Implement each step, verify it works, ensure user understands.
|
|
179
|
+
|
|
180
|
+
**For each step in the plan:**
|
|
181
|
+
|
|
182
|
+
#### 3.1 Explain Before Coding
|
|
183
|
+
- What we're about to do
|
|
184
|
+
- Why we're doing it this way
|
|
185
|
+
- Key things to understand
|
|
186
|
+
|
|
187
|
+
#### 3.2 Write the Code
|
|
188
|
+
- Write complete, working code (no placeholders)
|
|
189
|
+
- Include all necessary imports
|
|
190
|
+
- Add inline comments explaining non-obvious parts
|
|
191
|
+
- Use Edit tool to modify existing files, Write for new files
|
|
192
|
+
|
|
193
|
+
#### 3.3 Auto-Verify
|
|
194
|
+
Run the appropriate verify command:
|
|
195
|
+
```bash
|
|
196
|
+
# Execute verify command based on language
|
|
197
|
+
{verify_command}
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
**If verify FAILS:**
|
|
201
|
+
1. Analyze the error
|
|
202
|
+
2. Explain what went wrong (teaching moment)
|
|
203
|
+
3. Fix the code
|
|
204
|
+
4. Re-verify
|
|
205
|
+
5. Repeat until pass
|
|
206
|
+
|
|
207
|
+
**If verify PASSES:** Continue to user checkpoint.
|
|
208
|
+
|
|
209
|
+
#### 3.4 Write to Markdown
|
|
210
|
+
```markdown
|
|
211
|
+
### Step {N}: {Title}
|
|
212
|
+
|
|
213
|
+
**Goal:** {what this step accomplishes}
|
|
214
|
+
|
|
215
|
+
**Why:** {explanation of approach}
|
|
216
|
+
|
|
217
|
+
**Code:**
|
|
218
|
+
```{language}
|
|
219
|
+
{code with comments}
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
**Key Points:**
|
|
223
|
+
- {important thing 1}
|
|
224
|
+
- {important thing 2}
|
|
225
|
+
|
|
226
|
+
**Verify:** {verify_command} - PASSED
|
|
227
|
+
|
|
228
|
+
---
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
#### 3.5 User Checkpoint
|
|
232
|
+
```
|
|
233
|
+
Step {N}/{total} complete and verified.
|
|
234
|
+
|
|
235
|
+
[ ] Understood, next step
|
|
236
|
+
[ ] Need more explanation
|
|
237
|
+
[ ] Code doesn't work on my machine (paste error)
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
**If user reports error:**
|
|
241
|
+
1. Ask for the error message
|
|
242
|
+
2. Debug and fix
|
|
243
|
+
3. Re-verify locally
|
|
244
|
+
4. Update the markdown with the fix
|
|
245
|
+
|
|
246
|
+
**STOP and wait for user response before next step.**
|
|
247
|
+
|
|
248
|
+
---
|
|
249
|
+
|
|
250
|
+
### Phase 4: SUMMARY - Knowledge Consolidation
|
|
251
|
+
|
|
252
|
+
**Goal:** Reinforce learning with summary and best practices.
|
|
253
|
+
|
|
254
|
+
**Actions:**
|
|
255
|
+
1. Summarize what was built
|
|
256
|
+
2. List key takeaways
|
|
257
|
+
3. Document common mistakes to avoid
|
|
258
|
+
4. Suggest next steps for deeper learning
|
|
259
|
+
|
|
260
|
+
**Write to markdown:**
|
|
261
|
+
```markdown
|
|
262
|
+
## 4. Summary
|
|
263
|
+
|
|
264
|
+
### What We Built
|
|
265
|
+
{summary of implementation}
|
|
266
|
+
|
|
267
|
+
### Key Takeaways
|
|
268
|
+
1. {takeaway 1}
|
|
269
|
+
2. {takeaway 2}
|
|
270
|
+
3. {takeaway 3}
|
|
271
|
+
|
|
272
|
+
### Common Mistakes to Avoid
|
|
273
|
+
- {mistake 1} - {why it's bad}
|
|
274
|
+
- {mistake 2} - {why it's bad}
|
|
275
|
+
|
|
276
|
+
### Next Steps
|
|
277
|
+
- {suggestion for further learning 1}
|
|
278
|
+
- {suggestion for further learning 2}
|
|
279
|
+
|
|
280
|
+
---
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
**User Checkpoint:**
|
|
284
|
+
```
|
|
285
|
+
Phase 4/5: SUMMARY complete.
|
|
286
|
+
|
|
287
|
+
Would you like to take a quiz to reinforce learning?
|
|
288
|
+
[ ] Yes, quiz me
|
|
289
|
+
[ ] No, finish up
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
---
|
|
293
|
+
|
|
294
|
+
### Phase 5: QUIZ (Optional)
|
|
295
|
+
|
|
296
|
+
**Goal:** Test understanding with practical questions.
|
|
297
|
+
|
|
298
|
+
**Only if user opted in.**
|
|
299
|
+
|
|
300
|
+
**Question Types:**
|
|
301
|
+
1. **Conceptual:** Test understanding of the "why"
|
|
302
|
+
2. **Code Reading:** Given code, predict behavior
|
|
303
|
+
3. **Code Writing:** Small exercise to implement variation
|
|
304
|
+
4. **Debugging:** Find the bug in given code
|
|
305
|
+
|
|
306
|
+
**Format:**
|
|
307
|
+
```
|
|
308
|
+
QUIZ MODE
|
|
309
|
+
|
|
310
|
+
Q1 (Conceptual): {question}
|
|
311
|
+
|
|
312
|
+
Your answer: [wait for user]
|
|
313
|
+
|
|
314
|
+
---
|
|
315
|
+
|
|
316
|
+
Correct answer: {answer}
|
|
317
|
+
Explanation: {why}
|
|
318
|
+
|
|
319
|
+
Score: {X}/4
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
**Write to markdown:**
|
|
323
|
+
```markdown
|
|
324
|
+
## 5. Quiz
|
|
325
|
+
|
|
326
|
+
<details>
|
|
327
|
+
<summary>Q1: {question}</summary>
|
|
328
|
+
|
|
329
|
+
**Answer:** {answer}
|
|
330
|
+
|
|
331
|
+
**Explanation:** {explanation}
|
|
332
|
+
</details>
|
|
333
|
+
|
|
334
|
+
<details>
|
|
335
|
+
<summary>Q2: {question}</summary>
|
|
336
|
+
...
|
|
337
|
+
</details>
|
|
338
|
+
|
|
339
|
+
---
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
---
|
|
343
|
+
|
|
344
|
+
### Phase 6: COMPLETE
|
|
345
|
+
|
|
346
|
+
**Actions:**
|
|
347
|
+
1. Finalize markdown file
|
|
348
|
+
2. Display completion message
|
|
349
|
+
|
|
350
|
+
**Add to markdown:**
|
|
351
|
+
```markdown
|
|
352
|
+
---
|
|
353
|
+
|
|
354
|
+
> Tutorial completed: {timestamp}
|
|
355
|
+
> Total steps: {N}
|
|
356
|
+
> All code verified and working
|
|
357
|
+
|
|
358
|
+
Happy coding!
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
**Display to user:**
|
|
362
|
+
```
|
|
363
|
+
LEARN MODE COMPLETE
|
|
364
|
+
|
|
365
|
+
Tutorial saved: .claude/learn/{filename}.md
|
|
366
|
+
You can review this file anytime to refresh your knowledge.
|
|
367
|
+
|
|
368
|
+
What you learned:
|
|
369
|
+
- {concept 1}
|
|
370
|
+
- {concept 2}
|
|
371
|
+
- {concept 3}
|
|
372
|
+
|
|
373
|
+
Great job!
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
---
|
|
377
|
+
|
|
378
|
+
## Error Handling
|
|
379
|
+
|
|
380
|
+
### Verify Command Not Available
|
|
381
|
+
If the verify command fails because tool is not installed:
|
|
382
|
+
1. Inform user: "Verify tool not available: {command}"
|
|
383
|
+
2. Ask: "Install it now, or proceed with manual verification?"
|
|
384
|
+
3. If install: run appropriate install command
|
|
385
|
+
4. If manual: ask user to confirm code works after each step
|
|
386
|
+
|
|
387
|
+
### User Reports Code Doesn't Work
|
|
388
|
+
1. Ask for exact error message
|
|
389
|
+
2. Ask for their environment (OS, versions)
|
|
390
|
+
3. Debug systematically
|
|
391
|
+
4. Update tutorial with fix
|
|
392
|
+
5. Add to "Common Issues" section in markdown
|
|
393
|
+
|
|
394
|
+
### Language Not Detected
|
|
395
|
+
1. List common languages
|
|
396
|
+
2. Ask user to specify
|
|
397
|
+
3. Set verify strategy accordingly
|
|
398
|
+
|
|
399
|
+
---
|
|
400
|
+
|
|
401
|
+
## Principles
|
|
402
|
+
|
|
403
|
+
1. **No code without understanding** - Always explain before implementing
|
|
404
|
+
2. **Verify everything** - Never assume code works, always test
|
|
405
|
+
3. **Fix before proceed** - Don't move on until current step works
|
|
406
|
+
4. **User controls pace** - Always checkpoint before next phase
|
|
407
|
+
5. **Document for future** - Create reusable tutorial
|
|
408
|
+
6. **Basics to advanced** - Start simple, build up complexity
|
|
409
|
+
7. **Real working code** - No pseudocode, no placeholders
|
|
410
|
+
|
|
411
|
+
---
|
|
412
|
+
|
|
413
|
+
## Example Session
|
|
414
|
+
|
|
415
|
+
```
|
|
416
|
+
User: /learn "implement debounce in TypeScript"
|
|
417
|
+
|
|
418
|
+
[INIT]
|
|
419
|
+
Detected: TypeScript (tsconfig.json found)
|
|
420
|
+
Verify command: npx tsc --noEmit
|
|
421
|
+
Creating: .claude/learn/2024-02-06-debounce-typescript.md
|
|
422
|
+
|
|
423
|
+
[CONCEPT]
|
|
424
|
+
Debounce is a technique that delays executing a function until
|
|
425
|
+
after a specified time has passed since the last call...
|
|
426
|
+
[detailed explanation]
|
|
427
|
+
|
|
428
|
+
Ready to continue? [Yes/Explain more]
|
|
429
|
+
|
|
430
|
+
User: Yes
|
|
431
|
+
|
|
432
|
+
[PLAN]
|
|
433
|
+
Step 1: Create utils/debounce.ts with basic structure
|
|
434
|
+
Step 2: Implement core debounce logic
|
|
435
|
+
Step 3: Add TypeScript generics for type safety
|
|
436
|
+
Step 4: Write unit tests
|
|
437
|
+
|
|
438
|
+
Ready to code? [Yes/Modify plan]
|
|
439
|
+
|
|
440
|
+
User: Yes
|
|
441
|
+
|
|
442
|
+
[CODE Step 1/4]
|
|
443
|
+
Creating utils/debounce.ts...
|
|
444
|
+
[code with explanation]
|
|
445
|
+
|
|
446
|
+
Verifying: npx tsc --noEmit
|
|
447
|
+
PASSED
|
|
448
|
+
|
|
449
|
+
Understood? [Yes/Explain more/Error on my machine]
|
|
450
|
+
|
|
451
|
+
User: Yes
|
|
452
|
+
|
|
453
|
+
[CODE Step 2/4]
|
|
454
|
+
...
|
|
455
|
+
|
|
456
|
+
[After all steps]
|
|
457
|
+
|
|
458
|
+
[SUMMARY]
|
|
459
|
+
Key takeaways:
|
|
460
|
+
1. Debounce delays execution until activity stops
|
|
461
|
+
2. clearTimeout prevents stale callbacks
|
|
462
|
+
3. Generics preserve function type signatures
|
|
463
|
+
|
|
464
|
+
Quiz? [Yes/No]
|
|
465
|
+
|
|
466
|
+
User: No
|
|
467
|
+
|
|
468
|
+
COMPLETE
|
|
469
|
+
Tutorial saved: .claude/learn/2024-02-06-debounce-typescript.md
|
|
470
|
+
```
|
|
471
|
+
|
|
472
|
+
---
|
|
473
|
+
|
|
474
|
+
## Version History
|
|
475
|
+
|
|
476
|
+
- **1.0.0** - Initial release with full interactive learning flow
|