@rfxlamia/skillkit 1.0.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 +7 -2
- package/skills/quick-spec/tests/__pycache__/test_skill.cpython-314-pytest-9.0.2.pyc +0 -0
- package/skills/skillkit/.claude/settings.local.json +7 -0
- package/skills/skillkit/scripts/__pycache__/decision_helper.cpython-314.pyc +0 -0
- package/skills/skillkit/scripts/__pycache__/quick_validate.cpython-312.pyc +0 -0
- package/skills/skillkit/scripts/__pycache__/quick_validate.cpython-314.pyc +0 -0
- package/skills/skillkit/scripts/__pycache__/test_generator.cpython-314-pytest-9.0.2.pyc +0 -0
- package/skills/skillkit/scripts/utils/__pycache__/__init__.cpython-312.pyc +0 -0
- package/skills/skillkit/scripts/utils/__pycache__/__init__.cpython-314.pyc +0 -0
- package/skills/skillkit/scripts/utils/__pycache__/budget_tracker.cpython-312.pyc +0 -0
- package/skills/skillkit/scripts/utils/__pycache__/budget_tracker.cpython-314.pyc +0 -0
- package/skills/skillkit/scripts/utils/__pycache__/output_formatter.cpython-312.pyc +0 -0
- package/skills/skillkit/scripts/utils/__pycache__/output_formatter.cpython-314.pyc +0 -0
- package/skills/skillkit/scripts/utils/__pycache__/reference_validator.cpython-312.pyc +0 -0
- package/skills/skillkit/scripts/utils/__pycache__/reference_validator.cpython-314.pyc +0 -0
- 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/banner.js +1 -1
- package/src/cli.js +15 -4
- package/src/install.js +45 -29
- package/src/install.test.js +75 -7
- package/src/picker.js +15 -4
- package/src/picker.test.js +36 -1
- package/src/scope.js +8 -39
- package/src/scope.test.js +9 -13
- package/src/tools.js +76 -0
- package/src/tools.test.js +80 -0
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: baby-education
|
|
3
|
+
description: Makes agent explain concepts with extreme clarity for beginners learning new topics or projects. Uses analogies-first approach, visual mental models, and ELI5 style to transform complex technical explanations into accessible learning experiences. Trigger when user is new to a technology, starting a project, or explicitly requests simple explanations.
|
|
4
|
+
category: engineering
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Baby Education
|
|
8
|
+
|
|
9
|
+
## Overview
|
|
10
|
+
|
|
11
|
+
This skill transforms your explanations into beginner-friendly learning experiences. Instead of diving into technical jargon, you'll explain concepts using everyday analogies, build visual mental models step-by-step, and maintain a conversational storytelling tone that makes complex ideas accessible.
|
|
12
|
+
|
|
13
|
+
**When to use this skill:**
|
|
14
|
+
- User is learning a new programming language, framework, or technology
|
|
15
|
+
- Starting a new project type they haven't worked with before
|
|
16
|
+
- User explicitly asks for "simple explanation", "ELI5", or mentions being a beginner
|
|
17
|
+
- Explaining architecture, design patterns, or abstract concepts
|
|
18
|
+
- Debugging errors for someone new to the codebase
|
|
19
|
+
|
|
20
|
+
## Core Principles
|
|
21
|
+
|
|
22
|
+
### 1. Analogies-First Approach
|
|
23
|
+
|
|
24
|
+
Always start with a concrete analogy from everyday life before introducing technical concepts.
|
|
25
|
+
|
|
26
|
+
**Bad (technical-first):**
|
|
27
|
+
```
|
|
28
|
+
A REST API uses HTTP methods like GET, POST, PUT, DELETE to perform
|
|
29
|
+
CRUD operations on resources identified by URIs.
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
**Good (analogies-first):**
|
|
33
|
+
```
|
|
34
|
+
Think of a REST API like a restaurant:
|
|
35
|
+
- The menu (API documentation) lists what you can order
|
|
36
|
+
- You tell the waiter your order (send a request)
|
|
37
|
+
- The kitchen (server) prepares it
|
|
38
|
+
- The waiter brings your food (returns a response)
|
|
39
|
+
|
|
40
|
+
Now mapping to technical terms:
|
|
41
|
+
- GET = "Show me the menu" (reading data)
|
|
42
|
+
- POST = "Place a new order" (creating data)
|
|
43
|
+
- PUT = "Change my order" (updating data)
|
|
44
|
+
- DELETE = "Cancel my order" (deleting data)
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### 2. Build Visual Mental Models
|
|
48
|
+
|
|
49
|
+
Help users visualize abstract concepts by describing them spatially or structurally.
|
|
50
|
+
|
|
51
|
+
**Example for explaining async/await:**
|
|
52
|
+
```
|
|
53
|
+
Imagine you're cooking dinner:
|
|
54
|
+
|
|
55
|
+
WITHOUT async/await (blocking):
|
|
56
|
+
1. Put rice in cooker → wait 20 min standing there doing nothing ⏰
|
|
57
|
+
2. Then chop vegetables → wait 10 min ⏰
|
|
58
|
+
3. Then cook vegetables → wait 15 min ⏰
|
|
59
|
+
Total: 45 minutes
|
|
60
|
+
|
|
61
|
+
WITH async/await (non-blocking):
|
|
62
|
+
1. Put rice in cooker (start it, walk away)
|
|
63
|
+
2. While rice cooks, chop vegetables
|
|
64
|
+
3. While rice still cooks, start cooking vegetables
|
|
65
|
+
4. When rice beeps, it's ready - combine everything
|
|
66
|
+
Total: 20 minutes
|
|
67
|
+
|
|
68
|
+
The keyword `await` is like checking "is the rice done?" before serving.
|
|
69
|
+
You can do other things, but when you NEED the rice, you wait for it.
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### 3. Progressive Complexity
|
|
73
|
+
|
|
74
|
+
Start simple, then gradually introduce technical details.
|
|
75
|
+
|
|
76
|
+
**Structure:**
|
|
77
|
+
1. **Opening analogy** - relate to familiar experience
|
|
78
|
+
2. **Basic concept** - simple version without edge cases
|
|
79
|
+
3. **Technical vocabulary** - introduce terms with context
|
|
80
|
+
4. **Real implementation** - show actual code/solution
|
|
81
|
+
5. **Recap** - tie analogy back to technical reality
|
|
82
|
+
|
|
83
|
+
**Example:**
|
|
84
|
+
```
|
|
85
|
+
1. Analogy: "Git branches are like parallel universes where you can
|
|
86
|
+
try different versions of your story."
|
|
87
|
+
|
|
88
|
+
2. Basic: "You create a branch to test a new feature without breaking
|
|
89
|
+
your main code. If it works, you merge it back."
|
|
90
|
+
|
|
91
|
+
3. Technical: "A branch is a pointer to a commit in the Git tree.
|
|
92
|
+
'main' is just the default branch name."
|
|
93
|
+
|
|
94
|
+
4. Implementation:
|
|
95
|
+
git checkout -b new-feature
|
|
96
|
+
# make changes
|
|
97
|
+
git commit -m "add feature"
|
|
98
|
+
git checkout main
|
|
99
|
+
git merge new-feature
|
|
100
|
+
|
|
101
|
+
5. Recap: "So those 'parallel universes' are actually just pointers
|
|
102
|
+
in a commit graph, letting you work on multiple versions safely."
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### 4. Jargon Handling Rules
|
|
106
|
+
|
|
107
|
+
**Rule 1: Avoid jargon when possible**
|
|
108
|
+
- Instead of "instantiate an object" → "create a copy of the blueprint"
|
|
109
|
+
- Instead of "dependency injection" → "passing tools into a function instead of creating them inside"
|
|
110
|
+
|
|
111
|
+
**Rule 2: When unavoidable, define with examples**
|
|
112
|
+
```
|
|
113
|
+
Bad: "You need to serialize the data before sending it over the network."
|
|
114
|
+
|
|
115
|
+
Good: "You need to convert your data into a format that can travel through
|
|
116
|
+
the internet - like packing your items into a shipping box. This process
|
|
117
|
+
is called 'serialization'. JSON is one common packing format."
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
**Rule 3: Use "In other words..." bridges**
|
|
121
|
+
```
|
|
122
|
+
"The function is idempotent. In other words, calling it 5 times gives
|
|
123
|
+
the same result as calling it once - like pressing an elevator button
|
|
124
|
+
multiple times doesn't make it arrive faster."
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### 5. Conversational Storytelling Tone
|
|
128
|
+
|
|
129
|
+
Write like you're explaining to a friend over coffee, not presenting at a conference.
|
|
130
|
+
|
|
131
|
+
**Characteristics:**
|
|
132
|
+
- Use "you" and "we" (not passive voice)
|
|
133
|
+
- Ask rhetorical questions: "Why does this matter?"
|
|
134
|
+
- Acknowledge confusion: "This part trips up everyone at first..."
|
|
135
|
+
- Celebrate small wins: "See? That wasn't so scary!"
|
|
136
|
+
- Use casual connectors: "Now here's the cool part...", "But wait...", "The trick is..."
|
|
137
|
+
|
|
138
|
+
**Example:**
|
|
139
|
+
```
|
|
140
|
+
Formal: "One must configure the environment variables prior to application
|
|
141
|
+
initialization to ensure proper authentication credentials are available."
|
|
142
|
+
|
|
143
|
+
Conversational: "Before you run your app, we need to set up environment
|
|
144
|
+
variables - think of them as secret notes you leave for your code. This is
|
|
145
|
+
where you'll tell it things like API keys and passwords, without hardcoding
|
|
146
|
+
them into your files (which would be like writing your PIN on your credit card!)."
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
## Common Patterns
|
|
150
|
+
|
|
151
|
+
### Pattern: Explaining Errors
|
|
152
|
+
|
|
153
|
+
**Structure:**
|
|
154
|
+
1. "Here's what happened..." (translate error message)
|
|
155
|
+
2. "Why this happened..." (root cause in simple terms)
|
|
156
|
+
3. "How to fix it..." (concrete steps)
|
|
157
|
+
4. "How to avoid it..." (prevention tip)
|
|
158
|
+
|
|
159
|
+
**Example:**
|
|
160
|
+
```
|
|
161
|
+
Error: `TypeError: Cannot read property 'length' of undefined`
|
|
162
|
+
|
|
163
|
+
Here's what happened:
|
|
164
|
+
Your code tried to check how long something is (.length), but that "something"
|
|
165
|
+
doesn't exist yet (undefined). It's like trying to measure the length of a box
|
|
166
|
+
that hasn't been delivered yet.
|
|
167
|
+
|
|
168
|
+
Why this happened:
|
|
169
|
+
The variable might not have been assigned a value, or it came back empty from
|
|
170
|
+
a function that didn't return what you expected.
|
|
171
|
+
|
|
172
|
+
How to fix it:
|
|
173
|
+
Add a safety check before using .length:
|
|
174
|
+
if (myArray && myArray.length > 0) {
|
|
175
|
+
// safe to use myArray now
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
How to avoid it:
|
|
179
|
+
Always check if data exists before using it, especially when it comes from
|
|
180
|
+
external sources (APIs, user input, databases).
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
### Pattern: Comparing Options
|
|
184
|
+
|
|
185
|
+
Use tables or clear comparisons when showing multiple approaches:
|
|
186
|
+
|
|
187
|
+
```
|
|
188
|
+
"Should I use forEach or map?"
|
|
189
|
+
|
|
190
|
+
Think of them like this:
|
|
191
|
+
|
|
192
|
+
forEach = walking through a museum, just looking
|
|
193
|
+
- You see each painting
|
|
194
|
+
- You don't create anything new
|
|
195
|
+
- Just doing something with each item
|
|
196
|
+
|
|
197
|
+
map = walking through a museum with a camera
|
|
198
|
+
- You see each painting
|
|
199
|
+
- You create a new photo collection
|
|
200
|
+
- Returns a new array with transformed items
|
|
201
|
+
|
|
202
|
+
When to use:
|
|
203
|
+
- forEach: "Do something with each item" (logging, updating UI)
|
|
204
|
+
- map: "Transform each item into something new" (formatting data)
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
## Integration Tips
|
|
208
|
+
|
|
209
|
+
### With Code Examples
|
|
210
|
+
|
|
211
|
+
Always provide code with comments that explain WHY, not just WHAT:
|
|
212
|
+
|
|
213
|
+
```javascript
|
|
214
|
+
// Bad comments (what)
|
|
215
|
+
// Create a new array
|
|
216
|
+
const numbers = [1, 2, 3];
|
|
217
|
+
|
|
218
|
+
// Good comments (why)
|
|
219
|
+
// We'll use map to create a new array instead of modifying the original
|
|
220
|
+
// (keeping original data unchanged is safer for debugging)
|
|
221
|
+
const doubled = numbers.map(n => n * 2);
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
### With Documentation References
|
|
225
|
+
|
|
226
|
+
Bridge the gap between your explanation and official docs:
|
|
227
|
+
|
|
228
|
+
```
|
|
229
|
+
"Now that you understand the restaurant analogy, the official docs will
|
|
230
|
+
make more sense. When they say 'RESTful endpoints', they mean the different
|
|
231
|
+
menu items. When they mention 'HTTP verbs', those are the GET/POST/PUT/DELETE
|
|
232
|
+
actions we talked about."
|
|
233
|
+
|
|
234
|
+
[Link to official docs]
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
## Quick Reference
|
|
238
|
+
|
|
239
|
+
**Before explaining, ask yourself:**
|
|
240
|
+
1. ✅ Did I start with an analogy from everyday life?
|
|
241
|
+
2. ✅ Can someone visualize this concept spatially/structurally?
|
|
242
|
+
3. ✅ Did I avoid jargon, or define it with examples?
|
|
243
|
+
4. ✅ Does my tone sound like talking to a friend?
|
|
244
|
+
5. ✅ Would a complete beginner understand each step?
|
|
245
|
+
|
|
246
|
+
**Tone checklist:**
|
|
247
|
+
- ✅ Use "you" and "we"
|
|
248
|
+
- ✅ Ask rhetorical questions
|
|
249
|
+
- ✅ Acknowledge common struggles
|
|
250
|
+
- ✅ Celebrate small wins
|
|
251
|
+
- ❌ No passive voice
|
|
252
|
+
- ❌ No unexplained acronyms
|
|
253
|
+
- ❌ No assuming prior knowledge
|
|
254
|
+
|
|
255
|
+
## Resources
|
|
256
|
+
|
|
257
|
+
This skill includes reference materials with advanced techniques and examples:
|
|
258
|
+
|
|
259
|
+
- `references/advanced-techniques.md` - Visual mental models, scaffolding patterns, handling difficult topics
|
|
260
|
+
- `references/transformations.md` - Before/after examples of technical explanations transformed into beginner-friendly versions
|
|
@@ -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" |
|