@djm204/agent-skills 1.0.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/README.md +597 -0
- package/bin/cli.js +8 -0
- package/package.json +55 -0
- package/src/index.js +1817 -0
- package/src/index.test.js +1264 -0
- package/templates/_shared/code-quality.mdc +52 -0
- package/templates/_shared/communication.mdc +43 -0
- package/templates/_shared/core-principles.mdc +67 -0
- package/templates/_shared/git-workflow.mdc +48 -0
- package/templates/_shared/security-fundamentals.mdc +41 -0
- package/templates/agents/utility-agent/.cursor/rules/action-control.mdc +71 -0
- package/templates/agents/utility-agent/.cursor/rules/context-management.mdc +61 -0
- package/templates/agents/utility-agent/.cursor/rules/hallucination-prevention.mdc +58 -0
- package/templates/agents/utility-agent/.cursor/rules/overview.mdc +34 -0
- package/templates/agents/utility-agent/.cursor/rules/token-optimization.mdc +71 -0
- package/templates/agents/utility-agent/CLAUDE.md +513 -0
- package/templates/business/market-intelligence/.cursor/rules/data-sources.mdc +62 -0
- package/templates/business/market-intelligence/.cursor/rules/overview.mdc +55 -0
- package/templates/business/market-intelligence/.cursor/rules/reporting.mdc +59 -0
- package/templates/business/market-intelligence/.cursor/rules/risk-signals.mdc +63 -0
- package/templates/business/market-intelligence/.cursor/rules/sentiment-analysis.mdc +70 -0
- package/templates/business/market-intelligence/.cursor/rules/trend-detection.mdc +72 -0
- package/templates/business/market-intelligence/CLAUDE.md +371 -0
- package/templates/business/marketing-expert/.cursor/rules/brand-strategy.mdc +74 -0
- package/templates/business/marketing-expert/.cursor/rules/campaign-planning.mdc +60 -0
- package/templates/business/marketing-expert/.cursor/rules/growth-frameworks.mdc +69 -0
- package/templates/business/marketing-expert/.cursor/rules/market-analysis.mdc +70 -0
- package/templates/business/marketing-expert/.cursor/rules/marketing-analytics.mdc +71 -0
- package/templates/business/marketing-expert/.cursor/rules/overview.mdc +56 -0
- package/templates/business/marketing-expert/CLAUDE.md +567 -0
- package/templates/business/predictive-maintenance/.cursor/rules/alerting.mdc +56 -0
- package/templates/business/predictive-maintenance/.cursor/rules/asset-lifecycle.mdc +71 -0
- package/templates/business/predictive-maintenance/.cursor/rules/failure-prediction.mdc +65 -0
- package/templates/business/predictive-maintenance/.cursor/rules/maintenance-scheduling.mdc +61 -0
- package/templates/business/predictive-maintenance/.cursor/rules/overview.mdc +55 -0
- package/templates/business/predictive-maintenance/.cursor/rules/sensor-analytics.mdc +66 -0
- package/templates/business/predictive-maintenance/CLAUDE.md +529 -0
- package/templates/business/product-manager/.cursor/rules/communication.mdc +77 -0
- package/templates/business/product-manager/.cursor/rules/discovery.mdc +79 -0
- package/templates/business/product-manager/.cursor/rules/metrics.mdc +75 -0
- package/templates/business/product-manager/.cursor/rules/overview.mdc +47 -0
- package/templates/business/product-manager/.cursor/rules/prioritization.mdc +66 -0
- package/templates/business/product-manager/.cursor/rules/requirements.mdc +79 -0
- package/templates/business/product-manager/CLAUDE.md +593 -0
- package/templates/business/project-manager/.cursor/rules/overview.mdc +53 -0
- package/templates/business/project-manager/.cursor/rules/reporting.mdc +68 -0
- package/templates/business/project-manager/.cursor/rules/risk-management.mdc +71 -0
- package/templates/business/project-manager/.cursor/rules/scheduling.mdc +67 -0
- package/templates/business/project-manager/.cursor/rules/scope-management.mdc +66 -0
- package/templates/business/project-manager/.cursor/rules/stakeholder-management.mdc +70 -0
- package/templates/business/project-manager/CLAUDE.md +540 -0
- package/templates/business/regulatory-sentinel/.cursor/rules/compliance-tracking.mdc +74 -0
- package/templates/business/regulatory-sentinel/.cursor/rules/impact-assessment.mdc +62 -0
- package/templates/business/regulatory-sentinel/.cursor/rules/monitoring.mdc +67 -0
- package/templates/business/regulatory-sentinel/.cursor/rules/overview.mdc +55 -0
- package/templates/business/regulatory-sentinel/.cursor/rules/reporting.mdc +61 -0
- package/templates/business/regulatory-sentinel/.cursor/rules/risk-classification.mdc +73 -0
- package/templates/business/regulatory-sentinel/CLAUDE.md +572 -0
- package/templates/business/resource-allocator/.cursor/rules/capacity-modeling.mdc +65 -0
- package/templates/business/resource-allocator/.cursor/rules/coordination.mdc +67 -0
- package/templates/business/resource-allocator/.cursor/rules/crisis-management.mdc +64 -0
- package/templates/business/resource-allocator/.cursor/rules/demand-prediction.mdc +52 -0
- package/templates/business/resource-allocator/.cursor/rules/overview.mdc +76 -0
- package/templates/business/resource-allocator/.cursor/rules/scheduling.mdc +63 -0
- package/templates/business/resource-allocator/CLAUDE.md +525 -0
- package/templates/business/strategic-negotiator/.cursor/rules/contract-analysis.mdc +60 -0
- package/templates/business/strategic-negotiator/.cursor/rules/deal-structuring.mdc +66 -0
- package/templates/business/strategic-negotiator/.cursor/rules/game-theory.mdc +64 -0
- package/templates/business/strategic-negotiator/.cursor/rules/overview.mdc +55 -0
- package/templates/business/strategic-negotiator/.cursor/rules/preparation.mdc +79 -0
- package/templates/business/strategic-negotiator/.cursor/rules/scenario-modeling.mdc +66 -0
- package/templates/business/strategic-negotiator/CLAUDE.md +640 -0
- package/templates/business/supply-chain/.cursor/rules/cost-modeling.mdc +67 -0
- package/templates/business/supply-chain/.cursor/rules/demand-forecasting.mdc +67 -0
- package/templates/business/supply-chain/.cursor/rules/inventory-management.mdc +69 -0
- package/templates/business/supply-chain/.cursor/rules/logistics.mdc +61 -0
- package/templates/business/supply-chain/.cursor/rules/overview.mdc +64 -0
- package/templates/business/supply-chain/.cursor/rules/supplier-evaluation.mdc +66 -0
- package/templates/business/supply-chain/CLAUDE.md +590 -0
- package/templates/business/supply-chain-harmonizer/.cursor/rules/disruption-response.mdc +67 -0
- package/templates/business/supply-chain-harmonizer/.cursor/rules/inventory-rebalancing.mdc +63 -0
- package/templates/business/supply-chain-harmonizer/.cursor/rules/overview.mdc +65 -0
- package/templates/business/supply-chain-harmonizer/.cursor/rules/rerouting.mdc +64 -0
- package/templates/business/supply-chain-harmonizer/.cursor/rules/scenario-simulation.mdc +68 -0
- package/templates/business/supply-chain-harmonizer/.cursor/rules/stakeholder-notifications.mdc +61 -0
- package/templates/business/supply-chain-harmonizer/CLAUDE.md +600 -0
- package/templates/creative/brand-guardian/.cursor/rules/brand-voice.mdc +64 -0
- package/templates/creative/brand-guardian/.cursor/rules/content-review.mdc +47 -0
- package/templates/creative/brand-guardian/.cursor/rules/ethical-guidelines.mdc +47 -0
- package/templates/creative/brand-guardian/.cursor/rules/multi-channel.mdc +49 -0
- package/templates/creative/brand-guardian/.cursor/rules/overview.mdc +58 -0
- package/templates/creative/brand-guardian/.cursor/rules/visual-identity.mdc +64 -0
- package/templates/creative/brand-guardian/CLAUDE.md +634 -0
- package/templates/creative/content-creation-expert/.cursor/rules/content-strategy.mdc +65 -0
- package/templates/creative/content-creation-expert/.cursor/rules/copywriting.mdc +59 -0
- package/templates/creative/content-creation-expert/.cursor/rules/editorial-operations.mdc +65 -0
- package/templates/creative/content-creation-expert/.cursor/rules/multimedia-production.mdc +64 -0
- package/templates/creative/content-creation-expert/.cursor/rules/overview.mdc +58 -0
- package/templates/creative/content-creation-expert/.cursor/rules/seo-content.mdc +75 -0
- package/templates/creative/content-creation-expert/CLAUDE.md +568 -0
- package/templates/creative/narrative-architect/.cursor/rules/collaboration.mdc +62 -0
- package/templates/creative/narrative-architect/.cursor/rules/continuity-tracking.mdc +56 -0
- package/templates/creative/narrative-architect/.cursor/rules/overview.mdc +68 -0
- package/templates/creative/narrative-architect/.cursor/rules/story-bible.mdc +77 -0
- package/templates/creative/narrative-architect/.cursor/rules/timeline-management.mdc +60 -0
- package/templates/creative/narrative-architect/.cursor/rules/world-building.mdc +78 -0
- package/templates/creative/narrative-architect/CLAUDE.md +737 -0
- package/templates/creative/social-media-expert/.cursor/rules/audience-growth.mdc +62 -0
- package/templates/creative/social-media-expert/.cursor/rules/community-management.mdc +67 -0
- package/templates/creative/social-media-expert/.cursor/rules/content-strategy.mdc +60 -0
- package/templates/creative/social-media-expert/.cursor/rules/overview.mdc +48 -0
- package/templates/creative/social-media-expert/.cursor/rules/platform-strategy.mdc +64 -0
- package/templates/creative/social-media-expert/.cursor/rules/social-analytics.mdc +64 -0
- package/templates/creative/social-media-expert/CLAUDE.md +624 -0
- package/templates/creative/trend-forecaster/.cursor/rules/cultural-analysis.mdc +59 -0
- package/templates/creative/trend-forecaster/.cursor/rules/forecasting-methods.mdc +63 -0
- package/templates/creative/trend-forecaster/.cursor/rules/overview.mdc +58 -0
- package/templates/creative/trend-forecaster/.cursor/rules/reporting.mdc +61 -0
- package/templates/creative/trend-forecaster/.cursor/rules/signal-analysis.mdc +74 -0
- package/templates/creative/trend-forecaster/.cursor/rules/trend-lifecycle.mdc +75 -0
- package/templates/creative/trend-forecaster/CLAUDE.md +717 -0
- package/templates/creative/ux-designer/.cursor/rules/accessibility.mdc +69 -0
- package/templates/creative/ux-designer/.cursor/rules/emotional-design.mdc +59 -0
- package/templates/creative/ux-designer/.cursor/rules/handoff.mdc +73 -0
- package/templates/creative/ux-designer/.cursor/rules/information-architecture.mdc +62 -0
- package/templates/creative/ux-designer/.cursor/rules/interaction-design.mdc +66 -0
- package/templates/creative/ux-designer/.cursor/rules/overview.mdc +61 -0
- package/templates/creative/ux-designer/.cursor/rules/research.mdc +61 -0
- package/templates/creative/ux-designer/.cursor/rules/visual-design.mdc +68 -0
- package/templates/creative/ux-designer/CLAUDE.md +124 -0
- package/templates/dogfood/project-overview.mdc +12 -0
- package/templates/dogfood/project-structure.mdc +82 -0
- package/templates/dogfood/rules-creation-best-practices.mdc +45 -0
- package/templates/education/educator/.cursor/rules/accessibility.mdc +67 -0
- package/templates/education/educator/.cursor/rules/assessment.mdc +68 -0
- package/templates/education/educator/.cursor/rules/curriculum.mdc +57 -0
- package/templates/education/educator/.cursor/rules/engagement.mdc +65 -0
- package/templates/education/educator/.cursor/rules/instructional-design.mdc +69 -0
- package/templates/education/educator/.cursor/rules/overview.mdc +57 -0
- package/templates/education/educator/.cursor/rules/retention.mdc +64 -0
- package/templates/education/educator/CLAUDE.md +338 -0
- package/templates/engineering/blockchain/.cursor/rules/defi-patterns.mdc +48 -0
- package/templates/engineering/blockchain/.cursor/rules/gas-optimization.mdc +77 -0
- package/templates/engineering/blockchain/.cursor/rules/overview.mdc +41 -0
- package/templates/engineering/blockchain/.cursor/rules/security.mdc +61 -0
- package/templates/engineering/blockchain/.cursor/rules/smart-contracts.mdc +64 -0
- package/templates/engineering/blockchain/.cursor/rules/testing.mdc +77 -0
- package/templates/engineering/blockchain/.cursor/rules/web3-integration.mdc +47 -0
- package/templates/engineering/blockchain/CLAUDE.md +389 -0
- package/templates/engineering/cli-tools/.cursor/rules/architecture.mdc +76 -0
- package/templates/engineering/cli-tools/.cursor/rules/arguments.mdc +65 -0
- package/templates/engineering/cli-tools/.cursor/rules/distribution.mdc +40 -0
- package/templates/engineering/cli-tools/.cursor/rules/error-handling.mdc +67 -0
- package/templates/engineering/cli-tools/.cursor/rules/overview.mdc +58 -0
- package/templates/engineering/cli-tools/.cursor/rules/testing.mdc +42 -0
- package/templates/engineering/cli-tools/.cursor/rules/user-experience.mdc +43 -0
- package/templates/engineering/cli-tools/CLAUDE.md +356 -0
- package/templates/engineering/data-engineering/.cursor/rules/data-modeling.mdc +71 -0
- package/templates/engineering/data-engineering/.cursor/rules/data-quality.mdc +78 -0
- package/templates/engineering/data-engineering/.cursor/rules/overview.mdc +49 -0
- package/templates/engineering/data-engineering/.cursor/rules/performance.mdc +71 -0
- package/templates/engineering/data-engineering/.cursor/rules/pipeline-design.mdc +79 -0
- package/templates/engineering/data-engineering/.cursor/rules/security.mdc +79 -0
- package/templates/engineering/data-engineering/.cursor/rules/testing.mdc +75 -0
- package/templates/engineering/data-engineering/CLAUDE.md +974 -0
- package/templates/engineering/devops-sre/.cursor/rules/capacity-planning.mdc +49 -0
- package/templates/engineering/devops-sre/.cursor/rules/change-management.mdc +51 -0
- package/templates/engineering/devops-sre/.cursor/rules/chaos-engineering.mdc +50 -0
- package/templates/engineering/devops-sre/.cursor/rules/disaster-recovery.mdc +54 -0
- package/templates/engineering/devops-sre/.cursor/rules/incident-management.mdc +56 -0
- package/templates/engineering/devops-sre/.cursor/rules/observability.mdc +50 -0
- package/templates/engineering/devops-sre/.cursor/rules/overview.mdc +76 -0
- package/templates/engineering/devops-sre/.cursor/rules/postmortems.mdc +49 -0
- package/templates/engineering/devops-sre/.cursor/rules/runbooks.mdc +49 -0
- package/templates/engineering/devops-sre/.cursor/rules/slo-sli.mdc +46 -0
- package/templates/engineering/devops-sre/.cursor/rules/toil-reduction.mdc +52 -0
- package/templates/engineering/devops-sre/CLAUDE.md +1007 -0
- package/templates/engineering/fullstack/.cursor/rules/api-contracts.mdc +79 -0
- package/templates/engineering/fullstack/.cursor/rules/architecture.mdc +79 -0
- package/templates/engineering/fullstack/.cursor/rules/overview.mdc +61 -0
- package/templates/engineering/fullstack/.cursor/rules/shared-types.mdc +77 -0
- package/templates/engineering/fullstack/.cursor/rules/testing.mdc +72 -0
- package/templates/engineering/fullstack/CLAUDE.md +349 -0
- package/templates/engineering/ml-ai/.cursor/rules/data-engineering.mdc +71 -0
- package/templates/engineering/ml-ai/.cursor/rules/deployment.mdc +43 -0
- package/templates/engineering/ml-ai/.cursor/rules/model-development.mdc +44 -0
- package/templates/engineering/ml-ai/.cursor/rules/monitoring.mdc +45 -0
- package/templates/engineering/ml-ai/.cursor/rules/overview.mdc +42 -0
- package/templates/engineering/ml-ai/.cursor/rules/security.mdc +51 -0
- package/templates/engineering/ml-ai/.cursor/rules/testing.mdc +44 -0
- package/templates/engineering/ml-ai/CLAUDE.md +1136 -0
- package/templates/engineering/mobile/.cursor/rules/navigation.mdc +75 -0
- package/templates/engineering/mobile/.cursor/rules/offline-first.mdc +68 -0
- package/templates/engineering/mobile/.cursor/rules/overview.mdc +76 -0
- package/templates/engineering/mobile/.cursor/rules/performance.mdc +78 -0
- package/templates/engineering/mobile/.cursor/rules/testing.mdc +77 -0
- package/templates/engineering/mobile/CLAUDE.md +233 -0
- package/templates/engineering/platform-engineering/.cursor/rules/ci-cd.mdc +51 -0
- package/templates/engineering/platform-engineering/.cursor/rules/developer-experience.mdc +48 -0
- package/templates/engineering/platform-engineering/.cursor/rules/infrastructure-as-code.mdc +62 -0
- package/templates/engineering/platform-engineering/.cursor/rules/kubernetes.mdc +51 -0
- package/templates/engineering/platform-engineering/.cursor/rules/observability.mdc +52 -0
- package/templates/engineering/platform-engineering/.cursor/rules/overview.mdc +44 -0
- package/templates/engineering/platform-engineering/.cursor/rules/security.mdc +74 -0
- package/templates/engineering/platform-engineering/.cursor/rules/testing.mdc +59 -0
- package/templates/engineering/platform-engineering/CLAUDE.md +850 -0
- package/templates/engineering/qa-engineering/.cursor/rules/automation.mdc +71 -0
- package/templates/engineering/qa-engineering/.cursor/rules/metrics.mdc +68 -0
- package/templates/engineering/qa-engineering/.cursor/rules/overview.mdc +45 -0
- package/templates/engineering/qa-engineering/.cursor/rules/quality-gates.mdc +54 -0
- package/templates/engineering/qa-engineering/.cursor/rules/test-design.mdc +59 -0
- package/templates/engineering/qa-engineering/.cursor/rules/test-strategy.mdc +62 -0
- package/templates/engineering/qa-engineering/CLAUDE.md +726 -0
- package/templates/engineering/testing/.cursor/rules/advanced-techniques.mdc +44 -0
- package/templates/engineering/testing/.cursor/rules/ci-cd-integration.mdc +43 -0
- package/templates/engineering/testing/.cursor/rules/overview.mdc +61 -0
- package/templates/engineering/testing/.cursor/rules/performance-testing.mdc +39 -0
- package/templates/engineering/testing/.cursor/rules/quality-metrics.mdc +74 -0
- package/templates/engineering/testing/.cursor/rules/reliability.mdc +39 -0
- package/templates/engineering/testing/.cursor/rules/tdd-methodology.mdc +52 -0
- package/templates/engineering/testing/.cursor/rules/test-data.mdc +46 -0
- package/templates/engineering/testing/.cursor/rules/test-design.mdc +45 -0
- package/templates/engineering/testing/.cursor/rules/test-types.mdc +71 -0
- package/templates/engineering/testing/CLAUDE.md +1134 -0
- package/templates/engineering/unity-dev-expert/.cursor/rules/csharp-architecture.mdc +61 -0
- package/templates/engineering/unity-dev-expert/.cursor/rules/multiplayer-networking.mdc +67 -0
- package/templates/engineering/unity-dev-expert/.cursor/rules/overview.mdc +56 -0
- package/templates/engineering/unity-dev-expert/.cursor/rules/performance-optimization.mdc +76 -0
- package/templates/engineering/unity-dev-expert/.cursor/rules/physics-rendering.mdc +59 -0
- package/templates/engineering/unity-dev-expert/.cursor/rules/ui-systems.mdc +59 -0
- package/templates/engineering/unity-dev-expert/CLAUDE.md +534 -0
- package/templates/engineering/web-backend/.cursor/rules/api-design.mdc +64 -0
- package/templates/engineering/web-backend/.cursor/rules/authentication.mdc +69 -0
- package/templates/engineering/web-backend/.cursor/rules/database-patterns.mdc +73 -0
- package/templates/engineering/web-backend/.cursor/rules/error-handling.mdc +66 -0
- package/templates/engineering/web-backend/.cursor/rules/overview.mdc +74 -0
- package/templates/engineering/web-backend/.cursor/rules/security.mdc +60 -0
- package/templates/engineering/web-backend/.cursor/rules/testing.mdc +74 -0
- package/templates/engineering/web-backend/CLAUDE.md +366 -0
- package/templates/engineering/web-frontend/.cursor/rules/accessibility.mdc +75 -0
- package/templates/engineering/web-frontend/.cursor/rules/component-patterns.mdc +76 -0
- package/templates/engineering/web-frontend/.cursor/rules/overview.mdc +77 -0
- package/templates/engineering/web-frontend/.cursor/rules/performance.mdc +73 -0
- package/templates/engineering/web-frontend/.cursor/rules/state-management.mdc +71 -0
- package/templates/engineering/web-frontend/.cursor/rules/styling.mdc +69 -0
- package/templates/engineering/web-frontend/.cursor/rules/testing.mdc +75 -0
- package/templates/engineering/web-frontend/CLAUDE.md +399 -0
- package/templates/languages/cpp-expert/.cursor/rules/concurrency.mdc +68 -0
- package/templates/languages/cpp-expert/.cursor/rules/error-handling.mdc +65 -0
- package/templates/languages/cpp-expert/.cursor/rules/memory-and-ownership.mdc +68 -0
- package/templates/languages/cpp-expert/.cursor/rules/modern-cpp.mdc +75 -0
- package/templates/languages/cpp-expert/.cursor/rules/overview.mdc +37 -0
- package/templates/languages/cpp-expert/.cursor/rules/performance.mdc +74 -0
- package/templates/languages/cpp-expert/.cursor/rules/testing.mdc +70 -0
- package/templates/languages/cpp-expert/.cursor/rules/tooling.mdc +77 -0
- package/templates/languages/cpp-expert/CLAUDE.md +242 -0
- package/templates/languages/csharp-expert/.cursor/rules/aspnet-core.mdc +78 -0
- package/templates/languages/csharp-expert/.cursor/rules/async-patterns.mdc +71 -0
- package/templates/languages/csharp-expert/.cursor/rules/dependency-injection.mdc +76 -0
- package/templates/languages/csharp-expert/.cursor/rules/error-handling.mdc +65 -0
- package/templates/languages/csharp-expert/.cursor/rules/language-features.mdc +74 -0
- package/templates/languages/csharp-expert/.cursor/rules/overview.mdc +47 -0
- package/templates/languages/csharp-expert/.cursor/rules/performance.mdc +66 -0
- package/templates/languages/csharp-expert/.cursor/rules/testing.mdc +78 -0
- package/templates/languages/csharp-expert/.cursor/rules/tooling.mdc +78 -0
- package/templates/languages/csharp-expert/CLAUDE.md +360 -0
- package/templates/languages/golang-expert/.cursor/rules/concurrency.mdc +79 -0
- package/templates/languages/golang-expert/.cursor/rules/error-handling.mdc +77 -0
- package/templates/languages/golang-expert/.cursor/rules/interfaces-and-types.mdc +77 -0
- package/templates/languages/golang-expert/.cursor/rules/overview.mdc +74 -0
- package/templates/languages/golang-expert/.cursor/rules/performance.mdc +76 -0
- package/templates/languages/golang-expert/.cursor/rules/production-patterns.mdc +76 -0
- package/templates/languages/golang-expert/.cursor/rules/stdlib-and-tooling.mdc +68 -0
- package/templates/languages/golang-expert/.cursor/rules/testing.mdc +77 -0
- package/templates/languages/golang-expert/CLAUDE.md +361 -0
- package/templates/languages/java-expert/.cursor/rules/concurrency.mdc +69 -0
- package/templates/languages/java-expert/.cursor/rules/error-handling.mdc +70 -0
- package/templates/languages/java-expert/.cursor/rules/modern-java.mdc +74 -0
- package/templates/languages/java-expert/.cursor/rules/overview.mdc +42 -0
- package/templates/languages/java-expert/.cursor/rules/performance.mdc +69 -0
- package/templates/languages/java-expert/.cursor/rules/persistence.mdc +74 -0
- package/templates/languages/java-expert/.cursor/rules/spring-boot.mdc +73 -0
- package/templates/languages/java-expert/.cursor/rules/testing.mdc +79 -0
- package/templates/languages/java-expert/.cursor/rules/tooling.mdc +76 -0
- package/templates/languages/java-expert/CLAUDE.md +325 -0
- package/templates/languages/javascript-expert/.cursor/rules/language-deep-dive.mdc +74 -0
- package/templates/languages/javascript-expert/.cursor/rules/node-patterns.mdc +77 -0
- package/templates/languages/javascript-expert/.cursor/rules/overview.mdc +66 -0
- package/templates/languages/javascript-expert/.cursor/rules/performance.mdc +64 -0
- package/templates/languages/javascript-expert/.cursor/rules/react-patterns.mdc +70 -0
- package/templates/languages/javascript-expert/.cursor/rules/testing.mdc +76 -0
- package/templates/languages/javascript-expert/.cursor/rules/tooling.mdc +72 -0
- package/templates/languages/javascript-expert/.cursor/rules/typescript-deep-dive.mdc +77 -0
- package/templates/languages/javascript-expert/CLAUDE.md +479 -0
- package/templates/languages/kotlin-expert/.cursor/rules/coroutines.mdc +75 -0
- package/templates/languages/kotlin-expert/.cursor/rules/error-handling.mdc +69 -0
- package/templates/languages/kotlin-expert/.cursor/rules/frameworks.mdc +76 -0
- package/templates/languages/kotlin-expert/.cursor/rules/language-features.mdc +78 -0
- package/templates/languages/kotlin-expert/.cursor/rules/overview.mdc +38 -0
- package/templates/languages/kotlin-expert/.cursor/rules/performance.mdc +73 -0
- package/templates/languages/kotlin-expert/.cursor/rules/testing.mdc +70 -0
- package/templates/languages/kotlin-expert/.cursor/rules/tooling.mdc +67 -0
- package/templates/languages/kotlin-expert/CLAUDE.md +276 -0
- package/templates/languages/python-expert/.cursor/rules/async-python.mdc +71 -0
- package/templates/languages/python-expert/.cursor/rules/overview.mdc +76 -0
- package/templates/languages/python-expert/.cursor/rules/patterns-and-idioms.mdc +77 -0
- package/templates/languages/python-expert/.cursor/rules/performance.mdc +74 -0
- package/templates/languages/python-expert/.cursor/rules/testing.mdc +77 -0
- package/templates/languages/python-expert/.cursor/rules/tooling.mdc +77 -0
- package/templates/languages/python-expert/.cursor/rules/type-system.mdc +77 -0
- package/templates/languages/python-expert/.cursor/rules/web-and-apis.mdc +76 -0
- package/templates/languages/python-expert/CLAUDE.md +264 -0
- package/templates/languages/ruby-expert/.cursor/rules/concurrency-and-threading.mdc +65 -0
- package/templates/languages/ruby-expert/.cursor/rules/error-handling.mdc +69 -0
- package/templates/languages/ruby-expert/.cursor/rules/idioms-and-style.mdc +76 -0
- package/templates/languages/ruby-expert/.cursor/rules/overview.mdc +60 -0
- package/templates/languages/ruby-expert/.cursor/rules/performance.mdc +68 -0
- package/templates/languages/ruby-expert/.cursor/rules/rails-and-frameworks.mdc +60 -0
- package/templates/languages/ruby-expert/.cursor/rules/testing.mdc +56 -0
- package/templates/languages/ruby-expert/.cursor/rules/tooling.mdc +52 -0
- package/templates/languages/ruby-expert/CLAUDE.md +102 -0
- package/templates/languages/rust-expert/.cursor/rules/concurrency.mdc +69 -0
- package/templates/languages/rust-expert/.cursor/rules/ecosystem-and-tooling.mdc +76 -0
- package/templates/languages/rust-expert/.cursor/rules/error-handling.mdc +76 -0
- package/templates/languages/rust-expert/.cursor/rules/overview.mdc +62 -0
- package/templates/languages/rust-expert/.cursor/rules/ownership-and-borrowing.mdc +70 -0
- package/templates/languages/rust-expert/.cursor/rules/performance-and-unsafe.mdc +70 -0
- package/templates/languages/rust-expert/.cursor/rules/testing.mdc +73 -0
- package/templates/languages/rust-expert/.cursor/rules/traits-and-generics.mdc +76 -0
- package/templates/languages/rust-expert/CLAUDE.md +283 -0
- package/templates/languages/swift-expert/.cursor/rules/concurrency.mdc +77 -0
- package/templates/languages/swift-expert/.cursor/rules/error-handling.mdc +76 -0
- package/templates/languages/swift-expert/.cursor/rules/language-features.mdc +78 -0
- package/templates/languages/swift-expert/.cursor/rules/overview.mdc +46 -0
- package/templates/languages/swift-expert/.cursor/rules/performance.mdc +69 -0
- package/templates/languages/swift-expert/.cursor/rules/swiftui.mdc +77 -0
- package/templates/languages/swift-expert/.cursor/rules/testing.mdc +75 -0
- package/templates/languages/swift-expert/.cursor/rules/tooling.mdc +77 -0
- package/templates/languages/swift-expert/CLAUDE.md +275 -0
- package/templates/professional/documentation/.cursor/rules/adr.mdc +65 -0
- package/templates/professional/documentation/.cursor/rules/api-documentation.mdc +64 -0
- package/templates/professional/documentation/.cursor/rules/code-comments.mdc +75 -0
- package/templates/professional/documentation/.cursor/rules/maintenance.mdc +58 -0
- package/templates/professional/documentation/.cursor/rules/overview.mdc +48 -0
- package/templates/professional/documentation/.cursor/rules/readme-standards.mdc +70 -0
- package/templates/professional/documentation/CLAUDE.md +120 -0
- package/templates/professional/executive-assistant/.cursor/rules/calendar.mdc +51 -0
- package/templates/professional/executive-assistant/.cursor/rules/confidentiality.mdc +53 -0
- package/templates/professional/executive-assistant/.cursor/rules/email.mdc +49 -0
- package/templates/professional/executive-assistant/.cursor/rules/meetings.mdc +39 -0
- package/templates/professional/executive-assistant/.cursor/rules/overview.mdc +42 -0
- package/templates/professional/executive-assistant/.cursor/rules/prioritization.mdc +48 -0
- package/templates/professional/executive-assistant/.cursor/rules/stakeholder-management.mdc +50 -0
- package/templates/professional/executive-assistant/.cursor/rules/travel.mdc +43 -0
- package/templates/professional/executive-assistant/CLAUDE.md +620 -0
- package/templates/professional/grant-writer/.cursor/rules/budgets.mdc +55 -0
- package/templates/professional/grant-writer/.cursor/rules/compliance.mdc +47 -0
- package/templates/professional/grant-writer/.cursor/rules/funding-research.mdc +47 -0
- package/templates/professional/grant-writer/.cursor/rules/narrative.mdc +58 -0
- package/templates/professional/grant-writer/.cursor/rules/overview.mdc +68 -0
- package/templates/professional/grant-writer/.cursor/rules/post-award.mdc +59 -0
- package/templates/professional/grant-writer/.cursor/rules/review-criteria.mdc +51 -0
- package/templates/professional/grant-writer/.cursor/rules/sustainability.mdc +48 -0
- package/templates/professional/grant-writer/CLAUDE.md +577 -0
- package/templates/professional/knowledge-synthesis/.cursor/rules/document-management.mdc +51 -0
- package/templates/professional/knowledge-synthesis/.cursor/rules/knowledge-graphs.mdc +63 -0
- package/templates/professional/knowledge-synthesis/.cursor/rules/overview.mdc +74 -0
- package/templates/professional/knowledge-synthesis/.cursor/rules/research-workflow.mdc +50 -0
- package/templates/professional/knowledge-synthesis/.cursor/rules/search-retrieval.mdc +62 -0
- package/templates/professional/knowledge-synthesis/.cursor/rules/summarization.mdc +61 -0
- package/templates/professional/knowledge-synthesis/CLAUDE.md +593 -0
- package/templates/professional/life-logistics/.cursor/rules/financial-optimization.mdc +78 -0
- package/templates/professional/life-logistics/.cursor/rules/negotiation.mdc +68 -0
- package/templates/professional/life-logistics/.cursor/rules/overview.mdc +75 -0
- package/templates/professional/life-logistics/.cursor/rules/research-methodology.mdc +76 -0
- package/templates/professional/life-logistics/.cursor/rules/scheduling.mdc +68 -0
- package/templates/professional/life-logistics/.cursor/rules/task-management.mdc +47 -0
- package/templates/professional/life-logistics/CLAUDE.md +601 -0
- package/templates/professional/research-assistant/.cursor/rules/citation-attribution.mdc +61 -0
- package/templates/professional/research-assistant/.cursor/rules/information-synthesis.mdc +65 -0
- package/templates/professional/research-assistant/.cursor/rules/overview.mdc +56 -0
- package/templates/professional/research-assistant/.cursor/rules/research-methodologies.mdc +54 -0
- package/templates/professional/research-assistant/.cursor/rules/search-strategies.mdc +57 -0
- package/templates/professional/research-assistant/.cursor/rules/source-evaluation.mdc +59 -0
- package/templates/professional/research-assistant/CLAUDE.md +318 -0
- package/templates/professional/wellness-orchestrator/.cursor/rules/adaptive-planning.mdc +69 -0
- package/templates/professional/wellness-orchestrator/.cursor/rules/data-integration.mdc +60 -0
- package/templates/professional/wellness-orchestrator/.cursor/rules/fitness-programming.mdc +66 -0
- package/templates/professional/wellness-orchestrator/.cursor/rules/nutrition-planning.mdc +57 -0
- package/templates/professional/wellness-orchestrator/.cursor/rules/overview.mdc +76 -0
- package/templates/professional/wellness-orchestrator/.cursor/rules/sleep-optimization.mdc +68 -0
- package/templates/professional/wellness-orchestrator/CLAUDE.md +573 -0
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Error Handling
|
|
3
|
+
alwaysApply: false
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# CLI Error Handling
|
|
7
|
+
|
|
8
|
+
Patterns for handling errors gracefully and providing helpful feedback.
|
|
9
|
+
|
|
10
|
+
## Exit Codes
|
|
11
|
+
|
|
12
|
+
| Code | Meaning | Code | Meaning |
|
|
13
|
+
|------|---------|------|---------|
|
|
14
|
+
| 0 | Success | 2 | Invalid arguments |
|
|
15
|
+
| 1 | General error | 126 | Cannot execute |
|
|
16
|
+
| 64-78 | BSD sysexits | 130 | Interrupted (Ctrl+C) |
|
|
17
|
+
|
|
18
|
+
Map error types to exit codes in a central handler:
|
|
19
|
+
|
|
20
|
+
```go
|
|
21
|
+
switch {
|
|
22
|
+
case errors.Is(err, ErrInvalidArgs): os.Exit(2)
|
|
23
|
+
case errors.Is(err, context.Canceled): os.Exit(130)
|
|
24
|
+
default: os.Exit(1)
|
|
25
|
+
}
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Error Message Structure
|
|
29
|
+
|
|
30
|
+
Every error should include: **what happened**, **context** (paths, values), **why** (root cause), and **how to fix** (actionable suggestions).
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
Error: cannot read config file
|
|
34
|
+
File: ~/.config/mytool/config.yaml
|
|
35
|
+
Cause: permission denied
|
|
36
|
+
Try:
|
|
37
|
+
• chmod 600 ~/.config/mytool/config.yaml
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Implement as a structured `CLIError` type with `Message`, `Details`, `Cause`, and `Suggestions` fields.
|
|
41
|
+
|
|
42
|
+
## Error Wrapping
|
|
43
|
+
|
|
44
|
+
- Add context at each layer: `fmt.Errorf("deploy to %s: %w", env, err)`
|
|
45
|
+
- Unwrap with `errors.Is` / `errors.As` for specific handling
|
|
46
|
+
- Result chain: `"deploy to prod: invalid config: missing field 'api_key'"`
|
|
47
|
+
|
|
48
|
+
## Graceful Degradation
|
|
49
|
+
|
|
50
|
+
- **Partial failures**: Log warnings, continue processing, report summary (`failed 3/10 files`)
|
|
51
|
+
- **Fallbacks**: Try env var → config file → default value
|
|
52
|
+
- **Verbose mode**: Show stack traces and debug context only when `--verbose` / `--debug` is set
|
|
53
|
+
|
|
54
|
+
## Anti-Patterns
|
|
55
|
+
|
|
56
|
+
```go
|
|
57
|
+
// Bad: Silent failure
|
|
58
|
+
result, _ := riskyOp()
|
|
59
|
+
|
|
60
|
+
// Good: Propagate with context
|
|
61
|
+
result, err := riskyOp()
|
|
62
|
+
if err != nil { return fmt.Errorf("risky op: %w", err) }
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
- **Generic messages** — `"operation failed"` is useless; include what, where, and how to fix
|
|
66
|
+
- **Panic for recoverable errors** — return errors, never `panic` in CLI code
|
|
67
|
+
- **String matching** — use `errors.Is(err, os.ErrNotExist)` not `err.Error() == "file not found"`
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: CLI Tools Development Overview
|
|
3
|
+
alwaysApply: false
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# CLI Tools Development Overview
|
|
7
|
+
|
|
8
|
+
Guidelines for building professional command-line interfaces that are intuitive, robust, and maintainable.
|
|
9
|
+
|
|
10
|
+
## Scope
|
|
11
|
+
|
|
12
|
+
- Command-line applications and utilities
|
|
13
|
+
- Developer tools, build systems, automation tooling
|
|
14
|
+
- System administration scripts
|
|
15
|
+
- Interactive terminal applications
|
|
16
|
+
|
|
17
|
+
## Core Principles
|
|
18
|
+
|
|
19
|
+
### Human-First Design
|
|
20
|
+
- Helpful error messages that suggest fixes
|
|
21
|
+
- Sensible defaults for common cases
|
|
22
|
+
- Support both interactive and non-interactive modes
|
|
23
|
+
- Follow platform conventions (POSIX, Windows)
|
|
24
|
+
|
|
25
|
+
### Composability
|
|
26
|
+
- Accept stdin, produce stdout; stderr for diagnostics
|
|
27
|
+
- Support piping and redirection
|
|
28
|
+
- Return meaningful exit codes
|
|
29
|
+
|
|
30
|
+
### Predictability
|
|
31
|
+
- Same inputs produce same outputs (deterministic)
|
|
32
|
+
- Respect environment variables and config files
|
|
33
|
+
- Never silently fail
|
|
34
|
+
|
|
35
|
+
### Progressive Disclosure
|
|
36
|
+
- Common operations require minimal arguments
|
|
37
|
+
- Advanced features available but not required
|
|
38
|
+
- Help text at multiple levels; examples for every command
|
|
39
|
+
|
|
40
|
+
## Configuration Precedence
|
|
41
|
+
|
|
42
|
+
1. Command-line flags (highest)
|
|
43
|
+
2. Environment variables
|
|
44
|
+
3. Local config file
|
|
45
|
+
4. Global config file
|
|
46
|
+
5. Default values (lowest)
|
|
47
|
+
|
|
48
|
+
## Standard Flags
|
|
49
|
+
|
|
50
|
+
Always support: `-h/--help`, `-v/--verbose`, `-q/--quiet`, `--version`, `--config`, `--no-color`, `--dry-run`, `-f/--force`
|
|
51
|
+
|
|
52
|
+
## Definition of Done
|
|
53
|
+
|
|
54
|
+
- [ ] All commands have help text, examples, and shell completions
|
|
55
|
+
- [ ] Error messages suggest corrective actions; exit codes follow conventions
|
|
56
|
+
- [ ] Works in non-interactive environments (CI/CD) and supports piping
|
|
57
|
+
- [ ] Tests cover happy path and error cases
|
|
58
|
+
- [ ] Installation and configuration precedence documented
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: CLI testing—unit (business logic), integration (full commands, capture stdout/stderr), exit codes. Mock I/O; test non-interactively.
|
|
3
|
+
alwaysApply: false
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# CLI Testing
|
|
7
|
+
|
|
8
|
+
Guidelines for testing CLI applications.
|
|
9
|
+
|
|
10
|
+
## Levels
|
|
11
|
+
|
|
12
|
+
- **Unit**: Test business logic in isolation (functions that take config/inputs and return results). No CLI framework in unit tests; easy to assert and mock.
|
|
13
|
+
- **Integration**: Run full commands (real or test binary); capture stdout, stderr, and exit code. Use temp dirs and env; no leftover state.
|
|
14
|
+
- **E2E** (optional): Critical user flows with real binary; fewer, focused tests.
|
|
15
|
+
|
|
16
|
+
## Structure for Testability
|
|
17
|
+
|
|
18
|
+
- **Separate logic from CLI**: Core behavior in lib/ or core/ (pure functions or small modules); CLI layer only parses args, loads config, calls core, and prints. Unit test core; integration test CLI.
|
|
19
|
+
- **Inject I/O**: Accept writer/reader or use package-level vars for stdout/stderr in tests so you can capture output without spawning process (or spawn and capture for integration).
|
|
20
|
+
|
|
21
|
+
## Integration Tests
|
|
22
|
+
|
|
23
|
+
- **Run command**: `exec` or language equivalent (e.g. `exec.Command` in Go, `child_process` in Node) with args; capture stdout, stderr, exit code.
|
|
24
|
+
- **Assert**: Exit code (e.g. 0 success, 2 usage); stdout contains or equals expected; stderr empty or contains expected error.
|
|
25
|
+
- **Environment**: Use temp dir for cwd and config; set env vars (e.g. `HOME`, `CONFIG`); clean up after.
|
|
26
|
+
- **Non-interactive**: Set `--yes` or pipe to avoid prompts; or mock stdin with “y\n”.
|
|
27
|
+
|
|
28
|
+
## Exit Codes
|
|
29
|
+
|
|
30
|
+
- **Test explicitly**: Invalid args → 2; success → 0; runtime error → 1. Assert exit code in integration tests so contract is guaranteed.
|
|
31
|
+
|
|
32
|
+
## Definition of Done (CLI Tests)
|
|
33
|
+
|
|
34
|
+
- [ ] Unit tests for core logic; integration tests for main commands.
|
|
35
|
+
- [ ] Exit codes and stdout/stderr asserted; tests run non-interactively in CI.
|
|
36
|
+
- [ ] No reliance on real filesystem outside temp dirs; tests isolated.
|
|
37
|
+
|
|
38
|
+
## Common Pitfalls
|
|
39
|
+
|
|
40
|
+
- **Testing only happy path** - Test invalid args, missing files, and permission errors.
|
|
41
|
+
- **Brittle output assertions** - Prefer “contains” or structured parse over exact string when output might change (e.g. version).
|
|
42
|
+
- **Shared state** - Use temp dir per test; don’t rely on cwd or global config.
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: CLI UX—stdout vs stderr, output formats (table, JSON, plain), colors, progress, non-interactive. Human-first, scriptable.
|
|
3
|
+
alwaysApply: false
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# CLI User Experience
|
|
7
|
+
|
|
8
|
+
Guidelines for clear, scriptable CLI output.
|
|
9
|
+
|
|
10
|
+
## Streams
|
|
11
|
+
|
|
12
|
+
- **stdout**: Data output only (for piping and scripts). JSON, table rows, or plain lines.
|
|
13
|
+
- **stderr**: Progress, status, errors, logs. Never put parseable data on stderr when scripting is expected.
|
|
14
|
+
- **Exit codes**: 0 success; 1 general error; 2 invalid usage. Document in help.
|
|
15
|
+
|
|
16
|
+
## Output Formats
|
|
17
|
+
|
|
18
|
+
- Support at least: **human** (table or formatted) and **machine** (JSON). Flag e.g. `--output json` or `-o json`. Default human; JSON for scripting.
|
|
19
|
+
- **Table**: Align columns; consistent spacing. Optional `--no-headers` for scripts.
|
|
20
|
+
- **JSON**: One object or one JSON line per result; no extra prose. Respect `--output json` in all commands that produce data.
|
|
21
|
+
|
|
22
|
+
## Colors and Progress
|
|
23
|
+
|
|
24
|
+
- **Colors**: Use for success (green), error (red), warning (yellow), info (blue). Respect `NO_COLOR` and `--no-color`; disable when stdout is not a TTY.
|
|
25
|
+
- **Progress**: Spinner for indefinite; progress bar for known total. When not TTY (e.g. CI), print plain messages to stderr instead of spinner.
|
|
26
|
+
- **Interactive**: Prompts only when stdin is TTY; support `--yes`/`--force` to skip confirmation in scripts.
|
|
27
|
+
|
|
28
|
+
## Error Messages
|
|
29
|
+
|
|
30
|
+
- **Structure**: What failed, context (path, value), cause if known, and suggested fix. Use stderr.
|
|
31
|
+
- **Actionable**: “Cannot read config: permission denied at ~/.config/tool/config.yaml” and “chmod 600 ~/.config/tool/config.yaml”.
|
|
32
|
+
|
|
33
|
+
## Definition of Done (CLI UX)
|
|
34
|
+
|
|
35
|
+
- [ ] Data on stdout, progress/errors on stderr; exit codes documented.
|
|
36
|
+
- [ ] JSON (or machine) output where scripting is needed; colors respect NO_COLOR/TTY.
|
|
37
|
+
- [ ] Non-interactive mode (e.g. --yes) for CI; no hanging prompts.
|
|
38
|
+
|
|
39
|
+
## Common Pitfalls
|
|
40
|
+
|
|
41
|
+
- **Mixing data and logs on stdout** - Scripts break; keep data on stdout only.
|
|
42
|
+
- **Always showing spinner** - In CI or pipe, show static message or nothing.
|
|
43
|
+
- **Prompting without escape** - Provide flag to assume yes so automation doesn’t hang.
|
|
@@ -0,0 +1,356 @@
|
|
|
1
|
+
# CLI Tools Development Guide
|
|
2
|
+
|
|
3
|
+
Staff-level guidelines for building professional command-line interfaces that are intuitive, robust, and maintainable.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Overview
|
|
8
|
+
|
|
9
|
+
This guide applies to:
|
|
10
|
+
|
|
11
|
+
- Command-line applications and utilities
|
|
12
|
+
- Developer tools and build systems
|
|
13
|
+
- System administration scripts
|
|
14
|
+
- Automation and DevOps tooling
|
|
15
|
+
- Interactive terminal applications
|
|
16
|
+
|
|
17
|
+
### Key Principles
|
|
18
|
+
|
|
19
|
+
1. **Human-First Design** - Intuitive for humans, scriptable for machines
|
|
20
|
+
2. **Composability** - Do one thing well, compose with others
|
|
21
|
+
3. **Predictability** - Consistent behavior, no surprises
|
|
22
|
+
4. **Progressive Disclosure** - Simple things simple, complex things possible
|
|
23
|
+
|
|
24
|
+
### Technology Stack
|
|
25
|
+
|
|
26
|
+
| Language | Framework | Config | When to Use |
|
|
27
|
+
|----------|-----------|--------|-------------|
|
|
28
|
+
| Go | Cobra + Viper | Viper | Cross-platform binaries, performance |
|
|
29
|
+
| Node.js | Commander.js | cosmiconfig | npm ecosystem, rapid development |
|
|
30
|
+
| Python | Typer/Click | pydantic | Data processing, scripting |
|
|
31
|
+
| Rust | Clap | config-rs | Performance-critical, systems tools |
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## Command Structure
|
|
36
|
+
|
|
37
|
+
### Root Command Pattern
|
|
38
|
+
|
|
39
|
+
```go
|
|
40
|
+
// Go with Cobra
|
|
41
|
+
var rootCmd = &cobra.Command{
|
|
42
|
+
Use: "mytool",
|
|
43
|
+
Short: "A brief description",
|
|
44
|
+
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
|
|
45
|
+
return initConfig()
|
|
46
|
+
},
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
func init() {
|
|
50
|
+
rootCmd.PersistentFlags().BoolP("verbose", "v", false, "verbose output")
|
|
51
|
+
rootCmd.PersistentFlags().String("config", "", "config file path")
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Subcommands
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
mytool init # Initialize project
|
|
59
|
+
mytool build # Build project
|
|
60
|
+
mytool deploy # Deploy to environment
|
|
61
|
+
mytool config get # Nested subcommand
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Configuration Precedence
|
|
65
|
+
|
|
66
|
+
1. Command-line flags (highest)
|
|
67
|
+
2. Environment variables
|
|
68
|
+
3. Local config file
|
|
69
|
+
4. Global config file
|
|
70
|
+
5. Default values (lowest)
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## Arguments and Flags
|
|
75
|
+
|
|
76
|
+
### Standard Flags (Always Support)
|
|
77
|
+
|
|
78
|
+
| Flag | Purpose |
|
|
79
|
+
|------|---------|
|
|
80
|
+
| `-h, --help` | Show help |
|
|
81
|
+
| `-v, --verbose` | Verbose output |
|
|
82
|
+
| `-q, --quiet` | Suppress output |
|
|
83
|
+
| `--version` | Show version |
|
|
84
|
+
| `--config` | Config file path |
|
|
85
|
+
| `--no-color` | Disable colors |
|
|
86
|
+
| `--dry-run` | Preview changes |
|
|
87
|
+
| `-f, --force` | Skip confirmations |
|
|
88
|
+
|
|
89
|
+
### Argument Validation
|
|
90
|
+
|
|
91
|
+
```go
|
|
92
|
+
// Go: Custom validation
|
|
93
|
+
var runCmd = &cobra.Command{
|
|
94
|
+
Use: "run <environment>",
|
|
95
|
+
Args: func(cmd *cobra.Command, args []string) error {
|
|
96
|
+
if len(args) != 1 {
|
|
97
|
+
return fmt.Errorf("requires exactly one argument")
|
|
98
|
+
}
|
|
99
|
+
validEnvs := []string{"dev", "staging", "prod"}
|
|
100
|
+
for _, env := range validEnvs {
|
|
101
|
+
if args[0] == env {
|
|
102
|
+
return nil
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
return fmt.Errorf("invalid environment %q", args[0])
|
|
106
|
+
},
|
|
107
|
+
}
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
## User Experience
|
|
113
|
+
|
|
114
|
+
### Output Streams
|
|
115
|
+
|
|
116
|
+
- **stdout**: Data output (for piping)
|
|
117
|
+
- **stderr**: Progress, status, errors (for humans)
|
|
118
|
+
|
|
119
|
+
```go
|
|
120
|
+
// Correct stream usage
|
|
121
|
+
fmt.Fprintln(os.Stderr, "Building...") // Progress
|
|
122
|
+
fmt.Println(result.Path) // Data output
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### Colors
|
|
126
|
+
|
|
127
|
+
| Color | Use For |
|
|
128
|
+
|-------|---------|
|
|
129
|
+
| Green | Success |
|
|
130
|
+
| Red | Errors |
|
|
131
|
+
| Yellow | Warnings |
|
|
132
|
+
| Blue | Information |
|
|
133
|
+
| Dim | Secondary info |
|
|
134
|
+
|
|
135
|
+
Always respect `NO_COLOR` environment variable and `--no-color` flag.
|
|
136
|
+
|
|
137
|
+
### Progress Indicators
|
|
138
|
+
|
|
139
|
+
```go
|
|
140
|
+
// Spinner for unknown duration
|
|
141
|
+
spinner.Start()
|
|
142
|
+
defer spinner.Stop()
|
|
143
|
+
|
|
144
|
+
// Progress bar for known progress
|
|
145
|
+
bar := progressbar.New(total)
|
|
146
|
+
for _, item := range items {
|
|
147
|
+
process(item)
|
|
148
|
+
bar.Add(1)
|
|
149
|
+
}
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
### Interactive Prompts
|
|
153
|
+
|
|
154
|
+
```go
|
|
155
|
+
// Confirmation with non-interactive fallback
|
|
156
|
+
func confirm(message string, force bool) bool {
|
|
157
|
+
if force || !term.IsTerminal(int(os.Stdin.Fd())) {
|
|
158
|
+
return true
|
|
159
|
+
}
|
|
160
|
+
// Show interactive prompt
|
|
161
|
+
}
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
---
|
|
165
|
+
|
|
166
|
+
## Error Handling
|
|
167
|
+
|
|
168
|
+
### Exit Codes
|
|
169
|
+
|
|
170
|
+
| Code | Meaning |
|
|
171
|
+
|------|---------|
|
|
172
|
+
| 0 | Success |
|
|
173
|
+
| 1 | General error |
|
|
174
|
+
| 2 | Invalid arguments |
|
|
175
|
+
| 130 | Interrupted (Ctrl+C) |
|
|
176
|
+
|
|
177
|
+
### Error Message Structure
|
|
178
|
+
|
|
179
|
+
```
|
|
180
|
+
Error: cannot read config file
|
|
181
|
+
|
|
182
|
+
File: /home/user/.config/mytool/config.yaml
|
|
183
|
+
Cause: permission denied
|
|
184
|
+
|
|
185
|
+
Try:
|
|
186
|
+
• Check file permissions: ls -la ~/.config/mytool/
|
|
187
|
+
• Fix permissions: chmod 600 ~/.config/mytool/config.yaml
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
### Error Message Guidelines
|
|
191
|
+
|
|
192
|
+
1. **What happened** - Clear description
|
|
193
|
+
2. **Context** - Relevant details (paths, values)
|
|
194
|
+
3. **Why** - Root cause if known
|
|
195
|
+
4. **How to fix** - Actionable suggestions
|
|
196
|
+
|
|
197
|
+
---
|
|
198
|
+
|
|
199
|
+
## Testing
|
|
200
|
+
|
|
201
|
+
### Test Levels
|
|
202
|
+
|
|
203
|
+
| Level | What to Test | How |
|
|
204
|
+
|-------|--------------|-----|
|
|
205
|
+
| Unit | Business logic | Mock dependencies |
|
|
206
|
+
| Integration | Full commands | Capture stdout/stderr |
|
|
207
|
+
| E2E | User workflows | Run actual binary |
|
|
208
|
+
|
|
209
|
+
### Mocking I/O
|
|
210
|
+
|
|
211
|
+
```go
|
|
212
|
+
// Capture output
|
|
213
|
+
stdout := new(bytes.Buffer)
|
|
214
|
+
stderr := new(bytes.Buffer)
|
|
215
|
+
cmd.SetOut(stdout)
|
|
216
|
+
cmd.SetErr(stderr)
|
|
217
|
+
|
|
218
|
+
// Mock stdin
|
|
219
|
+
r, w, _ := os.Pipe()
|
|
220
|
+
go func() {
|
|
221
|
+
w.WriteString("y\n")
|
|
222
|
+
w.Close()
|
|
223
|
+
}()
|
|
224
|
+
os.Stdin = r
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
### Test Exit Codes
|
|
228
|
+
|
|
229
|
+
```go
|
|
230
|
+
func TestExitCodes(t *testing.T) {
|
|
231
|
+
cmd := exec.Command("./mytool", "invalid")
|
|
232
|
+
err := cmd.Run()
|
|
233
|
+
exitErr := err.(*exec.ExitError)
|
|
234
|
+
assert.Equal(t, 2, exitErr.ExitCode())
|
|
235
|
+
}
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
---
|
|
239
|
+
|
|
240
|
+
## Distribution
|
|
241
|
+
|
|
242
|
+
### Version Information
|
|
243
|
+
|
|
244
|
+
```bash
|
|
245
|
+
$ mytool version
|
|
246
|
+
mytool 1.0.0
|
|
247
|
+
commit: abc123
|
|
248
|
+
built: 2025-01-27
|
|
249
|
+
go: go1.22
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
### Installation Methods
|
|
253
|
+
|
|
254
|
+
```bash
|
|
255
|
+
# Homebrew
|
|
256
|
+
brew install myorg/tap/mytool
|
|
257
|
+
|
|
258
|
+
# npm
|
|
259
|
+
npm install -g mytool
|
|
260
|
+
|
|
261
|
+
# Go
|
|
262
|
+
go install github.com/myorg/mytool@latest
|
|
263
|
+
|
|
264
|
+
# Direct download
|
|
265
|
+
curl -fsSL https://example.com/install.sh | bash
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
### Shell Completions
|
|
269
|
+
|
|
270
|
+
```bash
|
|
271
|
+
# Generate completions
|
|
272
|
+
mytool completion bash > /etc/bash_completion.d/mytool
|
|
273
|
+
mytool completion zsh > "${fpath[1]}/_mytool"
|
|
274
|
+
mytool completion fish > ~/.config/fish/completions/mytool.fish
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
---
|
|
278
|
+
|
|
279
|
+
## Definition of Done
|
|
280
|
+
|
|
281
|
+
A CLI tool is ready for release when:
|
|
282
|
+
|
|
283
|
+
- [ ] All commands have help text and examples
|
|
284
|
+
- [ ] Error messages suggest corrective actions
|
|
285
|
+
- [ ] Exit codes follow conventions
|
|
286
|
+
- [ ] Works in non-interactive environments (CI/CD)
|
|
287
|
+
- [ ] Supports stdin/stdout piping
|
|
288
|
+
- [ ] Configuration precedence documented
|
|
289
|
+
- [ ] Shell completions available
|
|
290
|
+
- [ ] Version flag shows useful info
|
|
291
|
+
- [ ] Tests cover happy path and errors
|
|
292
|
+
- [ ] Installation instructions documented
|
|
293
|
+
|
|
294
|
+
---
|
|
295
|
+
|
|
296
|
+
## Common Pitfalls
|
|
297
|
+
|
|
298
|
+
### 1. Ignoring Non-TTY Environments
|
|
299
|
+
|
|
300
|
+
```go
|
|
301
|
+
// Bad: Always show spinner
|
|
302
|
+
spinner.Start()
|
|
303
|
+
|
|
304
|
+
// Good: Detect TTY
|
|
305
|
+
if term.IsTerminal(int(os.Stderr.Fd())) {
|
|
306
|
+
spinner.Start()
|
|
307
|
+
} else {
|
|
308
|
+
fmt.Fprintln(os.Stderr, "Processing...")
|
|
309
|
+
}
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
### 2. Hardcoded Paths
|
|
313
|
+
|
|
314
|
+
```go
|
|
315
|
+
// Bad
|
|
316
|
+
configPath := "/etc/mytool/config.yaml"
|
|
317
|
+
|
|
318
|
+
// Good
|
|
319
|
+
configPath := filepath.Join(xdg.ConfigHome, "mytool", "config.yaml")
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
### 3. Silent Failures
|
|
323
|
+
|
|
324
|
+
```go
|
|
325
|
+
// Bad
|
|
326
|
+
result, _ := riskyOperation()
|
|
327
|
+
|
|
328
|
+
// Good
|
|
329
|
+
result, err := riskyOperation()
|
|
330
|
+
if err != nil {
|
|
331
|
+
return fmt.Errorf("operation failed: %w", err)
|
|
332
|
+
}
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
### 4. Missing Non-Interactive Support
|
|
336
|
+
|
|
337
|
+
```go
|
|
338
|
+
// Bad: Always prompts
|
|
339
|
+
answer := prompt("Continue?")
|
|
340
|
+
|
|
341
|
+
// Good: Respect --force flag
|
|
342
|
+
if !force {
|
|
343
|
+
answer := prompt("Continue?")
|
|
344
|
+
}
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
---
|
|
348
|
+
|
|
349
|
+
## Resources
|
|
350
|
+
|
|
351
|
+
- [Command Line Interface Guidelines](https://clig.dev/)
|
|
352
|
+
- [Better CLI](https://better-cli.org/)
|
|
353
|
+
- [Cobra Documentation](https://cobra.dev/)
|
|
354
|
+
- [Commander.js](https://github.com/tj/commander.js)
|
|
355
|
+
- [Click Documentation](https://click.palletsprojects.com/)
|
|
356
|
+
- [Clap Documentation](https://docs.rs/clap/)
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Data Modeling
|
|
3
|
+
alwaysApply: false
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Data Modeling
|
|
7
|
+
|
|
8
|
+
Patterns for scalable, maintainable data models.
|
|
9
|
+
|
|
10
|
+
## Medallion Architecture
|
|
11
|
+
|
|
12
|
+
- **Bronze/Raw** — exact source copy, append-only, no transforms
|
|
13
|
+
- **Silver/Curated** — validated, typed, deduplicated, business keys applied
|
|
14
|
+
- **Gold/Marts** — aggregated, business-ready, optimized for consumption
|
|
15
|
+
|
|
16
|
+
## Dimensional Modeling (Star Schema)
|
|
17
|
+
|
|
18
|
+
- **Fact tables** — immutable events with measures and FK references to dimensions; partition by date
|
|
19
|
+
- **Dimension tables** — descriptive attributes with surrogate keys for SCD support
|
|
20
|
+
|
|
21
|
+
```sql
|
|
22
|
+
-- Fact: measures + foreign keys, partitioned by date
|
|
23
|
+
CREATE TABLE facts.orders (
|
|
24
|
+
order_id STRING, customer_key BIGINT, product_key BIGINT,
|
|
25
|
+
quantity INT, total_amount DECIMAL(12,2), _loaded_at TIMESTAMP
|
|
26
|
+
) PARTITIONED BY (order_date);
|
|
27
|
+
|
|
28
|
+
-- Dimension: surrogate key + SCD Type 2 tracking
|
|
29
|
+
CREATE TABLE dims.customers (
|
|
30
|
+
customer_key BIGINT GENERATED ALWAYS AS IDENTITY,
|
|
31
|
+
customer_id STRING, name STRING, segment STRING,
|
|
32
|
+
effective_from DATE, effective_to DATE, is_current BOOLEAN
|
|
33
|
+
);
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Slowly Changing Dimensions
|
|
37
|
+
|
|
38
|
+
- **Type 1** — overwrite in place; no history
|
|
39
|
+
- **Type 2** — close old row (`is_current=false`, set `effective_to`), insert new row; full history
|
|
40
|
+
- **Type 3** — add `previous_*` column; limited history (one prior value)
|
|
41
|
+
|
|
42
|
+
## Schema Design Rules
|
|
43
|
+
|
|
44
|
+
- **Types**: IDs as STRING, money as DECIMAL, dates as DATE/TIMESTAMP, flags as BOOLEAN
|
|
45
|
+
- **Naming**: tables plural snake_case, columns singular snake_case, FKs as `*_key`, booleans as `is_*`/`has_*`, timestamps as `*_at`, dates as `*_date`
|
|
46
|
+
- **Avoid wide tables** — normalize into fact + dimension; join at query time
|
|
47
|
+
|
|
48
|
+
```sql
|
|
49
|
+
-- Bad: float for money, string for dates
|
|
50
|
+
unit_price FLOAT, order_date STRING
|
|
51
|
+
|
|
52
|
+
-- Good: precise types
|
|
53
|
+
unit_price DECIMAL(10,2), order_date DATE
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Partitioning Strategies
|
|
57
|
+
|
|
58
|
+
- **Time-based** — most common; partition by date for time-series data
|
|
59
|
+
- **Categorical** — partition by high-cardinality enum (e.g., event_type)
|
|
60
|
+
- Avoid over-partitioning; use clustering/bucketing for secondary access patterns
|
|
61
|
+
|
|
62
|
+
## Alternative Approaches
|
|
63
|
+
|
|
64
|
+
- **Data Vault** — Hub (business keys) + Link (relationships) + Satellite (attributes with history); for enterprise DWH
|
|
65
|
+
- **One Big Table (OBT)** — fully denormalized for BI tools; fast reads but harder updates
|
|
66
|
+
|
|
67
|
+
## Anti-Patterns
|
|
68
|
+
|
|
69
|
+
- Floating-point types for monetary values
|
|
70
|
+
- Storing dates as strings (breaks date math, inconsistent formats)
|
|
71
|
+
- Over-partitioning on high-cardinality columns (millions of tiny files)
|