@jetrabbits/agentic 0.0.1
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/AGENTS.md +143 -0
- package/README.md +154 -0
- package/agentic +1615 -0
- package/areas/devops/ci-cd/AGENTS.md +48 -0
- package/areas/devops/ci-cd/PROMPTS.md +7 -0
- package/areas/devops/ci-cd/prompts/onboard-repo.md +97 -0
- package/areas/devops/ci-cd/prompts/pipeline-debug.md +103 -0
- package/areas/devops/ci-cd/prompts/release-pipeline.md +115 -0
- package/areas/devops/ci-cd/rules/pipeline-standards.md +33 -0
- package/areas/devops/ci-cd/rules/quality-gates.md +24 -0
- package/areas/devops/ci-cd/rules/supply-chain-security.md +34 -0
- package/areas/devops/ci-cd/skills/artifact-management/SKILL.md +157 -0
- package/areas/devops/ci-cd/skills/build-optimization/SKILL.md +168 -0
- package/areas/devops/ci-cd/skills/github-actions-patterns/SKILL.md +190 -0
- package/areas/devops/ci-cd/skills/gitlab-ci-patterns/SKILL.md +169 -0
- package/areas/devops/ci-cd/skills/pipeline-security/SKILL.md +161 -0
- package/areas/devops/ci-cd/workflows/onboard-repo.md +73 -0
- package/areas/devops/ci-cd/workflows/pipeline-debug.md +66 -0
- package/areas/devops/ci-cd/workflows/release-pipeline.md +115 -0
- package/areas/devops/database-ops/AGENTS.md +47 -0
- package/areas/devops/database-ops/prompts/backup-verify.md +83 -0
- package/areas/devops/database-ops/prompts/db-incident.md +127 -0
- package/areas/devops/database-ops/rules/access-control.md +20 -0
- package/areas/devops/database-ops/rules/backup-policy.md +33 -0
- package/areas/devops/database-ops/rules/migration-runbook.md +32 -0
- package/areas/devops/database-ops/skills/backup-restore/SKILL.md +226 -0
- package/areas/devops/database-ops/skills/db-performance/SKILL.md +205 -0
- package/areas/devops/database-ops/skills/migration-safety/SKILL.md +155 -0
- package/areas/devops/database-ops/skills/postgres-operations/SKILL.md +156 -0
- package/areas/devops/database-ops/skills/redis-operations/SKILL.md +174 -0
- package/areas/devops/database-ops/workflows/backup-verify.md +107 -0
- package/areas/devops/database-ops/workflows/db-incident.md +86 -0
- package/areas/devops/devsecops/AGENTS.md +47 -0
- package/areas/devops/devsecops/prompts/policy-onboard.md +79 -0
- package/areas/devops/devsecops/prompts/security-scan-pipeline.md +131 -0
- package/areas/devops/devsecops/rules/container-security.md +22 -0
- package/areas/devops/devsecops/rules/policy-as-code.md +37 -0
- package/areas/devops/devsecops/rules/shift-left-policy.md +26 -0
- package/areas/devops/devsecops/skills/container-hardening/SKILL.md +146 -0
- package/areas/devops/devsecops/skills/opa-policies/SKILL.md +188 -0
- package/areas/devops/devsecops/skills/sbom-supply-chain/SKILL.md +165 -0
- package/areas/devops/devsecops/skills/secret-detection/SKILL.md +190 -0
- package/areas/devops/devsecops/skills/sigstore-signing/SKILL.md +184 -0
- package/areas/devops/devsecops/workflows/policy-onboard.md +104 -0
- package/areas/devops/devsecops/workflows/security-scan-pipeline.md +155 -0
- package/areas/devops/infrastructure/AGENTS.md +50 -0
- package/areas/devops/infrastructure/prompts/destroy-environment.md +81 -0
- package/areas/devops/infrastructure/prompts/drift-remediation.md +71 -0
- package/areas/devops/infrastructure/prompts/module-development.md +69 -0
- package/areas/devops/infrastructure/prompts/provision-environment.md +121 -0
- package/areas/devops/infrastructure/rules/iac-standards.md +80 -0
- package/areas/devops/infrastructure/rules/immutability.md +28 -0
- package/areas/devops/infrastructure/rules/secret-hygiene.md +53 -0
- package/areas/devops/infrastructure/rules/state-management.md +47 -0
- package/areas/devops/infrastructure/skills/ansible-playbooks/SKILL.md +174 -0
- package/areas/devops/infrastructure/skills/cost-optimization/SKILL.md +177 -0
- package/areas/devops/infrastructure/skills/drift-detection/SKILL.md +178 -0
- package/areas/devops/infrastructure/skills/state-management/SKILL.md +159 -0
- package/areas/devops/infrastructure/skills/terraform-modules/SKILL.md +169 -0
- package/areas/devops/infrastructure/workflows/destroy-environment.md +96 -0
- package/areas/devops/infrastructure/workflows/drift-remediation.md +66 -0
- package/areas/devops/infrastructure/workflows/module-development.md +101 -0
- package/areas/devops/infrastructure/workflows/provision-environment.md +96 -0
- package/areas/devops/kubernetes/AGENTS.md +57 -0
- package/areas/devops/kubernetes/PROMPTS.md +9 -0
- package/areas/devops/kubernetes/prompts/cluster-bootstrap.md +67 -0
- package/areas/devops/kubernetes/prompts/debug-workload.md +91 -0
- package/areas/devops/kubernetes/prompts/onboard-service.md +101 -0
- package/areas/devops/kubernetes/prompts/upgrade-cluster.md +63 -0
- package/areas/devops/kubernetes/rules/cluster-standards.md +51 -0
- package/areas/devops/kubernetes/rules/resource-governance.md +80 -0
- package/areas/devops/kubernetes/rules/upgrade-policy.md +52 -0
- package/areas/devops/kubernetes/rules/workload-security.md +64 -0
- package/areas/devops/kubernetes/skills/cluster-operations/SKILL.md +136 -0
- package/areas/devops/kubernetes/skills/helm-charts/SKILL.md +152 -0
- package/areas/devops/kubernetes/skills/network-policies/SKILL.md +169 -0
- package/areas/devops/kubernetes/skills/pod-troubleshooting/SKILL.md +129 -0
- package/areas/devops/kubernetes/skills/rbac-design/SKILL.md +148 -0
- package/areas/devops/kubernetes/skills/resource-tuning/SKILL.md +156 -0
- package/areas/devops/kubernetes/workflows/cluster-bootstrap.md +194 -0
- package/areas/devops/kubernetes/workflows/debug-workload.md +108 -0
- package/areas/devops/kubernetes/workflows/onboard-service.md +124 -0
- package/areas/devops/kubernetes/workflows/upgrade-cluster.md +165 -0
- package/areas/devops/networking/AGENTS.md +47 -0
- package/areas/devops/networking/prompts/onboard-ingress.md +119 -0
- package/areas/devops/networking/prompts/service-mesh-onboard.md +77 -0
- package/areas/devops/networking/rules/ingress-standards.md +17 -0
- package/areas/devops/networking/rules/network-segmentation.md +24 -0
- package/areas/devops/networking/rules/tls-policy.md +32 -0
- package/areas/devops/networking/skills/dns-management/SKILL.md +169 -0
- package/areas/devops/networking/skills/ingress-patterns/SKILL.md +165 -0
- package/areas/devops/networking/skills/service-mesh/SKILL.md +206 -0
- package/areas/devops/networking/skills/tls-termination/SKILL.md +198 -0
- package/areas/devops/networking/skills/vpc-design/SKILL.md +132 -0
- package/areas/devops/networking/workflows/onboard-ingress.md +64 -0
- package/areas/devops/networking/workflows/service-mesh-onboard.md +122 -0
- package/areas/devops/observability/AGENTS.md +48 -0
- package/areas/devops/observability/prompts/alert-investigation.md +117 -0
- package/areas/devops/observability/prompts/observability-stack-setup.md +99 -0
- package/areas/devops/observability/prompts/onboard-service-monitoring.md +79 -0
- package/areas/devops/observability/rules/alerting-standards.md +36 -0
- package/areas/devops/observability/rules/data-retention.md +19 -0
- package/areas/devops/observability/rules/golden-signals.md +28 -0
- package/areas/devops/observability/skills/distributed-tracing/SKILL.md +149 -0
- package/areas/devops/observability/skills/grafana-dashboards/SKILL.md +201 -0
- package/areas/devops/observability/skills/log-aggregation/SKILL.md +159 -0
- package/areas/devops/observability/skills/prometheus-alertmanager/SKILL.md +188 -0
- package/areas/devops/observability/skills/slo-implementation/SKILL.md +189 -0
- package/areas/devops/observability/workflows/alert-investigation.md +98 -0
- package/areas/devops/observability/workflows/observability-stack-setup.md +156 -0
- package/areas/devops/observability/workflows/onboard-service-monitoring.md +83 -0
- package/areas/devops/sre/AGENTS.md +48 -0
- package/areas/devops/sre/prompts/incident-response.md +129 -0
- package/areas/devops/sre/prompts/postmortem.md +101 -0
- package/areas/devops/sre/prompts/slo-review.md +125 -0
- package/areas/devops/sre/rules/error-budget-policy.md +25 -0
- package/areas/devops/sre/rules/on-call-standards.md +25 -0
- package/areas/devops/sre/rules/slo-policy.md +31 -0
- package/areas/devops/sre/skills/capacity-planning/SKILL.md +162 -0
- package/areas/devops/sre/skills/chaos-engineering/SKILL.md +186 -0
- package/areas/devops/sre/skills/incident-command/SKILL.md +119 -0
- package/areas/devops/sre/skills/postmortem-analysis/SKILL.md +104 -0
- package/areas/devops/sre/skills/slo-sli-design/SKILL.md +145 -0
- package/areas/devops/sre/workflows/incident-response.md +66 -0
- package/areas/devops/sre/workflows/postmortem.md +90 -0
- package/areas/devops/sre/workflows/slo-review.md +95 -0
- package/areas/software/backend/AGENTS.md +59 -0
- package/areas/software/backend/PROMPTS.md +50 -0
- package/areas/software/backend/README.md +48 -0
- package/areas/software/backend/prompts/add-migration.md +93 -0
- package/areas/software/backend/prompts/create-endpoint.md +97 -0
- package/areas/software/backend/prompts/debug-issue.md +87 -0
- package/areas/software/backend/prompts/develop-epic.md +83 -0
- package/areas/software/backend/prompts/develop-feature.md +91 -0
- package/areas/software/backend/prompts/refactor-module.md +79 -0
- package/areas/software/backend/prompts/test-feature.md +89 -0
- package/areas/software/backend/rules/architecture.md +20 -0
- package/areas/software/backend/rules/data_access.md +20 -0
- package/areas/software/backend/rules/security.md +20 -0
- package/areas/software/backend/rules/testing.md +19 -0
- package/areas/software/backend/skills/api-design/SKILL.md +170 -0
- package/areas/software/backend/skills/async-processing/SKILL.md +152 -0
- package/areas/software/backend/skills/database-modeling/SKILL.md +173 -0
- package/areas/software/backend/skills/observability/SKILL.md +162 -0
- package/areas/software/backend/skills/troubleshooting/SKILL.md +139 -0
- package/areas/software/backend/workflows/add-migration.md +79 -0
- package/areas/software/backend/workflows/create-endpoint.md +89 -0
- package/areas/software/backend/workflows/debug-issue.md +77 -0
- package/areas/software/backend/workflows/develop-epic.md +78 -0
- package/areas/software/backend/workflows/develop-feature.md +98 -0
- package/areas/software/backend/workflows/refactor-module.md +73 -0
- package/areas/software/backend/workflows/test-feature.md +67 -0
- package/areas/software/data-engineering/AGENTS.md +59 -0
- package/areas/software/data-engineering/PROMPTS.md +32 -0
- package/areas/software/data-engineering/prompts/backfill-data.md +107 -0
- package/areas/software/data-engineering/prompts/data-quality-incident.md +109 -0
- package/areas/software/data-engineering/prompts/lineage-trace.md +121 -0
- package/areas/software/data-engineering/prompts/new-model.md +117 -0
- package/areas/software/data-engineering/prompts/schema-migration.md +111 -0
- package/areas/software/data-engineering/rules/data-governance.md +11 -0
- package/areas/software/data-engineering/rules/pii-handling.md +19 -0
- package/areas/software/data-engineering/rules/pipeline-integrity.md +11 -0
- package/areas/software/data-engineering/rules/schema-management.md +21 -0
- package/areas/software/data-engineering/skills/data-modeling/SKILL.md +49 -0
- package/areas/software/data-engineering/skills/dbt-patterns/SKILL.md +43 -0
- package/areas/software/data-engineering/skills/lineage-governance/SKILL.md +38 -0
- package/areas/software/data-engineering/skills/orchestration/SKILL.md +35 -0
- package/areas/software/data-engineering/skills/quality-checks/SKILL.md +50 -0
- package/areas/software/data-engineering/skills/sql-optimization/SKILL.md +47 -0
- package/areas/software/data-engineering/skills/streaming-patterns/SKILL.md +48 -0
- package/areas/software/data-engineering/workflows/backfill-data.md +59 -0
- package/areas/software/data-engineering/workflows/data-quality-incident.md +64 -0
- package/areas/software/data-engineering/workflows/lineage-trace.md +56 -0
- package/areas/software/data-engineering/workflows/new-model.md +71 -0
- package/areas/software/data-engineering/workflows/schema-migration.md +67 -0
- package/areas/software/frontend/AGENTS.md +60 -0
- package/areas/software/frontend/PROMPTS.md +32 -0
- package/areas/software/frontend/prompts/a11y-fix.md +75 -0
- package/areas/software/frontend/prompts/bundle-analyze.md +75 -0
- package/areas/software/frontend/prompts/release-prep.md +83 -0
- package/areas/software/frontend/prompts/scaffold-component.md +69 -0
- package/areas/software/frontend/prompts/visual-regression.md +73 -0
- package/areas/software/frontend/rules/accessibility.md +16 -0
- package/areas/software/frontend/rules/architecture.md +29 -0
- package/areas/software/frontend/rules/performance.md +23 -0
- package/areas/software/frontend/rules/quality.md +12 -0
- package/areas/software/frontend/skills/a11y-audit/SKILL.md +61 -0
- package/areas/software/frontend/skills/api-integration/SKILL.md +58 -0
- package/areas/software/frontend/skills/component-design/SKILL.md +171 -0
- package/areas/software/frontend/skills/css-architecture/SKILL.md +146 -0
- package/areas/software/frontend/skills/error-handling/SKILL.md +55 -0
- package/areas/software/frontend/skills/performance-tuning/SKILL.md +58 -0
- package/areas/software/frontend/skills/state-management/SKILL.md +54 -0
- package/areas/software/frontend/skills/testing-patterns/SKILL.md +69 -0
- package/areas/software/frontend/workflows/a11y-fix.md +63 -0
- package/areas/software/frontend/workflows/bundle-analyze.md +56 -0
- package/areas/software/frontend/workflows/release-prep.md +66 -0
- package/areas/software/frontend/workflows/scaffold-component.md +67 -0
- package/areas/software/frontend/workflows/visual-regression.md +65 -0
- package/areas/software/full-stack/AGENTS.md +72 -0
- package/areas/software/full-stack/PROMPTS.md +66 -0
- package/areas/software/full-stack/prompts/backend-project-full-cycle.md +141 -0
- package/areas/software/full-stack/prompts/debug-issue.md +115 -0
- package/areas/software/full-stack/prompts/develop-feature.md +119 -0
- package/areas/software/full-stack/prompts/feature-implementation-flow.md +137 -0
- package/areas/software/full-stack/prompts/testing-ci-pipeline.md +119 -0
- package/areas/software/full-stack/rules/api-design-guide.md +24 -0
- package/areas/software/full-stack/rules/async-concurrency-guide.md +21 -0
- package/areas/software/full-stack/rules/backend-architecture-rule.md +41 -0
- package/areas/software/full-stack/rules/background-jobs-guide.md +20 -0
- package/areas/software/full-stack/rules/code-quality-guide.md +22 -0
- package/areas/software/full-stack/rules/database-access-guide.md +24 -0
- package/areas/software/full-stack/rules/database-migrations-guide.md +24 -0
- package/areas/software/full-stack/rules/domain-models-guide.md +28 -0
- package/areas/software/full-stack/rules/e2e-test-guide.md +18 -0
- package/areas/software/full-stack/rules/env-settings-guide.md +34 -0
- package/areas/software/full-stack/rules/error-handling-guide.md +20 -0
- package/areas/software/full-stack/rules/logging-observability-guide.md +22 -0
- package/areas/software/full-stack/rules/project-guide.md +34 -0
- package/areas/software/full-stack/rules/python-venv-guide.md +23 -0
- package/areas/software/full-stack/rules/security-guide.md +22 -0
- package/areas/software/full-stack/rules/svt-test-guide.md +17 -0
- package/areas/software/full-stack/rules/testing-ci-guide.md +25 -0
- package/areas/software/full-stack/skills/api-design-principles/SKILL.md +125 -0
- package/areas/software/full-stack/skills/api-design-principles/assets/api-design-checklist.md +155 -0
- package/areas/software/full-stack/skills/api-design-principles/assets/rest-api-template.py +182 -0
- package/areas/software/full-stack/skills/api-design-principles/references/graphql-schema-design.md +583 -0
- package/areas/software/full-stack/skills/api-design-principles/references/rest-best-practices.md +408 -0
- package/areas/software/full-stack/skills/api-design-principles/resources/implementation-playbook.md +513 -0
- package/areas/software/full-stack/skills/api-patterns/SKILL.md +81 -0
- package/areas/software/full-stack/skills/api-patterns/api-style.md +42 -0
- package/areas/software/full-stack/skills/api-patterns/auth.md +24 -0
- package/areas/software/full-stack/skills/api-patterns/documentation.md +26 -0
- package/areas/software/full-stack/skills/api-patterns/graphql.md +41 -0
- package/areas/software/full-stack/skills/api-patterns/rate-limiting.md +31 -0
- package/areas/software/full-stack/skills/api-patterns/response.md +37 -0
- package/areas/software/full-stack/skills/api-patterns/rest.md +40 -0
- package/areas/software/full-stack/skills/api-patterns/scripts/api_validator.py +211 -0
- package/areas/software/full-stack/skills/api-patterns/security-testing.md +122 -0
- package/areas/software/full-stack/skills/api-patterns/trpc.md +41 -0
- package/areas/software/full-stack/skills/api-patterns/versioning.md +22 -0
- package/areas/software/full-stack/skills/app-builder/SKILL.md +135 -0
- package/areas/software/full-stack/skills/app-builder/agent-coordination.md +71 -0
- package/areas/software/full-stack/skills/app-builder/feature-building.md +53 -0
- package/areas/software/full-stack/skills/app-builder/project-detection.md +34 -0
- package/areas/software/full-stack/skills/app-builder/scaffolding.md +118 -0
- package/areas/software/full-stack/skills/app-builder/tech-stack.md +40 -0
- package/areas/software/full-stack/skills/app-builder/templates/SKILL.md +39 -0
- package/areas/software/full-stack/skills/app-builder/templates/astro-static/TEMPLATE.md +76 -0
- package/areas/software/full-stack/skills/app-builder/templates/chrome-extension/TEMPLATE.md +92 -0
- package/areas/software/full-stack/skills/app-builder/templates/cli-tool/TEMPLATE.md +88 -0
- package/areas/software/full-stack/skills/app-builder/templates/electron-desktop/TEMPLATE.md +88 -0
- package/areas/software/full-stack/skills/app-builder/templates/express-api/TEMPLATE.md +83 -0
- package/areas/software/full-stack/skills/app-builder/templates/flutter-app/TEMPLATE.md +90 -0
- package/areas/software/full-stack/skills/app-builder/templates/monorepo-turborepo/TEMPLATE.md +90 -0
- package/areas/software/full-stack/skills/app-builder/templates/nextjs-fullstack/TEMPLATE.md +82 -0
- package/areas/software/full-stack/skills/app-builder/templates/nextjs-saas/TEMPLATE.md +100 -0
- package/areas/software/full-stack/skills/app-builder/templates/nextjs-static/TEMPLATE.md +106 -0
- package/areas/software/full-stack/skills/app-builder/templates/nuxt-app/TEMPLATE.md +101 -0
- package/areas/software/full-stack/skills/app-builder/templates/python-fastapi/TEMPLATE.md +83 -0
- package/areas/software/full-stack/skills/app-builder/templates/react-native-app/TEMPLATE.md +93 -0
- package/areas/software/full-stack/skills/backend-developer/SKILL.md +58 -0
- package/areas/software/full-stack/skills/bash-pro/SKILL.md +310 -0
- package/areas/software/full-stack/skills/blackbox-test/SKILL.md +84 -0
- package/areas/software/full-stack/skills/prompt-project-planner/SKILL.md +130 -0
- package/areas/software/full-stack/skills/prompt-project-planner/output.schema.md +68 -0
- package/areas/software/full-stack/skills/prompt-project-planner/questions.md +80 -0
- package/areas/software/full-stack/skills/python-pro/SKILL.md +158 -0
- package/areas/software/full-stack/skills/skill-creator/LICENSE.txt +202 -0
- package/areas/software/full-stack/skills/skill-creator/SKILL.md +356 -0
- package/areas/software/full-stack/skills/skill-creator/references/output-patterns.md +82 -0
- package/areas/software/full-stack/skills/skill-creator/references/workflows.md +28 -0
- package/areas/software/full-stack/skills/skill-creator/scripts/init_skill.py +303 -0
- package/areas/software/full-stack/skills/skill-creator/scripts/package_skill.py +110 -0
- package/areas/software/full-stack/skills/skill-creator/scripts/quick_validate.py +95 -0
- package/areas/software/full-stack/workflows/backend-project-full-cycle.md +132 -0
- package/areas/software/full-stack/workflows/debug-issue.md +70 -0
- package/areas/software/full-stack/workflows/develop-feature.md +85 -0
- package/areas/software/full-stack/workflows/feature-implementation-flow.md +78 -0
- package/areas/software/full-stack/workflows/testing-ci-pipeline.md +65 -0
- package/areas/software/general/AGENTS.md +68 -0
- package/areas/software/general/prompts/code-review-workflow.md +87 -0
- package/areas/software/general/prompts/development-cycle-workflow.md +83 -0
- package/areas/software/general/prompts/project-setup-workflow.md +93 -0
- package/areas/software/general/rules/code-style-guide.md +31 -0
- package/areas/software/general/rules/docker-compose-guide.md +27 -0
- package/areas/software/general/rules/git-workflow-guide.md +27 -0
- package/areas/software/general/rules/github-workflow-guide.md +27 -0
- package/areas/software/general/rules/gitlab-ci-guide.md +27 -0
- package/areas/software/general/rules/lint-format-guide.md +29 -0
- package/areas/software/general/rules/makefile-guide.md +34 -0
- package/areas/software/general/rules/readme-sync-guide.md +40 -0
- package/areas/software/general/rules/sdlc-methodology-guide.md +27 -0
- package/areas/software/general/rules/sdlc-role-responsibilities.md +108 -0
- package/areas/software/general/skills/general-dev-tools/SKILL.md +324 -0
- package/areas/software/general/workflows/code-review-workflow.md +84 -0
- package/areas/software/general/workflows/development-cycle-workflow.md +85 -0
- package/areas/software/general/workflows/project-setup-workflow.md +94 -0
- package/areas/software/mlops/AGENTS.md +57 -0
- package/areas/software/mlops/PROMPTS.md +32 -0
- package/areas/software/mlops/prompts/champion-challenger.md +87 -0
- package/areas/software/mlops/prompts/deploy-endpoint.md +91 -0
- package/areas/software/mlops/prompts/evaluate-model.md +87 -0
- package/areas/software/mlops/prompts/model-incident.md +87 -0
- package/areas/software/mlops/prompts/train-experiment.md +83 -0
- package/areas/software/mlops/rules/data-integrity.md +9 -0
- package/areas/software/mlops/rules/model-governance.md +9 -0
- package/areas/software/mlops/rules/production-safety.md +9 -0
- package/areas/software/mlops/rules/reproducibility.md +9 -0
- package/areas/software/mlops/skills/experiment-tracking/SKILL.md +29 -0
- package/areas/software/mlops/skills/feature-engineering/SKILL.md +44 -0
- package/areas/software/mlops/skills/inference-serving/SKILL.md +35 -0
- package/areas/software/mlops/skills/model-evaluation/SKILL.md +40 -0
- package/areas/software/mlops/skills/model-monitoring/SKILL.md +32 -0
- package/areas/software/mlops/workflows/champion-challenger.md +65 -0
- package/areas/software/mlops/workflows/deploy-endpoint.md +70 -0
- package/areas/software/mlops/workflows/evaluate-model.md +63 -0
- package/areas/software/mlops/workflows/model-incident.md +64 -0
- package/areas/software/mlops/workflows/train-experiment.md +56 -0
- package/areas/software/mobile/AGENTS.md +58 -0
- package/areas/software/mobile/PROMPTS.md +32 -0
- package/areas/software/mobile/prompts/crash-triage.md +63 -0
- package/areas/software/mobile/prompts/device-testing.md +83 -0
- package/areas/software/mobile/prompts/ota-update.md +75 -0
- package/areas/software/mobile/prompts/release-build.md +67 -0
- package/areas/software/mobile/prompts/store-submission.md +79 -0
- package/areas/software/mobile/rules/offline-first.md +10 -0
- package/areas/software/mobile/rules/performance-budget.md +20 -0
- package/areas/software/mobile/rules/platform-compliance.md +17 -0
- package/areas/software/mobile/rules/security-mobile.md +9 -0
- package/areas/software/mobile/skills/app-store-prep/SKILL.md +27 -0
- package/areas/software/mobile/skills/mobile-testing/SKILL.md +36 -0
- package/areas/software/mobile/skills/native-modules/SKILL.md +38 -0
- package/areas/software/mobile/skills/navigation-patterns/SKILL.md +49 -0
- package/areas/software/mobile/skills/push-notifications/SKILL.md +40 -0
- package/areas/software/mobile/skills/state-sync/SKILL.md +48 -0
- package/areas/software/mobile/workflows/crash-triage.md +63 -0
- package/areas/software/mobile/workflows/device-testing.md +54 -0
- package/areas/software/mobile/workflows/ota-update.md +54 -0
- package/areas/software/mobile/workflows/release-build.md +67 -0
- package/areas/software/mobile/workflows/store-submission.md +63 -0
- package/areas/software/platform/AGENTS.md +67 -0
- package/areas/software/platform/PROMPTS.md +32 -0
- package/areas/software/platform/prompts/cost-audit.md +117 -0
- package/areas/software/platform/prompts/deploy-production.md +109 -0
- package/areas/software/platform/prompts/drift-check.md +107 -0
- package/areas/software/platform/prompts/incident-response.md +121 -0
- package/areas/software/platform/prompts/provision-env.md +113 -0
- package/areas/software/platform/rules/cost-governance.md +11 -0
- package/areas/software/platform/rules/immutability.md +17 -0
- package/areas/software/platform/rules/reliability.md +19 -0
- package/areas/software/platform/rules/security-posture.md +12 -0
- package/areas/software/platform/skills/ci-cd-pipelines/SKILL.md +58 -0
- package/areas/software/platform/skills/incident-response/SKILL.md +41 -0
- package/areas/software/platform/skills/k8s-manifests/SKILL.md +56 -0
- package/areas/software/platform/skills/networking/SKILL.md +44 -0
- package/areas/software/platform/skills/observability-setup/SKILL.md +49 -0
- package/areas/software/platform/skills/secrets-management/SKILL.md +43 -0
- package/areas/software/platform/skills/terraform-patterns/SKILL.md +75 -0
- package/areas/software/platform/workflows/cost-audit.md +61 -0
- package/areas/software/platform/workflows/deploy-production.md +67 -0
- package/areas/software/platform/workflows/drift-check.md +61 -0
- package/areas/software/platform/workflows/incident-response.md +69 -0
- package/areas/software/platform/workflows/provision-env.md +77 -0
- package/areas/software/qa/AGENTS.md +58 -0
- package/areas/software/qa/PROMPTS.md +32 -0
- package/areas/software/qa/prompts/flakiness-investigation.md +61 -0
- package/areas/software/qa/prompts/performance-audit.md +65 -0
- package/areas/software/qa/prompts/regression-suite.md +61 -0
- package/areas/software/qa/prompts/smoke-test.md +65 -0
- package/areas/software/qa/prompts/test-coverage-report.md +61 -0
- package/areas/software/qa/rules/flakiness-policy.md +12 -0
- package/areas/software/qa/rules/quality-gates.md +28 -0
- package/areas/software/qa/rules/test-data.md +9 -0
- package/areas/software/qa/rules/test-strategy.md +11 -0
- package/areas/software/qa/skills/accessibility-testing/SKILL.md +139 -0
- package/areas/software/qa/skills/api-testing/SKILL.md +140 -0
- package/areas/software/qa/skills/e2e-patterns/SKILL.md +152 -0
- package/areas/software/qa/skills/performance-testing/SKILL.md +177 -0
- package/areas/software/qa/skills/test-data-management/SKILL.md +161 -0
- package/areas/software/qa/skills/test-pyramid/SKILL.md +127 -0
- package/areas/software/qa/workflows/flakiness-investigation.md +63 -0
- package/areas/software/qa/workflows/performance-audit.md +59 -0
- package/areas/software/qa/workflows/regression-suite.md +59 -0
- package/areas/software/qa/workflows/smoke-test.md +64 -0
- package/areas/software/qa/workflows/test-coverage-report.md +57 -0
- package/areas/software/security/AGENTS.md +58 -0
- package/areas/software/security/PROMPTS.md +32 -0
- package/areas/software/security/prompts/compliance-report.md +113 -0
- package/areas/software/security/prompts/pen-test-sim.md +113 -0
- package/areas/software/security/prompts/secret-rotation.md +115 -0
- package/areas/software/security/prompts/security-scan.md +91 -0
- package/areas/software/security/prompts/threat-model-review.md +105 -0
- package/areas/software/security/rules/compliance-baseline.md +23 -0
- package/areas/software/security/rules/dependency-policy.md +12 -0
- package/areas/software/security/rules/secrets-policy.md +22 -0
- package/areas/software/security/rules/secure-coding.md +22 -0
- package/areas/software/security/skills/auth-patterns/SKILL.md +42 -0
- package/areas/software/security/skills/crypto-standards/SKILL.md +42 -0
- package/areas/software/security/skills/dependency-audit/SKILL.md +29 -0
- package/areas/software/security/skills/sast-dast-interpretation/SKILL.md +33 -0
- package/areas/software/security/skills/security-headers/SKILL.md +29 -0
- package/areas/software/security/skills/threat-modeling/SKILL.md +36 -0
- package/areas/software/security/workflows/compliance-report.md +57 -0
- package/areas/software/security/workflows/pen-test-sim.md +63 -0
- package/areas/software/security/workflows/secret-rotation.md +67 -0
- package/areas/software/security/workflows/security-scan.md +64 -0
- package/areas/software/security/workflows/threat-model-review.md +62 -0
- package/areas/template/AGENTS-area.tmpl.md +61 -0
- package/areas/template/AGENTS.tmpl.md +67 -0
- package/areas/template/GUIDE.md +102 -0
- package/areas/template/PROMPTS.tmpl.md +29 -0
- package/areas/template/README.md +57 -0
- package/areas/template/README.tmpl.md +51 -0
- package/areas/template/prompt.tmpl.md +101 -0
- package/areas/template/rule.tmpl.md +71 -0
- package/areas/template/skill.tmpl.md +108 -0
- package/areas/template/workflow.tmpl.md +104 -0
- package/bin/agentic.js +24 -0
- package/extensions/antigravity/GEMINI.md +10 -0
- package/extensions/claude/CLAUDE.md +10 -0
- package/extensions/codex/AGENTS.override.md +93 -0
- package/extensions/gemini/GEMINI.md +10 -0
- package/extensions/opencode/agents/designer.md +65 -0
- package/extensions/opencode/agents/developer.md +63 -0
- package/extensions/opencode/agents/devops-engineer.md +69 -0
- package/extensions/opencode/agents/pm.md +61 -0
- package/extensions/opencode/agents/product-owner.md +76 -0
- package/extensions/opencode/agents/qa.md +66 -0
- package/extensions/opencode/agents/team-lead.md +67 -0
- package/extensions/opencode/commands/feature.md +75 -0
- package/extensions/opencode/opencode.json +93 -0
- package/extensions/opencode/plugins/model-checker.json +14 -0
- package/extensions/opencode/plugins/model-checker.ts +279 -0
- package/extensions/opencode/plugins/sound-notification.ts +13 -0
- package/extensions/opencode/plugins/telegram-notification.ts +86 -0
- package/extensions/opencode/skills/code_review_expert/SKILL.md +144 -0
- package/extensions/opencode/skills/design_expert/SKILL.md +42 -0
- package/extensions/opencode/skills/qa_expert/SKILL.md +116 -0
- package/package.json +19 -0
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: api-design
|
|
3
|
+
type: skill
|
|
4
|
+
description: Design and implement REST APIs with consistent conventions, versioning, error contracts, and security.
|
|
5
|
+
related-rules:
|
|
6
|
+
- architecture.md
|
|
7
|
+
- security.md
|
|
8
|
+
allowed-tools: Read, Write, Edit, Bash
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# API Design Skill
|
|
12
|
+
|
|
13
|
+
> **Expertise:** REST API design, HTTP semantics, versioning strategies, error contracts, OpenAPI, pagination, idempotency.
|
|
14
|
+
|
|
15
|
+
## HTTP Method & Status Code Reference
|
|
16
|
+
|
|
17
|
+
| Operation | Method | Success | Error cases |
|
|
18
|
+
|---|---|---|---|
|
|
19
|
+
| Create resource | POST | 201 Created | 400 Validation, 409 Conflict |
|
|
20
|
+
| Read resource | GET | 200 OK | 404 Not Found, 403 Forbidden |
|
|
21
|
+
| Full update | PUT | 200 OK | 400, 404, 409 |
|
|
22
|
+
| Partial update | PATCH | 200 OK | 400, 404 |
|
|
23
|
+
| Delete | DELETE | 204 No Content | 404, 409 (has dependents) |
|
|
24
|
+
| Async action | POST | 202 Accepted | 400 |
|
|
25
|
+
|
|
26
|
+
## URL Design Rules
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
✅ Nouns, plural, lowercase, kebab-case
|
|
30
|
+
GET /users/{id}
|
|
31
|
+
POST /orders
|
|
32
|
+
GET /product-categories
|
|
33
|
+
|
|
34
|
+
❌ Verbs in path
|
|
35
|
+
POST /createOrder
|
|
36
|
+
GET /getUser?id=123
|
|
37
|
+
|
|
38
|
+
✅ Nesting only for true ownership (max 2 levels)
|
|
39
|
+
GET /orders/{order_id}/items ✅ items belong to order
|
|
40
|
+
GET /orders/{order_id}/items/{item_id}/tags ❌ too deep
|
|
41
|
+
|
|
42
|
+
✅ Actions as sub-resources
|
|
43
|
+
POST /orders/{id}/cancel
|
|
44
|
+
POST /invoices/{id}/resend
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Standard Error Contract
|
|
48
|
+
|
|
49
|
+
All error responses must follow the same shape:
|
|
50
|
+
```json
|
|
51
|
+
{
|
|
52
|
+
"error": {
|
|
53
|
+
"code": "ORDER_NOT_FOUND", // machine-readable, stable
|
|
54
|
+
"message": "Order ord_123 not found", // human-readable
|
|
55
|
+
"details": [ // optional: per-field errors
|
|
56
|
+
{ "field": "items[0].quantity", "issue": "must be > 0" }
|
|
57
|
+
],
|
|
58
|
+
"request_id": "req_abc123" // traceable
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
```python
|
|
64
|
+
# FastAPI implementation
|
|
65
|
+
from fastapi import HTTPException
|
|
66
|
+
from pydantic import BaseModel
|
|
67
|
+
from typing import Optional, List
|
|
68
|
+
|
|
69
|
+
class ErrorDetail(BaseModel):
|
|
70
|
+
field: str
|
|
71
|
+
issue: str
|
|
72
|
+
|
|
73
|
+
class ErrorResponse(BaseModel):
|
|
74
|
+
code: str
|
|
75
|
+
message: str
|
|
76
|
+
details: Optional[List[ErrorDetail]] = None
|
|
77
|
+
request_id: Optional[str] = None
|
|
78
|
+
|
|
79
|
+
# Usage
|
|
80
|
+
raise HTTPException(
|
|
81
|
+
status_code=404,
|
|
82
|
+
detail=ErrorResponse(
|
|
83
|
+
code="ORDER_NOT_FOUND",
|
|
84
|
+
message=f"Order {order_id} not found",
|
|
85
|
+
request_id=request.state.request_id
|
|
86
|
+
).model_dump()
|
|
87
|
+
)
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## Pagination Patterns
|
|
91
|
+
|
|
92
|
+
### Cursor-based (preferred for large/live datasets)
|
|
93
|
+
```python
|
|
94
|
+
class PaginatedResponse(BaseModel, Generic[T]):
|
|
95
|
+
items: List[T]
|
|
96
|
+
next_cursor: Optional[str] = None # opaque, base64-encoded
|
|
97
|
+
total_count: Optional[int] = None # only if cheap to compute
|
|
98
|
+
|
|
99
|
+
# Encode cursor: hide implementation detail from client
|
|
100
|
+
import base64, json
|
|
101
|
+
|
|
102
|
+
def encode_cursor(last_id: int, last_created_at: datetime) -> str:
|
|
103
|
+
payload = {"id": last_id, "ts": last_created_at.isoformat()}
|
|
104
|
+
return base64.b64encode(json.dumps(payload).encode()).decode()
|
|
105
|
+
|
|
106
|
+
def decode_cursor(cursor: str) -> dict:
|
|
107
|
+
return json.loads(base64.b64decode(cursor).decode())
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### Offset-based (only for small, static datasets)
|
|
111
|
+
```python
|
|
112
|
+
# Only when total count is cheap and dataset doesn't change under pagination
|
|
113
|
+
@router.get("/products")
|
|
114
|
+
async def list_products(page: int = 1, page_size: int = Query(20, le=100)):
|
|
115
|
+
offset = (page - 1) * page_size
|
|
116
|
+
# ...
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
## Versioning Strategy
|
|
120
|
+
|
|
121
|
+
```
|
|
122
|
+
URL versioning (recommended for major breaking changes):
|
|
123
|
+
/api/v1/orders
|
|
124
|
+
/api/v2/orders ← new schema, old still supported
|
|
125
|
+
|
|
126
|
+
Header versioning (for minor variations):
|
|
127
|
+
Accept: application/vnd.myapi.v2+json
|
|
128
|
+
|
|
129
|
+
Rules:
|
|
130
|
+
- v1 stays alive for minimum 6 months after v2 launch
|
|
131
|
+
- Deprecated endpoints return: Deprecation: true, Sunset: <date> headers
|
|
132
|
+
- Never remove a field from a response without a major version bump
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
## Idempotency
|
|
136
|
+
|
|
137
|
+
```python
|
|
138
|
+
# Idempotency key pattern for POST mutations
|
|
139
|
+
@router.post("/orders", status_code=201)
|
|
140
|
+
async def create_order(
|
|
141
|
+
body: CreateOrderRequest,
|
|
142
|
+
idempotency_key: Optional[str] = Header(None, alias="X-Idempotency-Key"),
|
|
143
|
+
db: AsyncSession = Depends(get_db),
|
|
144
|
+
redis: Redis = Depends(get_redis),
|
|
145
|
+
):
|
|
146
|
+
if idempotency_key:
|
|
147
|
+
cached = await redis.get(f"idempotency:{idempotency_key}")
|
|
148
|
+
if cached:
|
|
149
|
+
return JSONResponse(json.loads(cached), status_code=200) # 200 = already done
|
|
150
|
+
|
|
151
|
+
order = await order_service.create(db, body)
|
|
152
|
+
response = OrderResponse.model_validate(order)
|
|
153
|
+
|
|
154
|
+
if idempotency_key:
|
|
155
|
+
await redis.setex(
|
|
156
|
+
f"idempotency:{idempotency_key}",
|
|
157
|
+
86400, # 24h TTL
|
|
158
|
+
response.model_dump_json()
|
|
159
|
+
)
|
|
160
|
+
return response
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
## Security Checklist
|
|
164
|
+
|
|
165
|
+
- [ ] Auth middleware applied before any handler logic — never inside handler
|
|
166
|
+
- [ ] Ownership check: `if order.user_id != current_user.id: raise 403`
|
|
167
|
+
- [ ] Input validation via Pydantic (FastAPI) or Joi/Zod (Node) on every endpoint
|
|
168
|
+
- [ ] Rate limiting on public endpoints (especially auth, password reset)
|
|
169
|
+
- [ ] No sensitive data in URLs (tokens, passwords) — use request body or headers
|
|
170
|
+
- [ ] CORS configured explicitly: no `allow_origins=["*"]` in production
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: async-processing
|
|
3
|
+
type: skill
|
|
4
|
+
description: Design and implement async task queues, message consumers, and background job patterns.
|
|
5
|
+
related-rules:
|
|
6
|
+
- architecture.md
|
|
7
|
+
- data_access.md
|
|
8
|
+
allowed-tools: Read, Write, Edit, Bash
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Async Processing Skill
|
|
12
|
+
|
|
13
|
+
> **Expertise:** Task queues (Celery, ARQ, Dramatiq), Kafka/NATS consumers, background jobs, retry strategies, idempotency, dead-letter queues.
|
|
14
|
+
|
|
15
|
+
## When to Use Async Processing
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
Use async when:
|
|
19
|
+
✅ Operation takes > 200ms (send email, resize image, call slow 3rd party)
|
|
20
|
+
✅ Work can be retried independently (payment webhook, notification)
|
|
21
|
+
✅ Decoupling producers from consumers is required
|
|
22
|
+
✅ Fan-out to multiple consumers needed
|
|
23
|
+
|
|
24
|
+
Keep synchronous:
|
|
25
|
+
❌ Response depends on the result (user sees outcome immediately)
|
|
26
|
+
❌ Must be transactional with the triggering DB write
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Task Queue (Celery + Redis)
|
|
30
|
+
|
|
31
|
+
```python
|
|
32
|
+
# tasks.py
|
|
33
|
+
from celery import Celery
|
|
34
|
+
from celery.utils.log import get_task_logger
|
|
35
|
+
|
|
36
|
+
app = Celery("myapp", broker="redis://localhost:6379/1", backend="redis://localhost:6379/2")
|
|
37
|
+
app.conf.update(
|
|
38
|
+
task_serializer="json",
|
|
39
|
+
result_expires=3600,
|
|
40
|
+
task_acks_late=True, # Ack after completion, not on receive
|
|
41
|
+
task_reject_on_worker_lost=True,
|
|
42
|
+
task_default_retry_delay=60, # 1 min base delay
|
|
43
|
+
task_max_retries=5,
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
logger = get_task_logger(__name__)
|
|
47
|
+
|
|
48
|
+
@app.task(bind=True, max_retries=5, default_retry_delay=30)
|
|
49
|
+
def send_order_confirmation(self, order_id: int) -> None:
|
|
50
|
+
try:
|
|
51
|
+
order = Order.objects.get(id=order_id)
|
|
52
|
+
email_service.send_confirmation(order)
|
|
53
|
+
logger.info("email.sent", extra={"order_id": order_id})
|
|
54
|
+
except EmailServiceError as exc:
|
|
55
|
+
# Exponential backoff: 30s, 60s, 120s, 240s, 480s
|
|
56
|
+
delay = 30 * (2 ** self.request.retries)
|
|
57
|
+
raise self.retry(exc=exc, countdown=delay)
|
|
58
|
+
except Order.DoesNotExist:
|
|
59
|
+
logger.error("order.not_found", extra={"order_id": order_id})
|
|
60
|
+
# Don't retry — data issue, not transient
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Message Consumer (Kafka / aiokafka)
|
|
64
|
+
|
|
65
|
+
```python
|
|
66
|
+
from aiokafka import AIOKafkaConsumer
|
|
67
|
+
import asyncio, json
|
|
68
|
+
|
|
69
|
+
async def consume_order_events():
|
|
70
|
+
consumer = AIOKafkaConsumer(
|
|
71
|
+
"orders.events",
|
|
72
|
+
bootstrap_servers="kafka:9092",
|
|
73
|
+
group_id="notification-service",
|
|
74
|
+
auto_offset_reset="earliest",
|
|
75
|
+
enable_auto_commit=False, # Manual commit — control exactly-once
|
|
76
|
+
value_deserializer=lambda v: json.loads(v.decode()),
|
|
77
|
+
)
|
|
78
|
+
await consumer.start()
|
|
79
|
+
try:
|
|
80
|
+
async for msg in consumer:
|
|
81
|
+
event = msg.value
|
|
82
|
+
try:
|
|
83
|
+
await handle_event(event)
|
|
84
|
+
await consumer.commit() # Only commit on success
|
|
85
|
+
except TransientError as e:
|
|
86
|
+
logger.warning("event.retry", event_type=event["type"], error=str(e))
|
|
87
|
+
await asyncio.sleep(5) # Back off, do NOT commit
|
|
88
|
+
except PermanentError as e:
|
|
89
|
+
logger.error("event.dead_letter", event=event, error=str(e))
|
|
90
|
+
await dead_letter_queue.publish(event)
|
|
91
|
+
await consumer.commit() # Commit to move past poison message
|
|
92
|
+
finally:
|
|
93
|
+
await consumer.stop()
|
|
94
|
+
|
|
95
|
+
# Idempotency — always check before processing
|
|
96
|
+
async def handle_event(event: dict) -> None:
|
|
97
|
+
event_id = event["event_id"]
|
|
98
|
+
if await redis.exists(f"processed:{event_id}"):
|
|
99
|
+
return # Already handled — skip
|
|
100
|
+
|
|
101
|
+
await process(event)
|
|
102
|
+
await redis.setex(f"processed:{event_id}", 86400, "1")
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## Background Jobs (ARQ — lightweight async)
|
|
106
|
+
|
|
107
|
+
```python
|
|
108
|
+
# worker.py
|
|
109
|
+
from arq import cron
|
|
110
|
+
from arq.connections import RedisSettings
|
|
111
|
+
|
|
112
|
+
async def cleanup_expired_sessions(ctx):
|
|
113
|
+
deleted = await db.sessions.delete_expired()
|
|
114
|
+
ctx["log"].info(f"Cleaned up {deleted} expired sessions")
|
|
115
|
+
|
|
116
|
+
async def startup(ctx):
|
|
117
|
+
ctx["db"] = await create_db_pool()
|
|
118
|
+
ctx["log"] = structlog.get_logger()
|
|
119
|
+
|
|
120
|
+
class WorkerSettings:
|
|
121
|
+
functions = [cleanup_expired_sessions]
|
|
122
|
+
cron_jobs = [cron(cleanup_expired_sessions, hour=3, minute=0)] # 3 AM daily
|
|
123
|
+
redis_settings = RedisSettings(host="redis")
|
|
124
|
+
on_startup = startup
|
|
125
|
+
max_jobs = 10
|
|
126
|
+
job_timeout = 300 # 5 min max per job
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
## Retry Strategy Reference
|
|
130
|
+
|
|
131
|
+
| Error type | Strategy |
|
|
132
|
+
|---|---|
|
|
133
|
+
| Transient (network timeout, DB lock) | Exponential backoff, up to 5 retries |
|
|
134
|
+
| Rate limit (429) | Respect Retry-After header |
|
|
135
|
+
| Data validation (bad payload) | Dead-letter immediately — no retry |
|
|
136
|
+
| Downstream service down | Circuit breaker + retry queue |
|
|
137
|
+
| DB connection pool full | Short delay (5s) + 3 retries |
|
|
138
|
+
|
|
139
|
+
## Dead-Letter Queue Pattern
|
|
140
|
+
|
|
141
|
+
```python
|
|
142
|
+
async def send_to_dlq(original_message: dict, error: Exception, queue_name: str):
|
|
143
|
+
dlq_message = {
|
|
144
|
+
"original": original_message,
|
|
145
|
+
"error": str(error),
|
|
146
|
+
"error_type": type(error).__name__,
|
|
147
|
+
"failed_at": datetime.utcnow().isoformat(),
|
|
148
|
+
"source_queue": queue_name,
|
|
149
|
+
}
|
|
150
|
+
await redis.lpush("dlq", json.dumps(dlq_message))
|
|
151
|
+
metrics.increment("tasks.dead_lettered", tags={"queue": queue_name})
|
|
152
|
+
```
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: database-modeling
|
|
3
|
+
type: skill
|
|
4
|
+
description: Design relational schemas, write efficient queries, plan indexes, and implement safe migrations.
|
|
5
|
+
related-rules:
|
|
6
|
+
- data_access.md
|
|
7
|
+
- architecture.md
|
|
8
|
+
allowed-tools: Read, Write, Edit, Bash
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Database Modeling Skill
|
|
12
|
+
|
|
13
|
+
> **Expertise:** PostgreSQL schema design, SQLAlchemy (async), query optimization, indexing, migrations (Alembic), safe schema changes.
|
|
14
|
+
|
|
15
|
+
## Schema Design Patterns
|
|
16
|
+
|
|
17
|
+
### Standard column set (all tables)
|
|
18
|
+
```python
|
|
19
|
+
from sqlalchemy import Column, Integer, DateTime, func
|
|
20
|
+
from sqlalchemy.orm import DeclarativeBase
|
|
21
|
+
|
|
22
|
+
class Base(DeclarativeBase):
|
|
23
|
+
pass
|
|
24
|
+
|
|
25
|
+
class TimestampMixin:
|
|
26
|
+
created_at: Mapped[datetime] = mapped_column(
|
|
27
|
+
DateTime(timezone=True), server_default=func.now(), nullable=False
|
|
28
|
+
)
|
|
29
|
+
updated_at: Mapped[datetime] = mapped_column(
|
|
30
|
+
DateTime(timezone=True), server_default=func.now(),
|
|
31
|
+
onupdate=func.now(), nullable=False
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
class Order(TimestampMixin, Base):
|
|
35
|
+
__tablename__ = "orders"
|
|
36
|
+
|
|
37
|
+
id: Mapped[int] = mapped_column(primary_key=True)
|
|
38
|
+
user_id: Mapped[int] = mapped_column(ForeignKey("users.id"), nullable=False, index=True)
|
|
39
|
+
status: Mapped[str] = mapped_column(String(20), nullable=False, default="pending")
|
|
40
|
+
total_amount: Mapped[Decimal] = mapped_column(Numeric(12, 2), nullable=False)
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Soft delete pattern
|
|
44
|
+
```python
|
|
45
|
+
class SoftDeleteMixin:
|
|
46
|
+
deleted_at: Mapped[Optional[datetime]] = mapped_column(DateTime(timezone=True), nullable=True)
|
|
47
|
+
|
|
48
|
+
@property
|
|
49
|
+
def is_deleted(self) -> bool:
|
|
50
|
+
return self.deleted_at is not None
|
|
51
|
+
|
|
52
|
+
# Always filter in repository, never expose deleted records by default
|
|
53
|
+
class OrderRepository:
|
|
54
|
+
async def list_active(self, session: AsyncSession):
|
|
55
|
+
return await session.execute(
|
|
56
|
+
select(Order).where(Order.deleted_at.is_(None))
|
|
57
|
+
)
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Indexing Strategy
|
|
61
|
+
|
|
62
|
+
```sql
|
|
63
|
+
-- Single column: high-cardinality columns used in WHERE/JOIN/ORDER BY
|
|
64
|
+
CREATE INDEX idx_orders_user_id ON orders(user_id);
|
|
65
|
+
CREATE INDEX idx_orders_status ON orders(status) WHERE deleted_at IS NULL; -- partial index
|
|
66
|
+
|
|
67
|
+
-- Composite: query uses both columns together (order matters: equality first, then range)
|
|
68
|
+
CREATE INDEX idx_orders_user_created ON orders(user_id, created_at DESC);
|
|
69
|
+
|
|
70
|
+
-- Full-text search
|
|
71
|
+
CREATE INDEX idx_products_search ON products USING gin(to_tsvector('english', name || ' ' || description));
|
|
72
|
+
|
|
73
|
+
-- Never index: low-cardinality boolean columns, small tables (<1000 rows)
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### EXPLAIN ANALYZE checklist
|
|
77
|
+
```sql
|
|
78
|
+
-- Run before every new query on a table with >10k rows
|
|
79
|
+
EXPLAIN (ANALYZE, BUFFERS, FORMAT TEXT)
|
|
80
|
+
SELECT * FROM orders WHERE user_id = 123 ORDER BY created_at DESC LIMIT 20;
|
|
81
|
+
|
|
82
|
+
-- Watch for: Seq Scan on large table → add index
|
|
83
|
+
-- Index Scan with high actual rows >> estimated rows → ANALYZE the table
|
|
84
|
+
-- Nested Loop with large inner side → consider Hash Join
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Repository Pattern
|
|
88
|
+
|
|
89
|
+
```python
|
|
90
|
+
from sqlalchemy.ext.asyncio import AsyncSession
|
|
91
|
+
from sqlalchemy import select, update
|
|
92
|
+
|
|
93
|
+
class OrderRepository:
|
|
94
|
+
def __init__(self, session: AsyncSession):
|
|
95
|
+
self.session = session
|
|
96
|
+
|
|
97
|
+
async def get_by_id(self, order_id: int) -> Optional[Order]:
|
|
98
|
+
result = await self.session.execute(
|
|
99
|
+
select(Order).where(Order.id == order_id, Order.deleted_at.is_(None))
|
|
100
|
+
)
|
|
101
|
+
return result.scalar_one_or_none()
|
|
102
|
+
|
|
103
|
+
async def list_by_user(
|
|
104
|
+
self, user_id: int, *, limit: int = 20, cursor_id: Optional[int] = None
|
|
105
|
+
) -> list[Order]:
|
|
106
|
+
q = select(Order).where(Order.user_id == user_id, Order.deleted_at.is_(None))
|
|
107
|
+
if cursor_id:
|
|
108
|
+
q = q.where(Order.id < cursor_id) # cursor-based pagination
|
|
109
|
+
q = q.order_by(Order.id.desc()).limit(limit)
|
|
110
|
+
result = await self.session.execute(q)
|
|
111
|
+
return list(result.scalars())
|
|
112
|
+
|
|
113
|
+
async def update_status(self, order_id: int, status: str) -> None:
|
|
114
|
+
await self.session.execute(
|
|
115
|
+
update(Order).where(Order.id == order_id).values(status=status)
|
|
116
|
+
)
|
|
117
|
+
# No commit here — caller (service layer) owns the transaction
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## Migration Safety (Alembic)
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
# Generate migration
|
|
124
|
+
alembic revision --autogenerate -m "add_index_orders_user_id"
|
|
125
|
+
|
|
126
|
+
# ALWAYS review generated file before applying
|
|
127
|
+
alembic show head
|
|
128
|
+
|
|
129
|
+
# Apply
|
|
130
|
+
alembic upgrade head
|
|
131
|
+
|
|
132
|
+
# Rollback one step
|
|
133
|
+
alembic downgrade -1
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### Safe vs. unsafe schema operations
|
|
137
|
+
|
|
138
|
+
| Operation | Safe to deploy | Strategy |
|
|
139
|
+
|---|---|---|
|
|
140
|
+
| Add nullable column | ✅ Non-breaking | Apply directly |
|
|
141
|
+
| Add column with default | ✅ (PostgreSQL 11+) | Apply directly |
|
|
142
|
+
| Add NOT NULL column | ⚠️ Breaking | Add nullable → backfill → add constraint |
|
|
143
|
+
| Add index | ✅ with CONCURRENTLY | `CREATE INDEX CONCURRENTLY` |
|
|
144
|
+
| Rename column | ❌ Breaking | Expand/contract (add new → migrate code → drop old) |
|
|
145
|
+
| Drop column | ❌ Breaking | Deprecate in code → drop in next release |
|
|
146
|
+
| Change type | ❌ Breaking | Add new column with new type → migrate → drop old |
|
|
147
|
+
|
|
148
|
+
```python
|
|
149
|
+
# Alembic: create index without locking table
|
|
150
|
+
def upgrade():
|
|
151
|
+
op.execute("CREATE INDEX CONCURRENTLY IF NOT EXISTS idx_orders_user_id ON orders(user_id)")
|
|
152
|
+
|
|
153
|
+
def downgrade():
|
|
154
|
+
op.execute("DROP INDEX CONCURRENTLY IF EXISTS idx_orders_user_id")
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
## N+1 Query Prevention
|
|
158
|
+
|
|
159
|
+
```python
|
|
160
|
+
# ❌ N+1: loads orders, then 1 query per order to get user
|
|
161
|
+
orders = await session.execute(select(Order)).scalars()
|
|
162
|
+
for order in orders:
|
|
163
|
+
print(order.user.name) # each access fires a query
|
|
164
|
+
|
|
165
|
+
# ✅ Eager load with joinedload
|
|
166
|
+
from sqlalchemy.orm import joinedload
|
|
167
|
+
|
|
168
|
+
orders = await session.execute(
|
|
169
|
+
select(Order)
|
|
170
|
+
.options(joinedload(Order.user)) # single JOIN
|
|
171
|
+
.where(Order.status == "pending")
|
|
172
|
+
)
|
|
173
|
+
```
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: observability
|
|
3
|
+
type: skill
|
|
4
|
+
description: Implement structured logging, distributed tracing, and metrics for production-ready backend services.
|
|
5
|
+
related-rules:
|
|
6
|
+
- architecture.md
|
|
7
|
+
allowed-tools: Read, Write, Edit, Bash
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Observability Skill
|
|
11
|
+
|
|
12
|
+
> **Expertise:** Structured JSON logging, OpenTelemetry distributed tracing, Prometheus/RED metrics, alert design.
|
|
13
|
+
|
|
14
|
+
## Structured Logging
|
|
15
|
+
|
|
16
|
+
```python
|
|
17
|
+
import structlog
|
|
18
|
+
import logging
|
|
19
|
+
|
|
20
|
+
# Configure once at app startup
|
|
21
|
+
structlog.configure(
|
|
22
|
+
processors=[
|
|
23
|
+
structlog.contextvars.merge_contextvars,
|
|
24
|
+
structlog.processors.add_log_level,
|
|
25
|
+
structlog.processors.TimeStamper(fmt="iso"),
|
|
26
|
+
structlog.processors.JSONRenderer(), # machine-parseable
|
|
27
|
+
],
|
|
28
|
+
logger_factory=structlog.PrintLoggerFactory(),
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
log = structlog.get_logger()
|
|
32
|
+
|
|
33
|
+
# Bind context per request (FastAPI middleware)
|
|
34
|
+
@app.middleware("http")
|
|
35
|
+
async def logging_middleware(request: Request, call_next):
|
|
36
|
+
request_id = request.headers.get("X-Request-ID") or str(uuid4())
|
|
37
|
+
structlog.contextvars.bind_contextvars(
|
|
38
|
+
request_id=request_id,
|
|
39
|
+
method=request.method,
|
|
40
|
+
path=request.url.path,
|
|
41
|
+
)
|
|
42
|
+
response = await call_next(request)
|
|
43
|
+
structlog.contextvars.unbind_contextvars("request_id", "method", "path")
|
|
44
|
+
return response
|
|
45
|
+
|
|
46
|
+
# Usage in service/repository layer
|
|
47
|
+
log.info("order.created", order_id=order.id, user_id=user.id, amount=str(order.total))
|
|
48
|
+
log.warning("payment.retry", order_id=order_id, attempt=attempt, reason=str(error))
|
|
49
|
+
log.error("db.query_failed", table="orders", query_type="insert", exc_info=True)
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### What NOT to log
|
|
53
|
+
```python
|
|
54
|
+
# ❌ Never log PII or secrets
|
|
55
|
+
log.info("user.login", email=user.email) # PII — omit or hash
|
|
56
|
+
log.debug("auth.token", token=access_token) # secret — never
|
|
57
|
+
|
|
58
|
+
# ✅ Log identifiers, not values
|
|
59
|
+
log.info("user.login", user_id=user.id)
|
|
60
|
+
log.info("auth.issued", token_jti=token_payload["jti"])
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Distributed Tracing (OpenTelemetry)
|
|
64
|
+
|
|
65
|
+
```python
|
|
66
|
+
from opentelemetry import trace
|
|
67
|
+
from opentelemetry.sdk.trace import TracerProvider
|
|
68
|
+
from opentelemetry.exporter.otlp.proto.grpc.trace_exporter import OTLPSpanExporter
|
|
69
|
+
from opentelemetry.sdk.trace.export import BatchSpanProcessor
|
|
70
|
+
|
|
71
|
+
# Setup (once at startup)
|
|
72
|
+
provider = TracerProvider()
|
|
73
|
+
provider.add_span_processor(BatchSpanProcessor(OTLPSpanExporter()))
|
|
74
|
+
trace.set_tracer_provider(provider)
|
|
75
|
+
|
|
76
|
+
tracer = trace.get_tracer("order-service")
|
|
77
|
+
|
|
78
|
+
# Instrument a service method
|
|
79
|
+
async def create_order(self, user_id: int, items: list) -> Order:
|
|
80
|
+
with tracer.start_as_current_span("order.create") as span:
|
|
81
|
+
span.set_attribute("user.id", user_id)
|
|
82
|
+
span.set_attribute("items.count", len(items))
|
|
83
|
+
|
|
84
|
+
try:
|
|
85
|
+
order = await self.repo.create(user_id, items)
|
|
86
|
+
span.set_attribute("order.id", order.id)
|
|
87
|
+
return order
|
|
88
|
+
except Exception as e:
|
|
89
|
+
span.record_exception(e)
|
|
90
|
+
span.set_status(trace.StatusCode.ERROR)
|
|
91
|
+
raise
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Metrics (Prometheus / RED)
|
|
95
|
+
|
|
96
|
+
RED method: **R**ate · **E**rror rate · **D**uration for every service boundary.
|
|
97
|
+
|
|
98
|
+
```python
|
|
99
|
+
from prometheus_client import Counter, Histogram, start_http_server
|
|
100
|
+
|
|
101
|
+
# Define metrics at module level (not inside functions)
|
|
102
|
+
REQUEST_COUNT = Counter(
|
|
103
|
+
"http_requests_total",
|
|
104
|
+
"Total HTTP requests",
|
|
105
|
+
["method", "endpoint", "status_code"]
|
|
106
|
+
)
|
|
107
|
+
|
|
108
|
+
REQUEST_DURATION = Histogram(
|
|
109
|
+
"http_request_duration_seconds",
|
|
110
|
+
"HTTP request duration",
|
|
111
|
+
["method", "endpoint"],
|
|
112
|
+
buckets=[0.01, 0.05, 0.1, 0.25, 0.5, 1.0, 2.5, 5.0]
|
|
113
|
+
)
|
|
114
|
+
|
|
115
|
+
DB_QUERY_DURATION = Histogram(
|
|
116
|
+
"db_query_duration_seconds",
|
|
117
|
+
"DB query duration",
|
|
118
|
+
["operation", "table"],
|
|
119
|
+
buckets=[0.001, 0.005, 0.01, 0.05, 0.1, 0.5]
|
|
120
|
+
)
|
|
121
|
+
|
|
122
|
+
# FastAPI middleware
|
|
123
|
+
@app.middleware("http")
|
|
124
|
+
async def metrics_middleware(request: Request, call_next):
|
|
125
|
+
start = time.monotonic()
|
|
126
|
+
response = await call_next(request)
|
|
127
|
+
duration = time.monotonic() - start
|
|
128
|
+
|
|
129
|
+
endpoint = request.url.path
|
|
130
|
+
REQUEST_COUNT.labels(request.method, endpoint, response.status_code).inc()
|
|
131
|
+
REQUEST_DURATION.labels(request.method, endpoint).observe(duration)
|
|
132
|
+
return response
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
## Health Check Endpoint
|
|
136
|
+
|
|
137
|
+
```python
|
|
138
|
+
@router.get("/health", include_in_schema=False)
|
|
139
|
+
async def health(db: AsyncSession = Depends(get_db)):
|
|
140
|
+
checks = {}
|
|
141
|
+
try:
|
|
142
|
+
await db.execute(text("SELECT 1"))
|
|
143
|
+
checks["database"] = "ok"
|
|
144
|
+
except Exception as e:
|
|
145
|
+
checks["database"] = f"error: {e}"
|
|
146
|
+
|
|
147
|
+
is_healthy = all(v == "ok" for v in checks.values())
|
|
148
|
+
return JSONResponse(
|
|
149
|
+
{"status": "ok" if is_healthy else "degraded", "checks": checks},
|
|
150
|
+
status_code=200 if is_healthy else 503
|
|
151
|
+
)
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
## Alerting Rules (Reference)
|
|
155
|
+
|
|
156
|
+
| Signal | Threshold | Severity |
|
|
157
|
+
|---|---|---|
|
|
158
|
+
| Error rate | > 1% over 5 min | P1 |
|
|
159
|
+
| p99 latency | > 2s over 5 min | P1 |
|
|
160
|
+
| p95 latency | > 500ms over 15 min | P2 |
|
|
161
|
+
| DB connection pool saturation | > 80% for 5 min | P2 |
|
|
162
|
+
| Health check failures | 2 consecutive | P1 |
|