oh-my-customcodex 0.1.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/LICENSE +21 -0
- package/README.md +327 -0
- package/dist/cli/index.js +32054 -0
- package/dist/index.js +5469 -0
- package/package.json +89 -0
- package/templates/.claude/agents/arch-documenter.md +38 -0
- package/templates/.claude/agents/arch-speckit-agent.md +66 -0
- package/templates/.claude/agents/be-django-expert.md +47 -0
- package/templates/.claude/agents/be-express-expert.md +31 -0
- package/templates/.claude/agents/be-fastapi-expert.md +45 -0
- package/templates/.claude/agents/be-go-backend-expert.md +45 -0
- package/templates/.claude/agents/be-nestjs-expert.md +29 -0
- package/templates/.claude/agents/be-springboot-expert.md +42 -0
- package/templates/.claude/agents/db-alembic-expert.md +73 -0
- package/templates/.claude/agents/db-postgres-expert.md +38 -0
- package/templates/.claude/agents/db-redis-expert.md +38 -0
- package/templates/.claude/agents/db-supabase-expert.md +37 -0
- package/templates/.claude/agents/de-airflow-expert.md +48 -0
- package/templates/.claude/agents/de-dbt-expert.md +36 -0
- package/templates/.claude/agents/de-kafka-expert.md +83 -0
- package/templates/.claude/agents/de-pipeline-expert.md +34 -0
- package/templates/.claude/agents/de-snowflake-expert.md +38 -0
- package/templates/.claude/agents/de-spark-expert.md +38 -0
- package/templates/.claude/agents/fe-design-expert.md +120 -0
- package/templates/.claude/agents/fe-flutter-agent.md +48 -0
- package/templates/.claude/agents/fe-svelte-agent.md +33 -0
- package/templates/.claude/agents/fe-vercel-agent.md +40 -0
- package/templates/.claude/agents/fe-vuejs-agent.md +34 -0
- package/templates/.claude/agents/infra-aws-expert.md +49 -0
- package/templates/.claude/agents/infra-docker-expert.md +49 -0
- package/templates/.claude/agents/lang-golang-expert.md +46 -0
- package/templates/.claude/agents/lang-java21-expert.md +42 -0
- package/templates/.claude/agents/lang-kotlin-expert.md +45 -0
- package/templates/.claude/agents/lang-python-expert.md +45 -0
- package/templates/.claude/agents/lang-rust-expert.md +45 -0
- package/templates/.claude/agents/lang-typescript-expert.md +45 -0
- package/templates/.claude/agents/mgr-claude-code-bible.md +62 -0
- package/templates/.claude/agents/mgr-creator.md +57 -0
- package/templates/.claude/agents/mgr-gitnerd.md +50 -0
- package/templates/.claude/agents/mgr-sauron.md +163 -0
- package/templates/.claude/agents/mgr-supplier.md +39 -0
- package/templates/.claude/agents/mgr-updater.md +40 -0
- package/templates/.claude/agents/qa-engineer.md +36 -0
- package/templates/.claude/agents/qa-planner.md +78 -0
- package/templates/.claude/agents/qa-writer.md +32 -0
- package/templates/.claude/agents/sec-codeql-expert.md +56 -0
- package/templates/.claude/agents/slack-cli-expert.md +98 -0
- package/templates/.claude/agents/souls/lang-golang-expert.soul.md +21 -0
- package/templates/.claude/agents/sys-memory-keeper.md +123 -0
- package/templates/.claude/agents/sys-naggy.md +76 -0
- package/templates/.claude/agents/tool-bun-expert.md +26 -0
- package/templates/.claude/agents/tool-npm-expert.md +31 -0
- package/templates/.claude/agents/tool-optimizer.md +37 -0
- package/templates/.claude/agents/wiki-curator.md +72 -0
- package/templates/.claude/config/required-plugins.json +30 -0
- package/templates/.claude/contexts/dev.md +20 -0
- package/templates/.claude/contexts/ecomode.md +110 -0
- package/templates/.claude/contexts/index.yaml +41 -0
- package/templates/.claude/contexts/research.md +28 -0
- package/templates/.claude/contexts/review.md +23 -0
- package/templates/.claude/hooks/hooks.json +533 -0
- package/templates/.claude/hooks/scripts/adaptive-harness-scan.sh +45 -0
- package/templates/.claude/hooks/scripts/agent-start-recorder.sh +40 -0
- package/templates/.claude/hooks/scripts/agent-teams-advisor.sh +76 -0
- package/templates/.claude/hooks/scripts/audit-log.sh +64 -0
- package/templates/.claude/hooks/scripts/auto-continue-guard.sh +33 -0
- package/templates/.claude/hooks/scripts/content-hash-validator.sh +75 -0
- package/templates/.claude/hooks/scripts/context-budget-advisor.sh +107 -0
- package/templates/.claude/hooks/scripts/cost-cap-advisor.sh +71 -0
- package/templates/.claude/hooks/scripts/cwd-change-detector.sh +36 -0
- package/templates/.claude/hooks/scripts/eval-core-batch-save.sh +46 -0
- package/templates/.claude/hooks/scripts/feedback-collector.sh +92 -0
- package/templates/.claude/hooks/scripts/file-change-validator.sh +26 -0
- package/templates/.claude/hooks/scripts/git-delegation-guard.sh +57 -0
- package/templates/.claude/hooks/scripts/model-escalation-advisor.sh +106 -0
- package/templates/.claude/hooks/scripts/omcodex-auto-update.sh +4 -0
- package/templates/.claude/hooks/scripts/omcustom-auto-update.sh +177 -0
- package/templates/.claude/hooks/scripts/rtk-intercept.sh +77 -0
- package/templates/.claude/hooks/scripts/rule-deletion-guard.sh +60 -0
- package/templates/.claude/hooks/scripts/schema-validator.sh +106 -0
- package/templates/.claude/hooks/scripts/secret-filter.sh +100 -0
- package/templates/.claude/hooks/scripts/session-autofix-prompt.sh +34 -0
- package/templates/.claude/hooks/scripts/session-autofix.sh +146 -0
- package/templates/.claude/hooks/scripts/session-env-check.sh +254 -0
- package/templates/.claude/hooks/scripts/skill-extractor-analyzer.sh +49 -0
- package/templates/.claude/hooks/scripts/stage-blocker.sh +16 -0
- package/templates/.claude/hooks/scripts/stale-todo-scanner.sh +91 -0
- package/templates/.claude/hooks/scripts/stall-detection-advisor.sh +112 -0
- package/templates/.claude/hooks/scripts/stop-console-audit.sh +46 -0
- package/templates/.claude/hooks/scripts/stuck-detector.sh +199 -0
- package/templates/.claude/hooks/scripts/task-outcome-recorder.sh +119 -0
- package/templates/.claude/hooks/scripts/task-state-precompact.sh +58 -0
- package/templates/.claude/hooks/scripts/user-prompt-preprocessor.sh +32 -0
- package/templates/.claude/hooks/skill-count-reminder.sh +34 -0
- package/templates/.claude/install-hooks.sh +100 -0
- package/templates/.claude/ontology/agents.yaml +546 -0
- package/templates/.claude/ontology/graphs/agent-skill.json +102 -0
- package/templates/.claude/ontology/graphs/full-graph.json +629 -0
- package/templates/.claude/ontology/graphs/routing.json +112 -0
- package/templates/.claude/ontology/graphs/skill-rule.json +78 -0
- package/templates/.claude/ontology/rules.yaml +251 -0
- package/templates/.claude/ontology/schema.yaml +144 -0
- package/templates/.claude/ontology/skills.yaml +575 -0
- package/templates/.claude/rules/MAY-optimization.md +42 -0
- package/templates/.claude/rules/MUST-agent-design.md +340 -0
- package/templates/.claude/rules/MUST-agent-identification.md +77 -0
- package/templates/.claude/rules/MUST-agent-teams.md +293 -0
- package/templates/.claude/rules/MUST-completion-verification.md +112 -0
- package/templates/.claude/rules/MUST-continuous-improvement.md +69 -0
- package/templates/.claude/rules/MUST-enforcement-policy.md +50 -0
- package/templates/.claude/rules/MUST-intent-transparency.md +74 -0
- package/templates/.claude/rules/MUST-language-policy.md +28 -0
- package/templates/.claude/rules/MUST-orchestrator-coordination.md +399 -0
- package/templates/.claude/rules/MUST-parallel-execution.md +184 -0
- package/templates/.claude/rules/MUST-permissions.md +32 -0
- package/templates/.claude/rules/MUST-safety.md +23 -0
- package/templates/.claude/rules/MUST-sync-verification.md +145 -0
- package/templates/.claude/rules/MUST-tool-identification.md +97 -0
- package/templates/.claude/rules/SHOULD-ecomode.md +123 -0
- package/templates/.claude/rules/SHOULD-error-handling.md +33 -0
- package/templates/.claude/rules/SHOULD-hud-statusline.md +51 -0
- package/templates/.claude/rules/SHOULD-interaction.md +77 -0
- package/templates/.claude/rules/SHOULD-memory-integration.md +371 -0
- package/templates/.claude/rules/SHOULD-ontology-rag-routing.md +49 -0
- package/templates/.claude/rules/SHOULD-wiki-sync.md +73 -0
- package/templates/.claude/rules/index.yaml +141 -0
- package/templates/.claude/schemas/tool-inputs.json +62 -0
- package/templates/.claude/skills/action-validator/SKILL.md +89 -0
- package/templates/.claude/skills/adaptive-harness/SKILL.md +335 -0
- package/templates/.claude/skills/adversarial-review/SKILL.md +80 -0
- package/templates/.claude/skills/agora/SKILL.md +194 -0
- package/templates/.claude/skills/airflow-best-practices/SKILL.md +94 -0
- package/templates/.claude/skills/alembic-best-practices/SKILL.md +295 -0
- package/templates/.claude/skills/ambiguity-gate/SKILL.md +94 -0
- package/templates/.claude/skills/analysis/SKILL.md +223 -0
- package/templates/.claude/skills/audit-agents/SKILL.md +118 -0
- package/templates/.claude/skills/aws-best-practices/SKILL.md +281 -0
- package/templates/.claude/skills/claude-code-bible/SKILL.md +93 -0
- package/templates/.claude/skills/claude-code-bible/scripts/fetch-docs.js +244 -0
- package/templates/.claude/skills/claude-native/SKILL.md +215 -0
- package/templates/.claude/skills/codex-exec/SKILL.md +206 -0
- package/templates/.claude/skills/codex-exec/scripts/codex-wrapper.cjs +430 -0
- package/templates/.claude/skills/create-agent/SKILL.md +94 -0
- package/templates/.claude/skills/cve-triage/SKILL.md +91 -0
- package/templates/.claude/skills/dag-orchestration/SKILL.md +201 -0
- package/templates/.claude/skills/dbt-best-practices/SKILL.md +55 -0
- package/templates/.claude/skills/de-lead-routing/SKILL.md +230 -0
- package/templates/.claude/skills/deep-plan/SKILL.md +344 -0
- package/templates/.claude/skills/deep-verify/SKILL.md +111 -0
- package/templates/.claude/skills/dev-lead-routing/SKILL.md +161 -0
- package/templates/.claude/skills/dev-refactor/SKILL.md +234 -0
- package/templates/.claude/skills/dev-review/SKILL.md +172 -0
- package/templates/.claude/skills/django-best-practices/SKILL.md +334 -0
- package/templates/.claude/skills/docker-best-practices/SKILL.md +276 -0
- package/templates/.claude/skills/evaluator-optimizer/SKILL.md +421 -0
- package/templates/.claude/skills/fastapi-best-practices/SKILL.md +271 -0
- package/templates/.claude/skills/fix-refs/SKILL.md +109 -0
- package/templates/.claude/skills/flutter-best-practices/SKILL.md +325 -0
- package/templates/.claude/skills/gemini-exec/SKILL.md +215 -0
- package/templates/.claude/skills/gemini-exec/scripts/gemini-wrapper.cjs +485 -0
- package/templates/.claude/skills/go-backend-best-practices/SKILL.md +135 -0
- package/templates/.claude/skills/go-best-practices/SKILL.md +204 -0
- package/templates/.claude/skills/hada-scout/SKILL.md +92 -0
- package/templates/.claude/skills/harness-eval/SKILL.md +95 -0
- package/templates/.claude/skills/harness-synthesizer/SKILL.md +145 -0
- package/templates/.claude/skills/help/SKILL.md +127 -0
- package/templates/.claude/skills/idea/SKILL.md +88 -0
- package/templates/.claude/skills/impeccable-design/SKILL.md +173 -0
- package/templates/.claude/skills/intent-detection/SKILL.md +293 -0
- package/templates/.claude/skills/intent-detection/patterns/agent-triggers.yaml +438 -0
- package/templates/.claude/skills/java21-best-practices/SKILL.md +190 -0
- package/templates/.claude/skills/jinja2-prompts/SKILL.md +86 -0
- package/templates/.claude/skills/kafka-best-practices/SKILL.md +53 -0
- package/templates/.claude/skills/kotlin-best-practices/SKILL.md +257 -0
- package/templates/.claude/skills/lists/SKILL.md +80 -0
- package/templates/.claude/skills/memory-management/SKILL.md +196 -0
- package/templates/.claude/skills/memory-recall/SKILL.md +172 -0
- package/templates/.claude/skills/memory-save/SKILL.md +128 -0
- package/templates/.claude/skills/model-escalation/SKILL.md +62 -0
- package/templates/.claude/skills/monitoring-setup/SKILL.md +215 -0
- package/templates/.claude/skills/multi-model-verification/SKILL.md +130 -0
- package/templates/.claude/skills/npm-audit/SKILL.md +74 -0
- package/templates/.claude/skills/npm-publish/SKILL.md +65 -0
- package/templates/.claude/skills/npm-version/SKILL.md +104 -0
- package/templates/.claude/skills/omcodex-auto-improve/SKILL.md +136 -0
- package/templates/.claude/skills/omcodex-feedback/SKILL.md +205 -0
- package/templates/.claude/skills/omcodex-improve-report/SKILL.md +65 -0
- package/templates/.claude/skills/omcodex-loop/SKILL.md +45 -0
- package/templates/.claude/skills/omcodex-release-notes/SKILL.md +117 -0
- package/templates/.claude/skills/omcodex-takeover/SKILL.md +115 -0
- package/templates/.claude/skills/omcodex-web/SKILL.md +95 -0
- package/templates/.claude/skills/optimize-analyze/SKILL.md +57 -0
- package/templates/.claude/skills/optimize-bundle/SKILL.md +69 -0
- package/templates/.claude/skills/optimize-report/SKILL.md +76 -0
- package/templates/.claude/skills/peer-messaging/SKILL.md +59 -0
- package/templates/.claude/skills/pipeline/SKILL.md +103 -0
- package/templates/.claude/skills/pipeline-architecture-patterns/SKILL.md +84 -0
- package/templates/.claude/skills/pipeline-guards/SKILL.md +173 -0
- package/templates/.claude/skills/post-release-followup/SKILL.md +134 -0
- package/templates/.claude/skills/postgres-best-practices/SKILL.md +67 -0
- package/templates/.claude/skills/pr-auto-improve/SKILL.md +129 -0
- package/templates/.claude/skills/professor-triage/SKILL.md +321 -0
- package/templates/.claude/skills/python-best-practices/SKILL.md +223 -0
- package/templates/.claude/skills/qa-lead-routing/SKILL.md +104 -0
- package/templates/.claude/skills/react-best-practices/SKILL.md +102 -0
- package/templates/.claude/skills/reasoning-sandwich/SKILL.md +64 -0
- package/templates/.claude/skills/redis-best-practices/SKILL.md +84 -0
- package/templates/.claude/skills/release-plan/SKILL.md +207 -0
- package/templates/.claude/skills/research/SKILL.md +493 -0
- package/templates/.claude/skills/result-aggregation/SKILL.md +165 -0
- package/templates/.claude/skills/rtk-exec/SKILL.md +199 -0
- package/templates/.claude/skills/rtk-exec/scripts/rtk-wrapper.cjs +377 -0
- package/templates/.claude/skills/rust-best-practices/SKILL.md +268 -0
- package/templates/.claude/skills/sauron-watch/SKILL.md +239 -0
- package/templates/.claude/skills/scout/SKILL.md +250 -0
- package/templates/.claude/skills/sdd/SKILL.md +24 -0
- package/templates/.claude/skills/sdd-dev/SKILL.md +257 -0
- package/templates/.claude/skills/sdd-development/SKILL.md +24 -0
- package/templates/.claude/skills/secretary-routing/SKILL.md +132 -0
- package/templates/.claude/skills/skill-extractor/SKILL.md +155 -0
- package/templates/.claude/skills/skills-sh-search/SKILL.md +210 -0
- package/templates/.claude/skills/snowflake-best-practices/SKILL.md +66 -0
- package/templates/.claude/skills/spark-best-practices/SKILL.md +53 -0
- package/templates/.claude/skills/springboot-best-practices/SKILL.md +74 -0
- package/templates/.claude/skills/springboot-best-practices/examples/config-properties-example.java +22 -0
- package/templates/.claude/skills/springboot-best-practices/examples/controller-example.java +28 -0
- package/templates/.claude/skills/springboot-best-practices/examples/controller-test-example.java +33 -0
- package/templates/.claude/skills/springboot-best-practices/examples/entity-example.java +22 -0
- package/templates/.claude/skills/springboot-best-practices/examples/exception-handler-example.java +30 -0
- package/templates/.claude/skills/springboot-best-practices/examples/repository-example.java +17 -0
- package/templates/.claude/skills/springboot-best-practices/examples/repository-test-example.java +23 -0
- package/templates/.claude/skills/springboot-best-practices/examples/security-config-example.java +27 -0
- package/templates/.claude/skills/springboot-best-practices/examples/service-example.java +33 -0
- package/templates/.claude/skills/status/SKILL.md +155 -0
- package/templates/.claude/skills/structured-dev-cycle/SKILL.md +200 -0
- package/templates/.claude/skills/stuck-recovery/SKILL.md +80 -0
- package/templates/.claude/skills/supabase-postgres-best-practices/SKILL.md +100 -0
- package/templates/.claude/skills/systematic-debugging/SKILL.md +288 -0
- package/templates/.claude/skills/systematic-debugging/condition-based-waiting-example.ts +278 -0
- package/templates/.claude/skills/systematic-debugging/condition-based-waiting.md +240 -0
- package/templates/.claude/skills/systematic-debugging/defense-in-depth.md +252 -0
- package/templates/.claude/skills/systematic-debugging/find-polluter.sh +147 -0
- package/templates/.claude/skills/systematic-debugging/root-cause-tracing.md +87 -0
- package/templates/.claude/skills/task-decomposition/SKILL.md +197 -0
- package/templates/.claude/skills/typescript-best-practices/SKILL.md +322 -0
- package/templates/.claude/skills/update-docs/SKILL.md +142 -0
- package/templates/.claude/skills/update-external/SKILL.md +169 -0
- package/templates/.claude/skills/vercel-deploy/SKILL.md +75 -0
- package/templates/.claude/skills/web-design-guidelines/SKILL.md +119 -0
- package/templates/.claude/skills/wiki/SKILL.md +426 -0
- package/templates/.claude/skills/wiki-rag/SKILL.md +154 -0
- package/templates/.claude/skills/worker-reviewer-pipeline/SKILL.md +165 -0
- package/templates/.claude/skills/writing-clearly-and-concisely/SKILL.md +66 -0
- package/templates/.claude/statusline.sh +380 -0
- package/templates/.claude/uninstall-hooks.sh +52 -0
- package/templates/.github/workflows/wiki-sync.yml +132 -0
- package/templates/AGENTS.md.en +255 -0
- package/templates/AGENTS.md.ko +255 -0
- package/templates/CLAUDE.md +263 -0
- package/templates/CLAUDE.md.en +256 -0
- package/templates/CLAUDE.md.ko +256 -0
- package/templates/deprecated-files.json +10 -0
- package/templates/guides/agents-md-quality/README.md +110 -0
- package/templates/guides/airflow/README.md +47 -0
- package/templates/guides/alembic/README.md +438 -0
- package/templates/guides/aws/common-patterns.md +169 -0
- package/templates/guides/aws/index.yaml +26 -0
- package/templates/guides/aws/well-architected.md +143 -0
- package/templates/guides/cc-token-saver/README.md +97 -0
- package/templates/guides/claude-code/01-overview.md +42 -0
- package/templates/guides/claude-code/03-tools.md +107 -0
- package/templates/guides/claude-code/04-agent-skills.md +90 -0
- package/templates/guides/claude-code/05-agent-sdk.md +129 -0
- package/templates/guides/claude-code/06-mcp.md +165 -0
- package/templates/guides/claude-code/07-prompt-engineering.md +100 -0
- package/templates/guides/claude-code/08-testing.md +56 -0
- package/templates/guides/claude-code/09-guardrails.md +78 -0
- package/templates/guides/claude-code/10-monitoring.md +87 -0
- package/templates/guides/claude-code/11-sub-agents.md +159 -0
- package/templates/guides/claude-code/12-workflow-patterns.md +182 -0
- package/templates/guides/claude-code/13-cli-flags.md +151 -0
- package/templates/guides/claude-code/index.yaml +61 -0
- package/templates/guides/dbt/README.md +32 -0
- package/templates/guides/django-best-practices/README.md +476 -0
- package/templates/guides/docker/compose-best-practices.md +284 -0
- package/templates/guides/docker/dockerfile-best-practices.md +262 -0
- package/templates/guides/docker/index.yaml +26 -0
- package/templates/guides/drizzle-orm/README.md +69 -0
- package/templates/guides/elements-of-style/elements-of-style.html +2609 -0
- package/templates/guides/fastapi/best-practices.md +232 -0
- package/templates/guides/fastapi/index.yaml +21 -0
- package/templates/guides/flutter/architecture.md +141 -0
- package/templates/guides/flutter/fundamentals.md +119 -0
- package/templates/guides/flutter/index.yaml +44 -0
- package/templates/guides/flutter/performance.md +119 -0
- package/templates/guides/flutter/security.md +120 -0
- package/templates/guides/flutter/state-management.md +144 -0
- package/templates/guides/flutter/testing.md +155 -0
- package/templates/guides/git-worktree-workflow/README.md +138 -0
- package/templates/guides/go-backend/index.yaml +26 -0
- package/templates/guides/go-backend/project-layout.md +243 -0
- package/templates/guides/go-backend/uber-style.md +212 -0
- package/templates/guides/golang/concurrency.md +282 -0
- package/templates/guides/golang/effective-go.md +309 -0
- package/templates/guides/golang/error-handling.md +250 -0
- package/templates/guides/golang/index.yaml +27 -0
- package/templates/guides/hook-data-flow/README.md +135 -0
- package/templates/guides/iceberg/README.md +49 -0
- package/templates/guides/impeccable-design/color-and-contrast.md +278 -0
- package/templates/guides/impeccable-design/index.yaml +12 -0
- package/templates/guides/impeccable-design/motion-design.md +390 -0
- package/templates/guides/impeccable-design/typography.md +386 -0
- package/templates/guides/impeccable-design/ux-writing.md +400 -0
- package/templates/guides/index.yaml +265 -0
- package/templates/guides/java21/index.yaml +29 -0
- package/templates/guides/java21/java-style-guide.md +248 -0
- package/templates/guides/java21/modern-java21.md +303 -0
- package/templates/guides/kafka/README.md +32 -0
- package/templates/guides/kotlin/coding-conventions.md +247 -0
- package/templates/guides/kotlin/idioms.md +234 -0
- package/templates/guides/kotlin/index.yaml +26 -0
- package/templates/guides/multi-model-routing/README.md +101 -0
- package/templates/guides/multi-provider-exec/README.md +83 -0
- package/templates/guides/postgres/README.md +58 -0
- package/templates/guides/python/index.yaml +26 -0
- package/templates/guides/python/pep8-style-guide.md +202 -0
- package/templates/guides/python/zen-of-python.md +79 -0
- package/templates/guides/redis/README.md +50 -0
- package/templates/guides/rust/error-handling.md +262 -0
- package/templates/guides/rust/index.yaml +26 -0
- package/templates/guides/rust/ownership.md +180 -0
- package/templates/guides/skill-bundle-design/README.md +106 -0
- package/templates/guides/slack-cli/README.md +145 -0
- package/templates/guides/snowflake/README.md +32 -0
- package/templates/guides/spark/README.md +32 -0
- package/templates/guides/springboot/best-practices.md +361 -0
- package/templates/guides/springboot/index.yaml +22 -0
- package/templates/guides/supabase-postgres/README.md +32 -0
- package/templates/guides/supabase-postgres/index.yaml +19 -0
- package/templates/guides/typescript/advanced-types.md +225 -0
- package/templates/guides/typescript/index.yaml +26 -0
- package/templates/guides/typescript/type-system.md +219 -0
- package/templates/guides/web-design/accessibility.md +66 -0
- package/templates/guides/web-design/index.yaml +20 -0
- package/templates/guides/web-design/performance.md +102 -0
- package/templates/guides/web-scraping/README.md +926 -0
- package/templates/guides/web-scraping/index.yaml +19 -0
- package/templates/guides/worktree-lifecycle/README.md +104 -0
- package/templates/index.yaml +18 -0
- package/templates/manifest.json +49 -0
- package/templates/workflows/auto-dev.yaml +46 -0
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# Root Cause Tracing
|
|
2
|
+
|
|
3
|
+
<!-- Source: https://github.com/tmdgusya/engineering-disciplines (MIT License) -->
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
Bugs often manifest deep in the call stack (git init in wrong directory, file created in wrong location, database opened with wrong path). Your instinct is to fix where the error appears, but that's treating a symptom.
|
|
8
|
+
|
|
9
|
+
**Core principle:** Trace backward through the call chain until you find the original trigger, then fix at the source.
|
|
10
|
+
|
|
11
|
+
## When to Use
|
|
12
|
+
|
|
13
|
+
**Use when:**
|
|
14
|
+
- Error happens deep in execution (not at entry point)
|
|
15
|
+
- Stack trace shows long call chain
|
|
16
|
+
- Unclear where invalid data originated
|
|
17
|
+
- Need to find which test/code triggers the problem
|
|
18
|
+
|
|
19
|
+
## The Tracing Process
|
|
20
|
+
|
|
21
|
+
### 1. Observe the Symptom
|
|
22
|
+
```
|
|
23
|
+
Error: git init failed in /Users/jesse/project/packages/core
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### 2. Find Immediate Cause
|
|
27
|
+
**What code directly causes this?**
|
|
28
|
+
```typescript
|
|
29
|
+
await execFileAsync('git', ['init'], { cwd: projectDir });
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### 3. Ask: What Called This?
|
|
33
|
+
```typescript
|
|
34
|
+
WorktreeManager.createSessionWorktree(projectDir, sessionId)
|
|
35
|
+
-> called by Session.initializeWorkspace()
|
|
36
|
+
-> called by Session.create()
|
|
37
|
+
-> called by test at Project.create()
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### 4. Keep Tracing Up
|
|
41
|
+
**What value was passed?**
|
|
42
|
+
- `projectDir = ''` (empty string!)
|
|
43
|
+
- Empty string as `cwd` resolves to `process.cwd()`
|
|
44
|
+
- That's the source code directory!
|
|
45
|
+
|
|
46
|
+
### 5. Find Original Trigger
|
|
47
|
+
**Where did empty string come from?**
|
|
48
|
+
```typescript
|
|
49
|
+
const context = setupCoreTest(); // Returns { tempDir: '' }
|
|
50
|
+
Project.create('name', context.tempDir); // Accessed before beforeEach!
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Adding Stack Traces
|
|
54
|
+
|
|
55
|
+
When you can't trace manually, add instrumentation:
|
|
56
|
+
|
|
57
|
+
```typescript
|
|
58
|
+
// Before the problematic operation
|
|
59
|
+
async function gitInit(directory: string) {
|
|
60
|
+
const stack = new Error().stack;
|
|
61
|
+
console.error('DEBUG git init:', {
|
|
62
|
+
directory,
|
|
63
|
+
cwd: process.cwd(),
|
|
64
|
+
nodeEnv: process.env.NODE_ENV,
|
|
65
|
+
stack,
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
await execFileAsync('git', ['init'], { cwd: directory });
|
|
69
|
+
}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
**Critical:** Use `console.error()` in tests (not logger - may not show)
|
|
73
|
+
|
|
74
|
+
## Finding Which Test Causes Pollution
|
|
75
|
+
|
|
76
|
+
If something appears during tests but you don't know which test, use the bisection script `find-polluter.sh` in this directory.
|
|
77
|
+
|
|
78
|
+
## Key Principle
|
|
79
|
+
|
|
80
|
+
**NEVER fix just where the error appears.** Trace back to find the original trigger.
|
|
81
|
+
|
|
82
|
+
## Stack Trace Tips
|
|
83
|
+
|
|
84
|
+
- **In tests:** Use `console.error()` not logger - logger may be suppressed
|
|
85
|
+
- **Before operation:** Log before the dangerous operation, not after it fails
|
|
86
|
+
- **Include context:** Directory, cwd, environment variables, timestamps
|
|
87
|
+
- **Capture stack:** `new Error().stack` shows complete call chain
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: task-decomposition
|
|
3
|
+
description: Auto-decompose large tasks into DAG-compatible parallel subtasks
|
|
4
|
+
scope: core
|
|
5
|
+
context: fork
|
|
6
|
+
user-invocable: false
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Task Decomposition Skill
|
|
10
|
+
|
|
11
|
+
Analyzes task complexity and decomposes large tasks into smaller, parallelizable subtasks compatible with the DAG orchestration skill. The orchestrator uses this as a planning frontend before execution.
|
|
12
|
+
|
|
13
|
+
## Trigger Conditions
|
|
14
|
+
|
|
15
|
+
Decomposition is **recommended** when any of these thresholds are met:
|
|
16
|
+
|
|
17
|
+
| Trigger | Threshold | Rationale |
|
|
18
|
+
|---------|-----------|-----------|
|
|
19
|
+
| Estimated duration | > 30 minutes | Too long for single agent |
|
|
20
|
+
| Files affected | > 3 files | Parallelizable across files |
|
|
21
|
+
| Domains involved | > 2 domains | Requires multiple specialists |
|
|
22
|
+
| Agent types needed | > 2 types | Cross-specialty coordination |
|
|
23
|
+
|
|
24
|
+
### Step 0: Pattern Selection
|
|
25
|
+
|
|
26
|
+
Before decomposing, select the appropriate workflow pattern:
|
|
27
|
+
|
|
28
|
+
| Pattern | When to Use | Primitive |
|
|
29
|
+
|---------|-------------|-----------|
|
|
30
|
+
| Sequential | Steps must execute in order, each depends on previous | dag-orchestration (linear) |
|
|
31
|
+
| Parallel | Independent subtasks with no shared state | Agent tool (R009) or Agent Teams (R018) |
|
|
32
|
+
| Evaluator-Optimizer | Quality-critical output needing iterative refinement | worker-reviewer-pipeline |
|
|
33
|
+
| Orchestrator | Complex multi-step with dynamic routing | Routing skills (secretary/dev-lead/de-lead/qa-lead) |
|
|
34
|
+
|
|
35
|
+
**Decision**: If task has independent subtasks → Parallel. If quality-critical → add EO review cycle. If multi-step with dependencies → Sequential/Orchestrator.
|
|
36
|
+
|
|
37
|
+
## Decomposition Process
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
1. Analyze task scope
|
|
41
|
+
├── Estimate duration, file count, domains
|
|
42
|
+
├── Identify required agent types
|
|
43
|
+
└── Check trigger thresholds
|
|
44
|
+
|
|
45
|
+
2. If thresholds met → decompose:
|
|
46
|
+
├── Break into atomic subtasks (single agent, single concern)
|
|
47
|
+
├── Identify dependencies between subtasks
|
|
48
|
+
├── Map subtasks to agents (use routing skills)
|
|
49
|
+
└── Generate DAG workflow spec
|
|
50
|
+
|
|
51
|
+
3. Present plan to user (R015 transparency)
|
|
52
|
+
├── Show decomposed subtasks with agents
|
|
53
|
+
├── Show dependency graph
|
|
54
|
+
├── Show estimated parallel execution time
|
|
55
|
+
└── Request confirmation before execution
|
|
56
|
+
|
|
57
|
+
4. Execute via dag-orchestration skill
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Decomposition Heuristics
|
|
61
|
+
|
|
62
|
+
### By File Independence
|
|
63
|
+
```
|
|
64
|
+
Task: "Update auth module across 5 files"
|
|
65
|
+
├── auth.ts → lang-typescript-expert
|
|
66
|
+
├── middleware.ts → lang-typescript-expert
|
|
67
|
+
├── config.ts → lang-typescript-expert (independent)
|
|
68
|
+
├── auth.test.ts → qa-engineer (depends: auth.ts)
|
|
69
|
+
└── README.md → arch-documenter (depends: all above)
|
|
70
|
+
|
|
71
|
+
DAG: [auth.ts, middleware.ts, config.ts] → auth.test.ts → README.md
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### By Domain Separation
|
|
75
|
+
```
|
|
76
|
+
Task: "Add user profile feature with API and UI"
|
|
77
|
+
├── API endpoint → be-express-expert
|
|
78
|
+
├── Database schema → db-postgres-expert
|
|
79
|
+
├── Frontend component → fe-vercel-agent
|
|
80
|
+
└── Integration test → qa-engineer
|
|
81
|
+
|
|
82
|
+
DAG: [API, DB] → Frontend → Integration test
|
|
83
|
+
(API and DB are independent, Frontend needs both)
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### By Layer
|
|
87
|
+
```
|
|
88
|
+
Task: "Implement order processing in Spring Boot"
|
|
89
|
+
├── Domain model → lang-kotlin-expert
|
|
90
|
+
├── Repository → be-springboot-expert (depends: domain)
|
|
91
|
+
├── Service → be-springboot-expert (depends: domain, repository)
|
|
92
|
+
├── Controller → be-springboot-expert (depends: service)
|
|
93
|
+
└── Tests → qa-engineer (depends: all)
|
|
94
|
+
|
|
95
|
+
DAG: domain → [repository] → service → controller → tests
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## Output Format
|
|
99
|
+
|
|
100
|
+
### Decomposition Plan
|
|
101
|
+
```
|
|
102
|
+
[Task Decomposition]
|
|
103
|
+
├── Original: "Add user authentication with JWT"
|
|
104
|
+
├── Complexity: High (4 files, 3 domains, ~45 min)
|
|
105
|
+
├── Decomposed into 5 subtasks:
|
|
106
|
+
│
|
|
107
|
+
│ [1] analyze (Explore:haiku)
|
|
108
|
+
│ Scan codebase for existing auth patterns
|
|
109
|
+
│
|
|
110
|
+
│ [2] implement-auth (lang-typescript-expert:sonnet)
|
|
111
|
+
│ Implement JWT signing and validation
|
|
112
|
+
│ Depends: [1]
|
|
113
|
+
│
|
|
114
|
+
│ [3] implement-middleware (lang-typescript-expert:sonnet)
|
|
115
|
+
│ Create auth middleware
|
|
116
|
+
│ Depends: [1]
|
|
117
|
+
│
|
|
118
|
+
│ [4] write-tests (qa-engineer:sonnet)
|
|
119
|
+
│ Write auth tests
|
|
120
|
+
│ Depends: [2, 3]
|
|
121
|
+
│
|
|
122
|
+
│ [5] commit (mgr-gitnerd:sonnet)
|
|
123
|
+
│ Commit all changes
|
|
124
|
+
│ Depends: [4]
|
|
125
|
+
│
|
|
126
|
+
├── Parallel layers: 3 (max 2 concurrent in layer 2)
|
|
127
|
+
├── Estimated time: ~20 min (vs ~45 min sequential)
|
|
128
|
+
└── Proceed? [Y/n]
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### Generated DAG Spec
|
|
132
|
+
```yaml
|
|
133
|
+
workflow:
|
|
134
|
+
name: auto-decomposed-auth
|
|
135
|
+
description: "Auto-decomposed: Add user authentication with JWT"
|
|
136
|
+
|
|
137
|
+
nodes:
|
|
138
|
+
- id: analyze
|
|
139
|
+
agent: Explore
|
|
140
|
+
model: haiku
|
|
141
|
+
prompt: "Scan codebase for existing auth patterns"
|
|
142
|
+
- id: implement-auth
|
|
143
|
+
agent: lang-typescript-expert
|
|
144
|
+
model: sonnet
|
|
145
|
+
prompt: "Implement JWT signing and validation"
|
|
146
|
+
depends_on: [analyze]
|
|
147
|
+
- id: implement-middleware
|
|
148
|
+
agent: lang-typescript-expert
|
|
149
|
+
model: sonnet
|
|
150
|
+
prompt: "Create auth middleware"
|
|
151
|
+
depends_on: [analyze]
|
|
152
|
+
- id: write-tests
|
|
153
|
+
agent: qa-engineer
|
|
154
|
+
model: sonnet
|
|
155
|
+
prompt: "Write auth tests"
|
|
156
|
+
depends_on: [implement-auth, implement-middleware]
|
|
157
|
+
- id: commit
|
|
158
|
+
agent: mgr-gitnerd
|
|
159
|
+
model: sonnet
|
|
160
|
+
prompt: "Commit all changes"
|
|
161
|
+
depends_on: [write-tests]
|
|
162
|
+
|
|
163
|
+
config:
|
|
164
|
+
max_parallel: 4
|
|
165
|
+
failure_strategy: stop
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
## Atomic Task Criteria
|
|
169
|
+
|
|
170
|
+
A subtask is **atomic** when it meets ALL of:
|
|
171
|
+
- Single agent can handle it
|
|
172
|
+
- Single concern (one logical change)
|
|
173
|
+
- Independently testable outcome
|
|
174
|
+
- < 15 minutes estimated duration
|
|
175
|
+
- < 3 files affected
|
|
176
|
+
|
|
177
|
+
If a subtask is not atomic → decompose further (max 2 levels deep).
|
|
178
|
+
|
|
179
|
+
## Skip Decomposition When
|
|
180
|
+
|
|
181
|
+
| Condition | Reason |
|
|
182
|
+
|-----------|--------|
|
|
183
|
+
| Single file edit | Already atomic |
|
|
184
|
+
| < 10 minutes estimated | Overhead not worth it |
|
|
185
|
+
| User explicitly requests "just do it" | User override |
|
|
186
|
+
| Single domain, single agent | No parallelization benefit |
|
|
187
|
+
|
|
188
|
+
## Integration
|
|
189
|
+
|
|
190
|
+
| Component | Integration |
|
|
191
|
+
|-----------|-------------|
|
|
192
|
+
| dag-orchestration | Generates DAG specs consumed by dag-orchestration |
|
|
193
|
+
| Routing skills | Uses dev-lead/de-lead/qa-lead routing for agent mapping |
|
|
194
|
+
| R009 | Maximizes parallelization within max-4 limit |
|
|
195
|
+
| R010 | Decomposition happens in orchestrator only |
|
|
196
|
+
| R015 | Plan displayed before execution for user approval |
|
|
197
|
+
| R018 | 3+ agents in plan → check Agent Teams eligibility |
|
|
@@ -0,0 +1,322 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: typescript-best-practices
|
|
3
|
+
description: Type-safe TypeScript patterns from industry standards
|
|
4
|
+
scope: core
|
|
5
|
+
user-invocable: false
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## Purpose
|
|
9
|
+
|
|
10
|
+
Apply type-safe TypeScript patterns and best practices from industry standards.
|
|
11
|
+
|
|
12
|
+
## Core Principles
|
|
13
|
+
|
|
14
|
+
```
|
|
15
|
+
Type safety over convenience
|
|
16
|
+
Explicit over implicit
|
|
17
|
+
Prefer strict mode
|
|
18
|
+
Use inference wisely
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Rules
|
|
22
|
+
|
|
23
|
+
### 1. Type System
|
|
24
|
+
|
|
25
|
+
```yaml
|
|
26
|
+
type_inference:
|
|
27
|
+
rely_on: trivially inferred types (primitives, literals)
|
|
28
|
+
annotate: complex expressions, return types, public APIs
|
|
29
|
+
|
|
30
|
+
any_vs_unknown:
|
|
31
|
+
prefer: unknown (requires type narrowing)
|
|
32
|
+
avoid: any (disables type checking)
|
|
33
|
+
if_any_needed: add suppressing comment
|
|
34
|
+
|
|
35
|
+
nullable:
|
|
36
|
+
prefer: "field?: Type"
|
|
37
|
+
avoid: "field: Type | undefined"
|
|
38
|
+
compare_enums: explicitly, not boolean coercion
|
|
39
|
+
|
|
40
|
+
patterns: |
|
|
41
|
+
// Good: unknown with narrowing
|
|
42
|
+
function process(data: unknown): void {
|
|
43
|
+
if (typeof data === 'string') {
|
|
44
|
+
console.log(data.toUpperCase());
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// Avoid: any
|
|
49
|
+
function process(data: any): void {
|
|
50
|
+
console.log(data.toUpperCase()); // No type checking!
|
|
51
|
+
}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### 2. Interfaces vs Types
|
|
55
|
+
|
|
56
|
+
```yaml
|
|
57
|
+
prefer_interfaces:
|
|
58
|
+
- Object type definitions
|
|
59
|
+
- Public API contracts
|
|
60
|
+
- Extendable types
|
|
61
|
+
|
|
62
|
+
use_types_for:
|
|
63
|
+
- Union types
|
|
64
|
+
- Intersection types
|
|
65
|
+
- Mapped types
|
|
66
|
+
- Utility types
|
|
67
|
+
|
|
68
|
+
patterns: |
|
|
69
|
+
// Interface for objects
|
|
70
|
+
interface User {
|
|
71
|
+
id: string;
|
|
72
|
+
name: string;
|
|
73
|
+
email: string;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// Type for unions/utilities
|
|
77
|
+
type Status = 'pending' | 'active' | 'completed';
|
|
78
|
+
type ReadonlyUser = Readonly<User>;
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### 3. Arrays and Generics
|
|
82
|
+
|
|
83
|
+
```yaml
|
|
84
|
+
array_syntax:
|
|
85
|
+
simple_types: "T[]"
|
|
86
|
+
complex_types: "Array<T>"
|
|
87
|
+
|
|
88
|
+
generics:
|
|
89
|
+
naming: single uppercase (T, K, V) or descriptive (TItem, TResult)
|
|
90
|
+
constraints: use extends for type bounds
|
|
91
|
+
defaults: provide when appropriate
|
|
92
|
+
|
|
93
|
+
patterns: |
|
|
94
|
+
// Array syntax
|
|
95
|
+
const numbers: number[] = [1, 2, 3];
|
|
96
|
+
const items: Array<{ id: string; value: number }> = [];
|
|
97
|
+
|
|
98
|
+
// Generic constraints
|
|
99
|
+
function getProperty<T, K extends keyof T>(obj: T, key: K): T[K] {
|
|
100
|
+
return obj[key];
|
|
101
|
+
}
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### 4. Variables and Constants
|
|
105
|
+
|
|
106
|
+
```yaml
|
|
107
|
+
declarations:
|
|
108
|
+
prefer: const
|
|
109
|
+
when_needed: let
|
|
110
|
+
never: var
|
|
111
|
+
|
|
112
|
+
one_per_statement: true
|
|
113
|
+
|
|
114
|
+
patterns: |
|
|
115
|
+
// Good
|
|
116
|
+
const name = 'TypeScript';
|
|
117
|
+
const version = 5.0;
|
|
118
|
+
|
|
119
|
+
// Avoid
|
|
120
|
+
var name = 'TypeScript', version = 5.0;
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### 5. Functions
|
|
124
|
+
|
|
125
|
+
```yaml
|
|
126
|
+
function_declarations:
|
|
127
|
+
named_functions: function declaration
|
|
128
|
+
callbacks: arrow functions
|
|
129
|
+
methods: shorthand syntax
|
|
130
|
+
|
|
131
|
+
parameters:
|
|
132
|
+
prefer_rest: "...args: T[]"
|
|
133
|
+
avoid: arguments object
|
|
134
|
+
|
|
135
|
+
this_handling:
|
|
136
|
+
prefer: arrow functions or explicit parameter
|
|
137
|
+
avoid: rebinding with bind/call/apply
|
|
138
|
+
|
|
139
|
+
patterns: |
|
|
140
|
+
// Function declaration
|
|
141
|
+
function processData(data: Data): Result {
|
|
142
|
+
return transform(data);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// Arrow function for callbacks
|
|
146
|
+
items.map((item) => item.value);
|
|
147
|
+
|
|
148
|
+
// Rest parameters
|
|
149
|
+
function concat(...strings: string[]): string {
|
|
150
|
+
return strings.join('');
|
|
151
|
+
}
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### 6. Classes
|
|
155
|
+
|
|
156
|
+
```yaml
|
|
157
|
+
visibility:
|
|
158
|
+
prefer: explicit modifiers (public, private, protected)
|
|
159
|
+
avoid: private fields (#)
|
|
160
|
+
|
|
161
|
+
initialization:
|
|
162
|
+
prefer: at declaration site
|
|
163
|
+
use: parameter properties in constructors
|
|
164
|
+
|
|
165
|
+
readonly:
|
|
166
|
+
apply_to: non-reassigned properties
|
|
167
|
+
|
|
168
|
+
patterns: |
|
|
169
|
+
class User {
|
|
170
|
+
readonly id: string;
|
|
171
|
+
private email: string;
|
|
172
|
+
|
|
173
|
+
constructor(
|
|
174
|
+
public name: string,
|
|
175
|
+
email: string,
|
|
176
|
+
) {
|
|
177
|
+
this.id = generateId();
|
|
178
|
+
this.email = email;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
### 7. Naming Conventions
|
|
184
|
+
|
|
185
|
+
```yaml
|
|
186
|
+
UpperCamelCase:
|
|
187
|
+
- Classes
|
|
188
|
+
- Interfaces
|
|
189
|
+
- Type aliases
|
|
190
|
+
- Enums
|
|
191
|
+
- Type parameters
|
|
192
|
+
|
|
193
|
+
lowerCamelCase:
|
|
194
|
+
- Variables
|
|
195
|
+
- Parameters
|
|
196
|
+
- Functions
|
|
197
|
+
- Methods
|
|
198
|
+
- Properties
|
|
199
|
+
|
|
200
|
+
CONSTANT_CASE:
|
|
201
|
+
- Global constants
|
|
202
|
+
- Enum values
|
|
203
|
+
- Static readonly fields
|
|
204
|
+
|
|
205
|
+
rules:
|
|
206
|
+
- No leading/trailing underscores
|
|
207
|
+
- No abbreviations (except universal: URL, ID, DNS)
|
|
208
|
+
- Acronyms as whole words: loadHttpUrl, not loadHTTPURL
|
|
209
|
+
- Single-letter names only in 10-line scopes
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
### 8. Control Flow
|
|
213
|
+
|
|
214
|
+
```yaml
|
|
215
|
+
braces:
|
|
216
|
+
always: use braces for all control statements
|
|
217
|
+
|
|
218
|
+
equality:
|
|
219
|
+
always: "=== and !=="
|
|
220
|
+
never: "== and !="
|
|
221
|
+
|
|
222
|
+
loops:
|
|
223
|
+
arrays: for...of
|
|
224
|
+
objects: for...in with hasOwnProperty check
|
|
225
|
+
|
|
226
|
+
patterns: |
|
|
227
|
+
// Always braced
|
|
228
|
+
if (condition) {
|
|
229
|
+
doSomething();
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
// for...of for arrays
|
|
233
|
+
for (const item of items) {
|
|
234
|
+
process(item);
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
// for...in with check
|
|
238
|
+
for (const key in obj) {
|
|
239
|
+
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
240
|
+
process(obj[key]);
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
### 9. Error Handling
|
|
246
|
+
|
|
247
|
+
```yaml
|
|
248
|
+
throwing:
|
|
249
|
+
only: Error instances
|
|
250
|
+
with_message: descriptive error messages
|
|
251
|
+
|
|
252
|
+
catching:
|
|
253
|
+
type: unknown
|
|
254
|
+
validate: before use
|
|
255
|
+
|
|
256
|
+
empty_catch:
|
|
257
|
+
require: rationale comment
|
|
258
|
+
|
|
259
|
+
patterns: |
|
|
260
|
+
// Throw Error instances
|
|
261
|
+
throw new Error('Invalid input');
|
|
262
|
+
|
|
263
|
+
// Catch with unknown
|
|
264
|
+
try {
|
|
265
|
+
riskyOperation();
|
|
266
|
+
} catch (error: unknown) {
|
|
267
|
+
if (error instanceof Error) {
|
|
268
|
+
console.error(error.message);
|
|
269
|
+
}
|
|
270
|
+
throw error;
|
|
271
|
+
}
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
### 10. Imports and Exports
|
|
275
|
+
|
|
276
|
+
```yaml
|
|
277
|
+
imports:
|
|
278
|
+
prefer: named imports
|
|
279
|
+
use_namespace: for large APIs
|
|
280
|
+
prefer_relative: within project
|
|
281
|
+
|
|
282
|
+
exports:
|
|
283
|
+
prefer: named exports
|
|
284
|
+
avoid: default exports
|
|
285
|
+
|
|
286
|
+
patterns: |
|
|
287
|
+
// Named imports
|
|
288
|
+
import { User, UserService } from './user';
|
|
289
|
+
|
|
290
|
+
// Namespace import for large APIs
|
|
291
|
+
import * as fs from 'fs';
|
|
292
|
+
|
|
293
|
+
// Named exports
|
|
294
|
+
export interface User { }
|
|
295
|
+
export function createUser() { }
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
### 11. Disallowed Features
|
|
299
|
+
|
|
300
|
+
```yaml
|
|
301
|
+
never_use:
|
|
302
|
+
- eval() or dynamic code evaluation
|
|
303
|
+
- with statements
|
|
304
|
+
- const enum (use plain enum)
|
|
305
|
+
- debugger statements in production
|
|
306
|
+
- Modifying built-in prototypes
|
|
307
|
+
- Wrapper objects (new String(), new Boolean())
|
|
308
|
+
- Automatic semicolon insertion reliance
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
## Application
|
|
312
|
+
|
|
313
|
+
When writing or reviewing TypeScript code:
|
|
314
|
+
|
|
315
|
+
1. **Always** enable strict mode
|
|
316
|
+
2. **Always** use explicit return types for public APIs
|
|
317
|
+
3. **Prefer** unknown over any
|
|
318
|
+
4. **Prefer** interfaces for object types
|
|
319
|
+
5. **Use** const by default
|
|
320
|
+
6. **Use** triple equals exclusively
|
|
321
|
+
7. **Handle** errors with typed catch blocks
|
|
322
|
+
8. **Avoid** default exports
|