@harness-engineering/cli 1.13.0 → 1.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agents/skills/claude-code/add-harness-component/skill.yaml +1 -0
- package/dist/agents/skills/claude-code/align-documentation/skill.yaml +1 -0
- package/dist/agents/skills/claude-code/check-mechanical-constraints/skill.yaml +1 -0
- package/dist/agents/skills/claude-code/cleanup-dead-code/skill.yaml +1 -0
- package/dist/agents/skills/claude-code/detect-doc-drift/skill.yaml +1 -0
- package/dist/agents/skills/claude-code/enforce-architecture/skill.yaml +1 -0
- package/dist/agents/skills/claude-code/harness-accessibility/skill.yaml +1 -0
- package/dist/agents/skills/claude-code/harness-api-design/SKILL.md +304 -0
- package/dist/agents/skills/claude-code/harness-api-design/skill.yaml +74 -0
- package/dist/agents/skills/claude-code/harness-architecture-advisor/skill.yaml +1 -0
- package/dist/agents/skills/claude-code/harness-auth/SKILL.md +279 -0
- package/dist/agents/skills/claude-code/harness-auth/skill.yaml +81 -0
- package/dist/agents/skills/claude-code/harness-autopilot/skill.yaml +1 -0
- package/dist/agents/skills/claude-code/harness-brainstorming/skill.yaml +1 -0
- package/dist/agents/skills/claude-code/harness-caching/SKILL.md +309 -0
- package/dist/agents/skills/claude-code/harness-caching/skill.yaml +73 -0
- package/dist/agents/skills/claude-code/harness-chaos/SKILL.md +295 -0
- package/dist/agents/skills/claude-code/harness-chaos/skill.yaml +72 -0
- package/dist/agents/skills/claude-code/harness-code-review/skill.yaml +1 -0
- package/dist/agents/skills/claude-code/harness-codebase-cleanup/skill.yaml +1 -0
- package/dist/agents/skills/claude-code/harness-compliance/SKILL.md +303 -0
- package/dist/agents/skills/claude-code/harness-compliance/skill.yaml +78 -0
- package/dist/agents/skills/claude-code/harness-containerization/SKILL.md +284 -0
- package/dist/agents/skills/claude-code/harness-containerization/skill.yaml +80 -0
- package/dist/agents/skills/claude-code/harness-data-pipeline/SKILL.md +274 -0
- package/dist/agents/skills/claude-code/harness-data-pipeline/skill.yaml +81 -0
- package/dist/agents/skills/claude-code/harness-data-validation/SKILL.md +343 -0
- package/dist/agents/skills/claude-code/harness-data-validation/skill.yaml +75 -0
- package/dist/agents/skills/claude-code/harness-database/SKILL.md +258 -0
- package/dist/agents/skills/claude-code/harness-database/skill.yaml +80 -0
- package/dist/agents/skills/claude-code/harness-debugging/skill.yaml +1 -0
- package/dist/agents/skills/claude-code/harness-dependency-health/skill.yaml +1 -0
- package/dist/agents/skills/claude-code/harness-deployment/SKILL.md +255 -0
- package/dist/agents/skills/claude-code/harness-deployment/skill.yaml +77 -0
- package/dist/agents/skills/claude-code/harness-design/skill.yaml +1 -0
- package/dist/agents/skills/claude-code/harness-design-mobile/skill.yaml +1 -0
- package/dist/agents/skills/claude-code/harness-design-system/skill.yaml +1 -0
- package/dist/agents/skills/claude-code/harness-design-web/skill.yaml +1 -0
- package/dist/agents/skills/claude-code/harness-diagnostics/skill.yaml +1 -0
- package/dist/agents/skills/claude-code/harness-docs-pipeline/skill.yaml +1 -0
- package/dist/agents/skills/claude-code/harness-dx/SKILL.md +276 -0
- package/dist/agents/skills/claude-code/harness-dx/skill.yaml +76 -0
- package/dist/agents/skills/claude-code/harness-e2e/SKILL.md +245 -0
- package/dist/agents/skills/claude-code/harness-e2e/skill.yaml +78 -0
- package/dist/agents/skills/claude-code/harness-event-driven/SKILL.md +280 -0
- package/dist/agents/skills/claude-code/harness-event-driven/skill.yaml +77 -0
- package/dist/agents/skills/claude-code/harness-execution/skill.yaml +1 -0
- package/dist/agents/skills/claude-code/harness-feature-flags/SKILL.md +287 -0
- package/dist/agents/skills/claude-code/harness-feature-flags/skill.yaml +74 -0
- package/dist/agents/skills/claude-code/harness-git-workflow/skill.yaml +1 -0
- package/dist/agents/skills/claude-code/harness-hotspot-detector/skill.yaml +1 -0
- package/dist/agents/skills/claude-code/harness-i18n/skill.yaml +1 -0
- package/dist/agents/skills/claude-code/harness-i18n-process/skill.yaml +1 -0
- package/dist/agents/skills/claude-code/harness-i18n-workflow/skill.yaml +1 -0
- package/dist/agents/skills/claude-code/harness-impact-analysis/skill.yaml +1 -0
- package/dist/agents/skills/claude-code/harness-incident-response/SKILL.md +223 -0
- package/dist/agents/skills/claude-code/harness-incident-response/skill.yaml +78 -0
- package/dist/agents/skills/claude-code/harness-infrastructure-as-code/SKILL.md +279 -0
- package/dist/agents/skills/claude-code/harness-infrastructure-as-code/skill.yaml +80 -0
- package/dist/agents/skills/claude-code/harness-integration-test/SKILL.md +271 -0
- package/dist/agents/skills/claude-code/harness-integration-test/skill.yaml +73 -0
- package/dist/agents/skills/claude-code/harness-integrity/skill.yaml +1 -0
- package/dist/agents/skills/claude-code/harness-knowledge-mapper/skill.yaml +1 -0
- package/dist/agents/skills/claude-code/harness-load-testing/SKILL.md +274 -0
- package/dist/agents/skills/claude-code/harness-load-testing/skill.yaml +79 -0
- package/dist/agents/skills/claude-code/harness-ml-ops/SKILL.md +341 -0
- package/dist/agents/skills/claude-code/harness-ml-ops/skill.yaml +79 -0
- package/dist/agents/skills/claude-code/harness-mobile-patterns/SKILL.md +326 -0
- package/dist/agents/skills/claude-code/harness-mobile-patterns/skill.yaml +82 -0
- package/dist/agents/skills/claude-code/harness-mutation-test/SKILL.md +251 -0
- package/dist/agents/skills/claude-code/harness-mutation-test/skill.yaml +70 -0
- package/dist/agents/skills/claude-code/harness-observability/SKILL.md +283 -0
- package/dist/agents/skills/claude-code/harness-observability/skill.yaml +78 -0
- package/dist/agents/skills/claude-code/harness-onboarding/skill.yaml +1 -0
- package/dist/agents/skills/claude-code/harness-parallel-agents/skill.yaml +1 -0
- package/dist/agents/skills/claude-code/harness-perf/skill.yaml +1 -0
- package/dist/agents/skills/claude-code/harness-perf-tdd/skill.yaml +1 -0
- package/dist/agents/skills/claude-code/harness-planning/skill.yaml +1 -0
- package/dist/agents/skills/claude-code/harness-pre-commit-review/skill.yaml +1 -0
- package/dist/agents/skills/claude-code/harness-product-spec/SKILL.md +285 -0
- package/dist/agents/skills/claude-code/harness-product-spec/skill.yaml +72 -0
- package/dist/agents/skills/claude-code/harness-property-test/SKILL.md +281 -0
- package/dist/agents/skills/claude-code/harness-property-test/skill.yaml +71 -0
- package/dist/agents/skills/claude-code/harness-refactoring/skill.yaml +1 -0
- package/dist/agents/skills/claude-code/harness-release-readiness/skill.yaml +1 -0
- package/dist/agents/skills/claude-code/harness-resilience/SKILL.md +255 -0
- package/dist/agents/skills/claude-code/harness-resilience/skill.yaml +76 -0
- package/dist/agents/skills/claude-code/harness-roadmap/skill.yaml +1 -0
- package/dist/agents/skills/claude-code/harness-secrets/SKILL.md +293 -0
- package/dist/agents/skills/claude-code/harness-secrets/skill.yaml +76 -0
- package/dist/agents/skills/claude-code/harness-security-review/skill.yaml +1 -0
- package/dist/agents/skills/claude-code/harness-security-scan/skill.yaml +1 -0
- package/dist/agents/skills/claude-code/harness-skill-authoring/skill.yaml +1 -0
- package/dist/agents/skills/claude-code/harness-soundness-review/skill.yaml +1 -0
- package/dist/agents/skills/claude-code/harness-sql-review/SKILL.md +315 -0
- package/dist/agents/skills/claude-code/harness-sql-review/skill.yaml +74 -0
- package/dist/agents/skills/claude-code/harness-state-management/skill.yaml +1 -0
- package/dist/agents/skills/claude-code/harness-tdd/skill.yaml +1 -0
- package/dist/agents/skills/claude-code/harness-test-advisor/skill.yaml +1 -0
- package/dist/agents/skills/claude-code/harness-test-data/SKILL.md +268 -0
- package/dist/agents/skills/claude-code/harness-test-data/skill.yaml +74 -0
- package/dist/agents/skills/claude-code/harness-ux-copy/SKILL.md +271 -0
- package/dist/agents/skills/claude-code/harness-ux-copy/skill.yaml +77 -0
- package/dist/agents/skills/claude-code/harness-verification/skill.yaml +1 -0
- package/dist/agents/skills/claude-code/harness-verify/skill.yaml +1 -0
- package/dist/agents/skills/claude-code/harness-visual-regression/SKILL.md +257 -0
- package/dist/agents/skills/claude-code/harness-visual-regression/skill.yaml +74 -0
- package/dist/agents/skills/claude-code/initialize-harness-project/skill.yaml +1 -0
- package/dist/agents/skills/claude-code/validate-context-engineering/skill.yaml +1 -0
- package/dist/agents/skills/gemini-cli/add-harness-component/skill.yaml +1 -0
- package/dist/agents/skills/gemini-cli/align-documentation/skill.yaml +1 -0
- package/dist/agents/skills/gemini-cli/check-mechanical-constraints/skill.yaml +1 -0
- package/dist/agents/skills/gemini-cli/cleanup-dead-code/skill.yaml +1 -0
- package/dist/agents/skills/gemini-cli/detect-doc-drift/skill.yaml +1 -0
- package/dist/agents/skills/gemini-cli/enforce-architecture/skill.yaml +1 -0
- package/dist/agents/skills/gemini-cli/harness-accessibility/skill.yaml +1 -0
- package/dist/agents/skills/gemini-cli/harness-api-design/SKILL.md +304 -0
- package/dist/agents/skills/gemini-cli/harness-api-design/skill.yaml +74 -0
- package/dist/agents/skills/gemini-cli/harness-architecture-advisor/skill.yaml +1 -0
- package/dist/agents/skills/gemini-cli/harness-auth/SKILL.md +279 -0
- package/dist/agents/skills/gemini-cli/harness-auth/skill.yaml +81 -0
- package/dist/agents/skills/gemini-cli/harness-autopilot/skill.yaml +1 -0
- package/dist/agents/skills/gemini-cli/harness-brainstorming/skill.yaml +1 -0
- package/dist/agents/skills/gemini-cli/harness-caching/SKILL.md +309 -0
- package/dist/agents/skills/gemini-cli/harness-caching/skill.yaml +73 -0
- package/dist/agents/skills/gemini-cli/harness-chaos/SKILL.md +295 -0
- package/dist/agents/skills/gemini-cli/harness-chaos/skill.yaml +72 -0
- package/dist/agents/skills/gemini-cli/harness-code-review/skill.yaml +1 -0
- package/dist/agents/skills/gemini-cli/harness-codebase-cleanup/skill.yaml +1 -0
- package/dist/agents/skills/gemini-cli/harness-compliance/SKILL.md +303 -0
- package/dist/agents/skills/gemini-cli/harness-compliance/skill.yaml +78 -0
- package/dist/agents/skills/gemini-cli/harness-containerization/SKILL.md +284 -0
- package/dist/agents/skills/gemini-cli/harness-containerization/skill.yaml +80 -0
- package/dist/agents/skills/gemini-cli/harness-data-pipeline/SKILL.md +274 -0
- package/dist/agents/skills/gemini-cli/harness-data-pipeline/skill.yaml +81 -0
- package/dist/agents/skills/gemini-cli/harness-data-validation/SKILL.md +343 -0
- package/dist/agents/skills/gemini-cli/harness-data-validation/skill.yaml +75 -0
- package/dist/agents/skills/gemini-cli/harness-database/SKILL.md +258 -0
- package/dist/agents/skills/gemini-cli/harness-database/skill.yaml +80 -0
- package/dist/agents/skills/gemini-cli/harness-debugging/skill.yaml +1 -0
- package/dist/agents/skills/gemini-cli/harness-dependency-health/skill.yaml +1 -0
- package/dist/agents/skills/gemini-cli/harness-deployment/SKILL.md +255 -0
- package/dist/agents/skills/gemini-cli/harness-deployment/skill.yaml +77 -0
- package/dist/agents/skills/gemini-cli/harness-design/skill.yaml +1 -0
- package/dist/agents/skills/gemini-cli/harness-design-mobile/skill.yaml +1 -0
- package/dist/agents/skills/gemini-cli/harness-design-system/skill.yaml +1 -0
- package/dist/agents/skills/gemini-cli/harness-design-web/skill.yaml +1 -0
- package/dist/agents/skills/gemini-cli/harness-diagnostics/skill.yaml +1 -0
- package/dist/agents/skills/gemini-cli/harness-docs-pipeline/skill.yaml +1 -0
- package/dist/agents/skills/gemini-cli/harness-dx/SKILL.md +276 -0
- package/dist/agents/skills/gemini-cli/harness-dx/skill.yaml +76 -0
- package/dist/agents/skills/gemini-cli/harness-e2e/SKILL.md +245 -0
- package/dist/agents/skills/gemini-cli/harness-e2e/skill.yaml +78 -0
- package/dist/agents/skills/gemini-cli/harness-event-driven/SKILL.md +280 -0
- package/dist/agents/skills/gemini-cli/harness-event-driven/skill.yaml +77 -0
- package/dist/agents/skills/gemini-cli/harness-execution/skill.yaml +1 -0
- package/dist/agents/skills/gemini-cli/harness-feature-flags/SKILL.md +287 -0
- package/dist/agents/skills/gemini-cli/harness-feature-flags/skill.yaml +74 -0
- package/dist/agents/skills/gemini-cli/harness-git-workflow/skill.yaml +1 -0
- package/dist/agents/skills/gemini-cli/harness-hotspot-detector/skill.yaml +1 -0
- package/dist/agents/skills/gemini-cli/harness-i18n/skill.yaml +1 -0
- package/dist/agents/skills/gemini-cli/harness-i18n-process/skill.yaml +1 -0
- package/dist/agents/skills/gemini-cli/harness-i18n-workflow/skill.yaml +1 -0
- package/dist/agents/skills/gemini-cli/harness-impact-analysis/skill.yaml +1 -0
- package/dist/agents/skills/gemini-cli/harness-incident-response/SKILL.md +223 -0
- package/dist/agents/skills/gemini-cli/harness-incident-response/skill.yaml +78 -0
- package/dist/agents/skills/gemini-cli/harness-infrastructure-as-code/SKILL.md +279 -0
- package/dist/agents/skills/gemini-cli/harness-infrastructure-as-code/skill.yaml +80 -0
- package/dist/agents/skills/gemini-cli/harness-integration-test/SKILL.md +271 -0
- package/dist/agents/skills/gemini-cli/harness-integration-test/skill.yaml +73 -0
- package/dist/agents/skills/gemini-cli/harness-integrity/skill.yaml +1 -0
- package/dist/agents/skills/gemini-cli/harness-knowledge-mapper/skill.yaml +1 -0
- package/dist/agents/skills/gemini-cli/harness-load-testing/SKILL.md +274 -0
- package/dist/agents/skills/gemini-cli/harness-load-testing/skill.yaml +79 -0
- package/dist/agents/skills/gemini-cli/harness-ml-ops/SKILL.md +341 -0
- package/dist/agents/skills/gemini-cli/harness-ml-ops/skill.yaml +79 -0
- package/dist/agents/skills/gemini-cli/harness-mobile-patterns/SKILL.md +326 -0
- package/dist/agents/skills/gemini-cli/harness-mobile-patterns/skill.yaml +82 -0
- package/dist/agents/skills/gemini-cli/harness-mutation-test/SKILL.md +251 -0
- package/dist/agents/skills/gemini-cli/harness-mutation-test/skill.yaml +70 -0
- package/dist/agents/skills/gemini-cli/harness-observability/SKILL.md +283 -0
- package/dist/agents/skills/gemini-cli/harness-observability/skill.yaml +78 -0
- package/dist/agents/skills/gemini-cli/harness-onboarding/skill.yaml +1 -0
- package/dist/agents/skills/gemini-cli/harness-parallel-agents/skill.yaml +1 -0
- package/dist/agents/skills/gemini-cli/harness-perf/skill.yaml +1 -0
- package/dist/agents/skills/gemini-cli/harness-perf-tdd/skill.yaml +1 -0
- package/dist/agents/skills/gemini-cli/harness-planning/skill.yaml +1 -0
- package/dist/agents/skills/gemini-cli/harness-pre-commit-review/skill.yaml +1 -0
- package/dist/agents/skills/gemini-cli/harness-product-spec/SKILL.md +285 -0
- package/dist/agents/skills/gemini-cli/harness-product-spec/skill.yaml +72 -0
- package/dist/agents/skills/gemini-cli/harness-property-test/SKILL.md +281 -0
- package/dist/agents/skills/gemini-cli/harness-property-test/skill.yaml +71 -0
- package/dist/agents/skills/gemini-cli/harness-refactoring/skill.yaml +1 -0
- package/dist/agents/skills/gemini-cli/harness-release-readiness/skill.yaml +1 -0
- package/dist/agents/skills/gemini-cli/harness-resilience/SKILL.md +255 -0
- package/dist/agents/skills/gemini-cli/harness-resilience/skill.yaml +76 -0
- package/dist/agents/skills/gemini-cli/harness-roadmap/skill.yaml +1 -0
- package/dist/agents/skills/gemini-cli/harness-secrets/SKILL.md +293 -0
- package/dist/agents/skills/gemini-cli/harness-secrets/skill.yaml +76 -0
- package/dist/agents/skills/gemini-cli/harness-security-review/SKILL.md +240 -0
- package/dist/agents/skills/gemini-cli/harness-security-review/skill.yaml +1 -0
- package/dist/agents/skills/gemini-cli/harness-security-scan/skill.yaml +1 -0
- package/dist/agents/skills/gemini-cli/harness-skill-authoring/skill.yaml +1 -0
- package/dist/agents/skills/gemini-cli/harness-soundness-review/skill.yaml +1 -0
- package/dist/agents/skills/gemini-cli/harness-sql-review/SKILL.md +315 -0
- package/dist/agents/skills/gemini-cli/harness-sql-review/skill.yaml +74 -0
- package/dist/agents/skills/gemini-cli/harness-state-management/skill.yaml +1 -0
- package/dist/agents/skills/gemini-cli/harness-tdd/skill.yaml +1 -0
- package/dist/agents/skills/gemini-cli/harness-test-advisor/skill.yaml +1 -0
- package/dist/agents/skills/gemini-cli/harness-test-data/SKILL.md +268 -0
- package/dist/agents/skills/gemini-cli/harness-test-data/skill.yaml +74 -0
- package/dist/agents/skills/gemini-cli/harness-ux-copy/SKILL.md +271 -0
- package/dist/agents/skills/gemini-cli/harness-ux-copy/skill.yaml +77 -0
- package/dist/agents/skills/gemini-cli/harness-verification/skill.yaml +1 -0
- package/dist/agents/skills/gemini-cli/harness-verify/skill.yaml +1 -0
- package/dist/agents/skills/gemini-cli/harness-visual-regression/SKILL.md +257 -0
- package/dist/agents/skills/gemini-cli/harness-visual-regression/skill.yaml +74 -0
- package/dist/agents/skills/gemini-cli/initialize-harness-project/skill.yaml +1 -0
- package/dist/agents/skills/gemini-cli/validate-context-engineering/skill.yaml +1 -0
- package/dist/{agents-md-P2RHSUV7.js → agents-md-XU3BHE22.js} +1 -1
- package/dist/{architecture-ESOOE26S.js → architecture-2R5Z4ZAF.js} +2 -2
- package/dist/bin/harness-mcp.js +14 -13
- package/dist/bin/harness.js +22 -21
- package/dist/{check-phase-gate-S2MZKLFQ.js → check-phase-gate-2OFZ7OWW.js} +3 -2
- package/dist/{chunk-LD3DKUK5.js → chunk-4ZMOCPYO.js} +1 -1
- package/dist/{chunk-5VY23YK3.js → chunk-65FRIL4D.js} +2 -2
- package/dist/{chunk-L2KLU56K.js → chunk-AOZRDOIP.js} +2 -2
- package/dist/{chunk-MACVXDZK.js → chunk-DZS7CJKL.js} +4 -4
- package/dist/{chunk-7PZWR4LI.js → chunk-IM32EEDM.js} +9 -9
- package/dist/{chunk-2YPZKGAG.js → chunk-IMFVFNJE.js} +1 -1
- package/dist/{chunk-HD4IBGLA.js → chunk-N5G5QMS3.js} +24 -1
- package/dist/{chunk-MI5XJQDY.js → chunk-ND6PNADU.js} +23 -9
- package/dist/{chunk-7KQSUZVG.js → chunk-NERR4TAO.js} +729 -436
- package/dist/{chunk-PSNN4LWX.js → chunk-NOPU4RZ4.js} +2 -2
- package/dist/{chunk-KELT6K6M.js → chunk-PQ5YK4AY.js} +287 -258
- package/dist/{chunk-WPPDRIJL.js → chunk-QY4T6YAZ.js} +3 -3
- package/dist/{chunk-RZSUJBZZ.js → chunk-SSKDAOX5.js} +31 -28
- package/dist/{chunk-2VU4MFM3.js → chunk-TKJZKICB.js} +6 -6
- package/dist/{chunk-GNGELAXY.js → chunk-TS3XWPW5.js} +1 -1
- package/dist/chunk-UAX4I5ZE.js +217 -0
- package/dist/{chunk-VRFZWGMS.js → chunk-XYLGHKG6.js} +5 -1
- package/dist/{chunk-6N4R6FVX.js → chunk-YBJ262QL.js} +1 -1
- package/dist/{chunk-3KOLLWWE.js → chunk-Z77YQRQT.js} +11 -207
- package/dist/{ci-workflow-4NYBUG6R.js → ci-workflow-EHV65NQB.js} +1 -1
- package/dist/{create-skill-WPXHSLX2.js → create-skill-XSWHMSM5.js} +2 -2
- package/dist/{dist-WF4C7A4A.js → dist-2B363XUH.js} +1 -1
- package/dist/{dist-M6BQODWC.js → dist-HXHWB7SV.js} +2 -2
- package/dist/{docs-BPYCN2DR.js → docs-FZOPM4GK.js} +4 -2
- package/dist/{engine-LXLIWQQ3.js → engine-OL4T6NZS.js} +1 -1
- package/dist/{entropy-4VDVV5CR.js → entropy-LVHJMFGH.js} +2 -2
- package/dist/{feedback-63QB5RCA.js → feedback-IHLVLMRD.js} +1 -1
- package/dist/{generate-agent-definitions-QABOJG56.js → generate-agent-definitions-64S3CLEZ.js} +3 -3
- package/dist/{glob-helper-5OHBUQAI.js → glob-helper-R5FXNUPS.js} +1 -1
- package/dist/{graph-loader-KO4GJ5N2.js → graph-loader-GJZ4FN4Y.js} +1 -1
- package/dist/index.d.ts +35 -8
- package/dist/index.js +23 -21
- package/dist/{loader-Z2IT7QX3.js → loader-DPYFB6R6.js} +1 -1
- package/dist/{mcp-KQHEL5IF.js → mcp-JQUI7BVZ.js} +14 -13
- package/dist/{performance-26BH47O4.js → performance-ZTVSUANN.js} +2 -2
- package/dist/{review-pipeline-GHR3WFBI.js → review-pipeline-76JHKGSV.js} +1 -1
- package/dist/{runtime-PDWD7UIK.js → runtime-X7U6SC7K.js} +1 -1
- package/dist/{security-UQFUZXEN.js → security-FWQZF2IZ.js} +1 -1
- package/dist/skill-executor-XZLYZYAK.js +8 -0
- package/dist/{validate-N7QJOKFZ.js → validate-GCHZJIL7.js} +2 -2
- package/dist/{validate-cross-check-EDQ5QGTM.js → validate-cross-check-STFHYMAZ.js} +1 -1
- package/package.json +3 -3
- package/dist/skill-executor-RG45LUO5.js +0 -8
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
# Harness SQL Review
|
|
2
|
+
|
|
3
|
+
> Adversarial review of SQL queries for performance anti-patterns, missing indexes, N+1 queries, and unsafe operations. Analyzes raw SQL, ORM-generated queries, and migration scripts to produce optimization recommendations with estimated impact.
|
|
4
|
+
|
|
5
|
+
## When to Use
|
|
6
|
+
|
|
7
|
+
- When reviewing a PR that adds or modifies SQL queries, repository methods, or database access patterns
|
|
8
|
+
- When investigating slow database performance or timeout issues
|
|
9
|
+
- When adding new database tables or indexes and validating query access patterns
|
|
10
|
+
- NOT for schema design or migration safety (use harness-database)
|
|
11
|
+
- NOT for data pipeline DAG structure or ETL patterns (use harness-data-pipeline)
|
|
12
|
+
- NOT for ORM selection or configuration decisions (use harness-database)
|
|
13
|
+
|
|
14
|
+
## Process
|
|
15
|
+
|
|
16
|
+
### Phase 1: SCAN -- Locate SQL Queries
|
|
17
|
+
|
|
18
|
+
1. **Resolve project root.** Use provided path or cwd.
|
|
19
|
+
|
|
20
|
+
2. **Detect SQL dialect.** Determine the database from project configuration:
|
|
21
|
+
- PostgreSQL: `DATABASE_URL` containing `postgres`, Prisma `provider = "postgresql"`, `pg` package
|
|
22
|
+
- MySQL: `DATABASE_URL` containing `mysql`, Prisma `provider = "mysql"`, `mysql2` package
|
|
23
|
+
- SQLite: `.sqlite` or `.db` files, Prisma `provider = "sqlite"`, `better-sqlite3` package
|
|
24
|
+
- MSSQL: `DATABASE_URL` containing `sqlserver`, `mssql` or `tedious` package
|
|
25
|
+
- Override with `--dialect` if auto-detection fails
|
|
26
|
+
|
|
27
|
+
3. **Extract raw SQL queries.** Scan source files for:
|
|
28
|
+
- SQL string literals: template literals containing `SELECT`, `INSERT`, `UPDATE`, `DELETE`, `CREATE`
|
|
29
|
+
- Query builder calls: `.query()`, `.raw()`, `.execute()`, `$queryRaw`, `$executeRaw`
|
|
30
|
+
- SQL files: `*.sql` in `queries/`, `src/**/sql/`, migration directories
|
|
31
|
+
- Stored procedures and views referenced in application code
|
|
32
|
+
|
|
33
|
+
4. **Extract ORM queries.** Identify ORM usage and extract the implied SQL:
|
|
34
|
+
- **Prisma:** `findMany`, `findUnique`, `include`, `select` with nested relations
|
|
35
|
+
- **TypeORM:** `createQueryBuilder`, `find` with `relations`, `@OneToMany` eager loading
|
|
36
|
+
- **Sequelize:** `findAll` with `include`, raw queries
|
|
37
|
+
- **Knex:** query chain analysis (`.select()`, `.where()`, `.join()`)
|
|
38
|
+
- **Drizzle:** query builder chains and relational queries
|
|
39
|
+
|
|
40
|
+
5. **Scope to PR changes.** If triggered by a PR, focus on queries in changed files. Also scan unchanged files that import changed models (they may be affected by schema changes).
|
|
41
|
+
|
|
42
|
+
6. **Build query inventory.** For each query, record:
|
|
43
|
+
- Source file and line number
|
|
44
|
+
- Query type (SELECT, INSERT, UPDATE, DELETE, DDL)
|
|
45
|
+
- Tables accessed
|
|
46
|
+
- Whether it is in a loop (potential N+1)
|
|
47
|
+
- Estimated complexity (simple, join, subquery, CTE, window function)
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
### Phase 2: ANALYZE -- Evaluate Query Patterns
|
|
52
|
+
|
|
53
|
+
1. **Detect N+1 queries.** The most common and impactful anti-pattern:
|
|
54
|
+
- Look for queries inside loops: `for` / `forEach` / `map` containing `await db.query`
|
|
55
|
+
- Look for ORM eager loading gaps: `findMany` followed by individual `findUnique` per result
|
|
56
|
+
- Look for GraphQL resolvers that query per-field without DataLoader
|
|
57
|
+
- Classify: **Error** if in a known hot path, **Warning** if in administrative code
|
|
58
|
+
|
|
59
|
+
2. **Detect missing indexes.** For each `WHERE`, `JOIN`, and `ORDER BY` clause:
|
|
60
|
+
- Identify the columns being filtered, joined, or sorted
|
|
61
|
+
- Check if a supporting index exists (read migration files, `CREATE INDEX` statements, Prisma `@@index`)
|
|
62
|
+
- Flag unindexed columns on tables likely to be large (referenced in multiple queries or with `count` operations)
|
|
63
|
+
- Recommend composite indexes when queries filter on multiple columns
|
|
64
|
+
|
|
65
|
+
3. **Detect full table scans.** Flag queries that:
|
|
66
|
+
- Use `SELECT *` on large tables without a `WHERE` clause
|
|
67
|
+
- Use `LIKE '%pattern%'` (leading wildcard prevents index use)
|
|
68
|
+
- Use functions on indexed columns in `WHERE` (`WHERE LOWER(email) = ...`)
|
|
69
|
+
- Use `OR` across different columns without index support
|
|
70
|
+
- Use `NOT IN` with large subqueries
|
|
71
|
+
|
|
72
|
+
4. **Detect unsafe operations.** Flag queries that:
|
|
73
|
+
- `UPDATE` or `DELETE` without a `WHERE` clause
|
|
74
|
+
- Use `TRUNCATE` in application code (should be migration/admin only)
|
|
75
|
+
- Perform DDL (`ALTER TABLE`, `DROP`) in application code
|
|
76
|
+
- Use `SELECT ... FOR UPDATE` without a transaction
|
|
77
|
+
- Have unbounded result sets (`SELECT` without `LIMIT` on user-facing endpoints)
|
|
78
|
+
|
|
79
|
+
5. **Detect join inefficiencies.** Evaluate:
|
|
80
|
+
- Cartesian products (missing `ON` clause or cross join without intent)
|
|
81
|
+
- Joining on non-indexed columns
|
|
82
|
+
- Joining large tables without filtering first (suggest subquery or CTE)
|
|
83
|
+
- Multiple joins that could be replaced with a single denormalized query
|
|
84
|
+
- Correlated subqueries that could be rewritten as joins
|
|
85
|
+
|
|
86
|
+
6. **Detect transaction issues.** Check for:
|
|
87
|
+
- Long-running transactions (multiple queries without commit)
|
|
88
|
+
- Read-after-write without transaction isolation
|
|
89
|
+
- Deadlock-prone patterns (acquiring locks in inconsistent order)
|
|
90
|
+
- Missing transactions on multi-step writes
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
### Phase 3: OPTIMIZE -- Produce Recommendations
|
|
95
|
+
|
|
96
|
+
1. **Generate optimized query alternatives.** For each finding, provide:
|
|
97
|
+
- The original query (with file location)
|
|
98
|
+
- The optimized alternative
|
|
99
|
+
- Explanation of why the optimization helps
|
|
100
|
+
- Estimated impact (order of magnitude: "reduces from O(N) queries to O(1)")
|
|
101
|
+
|
|
102
|
+
2. **Recommend index additions.** For each missing index:
|
|
103
|
+
|
|
104
|
+
```sql
|
|
105
|
+
-- Recommended: speeds up user lookup by email in login flow
|
|
106
|
+
-- Estimated impact: O(N) full scan -> O(log N) index seek
|
|
107
|
+
CREATE INDEX idx_users_email ON users (email);
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
Include:
|
|
111
|
+
- Index type recommendation (B-tree, hash, GIN, GiST) based on query pattern
|
|
112
|
+
- Composite index column order (most selective first)
|
|
113
|
+
- Partial index suggestions when queries always filter on a condition
|
|
114
|
+
|
|
115
|
+
3. **Recommend batching strategies for N+1.** Provide specific alternatives:
|
|
116
|
+
- ORM eager loading: show the `include` / `relations` / `with` syntax
|
|
117
|
+
- DataLoader pattern: show the DataLoader implementation for GraphQL resolvers
|
|
118
|
+
- `WHERE IN` batching: show the batched query for loop-based N+1
|
|
119
|
+
- SQL `JOIN` rewrite: show how to combine parent + child in one query
|
|
120
|
+
|
|
121
|
+
4. **Recommend query rewrites.** For complex subqueries and inefficient patterns:
|
|
122
|
+
- Correlated subquery -> JOIN or CTE
|
|
123
|
+
- `NOT IN` -> `NOT EXISTS` (NULL-safe and often faster)
|
|
124
|
+
- Multiple `UNION` -> single query with `CASE WHEN`
|
|
125
|
+
- `DISTINCT` on large result sets -> `GROUP BY` or `EXISTS`
|
|
126
|
+
- `SELECT *` -> explicit column list
|
|
127
|
+
|
|
128
|
+
5. **Prioritize by impact.** Order recommendations:
|
|
129
|
+
- N+1 queries in hot paths (highest impact)
|
|
130
|
+
- Missing indexes on high-traffic queries
|
|
131
|
+
- Unsafe operations (correctness risk)
|
|
132
|
+
- Query rewrites for efficiency
|
|
133
|
+
- Style and readability improvements
|
|
134
|
+
|
|
135
|
+
---
|
|
136
|
+
|
|
137
|
+
### Phase 4: VALIDATE -- Verify Optimization Correctness
|
|
138
|
+
|
|
139
|
+
1. **Verify semantic equivalence.** For every rewritten query:
|
|
140
|
+
- Does it return the same result set as the original?
|
|
141
|
+
- Does it handle NULL values the same way? (`NOT IN` vs `NOT EXISTS` differs on NULLs)
|
|
142
|
+
- Does it handle empty sets the same way?
|
|
143
|
+
- Does it maintain the same ordering?
|
|
144
|
+
|
|
145
|
+
2. **Verify index recommendations.** For each proposed index:
|
|
146
|
+
- Does the index cover the query it is intended to speed up?
|
|
147
|
+
- Does the index column order match the query filter order?
|
|
148
|
+
- Will the index cause write performance degradation? (flag if table has heavy write load)
|
|
149
|
+
- Are there existing indexes that already cover this query? (avoid duplicates)
|
|
150
|
+
|
|
151
|
+
3. **Check for regression risks.** Flag:
|
|
152
|
+
- Index additions on tables with high write throughput (may slow inserts)
|
|
153
|
+
- Query rewrites that increase memory usage (e.g., large `IN` lists)
|
|
154
|
+
- Eager loading that may fetch too much data (the "N+1 overcorrection" of loading everything)
|
|
155
|
+
- Batched queries that exceed the database's parameter limit
|
|
156
|
+
|
|
157
|
+
4. **Output structured report.** Present findings in review format:
|
|
158
|
+
|
|
159
|
+
```
|
|
160
|
+
SQL Review: [PASS/NEEDS_ATTENTION/FAIL]
|
|
161
|
+
Queries analyzed: N
|
|
162
|
+
Findings: E errors, W warnings, I info
|
|
163
|
+
|
|
164
|
+
ERRORS:
|
|
165
|
+
[SQL-N1-001] src/repositories/OrderRepository.ts:45
|
|
166
|
+
N+1 query in getOrdersWithItems(): queries items per order in loop
|
|
167
|
+
Current: 1 + N queries (N = number of orders)
|
|
168
|
+
Recommended: Single query with JOIN or Prisma include
|
|
169
|
+
Impact: O(N) -> O(1) database round trips
|
|
170
|
+
|
|
171
|
+
[SQL-UNSAFE-001] src/services/CleanupService.ts:23
|
|
172
|
+
DELETE without WHERE clause: db.execute("DELETE FROM temp_records")
|
|
173
|
+
Risk: Deletes all records if called outside intended context
|
|
174
|
+
Recommended: Add WHERE clause with date filter or use TRUNCATE in migration
|
|
175
|
+
|
|
176
|
+
WARNINGS:
|
|
177
|
+
[SQL-IDX-001] src/repositories/UserRepository.ts:78
|
|
178
|
+
Missing index: WHERE email = ? on users table (estimated 500K rows)
|
|
179
|
+
Recommended: CREATE INDEX idx_users_email ON users (email);
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
5. **Verify no new anti-patterns introduced.** Check that recommended optimizations do not introduce new problems (e.g., a JOIN recommendation that creates a Cartesian product, or an index recommendation on a column already indexed).
|
|
183
|
+
|
|
184
|
+
---
|
|
185
|
+
|
|
186
|
+
## Harness Integration
|
|
187
|
+
|
|
188
|
+
- **`harness skill run harness-sql-review`** -- Primary command for SQL query analysis.
|
|
189
|
+
- **`harness validate`** -- Run after applying query optimizations to verify project health.
|
|
190
|
+
- **`Glob`** -- Used to locate SQL files, repository files, DAO classes, and migration scripts.
|
|
191
|
+
- **`Grep`** -- Used to extract SQL strings, query builder calls, ORM methods, and index definitions.
|
|
192
|
+
- **`Read`** -- Used to read query files, repository implementations, and schema definitions.
|
|
193
|
+
- **`Write`** -- Used to generate optimized query files and index migration scripts.
|
|
194
|
+
- **`Bash`** -- Used to run `EXPLAIN` queries when database connection is available and to check migration files.
|
|
195
|
+
- **`emit_interaction`** -- Used to present the review report and confirm optimization approach for complex rewrites.
|
|
196
|
+
|
|
197
|
+
## Success Criteria
|
|
198
|
+
|
|
199
|
+
- All SQL queries in scope are inventoried with source location and type
|
|
200
|
+
- N+1 patterns are detected in both raw SQL and ORM usage
|
|
201
|
+
- Missing indexes are identified with specific `CREATE INDEX` recommendations
|
|
202
|
+
- Unsafe operations are flagged with risk assessment
|
|
203
|
+
- Optimized alternatives are semantically equivalent to originals
|
|
204
|
+
- Recommendations are prioritized by estimated performance impact
|
|
205
|
+
- Report follows structured format with actionable findings
|
|
206
|
+
|
|
207
|
+
## Examples
|
|
208
|
+
|
|
209
|
+
### Example: Express.js API with Prisma ORM
|
|
210
|
+
|
|
211
|
+
```
|
|
212
|
+
Phase 1: SCAN
|
|
213
|
+
Dialect: PostgreSQL (detected from DATABASE_URL)
|
|
214
|
+
ORM: Prisma 5.10
|
|
215
|
+
Queries found: 34 (28 Prisma, 4 $queryRaw, 2 $executeRaw)
|
|
216
|
+
Scope: PR diff (3 changed repository files)
|
|
217
|
+
|
|
218
|
+
Phase 2: ANALYZE
|
|
219
|
+
[SQL-N1-001] src/routes/orders.ts:67
|
|
220
|
+
findMany orders then findUnique for each order's customer
|
|
221
|
+
Pattern: 1 query for orders + N queries for customers
|
|
222
|
+
[SQL-IDX-001] src/routes/products.ts:23
|
|
223
|
+
findMany with where: { category: catId, status: "active" }
|
|
224
|
+
No composite index on (category_id, status)
|
|
225
|
+
[SQL-UNSAFE-001] src/routes/admin.ts:89
|
|
226
|
+
$executeRaw DELETE FROM sessions (no WHERE clause)
|
|
227
|
+
|
|
228
|
+
Phase 3: OPTIMIZE
|
|
229
|
+
N+1 fix: Use Prisma include: { customer: true }
|
|
230
|
+
Index: CREATE INDEX idx_products_category_status ON products (category_id, status);
|
|
231
|
+
Safety: Add WHERE expired_at < NOW() to session cleanup
|
|
232
|
+
|
|
233
|
+
Phase 4: VALIDATE
|
|
234
|
+
All rewrites produce equivalent results: YES
|
|
235
|
+
Index does not duplicate existing: YES (checked schema.prisma)
|
|
236
|
+
Report: FAIL (1 N+1 error, 1 unsafe operation, 1 missing index)
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
### Example: Django REST Framework with Raw SQL
|
|
240
|
+
|
|
241
|
+
```
|
|
242
|
+
Phase 1: SCAN
|
|
243
|
+
Dialect: PostgreSQL (detected from DATABASES setting)
|
|
244
|
+
ORM: Django ORM + 6 raw SQL queries
|
|
245
|
+
Queries found: 52 (46 ORM, 6 raw)
|
|
246
|
+
Scope: full project audit
|
|
247
|
+
|
|
248
|
+
Phase 2: ANALYZE
|
|
249
|
+
[SQL-N1-001] views/analytics.py:34
|
|
250
|
+
for report in reports: report.author.name (lazy loading author per report)
|
|
251
|
+
[SQL-SCAN-001] queries/search.sql:12
|
|
252
|
+
WHERE description LIKE '%' || search_term || '%' (leading wildcard, full scan)
|
|
253
|
+
[SQL-JOIN-001] views/dashboard.py:78
|
|
254
|
+
3 sequential queries that could be a single JOIN
|
|
255
|
+
[SQL-TXN-001] views/transfer.py:45
|
|
256
|
+
Debit + credit operations without @transaction.atomic
|
|
257
|
+
|
|
258
|
+
Phase 3: OPTIMIZE
|
|
259
|
+
N+1: Add select_related('author') to queryset
|
|
260
|
+
Search: Recommend PostgreSQL full-text search with GIN index:
|
|
261
|
+
CREATE INDEX idx_items_description_gin ON items USING GIN (to_tsvector('english', description));
|
|
262
|
+
Join: Combine 3 queries into single query with LEFT JOIN
|
|
263
|
+
Transaction: Wrap debit+credit in @transaction.atomic
|
|
264
|
+
|
|
265
|
+
Phase 4: VALIDATE
|
|
266
|
+
All optimizations preserve correctness: YES
|
|
267
|
+
Full-text search returns equivalent results: YES (for word-boundary matches)
|
|
268
|
+
Report: FAIL (1 N+1, 1 missing transaction) + 2 warnings
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
### Example: Go Service with sqlx and Raw Queries
|
|
272
|
+
|
|
273
|
+
```
|
|
274
|
+
Phase 1: SCAN
|
|
275
|
+
Dialect: PostgreSQL (detected from connection string)
|
|
276
|
+
Query library: sqlx
|
|
277
|
+
Queries found: 28 (all raw SQL in repository files)
|
|
278
|
+
SQL files: 12 in queries/ directory
|
|
279
|
+
|
|
280
|
+
Phase 2: ANALYZE
|
|
281
|
+
[SQL-N1-001] internal/repo/order_repo.go:56
|
|
282
|
+
GetOrdersByUser calls GetItemsByOrderID in loop
|
|
283
|
+
[SQL-IDX-001] queries/search_users.sql:3
|
|
284
|
+
WHERE created_at > $1 AND status = $2 ORDER BY created_at
|
|
285
|
+
Missing composite index on (status, created_at)
|
|
286
|
+
[SQL-PERF-001] queries/report_daily.sql:8
|
|
287
|
+
Correlated subquery for calculating running total
|
|
288
|
+
Recommend: window function SUM() OVER (ORDER BY date)
|
|
289
|
+
|
|
290
|
+
Phase 3: OPTIMIZE
|
|
291
|
+
N+1: Rewrite with single query using LEFT JOIN and GROUP BY
|
|
292
|
+
Index: CREATE INDEX idx_users_status_created ON users (status, created_at);
|
|
293
|
+
Rewrite: Replace correlated subquery with:
|
|
294
|
+
SELECT date, amount, SUM(amount) OVER (ORDER BY date) as running_total
|
|
295
|
+
FROM daily_revenue;
|
|
296
|
+
|
|
297
|
+
Phase 4: VALIDATE
|
|
298
|
+
Window function produces identical results: YES
|
|
299
|
+
Index column order matches query pattern: YES (equality on status, range on created_at)
|
|
300
|
+
Report: NEEDS_ATTENTION (1 N+1 error, 1 missing index, 1 query rewrite)
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
## Gates
|
|
304
|
+
|
|
305
|
+
- **No approving N+1 queries in user-facing hot paths.** An N+1 query in an endpoint called per page load is always an error. It must be fixed with eager loading, batching, or a JOIN before the PR can merge.
|
|
306
|
+
- **No recommending indexes without checking for duplicates.** Before recommending a new index, verify no existing index covers the same columns. Duplicate indexes waste write performance and storage.
|
|
307
|
+
- **No rewriting queries without semantic equivalence verification.** Every optimized query must produce the same result set as the original, including NULL handling and ordering. If equivalence cannot be confirmed, flag the rewrite as "needs manual verification."
|
|
308
|
+
- **No ignoring unsafe DELETE/UPDATE without WHERE.** These are always errors regardless of context. Even if the developer intends to delete all records, it should be an explicit `TRUNCATE` or have a documented justification.
|
|
309
|
+
|
|
310
|
+
## Escalation
|
|
311
|
+
|
|
312
|
+
- **When query optimization requires schema changes:** If the best optimization involves adding a column, denormalizing a table, or changing a relationship, flag it: "Optimal fix for SQL-N1-001 requires a denormalized `customer_name` column on orders. This is a schema change that needs harness-database review."
|
|
313
|
+
- **When EXPLAIN ANALYZE is needed but no database connection is available:** Report that static analysis has limits: "SQL-IDX-001 is flagged based on static analysis. Running EXPLAIN ANALYZE on the actual database would confirm whether a sequential scan is occurring. Consider adding `--explain` with a database connection."
|
|
314
|
+
- **When an N+1 pattern is intentional:** If the developer asserts the N+1 is acceptable (e.g., N is always small, capped at 5), require documentation: "Add a comment explaining the bounded N (max 5) and a test asserting the bound."
|
|
315
|
+
- **When ORM-generated SQL cannot be optimized without dropping to raw SQL:** Present the tradeoff: "Prisma cannot express this query efficiently. Options: (A) use `$queryRaw` for this specific query, (B) accept the suboptimal query with a performance budget note, (C) restructure the data access pattern."
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
name: harness-sql-review
|
|
2
|
+
version: "1.0.0"
|
|
3
|
+
description: SQL query optimization, index analysis, N+1 detection, and query plan review
|
|
4
|
+
cognitive_mode: adversarial-reviewer
|
|
5
|
+
triggers:
|
|
6
|
+
- manual
|
|
7
|
+
- on_pr
|
|
8
|
+
platforms:
|
|
9
|
+
- claude-code
|
|
10
|
+
- gemini-cli
|
|
11
|
+
tools:
|
|
12
|
+
- Bash
|
|
13
|
+
- Read
|
|
14
|
+
- Write
|
|
15
|
+
- Edit
|
|
16
|
+
- Glob
|
|
17
|
+
- Grep
|
|
18
|
+
- emit_interaction
|
|
19
|
+
cli:
|
|
20
|
+
command: harness skill run harness-sql-review
|
|
21
|
+
args:
|
|
22
|
+
- name: path
|
|
23
|
+
description: Project root path
|
|
24
|
+
required: false
|
|
25
|
+
- name: dialect
|
|
26
|
+
description: "SQL dialect: postgresql, mysql, sqlite, mssql. Auto-detected when omitted."
|
|
27
|
+
required: false
|
|
28
|
+
- name: explain
|
|
29
|
+
description: Include EXPLAIN ANALYZE output for detected queries when database connection is available
|
|
30
|
+
required: false
|
|
31
|
+
mcp:
|
|
32
|
+
tool: run_skill
|
|
33
|
+
input:
|
|
34
|
+
skill: harness-sql-review
|
|
35
|
+
path: string
|
|
36
|
+
type: rigid
|
|
37
|
+
tier: 3
|
|
38
|
+
internal: false
|
|
39
|
+
keywords:
|
|
40
|
+
- SQL
|
|
41
|
+
- query optimization
|
|
42
|
+
- index
|
|
43
|
+
- N+1
|
|
44
|
+
- explain plan
|
|
45
|
+
- slow query
|
|
46
|
+
- join
|
|
47
|
+
- subquery
|
|
48
|
+
- query plan
|
|
49
|
+
- database performance
|
|
50
|
+
- EXPLAIN ANALYZE
|
|
51
|
+
stack_signals:
|
|
52
|
+
- "src/**/*.sql"
|
|
53
|
+
- "queries/"
|
|
54
|
+
- "src/**/repositories/**"
|
|
55
|
+
- "src/**/dao/**"
|
|
56
|
+
- "src/**/*query*"
|
|
57
|
+
- "src/**/*repository*"
|
|
58
|
+
phases:
|
|
59
|
+
- name: scan
|
|
60
|
+
description: Locate SQL queries in source files, ORMs, raw queries, and migration scripts
|
|
61
|
+
required: true
|
|
62
|
+
- name: analyze
|
|
63
|
+
description: Evaluate query patterns for N+1, missing indexes, full table scans, and join efficiency
|
|
64
|
+
required: true
|
|
65
|
+
- name: optimize
|
|
66
|
+
description: Produce optimized query alternatives, index recommendations, and batching strategies
|
|
67
|
+
required: true
|
|
68
|
+
- name: validate
|
|
69
|
+
description: Verify optimizations preserve correctness and estimate performance improvement
|
|
70
|
+
required: true
|
|
71
|
+
state:
|
|
72
|
+
persistent: false
|
|
73
|
+
files: []
|
|
74
|
+
depends_on: []
|
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
# Harness Test Data
|
|
2
|
+
|
|
3
|
+
> Test factories, fixtures, database seeding, and test data isolation. Establishes patterns for creating realistic, composable test data without coupling tests to specific database states.
|
|
4
|
+
|
|
5
|
+
## When to Use
|
|
6
|
+
|
|
7
|
+
- Setting up test data factories for a new domain model or entity
|
|
8
|
+
- Migrating from shared test fixtures to isolated factory-based test data
|
|
9
|
+
- Establishing database seeding for development, staging, or test environments
|
|
10
|
+
- NOT when writing the tests themselves (use harness-tdd or harness-e2e instead)
|
|
11
|
+
- NOT when designing the database schema (use harness-database instead)
|
|
12
|
+
- NOT when testing data pipeline transformations (use harness-data-validation instead)
|
|
13
|
+
|
|
14
|
+
## Process
|
|
15
|
+
|
|
16
|
+
### Phase 1: DETECT -- Identify Models and Existing Patterns
|
|
17
|
+
|
|
18
|
+
1. **Catalog domain models.** Scan for:
|
|
19
|
+
- ORM model definitions (Prisma schema, TypeORM entities, Django models, SQLAlchemy models)
|
|
20
|
+
- Database migration files that reveal table structures and relationships
|
|
21
|
+
- TypeScript/Python type definitions for domain objects
|
|
22
|
+
|
|
23
|
+
2. **Map model relationships.** For each model, identify:
|
|
24
|
+
- Required fields and their types
|
|
25
|
+
- Foreign key relationships and cardinality (one-to-one, one-to-many, many-to-many)
|
|
26
|
+
- Unique constraints, enums, and validation rules
|
|
27
|
+
- Default values and auto-generated fields (IDs, timestamps)
|
|
28
|
+
|
|
29
|
+
3. **Inventory existing test data patterns.** Search for:
|
|
30
|
+
- Factory files (fishery, factory-bot, factory_boy, rosie)
|
|
31
|
+
- Fixture files (JSON, YAML, SQL seed files)
|
|
32
|
+
- Inline test data (objects constructed directly in test files)
|
|
33
|
+
- Shared test setup files (beforeAll/beforeEach with data creation)
|
|
34
|
+
|
|
35
|
+
4. **Identify test data problems.** Flag:
|
|
36
|
+
- Tests that share mutable data (one test's setup affects another)
|
|
37
|
+
- Hardcoded IDs or magic values that break when database is reset
|
|
38
|
+
- Missing cleanup leading to test pollution
|
|
39
|
+
- Overly complex setup that obscures test intent
|
|
40
|
+
|
|
41
|
+
5. **Report findings.** Summarize: models found, existing patterns, and specific problems to address.
|
|
42
|
+
|
|
43
|
+
### Phase 2: DESIGN -- Choose Patterns and Plan Structure
|
|
44
|
+
|
|
45
|
+
1. **Select the factory pattern.** Based on the project's language and conventions:
|
|
46
|
+
- **TypeScript/JavaScript:** fishery (type-safe factories with traits), or a custom builder pattern
|
|
47
|
+
- **Python:** factory_boy (Django/SQLAlchemy integration), or Faker-based builders
|
|
48
|
+
- **Go:** custom builder functions with functional options pattern
|
|
49
|
+
- **Ruby:** factory_bot with traits and transient attributes
|
|
50
|
+
|
|
51
|
+
2. **Design the factory API.** Each factory must support:
|
|
52
|
+
- Default creation: `UserFactory.build()` returns a valid object with sensible defaults
|
|
53
|
+
- Override: `UserFactory.build({ name: 'Custom' })` overrides specific fields
|
|
54
|
+
- Traits: `UserFactory.build({ trait: 'admin' })` applies a named set of overrides
|
|
55
|
+
- Associations: `ProjectFactory.build()` automatically creates a related `User` owner
|
|
56
|
+
- Batch creation: `UserFactory.buildList(5)` returns an array
|
|
57
|
+
|
|
58
|
+
3. **Plan data relationships.** Define how factories handle foreign keys:
|
|
59
|
+
- Lazy association: create the related record only when needed
|
|
60
|
+
- Explicit association: pass an existing related record to avoid duplicates
|
|
61
|
+
- Transient attributes: factory parameters that control behavior but are not persisted
|
|
62
|
+
|
|
63
|
+
4. **Design cleanup strategy.** Choose based on test infrastructure:
|
|
64
|
+
- **Transaction rollback:** wrap each test in a transaction (fastest, requires framework support)
|
|
65
|
+
- **Truncation:** truncate tables between tests in dependency order
|
|
66
|
+
- **Deletion:** delete records created by the test using tracked IDs
|
|
67
|
+
- **Database recreation:** drop and recreate the test database per suite (slowest, most isolated)
|
|
68
|
+
|
|
69
|
+
5. **Define seed data tiers.** Separate:
|
|
70
|
+
- Reference data: enums, categories, roles -- loaded once, read-only
|
|
71
|
+
- Scenario data: realistic datasets for development and demos
|
|
72
|
+
- Test data: minimal data created per-test via factories
|
|
73
|
+
|
|
74
|
+
### Phase 3: SCAFFOLD -- Generate Factories and Seed Scripts
|
|
75
|
+
|
|
76
|
+
1. **Create the factory directory structure.** Follow the project's conventions:
|
|
77
|
+
- `tests/factories/` or `src/__tests__/factories/` for unit/integration test factories
|
|
78
|
+
- `seeds/` or `prisma/seed.ts` for database seeding scripts
|
|
79
|
+
- `tests/fixtures/` for static fixture data (JSON, YAML)
|
|
80
|
+
|
|
81
|
+
2. **Generate a factory for each domain model.** Each factory file contains:
|
|
82
|
+
- Default attribute definitions using realistic fake data (Faker for names, emails, dates)
|
|
83
|
+
- Traits for common variations (active/inactive, admin/member, draft/published)
|
|
84
|
+
- Association handling for required relationships
|
|
85
|
+
- Type safety: factory output matches the model type definition
|
|
86
|
+
|
|
87
|
+
3. **Generate a factory index.** Create a barrel file that exports all factories for easy importing:
|
|
88
|
+
|
|
89
|
+
```
|
|
90
|
+
import { UserFactory, ProjectFactory, TaskFactory } from '../factories';
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
4. **Create seed scripts.** Generate:
|
|
94
|
+
- Reference data seeder: loads enums, categories, and lookup tables
|
|
95
|
+
- Development seeder: creates a realistic dataset for local development
|
|
96
|
+
- Test seeder: minimal baseline data required by most tests
|
|
97
|
+
|
|
98
|
+
5. **Create cleanup utilities.** Generate:
|
|
99
|
+
- Database cleanup function that truncates or deletes in correct dependency order
|
|
100
|
+
- Test lifecycle hooks (beforeEach/afterEach) that integrate cleanup
|
|
101
|
+
- Transaction wrapper for test isolation (if supported by the ORM)
|
|
102
|
+
|
|
103
|
+
6. **Verify factories produce valid data.** Write a smoke test that builds one instance of every factory and validates it against the model schema.
|
|
104
|
+
|
|
105
|
+
### Phase 4: VALIDATE -- Verify Isolation, Composability, and Correctness
|
|
106
|
+
|
|
107
|
+
1. **Test factory defaults.** For each factory, verify:
|
|
108
|
+
- `build()` returns a valid object that passes model validation
|
|
109
|
+
- Required fields are populated with realistic values
|
|
110
|
+
- Unique fields generate unique values across multiple builds
|
|
111
|
+
- Associations are created when needed and reused when provided
|
|
112
|
+
|
|
113
|
+
2. **Test factory composition.** Verify:
|
|
114
|
+
- Traits compose correctly: `UserFactory.build({ traits: ['admin', 'verified'] })` applies both
|
|
115
|
+
- Overrides take precedence over defaults and traits
|
|
116
|
+
- Batch creation produces distinct records with unique identifiers
|
|
117
|
+
|
|
118
|
+
3. **Test data isolation.** Run the test suite with factory-generated data and verify:
|
|
119
|
+
- Tests pass in any execution order (run with randomized order flag)
|
|
120
|
+
- No test reads data created by another test
|
|
121
|
+
- Cleanup runs correctly between tests (no orphaned records)
|
|
122
|
+
|
|
123
|
+
4. **Test seed scripts.** Verify:
|
|
124
|
+
- Seed scripts are idempotent (running twice does not create duplicates)
|
|
125
|
+
- Reference data seeder can run against an empty database
|
|
126
|
+
- Development seeder creates a realistic, navigable dataset
|
|
127
|
+
|
|
128
|
+
5. **Run `harness validate`.** Confirm the project passes all harness checks with factory infrastructure in place.
|
|
129
|
+
|
|
130
|
+
### Graph Refresh
|
|
131
|
+
|
|
132
|
+
If a knowledge graph exists at `.harness/graph/`, refresh it after code changes to keep graph queries accurate:
|
|
133
|
+
|
|
134
|
+
```
|
|
135
|
+
harness scan [path]
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
## Harness Integration
|
|
139
|
+
|
|
140
|
+
- **`harness validate`** -- Run in VALIDATE phase after all factories and seed scripts are created. Confirms project health.
|
|
141
|
+
- **`harness check-deps`** -- Run after SCAFFOLD phase to ensure test factory dependencies (Faker, fishery) are in devDependencies, not dependencies.
|
|
142
|
+
- **`emit_interaction`** -- Used at design checkpoints to present factory pattern options and cleanup strategy choices to the human.
|
|
143
|
+
- **Grep** -- Used in DETECT phase to find inline test data, hardcoded IDs, and existing factory patterns.
|
|
144
|
+
- **Glob** -- Used to catalog model definitions, migration files, and existing fixture files.
|
|
145
|
+
|
|
146
|
+
## Success Criteria
|
|
147
|
+
|
|
148
|
+
- Every domain model has a corresponding factory with sensible defaults
|
|
149
|
+
- Factories produce valid objects that pass model validation without any overrides
|
|
150
|
+
- No test file contains inline object construction for domain models (all use factories)
|
|
151
|
+
- Tests pass in any execution order, confirming data isolation
|
|
152
|
+
- Seed scripts are idempotent and documented
|
|
153
|
+
- Cleanup runs between tests with no orphaned records
|
|
154
|
+
- `harness validate` passes with factory infrastructure in place
|
|
155
|
+
|
|
156
|
+
## Examples
|
|
157
|
+
|
|
158
|
+
### Example: Fishery Factories for a TypeScript Project
|
|
159
|
+
|
|
160
|
+
**SCAFFOLD -- User factory with traits:**
|
|
161
|
+
|
|
162
|
+
```typescript
|
|
163
|
+
// tests/factories/user.factory.ts
|
|
164
|
+
import { Factory } from 'fishery';
|
|
165
|
+
import { faker } from '@faker-js/faker';
|
|
166
|
+
import { User } from '../../src/types/user';
|
|
167
|
+
|
|
168
|
+
export const UserFactory = Factory.define<User>(({ sequence, params, transientParams }) => ({
|
|
169
|
+
id: `user-${sequence}`,
|
|
170
|
+
email: params.email ?? faker.internet.email(),
|
|
171
|
+
name: params.name ?? faker.person.fullName(),
|
|
172
|
+
role: params.role ?? 'member',
|
|
173
|
+
status: params.status ?? 'active',
|
|
174
|
+
createdAt: params.createdAt ?? faker.date.past(),
|
|
175
|
+
updatedAt: new Date(),
|
|
176
|
+
}));
|
|
177
|
+
|
|
178
|
+
// Traits
|
|
179
|
+
export const AdminUser = UserFactory.params({ role: 'admin' });
|
|
180
|
+
export const InactiveUser = UserFactory.params({ status: 'inactive' });
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
**SCAFFOLD -- Project factory with association:**
|
|
184
|
+
|
|
185
|
+
```typescript
|
|
186
|
+
// tests/factories/project.factory.ts
|
|
187
|
+
import { Factory } from 'fishery';
|
|
188
|
+
import { faker } from '@faker-js/faker';
|
|
189
|
+
import { Project } from '../../src/types/project';
|
|
190
|
+
import { UserFactory } from './user.factory';
|
|
191
|
+
|
|
192
|
+
export const ProjectFactory = Factory.define<Project>(({ sequence, associations }) => ({
|
|
193
|
+
id: `project-${sequence}`,
|
|
194
|
+
name: faker.commerce.productName(),
|
|
195
|
+
description: faker.lorem.sentence(),
|
|
196
|
+
owner: associations.owner ?? UserFactory.build(),
|
|
197
|
+
ownerId: associations.owner?.id ?? `user-${sequence}`,
|
|
198
|
+
status: 'active',
|
|
199
|
+
createdAt: faker.date.past(),
|
|
200
|
+
}));
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
### Example: factory_boy for a Django Project
|
|
204
|
+
|
|
205
|
+
**SCAFFOLD -- Django model factories:**
|
|
206
|
+
|
|
207
|
+
```python
|
|
208
|
+
# tests/factories.py
|
|
209
|
+
import factory
|
|
210
|
+
from factory.django import DjangoModelFactory
|
|
211
|
+
from faker import Faker
|
|
212
|
+
from myapp.models import User, Organization, Project
|
|
213
|
+
|
|
214
|
+
fake = Faker()
|
|
215
|
+
|
|
216
|
+
class OrganizationFactory(DjangoModelFactory):
|
|
217
|
+
class Meta:
|
|
218
|
+
model = Organization
|
|
219
|
+
|
|
220
|
+
name = factory.LazyFunction(lambda: fake.company())
|
|
221
|
+
slug = factory.LazyAttribute(lambda o: o.name.lower().replace(' ', '-'))
|
|
222
|
+
|
|
223
|
+
class UserFactory(DjangoModelFactory):
|
|
224
|
+
class Meta:
|
|
225
|
+
model = User
|
|
226
|
+
|
|
227
|
+
email = factory.LazyFunction(lambda: fake.unique.email())
|
|
228
|
+
name = factory.LazyFunction(lambda: fake.name())
|
|
229
|
+
organization = factory.SubFactory(OrganizationFactory)
|
|
230
|
+
|
|
231
|
+
class Params:
|
|
232
|
+
admin = factory.Trait(is_staff=True, is_superuser=True)
|
|
233
|
+
|
|
234
|
+
class ProjectFactory(DjangoModelFactory):
|
|
235
|
+
class Meta:
|
|
236
|
+
model = Project
|
|
237
|
+
|
|
238
|
+
name = factory.LazyFunction(lambda: fake.catch_phrase())
|
|
239
|
+
owner = factory.SubFactory(UserFactory)
|
|
240
|
+
organization = factory.LazyAttribute(lambda p: p.owner.organization)
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
**Usage in tests:**
|
|
244
|
+
|
|
245
|
+
```python
|
|
246
|
+
def test_project_belongs_to_owner_organization():
|
|
247
|
+
project = ProjectFactory.create()
|
|
248
|
+
assert project.organization == project.owner.organization
|
|
249
|
+
|
|
250
|
+
def test_admin_can_delete_any_project():
|
|
251
|
+
admin = UserFactory.create(admin=True)
|
|
252
|
+
project = ProjectFactory.create()
|
|
253
|
+
assert admin.has_perm('delete_project', project)
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
## Gates
|
|
257
|
+
|
|
258
|
+
- **No hardcoded IDs in factories.** Factories must generate unique IDs per instance. Hardcoded IDs cause collision failures when tests run in parallel. Use sequences or UUIDs.
|
|
259
|
+
- **No production data in test fixtures.** Test data must be synthetic. If a fixture file contains real customer names, emails, or PII, it must be replaced with Faker-generated data before merging.
|
|
260
|
+
- **Factories must produce valid objects.** A factory `build()` with zero overrides must return an object that passes model validation. If it requires manual overrides to be valid, the defaults are wrong.
|
|
261
|
+
- **Cleanup must be explicit.** Do not rely on test framework teardown happening "eventually." Every test or test suite that creates database records must have an explicit cleanup step that runs even when tests fail.
|
|
262
|
+
|
|
263
|
+
## Escalation
|
|
264
|
+
|
|
265
|
+
- **When models have circular dependencies (User has Projects, Project has Owner User):** Use lazy evaluation or two-pass creation. Create the User first without Projects, create the Project with the User, then optionally update the User. Document the pattern in the factory file.
|
|
266
|
+
- **When the database schema is too complex for factories (50+ models):** Prioritize factories for the models that appear most frequently in tests. Use a tiered approach: core factories first, then add factories for secondary models as tests demand them.
|
|
267
|
+
- **When seed data conflicts with migration state:** Seed scripts must be updated whenever migrations change the schema. If seeds fail after a migration, fix the seeds immediately -- do not skip seeding.
|
|
268
|
+
- **When test isolation requires database-level features (row-level security, multi-tenancy):** Factory cleanup may need tenant-aware truncation. Escalate to ensure the cleanup strategy respects the application's multi-tenancy model.
|