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,105 @@
|
|
|
1
|
+
# Logging and Observability
|
|
2
|
+
|
|
3
|
+
This folder defines service-side logging and observability expectations for the
|
|
4
|
+
software-developer role. Use it when a task changes runtime behavior, error
|
|
5
|
+
handling, background jobs, API calls, data pipelines, model inference, or any
|
|
6
|
+
production path that operators may need to diagnose later.
|
|
7
|
+
|
|
8
|
+
## Goals
|
|
9
|
+
|
|
10
|
+
- Make production behavior explainable without exposing sensitive data.
|
|
11
|
+
- Help engineers find failures quickly across logs, metrics, and traces.
|
|
12
|
+
- Keep logs structured, searchable, and consistent across services.
|
|
13
|
+
- Capture business-relevant events without turning logs into analytics dumps.
|
|
14
|
+
- Support incident response, audit needs, and regression analysis.
|
|
15
|
+
|
|
16
|
+
## Signals
|
|
17
|
+
|
|
18
|
+
| Signal | Use it for | Examples |
|
|
19
|
+
| --- | --- | --- |
|
|
20
|
+
| Logs | Discrete events and diagnostic context. | request accepted, validation failed, retry exhausted |
|
|
21
|
+
| Metrics | Aggregated numeric behavior over time. | request count, error rate, queue depth, latency |
|
|
22
|
+
| Traces | Causal path across services. | API request through gateway, worker, database, model call |
|
|
23
|
+
| Alerts | Actionable symptoms needing human response. | high error rate, job stuck, SLO burn |
|
|
24
|
+
| Audit events | Security- or compliance-relevant actions. | permission change, export started, token revoked |
|
|
25
|
+
|
|
26
|
+
## Logging Contract
|
|
27
|
+
|
|
28
|
+
Every production log event should include:
|
|
29
|
+
|
|
30
|
+
- `timestamp`
|
|
31
|
+
- `level`
|
|
32
|
+
- `service`
|
|
33
|
+
- `environment`
|
|
34
|
+
- `event`
|
|
35
|
+
- `message`
|
|
36
|
+
- `request_id` or `correlation_id` when available
|
|
37
|
+
|
|
38
|
+
Add domain fields only when they help diagnosis:
|
|
39
|
+
|
|
40
|
+
- `user_id`, `tenant_id`, `organization_id`
|
|
41
|
+
- `job_id`, `task_id`, `model_id`, `deployment_id`
|
|
42
|
+
- `status_code`, `error_code`, `retry_count`
|
|
43
|
+
- `duration_ms`, `queue_time_ms`, `tokens_in`, `tokens_out`
|
|
44
|
+
|
|
45
|
+
Never log:
|
|
46
|
+
|
|
47
|
+
- API keys, passwords, tokens, session cookies, or credentials.
|
|
48
|
+
- Raw personally identifiable information unless explicitly approved.
|
|
49
|
+
- Full prompts, documents, attachments, database rows, or payment data by default.
|
|
50
|
+
- Secrets embedded in exception messages or request headers.
|
|
51
|
+
|
|
52
|
+
## Log Levels
|
|
53
|
+
|
|
54
|
+
| Level | Meaning | Typical use |
|
|
55
|
+
| --- | --- | --- |
|
|
56
|
+
| `debug` | Local or temporary diagnostic detail. | branch choice, raw dependency timing, feature-flag decision |
|
|
57
|
+
| `info` | Normal lifecycle event. | request completed, job started, model response accepted |
|
|
58
|
+
| `warn` | Unexpected but recoverable condition. | retry scheduled, fallback used, partial data skipped |
|
|
59
|
+
| `error` | Failure affecting user, job, or system behavior. | request failed, persistence failed, external dependency unavailable |
|
|
60
|
+
| `critical` | Severe failure requiring immediate attention. | data loss risk, widespread outage, safety control unavailable |
|
|
61
|
+
|
|
62
|
+
Use `debug` sparingly in production. Prefer metrics for high-frequency facts and
|
|
63
|
+
logs for events that explain state transitions or failures.
|
|
64
|
+
|
|
65
|
+
## Event Naming
|
|
66
|
+
|
|
67
|
+
Use stable, lowercase event names with dots:
|
|
68
|
+
|
|
69
|
+
- `api.request.started`
|
|
70
|
+
- `api.request.completed`
|
|
71
|
+
- `worker.job.failed`
|
|
72
|
+
- `model.inference.completed`
|
|
73
|
+
- `auth.permission.denied`
|
|
74
|
+
- `billing.invoice.exported`
|
|
75
|
+
|
|
76
|
+
Event names are contracts. Do not rename them casually once dashboards, alerts,
|
|
77
|
+
or runbooks depend on them.
|
|
78
|
+
|
|
79
|
+
## Required Practices
|
|
80
|
+
|
|
81
|
+
- Use structured logging when the runtime supports it.
|
|
82
|
+
- Propagate correlation IDs across service boundaries.
|
|
83
|
+
- Sanitize request, response, prompt, and exception data before logging.
|
|
84
|
+
- Include error class, error code, and safe message for failures.
|
|
85
|
+
- Record duration for external calls and slow internal operations.
|
|
86
|
+
- Add metrics for rates, latency, saturation, and queue depth.
|
|
87
|
+
- Add traces around cross-service calls, database calls, and model calls.
|
|
88
|
+
- Link alerts to runbooks when the alert requires human action.
|
|
89
|
+
|
|
90
|
+
## Review Questions
|
|
91
|
+
|
|
92
|
+
- Can an on-call engineer identify what failed, where, and for whom?
|
|
93
|
+
- Can the event be searched consistently across environments?
|
|
94
|
+
- Does the log avoid secrets and unnecessary personal data?
|
|
95
|
+
- Is a metric more appropriate than a log line?
|
|
96
|
+
- Is this event high-volume enough to need sampling or aggregation?
|
|
97
|
+
- Are dashboards or alerts updated when behavior changes?
|
|
98
|
+
|
|
99
|
+
## Related Files
|
|
100
|
+
|
|
101
|
+
- `checklists.md` for implementation and review gates.
|
|
102
|
+
- `examples.md` for concrete logging, metrics, and tracing examples.
|
|
103
|
+
- `roles/software-developer/frontend/logging-observability/` for browser-side observability.
|
|
104
|
+
- `skills/security/` for privacy and secret-handling expectations.
|
|
105
|
+
- `skills/performance/` for service-level measurement and SLO guidance.
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Logging and Observability Checklists
|
|
2
|
+
|
|
3
|
+
Use these checklists when adding or changing production behavior, error handling,
|
|
4
|
+
background processing, external calls, or operational monitoring.
|
|
5
|
+
|
|
6
|
+
## Design
|
|
7
|
+
|
|
8
|
+
- [ ] Identify the user, tenant, job, request, or resource identifiers needed for diagnosis.
|
|
9
|
+
- [ ] Define stable event names before implementation.
|
|
10
|
+
- [ ] Decide which facts belong in logs, metrics, traces, alerts, or audit events.
|
|
11
|
+
- [ ] Define redaction rules for secrets, credentials, prompts, documents, and personal data.
|
|
12
|
+
- [ ] Identify dashboards, runbooks, and alerts that must change with the behavior.
|
|
13
|
+
|
|
14
|
+
## Implementation
|
|
15
|
+
|
|
16
|
+
- [ ] Use the project's structured logging library or wrapper.
|
|
17
|
+
- [ ] Include `service`, `environment`, `event`, `level`, and timestamp fields.
|
|
18
|
+
- [ ] Propagate `request_id`, `correlation_id`, or `trace_id`.
|
|
19
|
+
- [ ] Log lifecycle events at boundaries: accepted, completed, failed, retried, skipped.
|
|
20
|
+
- [ ] Add safe error fields: `error_type`, `error_code`, and sanitized message.
|
|
21
|
+
- [ ] Add durations for external dependencies, database calls, queues, and model calls.
|
|
22
|
+
- [ ] Avoid high-cardinality metrics labels such as raw user emails or request paths with IDs.
|
|
23
|
+
- [ ] Keep log volume controlled with sampling, aggregation, or lower levels where appropriate.
|
|
24
|
+
|
|
25
|
+
## Privacy and Security
|
|
26
|
+
|
|
27
|
+
- [ ] Confirm no secrets, tokens, cookies, credentials, or private keys are logged.
|
|
28
|
+
- [ ] Confirm personally identifiable information is absent, hashed, or approved.
|
|
29
|
+
- [ ] Confirm prompts, completions, uploaded files, and database records are redacted by default.
|
|
30
|
+
- [ ] Confirm exception logging cannot leak request headers or raw payloads.
|
|
31
|
+
- [ ] Confirm audit events are immutable or written to the approved audit sink when required.
|
|
32
|
+
|
|
33
|
+
## Verification
|
|
34
|
+
|
|
35
|
+
- [ ] Run unit tests for logging helpers, redaction, and error handling when applicable.
|
|
36
|
+
- [ ] Exercise a success path and confirm expected logs/metrics are emitted.
|
|
37
|
+
- [ ] Exercise at least one failure path and confirm the failure is diagnosable.
|
|
38
|
+
- [ ] Verify correlation IDs connect logs, metrics, and traces across service boundaries.
|
|
39
|
+
- [ ] Verify dashboards or queries can find the new event names.
|
|
40
|
+
- [ ] Verify alerts are actionable and link to runbooks when human response is required.
|
|
41
|
+
|
|
42
|
+
## Review
|
|
43
|
+
|
|
44
|
+
- [ ] Log messages are concise and explain the operational meaning of the event.
|
|
45
|
+
- [ ] Field names follow existing project conventions.
|
|
46
|
+
- [ ] Event names are stable and documented where dashboards depend on them.
|
|
47
|
+
- [ ] No debug-only or temporary log lines remain in production paths.
|
|
48
|
+
- [ ] The change balances diagnostic value against cost, noise, and privacy risk.
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
# Logging and Observability Examples
|
|
2
|
+
|
|
3
|
+
These examples are intentionally framework-light. Adapt field names to the
|
|
4
|
+
project logger, metrics client, and tracing library already in use.
|
|
5
|
+
|
|
6
|
+
## Structured Request Log
|
|
7
|
+
|
|
8
|
+
```python
|
|
9
|
+
logger.info(
|
|
10
|
+
"API request completed",
|
|
11
|
+
extra={
|
|
12
|
+
"event": "api.request.completed",
|
|
13
|
+
"service": "orders-api",
|
|
14
|
+
"environment": settings.environment,
|
|
15
|
+
"request_id": request_id,
|
|
16
|
+
"user_id": safe_user_id,
|
|
17
|
+
"method": request.method,
|
|
18
|
+
"route": "/v1/orders/{order_id}",
|
|
19
|
+
"status_code": response.status_code,
|
|
20
|
+
"duration_ms": duration_ms,
|
|
21
|
+
},
|
|
22
|
+
)
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Use route templates instead of raw paths so metrics and logs do not explode with
|
|
26
|
+
one value per resource ID.
|
|
27
|
+
|
|
28
|
+
## Safe Error Log
|
|
29
|
+
|
|
30
|
+
```python
|
|
31
|
+
try:
|
|
32
|
+
result = await payment_client.capture(payment_id)
|
|
33
|
+
except PaymentTimeout as exc:
|
|
34
|
+
logger.warning(
|
|
35
|
+
"Payment capture retry scheduled",
|
|
36
|
+
extra={
|
|
37
|
+
"event": "payment.capture.retry_scheduled",
|
|
38
|
+
"service": "billing-worker",
|
|
39
|
+
"environment": settings.environment,
|
|
40
|
+
"request_id": request_id,
|
|
41
|
+
"payment_id": payment_id,
|
|
42
|
+
"error_type": type(exc).__name__,
|
|
43
|
+
"error_code": "PAYMENT_TIMEOUT",
|
|
44
|
+
"retry_count": retry_count + 1,
|
|
45
|
+
},
|
|
46
|
+
)
|
|
47
|
+
raise RetryableJobError("payment capture timed out") from exc
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Log the safe operational cause, not raw provider payloads or credentials.
|
|
51
|
+
|
|
52
|
+
## Redaction Helper
|
|
53
|
+
|
|
54
|
+
```python
|
|
55
|
+
SENSITIVE_KEYS = {"authorization", "cookie", "password", "token", "api_key"}
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def redact_mapping(data: dict[str, object]) -> dict[str, object]:
|
|
59
|
+
redacted: dict[str, object] = {}
|
|
60
|
+
for key, value in data.items():
|
|
61
|
+
if key.lower() in SENSITIVE_KEYS:
|
|
62
|
+
redacted[key] = "[REDACTED]"
|
|
63
|
+
else:
|
|
64
|
+
redacted[key] = value
|
|
65
|
+
return redacted
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Keep redaction helpers centralized so teams do not reimplement partial versions.
|
|
69
|
+
|
|
70
|
+
## Metrics
|
|
71
|
+
|
|
72
|
+
```python
|
|
73
|
+
REQUESTS_TOTAL.labels(
|
|
74
|
+
service="orders-api",
|
|
75
|
+
route="/v1/orders/{order_id}",
|
|
76
|
+
method="GET",
|
|
77
|
+
status_class="2xx",
|
|
78
|
+
).inc()
|
|
79
|
+
|
|
80
|
+
REQUEST_DURATION_SECONDS.labels(
|
|
81
|
+
service="orders-api",
|
|
82
|
+
route="/v1/orders/{order_id}",
|
|
83
|
+
method="GET",
|
|
84
|
+
).observe(duration_seconds)
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Use low-cardinality labels. Avoid raw user IDs, emails, order IDs, prompts, or
|
|
88
|
+
free-form error messages in metrics labels.
|
|
89
|
+
|
|
90
|
+
## Trace Boundary
|
|
91
|
+
|
|
92
|
+
```python
|
|
93
|
+
with tracer.start_as_current_span("model.inference") as span:
|
|
94
|
+
span.set_attribute("model.id", model_id)
|
|
95
|
+
span.set_attribute("model.provider", provider_name)
|
|
96
|
+
span.set_attribute("request.id", request_id)
|
|
97
|
+
|
|
98
|
+
response = await model_client.generate(prompt=redacted_prompt)
|
|
99
|
+
|
|
100
|
+
span.set_attribute("model.tokens_in", response.usage.tokens_in)
|
|
101
|
+
span.set_attribute("model.tokens_out", response.usage.tokens_out)
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Trace expensive or cross-service boundaries. Do not attach raw prompts,
|
|
105
|
+
documents, or generated content unless a project policy explicitly allows it.
|
|
106
|
+
|
|
107
|
+
## Audit Event
|
|
108
|
+
|
|
109
|
+
```python
|
|
110
|
+
audit_logger.info(
|
|
111
|
+
"User permission changed",
|
|
112
|
+
extra={
|
|
113
|
+
"event": "auth.permission.changed",
|
|
114
|
+
"actor_user_id": actor_user_id,
|
|
115
|
+
"target_user_id": target_user_id,
|
|
116
|
+
"organization_id": organization_id,
|
|
117
|
+
"permission": permission_name,
|
|
118
|
+
"action": "granted",
|
|
119
|
+
"request_id": request_id,
|
|
120
|
+
},
|
|
121
|
+
)
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
Audit events should be stable, searchable, and written to the approved audit sink.
|
|
125
|
+
|
|
126
|
+
## Anti-Examples
|
|
127
|
+
|
|
128
|
+
```python
|
|
129
|
+
logger.info(f"login payload: {request.json()}")
|
|
130
|
+
logger.error(f"provider failed with headers={headers} token={token}")
|
|
131
|
+
METRIC.labels(user_email=user.email, path=request.url.path).inc()
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
These patterns leak sensitive data, create high-cardinality metrics, or make
|
|
135
|
+
production logs expensive and hard to search.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Messaging
|
|
2
|
+
|
|
3
|
+
Use this packet for queues, streams, pub/sub systems, events, and asynchronous
|
|
4
|
+
workflows.
|
|
5
|
+
|
|
6
|
+
## Scope
|
|
7
|
+
|
|
8
|
+
- Producers, consumers, topics, queues, event schemas, retries, and dead-letter queues.
|
|
9
|
+
- Idempotency, ordering, deduplication, backpressure, and replay behavior.
|
|
10
|
+
- Outbox, inbox, saga, and event-driven integration patterns.
|
|
11
|
+
|
|
12
|
+
## Standards
|
|
13
|
+
|
|
14
|
+
- Treat message schemas as contracts.
|
|
15
|
+
- Make consumers idempotent because delivery may be duplicated.
|
|
16
|
+
- Define retry, poison-message, and dead-letter behavior.
|
|
17
|
+
- Include correlation IDs and causation IDs.
|
|
18
|
+
- Monitor lag, failures, throughput, and dead-letter volume.
|
|
19
|
+
|
|
20
|
+
## Related Files
|
|
21
|
+
|
|
22
|
+
- `../microservices/` for distributed boundaries.
|
|
23
|
+
- `../backend/` for worker/service implementation.
|
|
24
|
+
- `../observability/` for lag and failure signals.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Messaging Checklists
|
|
2
|
+
|
|
3
|
+
## Design
|
|
4
|
+
|
|
5
|
+
- [ ] Define topic or queue ownership, message schema, and compatibility rules.
|
|
6
|
+
- [ ] Decide ordering, delivery guarantee, retry, and dead-letter behavior.
|
|
7
|
+
- [ ] Define idempotency key and deduplication strategy.
|
|
8
|
+
- [ ] Document replay behavior and backfill safety.
|
|
9
|
+
|
|
10
|
+
## Implementation
|
|
11
|
+
|
|
12
|
+
- [ ] Validate message schema before processing.
|
|
13
|
+
- [ ] Store processed message IDs when duplicate handling requires it.
|
|
14
|
+
- [ ] Use transactional outbox or equivalent when publishing after database writes.
|
|
15
|
+
- [ ] Emit metrics for lag, processing duration, success, failure, and dead-letter count.
|
|
16
|
+
|
|
17
|
+
## Verification
|
|
18
|
+
|
|
19
|
+
- [ ] Test duplicate, out-of-order, malformed, retried, and poison messages.
|
|
20
|
+
- [ ] Test replay against representative data.
|
|
21
|
+
- [ ] Verify failure diagnostics include correlation IDs.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Messaging Examples
|
|
2
|
+
|
|
3
|
+
## Idempotent Consumer
|
|
4
|
+
|
|
5
|
+
```python
|
|
6
|
+
async def handle_user_created(message: Message) -> None:
|
|
7
|
+
event = UserCreated.model_validate_json(message.body)
|
|
8
|
+
if await inbox.already_processed(event.event_id):
|
|
9
|
+
return
|
|
10
|
+
|
|
11
|
+
await projections.create_user_summary(event.user_id, event.tenant_id)
|
|
12
|
+
await inbox.mark_processed(event.event_id)
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Event Envelope
|
|
16
|
+
|
|
17
|
+
```json
|
|
18
|
+
{
|
|
19
|
+
"event_id": "evt_123",
|
|
20
|
+
"event_type": "user.created",
|
|
21
|
+
"schema_version": 1,
|
|
22
|
+
"correlation_id": "req_456",
|
|
23
|
+
"occurred_at": "2026-06-27T12:00:00Z",
|
|
24
|
+
"payload": {}
|
|
25
|
+
}
|
|
26
|
+
```
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Microservices
|
|
2
|
+
|
|
3
|
+
Use this packet when designing or changing distributed service boundaries,
|
|
4
|
+
service-to-service communication, ownership, and runtime contracts.
|
|
5
|
+
|
|
6
|
+
## Scope
|
|
7
|
+
|
|
8
|
+
- Service boundaries, APIs, events, data ownership, deployment, and observability.
|
|
9
|
+
- Resilience patterns such as timeouts, retries, circuit breakers, and bulkheads.
|
|
10
|
+
- Compatibility, versioning, rollout, and incident isolation.
|
|
11
|
+
|
|
12
|
+
## Standards
|
|
13
|
+
|
|
14
|
+
- Services should own their data and expose stable contracts.
|
|
15
|
+
- Avoid distributed transactions unless there is no simpler path.
|
|
16
|
+
- Define timeouts, retries, idempotency, and fallback behavior for every remote call.
|
|
17
|
+
- Keep cross-service changes backward compatible during rollout.
|
|
18
|
+
- Add traces and metrics across service boundaries.
|
|
19
|
+
|
|
20
|
+
## Related Files
|
|
21
|
+
|
|
22
|
+
- `../api/`
|
|
23
|
+
- `../messaging/`
|
|
24
|
+
- `../backend/`
|
|
25
|
+
- `../observability/`
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Microservices Checklists
|
|
2
|
+
|
|
3
|
+
## Design
|
|
4
|
+
|
|
5
|
+
- [ ] Define service ownership, data ownership, and contract boundaries.
|
|
6
|
+
- [ ] Identify synchronous and asynchronous dependencies.
|
|
7
|
+
- [ ] Define failure behavior for each remote dependency.
|
|
8
|
+
- [ ] Plan rollout, compatibility, and rollback.
|
|
9
|
+
|
|
10
|
+
## Implementation
|
|
11
|
+
|
|
12
|
+
- [ ] Set explicit connection, read, and total timeouts.
|
|
13
|
+
- [ ] Use retries only for idempotent or safely deduplicated operations.
|
|
14
|
+
- [ ] Propagate correlation and trace context.
|
|
15
|
+
- [ ] Avoid leaking internal service errors through public contracts.
|
|
16
|
+
|
|
17
|
+
## Verification
|
|
18
|
+
|
|
19
|
+
- [ ] Test dependency timeout, failure, malformed response, and partial outage paths.
|
|
20
|
+
- [ ] Verify metrics and traces show cross-service latency and errors.
|
|
21
|
+
- [ ] Confirm old and new versions can coexist during deployment.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Microservices Examples
|
|
2
|
+
|
|
3
|
+
## Remote Call Policy
|
|
4
|
+
|
|
5
|
+
```text
|
|
6
|
+
Dependency: inventory-service
|
|
7
|
+
Operation: reserve inventory
|
|
8
|
+
Timeout: 800 ms total
|
|
9
|
+
Retry: none, operation is not safe without idempotency key
|
|
10
|
+
Fallback: fail order creation with retryable user-safe error
|
|
11
|
+
Observability: trace span plus dependency latency metric
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Compatibility Rollout
|
|
15
|
+
|
|
16
|
+
```text
|
|
17
|
+
1. Provider adds optional response field.
|
|
18
|
+
2. Consumer reads field when present.
|
|
19
|
+
3. Provider starts writing required data.
|
|
20
|
+
4. Consumer makes field required after all providers are upgraded.
|
|
21
|
+
```
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Node.js
|
|
2
|
+
|
|
3
|
+
Use this packet for Node.js services, scripts, CLIs, workers, and runtime
|
|
4
|
+
behavior.
|
|
5
|
+
|
|
6
|
+
## Scope
|
|
7
|
+
|
|
8
|
+
- Event loop behavior, async I/O, process lifecycle, package management, and runtime config.
|
|
9
|
+
- HTTP servers, workers, queues, file operations, and background tasks.
|
|
10
|
+
- Node-specific observability, error handling, and deployment concerns.
|
|
11
|
+
|
|
12
|
+
## Standards
|
|
13
|
+
|
|
14
|
+
- Avoid blocking the event loop in request paths.
|
|
15
|
+
- Handle unhandled rejections and process shutdown gracefully.
|
|
16
|
+
- Validate environment configuration at startup.
|
|
17
|
+
- Keep package dependencies minimal and audited.
|
|
18
|
+
- Use structured logs and correlation IDs.
|
|
19
|
+
|
|
20
|
+
## Related Files
|
|
21
|
+
|
|
22
|
+
- `../javascript/`
|
|
23
|
+
- `../typescript/`
|
|
24
|
+
- `../backend/`
|
|
25
|
+
- `../observability/`
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Node.js Checklists
|
|
2
|
+
|
|
3
|
+
## Implementation
|
|
4
|
+
|
|
5
|
+
- [ ] Validate required environment variables during startup.
|
|
6
|
+
- [ ] Add request timeouts and body size limits.
|
|
7
|
+
- [ ] Handle SIGTERM for graceful shutdown.
|
|
8
|
+
- [ ] Avoid synchronous filesystem, crypto, or compression work in hot paths.
|
|
9
|
+
- [ ] Lock package versions according to project policy.
|
|
10
|
+
|
|
11
|
+
## Verification
|
|
12
|
+
|
|
13
|
+
- [ ] Run lint, tests, and package audit where configured.
|
|
14
|
+
- [ ] Test startup failure for missing config.
|
|
15
|
+
- [ ] Test graceful shutdown with in-flight requests or jobs.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Node.js Examples
|
|
2
|
+
|
|
3
|
+
## Graceful Shutdown
|
|
4
|
+
|
|
5
|
+
```javascript
|
|
6
|
+
const server = app.listen(port);
|
|
7
|
+
|
|
8
|
+
process.on('SIGTERM', () => {
|
|
9
|
+
logger.info({ event: 'process.shutdown.started' });
|
|
10
|
+
server.close(() => {
|
|
11
|
+
logger.info({ event: 'process.shutdown.completed' });
|
|
12
|
+
process.exit(0);
|
|
13
|
+
});
|
|
14
|
+
});
|
|
15
|
+
```
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# NoSQL
|
|
2
|
+
|
|
3
|
+
Use this packet for document, key-value, wide-column, graph, and search-oriented
|
|
4
|
+
datastores.
|
|
5
|
+
|
|
6
|
+
## Scope
|
|
7
|
+
|
|
8
|
+
- Access patterns, partition keys, document shape, secondary indexes, and consistency.
|
|
9
|
+
- Denormalization, projections, TTLs, and schema evolution.
|
|
10
|
+
- Hot partitions, query limits, and operational cost.
|
|
11
|
+
|
|
12
|
+
## Standards
|
|
13
|
+
|
|
14
|
+
- Model from access patterns, not only entity diagrams.
|
|
15
|
+
- Make partition and sort keys explicit and reviewed.
|
|
16
|
+
- Plan schema evolution and backfills for denormalized data.
|
|
17
|
+
- Avoid unbounded scans in production paths.
|
|
18
|
+
- Monitor capacity, throttling, latency, and hot keys.
|
|
19
|
+
|
|
20
|
+
## Related Files
|
|
21
|
+
|
|
22
|
+
- `../database/`
|
|
23
|
+
- `../cache/`
|
|
24
|
+
- `../performance/`
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# NoSQL Checklists
|
|
2
|
+
|
|
3
|
+
## Design
|
|
4
|
+
|
|
5
|
+
- [ ] List read and write access patterns.
|
|
6
|
+
- [ ] Choose partition keys that avoid hot spots.
|
|
7
|
+
- [ ] Define consistency requirements for each query.
|
|
8
|
+
- [ ] Plan denormalized updates and repair jobs.
|
|
9
|
+
|
|
10
|
+
## Implementation
|
|
11
|
+
|
|
12
|
+
- [ ] Use conditional writes for concurrency-sensitive updates.
|
|
13
|
+
- [ ] Keep document size and item cardinality within service limits.
|
|
14
|
+
- [ ] Add TTLs only where expiry semantics are correct.
|
|
15
|
+
- [ ] Avoid full collection scans in request paths.
|
|
16
|
+
|
|
17
|
+
## Verification
|
|
18
|
+
|
|
19
|
+
- [ ] Test hot-key, missing-item, duplicate-write, and stale-read cases.
|
|
20
|
+
- [ ] Validate index usage or query plans.
|
|
21
|
+
- [ ] Check cost and capacity impact.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# NoSQL Examples
|
|
2
|
+
|
|
3
|
+
## Access Pattern Table
|
|
4
|
+
|
|
5
|
+
```text
|
|
6
|
+
Pattern: Load all active sessions for a user.
|
|
7
|
+
Partition key: USER#{user_id}
|
|
8
|
+
Sort key: SESSION#{created_at}
|
|
9
|
+
Filter: status = active
|
|
10
|
+
TTL: expires_at
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Conditional Write
|
|
14
|
+
|
|
15
|
+
```python
|
|
16
|
+
await table.put_item(
|
|
17
|
+
Item=item,
|
|
18
|
+
ConditionExpression="attribute_not_exists(pk)",
|
|
19
|
+
)
|
|
20
|
+
```
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Observability
|
|
2
|
+
|
|
3
|
+
Use this packet when designing or changing the signals that explain production
|
|
4
|
+
behavior: logs, metrics, traces, dashboards, alerts, and runbooks.
|
|
5
|
+
|
|
6
|
+
## Scope
|
|
7
|
+
|
|
8
|
+
- Service-level indicators, objectives, dashboards, tracing, metrics, and alerts.
|
|
9
|
+
- Incident diagnosis, deployment verification, and operational readiness.
|
|
10
|
+
- Signal quality, cost, cardinality, and retention.
|
|
11
|
+
|
|
12
|
+
## Standards
|
|
13
|
+
|
|
14
|
+
- Define what healthy means before choosing charts.
|
|
15
|
+
- Measure rate, errors, duration, and saturation for critical paths.
|
|
16
|
+
- Keep metric labels low-cardinality.
|
|
17
|
+
- Link actionable alerts to runbooks.
|
|
18
|
+
- Prefer symptoms over causes for paging alerts.
|
|
19
|
+
|
|
20
|
+
## Related Files
|
|
21
|
+
|
|
22
|
+
- `../logging/`
|
|
23
|
+
- `../performance/`
|
|
24
|
+
- `../microservices/`
|
|
25
|
+
- `skills/performance/`
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Observability Checklists
|
|
2
|
+
|
|
3
|
+
## Design
|
|
4
|
+
|
|
5
|
+
- [ ] Define user-visible success and failure signals.
|
|
6
|
+
- [ ] Identify service-level indicators and target objectives.
|
|
7
|
+
- [ ] Decide logs, metrics, traces, dashboards, and alerts.
|
|
8
|
+
- [ ] Define runbooks for alerts that require action.
|
|
9
|
+
|
|
10
|
+
## Implementation
|
|
11
|
+
|
|
12
|
+
- [ ] Add metrics for request count, error count, latency, and saturation.
|
|
13
|
+
- [ ] Add traces across service, database, queue, and model boundaries.
|
|
14
|
+
- [ ] Add structured logs for meaningful lifecycle events.
|
|
15
|
+
- [ ] Keep labels bounded and avoid personal data.
|
|
16
|
+
|
|
17
|
+
## Verification
|
|
18
|
+
|
|
19
|
+
- [ ] Trigger success and failure paths and confirm signals appear.
|
|
20
|
+
- [ ] Verify dashboards answer the main operational questions.
|
|
21
|
+
- [ ] Verify alerts are actionable and not noisy.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Observability Examples
|
|
2
|
+
|
|
3
|
+
## RED Metrics
|
|
4
|
+
|
|
5
|
+
```text
|
|
6
|
+
Rate: requests per second by service, route, method, status class
|
|
7
|
+
Errors: failed requests by service, route, method, error code
|
|
8
|
+
Duration: request latency histogram by service, route, method
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Alert Shape
|
|
12
|
+
|
|
13
|
+
```yaml
|
|
14
|
+
alert: HighErrorRate
|
|
15
|
+
expr: rate(http_requests_total{status_class="5xx"}[5m])
|
|
16
|
+
/ rate(http_requests_total[5m]) > 0.05
|
|
17
|
+
for: 10m
|
|
18
|
+
labels:
|
|
19
|
+
severity: page
|
|
20
|
+
annotations:
|
|
21
|
+
runbook: docs/runbooks/high-error-rate.md
|
|
22
|
+
```
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Performance
|
|
2
|
+
|
|
3
|
+
Use this packet when work affects latency, throughput, memory, CPU, database
|
|
4
|
+
load, network cost, startup time, or user-perceived responsiveness.
|
|
5
|
+
|
|
6
|
+
## Scope
|
|
7
|
+
|
|
8
|
+
- Measurement, profiling, optimization, capacity, and regression prevention.
|
|
9
|
+
- Backend, database, cache, frontend, queue, and model-inference performance.
|
|
10
|
+
- Load tests, benchmarks, SLOs, and production monitoring.
|
|
11
|
+
|
|
12
|
+
## Standards
|
|
13
|
+
|
|
14
|
+
- Measure before optimizing.
|
|
15
|
+
- Optimize the bottleneck, not the most visible code.
|
|
16
|
+
- Keep performance changes behaviorally safe and tested.
|
|
17
|
+
- Track before-and-after evidence.
|
|
18
|
+
- Avoid complexity unless the performance gain is necessary and proven.
|
|
19
|
+
|
|
20
|
+
## Related Files
|
|
21
|
+
|
|
22
|
+
- `../cache/`
|
|
23
|
+
- `../database/`
|
|
24
|
+
- `../observability/`
|
|
25
|
+
- `../frontend/performance/`
|
|
26
|
+
- `skills/performance/`
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Performance Checklists
|
|
2
|
+
|
|
3
|
+
## Investigation
|
|
4
|
+
|
|
5
|
+
- [ ] Define the target metric and acceptable threshold.
|
|
6
|
+
- [ ] Capture baseline latency, throughput, CPU, memory, and dependency timing.
|
|
7
|
+
- [ ] Identify the bottleneck with profiler, traces, query plans, or load tests.
|
|
8
|
+
|
|
9
|
+
## Implementation
|
|
10
|
+
|
|
11
|
+
- [ ] Make the smallest change that addresses the measured bottleneck.
|
|
12
|
+
- [ ] Avoid changing behavior and performance in the same unreviewable diff.
|
|
13
|
+
- [ ] Add metrics for the optimized path.
|
|
14
|
+
- [ ] Document trade-offs such as freshness, memory, or complexity.
|
|
15
|
+
|
|
16
|
+
## Verification
|
|
17
|
+
|
|
18
|
+
- [ ] Compare before-and-after measurements.
|
|
19
|
+
- [ ] Run regression tests for behavior.
|
|
20
|
+
- [ ] Confirm no new bottleneck or resource spike appears.
|