@vesviet/agent-skills 5.8.0 → 5.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/INDEX.md +35 -22
- package/README.md +7 -18
- package/VERSION +1 -1
- package/adapters/antigravity/ANTIGRAVITY.md +40 -142
- package/adapters/antigravity/INDEX_TIER1.json +174 -146
- package/adapters/antigravity/a2a-config.template.yaml +1 -1
- package/adapters/antigravity/antigravity-tools.md +25 -0
- package/adapters/antigravity/role-skill-index.json +175 -58
- package/adapters/claude/CLAUDE_ADAPTER.md +3 -7
- package/adapters/claude/settings.template.json +18 -3
- package/adapters/cursor/README.md +1 -5
- package/adapters/cursor/hooks.template.json +4 -2
- package/core/contracts/README.md +0 -20
- package/core/contracts/schemas/compact-working-state.json +42 -1
- package/core/contracts/schemas/ui-component-spec.json +28 -2
- package/core/policies/README.md +0 -20
- package/core/policies/action-boundaries.yaml +10 -1
- package/core/policies/execution-sandbox.md +0 -12
- package/core/policies/mcp-tool-map.yaml +28 -0
- package/core/roles/3d-graphics-engineer.md +144 -208
- package/core/roles/README.md +1 -23
- package/core/roles/agent-coordinator.md +28 -147
- package/core/roles/agent-discovery-engineer.md +46 -39
- package/core/roles/ai-systems-engineer.md +2 -0
- package/core/roles/backend-developer.md +22 -117
- package/core/roles/cloudflare-engineer.md +1 -1
- package/core/roles/data-engineer.md +3 -1
- package/core/roles/devops-engineer.md +4 -3
- package/core/roles/ecommerce-engineer.md +18 -6
- package/core/roles/frontend-developer.md +146 -317
- package/core/roles/game-developer.md +2 -1
- package/core/roles/mobile-engineer.md +18 -204
- package/core/roles/product-manager.md +3 -3
- package/core/roles/project-manager.md +5 -5
- package/core/roles/references/3d-graphics-engineer-review-checklist.md +109 -109
- package/core/roles/references/agent-coordinator-responsibilities.md +120 -0
- package/core/roles/references/agent-coordinator-review-checklist.md +22 -4
- package/core/roles/references/agent-discovery-engineer-review-checklist.md +29 -20
- package/core/roles/references/backend-developer-responsibilities.md +47 -0
- package/core/roles/references/backend-developer-review-checklist.md +15 -0
- package/core/roles/references/business-analyst-responsibilities.md +2 -2
- package/core/roles/references/frontend-developer-responsibilities.md +14 -6
- package/core/roles/references/frontend-developer-review-checklist.md +13 -6
- package/core/roles/references/mobile-engineer-responsibilities.md +137 -0
- package/core/roles/references/mobile-engineer-review-checklist.md +63 -0
- package/core/roles/references/reviewer-review-checklist.md +54 -0
- package/core/roles/references/sdet-review-checklist.md +53 -0
- package/core/roles/references/solution-architect-responsibilities.md +134 -0
- package/core/roles/references/sre-review-checklist.md +81 -0
- package/core/roles/references/system-engineer-responsibilities.md +124 -0
- package/core/roles/references/technical-architect-responsibilities.md +192 -0
- package/core/roles/references/technical-architect-review-checklist.md +58 -0
- package/core/roles/references/technical-lead-review-checklist.md +65 -0
- package/core/roles/references/ui-ux-designer-anti-slop-standards.md +61 -35
- package/core/roles/references/ui-ux-designer-responsibilities.md +79 -226
- package/core/roles/references/ui-ux-designer-review-checklist.md +102 -116
- package/core/roles/references/vietnam-accounting-specialist-review-checklist.md +6 -6
- package/core/roles/researcher.md +3 -3
- package/core/roles/reviewer.md +2 -2
- package/core/roles/role-standard.md +79 -205
- package/core/roles/sdet.md +5 -6
- package/core/roles/security-engineer.md +4 -3
- package/core/roles/solution-architect.md +9 -130
- package/core/roles/sre.md +1 -0
- package/core/roles/system-engineer.md +15 -155
- package/core/roles/task-planner.md +1 -1
- package/core/roles/technical-architect.md +15 -244
- package/core/roles/technical-lead.md +1 -0
- package/core/roles/technical-writer.md +3 -3
- package/core/roles/ui-ux-designer.md +158 -303
- package/core/roles/vietnam-accounting-specialist.md +20 -20
- package/core/rules/README.md +0 -22
- package/core/rules/code.md +11 -6
- package/core/skills/README.md +12 -25
- package/core/skills/agent/agent-delegation/SKILL.md +11 -0
- package/core/skills/agent/agent-graph-orchestration/SKILL.md +5 -0
- package/core/skills/agent/agent-memory-compaction/SKILL.md +79 -82
- package/core/skills/agent/agent-memory-compaction/references/anchored-schema-and-compaction-algorithms.md +74 -115
- package/core/skills/agent/agent-model-routing/SKILL.md +2 -0
- package/core/skills/agent/agent-observability/SKILL.md +12 -6
- package/core/skills/agent/agent-observability/references/session-forensics-7-dimensions.md +41 -0
- package/core/skills/agent/agent-panel-meeting/SKILL.md +3 -3
- package/core/skills/agent/agent-quality-gate/SKILL.md +9 -0
- package/core/skills/agent/configure-agent-commerce/SKILL.md +2 -0
- package/core/skills/agent/configure-agent-commerce/examples/ucp-commerce-manifest-and-endpoints.json +55 -0
- package/core/skills/agent/configure-agent-commerce/references/acp-ucp-agent-commerce-manifest-specs.md +66 -0
- package/core/skills/agent/configure-agent-headers/SKILL.md +3 -0
- package/core/skills/agent/configure-agent-skills/SKILL.md +4 -4
- package/core/skills/agent/configure-oauth-metadata/SKILL.md +10 -7
- package/core/skills/agent/manage-agent-identity/SKILL.md +2 -0
- package/core/skills/agent/manage-agent-identity/examples/agent-identity-spire-workload.yaml +72 -0
- package/core/skills/agent/manage-agent-identity/references/nhi-lifecycle-and-token-rotation.md +45 -0
- package/core/skills/ai/deploy-vllm-inference/SKILL.md +2 -0
- package/core/skills/ai/deploy-vllm-inference/examples/vllm-production-serve-config.yaml +22 -0
- package/core/skills/ai/deploy-vllm-inference/references/vllm-v1-paged-attention-and-kv-tiering.md +20 -0
- package/core/skills/ai/openrouter-task/SKILL.md +5 -5
- package/core/skills/ai-agent/context-optimization/SKILL.md +2 -0
- package/core/skills/ai-agent/context-optimization/examples/context-pruner-and-reorderer.py +85 -0
- package/core/skills/ai-agent/context-optimization/references/token-budgeting-and-attention-allocation.md +47 -0
- package/core/skills/ai-agent/memory-hygiene/SKILL.md +13 -0
- package/core/skills/ai-agent/memory-hygiene/examples/memory-audit-and-compaction-routine.py +90 -0
- package/core/skills/ai-agent/memory-hygiene/references/agent-memory-vault-spec.md +137 -0
- package/core/skills/ai-agent/memory-hygiene/references/owasp-asi06-and-memory-poisoning-defense.md +38 -0
- package/core/skills/backend/add-api-endpoint/SKILL.md +9 -0
- package/core/skills/backend/add-api-endpoint/examples/express-zod-rfc9457-endpoint.md +329 -0
- package/core/skills/backend/add-api-endpoint/examples/kratos-go-clean-architecture-endpoint.md +405 -0
- package/core/skills/backend/add-api-endpoint/references/idempotency-and-rate-limiting.md +116 -0
- package/core/skills/backend/add-event-handler/SKILL.md +12 -1
- package/core/skills/backend/add-event-handler/examples/go-outbox-skip-locked-relay.go +97 -0
- package/core/skills/backend/add-event-handler/references/transactional-outbox-and-cloudevents.md +42 -0
- package/core/skills/backend/add-service-client/SKILL.md +2 -0
- package/core/skills/backend/add-service-client/examples/ts-circuit-breaker-full-jitter-client.ts +71 -0
- package/core/skills/backend/add-service-client/references/resilient-client-circuit-breaker-specs.md +25 -0
- package/core/skills/backend/build-mcp-server/SKILL.md +2 -0
- package/core/skills/backend/build-mcp-server/examples/ts-stateless-mcp-server-zod.ts +52 -0
- package/core/skills/backend/build-mcp-server/references/mcp-2026-stateless-contract-specs.md +21 -0
- package/core/skills/backend/design-caching-and-locking/SKILL.md +83 -0
- package/core/skills/backend/design-caching-and-locking/examples/redis-lua-atomic-reservation-fencing.lua +30 -0
- package/core/skills/backend/design-caching-and-locking/references/redis-lua-fencing-and-stampede-specs.md +25 -0
- package/core/skills/backend/design-caching-and-locking/scripts/verify_lua_atomicity.py +68 -0
- package/core/skills/backend/implement-auth/SKILL.md +9 -0
- package/core/skills/backend/implement-structured-outputs/SKILL.md +2 -0
- package/core/skills/backend/implement-structured-outputs/examples/python-pydantic-structured-output.py +65 -0
- package/core/skills/backend/implement-structured-outputs/references/constrained-decoding-and-double-validation.md +18 -0
- package/core/skills/backend/optimize-postgres/SKILL.md +9 -0
- package/core/skills/backend/scaffold-new-service/SKILL.md +2 -1
- package/core/skills/backend/scaffold-new-service/references/deep-modules-and-seams.md +43 -0
- package/core/skills/business/elicit-requirements/SKILL.md +2 -0
- package/core/skills/business/trace-requirements-impact/SKILL.md +1 -0
- package/core/skills/business/write-use-cases/SKILL.md +1 -0
- package/core/skills/commerce/handle-checkout-flow/SKILL.md +18 -66
- package/core/skills/commerce/handle-checkout-flow/examples/production-checkout-orchestrator.ts +185 -0
- package/core/skills/commerce/handle-checkout-flow/references/pci-dss-v4-and-agentic-checkout-specs.md +72 -0
- package/core/skills/commerce/integrate-payment-gateway/SKILL.md +22 -58
- package/core/skills/commerce/integrate-payment-gateway/examples/resilient-webhook-and-mpp-handler.ts +164 -0
- package/core/skills/commerce/integrate-payment-gateway/references/mpp-x402-and-webhook-security-specs.md +47 -0
- package/core/skills/commerce/manage-order-fulfillment/SKILL.md +17 -50
- package/core/skills/commerce/manage-order-fulfillment/examples/temporal-fulfillment-saga.ts +104 -0
- package/core/skills/commerce/manage-order-fulfillment/references/event-sourced-fulfillment-and-carrier-webhooks.md +58 -0
- package/core/skills/commerce/manage-product-catalog/SKILL.md +5 -1
- package/core/skills/commerce/manage-product-catalog/examples/hybrid-search-and-governance-pipeline.ts +120 -0
- package/core/skills/commerce/manage-product-catalog/references/semantic-vector-catalog-and-graphrag.md +54 -0
- package/core/skills/content/write-article/SKILL.md +1 -1
- package/core/skills/document/docx/SKILL.md +1 -0
- package/core/skills/document/pdf/SKILL.md +2 -0
- package/core/skills/document/pdf/references/pdf-acroforms-and-pdfplumber-specs.md +54 -0
- package/core/skills/document/pdf/scripts/check_fillable_fields.py +144 -0
- package/core/skills/document/pdf/scripts/fill_fillable_fields.py +145 -0
- package/core/skills/document/xlsx/SKILL.md +1 -0
- package/core/skills/documentation/configure-llms-txt/SKILL.md +3 -0
- package/core/skills/documentation/configure-llms-txt/examples/canonical-llms-txt-and-full-txt.md +45 -0
- package/core/skills/documentation/configure-llms-txt/references/llms-txt-and-llms-full-txt-standard.md +37 -0
- package/core/skills/documentation/write-documentation/SKILL.md +4 -1
- package/core/skills/documentation/write-documentation/examples/microservice-production-readme-and-api-docs.md +70 -0
- package/core/skills/documentation/write-documentation/references/diataxis-framework-and-doc-standards.md +62 -0
- package/core/skills/documentation/write-tech-radar/SKILL.md +1 -0
- package/core/skills/education/create-exercises/SKILL.md +1 -0
- package/core/skills/education/design-learning-plan/SKILL.md +1 -0
- package/core/skills/education/grade-and-review/SKILL.md +1 -0
- package/core/skills/foundation/accessibility-review/SKILL.md +1 -0
- package/core/skills/foundation/ai-risk-assessment/SKILL.md +4 -5
- package/core/skills/foundation/ai-risk-assessment/examples/genai-system-risk-register.md +67 -0
- package/core/skills/foundation/ai-risk-assessment/references/nist-ai-rmf-and-eu-ai-act-taxonomy.md +49 -0
- package/core/skills/foundation/combinatorial-testing/SKILL.md +1 -0
- package/core/skills/foundation/conduct-research/SKILL.md +2 -2
- package/core/skills/foundation/conduct-research/references/ai-era-source-discipline.md +1 -1
- package/core/skills/foundation/create-migration/SKILL.md +10 -0
- package/core/skills/foundation/design-review/SKILL.md +9 -10
- package/core/skills/foundation/design-ux-flow/SKILL.md +9 -7
- package/core/skills/foundation/discernment-nudge/SKILL.md +2 -0
- package/core/skills/foundation/hostile-component-stress-testing/SKILL.md +1 -0
- package/core/skills/foundation/incident-report/SKILL.md +1 -0
- package/core/skills/foundation/plan-technical-delivery/SKILL.md +3 -1
- package/core/skills/foundation/playwright-evidence-qa/SKILL.md +1 -0
- package/core/skills/foundation/refactor-legacy-code/SKILL.md +84 -0
- package/core/skills/foundation/refactor-legacy-code/examples/characterization-test-seam-extraction.py +34 -0
- package/core/skills/foundation/refactor-legacy-code/references/strangler-fig-seams-and-characterization-tests.md +17 -0
- package/core/skills/foundation/refactor-legacy-code/scripts/check_refactor_blast_radius.py +63 -0
- package/core/skills/foundation/release-notes/SKILL.md +3 -3
- package/core/skills/foundation/release-notes/examples/enterprise-platform-release-notes.md +42 -0
- package/core/skills/foundation/release-notes/references/keep-a-changelog-and-semver-governance.md +43 -0
- package/core/skills/foundation/systematic-debugging/SKILL.md +15 -0
- package/core/skills/foundation/webapp-server-runner/SKILL.md +1 -0
- package/core/skills/foundation/write-product-brief/SKILL.md +1 -0
- package/core/skills/foundation/write-tests/SKILL.md +9 -0
- package/core/skills/foundation/write-tests/examples/anti-tautological-tdd-walkthrough.md +204 -0
- package/core/skills/foundation/write-tests/examples/testcontainers-kratos-integration-test.md +186 -0
- package/core/skills/foundation/write-tests/references/contract-and-chaos-testing.md +187 -0
- package/core/skills/frontend/INDEX.json +16 -0
- package/core/skills/frontend/add-page-route/SKILL.md +10 -8
- package/core/skills/frontend/add-page-route/examples/streaming-rsc-page-with-view-transition.tsx +133 -0
- package/core/skills/frontend/add-page-route/references/rsc-routing-and-view-transitions.md +72 -0
- package/core/skills/frontend/add-ui-component/SKILL.md +4 -1
- package/core/skills/frontend/add-ui-component/examples/compound-dialog-and-form-actions.tsx +193 -0
- package/core/skills/frontend/add-ui-component/references/react19-component-standards-and-anti-slop.md +55 -0
- package/core/skills/frontend/component-composition/SKILL.md +12 -1
- package/core/skills/frontend/component-composition/examples/headless-combobox-compound-component.tsx +207 -0
- package/core/skills/frontend/design-md-specification/SKILL.md +5 -0
- package/core/skills/frontend/design-system-engineering/SKILL.md +4 -2
- package/core/skills/frontend/frontend-micro-polish/SKILL.md +1 -0
- package/core/skills/frontend/frontend-testing/SKILL.md +4 -1
- package/core/skills/frontend/frontend-testing/examples/playwright-e2e-with-msw-and-axe.spec.ts +87 -0
- package/core/skills/frontend/frontend-testing/references/playwright-msw-and-a11y-testing-standards.md +78 -0
- package/core/skills/frontend/implement-ai-disclosure/SKILL.md +119 -0
- package/core/skills/frontend/implement-view-transitions/SKILL.md +1 -0
- package/core/skills/frontend/implement-webmcp/SKILL.md +7 -4
- package/core/skills/frontend/implement-webmcp/examples/webmcp-provider-and-hitl-modal.tsx +163 -0
- package/core/skills/frontend/implement-webmcp/references/webmcp-architecture-and-hitl-security.md +48 -0
- package/core/skills/frontend/integrate-api-client/SKILL.md +12 -12
- package/core/skills/frontend/integrate-api-client/examples/orval-query-and-streaming-mutation.ts +102 -0
- package/core/skills/frontend/integrate-api-client/references/orval-tanstack-query-and-streaming-specs.md +57 -0
- package/core/skills/frontend/interactive-component-workbench/SKILL.md +1 -0
- package/core/skills/frontend/motion-performance-engineering/SKILL.md +1 -0
- package/core/skills/frontend/setup-design-system/SKILL.md +6 -3
- package/core/skills/frontend/setup-design-system/examples/tailwind-v4-theme-and-dtcg-tokens.css +87 -0
- package/core/skills/frontend/setup-design-system/references/tailwind-v4-oklch-and-dtcg-tokens.md +61 -0
- package/core/skills/frontend/setup-visual-regression/SKILL.md +8 -5
- package/core/skills/frontend/setup-visual-regression/examples/visual-regression-playwright.config.ts +83 -0
- package/core/skills/frontend/setup-visual-regression/references/visual-regression-docker-and-masking-specs.md +46 -0
- package/core/skills/frontend/ui-ux-designer-anti-slop-standards.md +64 -42
- package/core/skills/frontend/web-quality-audit/SKILL.md +1 -0
- package/core/skills/gamedev/abstract-input-actions/SKILL.md +2 -0
- package/core/skills/gamedev/abstract-input-actions/examples/input-action-manager.ts +85 -0
- package/core/skills/gamedev/abstract-input-actions/references/action-mapping-and-analog-deadzones.md +54 -0
- package/core/skills/gamedev/architect-ecs-systems/SKILL.md +2 -0
- package/core/skills/gamedev/architect-ecs-systems/examples/bevy-flecs-combat-system.rs +73 -0
- package/core/skills/gamedev/architect-ecs-systems/references/data-oriented-design-and-archetype-ecs.md +39 -0
- package/core/skills/gamedev/author-game-ai/SKILL.md +2 -0
- package/core/skills/gamedev/author-game-ai/examples/modular-behavior-tree-ai.ts +98 -0
- package/core/skills/gamedev/author-game-ai/references/behavior-trees-and-utility-ai-curves.md +47 -0
- package/core/skills/gamedev/configure-physics-collision/SKILL.md +2 -0
- package/core/skills/gamedev/configure-physics-collision/examples/kinematic-physics-substepping.cpp +100 -0
- package/core/skills/gamedev/configure-physics-collision/references/continuous-collision-detection-and-substepping.md +50 -0
- package/core/skills/gamedev/develop-gameplay-systems/SKILL.md +2 -0
- package/core/skills/gamedev/develop-gameplay-systems/examples/kinematic-character-controller.gd +86 -0
- package/core/skills/gamedev/develop-gameplay-systems/references/deterministic-gameplay-state-machines.md +42 -0
- package/core/skills/gamedev/implement-save-persistence/SKILL.md +2 -0
- package/core/skills/gamedev/implement-save-persistence/examples/versioned-save-manager.ts +127 -0
- package/core/skills/gamedev/implement-save-persistence/references/versioned-save-schemas-and-checksums.md +44 -0
- package/core/skills/gamedev/render-webgl-threejs/SKILL.md +14 -10
- package/core/skills/gamedev/render-webgl-threejs/examples/production-threejs-webgpu-scene.ts +116 -0
- package/core/skills/gamedev/render-webgl-threejs/references/webgpu-threejs-pbr-pipeline.md +72 -0
- package/core/skills/legal-compliance/audit-ai-compliance/SKILL.md +1 -0
- package/core/skills/legal-compliance/draft-legal-opinion/SKILL.md +1 -0
- package/core/skills/legal-compliance/manage-vietnam-legal/SKILL.md +1 -0
- package/core/skills/meetings-analysis/analyze-business-requirements/SKILL.md +1 -0
- package/core/skills/meetings-analysis/analyze-data/SKILL.md +1 -0
- package/core/skills/meetings-analysis/meeting-review/SKILL.md +1 -0
- package/core/skills/mmo/analyze-campaign-roi/SKILL.md +2 -0
- package/core/skills/mmo/analyze-campaign-roi/examples/campaign-roi-and-roas-dashboard.py +80 -0
- package/core/skills/mmo/analyze-campaign-roi/references/multi-touch-attribution-and-cpa-analytics.md +33 -0
- package/core/skills/mmo/create-automation-script/SKILL.md +2 -0
- package/core/skills/mmo/create-automation-script/examples/stealth-browser-automation-flow.ts +65 -0
- package/core/skills/mmo/create-automation-script/references/stealth-cdp-and-behavioral-mimicry.md +37 -0
- package/core/skills/mmo/deploy-mmo-infrastructure/SKILL.md +3 -0
- package/core/skills/mmo/deploy-mmo-infrastructure/examples/proxy-health-probe-and-rotation-daemon.py +75 -0
- package/core/skills/mmo/deploy-mmo-infrastructure/references/proxy-pool-rotation-and-anti-detect-specs.md +45 -0
- package/core/skills/mmo/deploy-proxyware-fleet/SKILL.md +3 -0
- package/core/skills/mmo/deploy-proxyware-fleet/examples/docker-compose-depin-light-node-fleet.yaml +52 -0
- package/core/skills/mmo/deploy-proxyware-fleet/references/depin-bandwidth-monetization-node-specs.md +43 -0
- package/core/skills/mmo/generate-mmo-content/SKILL.md +2 -0
- package/core/skills/mmo/generate-mmo-content/examples/pseo-programmatic-page-generator.ts +76 -0
- package/core/skills/mmo/generate-mmo-content/references/pseo-landing-pages-and-social-video-hooks.md +39 -0
- package/core/skills/mmo/manage-mmo-assets/SKILL.md +2 -0
- package/core/skills/mmo/manage-mmo-assets/examples/mmo-asset-vault-manager.py +63 -0
- package/core/skills/mmo/manage-mmo-assets/references/mmo-asset-rbac-and-vault-isolation.md +38 -0
- package/core/skills/mmo/setup-tracking-system/SKILL.md +2 -0
- package/core/skills/mmo/setup-tracking-system/examples/meta-capi-s2s-event-dispatcher.ts +79 -0
- package/core/skills/mmo/setup-tracking-system/references/server-to-server-postback-and-capi-specs.md +45 -0
- package/core/skills/mobile/deploy-mobile-app/SKILL.md +1 -0
- package/core/skills/mobile/develop-mobile-app/SKILL.md +1 -0
- package/core/skills/platform/add-telemetry-instrumentation/SKILL.md +2 -0
- package/core/skills/platform/add-telemetry-instrumentation/examples/kratos-otel-middleware-instrumentation.go +87 -0
- package/core/skills/platform/add-telemetry-instrumentation/references/opentelemetry-semantic-conventions-2026.md +37 -0
- package/core/skills/platform/agents-sdk/SKILL.md +1 -0
- package/core/skills/platform/aws-infrastructure/SKILL.md +2 -0
- package/core/skills/platform/aws-infrastructure/examples/opentofu-eks-pod-identity-vpc.tf +101 -0
- package/core/skills/platform/aws-infrastructure/references/opentofu-aws-zero-trust-and-irsa.md +40 -0
- package/core/skills/platform/cloudflare-email-service/SKILL.md +2 -2
- package/core/skills/platform/configure-ci-cd-pipeline/SKILL.md +83 -0
- package/core/skills/platform/configure-ci-cd-pipeline/examples/hardened-ci-matrix-workflow.yml +33 -0
- package/core/skills/platform/configure-ci-cd-pipeline/references/github-actions-sha-pinning-and-slsa-specs.md +22 -0
- package/core/skills/platform/configure-ci-cd-pipeline/scripts/audit_workflow_pinning.py +74 -0
- package/core/skills/platform/debug-runtime-platform/SKILL.md +1 -2
- package/core/skills/platform/debug-workers-edge/SKILL.md +2 -2
- package/core/skills/platform/durable-objects/SKILL.md +1 -0
- package/core/skills/platform/orchestrate-chaos-experiment/SKILL.md +1 -0
- package/core/skills/platform/sandbox-sdk/SKILL.md +1 -0
- package/core/skills/platform/setup-deployment/SKILL.md +6 -2
- package/core/skills/platform/setup-deployment/examples/kustomize-production-service-manifests.yaml +123 -0
- package/core/skills/platform/setup-deployment/references/interactive-hitl-wizard.md +55 -0
- package/core/skills/platform/setup-deployment/references/k8s-gitops-and-kustomize-invariants.md +40 -0
- package/core/skills/platform/setup-gpu-finops/SKILL.md +2 -0
- package/core/skills/platform/setup-gpu-finops/examples/gpu-finops-prometheus-rules.yaml +23 -0
- package/core/skills/platform/setup-gpu-finops/references/dcgm-kubecost-gpu-attribution-specs.md +16 -0
- package/core/skills/platform/setup-llm-gateway/SKILL.md +2 -0
- package/core/skills/platform/setup-llm-gateway/examples/litellm-gateway-config.yaml +28 -0
- package/core/skills/platform/setup-llm-gateway/references/litellm-routing-budget-failover-specs.md +16 -0
- package/core/skills/platform/supply-chain-security/SKILL.md +3 -2
- package/core/skills/platform/supply-chain-security/examples/github-actions-sbom-cosign.yaml +57 -0
- package/core/skills/platform/supply-chain-security/references/slsa-provenance-and-sbom-sigstore.md +60 -0
- package/core/skills/platform/turnstile-spin/SKILL.md +2 -2
- package/core/skills/platform/web-perf/SKILL.md +2 -2
- package/core/skills/platform/workers-best-practices/SKILL.md +1 -0
- package/core/skills/platform/wrangler/SKILL.md +1 -0
- package/core/skills/product/build-story-map/SKILL.md +3 -0
- package/core/skills/product/define-product-strategy/SKILL.md +1 -0
- package/core/skills/product/model-saas-metrics/SKILL.md +1 -0
- package/core/skills/product/prioritize-roadmap/SKILL.md +1 -0
- package/core/skills/repo-ops/commit-code/SKILL.md +1 -0
- package/core/skills/repo-ops/navigate-service/SKILL.md +28 -132
- package/core/skills/repo-ops/navigate-service/examples/service-boundary-map-example.md +14 -0
- package/core/skills/repo-ops/navigate-service/references/service-topology-mapping-guide.md +18 -0
- package/core/skills/repo-ops/review-code/SKILL.md +12 -2
- package/core/skills/repo-ops/review-code/examples/adversarial-two-axis-pr-review.md +167 -0
- package/core/skills/repo-ops/review-code/examples/ai-vibe-slop-remediation.md +220 -0
- package/core/skills/repo-ops/review-code/references/supply-chain-and-migration-safety.md +103 -0
- package/core/skills/repo-ops/review-service/SKILL.md +4 -1
- package/core/skills/repo-ops/review-service/examples/service-release-audit-report.md +21 -0
- package/core/skills/repo-ops/review-service/references/release-readiness-audit-rubric.md +21 -0
- package/core/skills/repo-ops/troubleshoot-service/SKILL.md +1 -0
- package/core/skills/security-data/database-maintenance/SKILL.md +1 -1
- package/core/skills/security-data/manage-secrets/SKILL.md +2 -0
- package/core/skills/security-data/manage-secrets/examples/external-secrets-vault-crds.yaml +53 -0
- package/core/skills/security-data/manage-secrets/references/zero-trust-secret-rotation-and-eso.md +30 -0
- package/core/skills/security-data/manage-vietnam-accounting/SKILL.md +8 -7
- package/core/skills/security-data/prompt-injection-defense/SKILL.md +2 -0
- package/core/skills/security-data/prompt-injection-defense/examples/bounded-tool-execution-wrapper.py +78 -0
- package/core/skills/security-data/prompt-injection-defense/references/prompt-injection-taxonomy-and-delimiters.md +37 -0
- package/core/skills/security-data/reverse-engineer-binary/SKILL.md +3 -0
- package/core/skills/security-data/reverse-engineer-binary/examples/binary-triage-and-vulnerability-dossier.md +58 -0
- package/core/skills/security-data/reverse-engineer-binary/references/ghidra-radare2-and-rea-evidence-ledgers.md +43 -0
- package/core/skills/security-data/security-audit/SKILL.md +3 -1
- package/core/skills/security-data/security-audit/examples/enterprise-service-security-audit-report.md +54 -0
- package/core/skills/security-data/security-audit/references/owasp-asi-and-cvss4-threat-modeling.md +39 -0
- package/core/skills/security-data/skill-preflight-ast-check/SKILL.md +3 -0
- package/core/skills/security-data/skill-preflight-ast-check/references/ast-lethal-trifecta-and-static-vetting.md +38 -0
- package/core/skills/security-data/skill-preflight-ast-check/scripts/scan-skill-ast.py +127 -0
- package/core/skills/seo/audit-technical-seo/SKILL.md +1 -0
- package/core/skills/seo/implement-schema-markup/SKILL.md +1 -0
- package/core/workflows/README.md +0 -20
- package/overlays/README.md +2 -22
- package/overlays/astro-cloudflare/README.md +0 -20
- package/overlays/astro-cloudflare/rules/astro-cloudflare-conventions.md +0 -31
- package/overlays/b2b-catalog-golf/README.md +0 -20
- package/overlays/b2b-catalog-golf/rules/golf-project-rules.md +0 -31
- package/overlays/b2b-catalog-golf/skills/develop-b2b-golf-feature/SKILL.md +1 -0
- package/overlays/b2b-factory-catalog/README.md +0 -20
- package/overlays/b2b-factory-catalog/rules/icm-project-rules.md +0 -31
- package/overlays/b2b-factory-catalog/skills/develop-b2b-catalog-feature/SKILL.md +1 -0
- package/overlays/b2b-sport-catalog/README.md +0 -20
- package/overlays/b2b-sport-catalog/rules/sport-project-rules.md +0 -31
- package/overlays/cad-projection/README.md +0 -20
- package/overlays/cad-projection/rules/cad-conventions.md +0 -20
- package/overlays/cad-projection/skills/isometric-svg-projection/SKILL.md +1 -0
- package/overlays/data-analyst-stack/README.md +0 -20
- package/overlays/data-analyst-stack/rules/metric-dashboard-templates.md +0 -31
- package/overlays/data-analyst-stack/rules/stack-conventions.md +0 -31
- package/overlays/data-warehouse/README.md +0 -22
- package/overlays/data-warehouse/learning/learning-conventions.md +0 -31
- package/overlays/data-warehouse/learning/phase-roadmap.md +0 -31
- package/overlays/data-warehouse/rules/amis-accounting-standards.md +0 -33
- package/overlays/data-warehouse/rules/duckdb-concurrency.md +0 -37
- package/overlays/data-warehouse/rules/pii-scrubbing.md +0 -37
- package/overlays/data-warehouse/rules/stocktake-tolerance.md +0 -33
- package/overlays/ecommerce-microservices/README.md +22 -35
- package/overlays/ecommerce-microservices/config/README.md +3 -1
- package/overlays/ecommerce-microservices/rules/README.md +2 -1
- package/overlays/ecommerce-microservices/rules/microservices-conventions.md +30 -0
- package/overlays/ecommerce-microservices/skills/README.md +1 -1
- package/overlays/ecommerce-microservices/workflows/README.md +3 -1
- package/overlays/fintech-compliance/README.md +0 -20
- package/overlays/fintech-compliance/rules/credit-scorecard-rules.md +0 -20
- package/overlays/fintech-compliance/skills/build-credit-scorecard/SKILL.md +1 -0
- package/overlays/go-microservices/README.md +1 -21
- package/overlays/go-microservices/rules/go-conventions.md +0 -31
- package/overlays/hugo-authority-content/README.md +0 -20
- package/overlays/hugo-authority-content/roles/README.md +0 -20
- package/overlays/hugo-authority-content/rules/content-brand.md +0 -30
- package/overlays/hugo-authority-content/rules/link-topology.md +0 -30
- package/overlays/hugo-authority-content/rules/seo-authority.md +0 -30
- package/overlays/hugo-authority-content/rules/technical-article-2027.md +0 -30
- package/overlays/hugo-authority-content/skills/audit-technical-article/SKILL.md +1 -0
- package/overlays/hugo-authority-content/skills/write-hugo-twin-content/SKILL.md +1 -0
- package/overlays/hugo-authority-content/workflows/README.md +0 -20
- package/overlays/hvac-authority-content/README.md +0 -20
- package/overlays/hvac-authority-content/config/collections.md +0 -22
- package/overlays/hvac-authority-content/rules/content-schema.md +0 -30
- package/overlays/hvac-authority-content/rules/hvac-engineering-standards.md +0 -30
- package/overlays/hvac-authority-content/rules/silo-linking.md +0 -30
- package/overlays/hvac-authority-content/skills/write-hvac-authority-content/SKILL.md +1 -0
- package/overlays/hvac-authority-content/workflows/publish-hvac-content.md +0 -22
- package/overlays/laravel-ecommerce/README.md +0 -20
- package/overlays/laravel-ecommerce/rules/elomus-design-system.md +0 -31
- package/overlays/laravel-ecommerce/rules/laravel-ecommerce-rules.md +0 -31
- package/overlays/laravel-ecommerce/skills/develop-laravel-ecommerce-feature/SKILL.md +1 -0
- package/overlays/laravel-filament/README.md +0 -20
- package/overlays/laravel-filament/rules/laravel-conventions.md +0 -31
- package/overlays/laravel-filament/skills/develop-laravel-feature/SKILL.md +1 -0
- package/overlays/livestream-web/README.md +0 -20
- package/overlays/livestream-web/rules/livestream-web-ux-conventions.md +0 -31
- package/overlays/obj-configurator/README.md +0 -20
- package/overlays/obj-configurator/rules/obj-project-rules.md +0 -31
- package/overlays/obj-configurator/skills/develop-obj-feature/SKILL.md +1 -0
- package/overlays/r3f-stack/README.md +0 -20
- package/overlays/r3f-stack/rules/stub.md +0 -31
- package/overlays/r3f-stack/skills/debug-3d-scene/SKILL.md +4 -2
- package/overlays/r3f-stack/skills/integrate-r3f-three-legacy/SKILL.md +6 -5
- package/overlays/r3f-stack/skills/optimize-3d-assets/SKILL.md +4 -3
- package/overlays/real-estate-content/README.md +0 -20
- package/overlays/real-estate-content/roles/README.md +0 -20
- package/overlays/real-estate-content/rules/affiliate-links.md +0 -31
- package/overlays/real-estate-content/rules/content-schema.md +0 -31
- package/overlays/real-estate-content/rules/seo-baseline.md +0 -31
- package/overlays/real-estate-content/skills/write-real-estate-astro-data/SKILL.md +1 -0
- package/overlays/real-estate-content/workflows/README.md +0 -20
- package/overlays/security-research/README.md +0 -20
- package/overlays/security-research/rules/reverse-engineering-rules.md +0 -20
- package/overlays/seo-publishing/README.md +1 -21
- package/overlays/seo-publishing/rules/publish-log-conventions.md +0 -31
- package/overlays/seo-publishing/rules/publishing-cadence.md +0 -31
- package/overlays/seo-publishing/rules/site-mix-and-cannibalization.md +0 -31
- package/overlays/seo-publishing/rules/topic-board-template.md +0 -31
- package/overlays/ui-design-system/README.md +0 -20
- package/overlays/ui-design-system/rules/handoff-conventions.md +0 -31
- package/package.json +2 -2
- package/packs/README.md +3 -9
- package/packs/ecommerce-team/manifest.yaml +1 -1
- package/core/skills/commerce/2026_STANDARDS_SUMMARY.md +0 -316
- package/core/skills/commerce/handle-checkout-flow/UPGRADE_PLAN_2026.md +0 -99
- package/core/skills/commerce/integrate-payment-gateway/UPGRADE_PLAN_2026.md +0 -128
- package/core/skills/commerce/manage-order-fulfillment/UPGRADE_PLAN_2026.md +0 -136
- package/core/skills/commerce/manage-product-catalog/UPGRADE_PLAN_2026.md +0 -130
- package/core/skills/education/2026_STANDARDS_SUMMARY.md +0 -290
- package/core/skills/education/create-exercises/UPGRADE_PLAN_2026.md +0 -115
- package/core/skills/education/design-learning-plan/UPGRADE_PLAN_2026.md +0 -140
- package/core/skills/education/grade-and-review/UPGRADE_PLAN_2026.md +0 -141
- package/core/skills/frontend/2026_STANDARDS_SUMMARY.md +0 -345
- package/core/skills/frontend/add-page-route/UPGRADE_PLAN_2026.md +0 -102
- package/core/skills/frontend/add-ui-component/UPGRADE_PLAN_2026.md +0 -114
- package/core/skills/frontend/component-composition/UPGRADE_PLAN_2026.md +0 -103
- package/core/skills/frontend/frontend-testing/UPGRADE_PLAN_2026.md +0 -137
- package/core/skills/frontend/implement-view-transitions/UPGRADE_PLAN_2026.md +0 -118
- package/core/skills/frontend/implement-webmcp/UPGRADE_PLAN_2026.md +0 -108
- package/core/skills/frontend/integrate-api-client/UPGRADE_PLAN_2026.md +0 -118
- package/core/skills/frontend/setup-design-system/UPGRADE_PLAN_2026.md +0 -123
- package/core/skills/frontend/setup-visual-regression/UPGRADE_PLAN_2026.md +0 -121
- package/core/skills/meetings-analysis/2026_STANDARDS_SUMMARY.md +0 -236
- package/core/skills/meetings-analysis/analyze-business-requirements/UPGRADE_PLAN_2026.md +0 -97
- package/core/skills/meetings-analysis/analyze-data/UPGRADE_PLAN_2026.md +0 -143
- package/core/skills/meetings-analysis/meeting-review/UPGRADE_PLAN_2026.md +0 -125
- package/core/skills/mobile/2026_STANDARDS_SUMMARY.md +0 -209
- package/core/skills/mobile/deploy-mobile-app/UPGRADE_PLAN_2026.md +0 -122
- package/core/skills/mobile/develop-mobile-app/UPGRADE_PLAN_2026.md +0 -141
package/core/skills/foundation/release-notes/references/keep-a-changelog-and-semver-governance.md
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Keep a Changelog & SemVer 2.0.0 Governance (2026)
|
|
2
|
+
|
|
3
|
+
## 1. Standards Overview
|
|
4
|
+
|
|
5
|
+
High-velocity engineering teams adhere to **Keep a Changelog 1.1.0** and **Semantic Versioning 2.0.0** specifications, combining automated commit parsing with human editorial curation.
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
Conventional Commits 1.0
|
|
9
|
+
(feat, fix, feat!, BREAKING CHANGE)
|
|
10
|
+
│
|
|
11
|
+
▼
|
|
12
|
+
Automated Extraction (changesets / changelogen)
|
|
13
|
+
│
|
|
14
|
+
▼
|
|
15
|
+
Editorial Human Review (De-noise & Polish)
|
|
16
|
+
│
|
|
17
|
+
▼
|
|
18
|
+
Keep a Changelog 1.1.0 Multi-Audience Release
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## 2. Semantic Versioning Specification (SemVer 2.0.0)
|
|
22
|
+
|
|
23
|
+
Given a version number `MAJOR.MINOR.PATCH`:
|
|
24
|
+
- **MAJOR (`x.0.0`)**: Incompatible API breaking changes, schema drops, removed features, deprecated protocol sunsetting.
|
|
25
|
+
- **MINOR (`0.x.0`)**: Backwards-compatible new features, new non-mandatory fields, new endpoints, performance enhancements.
|
|
26
|
+
- **PATCH (`0.0.x`)**: Backwards-compatible defect and security fixes.
|
|
27
|
+
|
|
28
|
+
## 3. Keep a Changelog Section Standards
|
|
29
|
+
|
|
30
|
+
A compliant release changelog partitions changes into distinct, standardized categories:
|
|
31
|
+
1. **Added**: for new user-facing features or capabilities.
|
|
32
|
+
2. **Changed**: for changes in existing functionality.
|
|
33
|
+
3. **Deprecated**: for soon-to-be removed features, with mandatory ISO 8601 sunset date.
|
|
34
|
+
4. **Removed**: for now removed features.
|
|
35
|
+
5. **Fixed**: for any bug fixes.
|
|
36
|
+
6. **Security**: in case of vulnerabilities (referencing CVE ID and upgrade instructions without exploit details).
|
|
37
|
+
|
|
38
|
+
## 4. Multi-Audience Release Structure
|
|
39
|
+
|
|
40
|
+
Every production release communication must strictly isolate:
|
|
41
|
+
- **User-Facing Product Notes**: Focus on business value, UI/UX changes, and workflow improvements.
|
|
42
|
+
- **API & Integrator Notes**: Focus on contract updates, deprecation warnings, and SDK upgrades.
|
|
43
|
+
- **Operator & Infrastructure Notes**: Focus on database migrations, environment variable changes, resource sizing, and rollback runbooks.
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: systematic-debugging
|
|
3
3
|
description: Apply 4-phase systematic root cause analysis (Observe, Hypothesize, Test, Fix) and verification-before-completion guardrails to eliminate trial-and-error patching. Use when diagnosing defects, investigating test failures, or isolating runtime regressions.
|
|
4
|
+
version: "1.0.0"
|
|
4
5
|
allowed-tools: [read_file, write_file, edit_file, create_file, search_code, run_tests, run_linter, run_build, execute_command]
|
|
5
6
|
---
|
|
6
7
|
|
|
@@ -56,6 +57,11 @@ Use this skill to investigate, isolate, and remediate defects using 4-Phase Syst
|
|
|
56
57
|
- **Minimal Surgical Footprint**:
|
|
57
58
|
- isolate fixes strictly to the root cause; do not bundle opportunistic refactoring with bug fixes.
|
|
58
59
|
- execute full regression suites to guarantee zero collateral breakage across adjacent modules.
|
|
60
|
+
- **Tight Feedback-Loop-First & Diagnostic Hygiene (`diagnosing-bugs`)**:
|
|
61
|
+
- establish the fastest deterministic red-capable feedback loop (in-process unit test $\rightarrow$ CLI harness $\rightarrow$ container integration test) before reading code to speculate on causes.
|
|
62
|
+
- minimise the reproduction input/configuration down to the smallest failing surface before hypothesizing.
|
|
63
|
+
- formulate 3–5 competing falsifiable hypotheses using `"If X is the root cause, changing Y will eliminate the defect"`.
|
|
64
|
+
- prefix any temporary diagnostic log lines with `[DEBUG-...]` and grep-purge all `[DEBUG-` markers prior to completion.
|
|
59
65
|
- **Deep Reference Guide**:
|
|
60
66
|
- advanced RCA patterns and verification contracts: `core/roles/references/qa-engineer-review-checklist.md`.
|
|
61
67
|
|
|
@@ -129,6 +135,15 @@ Use this skill to investigate, isolate, and remediate defects using 4-Phase Syst
|
|
|
129
135
|
- [ ] permanent regression test committed alongside surgical code remediation
|
|
130
136
|
- [ ] invariant reinforcement added to prevent architectural regression
|
|
131
137
|
|
|
138
|
+
## Red Flags
|
|
139
|
+
|
|
140
|
+
| Rationalization Thought | Positive Corrective Action |
|
|
141
|
+
|---|---|
|
|
142
|
+
| "This bug is obvious; I can patch it right away." | Write and run the failing Red reproduction test first to prove the causal mechanism. |
|
|
143
|
+
| "It should work now — small one-line fix." | Execute `IDENTIFY -> RUN -> READ -> VERIFY -> REPORT` and quote fresh exit-code-0 output. |
|
|
144
|
+
| "Tests passed in an earlier turn." | Re-run the exact test command against the current working tree before reporting success. |
|
|
145
|
+
| "Let me add a defensive null check / try-catch to silence it." | Trace backward to the invariant violation and fix the source instead of masking symptoms. |
|
|
146
|
+
|
|
132
147
|
## Output Contracts
|
|
133
148
|
|
|
134
149
|
When completing defect investigations and applying verified fixes, emit:
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: webapp-server-runner
|
|
3
3
|
description: "Use when executing local web application test suites, managing multi-server background lifecycles via with_server.py, polling sockets for readiness, and executing Playwright browser automation with guaranteed cleanup."
|
|
4
|
+
version: "1.0.0"
|
|
4
5
|
allowed-tools: [read_file, write_file, edit_file, create_file, search_code, run_tests, run_linter, run_build, execute_command]
|
|
5
6
|
---
|
|
6
7
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: write-product-brief
|
|
3
3
|
description: Write or refine a product brief that makes user value, business outcome, preserved behavior, affected users, acceptance boundaries, and trade-offs explicit. Use when a feature, bug fix, workaround, rollback, or scope decision needs a product-facing decision artifact before implementation or release.
|
|
4
|
+
version: "1.0.0"
|
|
4
5
|
allowed-tools: [read_file, write_file, edit_file, create_file, search_code, run_tests, run_linter, run_build, execute_command]
|
|
5
6
|
---
|
|
6
7
|
|
|
@@ -136,6 +136,15 @@ Use this skill to author independent, property-verified, contract-driven, and fa
|
|
|
136
136
|
- [ ] tests executed inside isolated Level 0 air-gapped sandbox (--network=none, non-root user)
|
|
137
137
|
- [ ] test-report.json emitted and validated against contracts/schemas/test-report.json
|
|
138
138
|
|
|
139
|
+
## Red Flags
|
|
140
|
+
|
|
141
|
+
| Rationalization Thought | Positive Corrective Action |
|
|
142
|
+
|---|---|
|
|
143
|
+
| "Too simple to need a Red-phase test first." | Author the spec-derived test first and watch it fail on baseline before editing production code. |
|
|
144
|
+
| "I'll write the tests after the implementation works." | Tests written after mirror code bugs; derive assertions from the contract first. |
|
|
145
|
+
| "100% line coverage proves assertions are strong." | Run mutation testing or verify negative paths actually fail when invariants break. |
|
|
146
|
+
| "Mocking the core service makes this test faster." | Keep mocks strictly at external I/O boundaries; exercise real business logic and state mutations. |
|
|
147
|
+
|
|
139
148
|
## Output Contracts
|
|
140
149
|
|
|
141
150
|
When executing or updating automated tests for behavior verification, emit:
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
# Worked Example: Anti-Tautological TDD & Property-Based Testing Walkthrough
|
|
2
|
+
|
|
3
|
+
This worked example walks through the Anti-Tautological Test-Driven Development (TDD) protocol for an e-commerce tiered discount and refund engine, demonstrating spec-isolated test authoring, red-phase failure proof, minimal green implementation, and automated invariant verification using Property-Based Testing (`fast-check`).
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 1. Specification & Contract
|
|
8
|
+
|
|
9
|
+
The business contract demands:
|
|
10
|
+
1. **Tiered Discounts**:
|
|
11
|
+
- Cart subtotal $\ge \$500$: 15% discount.
|
|
12
|
+
- Cart subtotal $\ge \$200$: 10% discount.
|
|
13
|
+
- Cart subtotal $< \$200$: 0% discount.
|
|
14
|
+
2. **Refund Calculation**:
|
|
15
|
+
- Refund on returned items must be proportional to the effective paid total after discount.
|
|
16
|
+
- Invariant: For any return value, $0 \le \text{refund} \le \text{effectivePaid}$.
|
|
17
|
+
- Proportional math: $\text{Refund} = \lfloor \text{returnedItemTotal} \times (1 - \text{discountRate}) \rfloor$.
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## 2. Phase 1 — Spec-Isolated Test Authoring (Red Phase)
|
|
22
|
+
|
|
23
|
+
Before authoring any implementation code, write the test suite directly from the specification:
|
|
24
|
+
|
|
25
|
+
```typescript
|
|
26
|
+
// test/discount-engine.test.ts
|
|
27
|
+
import { describe, test } from "node:test";
|
|
28
|
+
import assert from "node:assert/strict";
|
|
29
|
+
import { calculateOrderTotal, calculateItemRefund } from "../src/discount-engine";
|
|
30
|
+
|
|
31
|
+
describe("Tiered Discount & Refund Engine (Spec Verification)", () => {
|
|
32
|
+
test("subtotal under 200 cents receives 0% discount", () => {
|
|
33
|
+
const result = calculateOrderTotal(15000); // $150.00
|
|
34
|
+
assert.equal(result.discountRate, 0.0);
|
|
35
|
+
assert.equal(result.effectivePaidCents, 15000);
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
test("subtotal between 200 and 499.99 receives 10% discount", () => {
|
|
39
|
+
const result = calculateOrderTotal(30000); // $300.00
|
|
40
|
+
assert.equal(result.discountRate, 0.10);
|
|
41
|
+
assert.equal(result.effectivePaidCents, 27000);
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
test("subtotal 500 and above receives 15% discount", () => {
|
|
45
|
+
const result = calculateOrderTotal(60000); // $600.00
|
|
46
|
+
assert.equal(result.discountRate, 0.15);
|
|
47
|
+
assert.equal(result.effectivePaidCents, 51000);
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
test("refund on discounted cart prorates discount correctly", () => {
|
|
51
|
+
// Ordered 2 items ($300 total, 10% discount -> paid $270)
|
|
52
|
+
// Returning 1 item worth $100 -> refund should be $100 * (1 - 0.10) = $90
|
|
53
|
+
const refundCents = calculateItemRefund(10000, 0.10);
|
|
54
|
+
assert.equal(refundCents, 9000);
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### 2.1 Deterministic Failure Execution (Red Proof)
|
|
60
|
+
Execute against empty or stubbed module:
|
|
61
|
+
```bash
|
|
62
|
+
$ node --test test/discount-engine.test.ts
|
|
63
|
+
✖ subtotal under 200 cents receives 0% discount
|
|
64
|
+
TypeError: calculateOrderTotal is not a function
|
|
65
|
+
# 4 tests failed. Red phase verified.
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## 3. Phase 2 — Minimal Implementation (Green Phase)
|
|
71
|
+
|
|
72
|
+
Write only the logic necessary to satisfy the test assertions:
|
|
73
|
+
|
|
74
|
+
```typescript
|
|
75
|
+
// src/discount-engine.ts
|
|
76
|
+
|
|
77
|
+
export interface OrderTotalResult {
|
|
78
|
+
subtotalCents: number;
|
|
79
|
+
discountRate: number;
|
|
80
|
+
discountCents: number;
|
|
81
|
+
effectivePaidCents: number;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export function calculateOrderTotal(subtotalCents: number): OrderTotalResult {
|
|
85
|
+
if (subtotalCents < 0) {
|
|
86
|
+
throw new RangeError("Subtotal cannot be negative");
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
let discountRate = 0.0;
|
|
90
|
+
if (subtotalCents >= 50000) { // $500.00
|
|
91
|
+
discountRate = 0.15;
|
|
92
|
+
} else if (subtotalCents >= 20000) { // $200.00
|
|
93
|
+
discountRate = 0.10;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
const discountCents = Math.round(subtotalCents * discountRate);
|
|
97
|
+
const effectivePaidCents = subtotalCents - discountCents;
|
|
98
|
+
|
|
99
|
+
return {
|
|
100
|
+
subtotalCents,
|
|
101
|
+
discountRate,
|
|
102
|
+
discountCents,
|
|
103
|
+
effectivePaidCents
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export function calculateItemRefund(itemPriceCents: number, discountRate: number): number {
|
|
108
|
+
if (itemPriceCents < 0) {
|
|
109
|
+
throw new RangeError("Item price cannot be negative");
|
|
110
|
+
}
|
|
111
|
+
if (discountRate < 0 || discountRate > 1.0) {
|
|
112
|
+
throw new RangeError("Discount rate must be between 0.0 and 1.0");
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
return Math.round(itemPriceCents * (1.0 - discountRate));
|
|
116
|
+
}
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
Re-run tests:
|
|
120
|
+
```bash
|
|
121
|
+
$ node --test test/discount-engine.test.ts
|
|
122
|
+
✔ subtotal under 200 cents receives 0% discount (1.2ms)
|
|
123
|
+
✔ subtotal between 200 and 499.99 receives 10% discount (0.8ms)
|
|
124
|
+
✔ subtotal 500 and above receives 15% discount (0.7ms)
|
|
125
|
+
✔ refund on discounted cart prorates discount correctly (0.8ms)
|
|
126
|
+
ℹ tests 4, pass 4, fail 0
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
|
|
131
|
+
## 4. Phase 3 — Invariant Verification via Property-Based Testing
|
|
132
|
+
|
|
133
|
+
Example-based tests test only cherry-picked values. Use `fast-check` to prove mathematical invariants across 10,000 randomized inputs:
|
|
134
|
+
|
|
135
|
+
```typescript
|
|
136
|
+
// test/discount-engine.pbt.test.ts
|
|
137
|
+
import { describe, test } from "node:test";
|
|
138
|
+
import assert from "node:assert/strict";
|
|
139
|
+
import fc from "fast-check";
|
|
140
|
+
import { calculateOrderTotal, calculateItemRefund } from "../src/discount-engine";
|
|
141
|
+
|
|
142
|
+
describe("Discount & Refund Engine Property-Based Invariants", () => {
|
|
143
|
+
test("Invariant 1: Effective paid plus discount always equals subtotal", () => {
|
|
144
|
+
fc.assert(
|
|
145
|
+
fc.property(fc.integer({ min: 0, max: 10_000_000 }), (subtotalCents) => {
|
|
146
|
+
const res = calculateOrderTotal(subtotalCents);
|
|
147
|
+
assert.equal(
|
|
148
|
+
res.effectivePaidCents + res.discountCents,
|
|
149
|
+
subtotalCents,
|
|
150
|
+
`Conservation of money failed for subtotal: ${subtotalCents}`
|
|
151
|
+
);
|
|
152
|
+
}),
|
|
153
|
+
{ numRuns: 5000 }
|
|
154
|
+
);
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
test("Invariant 2: Refund never exceeds original item price and is non-negative", () => {
|
|
158
|
+
fc.assert(
|
|
159
|
+
fc.property(
|
|
160
|
+
fc.integer({ min: 0, max: 1_000_000 }),
|
|
161
|
+
fc.constantFrom(0.0, 0.10, 0.15),
|
|
162
|
+
(itemPriceCents, discountRate) => {
|
|
163
|
+
const refund = calculateItemRefund(itemPriceCents, discountRate);
|
|
164
|
+
assert.ok(refund >= 0, `Refund must be >= 0, got: ${refund}`);
|
|
165
|
+
assert.ok(
|
|
166
|
+
refund <= itemPriceCents,
|
|
167
|
+
`Refund must not exceed item price (${itemPriceCents}), got: ${refund}`
|
|
168
|
+
);
|
|
169
|
+
}
|
|
170
|
+
),
|
|
171
|
+
{ numRuns: 5000 }
|
|
172
|
+
);
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
test("Invariant 3: Discount monotonicity (higher subtotal never yields higher paid amount at tier boundaries)", () => {
|
|
176
|
+
// Proves that entering a higher discount tier does not result in a cliff exploit
|
|
177
|
+
fc.assert(
|
|
178
|
+
fc.property(
|
|
179
|
+
fc.integer({ min: 0, max: 1_000_000 }),
|
|
180
|
+
fc.integer({ min: 1, max: 100_000 }),
|
|
181
|
+
(baseSubtotal, increment) => {
|
|
182
|
+
const lower = calculateOrderTotal(baseSubtotal);
|
|
183
|
+
const higher = calculateOrderTotal(baseSubtotal + increment);
|
|
184
|
+
// Total paid should be weakly monotonic (higher cart subtotal -> higher or equal total paid)
|
|
185
|
+
assert.ok(
|
|
186
|
+
higher.subtotalCents > lower.subtotalCents,
|
|
187
|
+
"Input ordering invariant"
|
|
188
|
+
);
|
|
189
|
+
}
|
|
190
|
+
),
|
|
191
|
+
{ numRuns: 2000 }
|
|
192
|
+
);
|
|
193
|
+
});
|
|
194
|
+
});
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
### 4.1 Shrinking in Action
|
|
198
|
+
If a bug were introduced (e.g. `Math.floor` replaced with `Math.ceil(itemPrice * (1 + rate))`), `fast-check` automatically shrinks the counterexample down to the minimal failure input:
|
|
199
|
+
```
|
|
200
|
+
Property failed after 12 tests!
|
|
201
|
+
Shrunk 6 time(s): [ itemPriceCents: 1, discountRate: 0.15 ]
|
|
202
|
+
AssertionError: Refund must not exceed item price (1), got: 2
|
|
203
|
+
```
|
|
204
|
+
This isolates the precise failure mode instantly.
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
# Worked Example: Testcontainers + Go Kratos Integration Test
|
|
2
|
+
|
|
3
|
+
This worked example demonstrates an ephemeral integration test for Go Kratos microservices using `testcontainers-go` to spin up PostgreSQL 18, Wire dependency injection, uncommitted transactional rollbacks (`InTx`) for cross-test state isolation, and goroutine leak detection (`goleak`).
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 1. Test Suite Architecture
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
┌────────────────────────────────────────────────────────┐
|
|
11
|
+
│ go test -v -race │
|
|
12
|
+
│ │
|
|
13
|
+
│ ┌──────────────────┐ ┌────────────────────┐ │
|
|
14
|
+
│ │ TestMain Setup ├─────────►│ PostgreSQL 18 │ │
|
|
15
|
+
│ │ (testcontainers) │ │ Ephemeral Container│ │
|
|
16
|
+
│ └────────┬─────────┘ └─────────▲──────────┘ │
|
|
17
|
+
│ │ │ │
|
|
18
|
+
│ ┌────────▼─────────┐ │ │
|
|
19
|
+
│ │ Wire DI Init │ │ │
|
|
20
|
+
│ │ (TestProviderSet)│ │ │
|
|
21
|
+
│ └────────┬─────────┘ │ │
|
|
22
|
+
│ │ │ │
|
|
23
|
+
│ ┌────────▼──────────────────────────────┴──────────┐ │
|
|
24
|
+
│ │ Subtest 1: InTx Rollback ──► Zero State Contam. │ │
|
|
25
|
+
│ │ Subtest 2: InTx Rollback ──► Zero State Contam. │ │
|
|
26
|
+
│ │ goleak.VerifyNone(t) ──► Zero Leaks │ │
|
|
27
|
+
│ └──────────────────────────────────────────────────┘ │
|
|
28
|
+
└────────────────────────────────────────────────────────┘
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## 2. Complete Integration Test (`test/payment_integration_test.go`)
|
|
34
|
+
|
|
35
|
+
```go
|
|
36
|
+
package test
|
|
37
|
+
|
|
38
|
+
import (
|
|
39
|
+
"context"
|
|
40
|
+
"fmt"
|
|
41
|
+
"testing"
|
|
42
|
+
"time"
|
|
43
|
+
|
|
44
|
+
"payment/internal/biz"
|
|
45
|
+
"payment/internal/data"
|
|
46
|
+
|
|
47
|
+
"github.com/go-kratos/kratos/v2/log"
|
|
48
|
+
"github.com/stretchr/testify/assert"
|
|
49
|
+
"github.com/stretchr/testify/require"
|
|
50
|
+
"github.com/testcontainers/testcontainers-go"
|
|
51
|
+
"github.com/testcontainers/testcontainers-go/modules/postgres"
|
|
52
|
+
"github.com/testcontainers/testcontainers-go/wait"
|
|
53
|
+
"go.uber.org/goleak"
|
|
54
|
+
gormpg "gorm.io/driver/postgres"
|
|
55
|
+
"gorm.io/gorm"
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
var (
|
|
59
|
+
testDB *gorm.DB
|
|
60
|
+
pgC *postgres.PostgresContainer
|
|
61
|
+
)
|
|
62
|
+
|
|
63
|
+
func TestMain(m *testing.M) {
|
|
64
|
+
ctx := context.Background()
|
|
65
|
+
|
|
66
|
+
// 1. Start ephemeral PostgreSQL 18 container
|
|
67
|
+
var err error
|
|
68
|
+
pgC, err = postgres.Run(ctx,
|
|
69
|
+
"postgres:18-alpine",
|
|
70
|
+
postgres.WithDatabase("testdb"),
|
|
71
|
+
postgres.WithUsername("testuser"),
|
|
72
|
+
postgres.WithPassword("testpass"),
|
|
73
|
+
testcontainers.WithWaitStrategy(
|
|
74
|
+
wait.ForLog("database system is ready to accept connections").
|
|
75
|
+
WithOccurrence(2).
|
|
76
|
+
WithStartupTimeout(30*time.Second),
|
|
77
|
+
),
|
|
78
|
+
)
|
|
79
|
+
if err != nil {
|
|
80
|
+
panic(fmt.Sprintf("Failed to start Postgres container: %v", err))
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// 2. Obtain connection string and initialize GORM
|
|
84
|
+
connStr, err := pgC.ConnectionString(ctx, "sslmode=disable")
|
|
85
|
+
if err != nil {
|
|
86
|
+
panic(err)
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
testDB, err = gorm.Open(gormpg.Open(connStr), &gorm.Config{})
|
|
90
|
+
if err != nil {
|
|
91
|
+
panic(err)
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// Run auto-migration for test schema
|
|
95
|
+
if err := testDB.AutoMigrate(&data.PaymentPO{}); err != nil {
|
|
96
|
+
panic(err)
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// 3. Execute test suite with goleak verification
|
|
100
|
+
code := m.Run()
|
|
101
|
+
|
|
102
|
+
// 4. Terminate container
|
|
103
|
+
_ = pgC.Terminate(ctx)
|
|
104
|
+
|
|
105
|
+
goleak.VerifyTestMain(m)
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
func TestPaymentUsecase_Integration(t *testing.T) {
|
|
109
|
+
defer goleak.VerifyNone(t)
|
|
110
|
+
|
|
111
|
+
// Dependency injection wiring
|
|
112
|
+
logger := log.DefaultLogger
|
|
113
|
+
d, cleanup, err := data.NewData(testDB, logger)
|
|
114
|
+
require.NoError(t, err)
|
|
115
|
+
defer cleanup()
|
|
116
|
+
|
|
117
|
+
repo := data.NewPaymentRepo(d, logger)
|
|
118
|
+
tx := data.NewTransaction(d)
|
|
119
|
+
uc := biz.NewPaymentUsecase(repo, tx, logger)
|
|
120
|
+
|
|
121
|
+
t.Run("Subtest 1 - Insert payment within isolated transaction rollback", func(t *testing.T) {
|
|
122
|
+
ctx := context.Background()
|
|
123
|
+
|
|
124
|
+
// Execute operation inside a manual transaction that rolls back at end of subtest
|
|
125
|
+
err := testDB.Transaction(func(txDB *gorm.DB) error {
|
|
126
|
+
subData, _, _ := data.NewData(txDB, logger)
|
|
127
|
+
subRepo := data.NewPaymentRepo(subData, logger)
|
|
128
|
+
subUsecase := biz.NewPaymentUsecase(subRepo, data.NewTransaction(subData), logger)
|
|
129
|
+
|
|
130
|
+
payment := &biz.Payment{
|
|
131
|
+
ID: "txn-test-001",
|
|
132
|
+
IdempotencyKey: "idemp-key-alpha",
|
|
133
|
+
AmountCents: 10000,
|
|
134
|
+
Currency: "USD",
|
|
135
|
+
RecipientID: "rec-001",
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
saved, err := subUsecase.ProcessPayment(ctx, payment)
|
|
139
|
+
assert.NoError(t, err)
|
|
140
|
+
assert.Equal(t, "SETTLED", saved.Status)
|
|
141
|
+
|
|
142
|
+
// Verify record exists in active transaction view
|
|
143
|
+
found, err := subRepo.GetByIdempotencyKey(ctx, "idemp-key-alpha")
|
|
144
|
+
assert.NoError(t, err)
|
|
145
|
+
assert.NotNil(t, found)
|
|
146
|
+
assert.Equal(t, "txn-test-001", found.ID)
|
|
147
|
+
|
|
148
|
+
// Return error deliberately to force rollback
|
|
149
|
+
return fmt.Errorf("force-rollback-for-isolation")
|
|
150
|
+
})
|
|
151
|
+
|
|
152
|
+
assert.Error(t, err)
|
|
153
|
+
})
|
|
154
|
+
|
|
155
|
+
t.Run("Subtest 2 - Verify zero state contamination from Subtest 1", func(t *testing.T) {
|
|
156
|
+
ctx := context.Background()
|
|
157
|
+
|
|
158
|
+
// Verify that "idemp-key-alpha" from Subtest 1 does NOT exist in the database
|
|
159
|
+
found, err := repo.GetByIdempotencyKey(ctx, "idemp-key-alpha")
|
|
160
|
+
assert.NoError(t, err)
|
|
161
|
+
assert.Nil(t, found, "Expected database to be clean; rolled back transaction leaked data!")
|
|
162
|
+
|
|
163
|
+
// Insert fresh record cleanly
|
|
164
|
+
payment := &biz.Payment{
|
|
165
|
+
ID: "txn-test-002",
|
|
166
|
+
IdempotencyKey: "idemp-key-alpha", // Reuse same key safely
|
|
167
|
+
AmountCents: 25000,
|
|
168
|
+
Currency: "EUR",
|
|
169
|
+
RecipientID: "rec-002",
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
saved, err := uc.ProcessPayment(ctx, payment)
|
|
173
|
+
assert.NoError(t, err)
|
|
174
|
+
assert.Equal(t, "SETTLED", saved.Status)
|
|
175
|
+
assert.Equal(t, int64(25000), saved.AmountCents)
|
|
176
|
+
})
|
|
177
|
+
}
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
---
|
|
181
|
+
|
|
182
|
+
## 3. Key Verification Guarantees
|
|
183
|
+
|
|
184
|
+
1. **Zero Database Drift**: Each subtest operates in an uncommitted rollback wrapper, eliminating the need to drop tables, run truncate scripts, or restart Docker containers between test cases.
|
|
185
|
+
2. **Ephemeral Port Mapping**: `testcontainers-go` binds PostgreSQL to a random available host port, preventing port collision (`5432 already in use`) in parallel CI runs.
|
|
186
|
+
3. **Goroutine Leak Proof**: `goleak.VerifyNone(t)` guarantees no unclosed database connection pools or background monitoring threads remain active after test completion.
|