@rfxlamia/skillkit 1.1.0 → 1.2.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/agents/agents/creative-copywriter.md +212 -0
- package/agents/agents/dario-amodei.md +135 -0
- package/agents/agents/doc-simplifier.md +63 -0
- package/agents/agents/kotlin-pro.md +433 -0
- package/agents/agents/red-team.md +136 -0
- package/agents/agents/sam-altman.md +121 -0
- package/agents/agents/seo-manager.md +184 -0
- package/package.json +1 -1
- package/skills/skillkit-help/SKILL.md +81 -0
- package/skills/skillkit-help/knowledge/application/09-case-studies.md +257 -0
- package/skills/skillkit-help/knowledge/application/12-testing-and-validation.md +276 -0
- package/skills/skillkit-help/knowledge/foundation/01-why-skills-exist.md +246 -0
- package/skills/skillkit-help/knowledge/foundation/02-skills-vs-subagents-comparison.md +312 -0
- package/skills/skillkit-help/knowledge/foundation/03-skills-vs-subagents-decision-tree.md +346 -0
- package/skills/skillkit-help/knowledge/foundation/06-platform-constraints.md +237 -0
- package/skills/skillkit-help/knowledge/foundation/08-when-not-to-use-skills.md +270 -0
- package/skills/skillkit-help/template/SKILL.md +52 -0
- package/skills/skills/adversarial-review/SKILL.md +219 -0
- package/skills/skills/baby-education/SKILL.md +260 -0
- package/skills/skills/baby-education/references/advanced-techniques.md +323 -0
- package/skills/skills/baby-education/references/transformations.md +345 -0
- package/skills/skills/been-there-done-that/SKILL.md +455 -0
- package/skills/skills/been-there-done-that/references/analysis-patterns.md +162 -0
- package/skills/skills/been-there-done-that/references/git-commands.md +132 -0
- package/skills/skills/been-there-done-that/references/tree-insertion-logic.md +145 -0
- package/skills/skills/coolhunter/SKILL.md +270 -0
- package/skills/skills/coolhunter/assets/elicitation-methods.csv +51 -0
- package/skills/skills/coolhunter/knowledge/elicitation-methods.md +312 -0
- package/skills/skills/coolhunter/references/workflow-execution.md +238 -0
- package/skills/skills/coolhunter/workflow-plan-coolhunter.md +232 -0
- package/skills/skills/creative-copywriting/SKILL.md +324 -0
- package/skills/skills/creative-copywriting/databases/README.md +60 -0
- package/skills/skills/creative-copywriting/databases/carousel-structures.csv +16 -0
- package/skills/skills/creative-copywriting/databases/emotional-arcs.csv +11 -0
- package/skills/skills/creative-copywriting/databases/hook-formulas.csv +51 -0
- package/skills/skills/creative-copywriting/databases/power-words.csv +201 -0
- package/skills/skills/creative-copywriting/databases/psychological-triggers.csv +21 -0
- package/skills/skills/creative-copywriting/databases/read-more-patterns.csv +26 -0
- package/skills/skills/creative-copywriting/databases/swipe-triggers.csv +31 -0
- package/skills/skills/creative-copywriting/references/carousel-psychology.md +223 -0
- package/skills/skills/creative-copywriting/references/hook-anatomy.md +169 -0
- package/skills/skills/creative-copywriting/references/power-word-science.md +134 -0
- package/skills/skills/creative-copywriting/references/storytelling-frameworks.md +157 -0
- package/skills/skills/diverse-content-gen/SKILL.md +201 -0
- package/skills/skills/diverse-content-gen/references/advanced-techniques.md +320 -0
- package/skills/skills/diverse-content-gen/references/research-findings.md +379 -0
- package/skills/skills/diverse-content-gen/references/task-workflows.md +241 -0
- package/skills/skills/diverse-content-gen/references/tool-integration.md +419 -0
- package/skills/skills/diverse-content-gen/references/troubleshooting.md +426 -0
- package/skills/skills/diverse-content-gen/references/vs-core-technique.md +240 -0
- package/skills/skills/framework-critical-thinking/SKILL.md +220 -0
- package/skills/skills/framework-critical-thinking/references/bias_detector.md +375 -0
- package/skills/skills/framework-critical-thinking/references/fallback_handler.md +239 -0
- package/skills/skills/framework-critical-thinking/references/memory_curator.md +161 -0
- package/skills/skills/framework-critical-thinking/references/metacognitive_monitor.md +297 -0
- package/skills/skills/framework-critical-thinking/references/producer_critic_orchestrator.md +333 -0
- package/skills/skills/framework-critical-thinking/references/reasoning_router.md +235 -0
- package/skills/skills/framework-critical-thinking/references/reasoning_validator.md +97 -0
- package/skills/skills/framework-critical-thinking/references/reflection_trigger.md +78 -0
- package/skills/skills/framework-critical-thinking/references/self_verification.md +388 -0
- package/skills/skills/framework-critical-thinking/references/uncertainty_quantifier.md +207 -0
- package/skills/skills/framework-initiative/SKILL.md +231 -0
- package/skills/skills/framework-initiative/references/examples.md +150 -0
- package/skills/skills/framework-initiative/references/impact-analysis.md +157 -0
- package/skills/skills/framework-initiative/references/intent-patterns.md +145 -0
- package/skills/skills/framework-initiative/references/star-framework.md +165 -0
- package/skills/skills/humanize-docs/SKILL.md +203 -0
- package/skills/skills/humanize-docs/references/advanced-techniques.md +13 -0
- package/skills/skills/humanize-docs/references/core-transformations.md +368 -0
- package/skills/skills/humanize-docs/references/detection-patterns.md +400 -0
- package/skills/skills/humanize-docs/references/examples-gallery.md +374 -0
- package/skills/skills/imagine/SKILL.md +190 -0
- package/skills/skills/imagine/references/artstyle-corporate-memphis.md +625 -0
- package/skills/skills/imagine/references/artstyle-crewdson-hyperrealism.md +295 -0
- package/skills/skills/imagine/references/artstyle-iphone-social-media.md +426 -0
- package/skills/skills/imagine/references/artstyle-sciencesaru.md +276 -0
- package/skills/skills/pre-deploy-checklist/README.md +26 -0
- package/skills/skills/pre-deploy-checklist/SKILL.md +153 -0
- package/skills/skills/pre-deploy-checklist/references/checklist-categories.md +174 -0
- package/skills/skills/pre-deploy-checklist/references/domain-prompts.md +216 -0
- package/skills/skills/prompt-engineering/SKILL.md +209 -0
- package/skills/skills/prompt-engineering/references/advanced-combinations.md +444 -0
- package/skills/skills/prompt-engineering/references/chain-of-thought.md +140 -0
- package/skills/skills/prompt-engineering/references/decision_matrix.md +220 -0
- package/skills/skills/prompt-engineering/references/few-shot.md +346 -0
- package/skills/skills/prompt-engineering/references/json-format.md +270 -0
- package/skills/skills/prompt-engineering/references/natural-language.md +420 -0
- package/skills/skills/prompt-engineering/references/pitfalls.md +365 -0
- package/skills/skills/prompt-engineering/references/prompt-chaining.md +498 -0
- package/skills/skills/prompt-engineering/references/react.md +108 -0
- package/skills/skills/prompt-engineering/references/self-consistency.md +322 -0
- package/skills/skills/prompt-engineering/references/tree-of-thoughts.md +386 -0
- package/skills/skills/prompt-engineering/references/xml-format.md +220 -0
- package/skills/skills/prompt-engineering/references/yaml-format.md +488 -0
- package/skills/skills/prompt-engineering/references/zero-shot.md +74 -0
- package/skills/skills/quick-spec/SKILL.md +280 -0
- package/skills/skills/quick-spec/assets/tech-spec-template.md +74 -0
- package/skills/skills/quick-spec/references/step-01-understand.md +189 -0
- package/skills/skills/quick-spec/references/step-02-investigate.md +144 -0
- package/skills/skills/quick-spec/references/step-03-generate.md +128 -0
- package/skills/skills/quick-spec/references/step-04-review.md +173 -0
- package/skills/skills/quick-spec/tests/__pycache__/test_skill.cpython-314-pytest-9.0.2.pyc +0 -0
- package/skills/skills/quick-spec/tests/test_scenarios.md +83 -0
- package/skills/skills/quick-spec/tests/test_skill.py +136 -0
- package/skills/skills/readme-expert/SKILL.md +538 -0
- package/skills/skills/readme-expert/knowledge/INDEX.md +192 -0
- package/skills/skills/readme-expert/knowledge/application/quality-standards.md +470 -0
- package/skills/skills/readme-expert/knowledge/application/script-executor.md +604 -0
- package/skills/skills/readme-expert/knowledge/application/template-library.md +822 -0
- package/skills/skills/readme-expert/knowledge/foundation/codebase-scanner.md +361 -0
- package/skills/skills/readme-expert/knowledge/foundation/validation-checklist.md +481 -0
- package/skills/skills/red-teaming/SKILL.md +321 -0
- package/skills/skills/red-teaming/references/ai-llm-redteam.md +517 -0
- package/skills/skills/red-teaming/references/attack-techniques.md +410 -0
- package/skills/skills/red-teaming/references/cybersecurity-redteam.md +383 -0
- package/skills/skills/red-teaming/references/tools-frameworks.md +446 -0
- package/skills/skills/releasing/.skillkit-mode +1 -0
- package/skills/skills/releasing/SKILL.md +225 -0
- package/skills/skills/releasing/references/version-detection.md +108 -0
- package/skills/skills/screenwriter/SKILL.md +273 -0
- package/skills/skills/screenwriter/references/advanced-techniques.md +216 -0
- package/skills/skills/screenwriter/references/pipeline-integration.md +266 -0
- package/skills/skills/skillkit/.claude/settings.local.json +7 -0
- package/skills/skills/skillkit/.claude-plugin/plugin.json +27 -0
- package/skills/skills/skillkit/CHANGELOG.md +484 -0
- package/skills/skills/skillkit/SKILL.md +511 -0
- package/skills/skills/skillkit/commands/skillkit.md +6 -0
- package/skills/skills/skillkit/commands/validate-plan.md +6 -0
- package/skills/skills/skillkit/commands/verify.md +6 -0
- package/skills/skills/skillkit/knowledge/INDEX.md +352 -0
- package/skills/skills/skillkit/knowledge/application/09-case-studies.md +257 -0
- package/skills/skills/skillkit/knowledge/application/10-technical-architecture.md +324 -0
- package/skills/skills/skillkit/knowledge/application/11-adoption-strategy.md +267 -0
- package/skills/skills/skillkit/knowledge/application/12-testing-and-validation.md +276 -0
- package/skills/skills/skillkit/knowledge/application/13-competitive-landscape.md +198 -0
- package/skills/skills/skillkit/knowledge/foundation/01-why-skills-exist.md +246 -0
- package/skills/skills/skillkit/knowledge/foundation/02-skills-vs-subagents-comparison.md +312 -0
- package/skills/skills/skillkit/knowledge/foundation/03-skills-vs-subagents-decision-tree.md +346 -0
- package/skills/skills/skillkit/knowledge/foundation/04-hybrid-patterns.md +308 -0
- package/skills/skills/skillkit/knowledge/foundation/05-token-economics.md +275 -0
- package/skills/skills/skillkit/knowledge/foundation/06-platform-constraints.md +237 -0
- package/skills/skills/skillkit/knowledge/foundation/07-security-concerns.md +322 -0
- package/skills/skills/skillkit/knowledge/foundation/08-when-not-to-use-skills.md +270 -0
- package/skills/skills/skillkit/knowledge/plugin-guide.md +614 -0
- package/skills/skills/skillkit/knowledge/tools/14-validation-tools-guide.md +150 -0
- package/skills/skills/skillkit/knowledge/tools/15-cost-tools-guide.md +157 -0
- package/skills/skills/skillkit/knowledge/tools/16-security-tools-guide.md +122 -0
- package/skills/skills/skillkit/knowledge/tools/17-pattern-tools-guide.md +161 -0
- package/skills/skills/skillkit/knowledge/tools/18-decision-helper-guide.md +243 -0
- package/skills/skills/skillkit/knowledge/tools/19-test-generator-guide.md +275 -0
- package/skills/skills/skillkit/knowledge/tools/20-split-skill-guide.md +149 -0
- package/skills/skills/skillkit/knowledge/tools/21-quality-scorer-guide.md +226 -0
- package/skills/skills/skillkit/knowledge/tools/22-migration-helper-guide.md +356 -0
- package/skills/skills/skillkit/knowledge/tools/23-subagent-creation-guide.md +448 -0
- package/skills/skills/skillkit/knowledge/tools/24-behavioral-testing-guide.md +122 -0
- package/skills/skills/skillkit/references/proposal-generation.md +982 -0
- package/skills/skills/skillkit/references/rationalization-catalog.md +75 -0
- package/skills/skills/skillkit/references/research-methodology.md +661 -0
- package/skills/skills/skillkit/references/section-2-full-creation-workflow.md +452 -0
- package/skills/skills/skillkit/references/section-3-validation-workflow-existing-skill.md +63 -0
- package/skills/skills/skillkit/references/section-4-decision-workflow-skills-vs-subagents.md +64 -0
- package/skills/skills/skillkit/references/section-5-migration-workflow-doc-to-skill.md +58 -0
- package/skills/skills/skillkit/references/section-6-subagent-creation-workflow.md +499 -0
- package/skills/skills/skillkit/references/section-7-knowledge-reference-map.md +72 -0
- package/skills/skills/skillkit/scripts/__pycache__/decision_helper.cpython-314.pyc +0 -0
- package/skills/skills/skillkit/scripts/__pycache__/quick_validate.cpython-312.pyc +0 -0
- package/skills/skills/skillkit/scripts/__pycache__/quick_validate.cpython-314.pyc +0 -0
- package/skills/skills/skillkit/scripts/__pycache__/test_generator.cpython-314-pytest-9.0.2.pyc +0 -0
- package/skills/skills/skillkit/scripts/decision_helper.py +799 -0
- package/skills/skills/skillkit/scripts/init_skill.py +400 -0
- package/skills/skills/skillkit/scripts/init_subagent.py +231 -0
- package/skills/skills/skillkit/scripts/migration_helper.py +669 -0
- package/skills/skills/skillkit/scripts/package_skill.py +211 -0
- package/skills/skills/skillkit/scripts/pattern_detector.py +381 -0
- package/skills/skills/skillkit/scripts/pattern_detector_new.py +382 -0
- package/skills/skills/skillkit/scripts/pressure_tester.py +157 -0
- package/skills/skills/skillkit/scripts/quality_scorer.py +999 -0
- package/skills/skills/skillkit/scripts/quick_validate.py +100 -0
- package/skills/skills/skillkit/scripts/security_scanner.py +474 -0
- package/skills/skills/skillkit/scripts/split_skill.py +540 -0
- package/skills/skills/skillkit/scripts/test_generator.py +695 -0
- package/skills/skills/skillkit/scripts/token_estimator.py +493 -0
- package/skills/skills/skillkit/scripts/utils/__init__.py +49 -0
- package/skills/skills/skillkit/scripts/utils/__pycache__/__init__.cpython-312.pyc +0 -0
- package/skills/skills/skillkit/scripts/utils/__pycache__/__init__.cpython-314.pyc +0 -0
- package/skills/skills/skillkit/scripts/utils/__pycache__/budget_tracker.cpython-312.pyc +0 -0
- package/skills/skills/skillkit/scripts/utils/__pycache__/budget_tracker.cpython-314.pyc +0 -0
- package/skills/skills/skillkit/scripts/utils/__pycache__/output_formatter.cpython-312.pyc +0 -0
- package/skills/skills/skillkit/scripts/utils/__pycache__/output_formatter.cpython-314.pyc +0 -0
- package/skills/skills/skillkit/scripts/utils/__pycache__/reference_validator.cpython-312.pyc +0 -0
- package/skills/skills/skillkit/scripts/utils/__pycache__/reference_validator.cpython-314.pyc +0 -0
- package/skills/skills/skillkit/scripts/utils/budget_tracker.py +388 -0
- package/skills/skills/skillkit/scripts/utils/output_formatter.py +263 -0
- package/skills/skills/skillkit/scripts/utils/reference_validator.py +401 -0
- package/skills/skills/skillkit/scripts/validate_skill.py +594 -0
- package/skills/skills/skillkit/tests/test_behavioral.py +39 -0
- package/skills/skills/skillkit/tests/test_scenarios.md +83 -0
- package/skills/skills/skillkit/tests/test_skill.py +136 -0
- package/skills/skills/skillkit-help/SKILL.md +81 -0
- package/skills/skills/skillkit-help/knowledge/application/09-case-studies.md +257 -0
- package/skills/skills/skillkit-help/knowledge/application/12-testing-and-validation.md +276 -0
- package/skills/skills/skillkit-help/knowledge/foundation/01-why-skills-exist.md +246 -0
- package/skills/skills/skillkit-help/knowledge/foundation/02-skills-vs-subagents-comparison.md +312 -0
- package/skills/skills/skillkit-help/knowledge/foundation/03-skills-vs-subagents-decision-tree.md +346 -0
- package/skills/skills/skillkit-help/knowledge/foundation/06-platform-constraints.md +237 -0
- package/skills/skills/skillkit-help/knowledge/foundation/08-when-not-to-use-skills.md +270 -0
- package/skills/skills/skillkit-help/template/SKILL.md +52 -0
- package/skills/skills/social-media-seo/SKILL.md +278 -0
- package/skills/skills/social-media-seo/databases/caption-styles.csv +31 -0
- package/skills/skills/social-media-seo/databases/engagement-tactics.csv +16 -0
- package/skills/skills/social-media-seo/databases/hashtag-strategies.csv +21 -0
- package/skills/skills/social-media-seo/databases/hook-formulas.csv +26 -0
- package/skills/skills/social-media-seo/databases/keyword-clusters.csv +11 -0
- package/skills/skills/social-media-seo/databases/thread-structures.csv +26 -0
- package/skills/skills/social-media-seo/databases/viral-patterns.csv +21 -0
- package/skills/skills/social-media-seo/references/analytics-guide.md +321 -0
- package/skills/skills/social-media-seo/references/instagram-seo.md +235 -0
- package/skills/skills/social-media-seo/references/threads-seo.md +305 -0
- package/skills/skills/social-media-seo/references/x-twitter-seo.md +337 -0
- package/skills/skills/social-media-seo/scripts/query_database.py +191 -0
- package/skills/skills/storyteller/SKILL.md +241 -0
- package/skills/skills/storyteller/references/transformation-methodology.md +293 -0
- package/skills/skills/storyteller/references/visual-vocabulary.md +177 -0
- package/skills/skills/thread-pro/SKILL.md +162 -0
- package/skills/skills/thread-pro/anti-ai-patterns.md +120 -0
- package/skills/skills/thread-pro/hook-formulas.md +138 -0
- package/skills/skills/thread-pro/references/anti-ai-patterns.md +120 -0
- package/skills/skills/thread-pro/references/hook-formulas.md +138 -0
- package/skills/skills/thread-pro/references/thread-structures.md +240 -0
- package/skills/skills/thread-pro/references/voice-injection.md +130 -0
- package/skills/skills/thread-pro/thread-structures.md +240 -0
- package/skills/skills/thread-pro/voice-injection.md +130 -0
- package/skills/skills/tinkering/SKILL.md +251 -0
- package/skills/skills/tinkering/references/graduation-checklist.md +100 -0
- package/skills/skills/validate-plan/.skillkit-mode +1 -0
- package/skills/skills/validate-plan/SKILL.md +406 -0
- package/skills/skills/validate-plan/references/dry-principles.md +251 -0
- package/skills/skills/validate-plan/references/gap-analysis-guide.md +320 -0
- package/skills/skills/validate-plan/references/tdd-patterns.md +413 -0
- package/skills/skills/validate-plan/references/yagni-checklist.md +330 -0
- package/skills/skills/verify-before-ship/.skillkit-mode +1 -0
- package/skills/skills/verify-before-ship/SKILL.md +116 -0
- package/skills/skills/verify-before-ship/references/anti-rationalization.md +212 -0
- package/skills/skills/verify-before-ship/references/verification-gates.md +305 -0
- package/skills-manifest.json +8 -2
- package/src/picker.js +11 -5
- package/src/picker.test.js +36 -1
|
@@ -0,0 +1,323 @@
|
|
|
1
|
+
# Advanced Techniques for Baby Education
|
|
2
|
+
|
|
3
|
+
## Visual Mental Models Deep Dive
|
|
4
|
+
|
|
5
|
+
### Technique 1: Layered Diagrams (Text-Based)
|
|
6
|
+
|
|
7
|
+
For complex systems, build diagrams incrementally using ASCII art or structured text:
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
Explaining: How does a web request work?
|
|
11
|
+
|
|
12
|
+
Layer 1 (Simplified):
|
|
13
|
+
You (Browser) → Internet → Server → Database
|
|
14
|
+
↓
|
|
15
|
+
Server sends back webpage
|
|
16
|
+
|
|
17
|
+
Layer 2 (Add Detail):
|
|
18
|
+
Browser Internet Cloud Server Farm
|
|
19
|
+
| | |
|
|
20
|
+
|--[HTTP Request]--->|---[Route to IP]----->|
|
|
21
|
+
| | |--[Query DB]
|
|
22
|
+
| | | ↓
|
|
23
|
+
|<--[HTML/CSS/JS]----| <-[Package Response]-|<-[Data]
|
|
24
|
+
|
|
25
|
+
Layer 3 (Technical):
|
|
26
|
+
Now map to real terms:
|
|
27
|
+
- "HTTP Request" = GET/POST with headers
|
|
28
|
+
- "Route to IP" = DNS lookup + TCP connection
|
|
29
|
+
- "Query DB" = SQL SELECT statement
|
|
30
|
+
- "Package Response" = JSON/HTML serialization
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### Technique 2: State Transition Stories
|
|
34
|
+
|
|
35
|
+
Explain state changes as a story progression:
|
|
36
|
+
|
|
37
|
+
```
|
|
38
|
+
Topic: React Component Lifecycle
|
|
39
|
+
|
|
40
|
+
Tell it like a day in someone's life:
|
|
41
|
+
|
|
42
|
+
1. Born (Constructor/Initial State)
|
|
43
|
+
"You wake up with your default settings - maybe grumpy, maybe energetic"
|
|
44
|
+
|
|
45
|
+
2. Getting Ready (componentDidMount)
|
|
46
|
+
"You check your phone, load today's schedule from the calendar"
|
|
47
|
+
|
|
48
|
+
3. Living (Render + Updates)
|
|
49
|
+
"Throughout the day, things happen that change your mood or plans"
|
|
50
|
+
"Each time something changes, you react and update what you're doing"
|
|
51
|
+
|
|
52
|
+
4. Going to Sleep (componentWillUnmount)
|
|
53
|
+
"Before bed, you clean up - close apps, set alarm, turn off lights"
|
|
54
|
+
|
|
55
|
+
Then map: "In React, your component does the same thing with data instead of daily tasks"
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Technique 3: Zoom In/Zoom Out Pattern
|
|
59
|
+
|
|
60
|
+
Start macro, then zoom to micro details:
|
|
61
|
+
|
|
62
|
+
```
|
|
63
|
+
Explaining: Database Indexing
|
|
64
|
+
|
|
65
|
+
Zoom Level 1 (Bird's Eye):
|
|
66
|
+
"A database index is like a book's table of contents - helps you find stuff faster"
|
|
67
|
+
|
|
68
|
+
Zoom Level 2 (Ground Level):
|
|
69
|
+
"Instead of reading every page to find 'Chapter on Dogs', you check the index:
|
|
70
|
+
Dogs............Page 47
|
|
71
|
+
Now jump directly there"
|
|
72
|
+
|
|
73
|
+
Zoom Level 3 (Microscope):
|
|
74
|
+
"Technically, it's a B-tree data structure that stores:
|
|
75
|
+
- Keys (sorted values you're searching for)
|
|
76
|
+
- Pointers (memory addresses to actual data rows)
|
|
77
|
+
|
|
78
|
+
Search time: O(log n) instead of O(n)"
|
|
79
|
+
|
|
80
|
+
Zoom Back Out:
|
|
81
|
+
"So when you query WHERE name='John', the database checks its 'index book' instead of scanning every row"
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Scaffolding Patterns for Complex Topics
|
|
85
|
+
|
|
86
|
+
### Pattern 1: Prerequisite Ladder
|
|
87
|
+
|
|
88
|
+
Build understanding step-by-step with explicit dependencies:
|
|
89
|
+
|
|
90
|
+
```
|
|
91
|
+
Topic: Understanding Promises in JavaScript
|
|
92
|
+
|
|
93
|
+
Rung 1: "First, understand callbacks"
|
|
94
|
+
→ "A callback is just passing a function to be called later"
|
|
95
|
+
→ Example: setTimeout(() => console.log("done"), 1000)
|
|
96
|
+
|
|
97
|
+
Rung 2: "Callbacks get messy (callback hell)"
|
|
98
|
+
→ Show nested callbacks example
|
|
99
|
+
→ "This becomes unreadable fast"
|
|
100
|
+
|
|
101
|
+
Rung 3: "Promises solve this by chaining"
|
|
102
|
+
→ Same logic, but with .then() instead of nesting
|
|
103
|
+
→ "Much cleaner to read"
|
|
104
|
+
|
|
105
|
+
Rung 4: "async/await makes it even better"
|
|
106
|
+
→ "Now it looks like normal sequential code"
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### Pattern 2: Contrast with Known Concepts
|
|
110
|
+
|
|
111
|
+
Use "You already know X, this is similar but..." framework:
|
|
112
|
+
|
|
113
|
+
```
|
|
114
|
+
"You know how Excel formulas work?
|
|
115
|
+
- You type =SUM(A1:A10)
|
|
116
|
+
- Excel calculates it
|
|
117
|
+
- The cell shows the result
|
|
118
|
+
- If A1 changes, result updates automatically
|
|
119
|
+
|
|
120
|
+
React hooks work the same way:
|
|
121
|
+
- You define a formula (function component)
|
|
122
|
+
- React calculates what to display
|
|
123
|
+
- The DOM shows the result
|
|
124
|
+
- If state changes, React recalculates and updates
|
|
125
|
+
|
|
126
|
+
The syntax looks different, but the concept is identical: automatic recalculation when inputs change"
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
## Handling Edge Cases
|
|
130
|
+
|
|
131
|
+
### Case 1: Topics That Don't Analogy Well
|
|
132
|
+
|
|
133
|
+
Some concepts (like monads, category theory) resist simple analogies.
|
|
134
|
+
|
|
135
|
+
**Strategy: Build from simple → abstract**
|
|
136
|
+
|
|
137
|
+
```
|
|
138
|
+
Don't say: "A monad is just a monoid in the category of endofunctors"
|
|
139
|
+
|
|
140
|
+
Instead:
|
|
141
|
+
1. Show concrete examples first:
|
|
142
|
+
- Maybe<T> handles null safely
|
|
143
|
+
- Array<T> handles multiple values
|
|
144
|
+
- Promise<T> handles async values
|
|
145
|
+
|
|
146
|
+
2. Notice the pattern:
|
|
147
|
+
"They all wrap a value and let you chain operations"
|
|
148
|
+
|
|
149
|
+
3. Optional: "That wrapping + chaining pattern is what makes it a monad"
|
|
150
|
+
(But don't insist on the term if it's not needed)
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
### Case 2: Balance Between Simplicity and Accuracy
|
|
154
|
+
|
|
155
|
+
Sometimes analogies break down. Address this explicitly:
|
|
156
|
+
|
|
157
|
+
```
|
|
158
|
+
"Earlier I said 'Git branches are like parallel universes.' That works for understanding the basics, but let me refine it:
|
|
159
|
+
|
|
160
|
+
More accurately, they're lightweight pointers to commits. All branches exist in the same universe (your .git folder), and you can see all of them simultaneously. The 'parallel universe' idea helps you understand isolation, but technically they're just different paths through the same commit graph.
|
|
161
|
+
|
|
162
|
+
For everyday use, think parallel universes. When debugging merge conflicts, remember it's one graph with multiple pointers."
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
### Case 3: Unavoidable Jargon
|
|
166
|
+
|
|
167
|
+
When technical terms must be used (e.g., in error messages):
|
|
168
|
+
|
|
169
|
+
**Three-Step Approach:**
|
|
170
|
+
1. Provide everyday version
|
|
171
|
+
2. Introduce technical term
|
|
172
|
+
3. Connect them
|
|
173
|
+
|
|
174
|
+
```
|
|
175
|
+
Error: "Segmentation fault (core dumped)"
|
|
176
|
+
|
|
177
|
+
1. Everyday: "Your program tried to access memory it's not allowed to touch - like trying to open your neighbor's mailbox"
|
|
178
|
+
|
|
179
|
+
2. Technical: "This is called a 'segmentation fault' or 'segfault'"
|
|
180
|
+
|
|
181
|
+
3. Connection: "The 'segments' are different areas of memory. Your program stepped into the wrong segment - hence 'segmentation' fault. 'Core dumped' means it saved a snapshot of memory for debugging"
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
## Different Audience Levels
|
|
185
|
+
|
|
186
|
+
### Complete Beginner (Zero Assumed Knowledge)
|
|
187
|
+
|
|
188
|
+
- Define EVERYTHING, even "obvious" terms
|
|
189
|
+
- Use analogies from daily life (cooking, driving, shopping)
|
|
190
|
+
- Avoid compound sentences with multiple concepts
|
|
191
|
+
- Check understanding every 2-3 concepts
|
|
192
|
+
|
|
193
|
+
**Example:**
|
|
194
|
+
```
|
|
195
|
+
"We'll install Node.js. Think of it like this: JavaScript normally runs in your browser (like Chrome or Firefox). Node.js lets JavaScript run directly on your computer, outside the browser. It's like taking a fish out of water and giving it a special tank - different environment, same fish."
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
### Some Background (Familiar with basics)
|
|
199
|
+
|
|
200
|
+
- Reference foundational concepts quickly
|
|
201
|
+
- Use programming-adjacent analogies (Excel formulas, Photoshop layers)
|
|
202
|
+
- Introduce multiple concepts per explanation
|
|
203
|
+
- Focus analogies on the NEW part
|
|
204
|
+
|
|
205
|
+
**Example:**
|
|
206
|
+
```
|
|
207
|
+
"You know how variables store values? Pointers are similar, but instead of storing the value itself, they store the address where the value lives in memory. Like a hotel room key card - the card isn't the room, it just points to where the room is."
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
### Struggling with Specific Concept (Mid-level learner)
|
|
211
|
+
|
|
212
|
+
- Don't restart from zero
|
|
213
|
+
- Pinpoint the conceptual gap
|
|
214
|
+
- Use precise analogies for that one concept
|
|
215
|
+
- Connect to what they already implemented
|
|
216
|
+
|
|
217
|
+
**Example:**
|
|
218
|
+
```
|
|
219
|
+
"I see you're confused about async/await vs .then() - you've used both, but not sure when to use which. They do the same thing, just different syntax:
|
|
220
|
+
|
|
221
|
+
.then() = explicit chaining (you see each step)
|
|
222
|
+
async/await = looks synchronous (hidden chaining)
|
|
223
|
+
|
|
224
|
+
Use .then() when: multiple parallel async operations
|
|
225
|
+
Use async/await when: sequential operations where you need the previous result
|
|
226
|
+
|
|
227
|
+
In your code on line 23, you need the user data before fetching their posts - perfect for async/await"
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
## Integration with Code Examples
|
|
231
|
+
|
|
232
|
+
### Technique: Annotated Code Stories
|
|
233
|
+
|
|
234
|
+
```javascript
|
|
235
|
+
// Story: We're building a shopping cart
|
|
236
|
+
|
|
237
|
+
// 1. Start with an empty cart (initial state)
|
|
238
|
+
let cart = [];
|
|
239
|
+
|
|
240
|
+
// 2. Customer adds an item (state update)
|
|
241
|
+
function addItem(item) {
|
|
242
|
+
// Like putting item in a real shopping cart
|
|
243
|
+
cart.push(item);
|
|
244
|
+
|
|
245
|
+
// Update the total (derived state)
|
|
246
|
+
updateTotal();
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
// 3. Calculate total (computed value)
|
|
250
|
+
function updateTotal() {
|
|
251
|
+
// Similar to cashier scanning items
|
|
252
|
+
const total = cart.reduce((sum, item) => sum + item.price, 0);
|
|
253
|
+
|
|
254
|
+
// Show it to customer (update UI)
|
|
255
|
+
displayTotal(total);
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
// The pattern: Action → State Change → UI Update
|
|
259
|
+
// React components work exactly like this shopping cart
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
### Technique: Before/After Debugging
|
|
263
|
+
|
|
264
|
+
```javascript
|
|
265
|
+
// ❌ Before (confusing for beginners)
|
|
266
|
+
const data = await fetch(url).then(r => r.json());
|
|
267
|
+
|
|
268
|
+
// ✅ After (step-by-step clarity)
|
|
269
|
+
// Step 1: Ask server for data (like ordering food)
|
|
270
|
+
const response = await fetch(url);
|
|
271
|
+
|
|
272
|
+
// Step 2: Unpack the response (like opening the delivery bag)
|
|
273
|
+
const data = await response.json();
|
|
274
|
+
|
|
275
|
+
// Why two steps? Because fetch gives you the "box" (response),
|
|
276
|
+
// .json() opens the box and gives you the actual "food" (data)
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
## Combining with Other Skills
|
|
280
|
+
|
|
281
|
+
### Baby Education + Code Review
|
|
282
|
+
|
|
283
|
+
When reviewing code for a beginner:
|
|
284
|
+
|
|
285
|
+
```
|
|
286
|
+
"Your code works, but let's make it more maintainable. See this part:
|
|
287
|
+
|
|
288
|
+
if (user && user.age && user.age > 18) { ... }
|
|
289
|
+
|
|
290
|
+
This is called 'defensive coding' - checking everything exists before using it. Good! But there's a cleaner pattern called 'optional chaining':
|
|
291
|
+
|
|
292
|
+
if (user?.age > 18) { ... }
|
|
293
|
+
|
|
294
|
+
The ?. means 'only keep going if the thing before exists.' Like a safety gate on stairs - only proceed if it's safe.
|
|
295
|
+
|
|
296
|
+
Both work, but ?. is easier to read once you know the pattern."
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
### Baby Education + Debugging
|
|
300
|
+
|
|
301
|
+
When helping fix an error:
|
|
302
|
+
|
|
303
|
+
```
|
|
304
|
+
"The error says 'Cannot find module'. Let's translate this:
|
|
305
|
+
|
|
306
|
+
Your code is like a recipe that says 'add the imported chocolate chips.' But when Node looks in your pantry (node_modules folder), there's no chocolate chips package.
|
|
307
|
+
|
|
308
|
+
Fix: npm install chocolate-chips
|
|
309
|
+
|
|
310
|
+
Technically: npm installs the module into node_modules, so when your code does 'import X from Y', Node can find Y in that folder."
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
## Quick Reference Patterns
|
|
314
|
+
|
|
315
|
+
| Situation | Pattern | Example |
|
|
316
|
+
|-----------|---------|---------|
|
|
317
|
+
| Abstract concept | Concrete analogy first | "Redux is like a bank vault - one central place for all your money (state)" |
|
|
318
|
+
| Multiple options | Comparison table | forEach vs map vs filter |
|
|
319
|
+
| Sequential process | Numbered steps with checkpoints | "First...then...finally" |
|
|
320
|
+
| Error explanation | 4-step: What/Why/Fix/Prevent | TypeError breakdown |
|
|
321
|
+
| Terminology | Sandwich: Analogy → Term → Connection | "Segmentation fault" explanation |
|
|
322
|
+
| Complex system | Zoom levels | Macro → Micro → Zoom out |
|
|
323
|
+
| State changes | Story progression | Component lifecycle as "day in life" |
|
|
@@ -0,0 +1,345 @@
|
|
|
1
|
+
# Transformation Examples: Before & After
|
|
2
|
+
|
|
3
|
+
> **Safety Note:** This file contains intentionally insecure code examples for educational purposes only. Examples marked with ❌ demonstrate bad practices that should NOT be used in production. All passwords, API keys, and secrets shown are fictional examples used to teach security concepts.
|
|
4
|
+
|
|
5
|
+
## Example 1: Explaining Docker
|
|
6
|
+
|
|
7
|
+
### ❌ Before (Technical-first)
|
|
8
|
+
|
|
9
|
+
"Docker is a containerization platform that uses OS-level virtualization to deliver software in packages called containers. Containers are isolated from one another and bundle their own software, libraries and configuration files, sharing the host OS kernel. This makes them more lightweight than traditional VMs."
|
|
10
|
+
|
|
11
|
+
**Problems:**
|
|
12
|
+
- Jargon overload (containerization, OS-level virtualization, kernel)
|
|
13
|
+
- No concrete reference point
|
|
14
|
+
- Abstract concepts without context
|
|
15
|
+
|
|
16
|
+
### ✅ After (Baby Education Style)
|
|
17
|
+
|
|
18
|
+
"Imagine shipping physical products:
|
|
19
|
+
|
|
20
|
+
**Without Docker (old way):**
|
|
21
|
+
You send a recipe to someone. They need to:
|
|
22
|
+
- Buy the exact ingredients you used
|
|
23
|
+
- Install the same cooking equipment
|
|
24
|
+
- Hope their kitchen setup matches yours
|
|
25
|
+
Result: 'It works on my machine' problem
|
|
26
|
+
|
|
27
|
+
**With Docker (new way):**
|
|
28
|
+
You send a fully-equipped food truck with:
|
|
29
|
+
- All ingredients already inside
|
|
30
|
+
- All cooking equipment installed
|
|
31
|
+
- Everything configured exactly as you set it up
|
|
32
|
+
Result: It works the same everywhere
|
|
33
|
+
|
|
34
|
+
That 'food truck' is a Docker container - a package with your code + everything it needs to run. The 'parking lot' where food trucks can operate is your computer (or server).
|
|
35
|
+
|
|
36
|
+
Technical terms:
|
|
37
|
+
- Container = food truck (isolated environment with everything inside)
|
|
38
|
+
- Image = blueprint for building the food truck
|
|
39
|
+
- Docker = the system that manages all the food trucks"
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## Example 2: Explaining API Rate Limiting
|
|
44
|
+
|
|
45
|
+
### ❌ Before (Technical-first)
|
|
46
|
+
|
|
47
|
+
"Rate limiting is implemented to prevent API abuse and ensure fair usage. The server tracks requests per client using tokens or sliding window algorithms, returning 429 Too Many Requests when the threshold is exceeded."
|
|
48
|
+
|
|
49
|
+
**Problems:**
|
|
50
|
+
- No context for WHY it exists
|
|
51
|
+
- Technical implementation details before concept
|
|
52
|
+
- Assumes knowledge of HTTP status codes
|
|
53
|
+
|
|
54
|
+
### ✅ After (Baby Education Style)
|
|
55
|
+
|
|
56
|
+
"You know how buffets have rules like 'one plate at a time'?
|
|
57
|
+
|
|
58
|
+
API rate limiting is the same concept:
|
|
59
|
+
|
|
60
|
+
**The Problem Without Limits:**
|
|
61
|
+
Imagine if one person could take 1000 plates simultaneously at a buffet. Nobody else gets food. The kitchen can't keep up. The buffet shuts down.
|
|
62
|
+
|
|
63
|
+
**The Solution (Rate Limiting):**
|
|
64
|
+
'You can get 100 items per hour, max 10 items per minute'
|
|
65
|
+
|
|
66
|
+
In API terms:
|
|
67
|
+
- You (client) request data from the buffet (API server)
|
|
68
|
+
- The server says 'Sure, but only 1000 requests per hour'
|
|
69
|
+
- If you exceed this, server says 'Slow down' (error code 429)
|
|
70
|
+
|
|
71
|
+
Why this matters for your code:
|
|
72
|
+
```javascript
|
|
73
|
+
// Bad: Rapid-fire requests (will get blocked)
|
|
74
|
+
for (let i = 0; i < 10000; i++) {
|
|
75
|
+
fetch('/api/data');
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// Good: Respect the limits with delays
|
|
79
|
+
async function fetchWithDelay() {
|
|
80
|
+
for (let i = 0; i < 10000; i++) {
|
|
81
|
+
await fetch('/api/data');
|
|
82
|
+
await sleep(100); // Wait 100ms between requests
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Real-world analogy: It's like waiting in line at a coffee shop instead of screaming your order 50 times at the barista."
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
## Example 3: Debugging `undefined is not a function`
|
|
92
|
+
|
|
93
|
+
### ❌ Before (Technical-first)
|
|
94
|
+
|
|
95
|
+
"This error occurs when you attempt to invoke a method on an undefined reference. Common causes include typos in method names, calling methods on objects that don't support them, or scope issues with 'this' binding."
|
|
96
|
+
|
|
97
|
+
**Problems:**
|
|
98
|
+
- Doesn't help beginner locate the actual issue
|
|
99
|
+
- Technical jargon (invoke, reference, scope, binding)
|
|
100
|
+
- No actionable debugging steps
|
|
101
|
+
|
|
102
|
+
### ✅ After (Baby Education Style)
|
|
103
|
+
|
|
104
|
+
**Error:** `TypeError: undefined is not a function`
|
|
105
|
+
|
|
106
|
+
**Translation:**
|
|
107
|
+
Your code tried to call something as if it were a function, but it's actually `undefined` (doesn't exist).
|
|
108
|
+
|
|
109
|
+
**Analogy:**
|
|
110
|
+
It's like yelling "Hey Siri!" to a lamp. You're treating the lamp like it can respond, but it's not a smart device - it doesn't have that function.
|
|
111
|
+
|
|
112
|
+
**Common Causes:**
|
|
113
|
+
|
|
114
|
+
**1. Typo in function name**
|
|
115
|
+
```javascript
|
|
116
|
+
// You wrote:
|
|
117
|
+
myArray.pus(item); // ❌ typo: 'pus' doesn't exist
|
|
118
|
+
|
|
119
|
+
// Should be:
|
|
120
|
+
myArray.push(item); // ✅
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
**2. Function doesn't exist yet**
|
|
124
|
+
```javascript
|
|
125
|
+
// Function is defined AFTER you call it:
|
|
126
|
+
greet(); // ❌ undefined at this point
|
|
127
|
+
function greet() { console.log("hi"); }
|
|
128
|
+
|
|
129
|
+
// Move definition before call:
|
|
130
|
+
function greet() { console.log("hi"); }
|
|
131
|
+
greet(); // ✅
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
**3. Wrong object type**
|
|
135
|
+
```javascript
|
|
136
|
+
let num = 42;
|
|
137
|
+
num.toUpperCase(); // ❌ numbers don't have toUpperCase
|
|
138
|
+
// (that's a string method)
|
|
139
|
+
|
|
140
|
+
let text = "42";
|
|
141
|
+
text.toUpperCase(); // ✅ works for strings
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
**How to Debug:**
|
|
145
|
+
1. Look at the line number in the error
|
|
146
|
+
2. Find what you're trying to call (ends with `()`)
|
|
147
|
+
3. Add `console.log()` before that line to check if it exists:
|
|
148
|
+
```javascript
|
|
149
|
+
console.log(typeof myFunction); // Should show "function"
|
|
150
|
+
myFunction(); // If it shows "undefined", that's your problem
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
**Prevention:**
|
|
154
|
+
Use your editor's autocomplete - if the function doesn't appear in autocomplete suggestions, it probably doesn't exist or has a typo."
|
|
155
|
+
|
|
156
|
+
---
|
|
157
|
+
|
|
158
|
+
## Example 4: Explaining `git merge` vs `git rebase`
|
|
159
|
+
|
|
160
|
+
### ❌ Before (Technical-first)
|
|
161
|
+
|
|
162
|
+
"Merge creates a merge commit that joins two branches, preserving history. Rebase rewrites commit history by replaying commits from one branch onto another, resulting in a linear history but altering commit SHAs."
|
|
163
|
+
|
|
164
|
+
**Problems:**
|
|
165
|
+
- Assumes understanding of "commit history" and "SHAs"
|
|
166
|
+
- Doesn't explain when to use each
|
|
167
|
+
- No visual component
|
|
168
|
+
|
|
169
|
+
### ✅ After (Baby Education Style)
|
|
170
|
+
|
|
171
|
+
**The Scenario:**
|
|
172
|
+
You and your friend are both editing the same story.
|
|
173
|
+
|
|
174
|
+
**git merge (keep both story paths):**
|
|
175
|
+
```
|
|
176
|
+
Your version: Friend's version:
|
|
177
|
+
Chapter 1 Chapter 1
|
|
178
|
+
Chapter 2 Chapter 2 (different)
|
|
179
|
+
Chapter 3 Chapter 3
|
|
180
|
+
|
|
181
|
+
After merge:
|
|
182
|
+
Chapter 1
|
|
183
|
+
Chapter 2 (yours)
|
|
184
|
+
Chapter 2 (friend's) ← merge point noted
|
|
185
|
+
Chapter 3
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
Like taking both versions and saying "here's where we combined our work."
|
|
189
|
+
|
|
190
|
+
**git rebase (make one continuous story):**
|
|
191
|
+
```
|
|
192
|
+
Rewrite history so it looks like your friend went first:
|
|
193
|
+
Chapter 1
|
|
194
|
+
Chapter 2 (friend's)
|
|
195
|
+
Chapter 2 (yours, but rewritten as if friend's didn't exist when you wrote it)
|
|
196
|
+
Chapter 3
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
Like editing your chapters to fit perfectly after your friend's, as if you wrote them sequentially.
|
|
200
|
+
|
|
201
|
+
**When to use:**
|
|
202
|
+
|
|
203
|
+
Use **merge** when:
|
|
204
|
+
- Working on shared/public branches
|
|
205
|
+
- You want to preserve exact history of who did what when
|
|
206
|
+
- Multiple people touching the same code
|
|
207
|
+
|
|
208
|
+
Use **rebase** when:
|
|
209
|
+
- Cleaning up your own local branch before sharing
|
|
210
|
+
- You want a clean, linear story
|
|
211
|
+
- You haven't pushed the branch yet
|
|
212
|
+
|
|
213
|
+
**Golden Rule:**
|
|
214
|
+
Never rebase public branches (it's like editing published chapters - confuses everyone who already read them)
|
|
215
|
+
|
|
216
|
+
**Commands:**
|
|
217
|
+
```bash
|
|
218
|
+
# Merge (safe for public branches)
|
|
219
|
+
git checkout main
|
|
220
|
+
git merge feature-branch
|
|
221
|
+
|
|
222
|
+
# Rebase (only for your local unpublished work)
|
|
223
|
+
git checkout feature-branch
|
|
224
|
+
git rebase main
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
---
|
|
228
|
+
|
|
229
|
+
## Example 5: Understanding Environment Variables
|
|
230
|
+
|
|
231
|
+
### ❌ Before (Technical-first)
|
|
232
|
+
|
|
233
|
+
"Environment variables are dynamic-named values stored in the operating system that affect running processes. They provide configuration data to applications without hardcoding values in source code."
|
|
234
|
+
|
|
235
|
+
**Problems:**
|
|
236
|
+
- Abstract definition
|
|
237
|
+
- Doesn't explain the security/practical benefit
|
|
238
|
+
- No clear "why" or "when"
|
|
239
|
+
|
|
240
|
+
### ✅ After (Baby Education Style)
|
|
241
|
+
|
|
242
|
+
**Analogy:**
|
|
243
|
+
Environment variables are like sticky notes you put on your computer that your code can read.
|
|
244
|
+
|
|
245
|
+
**Why This Matters:**
|
|
246
|
+
|
|
247
|
+
Imagine you write code like this:
|
|
248
|
+
```javascript
|
|
249
|
+
const password = "mySecretPassword123"; // ❌ BAD IDEA
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
**Problems:**
|
|
253
|
+
1. Anyone who sees your code sees your password
|
|
254
|
+
2. If you share code on GitHub, password is public
|
|
255
|
+
3. Different computers (dev, production) need different passwords
|
|
256
|
+
|
|
257
|
+
**Solution: Environment Variables**
|
|
258
|
+
|
|
259
|
+
Instead, create a secret sticky note (`.env` file):
|
|
260
|
+
```
|
|
261
|
+
DATABASE_PASSWORD=mySecretPassword123
|
|
262
|
+
API_KEY=abc123xyz
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
Your code reads the sticky note:
|
|
266
|
+
```javascript
|
|
267
|
+
const password = process.env.DATABASE_PASSWORD; // ✅ Safe
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
**Benefits:**
|
|
271
|
+
1. ✅ Code doesn't contain secrets
|
|
272
|
+
2. ✅ Each computer can have different sticky notes
|
|
273
|
+
3. ✅ You can share code without sharing passwords
|
|
274
|
+
|
|
275
|
+
**Real-World Flow:**
|
|
276
|
+
|
|
277
|
+
On your computer:
|
|
278
|
+
- Create `.env` file with your dev database password
|
|
279
|
+
- Add `.env` to `.gitignore` (so it never uploads to GitHub)
|
|
280
|
+
- Code reads from `.env`
|
|
281
|
+
|
|
282
|
+
On production server:
|
|
283
|
+
- Different `.env` file with production database password
|
|
284
|
+
- Same code, different config - works everywhere
|
|
285
|
+
|
|
286
|
+
**Common Mistake:**
|
|
287
|
+
```javascript
|
|
288
|
+
// ❌ Accidentally committing secrets
|
|
289
|
+
git add .env // DON'T DO THIS
|
|
290
|
+
|
|
291
|
+
// ✅ Ignore secrets file
|
|
292
|
+
echo ".env" >> .gitignore
|
|
293
|
+
git add .gitignore
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
Think of it like this: Your code is a recipe that says "add the secret sauce." The `.env` file is where you write down what that secret sauce is - and everyone can have their own recipe for it."
|
|
297
|
+
|
|
298
|
+
---
|
|
299
|
+
|
|
300
|
+
## Common Mistake Patterns & Corrections
|
|
301
|
+
|
|
302
|
+
### Mistake 1: Using Passive Voice
|
|
303
|
+
|
|
304
|
+
❌ "The function should be called after initialization"
|
|
305
|
+
✅ "Call the function after you initialize"
|
|
306
|
+
|
|
307
|
+
### Mistake 2: Unexplained Acronyms
|
|
308
|
+
|
|
309
|
+
❌ "Configure the CORS policy"
|
|
310
|
+
✅ "Configure CORS (Cross-Origin Resource Sharing) - the security rule that controls which websites can access your API"
|
|
311
|
+
|
|
312
|
+
### Mistake 3: Assuming Knowledge
|
|
313
|
+
|
|
314
|
+
❌ "Just use a reducer"
|
|
315
|
+
✅ "Use a reducer - a function that takes current state and an action, then returns new state. Think of it like a calculator: you input current number + operation, it outputs the result."
|
|
316
|
+
|
|
317
|
+
### Mistake 4: No Context for "Why"
|
|
318
|
+
|
|
319
|
+
❌ "Always use strict mode"
|
|
320
|
+
✅ "Use strict mode - it's like spell-check for JavaScript. It catches common mistakes like using variables before declaring them."
|
|
321
|
+
|
|
322
|
+
### Mistake 5: Multiple Concepts at Once
|
|
323
|
+
|
|
324
|
+
❌ "This async function returns a promise that resolves with the fetched data after the API call completes"
|
|
325
|
+
|
|
326
|
+
✅ (Break into steps)
|
|
327
|
+
"This function talks to an API.
|
|
328
|
+
Since talking to APIs takes time (like sending a letter), it's 'async' - it doesn't block your code while waiting.
|
|
329
|
+
It returns a Promise - think of it as a 'I'll get back to you' note.
|
|
330
|
+
When the API finally responds, the Promise 'resolves' with the data."
|
|
331
|
+
|
|
332
|
+
---
|
|
333
|
+
|
|
334
|
+
## Quick Transformation Checklist
|
|
335
|
+
|
|
336
|
+
When converting technical explanations:
|
|
337
|
+
|
|
338
|
+
1. ✅ Start with "Imagine..." or "You know how..."
|
|
339
|
+
2. ✅ Use everyday analogies before technical terms
|
|
340
|
+
3. ✅ Show concrete examples with comments
|
|
341
|
+
4. ✅ Explain the "why" before the "how"
|
|
342
|
+
5. ✅ Use "you" and "we" instead of "one must"
|
|
343
|
+
6. ✅ Break complex sentences into simple steps
|
|
344
|
+
7. ✅ Add context for jargon you can't avoid
|
|
345
|
+
8. ✅ Celebrate small wins ("See? Not so scary!")
|