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
|
+
# Authorization Checklists
|
|
2
|
+
|
|
3
|
+
## Design
|
|
4
|
+
|
|
5
|
+
- [ ] Identify protected resources, actions, actors, and tenant boundaries.
|
|
6
|
+
- [ ] Define policy rules in terms of role, relationship, ownership, or attributes.
|
|
7
|
+
- [ ] Decide where enforcement occurs: handler, service layer, policy engine, or database.
|
|
8
|
+
- [ ] Document admin, delegation, and support-access exceptions.
|
|
9
|
+
|
|
10
|
+
## Implementation
|
|
11
|
+
|
|
12
|
+
- [ ] Check authorization after authentication and before side effects.
|
|
13
|
+
- [ ] Use shared policy helpers instead of duplicating one-off checks.
|
|
14
|
+
- [ ] Make failed checks return safe error responses.
|
|
15
|
+
- [ ] Add audit events for permission changes and privileged access.
|
|
16
|
+
|
|
17
|
+
## Verification
|
|
18
|
+
|
|
19
|
+
- [ ] Test allowed, denied, cross-tenant, unauthenticated, and stale-permission cases.
|
|
20
|
+
- [ ] Confirm client-provided roles or ownership fields cannot bypass enforcement.
|
|
21
|
+
- [ ] Verify audit logs include actor, target, action, and result.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Authorization Examples
|
|
2
|
+
|
|
3
|
+
## Policy Check
|
|
4
|
+
|
|
5
|
+
```python
|
|
6
|
+
def require_project_access(principal: Principal, project: Project, action: str) -> None:
|
|
7
|
+
if principal.tenant_id != project.tenant_id:
|
|
8
|
+
raise Forbidden("cross-tenant access denied")
|
|
9
|
+
|
|
10
|
+
if action not in principal.permissions_for(project.id):
|
|
11
|
+
raise Forbidden("permission denied")
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Audit Event
|
|
15
|
+
|
|
16
|
+
```python
|
|
17
|
+
audit_logger.info(
|
|
18
|
+
"Permission granted",
|
|
19
|
+
extra={
|
|
20
|
+
"event": "auth.permission.granted",
|
|
21
|
+
"actor_user_id": actor.id,
|
|
22
|
+
"target_user_id": target.id,
|
|
23
|
+
"permission": permission,
|
|
24
|
+
"tenant_id": tenant_id,
|
|
25
|
+
},
|
|
26
|
+
)
|
|
27
|
+
```
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Backend
|
|
2
|
+
|
|
3
|
+
Use this packet for service-side application code: APIs, workers, domain
|
|
4
|
+
services, persistence orchestration, integrations, and runtime behavior.
|
|
5
|
+
|
|
6
|
+
## Scope
|
|
7
|
+
|
|
8
|
+
- Request handlers, service layers, repositories, workers, and schedulers.
|
|
9
|
+
- Business rules, validations, transactions, retries, and idempotency.
|
|
10
|
+
- External service integrations and background processing.
|
|
11
|
+
- Operational readiness for backend services.
|
|
12
|
+
|
|
13
|
+
## Standards
|
|
14
|
+
|
|
15
|
+
- Keep business rules in testable service/domain code, not only transport handlers.
|
|
16
|
+
- Make side effects explicit and idempotent where retries are possible.
|
|
17
|
+
- Use transactions for multi-step persistence changes that must commit together.
|
|
18
|
+
- Propagate correlation IDs and structured errors.
|
|
19
|
+
- Add tests around behavior, failure modes, and boundary contracts.
|
|
20
|
+
|
|
21
|
+
## Related Files
|
|
22
|
+
|
|
23
|
+
- `../api/` for transport contracts.
|
|
24
|
+
- `../database/` and `../sql/` for persistence.
|
|
25
|
+
- `../messaging/` for async flows.
|
|
26
|
+
- `../logging/` and `../observability/` for runtime signals.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Backend Checklists
|
|
2
|
+
|
|
3
|
+
## Design
|
|
4
|
+
|
|
5
|
+
- [ ] Identify transport boundary, domain boundary, persistence boundary, and side effects.
|
|
6
|
+
- [ ] Define failure modes, retry behavior, idempotency keys, and transaction boundaries.
|
|
7
|
+
- [ ] Confirm input validation and output contract ownership.
|
|
8
|
+
- [ ] Decide which behavior belongs in handler, service, repository, or worker code.
|
|
9
|
+
|
|
10
|
+
## Implementation
|
|
11
|
+
|
|
12
|
+
- [ ] Keep handlers thin and delegate business behavior to testable units.
|
|
13
|
+
- [ ] Use shared clients, repositories, serializers, and error types.
|
|
14
|
+
- [ ] Add timeouts and cancellation support for external calls.
|
|
15
|
+
- [ ] Emit safe logs, metrics, and traces for critical paths.
|
|
16
|
+
|
|
17
|
+
## Verification
|
|
18
|
+
|
|
19
|
+
- [ ] Add unit tests for business rules.
|
|
20
|
+
- [ ] Add integration tests for persistence or external boundaries.
|
|
21
|
+
- [ ] Test timeout, retry, duplicate request, and dependency failure paths.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Backend Examples
|
|
2
|
+
|
|
3
|
+
## Service Boundary
|
|
4
|
+
|
|
5
|
+
```python
|
|
6
|
+
class OrderService:
|
|
7
|
+
def __init__(self, orders: OrderRepository, payments: PaymentClient):
|
|
8
|
+
self.orders = orders
|
|
9
|
+
self.payments = payments
|
|
10
|
+
|
|
11
|
+
async def capture_order(self, order_id: str, actor: Principal) -> Order:
|
|
12
|
+
order = await self.orders.get_for_update(order_id)
|
|
13
|
+
order.require_action("capture", actor)
|
|
14
|
+
await self.payments.capture(order.payment_id, idempotency_key=order.id)
|
|
15
|
+
order.mark_captured()
|
|
16
|
+
await self.orders.save(order)
|
|
17
|
+
return order
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Keep orchestration visible and push low-level persistence and transport details
|
|
21
|
+
behind dedicated collaborators.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Cache
|
|
2
|
+
|
|
3
|
+
Use this packet when adding, changing, or reviewing in-memory, distributed,
|
|
4
|
+
browser, CDN, database, or application-level caching.
|
|
5
|
+
|
|
6
|
+
## Scope
|
|
7
|
+
|
|
8
|
+
- Cache keys, values, expiry, invalidation, and warming.
|
|
9
|
+
- Read-through, write-through, write-behind, and aside-cache patterns.
|
|
10
|
+
- CDN and HTTP cache headers.
|
|
11
|
+
- Stampede prevention, consistency trade-offs, and fallback behavior.
|
|
12
|
+
|
|
13
|
+
## Standards
|
|
14
|
+
|
|
15
|
+
- Cache only data that has clear freshness and invalidation rules.
|
|
16
|
+
- Include tenant, locale, auth scope, and version dimensions in keys when relevant.
|
|
17
|
+
- Prefer bounded TTLs and explicit invalidation for mutable data.
|
|
18
|
+
- Prevent stampedes with locks, single-flight, jitter, or stale-while-revalidate.
|
|
19
|
+
- Never cache secrets or user-private data in shared scopes.
|
|
20
|
+
|
|
21
|
+
## Related Files
|
|
22
|
+
|
|
23
|
+
- `../performance/` for measurement.
|
|
24
|
+
- `../backend/` for service integration.
|
|
25
|
+
- `../frontend/performance/` for browser-facing cache concerns.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Cache Checklists
|
|
2
|
+
|
|
3
|
+
## Design
|
|
4
|
+
|
|
5
|
+
- [ ] Define source of truth, freshness target, TTL, and invalidation triggers.
|
|
6
|
+
- [ ] Include all required dimensions in the cache key.
|
|
7
|
+
- [ ] Decide behavior for miss, stale value, backend failure, and partial invalidation.
|
|
8
|
+
- [ ] Estimate cardinality, memory cost, and eviction impact.
|
|
9
|
+
|
|
10
|
+
## Implementation
|
|
11
|
+
|
|
12
|
+
- [ ] Use stable key builders rather than ad hoc string construction.
|
|
13
|
+
- [ ] Add TTL jitter for high-volume keys.
|
|
14
|
+
- [ ] Protect shared caches from private or tenant-specific leakage.
|
|
15
|
+
- [ ] Record hit rate, miss rate, latency, and eviction metrics.
|
|
16
|
+
|
|
17
|
+
## Verification
|
|
18
|
+
|
|
19
|
+
- [ ] Test hit, miss, stale, invalidation, and backend failure paths.
|
|
20
|
+
- [ ] Verify cross-user and cross-tenant data cannot leak.
|
|
21
|
+
- [ ] Compare latency and load before and after caching.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Cache Examples
|
|
2
|
+
|
|
3
|
+
## Key Builder
|
|
4
|
+
|
|
5
|
+
```python
|
|
6
|
+
def user_profile_cache_key(tenant_id: str, user_id: str, version: int) -> str:
|
|
7
|
+
return f"tenant:{tenant_id}:user:{user_id}:profile:v{version}"
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
## Cache Aside
|
|
11
|
+
|
|
12
|
+
```python
|
|
13
|
+
async def get_profile(tenant_id: str, user_id: str) -> Profile:
|
|
14
|
+
key = user_profile_cache_key(tenant_id, user_id, version=2)
|
|
15
|
+
cached = await cache.get(key)
|
|
16
|
+
if cached is not None:
|
|
17
|
+
return Profile.model_validate_json(cached)
|
|
18
|
+
|
|
19
|
+
profile = await repository.get_profile(tenant_id, user_id)
|
|
20
|
+
await cache.set(key, profile.model_dump_json(), ttl_seconds=300)
|
|
21
|
+
return profile
|
|
22
|
+
```
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
# Project‑Level Checklists for a Senior Software Developer
|
|
2
|
+
|
|
3
|
+
A collection of reusable task lists that cover the complete lifecycle of a work item – from receiving a request to shipping a production‑ready change.
|
|
4
|
+
Each checklist is written in **GitHub‑flavored Markdown task‑list syntax** (`- [ ]` = pending, `- [x]` = done) so you can tick boxes directly in most editors or on GitHub.
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## 📥 1. Receive Task & Clarify Scope
|
|
9
|
+
|
|
10
|
+
- [ ] **Acknowledge receipt** (comment or message).
|
|
11
|
+
- [ ] Identify **problem statement**, **acceptance criteria**, and **success metrics**.
|
|
12
|
+
- [ ] Note any **deadlines**, **stakeholders**, and **dependencies**.
|
|
13
|
+
- [ ] Add a short **summary** to the task tracker (Jira, GitHub Issues, etc.).
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## 🧭 2. Load Context
|
|
18
|
+
|
|
19
|
+
- [ ] Load `context/engineering.md` – overall team processes, conventions, and tooling.
|
|
20
|
+
- [ ] Load `projects/<project>/context.md` (or `context/<project>.md` if a different naming convention is used).
|
|
21
|
+
- [ ] Identify relevant **service boundaries**, **API contracts**, and **data stores** affected.
|
|
22
|
+
- [ ] Verify **access permissions** (repo, cloud resources, secrets manager).
|
|
23
|
+
- [ ] Check for any **existing design docs**, **architecture diagrams**, or **runbooks** related to the area.
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## 📚 3. Load & Apply Relevant Skills
|
|
28
|
+
|
|
29
|
+
- [ ] Include / reference `skills/software-development/skill.md`.
|
|
30
|
+
- [ ] As needed, load:
|
|
31
|
+
- `skills/security/`
|
|
32
|
+
- `skills/performance/`
|
|
33
|
+
- `skills/qa/`
|
|
34
|
+
- `skills/software-development/skill.md` for API and database patterns
|
|
35
|
+
- `roles/software-developer/api/` for endpoint-specific guidance
|
|
36
|
+
- [ ] Confirm that the proposed change does **not violate** any policy in those skill files (e.g., secret handling, performance thresholds, test coverage).
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## 🏗️ 4. Design Solution
|
|
41
|
+
|
|
42
|
+
- [ ] Sketch a **high‑level diagram** (component, data flow, or API contract) if needed.
|
|
43
|
+
- [ ] List **design alternatives** and **rationale** for the chosen path.
|
|
44
|
+
- [ ] Identify **trade‑offs** (simplicity vs. performance, short‑term hack vs. long‑term refactor).
|
|
45
|
+
- [ ] Document **constraints** (e.g., latency target, security requirements, compliance).
|
|
46
|
+
- [ ] Add **TODO** markers for any open questions that will need resolution later.
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## ✍️ 5. Implement
|
|
51
|
+
|
|
52
|
+
- [ ] Write **production‑ready code** that follows project conventions.
|
|
53
|
+
- [ ] Keep changes **focused** – single responsibility or feature flag where appropriate.
|
|
54
|
+
- [ ] Add **inline comments** for non‑obvious logic, not for stating the obvious.
|
|
55
|
+
- [ ] Ensure **no new third‑party dependencies** are introduced without approval.
|
|
56
|
+
- [ ] Re‑use existing **utilities**, **helper functions**, and **shared libraries**.
|
|
57
|
+
- [ ] Run **local static checks** (`ruff`, `mypy`, `pre‑commit`, etc.) and fix failures.
|
|
58
|
+
- [ ] Commit with a **clear, descriptive message** referencing the task ID if applicable.
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## 🧪 6. Test
|
|
63
|
+
|
|
64
|
+
- [ ] Write **unit tests** for new/modified functions (aim for ≥ 80 % coverage of new code).
|
|
65
|
+
- [ ] Add **integration / contract tests** for any new or changed APIs.
|
|
66
|
+
- [ ] Run **property‑based tests** (if the project uses them).
|
|
67
|
+
- [ ] Execute **end‑to‑end tests** that exercise the full pipeline.
|
|
68
|
+
- [ ] Perform **performance sanity checks** – does latency/throughput meet the baseline?
|
|
69
|
+
- [ ] Verify **security scans** (`bandit`, `safety`, secret detection) pass.
|
|
70
|
+
- [ ] Confirm **all tests pass** on the CI pipeline locally before pushing.
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## 📄 7. Review & Refactor
|
|
75
|
+
|
|
76
|
+
- [ ] Submit a **Pull Request / Merge Request** with:
|
|
77
|
+
- Clear description of *what* was changed and *why*.
|
|
78
|
+
- Links to relevant **design docs** or **issue tickets**.
|
|
79
|
+
- Checklist of **testing results**.
|
|
80
|
+
- [ ] Address feedback from **code reviewers** (must be approved by at least one senior reviewer).
|
|
81
|
+
- [ ] Re‑run CI after incorporating review changes.
|
|
82
|
+
- [ ] Perform a **final refactor pass** to eliminate dead code or duplicated logic.
|
|
83
|
+
- [ ] Ensure **test suite still passes** after refactor.
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
## 📚 8. Update Documentation
|
|
88
|
+
|
|
89
|
+
- [ ] Update **README** / service documentation with any new configuration options or deployment steps.
|
|
90
|
+
- [ ] Regenerate / update **API spec** (OpenAPI, Protobuf, etc.) if an endpoint was added/changed.
|
|
91
|
+
- [ ] Add or amend **architecture diagrams** where relevant.
|
|
92
|
+
- [ ] Document **known limitations** or **operational runbooks** (e.g., scaling limits, rollback procedure).
|
|
93
|
+
- [ ] Link the updated docs in the PR description and in the task tracker.
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
## 🚀 9. Deploy / Release
|
|
98
|
+
|
|
99
|
+
- [ ] Increment version numbers in `pyproject.toml` / `requirements.txt` and push tags.
|
|
100
|
+
- [ ] Build **Docker** (or OCI) image, push to the registry, and update Helm/K8s manifests.
|
|
101
|
+
- [ ] Run **canary / blue‑green** deployment if required, and monitor health metrics.
|
|
102
|
+
- [ ] Verify **observability** (metrics, logs, tracing) are emitting correct data for the new version.
|
|
103
|
+
- [ ] Conduct **post‑deployment validation** (functional smoke test, latency checks).
|
|
104
|
+
- [ ] Tag the release in Git (`model-release/vX.Y.Z`) and close the task.
|
|
105
|
+
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
## ✅ 10. Verify Success Criteria
|
|
109
|
+
|
|
110
|
+
- [ ] Confirm the original **problem statement** has been resolved.
|
|
111
|
+
- [ ] Verify adherence to **project conventions** and **coding standards**.
|
|
112
|
+
- [ ] Ensure the change is **production‑ready** (builds, deploys, runs).
|
|
113
|
+
- [ ] Check that **appropriate tests** exist and pass.
|
|
114
|
+
- [ ] Validate that **technical debt** has not increased (no new TODOs left behind).
|
|
115
|
+
- [ ] Ensure significant decisions are **clearly explained** (in code comments, docs, or PR discussion).
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
### Completion
|
|
120
|
+
|
|
121
|
+
When all checklist items are ticked, the work is considered **complete** and ready for merging.
|
|
122
|
+
Keep this file handy; you can copy it into new projects or create project‑specific variants (e.g., `checklists/frontend.md`, `checklists/mlops.md`) by selecting the relevant sections.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Code Review
|
|
2
|
+
|
|
3
|
+
Use this packet when reviewing or preparing changes for review.
|
|
4
|
+
|
|
5
|
+
## Scope
|
|
6
|
+
|
|
7
|
+
- Pull requests, merge requests, design reviews, and AI-generated code review.
|
|
8
|
+
- Correctness, security, maintainability, tests, performance, and operability.
|
|
9
|
+
- Review comments, approval criteria, and follow-up tracking.
|
|
10
|
+
|
|
11
|
+
## Standards
|
|
12
|
+
|
|
13
|
+
- Lead with correctness, safety, and user impact.
|
|
14
|
+
- Cite concrete files, lines, behavior, and reproduction steps.
|
|
15
|
+
- Separate blocking issues from preferences.
|
|
16
|
+
- Check tests and verification evidence.
|
|
17
|
+
- Keep feedback direct, respectful, and specific.
|
|
18
|
+
|
|
19
|
+
## Related Files
|
|
20
|
+
|
|
21
|
+
- `../checklists.md` for delivery gates.
|
|
22
|
+
- `../refactoring/` for safe change shaping.
|
|
23
|
+
- `context/communication.md` for feedback style.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Code Review Checklists
|
|
2
|
+
|
|
3
|
+
## Reviewer
|
|
4
|
+
|
|
5
|
+
- [ ] Confirm the change matches the stated requirement.
|
|
6
|
+
- [ ] Check edge cases, error handling, security, and privacy behavior.
|
|
7
|
+
- [ ] Verify tests cover the changed behavior and likely regressions.
|
|
8
|
+
- [ ] Look for unnecessary complexity, duplication, or new dependencies.
|
|
9
|
+
- [ ] Confirm docs, migrations, observability, and rollout notes are updated when needed.
|
|
10
|
+
|
|
11
|
+
## Author
|
|
12
|
+
|
|
13
|
+
- [ ] Keep the diff focused and reviewable.
|
|
14
|
+
- [ ] Explain what changed, why, and how it was verified.
|
|
15
|
+
- [ ] Link issues, design notes, screenshots, logs, or test output where useful.
|
|
16
|
+
- [ ] Resolve or explicitly track review comments.
|
|
17
|
+
|
|
18
|
+
## Comment Quality
|
|
19
|
+
|
|
20
|
+
- [ ] Mark severity when the issue is blocking.
|
|
21
|
+
- [ ] Suggest a concrete fix or ask a precise question.
|
|
22
|
+
- [ ] Avoid vague comments such as "clean this up" without direction.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Code Review Examples
|
|
2
|
+
|
|
3
|
+
## Blocking Finding
|
|
4
|
+
|
|
5
|
+
```text
|
|
6
|
+
[P1] Cross-tenant authorization bypass
|
|
7
|
+
|
|
8
|
+
This handler loads the invoice by ID before checking tenant ownership. A user who
|
|
9
|
+
can guess another tenant's invoice ID could read metadata. Load by tenant_id and
|
|
10
|
+
invoice_id together, or check ownership before returning any fields.
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Non-Blocking Suggestion
|
|
14
|
+
|
|
15
|
+
```text
|
|
16
|
+
[P3] Consider extracting the retry delay calculation
|
|
17
|
+
|
|
18
|
+
The retry policy is correct, but the inline arithmetic is hard to scan. A small
|
|
19
|
+
helper would make the jitter and max-delay behavior easier to test.
|
|
20
|
+
```
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Database
|
|
2
|
+
|
|
3
|
+
Use this packet for persistence design that is not specific to one database
|
|
4
|
+
family. It covers data modeling, migrations, transactions, consistency, and
|
|
5
|
+
operational safety.
|
|
6
|
+
|
|
7
|
+
## Scope
|
|
8
|
+
|
|
9
|
+
- Schema design, data access patterns, migrations, and backfills.
|
|
10
|
+
- Transactions, isolation, constraints, indexes, and consistency trade-offs.
|
|
11
|
+
- Backup, restore, retention, archival, and data deletion.
|
|
12
|
+
- Database access from services, workers, and reporting flows.
|
|
13
|
+
|
|
14
|
+
## Standards
|
|
15
|
+
|
|
16
|
+
- Treat the database as a shared contract with operational consequences.
|
|
17
|
+
- Prefer explicit constraints over relying only on application checks.
|
|
18
|
+
- Make migrations reversible or provide a documented rollback path.
|
|
19
|
+
- Separate online request paths from heavy analytical or backfill work.
|
|
20
|
+
- Test migrations and data transformations against representative data.
|
|
21
|
+
|
|
22
|
+
## Related Files
|
|
23
|
+
|
|
24
|
+
- `../sql/` for relational database guidance.
|
|
25
|
+
- `../nosql/` for document, key-value, and wide-column systems.
|
|
26
|
+
- `../backend/` for repository/service integration.
|
|
27
|
+
- `skills/security/` for data privacy and retention.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Database Checklists
|
|
2
|
+
|
|
3
|
+
## Design
|
|
4
|
+
|
|
5
|
+
- [ ] Define entities, relationships, ownership, retention, and privacy constraints.
|
|
6
|
+
- [ ] Choose transaction boundaries and consistency expectations.
|
|
7
|
+
- [ ] Identify indexes, uniqueness constraints, and query patterns.
|
|
8
|
+
- [ ] Plan migrations, backfills, rollback, and deployment order.
|
|
9
|
+
|
|
10
|
+
## Implementation
|
|
11
|
+
|
|
12
|
+
- [ ] Use parameterized queries or approved ORM/query builders.
|
|
13
|
+
- [ ] Add constraints for required invariants.
|
|
14
|
+
- [ ] Keep long-running migrations out of request-critical deployment steps.
|
|
15
|
+
- [ ] Add observability for slow queries, lock waits, and migration progress.
|
|
16
|
+
|
|
17
|
+
## Verification
|
|
18
|
+
|
|
19
|
+
- [ ] Test schema migration forward and rollback paths when supported.
|
|
20
|
+
- [ ] Test duplicate, missing, invalid, and concurrent-write cases.
|
|
21
|
+
- [ ] Inspect query plans for hot paths and newly added indexes.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Database Examples
|
|
2
|
+
|
|
3
|
+
## Migration Plan
|
|
4
|
+
|
|
5
|
+
```text
|
|
6
|
+
1. Add nullable column.
|
|
7
|
+
2. Deploy application code that writes both old and new fields.
|
|
8
|
+
3. Backfill existing rows in batches.
|
|
9
|
+
4. Add constraint after backfill validation.
|
|
10
|
+
5. Remove old field usage in a later deploy.
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Repository Boundary
|
|
14
|
+
|
|
15
|
+
```python
|
|
16
|
+
class UserRepository:
|
|
17
|
+
async def get_by_tenant_and_id(self, tenant_id: str, user_id: str) -> User | None:
|
|
18
|
+
row = await self.db.fetch_one(
|
|
19
|
+
"""
|
|
20
|
+
select id, tenant_id, email, status
|
|
21
|
+
from users
|
|
22
|
+
where tenant_id = :tenant_id and id = :user_id
|
|
23
|
+
""",
|
|
24
|
+
{"tenant_id": tenant_id, "user_id": user_id},
|
|
25
|
+
)
|
|
26
|
+
return User.model_validate(row) if row else None
|
|
27
|
+
```
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Debugging
|
|
2
|
+
|
|
3
|
+
Use this packet when investigating defects, regressions, incidents, flaky tests,
|
|
4
|
+
performance anomalies, or unexpected behavior.
|
|
5
|
+
|
|
6
|
+
## Scope
|
|
7
|
+
|
|
8
|
+
- Reproduction, hypothesis building, instrumentation, isolation, and verification.
|
|
9
|
+
- Local debugging, production diagnosis, logs, traces, metrics, and test failures.
|
|
10
|
+
- Root cause analysis and regression prevention.
|
|
11
|
+
|
|
12
|
+
## Standards
|
|
13
|
+
|
|
14
|
+
- Reproduce before changing code whenever feasible.
|
|
15
|
+
- Change one variable at a time while investigating.
|
|
16
|
+
- Prefer evidence over guesses.
|
|
17
|
+
- Keep diagnostic changes separate from the final fix where possible.
|
|
18
|
+
- Add regression tests or monitors after fixing confirmed bugs.
|
|
19
|
+
|
|
20
|
+
## Related Files
|
|
21
|
+
|
|
22
|
+
- `../logging/` and `../observability/` for runtime evidence.
|
|
23
|
+
- `../testing/` for regression coverage.
|
|
24
|
+
- `../frontend/debugging/` for browser-specific debugging.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Debugging Checklists
|
|
2
|
+
|
|
3
|
+
## Investigation
|
|
4
|
+
|
|
5
|
+
- [ ] Capture exact symptoms, inputs, environment, version, and timestamps.
|
|
6
|
+
- [ ] Reproduce locally or identify the closest observable production signal.
|
|
7
|
+
- [ ] List hypotheses and rank by likelihood and blast radius.
|
|
8
|
+
- [ ] Inspect logs, traces, metrics, diffs, and recent deploys.
|
|
9
|
+
|
|
10
|
+
## Fix
|
|
11
|
+
|
|
12
|
+
- [ ] Make the smallest change that addresses the confirmed cause.
|
|
13
|
+
- [ ] Remove temporary diagnostics or lower them to appropriate structured logs.
|
|
14
|
+
- [ ] Add tests for the failure mode.
|
|
15
|
+
- [ ] Confirm adjacent behavior still works.
|
|
16
|
+
|
|
17
|
+
## Closure
|
|
18
|
+
|
|
19
|
+
- [ ] Document root cause when the issue was user-visible or operationally significant.
|
|
20
|
+
- [ ] Add follow-up tasks for monitoring, tooling, or design gaps.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Debugging Examples
|
|
2
|
+
|
|
3
|
+
## Hypothesis Log
|
|
4
|
+
|
|
5
|
+
```text
|
|
6
|
+
Symptom: payment jobs retry forever after provider timeout.
|
|
7
|
+
|
|
8
|
+
Evidence:
|
|
9
|
+
- Retry count increases every 30 seconds.
|
|
10
|
+
- Provider request times out at 10 seconds.
|
|
11
|
+
- Job state remains "processing".
|
|
12
|
+
|
|
13
|
+
Hypothesis:
|
|
14
|
+
- Timeout path raises before job state is moved back to "queued".
|
|
15
|
+
|
|
16
|
+
Verification:
|
|
17
|
+
- Unit test timeout branch and inspect state transition.
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Regression Test Shape
|
|
21
|
+
|
|
22
|
+
```python
|
|
23
|
+
async def test_timeout_requeues_payment_job(payment_worker, timeout_payment_client):
|
|
24
|
+
job = await payment_worker.run_once()
|
|
25
|
+
|
|
26
|
+
assert job.status == "queued"
|
|
27
|
+
assert job.retry_count == 1
|
|
28
|
+
```
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Role Examples
|
|
2
|
+
|
|
3
|
+
This folder is reserved for larger end-to-end examples that are too specific for
|
|
4
|
+
the top-level `examples.md` file.
|
|
5
|
+
|
|
6
|
+
## Use Cases
|
|
7
|
+
|
|
8
|
+
- Complete feature walkthroughs.
|
|
9
|
+
- Multi-service change examples.
|
|
10
|
+
- Review examples with before-and-after diffs.
|
|
11
|
+
- Incident investigation narratives.
|
|
12
|
+
|
|
13
|
+
## File Naming
|
|
14
|
+
|
|
15
|
+
Use descriptive lowercase names:
|
|
16
|
+
|
|
17
|
+
- `api-contract-change.md`
|
|
18
|
+
- `background-job-retry.md`
|
|
19
|
+
- `database-migration-rollout.md`
|
|
20
|
+
- `frontend-form-validation.md`
|
|
21
|
+
|
|
22
|
+
Keep examples tied to role behavior and link back to topic packets when useful.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# Example Authoring Checklist
|
|
2
|
+
|
|
3
|
+
- [ ] State the scenario and why it matters.
|
|
4
|
+
- [ ] Show the starting point or problem.
|
|
5
|
+
- [ ] Show the implementation or review approach.
|
|
6
|
+
- [ ] Include tests, verification, or operational signals.
|
|
7
|
+
- [ ] Link to relevant topic folders such as `../api/`, `../database/`, or `../testing/`.
|
|
8
|
+
- [ ] Avoid project secrets, private data, and organization-specific credentials.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Example Index
|
|
2
|
+
|
|
3
|
+
Add larger examples here as the role grows.
|
|
4
|
+
|
|
5
|
+
## Starter Example Template
|
|
6
|
+
|
|
7
|
+
```markdown
|
|
8
|
+
# Scenario Name
|
|
9
|
+
|
|
10
|
+
## Problem
|
|
11
|
+
|
|
12
|
+
What failed or what needs to be built.
|
|
13
|
+
|
|
14
|
+
## Approach
|
|
15
|
+
|
|
16
|
+
The design and implementation path.
|
|
17
|
+
|
|
18
|
+
## Verification
|
|
19
|
+
|
|
20
|
+
Tests, checks, logs, screenshots, or rollout evidence.
|
|
21
|
+
|
|
22
|
+
## Follow-Ups
|
|
23
|
+
|
|
24
|
+
Known gaps or later improvements.
|
|
25
|
+
```
|