@robbiesrobotics/alice-agents 1.5.7 → 1.5.9
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/README.md +5 -2
- package/bin/alice-cloud.cjs +71 -55
- package/package.json +1 -1
- package/templates/skills/acculynx/SKILL.md +183 -0
- package/templates/skills/acculynx/references/analysis_template.py +116 -0
- package/templates/skills/acculynx/references/dashboard_page.tsx +641 -0
- package/templates/skills/claude-code/SKILL.md +2 -2
- package/templates/skills/coding-agent/SKILL.md +68 -0
- package/templates/skills/crawl4ai/SKILL.md +119 -0
- package/templates/skills/crawl4ai/scripts/crwl +3 -0
- package/templates/workspaces/accuscope/AGENTS.md +38 -0
- package/templates/workspaces/accuscope/FEEDBACK.md +27 -0
- package/templates/workspaces/accuscope/HEARTBEAT.md +26 -0
- package/templates/workspaces/accuscope/IDENTITY.md +48 -0
- package/templates/workspaces/accuscope/LEARNINGS.md +46 -0
- package/templates/workspaces/accuscope/MEMORY.md +47 -0
- package/templates/workspaces/accuscope/PLAYBOOK.md +65 -0
- package/templates/workspaces/accuscope/SOUL.md +40 -0
- package/templates/workspaces/accuscope/TOOLS.md +63 -0
- package/templates/workspaces/accuscope/USER.md +39 -0
- package/templates/workspaces/aiden/AGENTS.md +52 -0
- package/templates/workspaces/aiden/FEEDBACK.md +12 -0
- package/templates/workspaces/aiden/HEARTBEAT.md +9 -0
- package/templates/workspaces/aiden/IDENTITY.md +6 -0
- package/templates/workspaces/aiden/LEARNINGS.md +6 -0
- package/templates/workspaces/aiden/MEMORY.md +22 -0
- package/templates/workspaces/aiden/PLAYBOOK.md +16 -0
- package/templates/workspaces/aiden/SOUL.md +1 -1
- package/templates/workspaces/aiden/USER.md +17 -0
- package/templates/workspaces/alex/AGENTS.md +52 -0
- package/templates/workspaces/alex/FEEDBACK.md +11 -0
- package/templates/workspaces/alex/HEARTBEAT.md +9 -0
- package/templates/workspaces/alex/IDENTITY.md +6 -0
- package/templates/workspaces/alex/LEARNINGS.md +5 -0
- package/templates/workspaces/alex/MEMORY.md +22 -0
- package/templates/workspaces/alex/PLAYBOOK.md +16 -0
- package/templates/workspaces/alex/SOUL.md +1 -1
- package/templates/workspaces/alex/USER.md +13 -0
- package/templates/workspaces/aria/AGENTS.md +18 -0
- package/templates/workspaces/aria/FEEDBACK.md +12 -0
- package/templates/workspaces/aria/HEARTBEAT.md +32 -0
- package/templates/workspaces/aria/IDENTITY.md +12 -0
- package/templates/workspaces/aria/LEARNINGS.md +31 -0
- package/templates/workspaces/aria/MEMORY.md +29 -0
- package/templates/workspaces/aria/PLAYBOOK.md +71 -0
- package/templates/workspaces/aria/SOUL.md +57 -0
- package/templates/workspaces/aria/TOOLS.md +47 -0
- package/templates/workspaces/aria/USER.md +18 -0
- package/templates/workspaces/audrey/AGENTS.md +59 -0
- package/templates/workspaces/audrey/FEEDBACK.md +11 -0
- package/templates/workspaces/audrey/HEARTBEAT.md +9 -0
- package/templates/workspaces/audrey/IDENTITY.md +6 -0
- package/templates/workspaces/audrey/LEARNINGS.md +5 -0
- package/templates/workspaces/audrey/MEMORY.md +22 -0
- package/templates/workspaces/audrey/PLAYBOOK.md +16 -0
- package/templates/workspaces/audrey/SOUL.md +1 -1
- package/templates/workspaces/audrey/TOOLS.md +15 -0
- package/templates/workspaces/audrey/USER.md +13 -0
- package/templates/workspaces/avery/AGENTS.md +52 -0
- package/templates/workspaces/avery/FEEDBACK.md +12 -0
- package/templates/workspaces/avery/HEARTBEAT.md +5 -0
- package/templates/workspaces/avery/IDENTITY.md +6 -0
- package/templates/workspaces/avery/LEARNINGS.md +6 -0
- package/templates/workspaces/avery/MEMORY.md +22 -0
- package/templates/workspaces/avery/PLAYBOOK.md +16 -0
- package/templates/workspaces/avery/SOUL.md +1 -1
- package/templates/workspaces/avery/USER.md +17 -0
- package/templates/workspaces/avery/skills/claude-code/SKILL.md +38 -0
- package/templates/workspaces/avery/skills/claude-code/claude_code +55 -0
- package/templates/workspaces/caleb/AGENTS.md +52 -0
- package/templates/workspaces/caleb/FEEDBACK.md +11 -0
- package/templates/workspaces/caleb/HEARTBEAT.md +9 -0
- package/templates/workspaces/caleb/IDENTITY.md +6 -0
- package/templates/workspaces/caleb/LEARNINGS.md +5 -0
- package/templates/workspaces/caleb/MEMORY.md +22 -0
- package/templates/workspaces/caleb/PLAYBOOK.md +16 -0
- package/templates/workspaces/caleb/SOUL.md +1 -1
- package/templates/workspaces/caleb/TOOLS.md +30 -0
- package/templates/workspaces/caleb/USER.md +13 -0
- package/templates/workspaces/clara/AGENTS.md +59 -0
- package/templates/workspaces/clara/FEEDBACK.md +12 -0
- package/templates/workspaces/clara/HEARTBEAT.md +5 -0
- package/templates/workspaces/clara/IDENTITY.md +6 -0
- package/templates/workspaces/clara/LEARNINGS.md +6 -0
- package/templates/workspaces/clara/MEMORY.md +22 -0
- package/templates/workspaces/clara/PLAYBOOK.md +16 -0
- package/templates/workspaces/clara/SOUL.md +1 -1
- package/templates/workspaces/clara/TOOLS.md +15 -0
- package/templates/workspaces/clara/USER.md +17 -0
- package/templates/workspaces/daphne/AGENTS.md +59 -0
- package/templates/workspaces/daphne/FEEDBACK.md +18 -0
- package/templates/workspaces/daphne/HEARTBEAT.md +5 -0
- package/templates/workspaces/daphne/IDENTITY.md +6 -0
- package/templates/workspaces/daphne/LEARNINGS.md +6 -0
- package/templates/workspaces/daphne/MEMORY.md +22 -0
- package/templates/workspaces/daphne/PLAYBOOK.md +48 -0
- package/templates/workspaces/daphne/SOUL.md +1 -1
- package/templates/workspaces/daphne/TOOLS.md +15 -0
- package/templates/workspaces/daphne/USER.md +17 -0
- package/templates/workspaces/darius/AGENTS.md +52 -0
- package/templates/workspaces/darius/FEEDBACK.md +12 -0
- package/templates/workspaces/darius/HEARTBEAT.md +5 -0
- package/templates/workspaces/darius/IDENTITY.md +6 -0
- package/templates/workspaces/darius/LEARNINGS.md +6 -0
- package/templates/workspaces/darius/MEMORY.md +22 -0
- package/templates/workspaces/darius/PLAYBOOK.md +16 -0
- package/templates/workspaces/darius/SOUL.md +1 -1
- package/templates/workspaces/darius/USER.md +17 -0
- package/templates/workspaces/darius/skills/claude-code/SKILL.md +38 -0
- package/templates/workspaces/darius/skills/claude-code/claude_code +55 -0
- package/templates/workspaces/devon/AGENTS.md +52 -0
- package/templates/workspaces/devon/FEEDBACK.md +11 -0
- package/templates/workspaces/devon/HEARTBEAT.md +5 -0
- package/templates/workspaces/devon/IDENTITY.md +6 -0
- package/templates/workspaces/devon/LEARNINGS.md +11 -0
- package/templates/workspaces/devon/MEMORY.md +22 -0
- package/templates/workspaces/devon/PLAYBOOK.md +16 -0
- package/templates/workspaces/devon/SOUL.md +1 -1
- package/templates/workspaces/devon/USER.md +13 -0
- package/templates/workspaces/devon/check_github.py +12 -0
- package/templates/workspaces/devon/check_mc_env.py +30 -0
- package/templates/workspaces/devon/check_sb.py +34 -0
- package/templates/workspaces/devon/check_vercel.py +12 -0
- package/templates/workspaces/devon/get_mc_files.py +17 -0
- package/templates/workspaces/devon/write_heartbeat.py +67 -0
- package/templates/workspaces/dylan/.env.example +33 -0
- package/templates/workspaces/dylan/00007_verify_licenses_table.sql +100 -0
- package/templates/workspaces/dylan/AGENTS.md +52 -0
- package/templates/workspaces/dylan/FEEDBACK.md +28 -0
- package/templates/workspaces/dylan/HEARTBEAT.md +5 -0
- package/templates/workspaces/dylan/IDENTITY.md +6 -0
- package/templates/workspaces/dylan/LEARNINGS.md +70 -0
- package/templates/workspaces/dylan/MEMORY.md +22 -0
- package/templates/workspaces/dylan/PLAYBOOK.md +16 -0
- package/templates/workspaces/dylan/SOUL.md +1 -1
- package/templates/workspaces/dylan/STRIPE_PIPELINE.md +185 -0
- package/templates/workspaces/dylan/USER.md +17 -0
- package/templates/workspaces/dylan/n8n-stripe-welcome-workflow.json +123 -0
- package/templates/workspaces/dylan/skills/claude-code/SKILL.md +38 -0
- package/templates/workspaces/dylan/skills/claude-code/claude_code +55 -0
- package/templates/workspaces/dylan/stripe-webhook-handler.py +433 -0
- package/templates/workspaces/dylan/test_mock_webhook.py +103 -0
- package/templates/workspaces/elena/AGENTS.md +59 -0
- package/templates/workspaces/elena/FEEDBACK.md +11 -0
- package/templates/workspaces/elena/HEARTBEAT.md +9 -0
- package/templates/workspaces/elena/IDENTITY.md +6 -0
- package/templates/workspaces/elena/LEARNINGS.md +5 -0
- package/templates/workspaces/elena/MEMORY.md +22 -0
- package/templates/workspaces/elena/PLAYBOOK.md +16 -0
- package/templates/workspaces/elena/SOUL.md +1 -1
- package/templates/workspaces/elena/TOOLS.md +15 -0
- package/templates/workspaces/elena/USER.md +13 -0
- package/templates/workspaces/eva/AGENTS.md +59 -0
- package/templates/workspaces/eva/FEEDBACK.md +11 -0
- package/templates/workspaces/eva/HEARTBEAT.md +9 -0
- package/templates/workspaces/eva/IDENTITY.md +6 -0
- package/templates/workspaces/eva/LEARNINGS.md +5 -0
- package/templates/workspaces/eva/MEMORY.md +22 -0
- package/templates/workspaces/eva/PLAYBOOK.md +16 -0
- package/templates/workspaces/eva/SOUL.md +1 -1
- package/templates/workspaces/eva/TOOLS.md +15 -0
- package/templates/workspaces/eva/USER.md +13 -0
- package/templates/workspaces/felix/AGENTS.md +52 -0
- package/templates/workspaces/felix/FEEDBACK.md +11 -0
- package/templates/workspaces/felix/HEARTBEAT.md +5 -0
- package/templates/workspaces/felix/IDENTITY.md +6 -0
- package/templates/workspaces/felix/LEARNINGS.md +17 -0
- package/templates/workspaces/felix/MEMORY.md +22 -0
- package/templates/workspaces/felix/PLAYBOOK.md +16 -0
- package/templates/workspaces/felix/SOUL.md +1 -1
- package/templates/workspaces/felix/USER.md +13 -0
- package/templates/workspaces/felix/fidelia-psychology.html +1594 -0
- package/templates/workspaces/felix/task.txt +164 -0
- package/templates/workspaces/hannah/AGENTS.md +59 -0
- package/templates/workspaces/hannah/FEEDBACK.md +12 -0
- package/templates/workspaces/hannah/HEARTBEAT.md +5 -0
- package/templates/workspaces/hannah/IDENTITY.md +6 -0
- package/templates/workspaces/hannah/LEARNINGS.md +6 -0
- package/templates/workspaces/hannah/MEMORY.md +22 -0
- package/templates/workspaces/hannah/PLAYBOOK.md +16 -0
- package/templates/workspaces/hannah/SOUL.md +1 -1
- package/templates/workspaces/hannah/TOOLS.md +15 -0
- package/templates/workspaces/hannah/USER.md +17 -0
- package/templates/workspaces/isaac/AGENTS.md +52 -0
- package/templates/workspaces/isaac/FEEDBACK.md +12 -0
- package/templates/workspaces/isaac/HEARTBEAT.md +9 -0
- package/templates/workspaces/isaac/IDENTITY.md +6 -0
- package/templates/workspaces/isaac/LEARNINGS.md +6 -0
- package/templates/workspaces/isaac/MEMORY.md +22 -0
- package/templates/workspaces/isaac/PLAYBOOK.md +16 -0
- package/templates/workspaces/isaac/SOUL.md +1 -1
- package/templates/workspaces/isaac/USER.md +17 -0
- package/templates/workspaces/isaac/skills/claude-code/SKILL.md +38 -0
- package/templates/workspaces/isaac/skills/claude-code/claude_code +55 -0
- package/templates/workspaces/logan/AGENTS.md +59 -0
- package/templates/workspaces/logan/FEEDBACK.md +11 -0
- package/templates/workspaces/logan/HEARTBEAT.md +9 -0
- package/templates/workspaces/logan/IDENTITY.md +6 -0
- package/templates/workspaces/logan/LEARNINGS.md +5 -0
- package/templates/workspaces/logan/MEMORY.md +22 -0
- package/templates/workspaces/logan/PLAYBOOK.md +16 -0
- package/templates/workspaces/logan/SOUL.md +1 -1
- package/templates/workspaces/logan/TOOLS.md +15 -0
- package/templates/workspaces/logan/USER.md +13 -0
- package/templates/workspaces/maxxipro/AGENTS.md +29 -0
- package/templates/workspaces/maxxipro/FEEDBACK.md +19 -0
- package/templates/workspaces/maxxipro/HEARTBEAT.md +22 -0
- package/templates/workspaces/maxxipro/IDENTITY.md +35 -0
- package/templates/workspaces/maxxipro/KNOWLEDGE.md +335 -0
- package/templates/workspaces/maxxipro/LEARNINGS.md +47 -0
- package/templates/workspaces/maxxipro/MEMORY.md +60 -0
- package/templates/workspaces/maxxipro/OUTREACH_TEMPLATES.md +143 -0
- package/templates/workspaces/maxxipro/PLAYBOOK.md +81 -0
- package/templates/workspaces/maxxipro/SOUL.md +146 -0
- package/templates/workspaces/maxxipro/TOOLS.md +81 -0
- package/templates/workspaces/maxxipro/USER.md +40 -0
- package/templates/workspaces/morgan/AGENTS.md +59 -0
- package/templates/workspaces/morgan/FEEDBACK.md +19 -0
- package/templates/workspaces/morgan/HEARTBEAT.md +5 -0
- package/templates/workspaces/morgan/IDENTITY.md +6 -0
- package/templates/workspaces/morgan/LEARNINGS.md +18 -0
- package/templates/workspaces/morgan/MEMORY.md +22 -0
- package/templates/workspaces/morgan/PLAYBOOK.md +16 -0
- package/templates/workspaces/morgan/SOUL.md +1 -1
- package/templates/workspaces/morgan/TOOLS.md +15 -0
- package/templates/workspaces/morgan/USER.md +13 -0
- package/templates/workspaces/nadia/AGENTS.md +59 -0
- package/templates/workspaces/nadia/FEEDBACK.md +12 -0
- package/templates/workspaces/nadia/HEARTBEAT.md +5 -0
- package/templates/workspaces/nadia/IDENTITY.md +6 -0
- package/templates/workspaces/nadia/LEARNINGS.md +6 -0
- package/templates/workspaces/nadia/MEMORY.md +22 -0
- package/templates/workspaces/nadia/PLAYBOOK.md +16 -0
- package/templates/workspaces/nadia/SOUL.md +1 -1
- package/templates/workspaces/nadia/TOOLS.md +15 -0
- package/templates/workspaces/nadia/USER.md +13 -0
- package/templates/workspaces/nate/AGENTS.md +24 -0
- package/templates/workspaces/nate/FEEDBACK.md +12 -0
- package/templates/workspaces/nate/HEARTBEAT.md +33 -0
- package/templates/workspaces/nate/IDENTITY.md +15 -0
- package/templates/workspaces/nate/LEARNINGS.md +33 -0
- package/templates/workspaces/nate/MEMORY.md +39 -0
- package/templates/workspaces/nate/PLAYBOOK.md +160 -0
- package/templates/workspaces/nate/SOUL.md +50 -0
- package/templates/workspaces/nate/TOOLS.md +111 -0
- package/templates/workspaces/nate/USER.md +32 -0
- package/templates/workspaces/olivia/.last-openclaw-version +1 -0
- package/templates/workspaces/olivia/.npmrc.tmp +0 -0
- package/templates/workspaces/olivia/AGENTS.md +77 -0
- package/templates/workspaces/olivia/ALPHA_CODING_BENCHMARK.txt +148 -0
- package/templates/workspaces/olivia/ALPHA_MODEL_GUIDE.md +393 -0
- package/templates/workspaces/olivia/FEEDBACK.md +13 -0
- package/templates/workspaces/olivia/HEADTOHEAD_BENCHMARK.txt +1289 -0
- package/templates/workspaces/olivia/HEARTBEAT.md +267 -0
- package/templates/workspaces/olivia/IDENTITY.md +6 -0
- package/templates/workspaces/olivia/LEARNINGS.md +708 -0
- package/templates/workspaces/olivia/MEMORY.md +202 -0
- package/templates/workspaces/olivia/MISSION_CONTROL_DESIGN_SPEC_v1.md +1143 -0
- package/templates/workspaces/olivia/MVP-COMPLETION-SUMMARY.md +175 -0
- package/templates/workspaces/olivia/NETWORK_IMPLEMENTATION_PLAN.md +1556 -0
- package/templates/workspaces/olivia/NEW_NODES_BENCHMARK.txt +947 -0
- package/templates/workspaces/olivia/PLAYBOOK.md +42 -0
- package/templates/workspaces/olivia/SELF-HEALING-COMPLETE.md +150 -0
- package/templates/workspaces/olivia/SOUL.md +8 -8
- package/templates/workspaces/olivia/TOOLS.md +15 -0
- package/templates/workspaces/olivia/USER.md +17 -0
- package/templates/workspaces/olivia/alicefleet-supabase-credentials.md +50 -0
- package/templates/workspaces/olivia/dzombo-copy-rewrite.md +115 -0
- package/templates/workspaces/olivia/dzombo-implementation-plan.md +1248 -0
- package/templates/workspaces/olivia/fidelia-psychology.html +1594 -0
- package/templates/workspaces/olivia/lead_debug.png +0 -0
- package/templates/workspaces/olivia/minimatch-10.2.4.tgz +0 -0
- package/templates/workspaces/olivia/operation-bllm-research.md +157 -0
- package/templates/workspaces/olivia/qa-audit-mission-control-v2.md +538 -0
- package/templates/workspaces/olivia/roofmaxx_logo.svg +1 -0
- package/templates/workspaces/olivia/roofmaxx_social.jpg +0 -0
- package/templates/workspaces/olivia/skills/1password/SKILL.md +53 -0
- package/templates/workspaces/olivia/skills/1password/_meta.json +6 -0
- package/templates/workspaces/olivia/skills/afrexai-recruiting-engine/README.md +57 -0
- package/templates/workspaces/olivia/skills/afrexai-recruiting-engine/SKILL.md +534 -0
- package/templates/workspaces/olivia/skills/afrexai-recruiting-engine/_meta.json +6 -0
- package/templates/workspaces/olivia/skills/agent-security/SKILL.md +69 -0
- package/templates/workspaces/olivia/skills/agent-security/_meta.json +6 -0
- package/templates/workspaces/olivia/skills/agentic-security-audit/SKILL.md +855 -0
- package/templates/workspaces/olivia/skills/agentic-security-audit/_meta.json +6 -0
- package/templates/workspaces/olivia/skills/ai-automation-consulting/SKILL.md +67 -0
- package/templates/workspaces/olivia/skills/ai-automation-consulting/_meta.json +6 -0
- package/templates/workspaces/olivia/skills/ai-automation-consulting/skill.json +12 -0
- package/templates/workspaces/olivia/skills/ai-presentation-maker/SKILL.md +1104 -0
- package/templates/workspaces/olivia/skills/ai-presentation-maker/_meta.json +6 -0
- package/templates/workspaces/olivia/skills/ai-productivity-audit/SKILL.md +181 -0
- package/templates/workspaces/olivia/skills/ai-productivity-audit/_meta.json +6 -0
- package/templates/workspaces/olivia/skills/ai-researcher/README.md +31 -0
- package/templates/workspaces/olivia/skills/ai-researcher/SKILL.md +59 -0
- package/templates/workspaces/olivia/skills/ai-researcher/_meta.json +6 -0
- package/templates/workspaces/olivia/skills/ai-seo-writer/README.md +19 -0
- package/templates/workspaces/olivia/skills/ai-seo-writer/SKILL.md +100 -0
- package/templates/workspaces/olivia/skills/ai-seo-writer/_meta.json +6 -0
- package/templates/workspaces/olivia/skills/analytics-tracking-2/SKILL.md +309 -0
- package/templates/workspaces/olivia/skills/analytics-tracking-2/_meta.json +6 -0
- package/templates/workspaces/olivia/skills/api-doc-writer/SKILL.md +232 -0
- package/templates/workspaces/olivia/skills/api-doc-writer/_meta.json +6 -0
- package/templates/workspaces/olivia/skills/api-generator/SKILL.md +49 -0
- package/templates/workspaces/olivia/skills/api-generator/_meta.json +6 -0
- package/templates/workspaces/olivia/skills/api-generator/tips.md +10 -0
- package/templates/workspaces/olivia/skills/apple-notes/SKILL.md +50 -0
- package/templates/workspaces/olivia/skills/apple-notes/_meta.json +6 -0
- package/templates/workspaces/olivia/skills/apple-reminders/SKILL.md +67 -0
- package/templates/workspaces/olivia/skills/apple-reminders/_meta.json +6 -0
- package/templates/workspaces/olivia/skills/automation-workflows/SKILL.md +267 -0
- package/templates/workspaces/olivia/skills/automation-workflows/_meta.json +6 -0
- package/templates/workspaces/olivia/skills/autoresearch/SKILL.md +46 -0
- package/templates/workspaces/olivia/skills/autoresearch/aria_write.py +148 -0
- package/templates/workspaces/olivia/skills/autoresearch/autoresearch.py +75 -0
- package/templates/workspaces/olivia/skills/azure-devops/SKILL.md +115 -0
- package/templates/workspaces/olivia/skills/azure-devops/_meta.json +6 -0
- package/templates/workspaces/olivia/skills/blogwatcher/SKILL.md +46 -0
- package/templates/workspaces/olivia/skills/blogwatcher/_meta.json +6 -0
- package/templates/workspaces/olivia/skills/blucli/SKILL.md +27 -0
- package/templates/workspaces/olivia/skills/blucli/_meta.json +6 -0
- package/templates/workspaces/olivia/skills/check-analytics/SKILL.md +92 -0
- package/templates/workspaces/olivia/skills/check-analytics/_meta.json +6 -0
- package/templates/workspaces/olivia/skills/cloud-architect/SKILL.md +89 -0
- package/templates/workspaces/olivia/skills/cloud-architect/_meta.json +6 -0
- package/templates/workspaces/olivia/skills/cloud-infra-automation/SKILL.md +50 -0
- package/templates/workspaces/olivia/skills/cloud-infra-automation/_meta.json +6 -0
- package/templates/workspaces/olivia/skills/cloud-storage/SKILL.md +61 -0
- package/templates/workspaces/olivia/skills/cloud-storage/_meta.json +6 -0
- package/templates/workspaces/olivia/skills/cloud-storage/auth.md +97 -0
- package/templates/workspaces/olivia/skills/cloud-storage/costs.md +88 -0
- package/templates/workspaces/olivia/skills/cloud-storage/providers.md +55 -0
- package/templates/workspaces/olivia/skills/copywriting-pro/SKILL.md +107 -0
- package/templates/workspaces/olivia/skills/copywriting-pro/_meta.json +6 -0
- package/templates/workspaces/olivia/skills/data-analyst-pro/SKILL.md +21 -0
- package/templates/workspaces/olivia/skills/data-analyst-pro/_meta.json +6 -0
- package/templates/workspaces/olivia/skills/database-designer/README.md +388 -0
- package/templates/workspaces/olivia/skills/database-designer/SKILL.md +66 -0
- package/templates/workspaces/olivia/skills/database-designer/_meta.json +6 -0
- package/templates/workspaces/olivia/skills/database-designer/index_optimizer.py +926 -0
- package/templates/workspaces/olivia/skills/database-designer/migration_generator.py +1199 -0
- package/templates/workspaces/olivia/skills/database-designer/schema_analyzer.py +982 -0
- package/templates/workspaces/olivia/skills/deploy-agent/SKILL.md +255 -0
- package/templates/workspaces/olivia/skills/deploy-agent/_meta.json +6 -0
- package/templates/workspaces/olivia/skills/devops-automation-pack/SKILL.md +72 -0
- package/templates/workspaces/olivia/skills/devops-automation-pack/_meta.json +6 -0
- package/templates/workspaces/olivia/skills/devops-automation-pack/deploy.sh +0 -0
- package/templates/workspaces/olivia/skills/financial-analysis-agent/SKILL.md +489 -0
- package/templates/workspaces/olivia/skills/financial-analysis-agent/_meta.json +6 -0
- package/templates/workspaces/olivia/skills/gdpr-compliance-tracker/README.md +72 -0
- package/templates/workspaces/olivia/skills/gdpr-compliance-tracker/SKILL.md +226 -0
- package/templates/workspaces/olivia/skills/gdpr-compliance-tracker/_meta.json +6 -0
- package/templates/workspaces/olivia/skills/gifgrep/SKILL.md +47 -0
- package/templates/workspaces/olivia/skills/gifgrep/_meta.json +6 -0
- package/templates/workspaces/olivia/skills/github/SKILL.md +47 -0
- package/templates/workspaces/olivia/skills/github/_meta.json +6 -0
- package/templates/workspaces/olivia/skills/gog/SKILL.md +36 -0
- package/templates/workspaces/olivia/skills/gog/_meta.json +6 -0
- package/templates/workspaces/olivia/skills/growth-strategy-hub/SKILL.md +135 -0
- package/templates/workspaces/olivia/skills/growth-strategy-hub/_meta.json +6 -0
- package/templates/workspaces/olivia/skills/growth-strategy-hub/metadata.json +4 -0
- package/templates/workspaces/olivia/skills/hetzner-cloud/SKILL.md +130 -0
- package/templates/workspaces/olivia/skills/hetzner-cloud/_meta.json +6 -0
- package/templates/workspaces/olivia/skills/himalaya/SKILL.md +217 -0
- package/templates/workspaces/olivia/skills/himalaya/_meta.json +6 -0
- package/templates/workspaces/olivia/skills/hotel-recommendation/SKILL.md +117 -0
- package/templates/workspaces/olivia/skills/hotel-recommendation/_meta.json +6 -0
- package/templates/workspaces/olivia/skills/hr-policy-generator/SKILL.md +54 -0
- package/templates/workspaces/olivia/skills/hr-policy-generator/_meta.json +6 -0
- package/templates/workspaces/olivia/skills/human-writing/SKILL.md +41 -0
- package/templates/workspaces/olivia/skills/human-writing/_meta.json +6 -0
- package/templates/workspaces/olivia/skills/imsg/SKILL.md +25 -0
- package/templates/workspaces/olivia/skills/imsg/_meta.json +6 -0
- package/templates/workspaces/olivia/skills/in-depth-research/SKILL.md +124 -0
- package/templates/workspaces/olivia/skills/in-depth-research/_meta.json +6 -0
- package/templates/workspaces/olivia/skills/in-depth-research/methodology.md +75 -0
- package/templates/workspaces/olivia/skills/in-depth-research/output-formats.md +168 -0
- package/templates/workspaces/olivia/skills/in-depth-research/sources.md +80 -0
- package/templates/workspaces/olivia/skills/javascript-skills/README.md +71 -0
- package/templates/workspaces/olivia/skills/javascript-skills/SKILL.md +746 -0
- package/templates/workspaces/olivia/skills/javascript-skills/_meta.json +6 -0
- package/templates/workspaces/olivia/skills/leadership-strategy-playbook/SKILL.md +147 -0
- package/templates/workspaces/olivia/skills/leadership-strategy-playbook/_meta.json +6 -0
- package/templates/workspaces/olivia/skills/market-research-agent/README.md +29 -0
- package/templates/workspaces/olivia/skills/market-research-agent/SKILL.md +52 -0
- package/templates/workspaces/olivia/skills/market-research-agent/_meta.json +6 -0
- package/templates/workspaces/olivia/skills/marketing-analytics/SKILL.md +74 -0
- package/templates/workspaces/olivia/skills/marketing-analytics/_meta.json +6 -0
- package/templates/workspaces/olivia/skills/marketing-master-io/SKILL.md +125 -0
- package/templates/workspaces/olivia/skills/marketing-master-io/_meta.json +6 -0
- package/templates/workspaces/olivia/skills/marketing-strategy-pmm/SKILL.md +398 -0
- package/templates/workspaces/olivia/skills/marketing-strategy-pmm/_meta.json +6 -0
- package/templates/workspaces/olivia/skills/meta-ads-analytics/SKILL.md +53 -0
- package/templates/workspaces/olivia/skills/meta-ads-analytics/_meta.json +6 -0
- package/templates/workspaces/olivia/skills/obsidian/SKILL.md +55 -0
- package/templates/workspaces/olivia/skills/obsidian/_meta.json +6 -0
- package/templates/workspaces/olivia/skills/openclaw-accounting/SKILL.md +125 -0
- package/templates/workspaces/olivia/skills/openclaw-accounting/_meta.json +6 -0
- package/templates/workspaces/olivia/skills/openclaw-security-toolkit/CHANGELOG.md +35 -0
- package/templates/workspaces/olivia/skills/openclaw-security-toolkit/CHANNELLOG.md +73 -0
- package/templates/workspaces/olivia/skills/openclaw-security-toolkit/README.md +161 -0
- package/templates/workspaces/olivia/skills/openclaw-security-toolkit/SKILL.md +130 -0
- package/templates/workspaces/olivia/skills/openclaw-security-toolkit/_meta.json +6 -0
- package/templates/workspaces/olivia/skills/openclaw-security-toolkit/config.json +36 -0
- package/templates/workspaces/olivia/skills/openclaw-security-toolkit/metadata.json +19 -0
- package/templates/workspaces/olivia/skills/openhue/SKILL.md +30 -0
- package/templates/workspaces/olivia/skills/openhue/_meta.json +6 -0
- package/templates/workspaces/olivia/skills/orgx-operations-agent/SKILL.md +41 -0
- package/templates/workspaces/olivia/skills/orgx-operations-agent/_meta.json +6 -0
- package/templates/workspaces/olivia/skills/outreach/SKILL.md +84 -0
- package/templates/workspaces/olivia/skills/outreach/_meta.json +6 -0
- package/templates/workspaces/olivia/skills/outreach/by-type.md +166 -0
- package/templates/workspaces/olivia/skills/outreach/templates.md +154 -0
- package/templates/workspaces/olivia/skills/outreach/tracking.md +145 -0
- package/templates/workspaces/olivia/skills/persona-hr-coordinator/SKILL.md +38 -0
- package/templates/workspaces/olivia/skills/persona-hr-coordinator/_meta.json +6 -0
- package/templates/workspaces/olivia/skills/personal-productivity/SKILL.md +161 -0
- package/templates/workspaces/olivia/skills/personal-productivity/_meta.json +6 -0
- package/templates/workspaces/olivia/skills/personal-productivity/index.js +363 -0
- package/templates/workspaces/olivia/skills/personal-productivity/package.json +15 -0
- package/templates/workspaces/olivia/skills/personal-travel/README.md +34 -0
- package/templates/workspaces/olivia/skills/personal-travel/SKILL.md +46 -0
- package/templates/workspaces/olivia/skills/personal-travel/_meta.json +6 -0
- package/templates/workspaces/olivia/skills/presentation-html-generator-skill/SKILL.md +185 -0
- package/templates/workspaces/olivia/skills/presentation-html-generator-skill/_meta.json +6 -0
- package/templates/workspaces/olivia/skills/product-manager/SKILL.md +77 -0
- package/templates/workspaces/olivia/skills/product-manager/_meta.json +6 -0
- package/templates/workspaces/olivia/skills/quant-strategy/SKILL.md +28 -0
- package/templates/workspaces/olivia/skills/quant-strategy/_meta.json +6 -0
- package/templates/workspaces/olivia/skills/sales-pipeline-tracker/README.md +29 -0
- package/templates/workspaces/olivia/skills/sales-pipeline-tracker/SKILL.md +45 -0
- package/templates/workspaces/olivia/skills/sales-pipeline-tracker/_meta.json +6 -0
- package/templates/workspaces/olivia/skills/security-auditor/SKILL.md +399 -0
- package/templates/workspaces/olivia/skills/security-auditor/_meta.json +6 -0
- package/templates/workspaces/olivia/skills/security-hardening/SKILL.md +296 -0
- package/templates/workspaces/olivia/skills/security-hardening/_meta.json +6 -0
- package/templates/workspaces/olivia/skills/security-scanner/SKILL.md +67 -0
- package/templates/workspaces/olivia/skills/security-scanner/_meta.json +6 -0
- package/templates/workspaces/olivia/skills/seo-optimization/SKILL.md +31 -0
- package/templates/workspaces/olivia/skills/seo-optimization/_meta.json +6 -0
- package/templates/workspaces/olivia/skills/service-booking/SKILL.md +193 -0
- package/templates/workspaces/olivia/skills/service-booking/_meta.json +6 -0
- package/templates/workspaces/olivia/skills/sme-hr-automation/SKILL.md +131 -0
- package/templates/workspaces/olivia/skills/sme-hr-automation/_meta.json +6 -0
- package/templates/workspaces/olivia/skills/social-media-scheduler/README.md +29 -0
- package/templates/workspaces/olivia/skills/social-media-scheduler/SKILL.md +49 -0
- package/templates/workspaces/olivia/skills/social-media-scheduler/_meta.json +6 -0
- package/templates/workspaces/olivia/skills/sonoscli/SKILL.md +26 -0
- package/templates/workspaces/olivia/skills/sonoscli/_meta.json +6 -0
- package/templates/workspaces/olivia/skills/strategy-advisor/SKILL.md +33 -0
- package/templates/workspaces/olivia/skills/strategy-advisor/_meta.json +6 -0
- package/templates/workspaces/olivia/skills/summarize/SKILL.md +49 -0
- package/templates/workspaces/olivia/skills/summarize/_meta.json +6 -0
- package/templates/workspaces/olivia/skills/things-mac/SKILL.md +61 -0
- package/templates/workspaces/olivia/skills/things-mac/_meta.json +6 -0
- package/templates/workspaces/olivia/skills/travel-itinerary-planner/SKILL.md +121 -0
- package/templates/workspaces/olivia/skills/travel-itinerary-planner/_meta.json +6 -0
- package/templates/workspaces/olivia/skills/travel-manager/SKILL.md +36 -0
- package/templates/workspaces/olivia/skills/travel-manager/_meta.json +6 -0
- package/templates/workspaces/olivia/skills/travel-planning/SKILL.md +238 -0
- package/templates/workspaces/olivia/skills/travel-planning/_meta.json +6 -0
- package/templates/workspaces/olivia/skills/travel-planning/booking-guide.md +91 -0
- package/templates/workspaces/olivia/skills/travel-planning/memory-template.md +111 -0
- package/templates/workspaces/olivia/skills/travel-planning/multi-city.md +131 -0
- package/templates/workspaces/olivia/skills/travel-planning/packing-templates.md +155 -0
- package/templates/workspaces/olivia/skills/travel-planning/setup.md +66 -0
- package/templates/workspaces/olivia/skills/update-it-all/SKILL.md +143 -0
- package/templates/workspaces/olivia/skills/update-it-all/_meta.json +6 -0
- package/templates/workspaces/olivia/skills/voice/SKILL.md +62 -0
- package/templates/workspaces/olivia/skills/weather/SKILL.md +49 -0
- package/templates/workspaces/olivia/skills/weather/_meta.json +6 -0
- package/templates/workspaces/olivia/skills/web-researcher/SKILL.md +21 -0
- package/templates/workspaces/olivia/skills/web-researcher/_meta.json +6 -0
- package/templates/workspaces/olivia/skills/website-seo/SKILL.md +284 -0
- package/templates/workspaces/olivia/skills/website-seo/_meta.json +6 -0
- package/templates/workspaces/olivia/stripe-welcome-n8n.json +103 -0
- package/templates/workspaces/olivia/test2.wav.wav +0 -0
- package/templates/workspaces/olivia/test_speech.json +1 -0
- package/templates/workspaces/olivia/test_speech.srt +0 -0
- package/templates/workspaces/olivia/test_speech.tsv +1 -0
- package/templates/workspaces/olivia/test_speech.txt +0 -0
- package/templates/workspaces/olivia/test_speech.vtt +2 -0
- package/templates/workspaces/owen/AGENTS.md +59 -0
- package/templates/workspaces/owen/FEEDBACK.md +12 -0
- package/templates/workspaces/owen/HEARTBEAT.md +5 -0
- package/templates/workspaces/owen/IDENTITY.md +6 -0
- package/templates/workspaces/owen/LEARNINGS.md +46 -0
- package/templates/workspaces/owen/MEMORY.md +22 -0
- package/templates/workspaces/owen/PLAYBOOK.md +16 -0
- package/templates/workspaces/owen/SOUL.md +1 -1
- package/templates/workspaces/owen/TOOLS.md +15 -0
- package/templates/workspaces/owen/USER.md +17 -0
- package/templates/workspaces/parker/AGENTS.md +59 -0
- package/templates/workspaces/parker/FEEDBACK.md +11 -0
- package/templates/workspaces/parker/HEARTBEAT.md +5 -0
- package/templates/workspaces/parker/IDENTITY.md +6 -0
- package/templates/workspaces/parker/LEARNINGS.md +17 -0
- package/templates/workspaces/parker/MEMORY.md +22 -0
- package/templates/workspaces/parker/PLAYBOOK.md +16 -0
- package/templates/workspaces/parker/SOUL.md +1 -1
- package/templates/workspaces/parker/TOOLS.md +15 -0
- package/templates/workspaces/parker/USER.md +13 -0
- package/templates/workspaces/quinn/AGENTS.md +52 -0
- package/templates/workspaces/quinn/FEEDBACK.md +11 -0
- package/templates/workspaces/quinn/HEARTBEAT.md +5 -0
- package/templates/workspaces/quinn/IDENTITY.md +6 -0
- package/templates/workspaces/quinn/LEARNINGS.md +35 -0
- package/templates/workspaces/quinn/MEMORY.md +22 -0
- package/templates/workspaces/quinn/PLAYBOOK.md +16 -0
- package/templates/workspaces/quinn/SOUL.md +1 -1
- package/templates/workspaces/quinn/USER.md +17 -0
- package/templates/workspaces/quinn/alice-login-page.png +0 -0
- package/templates/workspaces/rowan/AGENTS.md +59 -0
- package/templates/workspaces/rowan/FEEDBACK.md +12 -0
- package/templates/workspaces/rowan/HEARTBEAT.md +5 -0
- package/templates/workspaces/rowan/IDENTITY.md +6 -0
- package/templates/workspaces/rowan/LEARNINGS.md +12 -0
- package/templates/workspaces/rowan/MEMORY.md +22 -0
- package/templates/workspaces/rowan/PLAYBOOK.md +16 -0
- package/templates/workspaces/rowan/SOUL.md +1 -1
- package/templates/workspaces/rowan/USER.md +17 -0
- package/templates/workspaces/selena/AGENTS.md +59 -0
- package/templates/workspaces/selena/FEEDBACK.md +12 -0
- package/templates/workspaces/selena/HEARTBEAT.md +5 -0
- package/templates/workspaces/selena/IDENTITY.md +6 -0
- package/templates/workspaces/selena/LEARNINGS.md +24 -0
- package/templates/workspaces/selena/MEMORY.md +22 -0
- package/templates/workspaces/selena/PLAYBOOK.md +16 -0
- package/templates/workspaces/selena/SOUL.md +1 -1
- package/templates/workspaces/selena/USER.md +17 -0
- package/templates/workspaces/selena/kids-ai-security-compliance-plan.md +791 -0
- package/templates/workspaces/selena/kidspark-coppa-compliance-audit.md +866 -0
- package/templates/workspaces/sloane/AGENTS.md +59 -0
- package/templates/workspaces/sloane/FEEDBACK.md +12 -0
- package/templates/workspaces/sloane/HEARTBEAT.md +9 -0
- package/templates/workspaces/sloane/IDENTITY.md +6 -0
- package/templates/workspaces/sloane/LEARNINGS.md +6 -0
- package/templates/workspaces/sloane/MEMORY.md +22 -0
- package/templates/workspaces/sloane/PLAYBOOK.md +16 -0
- package/templates/workspaces/sloane/SOUL.md +1 -1
- package/templates/workspaces/sloane/TOOLS.md +15 -0
- package/templates/workspaces/sloane/USER.md +13 -0
- package/templates/workspaces/smoketestagent/AGENTS.md +52 -0
- package/templates/workspaces/smoketestagent/FEEDBACK.md +3 -0
- package/templates/workspaces/smoketestagent/HEARTBEAT.md +14 -0
- package/templates/workspaces/smoketestagent/IDENTITY.md +6 -0
- package/templates/workspaces/smoketestagent/LEARNINGS.md +3 -0
- package/templates/workspaces/smoketestagent/MEMORY.md +24 -0
- package/templates/workspaces/smoketestagent/PLAYBOOK.md +7 -0
- package/templates/workspaces/smoketestagent/SOUL.md +32 -0
- package/templates/workspaces/smoketestagent/TOOLS.md +13 -0
- package/templates/workspaces/smoketestagent/USER.md +5 -0
- package/templates/workspaces/sophie/AGENTS.md +59 -0
- package/templates/workspaces/sophie/FEEDBACK.md +12 -0
- package/templates/workspaces/sophie/HEARTBEAT.md +9 -0
- package/templates/workspaces/sophie/IDENTITY.md +6 -0
- package/templates/workspaces/sophie/LEARNINGS.md +6 -0
- package/templates/workspaces/sophie/MEMORY.md +22 -0
- package/templates/workspaces/sophie/PLAYBOOK.md +16 -0
- package/templates/workspaces/sophie/SOUL.md +1 -1
- package/templates/workspaces/sophie/TOOLS.md +15 -0
- package/templates/workspaces/sophie/USER.md +17 -0
- package/templates/workspaces/tommy/AGENTS.md +59 -0
- package/templates/workspaces/tommy/FEEDBACK.md +12 -0
- package/templates/workspaces/tommy/HEARTBEAT.md +9 -0
- package/templates/workspaces/tommy/IDENTITY.md +6 -0
- package/templates/workspaces/tommy/LEARNINGS.md +6 -0
- package/templates/workspaces/tommy/MEMORY.md +22 -0
- package/templates/workspaces/tommy/PLAYBOOK.md +16 -0
- package/templates/workspaces/tommy/SOUL.md +1 -1
- package/templates/workspaces/tommy/TOOLS.md +15 -0
- package/templates/workspaces/tommy/USER.md +17 -0
- package/templates/workspaces/uma/AGENTS.md +59 -0
- package/templates/workspaces/uma/FEEDBACK.md +11 -0
- package/templates/workspaces/uma/HEARTBEAT.md +5 -0
- package/templates/workspaces/uma/IDENTITY.md +6 -0
- package/templates/workspaces/uma/LEARNINGS.md +11 -0
- package/templates/workspaces/uma/MEMORY.md +22 -0
- package/templates/workspaces/uma/PLAYBOOK.md +16 -0
- package/templates/workspaces/uma/SOUL.md +1 -1
- package/templates/workspaces/uma/TOOLS.md +15 -0
- package/templates/workspaces/uma/USER.md +13 -0
|
@@ -0,0 +1,746 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: JavaScript
|
|
3
|
+
license: MIT
|
|
4
|
+
description: >
|
|
5
|
+
A comprehensive JavaScript style guide skill.
|
|
6
|
+
When activated, it provides best-practice JavaScript coding conventions and generates
|
|
7
|
+
code that strictly follows the style guide, covering variables, functions, objects,
|
|
8
|
+
arrays, classes, modules, async patterns, error handling, naming conventions, and more.
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# JavaScript Style Guide Skill
|
|
12
|
+
|
|
13
|
+
## Activation
|
|
14
|
+
|
|
15
|
+
This skill activates when the user mentions or implies **JavaScript** in their request. Once activated, it:
|
|
16
|
+
|
|
17
|
+
- Responds with best-practice guidance
|
|
18
|
+
- Generates JavaScript code that strictly conforms to the style guide
|
|
19
|
+
- Provides explanations for why each convention is recommended
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## Complete Style Rules
|
|
24
|
+
|
|
25
|
+
### 1. References
|
|
26
|
+
|
|
27
|
+
- Use `const` for all references; avoid `var`.
|
|
28
|
+
- If you must reassign references, use `let` instead of `var`.
|
|
29
|
+
- Both `const` and `let` are block-scoped, whereas `var` is function-scoped.
|
|
30
|
+
|
|
31
|
+
```javascript
|
|
32
|
+
// bad
|
|
33
|
+
var count = 1;
|
|
34
|
+
|
|
35
|
+
// good
|
|
36
|
+
const count = 1;
|
|
37
|
+
let mutableValue = 1;
|
|
38
|
+
mutableValue += 1;
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### 2. Objects
|
|
42
|
+
|
|
43
|
+
- Use literal syntax for object creation.
|
|
44
|
+
- Use computed property names when creating objects with dynamic property names.
|
|
45
|
+
- Use object method shorthand and property value shorthand.
|
|
46
|
+
- Group shorthand properties at the beginning of the object declaration.
|
|
47
|
+
- Only quote properties that are invalid identifiers.
|
|
48
|
+
- Prefer the object spread syntax (`...`) over `Object.assign` to shallow-copy objects.
|
|
49
|
+
|
|
50
|
+
```javascript
|
|
51
|
+
// bad
|
|
52
|
+
const item = new Object();
|
|
53
|
+
|
|
54
|
+
// good
|
|
55
|
+
const item = {};
|
|
56
|
+
|
|
57
|
+
// computed property names
|
|
58
|
+
const key = 'name';
|
|
59
|
+
const obj = { [key]: 'value' };
|
|
60
|
+
|
|
61
|
+
// method & property shorthand
|
|
62
|
+
const name = 'Alice';
|
|
63
|
+
const atom = {
|
|
64
|
+
name,
|
|
65
|
+
value: 1,
|
|
66
|
+
addValue(val) {
|
|
67
|
+
return atom.value + val;
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
// shallow copy
|
|
72
|
+
const original = { a: 1, b: 2 };
|
|
73
|
+
const copy = { ...original, c: 3 };
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### 3. Arrays
|
|
77
|
+
|
|
78
|
+
- Use literal syntax for array creation.
|
|
79
|
+
- Use `Array.from` or the spread operator to convert array-like objects.
|
|
80
|
+
- Use `return` statements in array method callbacks.
|
|
81
|
+
- Use line breaks after the opening bracket and before the closing bracket if the array has multiple lines.
|
|
82
|
+
|
|
83
|
+
```javascript
|
|
84
|
+
// bad
|
|
85
|
+
const items = new Array();
|
|
86
|
+
|
|
87
|
+
// good
|
|
88
|
+
const items = [];
|
|
89
|
+
|
|
90
|
+
// convert iterable
|
|
91
|
+
const nodes = Array.from(document.querySelectorAll('.item'));
|
|
92
|
+
const uniqueValues = [...new Set(arr)];
|
|
93
|
+
|
|
94
|
+
// array methods
|
|
95
|
+
[1, 2, 3].map((x) => x + 1);
|
|
96
|
+
|
|
97
|
+
[1, 2, 3].map((x) => {
|
|
98
|
+
const y = x + 1;
|
|
99
|
+
return x * y;
|
|
100
|
+
});
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### 4. Destructuring
|
|
104
|
+
|
|
105
|
+
- Use object destructuring when accessing multiple properties of an object.
|
|
106
|
+
- Use array destructuring.
|
|
107
|
+
- Use object destructuring for multiple return values, not array destructuring.
|
|
108
|
+
|
|
109
|
+
```javascript
|
|
110
|
+
// bad
|
|
111
|
+
function getFullName(user) {
|
|
112
|
+
const firstName = user.firstName;
|
|
113
|
+
const lastName = user.lastName;
|
|
114
|
+
return `${firstName} ${lastName}`;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// good
|
|
118
|
+
function getFullName({ firstName, lastName }) {
|
|
119
|
+
return `${firstName} ${lastName}`;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// array destructuring
|
|
123
|
+
const [first, , third] = [1, 2, 3];
|
|
124
|
+
|
|
125
|
+
// multiple return values — use object destructuring
|
|
126
|
+
function processInput(input) {
|
|
127
|
+
return { left, right, top, bottom };
|
|
128
|
+
}
|
|
129
|
+
const { left, top } = processInput(input);
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### 5. Strings
|
|
133
|
+
|
|
134
|
+
- Use single quotes `''` for strings.
|
|
135
|
+
- Use template literals for string interpolation and multi-line strings.
|
|
136
|
+
- Never use `eval()` on a string.
|
|
137
|
+
- Do not unnecessarily escape characters in strings.
|
|
138
|
+
|
|
139
|
+
```javascript
|
|
140
|
+
// bad
|
|
141
|
+
const name = "Alice";
|
|
142
|
+
const greeting = 'Hello, ' + name + '!';
|
|
143
|
+
|
|
144
|
+
// good
|
|
145
|
+
const name = 'Alice';
|
|
146
|
+
const greeting = `Hello, ${name}!`;
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
### 6. Functions
|
|
150
|
+
|
|
151
|
+
- Use named function expressions instead of function declarations.
|
|
152
|
+
- Wrap immediately invoked function expressions (IIFE) in parentheses.
|
|
153
|
+
- Never declare a function in a non-function block (`if`, `while`, etc.).
|
|
154
|
+
- Never name a parameter `arguments`.
|
|
155
|
+
- Use default parameter syntax rather than mutating function arguments.
|
|
156
|
+
- Always put default parameters last.
|
|
157
|
+
- Never use the `Function` constructor to create a new function.
|
|
158
|
+
- Use the spread operator `...` to call variadic functions.
|
|
159
|
+
- Use rest parameters (`...args`) instead of `arguments`.
|
|
160
|
+
|
|
161
|
+
```javascript
|
|
162
|
+
// named function expression
|
|
163
|
+
const short = function longUniqueMoreDescriptiveLexicalFoo() {
|
|
164
|
+
// ...
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
// default parameters last
|
|
168
|
+
function handleThings(name, opts = {}) {
|
|
169
|
+
// ...
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
// rest parameters
|
|
173
|
+
function concatenateAll(...args) {
|
|
174
|
+
return args.join('');
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
// spread to call
|
|
178
|
+
const values = [1, 2, 3];
|
|
179
|
+
console.log(Math.max(...values));
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
### 7. Arrow Functions
|
|
183
|
+
|
|
184
|
+
- Use arrow function notation for anonymous functions (callbacks).
|
|
185
|
+
- If the function body consists of a single expression, omit the braces and use the implicit return.
|
|
186
|
+
- If the expression spans multiple lines, wrap it in parentheses for readability.
|
|
187
|
+
- Always include parentheses around arguments for clarity and consistency.
|
|
188
|
+
|
|
189
|
+
```javascript
|
|
190
|
+
// bad
|
|
191
|
+
[1, 2, 3].map(function (x) {
|
|
192
|
+
const y = x + 1;
|
|
193
|
+
return x * y;
|
|
194
|
+
});
|
|
195
|
+
|
|
196
|
+
// good
|
|
197
|
+
[1, 2, 3].map((x) => {
|
|
198
|
+
const y = x + 1;
|
|
199
|
+
return x * y;
|
|
200
|
+
});
|
|
201
|
+
|
|
202
|
+
// implicit return
|
|
203
|
+
[1, 2, 3].map((x) => x * 2);
|
|
204
|
+
|
|
205
|
+
// multiline implicit return
|
|
206
|
+
[1, 2, 3].map((number) => (
|
|
207
|
+
`A long string with the ${number}. It's so long that we don't want it to take up space on the .map line!`
|
|
208
|
+
));
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
### 8. Classes & Constructors
|
|
212
|
+
|
|
213
|
+
- Always use `class`; avoid manipulating `prototype` directly.
|
|
214
|
+
- Use `extends` for inheritance.
|
|
215
|
+
- Methods can return `this` to enable method chaining.
|
|
216
|
+
- Classes have a default constructor if no constructor is specified; an empty constructor or one that just delegates to a parent is unnecessary.
|
|
217
|
+
- Avoid duplicate class members.
|
|
218
|
+
|
|
219
|
+
```javascript
|
|
220
|
+
// bad
|
|
221
|
+
function Queue(contents = []) {
|
|
222
|
+
this.queue = [...contents];
|
|
223
|
+
}
|
|
224
|
+
Queue.prototype.pop = function () {
|
|
225
|
+
return this.queue.pop();
|
|
226
|
+
};
|
|
227
|
+
|
|
228
|
+
// good
|
|
229
|
+
class Queue {
|
|
230
|
+
constructor(contents = []) {
|
|
231
|
+
this.queue = [...contents];
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
pop() {
|
|
235
|
+
return this.queue.pop();
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
// inheritance
|
|
240
|
+
class PeekableQueue extends Queue {
|
|
241
|
+
peek() {
|
|
242
|
+
return this.queue[0];
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
### 9. Modules
|
|
248
|
+
|
|
249
|
+
- Always use ES modules (`import`/`export`) over a non-standard module system.
|
|
250
|
+
- Do not use wildcard imports.
|
|
251
|
+
- Do not export directly from an import.
|
|
252
|
+
- Only import from a path in one place.
|
|
253
|
+
- Do not export mutable bindings.
|
|
254
|
+
- Prefer default export for modules that only export a single thing.
|
|
255
|
+
- Put all `import`s above non-import statements.
|
|
256
|
+
- Multi-line imports should be indented like multi-line array and object literals.
|
|
257
|
+
|
|
258
|
+
```javascript
|
|
259
|
+
// bad
|
|
260
|
+
const utils = require('./utils');
|
|
261
|
+
module.exports = utils.fetchData;
|
|
262
|
+
|
|
263
|
+
// good
|
|
264
|
+
import { fetchData } from './utils';
|
|
265
|
+
export default fetchData;
|
|
266
|
+
|
|
267
|
+
// single place import
|
|
268
|
+
import { named1, named2 } from 'module';
|
|
269
|
+
|
|
270
|
+
// multiline
|
|
271
|
+
import {
|
|
272
|
+
longNameA,
|
|
273
|
+
longNameB,
|
|
274
|
+
longNameC,
|
|
275
|
+
} from 'path/to/module';
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
### 10. Iterators and Generators
|
|
279
|
+
|
|
280
|
+
- Prefer JavaScript's higher-order functions over `for-in` or `for-of` loops.
|
|
281
|
+
- Use `map`, `filter`, `reduce`, `find`, `findIndex`, `every`, `some`, etc.
|
|
282
|
+
- Don't use generators for now (if targeting ES5 environments).
|
|
283
|
+
|
|
284
|
+
```javascript
|
|
285
|
+
const numbers = [1, 2, 3, 4, 5];
|
|
286
|
+
|
|
287
|
+
// bad
|
|
288
|
+
let sum = 0;
|
|
289
|
+
for (const num of numbers) {
|
|
290
|
+
sum += num;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
// good
|
|
294
|
+
const sum = numbers.reduce((total, num) => total + num, 0);
|
|
295
|
+
|
|
296
|
+
// filtering
|
|
297
|
+
const evens = numbers.filter((num) => num % 2 === 0);
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
### 11. Properties
|
|
301
|
+
|
|
302
|
+
- Use dot notation when accessing properties.
|
|
303
|
+
- Use bracket notation `[]` when accessing properties with a variable.
|
|
304
|
+
- Use the exponentiation operator `**` instead of `Math.pow`.
|
|
305
|
+
|
|
306
|
+
```javascript
|
|
307
|
+
const luke = { jedi: true, age: 28 };
|
|
308
|
+
|
|
309
|
+
// dot notation
|
|
310
|
+
const isJedi = luke.jedi;
|
|
311
|
+
|
|
312
|
+
// bracket notation
|
|
313
|
+
const prop = 'jedi';
|
|
314
|
+
const isJedi = luke[prop];
|
|
315
|
+
|
|
316
|
+
// exponentiation
|
|
317
|
+
const result = 2 ** 10;
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
### 12. Variables
|
|
321
|
+
|
|
322
|
+
- Always use `const` or `let`; never use `var`.
|
|
323
|
+
- Use one `const` or `let` declaration per variable or assignment.
|
|
324
|
+
- Group all `const`s and then group all `let`s.
|
|
325
|
+
- Assign variables where you need them, but place them in a reasonable place.
|
|
326
|
+
- Don't chain variable assignments.
|
|
327
|
+
- Avoid using unary increments (`++`, `--`); use `+= 1` / `-= 1` instead.
|
|
328
|
+
- Avoid linebreaks before or after `=` in an assignment.
|
|
329
|
+
|
|
330
|
+
```javascript
|
|
331
|
+
// bad
|
|
332
|
+
const items = getItems(),
|
|
333
|
+
goSportsTeam = true,
|
|
334
|
+
dragonball = 'z';
|
|
335
|
+
|
|
336
|
+
// good
|
|
337
|
+
const items = getItems();
|
|
338
|
+
const goSportsTeam = true;
|
|
339
|
+
const dragonball = 'z';
|
|
340
|
+
|
|
341
|
+
// group const then let
|
|
342
|
+
const a = 1;
|
|
343
|
+
const b = 2;
|
|
344
|
+
let c = 3;
|
|
345
|
+
let d = 4;
|
|
346
|
+
|
|
347
|
+
// avoid unary
|
|
348
|
+
let count = 0;
|
|
349
|
+
count += 1;
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
### 13. Hoisting
|
|
353
|
+
|
|
354
|
+
- `var` declarations get hoisted; `const` and `let` are in Temporal Dead Zone.
|
|
355
|
+
- Named function expressions hoist the variable name but not the function body.
|
|
356
|
+
- Function declarations hoist the name and the function body.
|
|
357
|
+
|
|
358
|
+
### 14. Comparison Operators & Equality
|
|
359
|
+
|
|
360
|
+
- Use `===` and `!==` over `==` and `!=`.
|
|
361
|
+
- Use shortcuts for booleans, but explicit comparisons for strings and numbers.
|
|
362
|
+
- Use braces to create blocks in `case` and `default` clauses that contain lexical declarations.
|
|
363
|
+
- Ternaries should not be nested and generally be single-line expressions.
|
|
364
|
+
- Avoid unneeded ternary statements.
|
|
365
|
+
- When mixing operators, enclose them in parentheses (except `**`, `+`, `-`).
|
|
366
|
+
|
|
367
|
+
```javascript
|
|
368
|
+
// bad
|
|
369
|
+
if (isValid == true) { /* ... */ }
|
|
370
|
+
if (name != '') { /* ... */ }
|
|
371
|
+
|
|
372
|
+
// good
|
|
373
|
+
if (isValid) { /* ... */ }
|
|
374
|
+
if (name !== '') { /* ... */ }
|
|
375
|
+
if (collection.length > 0) { /* ... */ }
|
|
376
|
+
|
|
377
|
+
// no nested ternaries
|
|
378
|
+
const thing = foo === 123 ? bar : foobar;
|
|
379
|
+
```
|
|
380
|
+
|
|
381
|
+
### 15. Blocks
|
|
382
|
+
|
|
383
|
+
- Use braces with all multiline blocks.
|
|
384
|
+
- Put `else` on the same line as the `if` block's closing brace.
|
|
385
|
+
- If an `if` block always executes a `return`, the subsequent `else` block is unnecessary.
|
|
386
|
+
|
|
387
|
+
```javascript
|
|
388
|
+
// bad
|
|
389
|
+
if (test)
|
|
390
|
+
return false;
|
|
391
|
+
|
|
392
|
+
// good
|
|
393
|
+
if (test) return false;
|
|
394
|
+
|
|
395
|
+
if (test) {
|
|
396
|
+
return false;
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
// if/else
|
|
400
|
+
if (test) {
|
|
401
|
+
thing1();
|
|
402
|
+
} else {
|
|
403
|
+
thing2();
|
|
404
|
+
}
|
|
405
|
+
```
|
|
406
|
+
|
|
407
|
+
### 16. Control Statements
|
|
408
|
+
|
|
409
|
+
- If a control statement (`if`, `while`, etc.) gets too long, each grouped condition should be on a new line, with the logical operator at the beginning of the line.
|
|
410
|
+
- Don't use selection operators in place of control statements.
|
|
411
|
+
|
|
412
|
+
```javascript
|
|
413
|
+
if (
|
|
414
|
+
foo === 123
|
|
415
|
+
&& bar === 'abc'
|
|
416
|
+
) {
|
|
417
|
+
thing1();
|
|
418
|
+
}
|
|
419
|
+
```
|
|
420
|
+
|
|
421
|
+
### 17. Comments
|
|
422
|
+
|
|
423
|
+
- Use `/** ... */` for multiline comments.
|
|
424
|
+
- Use `//` for single-line comments. Place them on a new line above the subject.
|
|
425
|
+
- Start all comments with a space for readability.
|
|
426
|
+
- Prefix comments with `FIXME:` or `TODO:` to annotate problems or suggest actions.
|
|
427
|
+
|
|
428
|
+
```javascript
|
|
429
|
+
// good single line
|
|
430
|
+
// This is a comment
|
|
431
|
+
const active = true;
|
|
432
|
+
|
|
433
|
+
/**
|
|
434
|
+
* Multiline comment explaining the function.
|
|
435
|
+
* @param {string} tag - The tag name.
|
|
436
|
+
* @returns {Element} The created element.
|
|
437
|
+
*/
|
|
438
|
+
function make(tag) {
|
|
439
|
+
return document.createElement(tag);
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
// TODO: implement caching
|
|
443
|
+
// FIXME: should not use global state
|
|
444
|
+
```
|
|
445
|
+
|
|
446
|
+
### 18. Whitespace
|
|
447
|
+
|
|
448
|
+
- Use soft tabs (spaces) set to 2 spaces.
|
|
449
|
+
- Place 1 space before the leading brace.
|
|
450
|
+
- Place 1 space before the opening parenthesis in control statements.
|
|
451
|
+
- Set off operators with spaces.
|
|
452
|
+
- End files with a single newline character.
|
|
453
|
+
- Use indentation when making long method chains (more than 2 method chains).
|
|
454
|
+
- Leave a blank line after blocks and before the next statement.
|
|
455
|
+
- Do not pad blocks with blank lines.
|
|
456
|
+
- Do not use multiple blank lines to pad your code.
|
|
457
|
+
- Do not add spaces inside parentheses, brackets.
|
|
458
|
+
- Add spaces inside curly braces.
|
|
459
|
+
|
|
460
|
+
```javascript
|
|
461
|
+
// bad
|
|
462
|
+
function foo(){
|
|
463
|
+
const name='Alice';
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
// good
|
|
467
|
+
function foo() {
|
|
468
|
+
const name = 'Alice';
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
// method chaining
|
|
472
|
+
$('#items')
|
|
473
|
+
.find('.selected')
|
|
474
|
+
.highlight()
|
|
475
|
+
.end()
|
|
476
|
+
.find('.open')
|
|
477
|
+
.updateCount();
|
|
478
|
+
```
|
|
479
|
+
|
|
480
|
+
### 19. Commas
|
|
481
|
+
|
|
482
|
+
- Do **not** use leading commas.
|
|
483
|
+
- Use trailing commas (dangling commas) for multiline structures.
|
|
484
|
+
|
|
485
|
+
```javascript
|
|
486
|
+
// bad — leading commas
|
|
487
|
+
const hero = {
|
|
488
|
+
firstName: 'Ada'
|
|
489
|
+
, lastName: 'Lovelace'
|
|
490
|
+
};
|
|
491
|
+
|
|
492
|
+
// good — trailing commas
|
|
493
|
+
const hero = {
|
|
494
|
+
firstName: 'Ada',
|
|
495
|
+
lastName: 'Lovelace',
|
|
496
|
+
};
|
|
497
|
+
|
|
498
|
+
const heroes = [
|
|
499
|
+
'Batman',
|
|
500
|
+
'Superman',
|
|
501
|
+
];
|
|
502
|
+
```
|
|
503
|
+
|
|
504
|
+
### 20. Semicolons
|
|
505
|
+
|
|
506
|
+
- **Always** use semicolons.
|
|
507
|
+
|
|
508
|
+
```javascript
|
|
509
|
+
// bad
|
|
510
|
+
const name = 'Alice'
|
|
511
|
+
|
|
512
|
+
// good
|
|
513
|
+
const name = 'Alice';
|
|
514
|
+
```
|
|
515
|
+
|
|
516
|
+
### 21. Type Casting & Coercion
|
|
517
|
+
|
|
518
|
+
- Perform type coercion at the beginning of the statement.
|
|
519
|
+
- Use `String()` for strings, `Number()` for numbers, `Boolean()` or `!!` for booleans.
|
|
520
|
+
- Use `parseInt` always with a radix.
|
|
521
|
+
|
|
522
|
+
```javascript
|
|
523
|
+
const val = '4';
|
|
524
|
+
|
|
525
|
+
// bad
|
|
526
|
+
const totalScore = val + 0;
|
|
527
|
+
|
|
528
|
+
// good
|
|
529
|
+
const totalScore = Number(val);
|
|
530
|
+
const inputValue = String(someNum);
|
|
531
|
+
const hasAge = Boolean(age);
|
|
532
|
+
const hasName = !!name;
|
|
533
|
+
const count = parseInt(inputValue, 10);
|
|
534
|
+
```
|
|
535
|
+
|
|
536
|
+
### 22. Naming Conventions
|
|
537
|
+
|
|
538
|
+
- Avoid single-letter names; be descriptive.
|
|
539
|
+
- Use **camelCase** for objects, functions, and instances.
|
|
540
|
+
- Use **PascalCase** for classes and constructors.
|
|
541
|
+
- Use **UPPERCASE_SNAKE_CASE** for constants that are exported and truly immutable.
|
|
542
|
+
- Do not use trailing or leading underscores.
|
|
543
|
+
- A base filename should exactly match the name of its default export.
|
|
544
|
+
- Use **camelCase** when exporting a function; use **PascalCase** when exporting a class / constructor / singleton / function library / bare object.
|
|
545
|
+
- Acronyms and initialisms should always be all uppercased or all lowercased.
|
|
546
|
+
|
|
547
|
+
```javascript
|
|
548
|
+
// bad
|
|
549
|
+
const OBJEcttsssss = {};
|
|
550
|
+
function c() {}
|
|
551
|
+
const u = new user();
|
|
552
|
+
|
|
553
|
+
// good
|
|
554
|
+
const thisIsMyObject = {};
|
|
555
|
+
function calculateTotal() {}
|
|
556
|
+
const user = new User();
|
|
557
|
+
|
|
558
|
+
// constants
|
|
559
|
+
export const API_BASE_URL = 'https://api.example.com';
|
|
560
|
+
export const MAX_RETRY_COUNT = 3;
|
|
561
|
+
|
|
562
|
+
// filename examples
|
|
563
|
+
// file: makeStyleGuide.js → export default function makeStyleGuide() {}
|
|
564
|
+
// file: User.js → export default class User {}
|
|
565
|
+
```
|
|
566
|
+
|
|
567
|
+
### 23. Accessors
|
|
568
|
+
|
|
569
|
+
- Accessor functions for properties are not required.
|
|
570
|
+
- Do not use JavaScript getters/setters as they cause unexpected side effects.
|
|
571
|
+
- If you do make accessor functions, use `getVal()` and `setVal('value')`.
|
|
572
|
+
- If the property/method is a boolean, use `isVal()` or `hasVal()`.
|
|
573
|
+
|
|
574
|
+
```javascript
|
|
575
|
+
// bad
|
|
576
|
+
dragon.age();
|
|
577
|
+
|
|
578
|
+
// good
|
|
579
|
+
dragon.getAge();
|
|
580
|
+
dragon.setAge(25);
|
|
581
|
+
dragon.isAlive();
|
|
582
|
+
dragon.hasWings();
|
|
583
|
+
```
|
|
584
|
+
|
|
585
|
+
### 24. Events
|
|
586
|
+
|
|
587
|
+
- When attaching data payloads to events, pass an object (hash) instead of a raw value.
|
|
588
|
+
|
|
589
|
+
```javascript
|
|
590
|
+
// bad
|
|
591
|
+
emitter.emit('itemUpdate', item.id);
|
|
592
|
+
|
|
593
|
+
// good
|
|
594
|
+
emitter.emit('itemUpdate', { itemId: item.id });
|
|
595
|
+
```
|
|
596
|
+
|
|
597
|
+
### 25. Promises & Async/Await
|
|
598
|
+
|
|
599
|
+
- Prefer `async`/`await` over chaining `.then()` and `.catch()`.
|
|
600
|
+
- Always handle errors with `try...catch` in `async` functions.
|
|
601
|
+
- Avoid mixing callbacks and promises.
|
|
602
|
+
- Use `Promise.all` for concurrent independent async operations.
|
|
603
|
+
- Use `Promise.allSettled` when you need results of all promises regardless of rejection.
|
|
604
|
+
|
|
605
|
+
```javascript
|
|
606
|
+
// bad
|
|
607
|
+
function fetchData() {
|
|
608
|
+
return getData()
|
|
609
|
+
.then((data) => parseData(data))
|
|
610
|
+
.then((parsed) => validate(parsed))
|
|
611
|
+
.catch((err) => console.error(err));
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
// good
|
|
615
|
+
async function fetchData() {
|
|
616
|
+
try {
|
|
617
|
+
const data = await getData();
|
|
618
|
+
const parsed = await parseData(data);
|
|
619
|
+
return validate(parsed);
|
|
620
|
+
} catch (err) {
|
|
621
|
+
console.error(err);
|
|
622
|
+
throw err;
|
|
623
|
+
}
|
|
624
|
+
}
|
|
625
|
+
|
|
626
|
+
// concurrent operations
|
|
627
|
+
async function loadDashboard() {
|
|
628
|
+
const [user, posts, notifications] = await Promise.all([
|
|
629
|
+
fetchUser(),
|
|
630
|
+
fetchPosts(),
|
|
631
|
+
fetchNotifications(),
|
|
632
|
+
]);
|
|
633
|
+
return { user, posts, notifications };
|
|
634
|
+
}
|
|
635
|
+
```
|
|
636
|
+
|
|
637
|
+
### 26. Error Handling
|
|
638
|
+
|
|
639
|
+
- Only throw `Error` objects (or subclasses of `Error`).
|
|
640
|
+
- Always catch errors where they can be meaningfully handled.
|
|
641
|
+
- Use custom error classes for domain-specific errors.
|
|
642
|
+
|
|
643
|
+
```javascript
|
|
644
|
+
// bad
|
|
645
|
+
throw 'Something went wrong';
|
|
646
|
+
throw { message: 'error' };
|
|
647
|
+
|
|
648
|
+
// good
|
|
649
|
+
throw new Error('Something went wrong');
|
|
650
|
+
|
|
651
|
+
class ValidationError extends Error {
|
|
652
|
+
constructor(message, field) {
|
|
653
|
+
super(message);
|
|
654
|
+
this.name = 'ValidationError';
|
|
655
|
+
this.field = field;
|
|
656
|
+
}
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
throw new ValidationError('Invalid email', 'email');
|
|
660
|
+
```
|
|
661
|
+
|
|
662
|
+
### 27. Optional Chaining & Nullish Coalescing
|
|
663
|
+
|
|
664
|
+
- Use optional chaining (`?.`) to access nested properties that may not exist.
|
|
665
|
+
- Use nullish coalescing (`??`) instead of `||` when you want to allow falsy values like `0` or `''`.
|
|
666
|
+
|
|
667
|
+
```javascript
|
|
668
|
+
// bad
|
|
669
|
+
const city = user && user.address && user.address.city;
|
|
670
|
+
const port = config.port || 3000; // breaks if port is 0
|
|
671
|
+
|
|
672
|
+
// good
|
|
673
|
+
const city = user?.address?.city;
|
|
674
|
+
const port = config.port ?? 3000;
|
|
675
|
+
```
|
|
676
|
+
|
|
677
|
+
### 28. Standard Library
|
|
678
|
+
|
|
679
|
+
- Use `Number.isNaN` instead of global `isNaN`.
|
|
680
|
+
- Use `Number.isFinite` instead of global `isFinite`.
|
|
681
|
+
|
|
682
|
+
```javascript
|
|
683
|
+
// bad
|
|
684
|
+
isNaN('1.2');
|
|
685
|
+
isFinite('2e3');
|
|
686
|
+
|
|
687
|
+
// good
|
|
688
|
+
Number.isNaN('1.2');
|
|
689
|
+
Number.isFinite('2e3');
|
|
690
|
+
```
|
|
691
|
+
|
|
692
|
+
---
|
|
693
|
+
|
|
694
|
+
## Usage
|
|
695
|
+
|
|
696
|
+
This is a **Prompt-based Skill** (natural language activation).
|
|
697
|
+
|
|
698
|
+
### How to Use
|
|
699
|
+
|
|
700
|
+
1. **Automatic Activation**: Simply mention "JavaScript" in your request. The skill will be activated automatically.
|
|
701
|
+
|
|
702
|
+
2. **Ask for Style Guidance**:
|
|
703
|
+
```
|
|
704
|
+
"How should I write a JavaScript function that fetches user data?"
|
|
705
|
+
```
|
|
706
|
+
|
|
707
|
+
3. **Request Code Review**:
|
|
708
|
+
```
|
|
709
|
+
"Review this JavaScript code for style issues: [paste code]"
|
|
710
|
+
```
|
|
711
|
+
|
|
712
|
+
4. **Generate Compliant Code**:
|
|
713
|
+
```
|
|
714
|
+
"Write a JavaScript module to handle form validation"
|
|
715
|
+
```
|
|
716
|
+
|
|
717
|
+
5. **Ask About Specific Rules**:
|
|
718
|
+
```
|
|
719
|
+
"What's the correct way to declare variables in JavaScript?"
|
|
720
|
+
"How should I handle async errors in JavaScript?"
|
|
721
|
+
```
|
|
722
|
+
|
|
723
|
+
### Examples
|
|
724
|
+
|
|
725
|
+
**User**: Write a JavaScript utility function to deep clone an object.
|
|
726
|
+
|
|
727
|
+
**Skill Response**: Generates clean, style-guide-compliant code:
|
|
728
|
+
|
|
729
|
+
```javascript
|
|
730
|
+
/**
|
|
731
|
+
* Deep clones a plain object or array using structured cloning.
|
|
732
|
+
* Falls back to JSON serialization for environments without structuredClone.
|
|
733
|
+
*
|
|
734
|
+
* @param {Object|Array} source - The value to clone.
|
|
735
|
+
* @returns {Object|Array} A deep copy of the source.
|
|
736
|
+
*/
|
|
737
|
+
function deepClone(source) {
|
|
738
|
+
if (typeof structuredClone === 'function') {
|
|
739
|
+
return structuredClone(source);
|
|
740
|
+
}
|
|
741
|
+
|
|
742
|
+
return JSON.parse(JSON.stringify(source));
|
|
743
|
+
}
|
|
744
|
+
|
|
745
|
+
export default deepClone;
|
|
746
|
+
```
|