ai-playbook 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 +146 -0
- package/agents/README.md +168 -0
- package/agents/SKILL.md +633 -0
- package/agents/architect/AGENT.md +44 -0
- package/agents/architect/README.md +5 -0
- package/agents/coder/AGENT.md +43 -0
- package/agents/coder/README.md +5 -0
- package/agents/debugger/AGENT.md +42 -0
- package/agents/debugger/README.md +6 -0
- package/agents/devops/AGENT.md +43 -0
- package/agents/devops/README.md +5 -0
- package/agents/documentation/AGENT.md +45 -0
- package/agents/documentation/README.md +5 -0
- package/agents/examples.md +550 -0
- package/agents/performance/AGENT.md +45 -0
- package/agents/performance/README.md +6 -0
- package/agents/planner/AGENT.md +44 -0
- package/agents/planner/README.md +6 -0
- package/agents/product-owner/AGENT.md +46 -0
- package/agents/product-owner/README.md +6 -0
- package/agents/refactorer/AGENT.md +44 -0
- package/agents/refactorer/README.md +6 -0
- package/agents/release-manager/AGENT.md +45 -0
- package/agents/release-manager/README.md +6 -0
- package/agents/researcher/AGENT.md +44 -0
- package/agents/researcher/README.md +6 -0
- package/agents/reviewer/AGENT.md +43 -0
- package/agents/reviewer/README.md +6 -0
- package/agents/security/AGENT.md +46 -0
- package/agents/security/README.md +6 -0
- package/agents/support/AGENT.md +45 -0
- package/agents/support/README.md +6 -0
- package/agents/tester/AGENT.md +46 -0
- package/agents/tester/README.md +5 -0
- package/bin/cli.js +186 -0
- package/commands/README.md +266 -0
- package/commands/build.md +135 -0
- package/commands/clean.md +126 -0
- package/commands/deploy-prod.md +171 -0
- package/commands/deploy-staging.md +147 -0
- package/commands/deps.md +169 -0
- package/commands/dev.md +132 -0
- package/commands/format.md +142 -0
- package/commands/lint.md +125 -0
- package/commands/migrate.md +159 -0
- package/commands/release.md +183 -0
- package/commands/rollback.md +152 -0
- package/commands/seed.md +178 -0
- package/commands/setup.md +109 -0
- package/commands/test.md +134 -0
- package/commands/validate.md +147 -0
- package/context/README.md +7 -0
- package/context/aem.md +47 -0
- package/context/architecture.md +51 -0
- package/context/bullminder.md +57 -0
- package/context/coding-style.md +42 -0
- package/context/communication.md +53 -0
- package/context/company.md +46 -0
- package/context/engineering.md +63 -0
- package/context/project-template.md +71 -0
- package/context/trading.md +52 -0
- package/hooks/README.md +326 -0
- package/hooks/code-review/README.md +6 -0
- package/hooks/code-review/check-coverage.md +101 -0
- package/hooks/custom/README.md +6 -0
- package/hooks/custom/project-specific-hooks.md +273 -0
- package/hooks/deployment/README.md +6 -0
- package/hooks/deployment/health-check.md +102 -0
- package/hooks/deployment/pre-deploy-check.md +84 -0
- package/hooks/documentation/README.md +6 -0
- package/hooks/documentation/update-changelog.md +146 -0
- package/hooks/post-task/README.md +5 -0
- package/hooks/post-task/run-tests.md +61 -0
- package/hooks/pre-commit/README.md +6 -0
- package/hooks/pre-commit/format.md +63 -0
- package/hooks/pre-commit/lint.md +62 -0
- package/hooks/pre-commit/type-check.md +78 -0
- package/hooks/pre-task/README.md +6 -0
- package/hooks/pre-task/check-branch.md +48 -0
- package/hooks/pre-task/validate-environment.md +48 -0
- package/hooks/security-check/README.md +6 -0
- package/hooks/security-check/dependency-audit.md +85 -0
- package/hooks/security-check/secrets-scan.md +77 -0
- package/hooks/test-before-finish/README.md +6 -0
- package/hooks/test-before-finish/run-all-tests.md +128 -0
- package/index.js +69 -0
- package/knowledge/README.md +33 -0
- package/knowledge/ai-agents.md +74 -0
- package/knowledge/decision-making.md +73 -0
- package/knowledge/documentation.md +67 -0
- package/knowledge/engineering-principles.md +65 -0
- package/knowledge/product-discovery.md +68 -0
- package/knowledge/security-privacy.md +54 -0
- package/knowledge/testing-quality.md +63 -0
- package/package.json +63 -0
- package/patterns/README.md +7 -0
- package/prompts/README.md +208 -0
- package/prompts/architect/README.md +96 -0
- package/prompts/architect/design-system.md +140 -0
- package/prompts/debugger/README.md +96 -0
- package/prompts/debugger/diagnose-issue.md +141 -0
- package/prompts/developer/README.md +129 -0
- package/prompts/developer/fix-bug.md +136 -0
- package/prompts/developer/implement-feature.md +133 -0
- package/prompts/product-owner/README.md +116 -0
- package/prompts/product-owner/define-feature.md +145 -0
- package/prompts/reviewer/README.md +91 -0
- package/prompts/reviewer/code-review.md +129 -0
- package/prompts/support/README.md +154 -0
- package/prompts/support/resolve-issue.md +124 -0
- package/roles/README.md +6 -0
- package/roles/design-architect/README.md +98 -0
- package/roles/design-architect/accessibility/README.md +33 -0
- package/roles/design-architect/accessibility/checklists.md +29 -0
- package/roles/design-architect/accessibility/examples.md +35 -0
- package/roles/design-architect/checklists.md +76 -0
- package/roles/design-architect/component-library/README.md +35 -0
- package/roles/design-architect/component-library/checklists.md +29 -0
- package/roles/design-architect/component-library/examples.md +35 -0
- package/roles/design-architect/design-system/README.md +35 -0
- package/roles/design-architect/design-system/checklists.md +27 -0
- package/roles/design-architect/design-system/examples.md +41 -0
- package/roles/design-architect/examples/README.md +31 -0
- package/roles/design-architect/examples/checklists.md +26 -0
- package/roles/design-architect/examples/examples.md +46 -0
- package/roles/design-architect/examples.md +90 -0
- package/roles/design-architect/figma/README.md +33 -0
- package/roles/design-architect/figma/checklists.md +27 -0
- package/roles/design-architect/figma/examples.md +38 -0
- package/roles/design-architect/responsibilities.md +73 -0
- package/roles/design-architect/responsive/README.md +34 -0
- package/roles/design-architect/responsive/checklists.md +26 -0
- package/roles/design-architect/responsive/examples.md +39 -0
- package/roles/design-architect/role.md +129 -0
- package/roles/design-architect/skill-map.md +42 -0
- package/roles/design-architect/triggers.md +110 -0
- package/roles/design-architect/ui/README.md +36 -0
- package/roles/design-architect/ui/checklists.md +29 -0
- package/roles/design-architect/ui/examples.md +28 -0
- package/roles/design-architect/usability/README.md +34 -0
- package/roles/design-architect/usability/checklists.md +28 -0
- package/roles/design-architect/usability/examples.md +31 -0
- package/roles/design-architect/ux/README.md +36 -0
- package/roles/design-architect/ux/checklists.md +28 -0
- package/roles/design-architect/ux/examples.md +37 -0
- package/roles/design-architect/wireframes/README.md +34 -0
- package/roles/design-architect/wireframes/checklists.md +25 -0
- package/roles/design-architect/wireframes/examples.md +32 -0
- package/roles/design-architect/workflow.md +80 -0
- package/roles/devops/README.md +101 -0
- package/roles/devops/ansible/README.md +6 -0
- package/roles/devops/checklists.md +413 -0
- package/roles/devops/ci-cd/README.md +169 -0
- package/roles/devops/ci-cd/checklists.md +289 -0
- package/roles/devops/ci-cd/examples.md +429 -0
- package/roles/devops/cloud-platforms/README.md +109 -0
- package/roles/devops/cost-optimization/README.md +131 -0
- package/roles/devops/disaster-recovery/README.md +118 -0
- package/roles/devops/docker/README.md +6 -0
- package/roles/devops/examples/README.md +6 -0
- package/roles/devops/examples.md +775 -0
- package/roles/devops/github-actions/README.md +6 -0
- package/roles/devops/helm/README.md +6 -0
- package/roles/devops/infrastructure-as-code/README.md +160 -0
- package/roles/devops/infrastructure-as-code/checklists.md +124 -0
- package/roles/devops/jenkins/README.md +6 -0
- package/roles/devops/kubernetes/README.md +150 -0
- package/roles/devops/kubernetes/checklists.md +192 -0
- package/roles/devops/kubernetes/examples.md +189 -0
- package/roles/devops/monitoring/README.md +93 -0
- package/roles/devops/networking/README.md +83 -0
- package/roles/devops/performance/README.md +104 -0
- package/roles/devops/responsibilities.md +95 -0
- package/roles/devops/role.md +130 -0
- package/roles/devops/security/README.md +126 -0
- package/roles/devops/skill-map.md +162 -0
- package/roles/devops/terraform/README.md +6 -0
- package/roles/devops/triggers.md +241 -0
- package/roles/devops/workflow.md +197 -0
- package/roles/qa/README.md +16 -0
- package/roles/qa/api-testing/README.md +6 -0
- package/roles/qa/automation/README.md +6 -0
- package/roles/qa/checklists.md +24 -0
- package/roles/qa/examples/README.md +6 -0
- package/roles/qa/examples.md +27 -0
- package/roles/qa/performance/README.md +6 -0
- package/roles/qa/playwright/README.md +6 -0
- package/roles/qa/responsibilities.md +16 -0
- package/roles/qa/role.md +47 -0
- package/roles/qa/selenium/README.md +6 -0
- package/roles/qa/skill-map.md +14 -0
- package/roles/qa/triggers.md +10 -0
- package/roles/qa/workflow.md +9 -0
- package/roles/software-architect/README.md +16 -0
- package/roles/software-architect/agents/README.md +6 -0
- package/roles/software-architect/ai-architecture/README.md +6 -0
- package/roles/software-architect/aws/README.md +6 -0
- package/roles/software-architect/azure/README.md +6 -0
- package/roles/software-architect/caching/README.md +6 -0
- package/roles/software-architect/checklists.md +25 -0
- package/roles/software-architect/cloud/README.md +6 -0
- package/roles/software-architect/database-design/README.md +6 -0
- package/roles/software-architect/diagrams/README.md +6 -0
- package/roles/software-architect/distributed-systems/README.md +7 -0
- package/roles/software-architect/docker/README.md +6 -0
- package/roles/software-architect/event-driven/README.md +7 -0
- package/roles/software-architect/examples/README.md +6 -0
- package/roles/software-architect/examples.md +22 -0
- package/roles/software-architect/gcp/README.md +6 -0
- package/roles/software-architect/kubernetes/README.md +6 -0
- package/roles/software-architect/messaging/README.md +6 -0
- package/roles/software-architect/rag/README.md +7 -0
- package/roles/software-architect/responsibilities.md +17 -0
- package/roles/software-architect/role.md +46 -0
- package/roles/software-architect/scalability/README.md +6 -0
- package/roles/software-architect/security/README.md +6 -0
- package/roles/software-architect/skill-map.md +15 -0
- package/roles/software-architect/system-design/README.md +6 -0
- package/roles/software-architect/triggers.md +10 -0
- package/roles/software-architect/vector-db/README.md +6 -0
- package/roles/software-architect/workflow.md +9 -0
- package/roles/software-developer/README.md +116 -0
- package/roles/software-developer/api/README.md +365 -0
- package/roles/software-developer/api/checklist.md +131 -0
- package/roles/software-developer/api/examples.md +459 -0
- package/roles/software-developer/authentication/README.md +26 -0
- package/roles/software-developer/authentication/checklists.md +22 -0
- package/roles/software-developer/authentication/examples.md +32 -0
- package/roles/software-developer/authorization/README.md +26 -0
- package/roles/software-developer/authorization/checklists.md +21 -0
- package/roles/software-developer/authorization/examples.md +27 -0
- package/roles/software-developer/backend/README.md +26 -0
- package/roles/software-developer/backend/checklists.md +21 -0
- package/roles/software-developer/backend/examples.md +21 -0
- package/roles/software-developer/cache/README.md +25 -0
- package/roles/software-developer/cache/checklists.md +21 -0
- package/roles/software-developer/cache/examples.md +22 -0
- package/roles/software-developer/checklists.md +122 -0
- package/roles/software-developer/code-review/README.md +23 -0
- package/roles/software-developer/code-review/checklists.md +22 -0
- package/roles/software-developer/code-review/examples.md +20 -0
- package/roles/software-developer/database/README.md +27 -0
- package/roles/software-developer/database/checklists.md +21 -0
- package/roles/software-developer/database/examples.md +27 -0
- package/roles/software-developer/debugging/README.md +24 -0
- package/roles/software-developer/debugging/checklists.md +20 -0
- package/roles/software-developer/debugging/examples.md +28 -0
- package/roles/software-developer/examples/README.md +22 -0
- package/roles/software-developer/examples/checklists.md +8 -0
- package/roles/software-developer/examples/examples.md +25 -0
- package/roles/software-developer/examples.md +378 -0
- package/roles/software-developer/frontend/README.md +76 -0
- package/roles/software-developer/frontend/accessibility/README.md +136 -0
- package/roles/software-developer/frontend/accessibility/best-practices.md +368 -0
- package/roles/software-developer/frontend/code-quality/README.md +136 -0
- package/roles/software-developer/frontend/code-quality/best-practices.md +309 -0
- package/roles/software-developer/frontend/components/README.md +65 -0
- package/roles/software-developer/frontend/components/best-practices.md +273 -0
- package/roles/software-developer/frontend/debugging/README.md +149 -0
- package/roles/software-developer/frontend/debugging/best-practices.md +329 -0
- package/roles/software-developer/frontend/examples/README.md +19 -0
- package/roles/software-developer/frontend/examples/checklists.md +8 -0
- package/roles/software-developer/frontend/examples/examples.md +17 -0
- package/roles/software-developer/frontend/logging-observability/README.md +196 -0
- package/roles/software-developer/frontend/logging-observability/best-practices.md +430 -0
- package/roles/software-developer/frontend/performance/README.md +99 -0
- package/roles/software-developer/frontend/performance/best-practices.md +350 -0
- package/roles/software-developer/frontend/state-management/README.md +85 -0
- package/roles/software-developer/frontend/state-management/best-practices.md +344 -0
- package/roles/software-developer/frontend/testing/README.md +114 -0
- package/roles/software-developer/frontend/testing/best-practices.md +272 -0
- package/roles/software-developer/fullstack/README.md +25 -0
- package/roles/software-developer/fullstack/checklists.md +19 -0
- package/roles/software-developer/fullstack/examples.md +14 -0
- package/roles/software-developer/graphql/README.md +24 -0
- package/roles/software-developer/graphql/checklists.md +20 -0
- package/roles/software-developer/graphql/examples.md +24 -0
- package/roles/software-developer/integration-tests/README.md +25 -0
- package/roles/software-developer/integration-tests/checklists.md +20 -0
- package/roles/software-developer/integration-tests/examples.md +18 -0
- package/roles/software-developer/java/README.md +24 -0
- package/roles/software-developer/java/checklists.md +16 -0
- package/roles/software-developer/java/examples.md +22 -0
- package/roles/software-developer/javascript/README.md +24 -0
- package/roles/software-developer/javascript/checklists.md +15 -0
- package/roles/software-developer/javascript/examples.md +18 -0
- package/roles/software-developer/logging/README.md +105 -0
- package/roles/software-developer/logging/checklists.md +48 -0
- package/roles/software-developer/logging/examples.md +135 -0
- package/roles/software-developer/messaging/README.md +24 -0
- package/roles/software-developer/messaging/checklists.md +21 -0
- package/roles/software-developer/messaging/examples.md +26 -0
- package/roles/software-developer/microservices/README.md +25 -0
- package/roles/software-developer/microservices/checklists.md +21 -0
- package/roles/software-developer/microservices/examples.md +21 -0
- package/roles/software-developer/node/README.md +25 -0
- package/roles/software-developer/node/checklists.md +15 -0
- package/roles/software-developer/node/examples.md +15 -0
- package/roles/software-developer/nosql/README.md +24 -0
- package/roles/software-developer/nosql/checklists.md +21 -0
- package/roles/software-developer/nosql/examples.md +20 -0
- package/roles/software-developer/observability/README.md +25 -0
- package/roles/software-developer/observability/checklists.md +21 -0
- package/roles/software-developer/observability/examples.md +22 -0
- package/roles/software-developer/performance/README.md +26 -0
- package/roles/software-developer/performance/checklists.md +20 -0
- package/roles/software-developer/performance/examples.md +20 -0
- package/roles/software-developer/python/README.md +25 -0
- package/roles/software-developer/python/checklists.md +15 -0
- package/roles/software-developer/python/examples.md +17 -0
- package/roles/software-developer/react/README.md +24 -0
- package/roles/software-developer/react/checklists.md +15 -0
- package/roles/software-developer/react/examples.md +22 -0
- package/roles/software-developer/refactoring/README.md +23 -0
- package/roles/software-developer/refactoring/checklists.md +21 -0
- package/roles/software-developer/refactoring/examples.md +11 -0
- package/roles/software-developer/responsibilities.md +58 -0
- package/roles/software-developer/role.md +127 -0
- package/roles/software-developer/skill-map.md +88 -0
- package/roles/software-developer/springboot/README.md +25 -0
- package/roles/software-developer/springboot/checklists.md +15 -0
- package/roles/software-developer/springboot/examples.md +21 -0
- package/roles/software-developer/sql/README.md +24 -0
- package/roles/software-developer/sql/checklists.md +22 -0
- package/roles/software-developer/sql/examples.md +20 -0
- package/roles/software-developer/testing/README.md +25 -0
- package/roles/software-developer/testing/checklists.md +21 -0
- package/roles/software-developer/testing/examples.md +19 -0
- package/roles/software-developer/triggers.md +550 -0
- package/roles/software-developer/typescript/README.md +25 -0
- package/roles/software-developer/typescript/checklists.md +15 -0
- package/roles/software-developer/typescript/examples.md +18 -0
- package/roles/software-developer/unit-tests/README.md +24 -0
- package/roles/software-developer/unit-tests/checklists.md +19 -0
- package/roles/software-developer/unit-tests/examples.md +22 -0
- package/roles/software-developer/workflow.md +196 -0
- package/roles/sre/README.md +16 -0
- package/roles/sre/alerts/README.md +6 -0
- package/roles/sre/availability/README.md +6 -0
- package/roles/sre/chaos/README.md +6 -0
- package/roles/sre/checklists.md +24 -0
- package/roles/sre/examples/README.md +6 -0
- package/roles/sre/examples.md +19 -0
- package/roles/sre/observability/README.md +6 -0
- package/roles/sre/reliability/README.md +6 -0
- package/roles/sre/responsibilities.md +16 -0
- package/roles/sre/role.md +46 -0
- package/roles/sre/skill-map.md +14 -0
- package/roles/sre/slos/README.md +6 -0
- package/roles/sre/triggers.md +10 -0
- package/roles/sre/workflow.md +9 -0
- package/roles/support-engineer/README.md +16 -0
- package/roles/support-engineer/checklists.md +24 -0
- package/roles/support-engineer/datadog/README.md +6 -0
- package/roles/support-engineer/examples/README.md +6 -0
- package/roles/support-engineer/examples.md +17 -0
- package/roles/support-engineer/incident-response/README.md +6 -0
- package/roles/support-engineer/kubernetes/README.md +6 -0
- package/roles/support-engineer/linux/README.md +6 -0
- package/roles/support-engineer/logs/README.md +6 -0
- package/roles/support-engineer/monitoring/README.md +6 -0
- package/roles/support-engineer/networking/README.md +6 -0
- package/roles/support-engineer/newrelic/README.md +6 -0
- package/roles/support-engineer/postmortem/README.md +6 -0
- package/roles/support-engineer/production/README.md +6 -0
- package/roles/support-engineer/responsibilities.md +16 -0
- package/roles/support-engineer/role.md +47 -0
- package/roles/support-engineer/root-cause-analysis/README.md +6 -0
- package/roles/support-engineer/runbooks/README.md +6 -0
- package/roles/support-engineer/skill-map.md +14 -0
- package/roles/support-engineer/splunk/README.md +6 -0
- package/roles/support-engineer/triggers.md +10 -0
- package/roles/support-engineer/troubleshooting/README.md +6 -0
- package/roles/support-engineer/workflow.md +9 -0
- package/setup.sh +204 -0
- package/skills/.claude/README.md +7 -0
- package/skills/README.md +21 -0
- package/skills/ai-agents/README.md +207 -0
- package/skills/ai-agents/examples.md +335 -0
- package/skills/ai-agents/skill.md +392 -0
- package/skills/architecture/README.md +198 -0
- package/skills/architecture/examples.md +316 -0
- package/skills/architecture/skill.md +189 -0
- package/skills/design-architecture/README.md +107 -0
- package/skills/design-architecture/examples.md +84 -0
- package/skills/design-architecture/skill.md +192 -0
- package/skills/devops/README.md +177 -0
- package/skills/devops/examples.md +376 -0
- package/skills/devops/skill.md +210 -0
- package/skills/documentation/README.md +182 -0
- package/skills/documentation/examples.md +364 -0
- package/skills/documentation/skill.md +200 -0
- package/skills/performance/README.md +177 -0
- package/skills/performance/examples.md +376 -0
- package/skills/performance/skill.md +199 -0
- package/skills/qa/README.md +106 -0
- package/skills/qa/examples.md +84 -0
- package/skills/qa/skill.md +384 -0
- package/skills/security/README.md +108 -0
- package/skills/security/examples.md +85 -0
- package/skills/security/skill.md +223 -0
- package/skills/software-development/README.md +239 -0
- package/skills/software-development/assessment.md +0 -0
- package/skills/software-development/checklists.md +0 -0
- package/skills/software-development/examples.md +375 -0
- package/skills/software-development/prompts.md +0 -0
- package/skills/software-development/skill.md +390 -0
- package/skills/software-development/templates/README.md +7 -0
- package/skills/software-development/templates/api-development.md +0 -0
- package/skills/software-development/templates/bug-fix.md +0 -0
- package/skills/software-development/templates/code-review.md +0 -0
- package/skills/software-development/templates/feature-implementation.md +0 -0
- package/skills/software-development/templates/llm-integration.md +0 -0
- package/skills/software-development/templates/performance-review.md +0 -0
- package/skills/software-development/templates/security-review.md +0 -0
- package/skills/software-development/templates/test-generation.md +0 -0
- package/skills/software-development/tools.md +0 -0
- package/skills/software-development/workflows.md +0 -0
- package/skills/sre/README.md +107 -0
- package/skills/sre/examples.md +379 -0
- package/skills/sre/skill.md +256 -0
- package/skills/support-engineering/README.md +107 -0
- package/skills/support-engineering/examples.md +85 -0
- package/skills/support-engineering/skill.md +103 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Testing Checklists
|
|
2
|
+
|
|
3
|
+
## Plan
|
|
4
|
+
|
|
5
|
+
- [ ] Identify risk: logic, integration, data, security, performance, or UI behavior.
|
|
6
|
+
- [ ] Choose appropriate test type and scope.
|
|
7
|
+
- [ ] Define fixtures, mocks, fakes, and cleanup strategy.
|
|
8
|
+
- [ ] Include negative and edge cases.
|
|
9
|
+
|
|
10
|
+
## Implementation
|
|
11
|
+
|
|
12
|
+
- [ ] Use descriptive test names.
|
|
13
|
+
- [ ] Keep arrange, act, assert steps clear.
|
|
14
|
+
- [ ] Avoid dependence on test order, wall-clock time, or shared mutable state.
|
|
15
|
+
- [ ] Test public behavior rather than private implementation when possible.
|
|
16
|
+
|
|
17
|
+
## Verification
|
|
18
|
+
|
|
19
|
+
- [ ] Run targeted tests and relevant broader suite.
|
|
20
|
+
- [ ] Confirm failures are understandable.
|
|
21
|
+
- [ ] Remove or quarantine flaky tests only with a tracked follow-up.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Testing Examples
|
|
2
|
+
|
|
3
|
+
## Test Name Shape
|
|
4
|
+
|
|
5
|
+
```python
|
|
6
|
+
def test_create_user_rejects_duplicate_email_within_tenant():
|
|
7
|
+
...
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
## Arrange Act Assert
|
|
11
|
+
|
|
12
|
+
```python
|
|
13
|
+
def test_total_includes_tax():
|
|
14
|
+
cart = Cart(items=[Item(price=100)], tax_rate=0.08)
|
|
15
|
+
|
|
16
|
+
total = cart.total()
|
|
17
|
+
|
|
18
|
+
assert total == 108
|
|
19
|
+
```
|
|
@@ -0,0 +1,550 @@
|
|
|
1
|
+
# Triggers.md
|
|
2
|
+
## Event‑Driven Triggers for the End‑to‑End Development Lifecycle
|
|
3
|
+
|
|
4
|
+
This document enumerates every **trigger** that should cause an automatic or semi‑automatic action in the **Software‑Developer** workflow described by `role.md`, `checklists.md`, `skill-map.md`, and `responsibilities.md`.
|
|
5
|
+
Each trigger includes:
|
|
6
|
+
|
|
7
|
+
* **Name** – a short identifier.
|
|
8
|
+
* **Source** – where the event originates (code push, schedule, external system, etc.).
|
|
9
|
+
* **Condition(s)** – the exact criteria that must be met for the trigger to fire.
|
|
10
|
+
* **Resulting Action(s)** – what the system shall do when the condition is satisfied (e.g., start a CI job, post a Slack message, run a script).
|
|
11
|
+
* **Configuration Hint** – a minimal example (YAML, CLI command, or JSON snippet) to help you wire the trigger in your tooling (GitHub Actions, Jenkins, GitLab CI, Argo Events, etc.).
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## 1️⃣ Triggers Overview
|
|
16
|
+
|
|
17
|
+
| # | Trigger | Typical Source | When It Fires | Primary Business Value |
|
|
18
|
+
|---|---------|----------------|---------------|------------------------|
|
|
19
|
+
| 1 | **Task‑Received** | Issue tracker (Jira, GitHub Issues, Asana) – new ticket assigned | Immediately after assignment | Notifies assignee, creates work‑item in the local sprint board, loads context. |
|
|
20
|
+
| 2 | **Branch‑Created** | Git push / PR creation | New branch pushed to `remotes/origin/<branch>` | Starts a *feature‑branch* lint/CI pipeline, creates a preview environment. |
|
|
21
|
+
| 3 | **Pull‑Request‑Opened / Updated** | Pull‑request event | PR opened or any subsequent push to the source branch | Begins review process, runs CI, posts status back to GitHub. |
|
|
22
|
+
| 4 | **CI‑Pipeline‑Success** | CI system (GitHub Actions, Jenkins, GitLab CI) | All job stages (`lint`, `test`, `security-scan`, `build`) finish with **pass** | Allows merge, triggers deployment gate, notifies reviewers. |
|
|
23
|
+
| 5 | **CI‑Pipeline‑Failure** | Same as #4 | Any stage returns a **failed** or **cancelled** status | Stops merge, opens a ticket for investigation, triggers alert. |
|
|
24
|
+
| 6 | **Test‑Coverage‑Threshold‑Met** | Coverage tool (`coverage.py`, `nyc`, `gcov`) | Coverage of new code ≥ configured % (e.g., 80 % line, 70 % branch) | Unlocks merge, encourages quality compliance. |
|
|
25
|
+
| 7 | **Security‑Scan‑Failure** | Static analysis/secret‑scan tools (`bandit`, `safety`, `git‑secret‑detect`) | Any finding severity ≥ **high** | Blocks merge, opens a security ticket, notifies security team. |
|
|
26
|
+
| 8 | **Performance‑Benchmark‑Regression** | Benchmark suite (e.g., `locust`, `k6`, custom script) | Latency or throughput degrades beyond a defined SLA | Pauses promotion to production, triggers a rollback, notifies performance team. |
|
|
27
|
+
| 9 | **Canary‑Deployment‑Completed** | Argo Rollouts / Flagger / Service Mesh | Canary traffic reaches target % and all health checks pass | Automatically promotes to full rollout or rolls back. |
|
|
28
|
+
|10| **Post‑Deploy‑Health‑Check‑Pass** | Synthetic health‑check (HTTP `/healthz`, Prometheus alert silence) | All alerts cleared for **X** minutes after deployment | Clears release gate, updates status in issue tracker. |
|
|
29
|
+
|11| **Scheduled‑Maintenance‑Window** | Calendar / cron job | At predefined times (e.g., nightly 02:00 UTC) | Executes migration scripts, dependency upgrades, or nightly build cleanup. |
|
|
30
|
+
|12| **Version‑Release‑Tag‑Created** | Git tag push (`vX.Y.Z`) | A new release tag is pushed to `refs/tags/` | Triggers publishing to artifact repository, Docker image push, Helm chart bump. |
|
|
31
|
+
|13| **External‑Webhook‑Received** | Third‑party system (payment gateway, analytics service) | Webhook payload meets verification criteria | Executes a dedicated handler, possibly updating a saga or starting a compensation flow. |
|
|
32
|
+
|14| **SLA‑Violation‑Alert** | Monitoring platform (Prometheus, CloudWatch) | Any SLA (latency > 200 ms, error rate > 1 %) remains active for more than **N** minutes | Triggers on‑call escalation, auto‑remediation script, and incident ticket creation. |
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
# Trigger Workflows
|
|
37
|
+
|
|
38
|
+
This document defines the standard trigger events, conditions, and automated actions used by the Software Development role.
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
# 2.1 Task Received
|
|
43
|
+
|
|
44
|
+
**Source**
|
|
45
|
+
|
|
46
|
+
* Jira Issue
|
|
47
|
+
* GitHub Issue
|
|
48
|
+
* Azure DevOps Work Item
|
|
49
|
+
* Linear Issue
|
|
50
|
+
|
|
51
|
+
**Condition**
|
|
52
|
+
|
|
53
|
+
* Issue created
|
|
54
|
+
* Issue assigned
|
|
55
|
+
* Status changes to **In Progress**
|
|
56
|
+
|
|
57
|
+
**Actions**
|
|
58
|
+
|
|
59
|
+
* Populate local checkout of the repository.
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
git fetch
|
|
63
|
+
git checkout <branch>
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
* Load project context.
|
|
67
|
+
|
|
68
|
+
```text
|
|
69
|
+
context/engineering.md
|
|
70
|
+
projects/<project>/context.md
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
* Create a temporary working document.
|
|
74
|
+
|
|
75
|
+
```text
|
|
76
|
+
tmp/<ticket_id>.md
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
* Initialize the document with the standard developer checklist.
|
|
80
|
+
|
|
81
|
+
See:
|
|
82
|
+
|
|
83
|
+
```text
|
|
84
|
+
checklists.md
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
## GitHub Actions Example
|
|
90
|
+
|
|
91
|
+
```yaml
|
|
92
|
+
on:
|
|
93
|
+
issues:
|
|
94
|
+
types:
|
|
95
|
+
- opened
|
|
96
|
+
- assigned
|
|
97
|
+
|
|
98
|
+
jobs:
|
|
99
|
+
load-context:
|
|
100
|
+
runs-on: ubuntu-latest
|
|
101
|
+
|
|
102
|
+
steps:
|
|
103
|
+
- uses: actions/checkout@v4
|
|
104
|
+
|
|
105
|
+
- name: Echo ticket ID
|
|
106
|
+
run: echo "Processing ${{ github.event.issue.number }}"
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
# 2.2 Branch Created
|
|
112
|
+
|
|
113
|
+
**Source**
|
|
114
|
+
|
|
115
|
+
Git Push
|
|
116
|
+
|
|
117
|
+
```text
|
|
118
|
+
refs/heads/*
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
**Condition**
|
|
122
|
+
|
|
123
|
+
Branch name matches:
|
|
124
|
+
|
|
125
|
+
```text
|
|
126
|
+
feature/*
|
|
127
|
+
bugfix/*
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
**Actions**
|
|
131
|
+
|
|
132
|
+
* Run Ruff
|
|
133
|
+
* Run MyPy
|
|
134
|
+
* Run Unit Tests
|
|
135
|
+
* Create Preview Environment
|
|
136
|
+
|
|
137
|
+
Example providers:
|
|
138
|
+
|
|
139
|
+
* Fly.io
|
|
140
|
+
* Heroku Review Apps
|
|
141
|
+
* Render Preview
|
|
142
|
+
* Vercel Preview
|
|
143
|
+
|
|
144
|
+
---
|
|
145
|
+
|
|
146
|
+
## GitLab CI Example
|
|
147
|
+
|
|
148
|
+
```yaml
|
|
149
|
+
branch-check:
|
|
150
|
+
stage: test
|
|
151
|
+
|
|
152
|
+
rules:
|
|
153
|
+
- if: $CI_COMMIT_BRANCH =~ /^feature\//
|
|
154
|
+
|
|
155
|
+
script:
|
|
156
|
+
- poetry install
|
|
157
|
+
- poetry run ruff check .
|
|
158
|
+
- poetry run mypy .
|
|
159
|
+
- poetry run pytest -q
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
|
|
164
|
+
# 2.3 Pull Request Opened / Updated
|
|
165
|
+
|
|
166
|
+
**Source**
|
|
167
|
+
|
|
168
|
+
GitHub Pull Request
|
|
169
|
+
|
|
170
|
+
**Condition**
|
|
171
|
+
|
|
172
|
+
Target branch:
|
|
173
|
+
|
|
174
|
+
```text
|
|
175
|
+
main
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
or another protected branch.
|
|
179
|
+
|
|
180
|
+
**Actions**
|
|
181
|
+
|
|
182
|
+
* Post the standard PR checklist.
|
|
183
|
+
|
|
184
|
+
```text
|
|
185
|
+
- [ ] Load Context
|
|
186
|
+
- [ ] Tests Added
|
|
187
|
+
- [ ] Documentation Updated
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
* Notify Slack.
|
|
191
|
+
|
|
192
|
+
---
|
|
193
|
+
|
|
194
|
+
## Slack Payload
|
|
195
|
+
|
|
196
|
+
```json
|
|
197
|
+
{
|
|
198
|
+
"text": ":construction: PR *#${{ github.event.number }}* opened by <@${{ github.event.pull_request.user.id }}>.\n_Triggers: Task-Received, CI-Pipeline._"
|
|
199
|
+
}
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
---
|
|
203
|
+
|
|
204
|
+
# 2.4 CI Pipeline Success / Failure
|
|
205
|
+
|
|
206
|
+
**Source**
|
|
207
|
+
|
|
208
|
+
Workflow Run
|
|
209
|
+
|
|
210
|
+
**Conditions**
|
|
211
|
+
|
|
212
|
+
### Success
|
|
213
|
+
|
|
214
|
+
```text
|
|
215
|
+
result == success
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
**Actions**
|
|
219
|
+
|
|
220
|
+
* Enable Merge
|
|
221
|
+
* Trigger Canary Deployment
|
|
222
|
+
|
|
223
|
+
---
|
|
224
|
+
|
|
225
|
+
### Failure
|
|
226
|
+
|
|
227
|
+
```text
|
|
228
|
+
result == failure
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
**Actions**
|
|
232
|
+
|
|
233
|
+
* Create CI Failure issue
|
|
234
|
+
* Assign issue to author
|
|
235
|
+
* Notify
|
|
236
|
+
|
|
237
|
+
```text
|
|
238
|
+
#ci-failures
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
---
|
|
242
|
+
|
|
243
|
+
# 2.5 Test Coverage Threshold Met
|
|
244
|
+
|
|
245
|
+
**Condition**
|
|
246
|
+
|
|
247
|
+
```text
|
|
248
|
+
Line Coverage >= 80%
|
|
249
|
+
|
|
250
|
+
Branch Coverage >= 70%
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
For modified files only.
|
|
254
|
+
|
|
255
|
+
---
|
|
256
|
+
|
|
257
|
+
## Success
|
|
258
|
+
|
|
259
|
+
* Allow Merge
|
|
260
|
+
* Execute
|
|
261
|
+
|
|
262
|
+
```text
|
|
263
|
+
/merge
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
---
|
|
267
|
+
|
|
268
|
+
## Failure
|
|
269
|
+
|
|
270
|
+
Comment on the PR with:
|
|
271
|
+
|
|
272
|
+
* Line Coverage
|
|
273
|
+
* Branch Coverage
|
|
274
|
+
* Coverage Report URL
|
|
275
|
+
|
|
276
|
+
---
|
|
277
|
+
|
|
278
|
+
# 2.6 Performance Benchmark Regression
|
|
279
|
+
|
|
280
|
+
**Trigger**
|
|
281
|
+
|
|
282
|
+
Nightly scheduled benchmark
|
|
283
|
+
|
|
284
|
+
**Condition**
|
|
285
|
+
|
|
286
|
+
```text
|
|
287
|
+
Current Latency > 1.2 × Baseline
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
Baseline stored in:
|
|
291
|
+
|
|
292
|
+
```text
|
|
293
|
+
benchmark-baseline.yaml
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
---
|
|
297
|
+
|
|
298
|
+
## Actions
|
|
299
|
+
|
|
300
|
+
* Block Merge
|
|
301
|
+
|
|
302
|
+
```text
|
|
303
|
+
/hold
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
* Create Performance Regression incident
|
|
307
|
+
* Optionally rollback using Argo Rollouts
|
|
308
|
+
|
|
309
|
+
---
|
|
310
|
+
|
|
311
|
+
# 2.7 Canary Deployment Completed
|
|
312
|
+
|
|
313
|
+
**Source**
|
|
314
|
+
|
|
315
|
+
Argo Rollouts
|
|
316
|
+
|
|
317
|
+
**Condition**
|
|
318
|
+
|
|
319
|
+
Traffic reaches:
|
|
320
|
+
|
|
321
|
+
```yaml
|
|
322
|
+
steps:
|
|
323
|
+
- setWeight: 50
|
|
324
|
+
- setWeight: 100
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
Prometheus alerts are clear.
|
|
328
|
+
|
|
329
|
+
---
|
|
330
|
+
|
|
331
|
+
## Actions
|
|
332
|
+
|
|
333
|
+
* Promote deployment to Production
|
|
334
|
+
* Notify
|
|
335
|
+
|
|
336
|
+
```text
|
|
337
|
+
#releases
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
---
|
|
341
|
+
|
|
342
|
+
# 2.8 Post Deployment Health Check
|
|
343
|
+
|
|
344
|
+
**Source**
|
|
345
|
+
|
|
346
|
+
Health Endpoint
|
|
347
|
+
|
|
348
|
+
```text
|
|
349
|
+
/healthz
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
Prometheus
|
|
353
|
+
|
|
354
|
+
```text
|
|
355
|
+
up{job="myapp"}
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
**Condition**
|
|
359
|
+
|
|
360
|
+
Healthy for:
|
|
361
|
+
|
|
362
|
+
```text
|
|
363
|
+
5 consecutive minutes
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
---
|
|
367
|
+
|
|
368
|
+
## Actions
|
|
369
|
+
|
|
370
|
+
* Update Jira
|
|
371
|
+
|
|
372
|
+
```text
|
|
373
|
+
In Progress → Done
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
* Run Documentation Update
|
|
377
|
+
* Execute deployment checklist
|
|
378
|
+
|
|
379
|
+
---
|
|
380
|
+
|
|
381
|
+
# 3. Platform Configuration
|
|
382
|
+
|
|
383
|
+
| Platform | Configuration |
|
|
384
|
+
| --------------- | ------------------------- |
|
|
385
|
+
| GitHub Actions | `.github/workflows/*.yml` |
|
|
386
|
+
| GitLab CI | `.gitlab-ci.yml` |
|
|
387
|
+
| Jenkins | `Jenkinsfile` |
|
|
388
|
+
| Argo Events | `EventSource` |
|
|
389
|
+
| Prometheus | `alertmanager.yml` |
|
|
390
|
+
| Jira Automation | Project Automation Rules |
|
|
391
|
+
|
|
392
|
+
---
|
|
393
|
+
|
|
394
|
+
## GitHub Actions
|
|
395
|
+
|
|
396
|
+
```yaml
|
|
397
|
+
on:
|
|
398
|
+
push:
|
|
399
|
+
branches:
|
|
400
|
+
- main
|
|
401
|
+
|
|
402
|
+
pull_request:
|
|
403
|
+
types:
|
|
404
|
+
- opened
|
|
405
|
+
- synchronize
|
|
406
|
+
```
|
|
407
|
+
|
|
408
|
+
---
|
|
409
|
+
|
|
410
|
+
## GitLab CI
|
|
411
|
+
|
|
412
|
+
```yaml
|
|
413
|
+
ci:
|
|
414
|
+
trigger:
|
|
415
|
+
- job: build
|
|
416
|
+
when: on_success
|
|
417
|
+
```
|
|
418
|
+
|
|
419
|
+
---
|
|
420
|
+
|
|
421
|
+
## Jenkins
|
|
422
|
+
|
|
423
|
+
```groovy
|
|
424
|
+
pipeline {
|
|
425
|
+
triggers {
|
|
426
|
+
pollSCM('H/5 * * * *')
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
```
|
|
430
|
+
|
|
431
|
+
---
|
|
432
|
+
|
|
433
|
+
## Argo Events
|
|
434
|
+
|
|
435
|
+
```yaml
|
|
436
|
+
apiVersion: argo.events.k8s.io/v1alpha1
|
|
437
|
+
kind: EventSource
|
|
438
|
+
|
|
439
|
+
metadata:
|
|
440
|
+
name: ci-success
|
|
441
|
+
|
|
442
|
+
spec:
|
|
443
|
+
source:
|
|
444
|
+
http:
|
|
445
|
+
path: /status
|
|
446
|
+
method: POST
|
|
447
|
+
```
|
|
448
|
+
|
|
449
|
+
---
|
|
450
|
+
|
|
451
|
+
## Prometheus Alertmanager
|
|
452
|
+
|
|
453
|
+
```yaml
|
|
454
|
+
receivers:
|
|
455
|
+
- name: slack-notifications
|
|
456
|
+
|
|
457
|
+
slack_configs:
|
|
458
|
+
- api_url: https://hooks.slack.com/services/...
|
|
459
|
+
channel: "#ops"
|
|
460
|
+
```
|
|
461
|
+
|
|
462
|
+
---
|
|
463
|
+
|
|
464
|
+
## Jira Automation
|
|
465
|
+
|
|
466
|
+
```text
|
|
467
|
+
When Issue Created
|
|
468
|
+
|
|
469
|
+
↓
|
|
470
|
+
|
|
471
|
+
Transition
|
|
472
|
+
|
|
473
|
+
↓
|
|
474
|
+
|
|
475
|
+
In Progress
|
|
476
|
+
|
|
477
|
+
↓
|
|
478
|
+
|
|
479
|
+
Attach Checklist
|
|
480
|
+
```
|
|
481
|
+
|
|
482
|
+
---
|
|
483
|
+
|
|
484
|
+
# 4. Best Practices for New Triggers
|
|
485
|
+
|
|
486
|
+
Before introducing a new trigger:
|
|
487
|
+
|
|
488
|
+
* Document the trigger source.
|
|
489
|
+
* Document all trigger conditions.
|
|
490
|
+
* Keep trigger configuration under version control.
|
|
491
|
+
* Add automated tests for the trigger.
|
|
492
|
+
* Send human-readable notifications.
|
|
493
|
+
* Ensure idempotency.
|
|
494
|
+
* Log structured event metadata.
|
|
495
|
+
* Document rollback procedures.
|
|
496
|
+
* Update related SOPs.
|
|
497
|
+
* Update responsibilities and checklists.
|
|
498
|
+
|
|
499
|
+
---
|
|
500
|
+
|
|
501
|
+
# 5. End-to-End Trigger Flow
|
|
502
|
+
|
|
503
|
+
```text
|
|
504
|
+
Task Received
|
|
505
|
+
│
|
|
506
|
+
▼
|
|
507
|
+
Issue Created
|
|
508
|
+
│
|
|
509
|
+
▼
|
|
510
|
+
Developer Assigned
|
|
511
|
+
│
|
|
512
|
+
▼
|
|
513
|
+
Branch Created
|
|
514
|
+
│
|
|
515
|
+
▼
|
|
516
|
+
Preview Environment
|
|
517
|
+
│
|
|
518
|
+
▼
|
|
519
|
+
Pull Request Opened
|
|
520
|
+
│
|
|
521
|
+
▼
|
|
522
|
+
CI Pipeline
|
|
523
|
+
│
|
|
524
|
+
▼
|
|
525
|
+
Coverage Check
|
|
526
|
+
│
|
|
527
|
+
▼
|
|
528
|
+
Merge Approved
|
|
529
|
+
│
|
|
530
|
+
▼
|
|
531
|
+
Merge to Main
|
|
532
|
+
│
|
|
533
|
+
▼
|
|
534
|
+
Canary Deployment
|
|
535
|
+
│
|
|
536
|
+
▼
|
|
537
|
+
Production Deployment
|
|
538
|
+
│
|
|
539
|
+
▼
|
|
540
|
+
Health Checks
|
|
541
|
+
│
|
|
542
|
+
▼
|
|
543
|
+
Jira Updated
|
|
544
|
+
│
|
|
545
|
+
▼
|
|
546
|
+
Documentation Updated
|
|
547
|
+
│
|
|
548
|
+
▼
|
|
549
|
+
Release Completed
|
|
550
|
+
```
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# TypeScript
|
|
2
|
+
|
|
3
|
+
Use this packet for TypeScript application code, type design, runtime validation,
|
|
4
|
+
frontend and Node.js projects.
|
|
5
|
+
|
|
6
|
+
## Scope
|
|
7
|
+
|
|
8
|
+
- Type modeling, generics, narrowing, discriminated unions, module boundaries, and build config.
|
|
9
|
+
- Runtime validation for external data.
|
|
10
|
+
- React, Node.js, and shared package types.
|
|
11
|
+
|
|
12
|
+
## Standards
|
|
13
|
+
|
|
14
|
+
- Model domain states explicitly.
|
|
15
|
+
- Avoid `any` unless isolated and justified.
|
|
16
|
+
- Use `unknown` plus validation for external inputs.
|
|
17
|
+
- Keep exported types stable and documented.
|
|
18
|
+
- Let types prevent impossible states where practical.
|
|
19
|
+
|
|
20
|
+
## Related Files
|
|
21
|
+
|
|
22
|
+
- `../javascript/`
|
|
23
|
+
- `../react/`
|
|
24
|
+
- `../node/`
|
|
25
|
+
- `../frontend/code-quality/`
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# TypeScript Checklists
|
|
2
|
+
|
|
3
|
+
## Implementation
|
|
4
|
+
|
|
5
|
+
- [ ] Avoid new unbounded `any` in changed code.
|
|
6
|
+
- [ ] Validate external data before casting or trusting it.
|
|
7
|
+
- [ ] Use discriminated unions for variant states.
|
|
8
|
+
- [ ] Keep exported types compatible with consumers.
|
|
9
|
+
- [ ] Ensure tsconfig and lint rules remain satisfied.
|
|
10
|
+
|
|
11
|
+
## Verification
|
|
12
|
+
|
|
13
|
+
- [ ] Run type checking.
|
|
14
|
+
- [ ] Add tests for runtime behavior, not just type satisfaction.
|
|
15
|
+
- [ ] Verify generated or shared types are updated when contracts change.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# TypeScript Examples
|
|
2
|
+
|
|
3
|
+
## Discriminated Union
|
|
4
|
+
|
|
5
|
+
```typescript
|
|
6
|
+
type LoadState<T> =
|
|
7
|
+
| { status: 'idle' }
|
|
8
|
+
| { status: 'loading' }
|
|
9
|
+
| { status: 'success'; data: T }
|
|
10
|
+
| { status: 'error'; message: string };
|
|
11
|
+
|
|
12
|
+
function renderUser(state: LoadState<User>) {
|
|
13
|
+
if (state.status === 'success') {
|
|
14
|
+
return state.data.displayName;
|
|
15
|
+
}
|
|
16
|
+
return state.status;
|
|
17
|
+
}
|
|
18
|
+
```
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Unit Tests
|
|
2
|
+
|
|
3
|
+
Use this packet for fast, isolated tests of pure functions, domain logic,
|
|
4
|
+
validators, serializers, reducers, hooks, and small services.
|
|
5
|
+
|
|
6
|
+
## Scope
|
|
7
|
+
|
|
8
|
+
- Unit test structure, fixtures, assertions, mocks, and edge cases.
|
|
9
|
+
- Characterization tests before refactoring.
|
|
10
|
+
- Regression tests for isolated bug fixes.
|
|
11
|
+
|
|
12
|
+
## Standards
|
|
13
|
+
|
|
14
|
+
- Keep unit tests fast and deterministic.
|
|
15
|
+
- Test observable behavior and meaningful edge cases.
|
|
16
|
+
- Use mocks only at clear boundaries.
|
|
17
|
+
- Avoid duplicating implementation logic in assertions.
|
|
18
|
+
- Keep test names specific.
|
|
19
|
+
|
|
20
|
+
## Related Files
|
|
21
|
+
|
|
22
|
+
- `../testing/`
|
|
23
|
+
- `../integration-tests/`
|
|
24
|
+
- `../refactoring/`
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Unit Test Checklists
|
|
2
|
+
|
|
3
|
+
## Design
|
|
4
|
+
|
|
5
|
+
- [ ] Identify the unit and its observable behavior.
|
|
6
|
+
- [ ] List happy path, edge cases, and failure cases.
|
|
7
|
+
- [ ] Decide which collaborators should be fakes, mocks, or real simple values.
|
|
8
|
+
|
|
9
|
+
## Implementation
|
|
10
|
+
|
|
11
|
+
- [ ] Keep setup minimal and explicit.
|
|
12
|
+
- [ ] Use descriptive assertions.
|
|
13
|
+
- [ ] Avoid testing private implementation details unless characterizing legacy behavior.
|
|
14
|
+
- [ ] Keep tests independent and order-insensitive.
|
|
15
|
+
|
|
16
|
+
## Verification
|
|
17
|
+
|
|
18
|
+
- [ ] Run the test alone and with nearby tests.
|
|
19
|
+
- [ ] Confirm failure messages point to the broken behavior.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Unit Test Examples
|
|
2
|
+
|
|
3
|
+
## Pure Function
|
|
4
|
+
|
|
5
|
+
```typescript
|
|
6
|
+
it('returns free shipping for orders above the threshold', () => {
|
|
7
|
+
const result = calculateShipping({ subtotal: 150, destination: 'US' });
|
|
8
|
+
|
|
9
|
+
expect(result.cost).toBe(0);
|
|
10
|
+
expect(result.reason).toBe('threshold_met');
|
|
11
|
+
});
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Python Domain Rule
|
|
15
|
+
|
|
16
|
+
```python
|
|
17
|
+
def test_invoice_cannot_be_captured_twice():
|
|
18
|
+
invoice = Invoice(status="captured")
|
|
19
|
+
|
|
20
|
+
with pytest.raises(InvalidState):
|
|
21
|
+
invoice.capture()
|
|
22
|
+
```
|