@ketecode/loom 0.0.0-stage → 0.2.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/LICENSE +21 -0
- package/README.md +616 -2
- package/agents/accessibility-reviewer/AGENT.md +70 -0
- package/agents/accessibility-reviewer/evals/triggers.json +15 -0
- package/agents/agent-evaluator/AGENT.md +74 -0
- package/agents/agent-evaluator/evals/triggers.json +15 -0
- package/agents/architect/AGENT.md +82 -0
- package/agents/architect/evals/triggers.json +17 -0
- package/agents/billing-reviewer/AGENT.md +68 -0
- package/agents/billing-reviewer/evals/triggers.json +16 -0
- package/agents/code-reviewer/AGENT.md +51 -0
- package/agents/code-reviewer/evals/behavior.json +60 -0
- package/agents/code-reviewer/evals/triggers.json +14 -0
- package/agents/code-simplifier/AGENT.md +74 -0
- package/agents/code-simplifier/evals/triggers.json +15 -0
- package/agents/cpp-build-resolver/AGENT.md +73 -0
- package/agents/cpp-build-resolver/evals/triggers.json +16 -0
- package/agents/cpp-reviewer/AGENT.md +59 -0
- package/agents/cpp-reviewer/evals/triggers.json +16 -0
- package/agents/csharp-build-resolver/AGENT.md +84 -0
- package/agents/csharp-build-resolver/evals/triggers.json +17 -0
- package/agents/csharp-reviewer/AGENT.md +88 -0
- package/agents/csharp-reviewer/evals/triggers.json +17 -0
- package/agents/dart-build-resolver/AGENT.md +80 -0
- package/agents/dart-build-resolver/evals/triggers.json +17 -0
- package/agents/dart-reviewer/AGENT.md +66 -0
- package/agents/dart-reviewer/evals/triggers.json +17 -0
- package/agents/database-reviewer/AGENT.md +72 -0
- package/agents/database-reviewer/evals/triggers.json +16 -0
- package/agents/django-reviewer/AGENT.md +61 -0
- package/agents/django-reviewer/evals/triggers.json +15 -0
- package/agents/doc-updater/AGENT.md +92 -0
- package/agents/doc-updater/evals/triggers.json +14 -0
- package/agents/e2e-runner/AGENT.md +88 -0
- package/agents/e2e-runner/evals/triggers.json +16 -0
- package/agents/fastapi-reviewer/AGENT.md +63 -0
- package/agents/fastapi-reviewer/evals/triggers.json +15 -0
- package/agents/flutter-reviewer/AGENT.md +70 -0
- package/agents/flutter-reviewer/evals/triggers.json +15 -0
- package/agents/fsharp-build-resolver/AGENT.md +81 -0
- package/agents/fsharp-build-resolver/evals/triggers.json +15 -0
- package/agents/fsharp-reviewer/AGENT.md +77 -0
- package/agents/fsharp-reviewer/evals/triggers.json +15 -0
- package/agents/go-build-resolver/AGENT.md +85 -0
- package/agents/go-build-resolver/evals/triggers.json +16 -0
- package/agents/go-reviewer/AGENT.md +66 -0
- package/agents/go-reviewer/evals/triggers.json +16 -0
- package/agents/healthcare-reviewer/AGENT.md +65 -0
- package/agents/healthcare-reviewer/evals/triggers.json +16 -0
- package/agents/i18n-reviewer/AGENT.md +64 -0
- package/agents/i18n-reviewer/evals/triggers.json +16 -0
- package/agents/inbox-triager/AGENT.md +98 -0
- package/agents/inbox-triager/evals/triggers.json +16 -0
- package/agents/infra-reviewer/AGENT.md +93 -0
- package/agents/infra-reviewer/evals/triggers.json +15 -0
- package/agents/java-build-resolver/AGENT.md +82 -0
- package/agents/java-build-resolver/evals/triggers.json +16 -0
- package/agents/java-reviewer/AGENT.md +64 -0
- package/agents/java-reviewer/evals/triggers.json +16 -0
- package/agents/kotlin-build-resolver/AGENT.md +89 -0
- package/agents/kotlin-build-resolver/evals/triggers.json +16 -0
- package/agents/kotlin-reviewer/AGENT.md +75 -0
- package/agents/kotlin-reviewer/evals/triggers.json +16 -0
- package/agents/mle-reviewer/AGENT.md +68 -0
- package/agents/mle-reviewer/evals/triggers.json +16 -0
- package/agents/network-config-reviewer/AGENT.md +68 -0
- package/agents/network-config-reviewer/evals/triggers.json +17 -0
- package/agents/payments-reviewer/AGENT.md +64 -0
- package/agents/payments-reviewer/evals/triggers.json +16 -0
- package/agents/performance-optimizer/AGENT.md +86 -0
- package/agents/performance-optimizer/evals/triggers.json +16 -0
- package/agents/perl-build-resolver/AGENT.md +84 -0
- package/agents/perl-build-resolver/evals/triggers.json +15 -0
- package/agents/perl-reviewer/AGENT.md +77 -0
- package/agents/perl-reviewer/evals/triggers.json +15 -0
- package/agents/php-build-resolver/AGENT.md +88 -0
- package/agents/php-build-resolver/evals/triggers.json +16 -0
- package/agents/php-reviewer/AGENT.md +61 -0
- package/agents/php-reviewer/evals/triggers.json +15 -0
- package/agents/planner/AGENT.md +75 -0
- package/agents/planner/evals/triggers.json +17 -0
- package/agents/pr-test-analyzer/AGENT.md +82 -0
- package/agents/pr-test-analyzer/evals/triggers.json +16 -0
- package/agents/python-build-resolver/AGENT.md +87 -0
- package/agents/python-build-resolver/evals/triggers.json +16 -0
- package/agents/python-reviewer/AGENT.md +63 -0
- package/agents/python-reviewer/evals/triggers.json +15 -0
- package/agents/rag-reviewer/AGENT.md +71 -0
- package/agents/rag-reviewer/evals/triggers.json +16 -0
- package/agents/react-reviewer/AGENT.md +70 -0
- package/agents/react-reviewer/evals/triggers.json +16 -0
- package/agents/refactor-cleaner/AGENT.md +82 -0
- package/agents/refactor-cleaner/evals/triggers.json +16 -0
- package/agents/ruby-build-resolver/AGENT.md +93 -0
- package/agents/ruby-build-resolver/evals/triggers.json +16 -0
- package/agents/ruby-reviewer/AGENT.md +62 -0
- package/agents/ruby-reviewer/evals/triggers.json +16 -0
- package/agents/rust-build-resolver/AGENT.md +98 -0
- package/agents/rust-build-resolver/evals/triggers.json +16 -0
- package/agents/rust-reviewer/AGENT.md +78 -0
- package/agents/rust-reviewer/evals/triggers.json +15 -0
- package/agents/security-reviewer/AGENT.md +84 -0
- package/agents/security-reviewer/evals/triggers.json +16 -0
- package/agents/silent-failure-hunter/AGENT.md +66 -0
- package/agents/silent-failure-hunter/evals/triggers.json +16 -0
- package/agents/solidity-reviewer/AGENT.md +70 -0
- package/agents/solidity-reviewer/evals/triggers.json +16 -0
- package/agents/spec-reviewer/AGENT.md +95 -0
- package/agents/spec-reviewer/evals/behavior.json +57 -0
- package/agents/spec-reviewer/evals/triggers.json +16 -0
- package/agents/swift-build-resolver/AGENT.md +85 -0
- package/agents/swift-build-resolver/evals/triggers.json +15 -0
- package/agents/swift-reviewer/AGENT.md +75 -0
- package/agents/swift-reviewer/evals/triggers.json +15 -0
- package/agents/task-implementer/AGENT.md +89 -0
- package/agents/task-implementer/evals/behavior.json +47 -0
- package/agents/task-implementer/evals/triggers.json +16 -0
- package/agents/typescript-build-resolver/AGENT.md +76 -0
- package/agents/typescript-build-resolver/evals/triggers.json +15 -0
- package/agents/typescript-reviewer/AGENT.md +76 -0
- package/agents/typescript-reviewer/evals/triggers.json +15 -0
- package/agents/vue-reviewer/AGENT.md +75 -0
- package/agents/vue-reviewer/evals/triggers.json +15 -0
- package/bin/kete-loom.js +723 -0
- package/commands/aside.md +19 -0
- package/commands/brainstorm.md +25 -0
- package/commands/build-fix.md +26 -0
- package/commands/campaign.md +19 -0
- package/commands/changelog.md +36 -0
- package/commands/checkpoint.md +26 -0
- package/commands/codemap.md +25 -0
- package/commands/commit.md +26 -0
- package/commands/debug.md +27 -0
- package/commands/deps-audit.md +32 -0
- package/commands/dual-review.md +34 -0
- package/commands/epic-decompose.md +21 -0
- package/commands/explain.md +37 -0
- package/commands/feature-dev.md +23 -0
- package/commands/finish-branch.md +26 -0
- package/commands/fix-bug.md +38 -0
- package/commands/hookify.md +23 -0
- package/commands/i18n-check.md +39 -0
- package/commands/issue-sync.md +22 -0
- package/commands/jira.md +19 -0
- package/commands/learn.md +23 -0
- package/commands/loom.md +21 -0
- package/commands/loop.md +20 -0
- package/commands/model-route.md +27 -0
- package/commands/onboard.md +35 -0
- package/commands/orchestrate.md +21 -0
- package/commands/plan-feature.md +36 -0
- package/commands/postmortem.md +42 -0
- package/commands/pr-describe.md +39 -0
- package/commands/pr.md +22 -0
- package/commands/prd.md +41 -0
- package/commands/production-readiness.md +45 -0
- package/commands/project-init.md +21 -0
- package/commands/refactor-clean.md +24 -0
- package/commands/resume-session.md +22 -0
- package/commands/review.md +35 -0
- package/commands/save-session.md +37 -0
- package/commands/security-scan.md +32 -0
- package/commands/sessions.md +21 -0
- package/commands/skill-create.md +21 -0
- package/commands/tdd.md +36 -0
- package/commands/test-coverage.md +24 -0
- package/commands/threat-model.md +36 -0
- package/commands/update-docs.md +25 -0
- package/commands/usage-report.md +43 -0
- package/commands/verify.md +21 -0
- package/hooks/block-dangerous-commands/HOOK.md +30 -0
- package/hooks/block-dangerous-commands/cases.json +50 -0
- package/hooks/block-dangerous-commands/hook.js +75 -0
- package/hooks/block-foreground-servers/HOOK.md +34 -0
- package/hooks/block-foreground-servers/cases.json +31 -0
- package/hooks/block-foreground-servers/hook.js +41 -0
- package/hooks/block-no-verify/HOOK.md +25 -0
- package/hooks/block-no-verify/cases.json +30 -0
- package/hooks/block-no-verify/hook.js +43 -0
- package/hooks/capture-lessons/HOOK.md +24 -0
- package/hooks/capture-lessons/hook.js +48 -0
- package/hooks/format-on-edit/HOOK.md +24 -0
- package/hooks/format-on-edit/hook.js +89 -0
- package/hooks/guard-secrets/HOOK.md +19 -0
- package/hooks/guard-secrets/cases.json +110 -0
- package/hooks/guard-secrets/hook.js +44 -0
- package/hooks/load-session-context/HOOK.md +20 -0
- package/hooks/load-session-context/hook.js +56 -0
- package/hooks/notify-on-stop/HOOK.md +25 -0
- package/hooks/notify-on-stop/hook.js +27 -0
- package/hooks/protect-files/HOOK.md +24 -0
- package/hooks/protect-files/cases.json +27 -0
- package/hooks/protect-files/hook.js +39 -0
- package/hooks/protect-lint-config/HOOK.md +29 -0
- package/hooks/protect-lint-config/cases.json +18 -0
- package/hooks/protect-lint-config/fixtures/.eslintrc.json +1 -0
- package/hooks/protect-lint-config/fixtures/.golangci.yml +1 -0
- package/hooks/protect-lint-config/fixtures/.prettierrc +1 -0
- package/hooks/protect-lint-config/fixtures/.rubocop.yml +1 -0
- package/hooks/protect-lint-config/fixtures/biome.json +1 -0
- package/hooks/protect-lint-config/fixtures/eslint.config.mjs +1 -0
- package/hooks/protect-lint-config/fixtures/ruff.toml +1 -0
- package/hooks/protect-lint-config/hook.js +25 -0
- package/hooks/read-before-edit/HOOK.md +26 -0
- package/hooks/read-before-edit/cases.json +15 -0
- package/hooks/read-before-edit/hook.js +50 -0
- package/hooks/run.js +148 -0
- package/hooks/verify-before-stop/HOOK.md +32 -0
- package/hooks/verify-before-stop/hook.js +70 -0
- package/mcp/atlassian.json +11 -0
- package/mcp/chrome-devtools.json +18 -0
- package/mcp/clickhouse.json +11 -0
- package/mcp/cloudflare.json +11 -0
- package/mcp/context7.json +11 -0
- package/mcp/exa.json +11 -0
- package/mcp/fetch.json +17 -0
- package/mcp/figma.json +11 -0
- package/mcp/firecrawl.json +11 -0
- package/mcp/git.json +17 -0
- package/mcp/github.json +11 -0
- package/mcp/linear.json +11 -0
- package/mcp/memory.json +18 -0
- package/mcp/notion.json +11 -0
- package/mcp/playwright.json +18 -0
- package/mcp/sentry.json +11 -0
- package/mcp/stripe.json +11 -0
- package/mcp/supabase.json +11 -0
- package/mcp/time.json +17 -0
- package/mcp/vercel.json +11 -0
- package/package.json +61 -4
- package/profiles.json +214 -0
- package/rules/common.md +21 -0
- package/rules/cpp.md +29 -0
- package/rules/csharp.md +25 -0
- package/rules/dart.md +29 -0
- package/rules/fsharp.md +28 -0
- package/rules/git.md +26 -0
- package/rules/go.md +29 -0
- package/rules/java.md +29 -0
- package/rules/kotlin.md +27 -0
- package/rules/perl.md +26 -0
- package/rules/php.md +28 -0
- package/rules/python.md +30 -0
- package/rules/ruby.md +27 -0
- package/rules/rust.md +26 -0
- package/rules/security.md +29 -0
- package/rules/swift.md +28 -0
- package/rules/testing.md +25 -0
- package/rules/typescript.md +29 -0
- package/rules/use-skills.md +23 -0
- package/schemas/skill-frontmatter.schema.json +52 -0
- package/scripts/lib/audit.js +96 -0
- package/scripts/lib/behavior.js +52 -0
- package/scripts/lib/frontmatter.js +65 -0
- package/scripts/lib/hooks-install.js +294 -0
- package/scripts/lib/i18n.js +51 -0
- package/scripts/lib/inventory.js +85 -0
- package/scripts/lib/lint.js +180 -0
- package/scripts/lib/mcp-install.js +288 -0
- package/scripts/lib/profiles.js +128 -0
- package/scripts/lib/render.js +92 -0
- package/scripts/lib/rules-install.js +118 -0
- package/scripts/lib/skills.js +87 -0
- package/scripts/lib/targets.js +123 -0
- package/skills/accounting-api-integration/SKILL.md +81 -0
- package/skills/accounting-api-integration/evals/triggers.json +17 -0
- package/skills/accounting-api-integration/references/quickbooks.md +48 -0
- package/skills/accounting-api-integration/references/xero.md +45 -0
- package/skills/agent-failure-debugging/SKILL.md +92 -0
- package/skills/agent-failure-debugging/evals/triggers.json +16 -0
- package/skills/agent-harness-design/SKILL.md +125 -0
- package/skills/agent-harness-design/evals/triggers.json +21 -0
- package/skills/agent-outbound-messaging/SKILL.md +92 -0
- package/skills/agent-outbound-messaging/evals/triggers.json +16 -0
- package/skills/agent-security/SKILL.md +117 -0
- package/skills/agent-security/evals/triggers.json +16 -0
- package/skills/agent-security/references/host-configs.md +37 -0
- package/skills/ai-media-generation/SKILL.md +89 -0
- package/skills/ai-media-generation/evals/triggers.json +16 -0
- package/skills/ai-media-generation/references/job-pipeline.md +76 -0
- package/skills/angular-patterns/SKILL.md +122 -0
- package/skills/angular-patterns/evals/triggers.json +16 -0
- package/skills/api-client-integration/SKILL.md +86 -0
- package/skills/api-client-integration/evals/triggers.json +16 -0
- package/skills/api-client-integration/references/resilience.md +57 -0
- package/skills/api-design/SKILL.md +96 -0
- package/skills/api-design/evals/triggers.json +18 -0
- package/skills/api-design/references/conventions.md +133 -0
- package/skills/architecture-decision-records/SKILL.md +98 -0
- package/skills/architecture-decision-records/evals/triggers.json +17 -0
- package/skills/article-writing/SKILL.md +108 -0
- package/skills/article-writing/evals/triggers.json +16 -0
- package/skills/aspnet-core-patterns/SKILL.md +149 -0
- package/skills/aspnet-core-patterns/evals/triggers.json +16 -0
- package/skills/auth-patterns/SKILL.md +104 -0
- package/skills/auth-patterns/evals/triggers.json +17 -0
- package/skills/auth-patterns/references/oauth-oidc.md +64 -0
- package/skills/autonomous-loops/SKILL.md +99 -0
- package/skills/autonomous-loops/evals/triggers.json +14 -0
- package/skills/aws-patterns/SKILL.md +91 -0
- package/skills/aws-patterns/evals/triggers.json +16 -0
- package/skills/azure-patterns/SKILL.md +86 -0
- package/skills/azure-patterns/evals/triggers.json +16 -0
- package/skills/benchmark-methodology/SKILL.md +88 -0
- package/skills/benchmark-methodology/evals/triggers.json +16 -0
- package/skills/benchmark-methodology/references/language-harnesses.md +130 -0
- package/skills/bgp-diagnostics/SKILL.md +84 -0
- package/skills/bgp-diagnostics/evals/triggers.json +18 -0
- package/skills/bgp-diagnostics/references/bgp-reference.md +81 -0
- package/skills/bioinformatics-workflows/SKILL.md +108 -0
- package/skills/bioinformatics-workflows/evals/triggers.json +16 -0
- package/skills/bioinformatics-workflows/references/commands.md +71 -0
- package/skills/bioinformatics-workflows/references/formats.md +24 -0
- package/skills/bioinformatics-workflows/references/workflow-managers.md +107 -0
- package/skills/blender-automation/SKILL.md +100 -0
- package/skills/blender-automation/evals/triggers.json +16 -0
- package/skills/blender-automation/references/batch-and-render.md +77 -0
- package/skills/blender-automation/references/bpy-inspection.md +91 -0
- package/skills/blender-automation/references/rig-and-retarget-checks.md +23 -0
- package/skills/brand-strategy/SKILL.md +83 -0
- package/skills/brand-strategy/evals/triggers.json +16 -0
- package/skills/brand-voice/SKILL.md +112 -0
- package/skills/brand-voice/evals/triggers.json +16 -0
- package/skills/browser-qa/SKILL.md +99 -0
- package/skills/browser-qa/evals/triggers.json +16 -0
- package/skills/bun-runtime/SKILL.md +93 -0
- package/skills/bun-runtime/evals/triggers.json +16 -0
- package/skills/change-impact-analysis/SKILL.md +89 -0
- package/skills/change-impact-analysis/evals/triggers.json +16 -0
- package/skills/change-impact-analysis/references/graph-commands.md +28 -0
- package/skills/cisco-ios-config/SKILL.md +101 -0
- package/skills/cisco-ios-config/evals/triggers.json +18 -0
- package/skills/cisco-ios-config/references/verification.md +63 -0
- package/skills/clickhouse-patterns/SKILL.md +101 -0
- package/skills/clickhouse-patterns/evals/triggers.json +18 -0
- package/skills/clickhouse-patterns/references/engines-and-views.md +138 -0
- package/skills/clinical-decision-support/SKILL.md +90 -0
- package/skills/clinical-decision-support/evals/triggers.json +16 -0
- package/skills/clinical-decision-support/references/cds-hooks.md +76 -0
- package/skills/clinical-decision-support/references/regulatory-boundaries.md +37 -0
- package/skills/code-tour/SKILL.md +97 -0
- package/skills/code-tour/evals/triggers.json +14 -0
- package/skills/codebase-onboarding/SKILL.md +112 -0
- package/skills/codebase-onboarding/evals/triggers.json +14 -0
- package/skills/cold-outreach-sequences/SKILL.md +90 -0
- package/skills/cold-outreach-sequences/evals/triggers.json +16 -0
- package/skills/content-repurposing/SKILL.md +82 -0
- package/skills/content-repurposing/evals/triggers.json +16 -0
- package/skills/context-budget/SKILL.md +84 -0
- package/skills/context-budget/evals/triggers.json +14 -0
- package/skills/contract-drafting/SKILL.md +96 -0
- package/skills/contract-drafting/evals/triggers.json +16 -0
- package/skills/contract-drafting/references/term-sheets.md +68 -0
- package/skills/contract-first-development/SKILL.md +86 -0
- package/skills/contract-first-development/evals/triggers.json +16 -0
- package/skills/contract-first-development/references/tooling.md +46 -0
- package/skills/conventional-commits/SKILL.md +144 -0
- package/skills/conventional-commits/evals/triggers.json +16 -0
- package/skills/cpp-patterns/SKILL.md +129 -0
- package/skills/cpp-patterns/evals/triggers.json +16 -0
- package/skills/cpp-patterns/references/cmake-and-tooling.md +88 -0
- package/skills/cpp-patterns/references/undefined-behaviour.md +75 -0
- package/skills/cpp-testing/SKILL.md +131 -0
- package/skills/cpp-testing/evals/triggers.json +16 -0
- package/skills/csharp-patterns/SKILL.md +110 -0
- package/skills/csharp-patterns/evals/triggers.json +17 -0
- package/skills/csharp-patterns/references/analyzers.md +59 -0
- package/skills/csharp-testing/SKILL.md +85 -0
- package/skills/csharp-testing/evals/triggers.json +17 -0
- package/skills/csharp-testing/references/integration-tests.md +77 -0
- package/skills/css-architecture/SKILL.md +143 -0
- package/skills/css-architecture/evals/triggers.json +16 -0
- package/skills/customs-trade-compliance/SKILL.md +95 -0
- package/skills/customs-trade-compliance/evals/triggers.json +16 -0
- package/skills/customs-trade-compliance/references/incoterms-2020.md +42 -0
- package/skills/dart-patterns/SKILL.md +157 -0
- package/skills/dart-patterns/evals/triggers.json +18 -0
- package/skills/dart-testing/SKILL.md +164 -0
- package/skills/dart-testing/evals/triggers.json +18 -0
- package/skills/data-analysis-notebooks/SKILL.md +113 -0
- package/skills/data-analysis-notebooks/evals/triggers.json +16 -0
- package/skills/data-analysis-notebooks/references/dataframe-pitfalls.md +49 -0
- package/skills/data-analysis-notebooks/references/statistics-pitfalls.md +24 -0
- package/skills/data-pipelines/SKILL.md +90 -0
- package/skills/data-pipelines/evals/triggers.json +16 -0
- package/skills/data-pipelines/references/orchestrators.md +64 -0
- package/skills/database-migrations/SKILL.md +102 -0
- package/skills/database-migrations/evals/triggers.json +16 -0
- package/skills/database-migrations/references/recipes.md +98 -0
- package/skills/database-migrations/references/tools.md +21 -0
- package/skills/dbt-patterns/SKILL.md +96 -0
- package/skills/dbt-patterns/evals/triggers.json +16 -0
- package/skills/dbt-patterns/references/yaml-examples.md +114 -0
- package/skills/decision-council/SKILL.md +98 -0
- package/skills/decision-council/evals/triggers.json +16 -0
- package/skills/deep-research/SKILL.md +107 -0
- package/skills/deep-research/evals/triggers.json +14 -0
- package/skills/dependency-audit/SKILL.md +103 -0
- package/skills/dependency-audit/evals/triggers.json +16 -0
- package/skills/dependency-audit/references/tools.md +124 -0
- package/skills/deployment-strategies/SKILL.md +108 -0
- package/skills/deployment-strategies/evals/triggers.json +16 -0
- package/skills/design-brainstorming/SKILL.md +132 -0
- package/skills/design-brainstorming/evals/behavior.json +55 -0
- package/skills/design-brainstorming/evals/triggers.json +16 -0
- package/skills/design-brainstorming/references/visual-mockups.md +34 -0
- package/skills/desktop-app-testing/SKILL.md +104 -0
- package/skills/desktop-app-testing/evals/triggers.json +16 -0
- package/skills/desktop-app-testing/references/drivers.md +81 -0
- package/skills/django-patterns/SKILL.md +123 -0
- package/skills/django-patterns/evals/triggers.json +16 -0
- package/skills/docker-patterns/SKILL.md +132 -0
- package/skills/docker-patterns/evals/triggers.json +16 -0
- package/skills/docker-patterns/references/dockerfiles.md +105 -0
- package/skills/document-processing/SKILL.md +100 -0
- package/skills/document-processing/evals/triggers.json +17 -0
- package/skills/document-processing/references/extraction-and-ocr.md +71 -0
- package/skills/document-processing/references/forms-and-conversion.md +69 -0
- package/skills/document-processing/references/redaction.md +61 -0
- package/skills/e2e-testing-playwright/SKILL.md +94 -0
- package/skills/e2e-testing-playwright/evals/triggers.json +16 -0
- package/skills/e2e-testing-playwright/references/config-and-ci.md +129 -0
- package/skills/ef-core-patterns/SKILL.md +117 -0
- package/skills/ef-core-patterns/evals/triggers.json +16 -0
- package/skills/email-deliverability/SKILL.md +99 -0
- package/skills/email-deliverability/evals/triggers.json +17 -0
- package/skills/email-deliverability/references/dns-records.md +85 -0
- package/skills/energy-procurement/SKILL.md +106 -0
- package/skills/energy-procurement/evals/triggers.json +16 -0
- package/skills/error-handling-patterns/SKILL.md +112 -0
- package/skills/error-handling-patterns/evals/triggers.json +18 -0
- package/skills/error-handling-patterns/references/language-idioms.md +49 -0
- package/skills/estimation-and-scoping/SKILL.md +97 -0
- package/skills/estimation-and-scoping/evals/triggers.json +14 -0
- package/skills/evm-dapp-integration/SKILL.md +73 -0
- package/skills/evm-dapp-integration/evals/triggers.json +16 -0
- package/skills/fastapi-patterns/SKILL.md +127 -0
- package/skills/fastapi-patterns/evals/triggers.json +16 -0
- package/skills/ffmpeg-media-processing/SKILL.md +94 -0
- package/skills/ffmpeg-media-processing/evals/triggers.json +16 -0
- package/skills/ffmpeg-media-processing/references/recipes.md +112 -0
- package/skills/fhir-integration/SKILL.md +81 -0
- package/skills/fhir-integration/evals/triggers.json +16 -0
- package/skills/fhir-integration/references/search-and-bundles.md +73 -0
- package/skills/fhir-integration/references/smart-on-fhir.md +50 -0
- package/skills/finishing-a-branch/SKILL.md +127 -0
- package/skills/finishing-a-branch/evals/behavior.json +49 -0
- package/skills/finishing-a-branch/evals/triggers.json +16 -0
- package/skills/flask-patterns/SKILL.md +132 -0
- package/skills/flask-patterns/evals/triggers.json +16 -0
- package/skills/flutter-patterns/SKILL.md +99 -0
- package/skills/flutter-patterns/evals/triggers.json +16 -0
- package/skills/flutterwave-integration/SKILL.md +75 -0
- package/skills/flutterwave-integration/evals/triggers.json +16 -0
- package/skills/flutterwave-integration/references/api.md +73 -0
- package/skills/flutterwave-integration/references/webhooks.md +49 -0
- package/skills/freight-carrier-management/SKILL.md +107 -0
- package/skills/freight-carrier-management/evals/triggers.json +16 -0
- package/skills/fsharp-patterns/SKILL.md +133 -0
- package/skills/fsharp-patterns/evals/triggers.json +16 -0
- package/skills/fsharp-testing/SKILL.md +136 -0
- package/skills/fsharp-testing/evals/triggers.json +16 -0
- package/skills/gcp-patterns/SKILL.md +86 -0
- package/skills/gcp-patterns/evals/triggers.json +16 -0
- package/skills/git-workflow/SKILL.md +114 -0
- package/skills/git-workflow/evals/triggers.json +16 -0
- package/skills/git-worktrees/SKILL.md +130 -0
- package/skills/git-worktrees/evals/behavior.json +56 -0
- package/skills/git-worktrees/evals/triggers.json +16 -0
- package/skills/github-actions-ci/SKILL.md +117 -0
- package/skills/github-actions-ci/evals/triggers.json +16 -0
- package/skills/github-api-automation/SKILL.md +101 -0
- package/skills/github-api-automation/evals/triggers.json +17 -0
- package/skills/go-patterns/SKILL.md +118 -0
- package/skills/go-patterns/evals/triggers.json +17 -0
- package/skills/go-patterns/references/concurrency.md +162 -0
- package/skills/go-testing/SKILL.md +154 -0
- package/skills/go-testing/evals/triggers.json +17 -0
- package/skills/google-workspace-integration/SKILL.md +65 -0
- package/skills/google-workspace-integration/evals/triggers.json +17 -0
- package/skills/google-workspace-integration/references/api.md +121 -0
- package/skills/harmonyos-arkts/SKILL.md +117 -0
- package/skills/harmonyos-arkts/evals/triggers.json +16 -0
- package/skills/harmonyos-arkts/references/build-errors.md +42 -0
- package/skills/hexagonal-architecture/SKILL.md +89 -0
- package/skills/hexagonal-architecture/evals/triggers.json +17 -0
- package/skills/hipaa-compliance/SKILL.md +91 -0
- package/skills/hipaa-compliance/evals/triggers.json +18 -0
- package/skills/hipaa-compliance/references/safeguards.md +68 -0
- package/skills/hl7v2-integration/SKILL.md +69 -0
- package/skills/hl7v2-integration/evals/triggers.json +16 -0
- package/skills/hl7v2-integration/references/messages-and-ack.md +78 -0
- package/skills/homelab-network-setup/SKILL.md +125 -0
- package/skills/homelab-network-setup/evals/triggers.json +18 -0
- package/skills/homelab-network-setup/references/firewall-and-dns.md +45 -0
- package/skills/homelab-network-setup/references/wireguard.md +72 -0
- package/skills/hubtel-integration/SKILL.md +77 -0
- package/skills/hubtel-integration/evals/triggers.json +16 -0
- package/skills/hubtel-integration/references/api.md +92 -0
- package/skills/i18n-localization/SKILL.md +114 -0
- package/skills/i18n-localization/evals/triggers.json +16 -0
- package/skills/i18n-localization/references/libraries.md +52 -0
- package/skills/implementation-plans/SKILL.md +117 -0
- package/skills/implementation-plans/evals/behavior.json +54 -0
- package/skills/implementation-plans/evals/triggers.json +16 -0
- package/skills/incident-postmortem/SKILL.md +118 -0
- package/skills/incident-postmortem/evals/triggers.json +14 -0
- package/skills/inventory-demand-planning/SKILL.md +89 -0
- package/skills/inventory-demand-planning/evals/triggers.json +16 -0
- package/skills/inventory-demand-planning/references/formulas.md +62 -0
- package/skills/investor-materials/SKILL.md +127 -0
- package/skills/investor-materials/evals/triggers.json +16 -0
- package/skills/investor-materials/references/templates.md +74 -0
- package/skills/invoicing-and-tax/SKILL.md +84 -0
- package/skills/invoicing-and-tax/evals/triggers.json +17 -0
- package/skills/invoicing-and-tax/references/e-invoicing.md +24 -0
- package/skills/invoicing-and-tax/references/invoice-fields.md +38 -0
- package/skills/invoicing-and-tax/references/rounding.md +26 -0
- package/skills/ios-platform-features/SKILL.md +99 -0
- package/skills/ios-platform-features/evals/triggers.json +16 -0
- package/skills/ios-platform-features/references/foundation-models.md +90 -0
- package/skills/java-patterns/SKILL.md +141 -0
- package/skills/java-patterns/evals/triggers.json +17 -0
- package/skills/java-testing/SKILL.md +142 -0
- package/skills/java-testing/evals/triggers.json +16 -0
- package/skills/jetpack-compose-patterns/SKILL.md +88 -0
- package/skills/jetpack-compose-patterns/evals/triggers.json +16 -0
- package/skills/jira-integration/SKILL.md +92 -0
- package/skills/jira-integration/evals/triggers.json +17 -0
- package/skills/jpa-hibernate/SKILL.md +92 -0
- package/skills/jpa-hibernate/evals/triggers.json +18 -0
- package/skills/jpa-hibernate/references/mapping.md +99 -0
- package/skills/jvm-sql-mappers/SKILL.md +98 -0
- package/skills/jvm-sql-mappers/evals/triggers.json +16 -0
- package/skills/jvm-sql-mappers/references/examples.md +129 -0
- package/skills/kotlin-multiplatform/SKILL.md +97 -0
- package/skills/kotlin-multiplatform/evals/triggers.json +16 -0
- package/skills/kotlin-patterns/SKILL.md +128 -0
- package/skills/kotlin-patterns/evals/triggers.json +16 -0
- package/skills/kotlin-testing/SKILL.md +117 -0
- package/skills/kotlin-testing/evals/triggers.json +16 -0
- package/skills/ktor-patterns/SKILL.md +135 -0
- package/skills/ktor-patterns/evals/triggers.json +18 -0
- package/skills/kubernetes-patterns/SKILL.md +106 -0
- package/skills/kubernetes-patterns/evals/triggers.json +16 -0
- package/skills/kubernetes-patterns/references/manifests.md +115 -0
- package/skills/laravel-patterns/SKILL.md +136 -0
- package/skills/laravel-patterns/evals/triggers.json +16 -0
- package/skills/linear-integration/SKILL.md +98 -0
- package/skills/linear-integration/evals/triggers.json +17 -0
- package/skills/literature-review/SKILL.md +109 -0
- package/skills/literature-review/evals/triggers.json +16 -0
- package/skills/literature-review/references/appraisal.md +41 -0
- package/skills/literature-review/references/search-sources.md +39 -0
- package/skills/llm-app-patterns/SKILL.md +97 -0
- package/skills/llm-app-patterns/evals/triggers.json +17 -0
- package/skills/llm-evals/SKILL.md +98 -0
- package/skills/llm-evals/evals/triggers.json +16 -0
- package/skills/llm-evals/references/graders.md +66 -0
- package/skills/logistics-exception-management/SKILL.md +90 -0
- package/skills/logistics-exception-management/evals/triggers.json +16 -0
- package/skills/manim-animations/SKILL.md +106 -0
- package/skills/manim-animations/evals/triggers.json +16 -0
- package/skills/market-research/SKILL.md +117 -0
- package/skills/market-research/evals/triggers.json +16 -0
- package/skills/marketing-campaign/SKILL.md +111 -0
- package/skills/marketing-campaign/evals/triggers.json +16 -0
- package/skills/mcp-server-patterns/SKILL.md +127 -0
- package/skills/mcp-server-patterns/evals/triggers.json +18 -0
- package/skills/mcp-server-patterns/references/protocol-notes.md +68 -0
- package/skills/metrics-dashboards/SKILL.md +113 -0
- package/skills/metrics-dashboards/evals/triggers.json +16 -0
- package/skills/ml-experiment-workflow/SKILL.md +125 -0
- package/skills/ml-experiment-workflow/evals/triggers.json +16 -0
- package/skills/mobile-accessibility/SKILL.md +94 -0
- package/skills/mobile-accessibility/evals/triggers.json +16 -0
- package/skills/mongodb-patterns/SKILL.md +115 -0
- package/skills/mongodb-patterns/evals/triggers.json +18 -0
- package/skills/mongodb-patterns/references/indexes-and-aggregation.md +94 -0
- package/skills/mpesa-daraja-integration/SKILL.md +70 -0
- package/skills/mpesa-daraja-integration/evals/triggers.json +16 -0
- package/skills/mpesa-daraja-integration/references/api.md +103 -0
- package/skills/mpesa-daraja-integration/references/callbacks.md +74 -0
- package/skills/mtn-momo-integration/SKILL.md +66 -0
- package/skills/mtn-momo-integration/evals/triggers.json +16 -0
- package/skills/mtn-momo-integration/references/api.md +153 -0
- package/skills/mtn-momo-integration/references/callbacks.md +92 -0
- package/skills/mtn-momo-integration/references/sandbox-and-go-live.md +51 -0
- package/skills/mtn-momo-integration/scripts/sandbox-setup.js +79 -0
- package/skills/mysql-patterns/SKILL.md +96 -0
- package/skills/mysql-patterns/evals/triggers.json +16 -0
- package/skills/mysql-patterns/references/explain.md +34 -0
- package/skills/mysql-patterns/references/online-ddl.md +41 -0
- package/skills/nestjs-patterns/SKILL.md +114 -0
- package/skills/nestjs-patterns/evals/triggers.json +16 -0
- package/skills/nestjs-patterns/references/testing.md +68 -0
- package/skills/network-automation/SKILL.md +107 -0
- package/skills/network-automation/evals/triggers.json +18 -0
- package/skills/network-automation/references/tool-snippets.md +153 -0
- package/skills/network-design/SKILL.md +98 -0
- package/skills/network-design/evals/triggers.json +16 -0
- package/skills/network-troubleshooting/SKILL.md +152 -0
- package/skills/network-troubleshooting/evals/triggers.json +18 -0
- package/skills/network-troubleshooting/references/commands.md +33 -0
- package/skills/nextjs-patterns/SKILL.md +150 -0
- package/skills/nextjs-patterns/evals/triggers.json +18 -0
- package/skills/nextjs-patterns/references/caching.md +87 -0
- package/skills/node-backend-patterns/SKILL.md +103 -0
- package/skills/node-backend-patterns/evals/triggers.json +16 -0
- package/skills/node-backend-patterns/references/templates.md +122 -0
- package/skills/nuxt-patterns/SKILL.md +103 -0
- package/skills/nuxt-patterns/evals/triggers.json +16 -0
- package/skills/observability/SKILL.md +125 -0
- package/skills/observability/evals/triggers.json +17 -0
- package/skills/observability/references/otel-setup.md +87 -0
- package/skills/observability/references/slo-alerts.md +70 -0
- package/skills/open-source-release/SKILL.md +107 -0
- package/skills/open-source-release/evals/triggers.json +15 -0
- package/skills/open-source-release/references/history-scrub.md +65 -0
- package/skills/parallel-agent-orchestration/SKILL.md +106 -0
- package/skills/parallel-agent-orchestration/evals/triggers.json +14 -0
- package/skills/patent-research/SKILL.md +94 -0
- package/skills/patent-research/evals/triggers.json +16 -0
- package/skills/patent-research/references/databases-and-queries.md +52 -0
- package/skills/paystack-integration/SKILL.md +59 -0
- package/skills/paystack-integration/evals/triggers.json +14 -0
- package/skills/paystack-integration/references/api.md +73 -0
- package/skills/paystack-integration/references/mobile-money.md +50 -0
- package/skills/paystack-integration/references/webhooks.md +80 -0
- package/skills/pci-dss-scope/SKILL.md +103 -0
- package/skills/pci-dss-scope/evals/triggers.json +18 -0
- package/skills/pci-dss-scope/references/saq-and-data.md +36 -0
- package/skills/perl-patterns/SKILL.md +135 -0
- package/skills/perl-patterns/evals/triggers.json +18 -0
- package/skills/perl-testing/SKILL.md +126 -0
- package/skills/perl-testing/evals/triggers.json +17 -0
- package/skills/php-patterns/SKILL.md +116 -0
- package/skills/php-patterns/evals/triggers.json +16 -0
- package/skills/php-testing/SKILL.md +123 -0
- package/skills/php-testing/evals/triggers.json +16 -0
- package/skills/postgres-patterns/SKILL.md +103 -0
- package/skills/postgres-patterns/evals/triggers.json +17 -0
- package/skills/postgres-patterns/references/explain.md +59 -0
- package/skills/postgres-patterns/references/locks.md +53 -0
- package/skills/prd-writing/SKILL.md +124 -0
- package/skills/prd-writing/evals/triggers.json +15 -0
- package/skills/prisma-patterns/SKILL.md +83 -0
- package/skills/prisma-patterns/evals/triggers.json +18 -0
- package/skills/prisma-patterns/references/prisma-8.md +46 -0
- package/skills/prisma-patterns/references/workflow.md +50 -0
- package/skills/privacy-compliance/SKILL.md +121 -0
- package/skills/privacy-compliance/evals/triggers.json +18 -0
- package/skills/privacy-compliance/references/jurisdictions.md +51 -0
- package/skills/production-scheduling/SKILL.md +98 -0
- package/skills/production-scheduling/evals/triggers.json +16 -0
- package/skills/prompt-engineering/SKILL.md +92 -0
- package/skills/prompt-engineering/evals/triggers.json +16 -0
- package/skills/prospect-research/SKILL.md +87 -0
- package/skills/prospect-research/evals/triggers.json +16 -0
- package/skills/python-app-distribution/SKILL.md +107 -0
- package/skills/python-app-distribution/evals/triggers.json +16 -0
- package/skills/python-app-distribution/references/pypi-trusted-publishing.md +55 -0
- package/skills/python-app-distribution/references/windows-macos-signing.md +70 -0
- package/skills/python-patterns/SKILL.md +107 -0
- package/skills/python-patterns/evals/triggers.json +16 -0
- package/skills/python-patterns/references/tooling.md +101 -0
- package/skills/python-testing/SKILL.md +126 -0
- package/skills/python-testing/evals/triggers.json +16 -0
- package/skills/python-testing/references/mocking.md +71 -0
- package/skills/pytorch-patterns/SKILL.md +139 -0
- package/skills/pytorch-patterns/evals/triggers.json +16 -0
- package/skills/pytorch-patterns/references/debugging.md +39 -0
- package/skills/quality-nonconformance/SKILL.md +107 -0
- package/skills/quality-nonconformance/evals/triggers.json +16 -0
- package/skills/quality-nonconformance/references/8d-and-capa.md +46 -0
- package/skills/quarkus-patterns/SKILL.md +93 -0
- package/skills/quarkus-patterns/evals/triggers.json +18 -0
- package/skills/rag-pipeline-patterns/SKILL.md +117 -0
- package/skills/rag-pipeline-patterns/evals/triggers.json +18 -0
- package/skills/rag-pipeline-patterns/references/evaluation.md +37 -0
- package/skills/rag-pipeline-patterns/references/retrieval-recipes.md +78 -0
- package/skills/rails-patterns/SKILL.md +132 -0
- package/skills/rails-patterns/evals/triggers.json +16 -0
- package/skills/react-native-patterns/SKILL.md +101 -0
- package/skills/react-native-patterns/evals/triggers.json +16 -0
- package/skills/react-patterns/SKILL.md +140 -0
- package/skills/react-patterns/evals/triggers.json +18 -0
- package/skills/react-performance/SKILL.md +107 -0
- package/skills/react-performance/evals/triggers.json +18 -0
- package/skills/react-testing/SKILL.md +121 -0
- package/skills/react-testing/evals/triggers.json +18 -0
- package/skills/react-testing/references/msw.md +64 -0
- package/skills/react-testing/references/queries.md +41 -0
- package/skills/react-testing/references/setup.md +74 -0
- package/skills/recommender-systems/SKILL.md +119 -0
- package/skills/recommender-systems/evals/triggers.json +16 -0
- package/skills/recommender-systems/references/evaluation.md +39 -0
- package/skills/redis-patterns/SKILL.md +109 -0
- package/skills/redis-patterns/evals/triggers.json +18 -0
- package/skills/redis-patterns/references/operations.md +61 -0
- package/skills/refactoring-safely/SKILL.md +107 -0
- package/skills/refactoring-safely/evals/behavior.json +57 -0
- package/skills/refactoring-safely/evals/triggers.json +17 -0
- package/skills/release-management/SKILL.md +141 -0
- package/skills/release-management/evals/triggers.json +16 -0
- package/skills/remotion-video/SKILL.md +91 -0
- package/skills/remotion-video/evals/triggers.json +16 -0
- package/skills/remotion-video/references/lambda.md +66 -0
- package/skills/reproducible-dev-environments/SKILL.md +132 -0
- package/skills/reproducible-dev-environments/evals/triggers.json +16 -0
- package/skills/responding-to-code-review/SKILL.md +124 -0
- package/skills/responding-to-code-review/evals/behavior.json +54 -0
- package/skills/responding-to-code-review/evals/triggers.json +16 -0
- package/skills/returns-reverse-logistics/SKILL.md +97 -0
- package/skills/returns-reverse-logistics/evals/triggers.json +16 -0
- package/skills/ruby-patterns/SKILL.md +127 -0
- package/skills/ruby-patterns/evals/triggers.json +18 -0
- package/skills/ruby-testing/SKILL.md +113 -0
- package/skills/ruby-testing/evals/triggers.json +18 -0
- package/skills/runbook-writing/SKILL.md +101 -0
- package/skills/runbook-writing/evals/triggers.json +14 -0
- package/skills/rust-patterns/SKILL.md +118 -0
- package/skills/rust-patterns/evals/triggers.json +16 -0
- package/skills/rust-patterns/references/cargo-and-clippy.md +105 -0
- package/skills/rust-patterns/references/errors-and-traits.md +97 -0
- package/skills/rust-testing/SKILL.md +148 -0
- package/skills/rust-testing/evals/triggers.json +16 -0
- package/skills/rust-testing/references/fakes-proptest-async.md +113 -0
- package/skills/search-first/SKILL.md +73 -0
- package/skills/search-first/evals/triggers.json +14 -0
- package/skills/security-review/SKILL.md +58 -0
- package/skills/security-review/evals/behavior.json +56 -0
- package/skills/security-review/evals/triggers.json +14 -0
- package/skills/security-review/references/checklist.md +54 -0
- package/skills/security-review/scripts/scan-secrets.js +79 -0
- package/skills/seo-audit/SKILL.md +111 -0
- package/skills/seo-audit/evals/triggers.json +16 -0
- package/skills/seo-audit/references/checks.md +65 -0
- package/skills/session-handoff/SKILL.md +101 -0
- package/skills/session-handoff/evals/behavior.json +55 -0
- package/skills/session-handoff/evals/triggers.json +14 -0
- package/skills/skill-authoring/SKILL.md +98 -0
- package/skills/skill-authoring/evals/triggers.json +15 -0
- package/skills/skill-authoring/references/frontmatter.md +40 -0
- package/skills/skill-authoring/references/pressure-testing.md +87 -0
- package/skills/slack-app-integration/SKILL.md +108 -0
- package/skills/slack-app-integration/evals/triggers.json +17 -0
- package/skills/slide-decks/SKILL.md +107 -0
- package/skills/slide-decks/evals/triggers.json +18 -0
- package/skills/slide-decks/references/html-decks.md +86 -0
- package/skills/slide-decks/references/layouts.md +45 -0
- package/skills/slide-decks/references/pptx.md +87 -0
- package/skills/smart-contract-security/SKILL.md +110 -0
- package/skills/smart-contract-security/evals/triggers.json +16 -0
- package/skills/smart-contract-security/references/vulnerability-checklist.md +79 -0
- package/skills/social-media-publishing/SKILL.md +84 -0
- package/skills/social-media-publishing/evals/triggers.json +17 -0
- package/skills/social-media-publishing/references/platform-apis.md +116 -0
- package/skills/solidity-patterns/SKILL.md +95 -0
- package/skills/solidity-patterns/evals/triggers.json +16 -0
- package/skills/spring-boot-patterns/SKILL.md +128 -0
- package/skills/spring-boot-patterns/evals/triggers.json +18 -0
- package/skills/spring-boot-patterns/references/testing.md +72 -0
- package/skills/stripe-integration/SKILL.md +69 -0
- package/skills/stripe-integration/evals/triggers.json +16 -0
- package/skills/stripe-integration/references/api.md +71 -0
- package/skills/stripe-integration/references/billing.md +58 -0
- package/skills/stripe-integration/references/webhooks.md +76 -0
- package/skills/subagent-driven-development/SKILL.md +109 -0
- package/skills/subagent-driven-development/evals/behavior.json +53 -0
- package/skills/subagent-driven-development/evals/triggers.json +15 -0
- package/skills/subagent-driven-development/references/implementer-brief.md +60 -0
- package/skills/subagent-driven-development/references/reviewer-briefs.md +52 -0
- package/skills/subscription-billing-ops/SKILL.md +118 -0
- package/skills/subscription-billing-ops/evals/triggers.json +17 -0
- package/skills/subscription-billing-ops/references/proration.md +47 -0
- package/skills/subscription-billing-ops/references/revenue-metrics.md +38 -0
- package/skills/svelte-patterns/SKILL.md +122 -0
- package/skills/svelte-patterns/evals/triggers.json +16 -0
- package/skills/swift-patterns/SKILL.md +113 -0
- package/skills/swift-patterns/evals/triggers.json +16 -0
- package/skills/swift-patterns/references/concurrency-migration.md +40 -0
- package/skills/swift-testing/SKILL.md +121 -0
- package/skills/swift-testing/evals/triggers.json +16 -0
- package/skills/swift-testing/references/swift-testing-cheatsheet.md +81 -0
- package/skills/swiftui-patterns/SKILL.md +102 -0
- package/skills/swiftui-patterns/evals/triggers.json +16 -0
- package/skills/systematic-debugging/SKILL.md +92 -0
- package/skills/systematic-debugging/evals/behavior.json +59 -0
- package/skills/systematic-debugging/evals/triggers.json +16 -0
- package/skills/systematic-debugging/references/condition-waiting.md +52 -0
- package/skills/systematic-debugging/references/root-cause-tracing.md +49 -0
- package/skills/systematic-debugging/references/test-pollution.md +46 -0
- package/skills/tdd-workflow/SKILL.md +69 -0
- package/skills/tdd-workflow/evals/behavior.json +55 -0
- package/skills/tdd-workflow/evals/triggers.json +15 -0
- package/skills/tdd-workflow/references/testing-anti-patterns.md +87 -0
- package/skills/technical-writing/SKILL.md +95 -0
- package/skills/technical-writing/evals/triggers.json +14 -0
- package/skills/terraform-patterns/SKILL.md +122 -0
- package/skills/terraform-patterns/evals/triggers.json +16 -0
- package/skills/terraform-patterns/references/backends.md +67 -0
- package/skills/test-coverage-improvement/SKILL.md +107 -0
- package/skills/test-coverage-improvement/evals/triggers.json +16 -0
- package/skills/threat-modeling/SKILL.md +113 -0
- package/skills/threat-modeling/evals/triggers.json +16 -0
- package/skills/transactional-email/SKILL.md +68 -0
- package/skills/transactional-email/evals/triggers.json +17 -0
- package/skills/transactional-email/references/providers.md +63 -0
- package/skills/typescript-patterns/SKILL.md +122 -0
- package/skills/typescript-patterns/evals/triggers.json +16 -0
- package/skills/typescript-testing/SKILL.md +101 -0
- package/skills/typescript-testing/evals/triggers.json +16 -0
- package/skills/ui-demo-recording/SKILL.md +93 -0
- package/skills/ui-demo-recording/evals/triggers.json +16 -0
- package/skills/ui-demo-recording/references/cursor-and-captions.md +48 -0
- package/skills/ui-demo-recording/references/playwright-recording.md +63 -0
- package/skills/ui-demo-recording/references/post-processing.md +57 -0
- package/skills/ui-design-polish/SKILL.md +113 -0
- package/skills/ui-design-polish/evals/triggers.json +18 -0
- package/skills/ui-design-polish/references/detail-checklist.md +45 -0
- package/skills/ui-design-polish/references/tokens.md +68 -0
- package/skills/ui-flow-audit/SKILL.md +112 -0
- package/skills/ui-flow-audit/evals/triggers.json +17 -0
- package/skills/ui-motion/SKILL.md +103 -0
- package/skills/ui-motion/evals/triggers.json +18 -0
- package/skills/ui-motion/references/patterns.md +138 -0
- package/skills/ui-motion/references/tokens.md +52 -0
- package/skills/unicode-text-processing/SKILL.md +103 -0
- package/skills/unicode-text-processing/evals/triggers.json +17 -0
- package/skills/unicode-text-processing/references/apis.md +89 -0
- package/skills/unicode-text-processing/references/script-notes.md +50 -0
- package/skills/verification-loop/SKILL.md +70 -0
- package/skills/verification-loop/evals/behavior.json +52 -0
- package/skills/verification-loop/evals/triggers.json +14 -0
- package/skills/verification-loop/scripts/detect-checks.js +102 -0
- package/skills/video-editing/SKILL.md +111 -0
- package/skills/video-editing/evals/triggers.json +16 -0
- package/skills/video-editing/references/edl-and-logging.md +44 -0
- package/skills/video-editing/references/ffmpeg-edit-recipes.md +92 -0
- package/skills/video-editing/references/resolve-scripting.md +53 -0
- package/skills/vite-patterns/SKILL.md +117 -0
- package/skills/vite-patterns/evals/triggers.json +16 -0
- package/skills/vue-patterns/SKILL.md +104 -0
- package/skills/vue-patterns/evals/triggers.json +16 -0
- package/skills/web-accessibility/SKILL.md +119 -0
- package/skills/web-accessibility/evals/triggers.json +16 -0
- package/skills/web-performance/SKILL.md +107 -0
- package/skills/web-performance/evals/triggers.json +16 -0
- package/skills/web-scraping/SKILL.md +80 -0
- package/skills/web-scraping/evals/triggers.json +16 -0
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: php-testing
|
|
3
|
+
description: Writing and fixing PHP test suites with PHPUnit or Pest, including attribute-based data providers and Pest datasets, test doubles via createMock/createStub or Mockery, database tests isolated by transactions, HTTP controller and client tests, and coverage with Xdebug or PCOV. Use when adding PHP unit or integration tests, converting PHPUnit annotations to attributes, deciding what to mock in PHP, or making a flaky PHP test deterministic.
|
|
4
|
+
license: MIT
|
|
5
|
+
compatibility: Any Agent Skills host. Needs php and composer; Xdebug or PCOV only for coverage.
|
|
6
|
+
metadata:
|
|
7
|
+
kete-loom/version: "0.1.0"
|
|
8
|
+
kete-loom/category: testing
|
|
9
|
+
kete-loom/risk: runs-commands
|
|
10
|
+
kete-loom/requires: "php, composer"
|
|
11
|
+
kete-loom/owner: "Kete-org"
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
# PHP testing
|
|
15
|
+
|
|
16
|
+
Tests that are fast, isolated and readable, written in whichever framework the project already uses.
|
|
17
|
+
|
|
18
|
+
## 0. Before you write
|
|
19
|
+
|
|
20
|
+
1. Identify the runner: `vendor/bin/pest` if `pestphp/pest` is in `composer.json` `require-dev`, else `vendor/bin/phpunit`. Check `composer.json` `scripts` for a `test` script and use it (`composer test`).
|
|
21
|
+
2. Read `phpunit.xml(.dist)`: test suites, bootstrap, `<php><env>` values (for example `APP_ENV=testing`, `DB_CONNECTION`), and `<source>` for coverage.
|
|
22
|
+
3. Note the PHPUnit major version (`composer show phpunit/phpunit`). PHPUnit 10 introduced attributes; 11 deprecated docblock annotations; 12 removed them. Make data providers `public static`: non-static providers are deprecated from PHPUnit 10.
|
|
23
|
+
4. Run the existing suite once. If it already fails, **stop and tell the user** which tests fail before you change anything.
|
|
24
|
+
5. Find the framework helpers already in use (Laravel `Tests\TestCase`, Symfony `KernelTestCase`/`WebTestCase`, a project base class) and extend the same one.
|
|
25
|
+
|
|
26
|
+
## 1. Layout and naming
|
|
27
|
+
|
|
28
|
+
- Mirror `src/` under `tests/Unit` and `tests/Feature` (or `tests/Integration`). Test class name = class under test + `Test`, autoloaded via `autoload-dev`.
|
|
29
|
+
- One behaviour per test. Name it as a sentence: `test_it_rejects_an_expired_coupon()` or `#[Test] public function rejectsExpiredCoupon()`; in Pest, `it('rejects an expired coupon', ...)`.
|
|
30
|
+
- Arrange, act, assert. Use the most specific assertion: `assertSame` (strict) over `assertEquals`, `assertCount`, `assertInstanceOf`, `expectException(X::class)` plus `expectExceptionMessage()`.
|
|
31
|
+
|
|
32
|
+
## 2. Data providers and datasets
|
|
33
|
+
|
|
34
|
+
PHPUnit 10+:
|
|
35
|
+
|
|
36
|
+
```php
|
|
37
|
+
use PHPUnit\Framework\Attributes\DataProvider;
|
|
38
|
+
use PHPUnit\Framework\Attributes\Test;
|
|
39
|
+
|
|
40
|
+
final class SlugTest extends TestCase
|
|
41
|
+
{
|
|
42
|
+
public static function cases(): iterable
|
|
43
|
+
{
|
|
44
|
+
yield 'spaces' => ['Hello World', 'hello-world'];
|
|
45
|
+
yield 'unicode' => ['Crème Brûlée', 'creme-brulee'];
|
|
46
|
+
yield 'empty' => ['', ''];
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
#[Test]
|
|
50
|
+
#[DataProvider('cases')]
|
|
51
|
+
public function slugifies(string $input, string $expected): void
|
|
52
|
+
{
|
|
53
|
+
self::assertSame($expected, Slug::from($input));
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Pest:
|
|
59
|
+
|
|
60
|
+
```php
|
|
61
|
+
it('slugifies', function (string $input, string $expected) {
|
|
62
|
+
expect(Slug::from($input))->toBe($expected);
|
|
63
|
+
})->with([
|
|
64
|
+
'spaces' => ['Hello World', 'hello-world'],
|
|
65
|
+
'empty' => ['', ''],
|
|
66
|
+
]);
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
- Always key the cases so a failure names the case.
|
|
70
|
+
- Converting annotations: `@dataProvider x` → `#[DataProvider('x')]`, `@test` → `#[Test]`, `@group g` → `#[Group('g')]`, `@covers` (class level) → `#[CoversClass(Foo::class)]`. Make provider methods `static`. Rector's PHPUnit sets can do this in bulk: ask before running it across the suite.
|
|
71
|
+
|
|
72
|
+
## 3. Test doubles
|
|
73
|
+
|
|
74
|
+
- Mock what you don't own and what is slow or nondeterministic: HTTP clients, mailers, queues, the clock, random sources. Don't mock value objects, entities or the class under test.
|
|
75
|
+
- PHPUnit: `$this->createStub(Repo::class)` when you only need return values (`->method('find')->willReturn($user)`); `$this->createMock(Repo::class)` when the call itself is the behaviour (`->expects($this->once())->method('save')->with($order)`).
|
|
76
|
+
- Mockery (if installed): `Mockery::mock(Repo::class)->shouldReceive('find')->once()->andReturn($user)`; make sure `Mockery::close()` runs (the `MockeryPHPUnitIntegration` trait or Pest does this).
|
|
77
|
+
- Final classes can't be doubled by PHPUnit. Depend on an interface, or use a hand-written fake. Don't remove `final` just to mock it.
|
|
78
|
+
- Time: inject a clock (`Psr\Clock\ClockInterface`, Symfony `MockClock`, Laravel `$this->travelTo()`/`Carbon::setTestNow()`). Never `sleep()` in a test.
|
|
79
|
+
- Prefer a small in-memory fake (`InMemoryOrderRepository`) over a deep mock chain; if setup needs more than three expectations, rethink the seam.
|
|
80
|
+
|
|
81
|
+
## 4. Database tests
|
|
82
|
+
|
|
83
|
+
- Use a dedicated test database, configured in `phpunit.xml` `<env>` or `.env.testing`. Never point tests at a shared or production database: **stop and ask** if the configured DSN looks like one.
|
|
84
|
+
- Isolate each test in a transaction that rolls back:
|
|
85
|
+
- Laravel: `use RefreshDatabase;` (migrates once, wraps each test) or `DatabaseTransactions` for an already-migrated database.
|
|
86
|
+
- Symfony + Doctrine: `dama/doctrine-test-bundle` (enable its PHPUnit extension in `phpunit.xml`).
|
|
87
|
+
- Plain PDO: `beginTransaction()` in `setUp()`, `rollBack()` in `tearDown()`.
|
|
88
|
+
- Transactions don't cover code that opens its own connection, commits explicitly, or runs DDL (MySQL commits implicitly on DDL). Those tests need truncation or a fresh schema.
|
|
89
|
+
- Create data with factories (Laravel model factories, Foundry for Symfony), only the fields the test cares about.
|
|
90
|
+
- SQLite in memory is fast but is not MySQL or Postgres: JSON, collation, locking and constraint behaviour differ. Run integration tests against the production engine (a container in CI) when those matter.
|
|
91
|
+
|
|
92
|
+
## 5. HTTP code
|
|
93
|
+
|
|
94
|
+
- Your endpoints: use the framework's test client, not a running server.
|
|
95
|
+
- Laravel: `$this->postJson('/api/orders', $payload)->assertCreated()->assertJsonPath('data.status', 'paid');`, `actingAs($user)`.
|
|
96
|
+
- Symfony: `$client = static::createClient(); $client->request('POST', '/orders'); self::assertResponseStatusCodeSame(201);`.
|
|
97
|
+
- PSR-15 apps: build a `ServerRequest` and call the handler directly.
|
|
98
|
+
- Cover per endpoint: success, validation failure (422/400), unauthenticated (401), forbidden (403), not found (404).
|
|
99
|
+
- Outgoing HTTP: never hit real services. Use Guzzle `MockHandler` with a `HandlerStack`, Symfony `MockHttpClient`, or Laravel `Http::fake()` plus `Http::preventStrayRequests()`. Assert the request you sent (method, URL, body), not only how you handled the response.
|
|
100
|
+
|
|
101
|
+
## 6. Running and coverage
|
|
102
|
+
|
|
103
|
+
- Single test: `vendor/bin/phpunit --filter slugifies tests/Unit/SlugTest.php`, `vendor/bin/pest --filter "slugifies"`.
|
|
104
|
+
- Random order shakes out hidden coupling: `--order-by=random` (PHPUnit), `--random-order-seed=<seed>` to reproduce.
|
|
105
|
+
- Parallel: `vendor/bin/pest --parallel`, `php artisan test --parallel`, or `brianium/paratest`. Each worker needs its own database.
|
|
106
|
+
- Coverage needs Xdebug (`XDEBUG_MODE=coverage`) or PCOV: `vendor/bin/phpunit --coverage-text`, `vendor/bin/pest --coverage --min=80`. Cover the new branches; don't chase a number.
|
|
107
|
+
|
|
108
|
+
## 7. Flaky tests
|
|
109
|
+
|
|
110
|
+
1. Rerun with `--order-by=random` and a fixed seed to see whether order matters.
|
|
111
|
+
2. Look for shared state: static properties, singletons, the service container, global time, leftover rows, the filesystem.
|
|
112
|
+
3. Replace the nondeterminism (clock, random, network) with a fake. Don't add retries or sleeps.
|
|
113
|
+
|
|
114
|
+
## Never
|
|
115
|
+
|
|
116
|
+
- Delete, skip (`markTestSkipped`) or weaken an assertion to make the suite pass without telling the user why.
|
|
117
|
+
- Call real third-party APIs, send real email or charge real payment methods from tests.
|
|
118
|
+
- Assert on `assertEquals` when the type matters, or `assertTrue($a == $b)` instead of a specific assertion.
|
|
119
|
+
- Leave `dd()`, `dump()`, `var_dump()` or `->only()` (Pest) in committed tests.
|
|
120
|
+
|
|
121
|
+
## Report
|
|
122
|
+
|
|
123
|
+
When done, state: tests added or changed (file and test names), the command you ran and its result, and anything not run (for example "integration tests need MySQL, not run").
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"should_trigger": [
|
|
3
|
+
"Write PHPUnit tests with a data provider for my PriceCalculator class",
|
|
4
|
+
"Convert our PHPUnit @dataProvider annotations to attributes so we can upgrade to PHPUnit 12",
|
|
5
|
+
"How do I mock the Guzzle client in a Pest test for my weather service?",
|
|
6
|
+
"My Laravel feature tests leave rows in the database between runs, how do I isolate them?",
|
|
7
|
+
"Add tests for the POST /orders endpoint in our Symfony app covering validation and auth failures"
|
|
8
|
+
],
|
|
9
|
+
"should_not_trigger": [
|
|
10
|
+
"Write a PHP 8.3 enum for invoice statuses with a label method",
|
|
11
|
+
"Review my PHP changes for type juggling bugs and missing strict_types",
|
|
12
|
+
"PHPStan fails at level 8 after upgrading Composer packages, fix it",
|
|
13
|
+
"Write pytest fixtures for my Django models",
|
|
14
|
+
"Set up Playwright end-to-end tests for the checkout page"
|
|
15
|
+
]
|
|
16
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: postgres-patterns
|
|
3
|
+
description: PostgreSQL schema, indexing and query-tuning guide covering data types and constraints, btree, partial, expression and GIN indexes, reading EXPLAIN (ANALYZE, BUFFERS) plans, isolation levels and lock conflicts, JSONB modelling, PgBouncer connection pooling, and pg_dump or point-in-time backups. Use when designing Postgres tables, a Postgres query is slow, you need to pick an index type, decode a lock wait or deadlock, store documents in JSONB, or set up pooling and backups for a PostgreSQL database.
|
|
4
|
+
license: MIT
|
|
5
|
+
compatibility: Any Agent Skills host. Running queries needs psql or the project's database client and a reachable PostgreSQL server; never point it at production without the user's say-so.
|
|
6
|
+
metadata:
|
|
7
|
+
kete-loom/version: "0.1.0"
|
|
8
|
+
kete-loom/category: data
|
|
9
|
+
kete-loom/risk: runs-commands
|
|
10
|
+
kete-loom/requires: "psql"
|
|
11
|
+
kete-loom/owner: "Kete-org"
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
# PostgreSQL patterns
|
|
15
|
+
|
|
16
|
+
Design tables the database can enforce, index for the queries you actually run, and prove every tuning change with a plan. For changing a live schema step by step, use the `database-migrations` skill; for MySQL or MariaDB, use `mysql-patterns`.
|
|
17
|
+
|
|
18
|
+
## 0. Before you start
|
|
19
|
+
|
|
20
|
+
1. Find the server version (`SELECT version();`) and how the app connects (ORM, driver, pooler). Advice differs across major versions; check the docs for that version.
|
|
21
|
+
2. Ask which environment you may query. Run `EXPLAIN ANALYZE` only on a dev or staging copy unless the user agrees: it **executes** the statement, including writes.
|
|
22
|
+
3. Wrap any `EXPLAIN ANALYZE` of an `INSERT`, `UPDATE` or `DELETE` in `BEGIN; ... ROLLBACK;`.
|
|
23
|
+
|
|
24
|
+
## 1. Schema design rules
|
|
25
|
+
|
|
26
|
+
- Primary keys: `bigint GENERATED ALWAYS AS IDENTITY`, or `uuid` when IDs are made outside the database. Never `serial` in new code, never `int` for a table that can grow past 2 billion rows.
|
|
27
|
+
- Time: `timestamptz`, stored in UTC. Never `timestamp` without time zone for events.
|
|
28
|
+
- Money: `numeric(p, s)` or integer minor units. Never `float`/`double precision`, never the `money` type.
|
|
29
|
+
- Text: `text` with a `CHECK (char_length(col) <= n)` when a limit is a business rule. `varchar(n)` is fine; `char(n)` is not.
|
|
30
|
+
- Enumerations: a lookup table or a `CHECK (status IN (...))`. Native `enum` types are hard to shrink later.
|
|
31
|
+
- Constraints are the schema: `NOT NULL` by default, `UNIQUE` for natural keys, `FOREIGN KEY` for every reference, `CHECK` for invariants. App-only validation drifts.
|
|
32
|
+
- Index every foreign key column you join or delete through. Postgres does not create them for you, and an unindexed FK makes parent deletes scan the child table.
|
|
33
|
+
- Name constraints and indexes explicitly (`orders_customer_id_fkey`, `orders_created_at_idx`) so migrations can refer to them.
|
|
34
|
+
|
|
35
|
+
## 2. Pick the index
|
|
36
|
+
|
|
37
|
+
| Query shape | Index |
|
|
38
|
+
|---|---|
|
|
39
|
+
| `=`, `<`, `>`, `BETWEEN`, `ORDER BY`, `LIKE 'abc%'` (C collation or `text_pattern_ops`) | btree (default) |
|
|
40
|
+
| Filter always on a subset (`WHERE deleted_at IS NULL`, `status = 'pending'`) | partial btree: `CREATE INDEX ... WHERE status = 'pending'` |
|
|
41
|
+
| Filter on a function (`lower(email)`, `(data->>'sku')`) | expression index on exactly that expression |
|
|
42
|
+
| JSONB containment `@>`, key exists `?`, arrays `&&`/`@>`, full-text `@@` | GIN (`jsonb_path_ops` when you only need `@>` and jsonpath) |
|
|
43
|
+
| Substring / fuzzy text `ILIKE '%abc%'` | GIN with `pg_trgm` (`gin_trgm_ops`) |
|
|
44
|
+
| Huge append-only table filtered by time | BRIN on the time column |
|
|
45
|
+
| Ranges, geometry, exclusion constraints | GiST |
|
|
46
|
+
|
|
47
|
+
Rules:
|
|
48
|
+
|
|
49
|
+
1. Multicolumn btree: equality columns first, then the range or sort column. `(tenant_id, created_at)` serves `WHERE tenant_id = $1 ORDER BY created_at DESC`.
|
|
50
|
+
2. Use `INCLUDE (...)` to make an index covering for an index-only scan, instead of adding columns to the key.
|
|
51
|
+
3. Every index costs writes, disk and vacuum time. Check `pg_stat_user_indexes.idx_scan` before adding more; drop indexes that stay at 0 on the primary and every replica (stats are per server), except ones that back a `UNIQUE` or primary key constraint.
|
|
52
|
+
4. On a table with live traffic, build with `CREATE INDEX CONCURRENTLY` (not inside a transaction). If it fails it leaves an `INVALID` index: drop it and retry.
|
|
53
|
+
|
|
54
|
+
## 3. Tune a slow query
|
|
55
|
+
|
|
56
|
+
1. Get the exact statement and real parameter values. Check `pg_stat_statements` for total and mean time if it is installed.
|
|
57
|
+
2. Run `EXPLAIN (ANALYZE, BUFFERS) <query>` on a realistic copy.
|
|
58
|
+
3. Read the plan bottom-up. Look for: estimated vs actual rows off by 10x or more, `Seq Scan` on a big table with a selective filter, `Rows Removed by Filter` much larger than rows returned, `Sort` with `external merge`, nested loops with a high `loops` count.
|
|
59
|
+
4. Fix the cause, in this order: stale stats (`ANALYZE table`), a missing or wrong index, a non-sargable predicate (function on the column, implicit cast, leading `%`), then query shape (`EXISTS` instead of `IN` with a big subquery, keyset pagination instead of big `OFFSET`).
|
|
60
|
+
5. Re-run the same `EXPLAIN` and compare time and buffers. Report before and after.
|
|
61
|
+
|
|
62
|
+
Plan-node reference and worked examples: `references/explain.md`.
|
|
63
|
+
|
|
64
|
+
## 4. Transactions, isolation and locks
|
|
65
|
+
|
|
66
|
+
- Default isolation is `READ COMMITTED`: each statement sees a fresh snapshot. Read-then-write logic (check balance, then update) needs `SELECT ... FOR UPDATE`, a guarded `UPDATE ... WHERE balance >= $1`, or `SERIALIZABLE`.
|
|
67
|
+
- `REPEATABLE READ` and `SERIALIZABLE` can fail with SQLSTATE `40001`. The app **must** retry the whole transaction; if it can't, don't use them.
|
|
68
|
+
- Lock rows in a consistent order (for example by primary key) to avoid deadlocks (`40P01`).
|
|
69
|
+
- Queues: `SELECT ... FOR UPDATE SKIP LOCKED LIMIT n` lets several workers claim jobs without blocking each other.
|
|
70
|
+
- Keep transactions short. Never hold one open across a network call or user think-time. Set `idle_in_transaction_session_timeout` so a stuck client can't hold locks for hours.
|
|
71
|
+
- Upserts: `INSERT ... ON CONFLICT (key) DO UPDATE` instead of select-then-insert.
|
|
72
|
+
- Diagnose waits with `pg_stat_activity` (`wait_event_type = 'Lock'`) and `pg_blocking_pids(pid)`. Queries: `references/locks.md`.
|
|
73
|
+
|
|
74
|
+
## 5. JSONB
|
|
75
|
+
|
|
76
|
+
- Use JSONB for genuinely variable attributes, payload archives and sparse settings. Columns you filter, join or constrain on every request belong in real columns.
|
|
77
|
+
- Index what you query: GIN for `@>`; an expression btree for one hot key (`((data->>'customer_id'))`).
|
|
78
|
+
- Validate shape with `CHECK (jsonb_typeof(data->'items') = 'array')` or in the app; Postgres won't do it otherwise.
|
|
79
|
+
- Updating one key rewrites the whole value. Large, frequently updated documents bloat the table.
|
|
80
|
+
|
|
81
|
+
## 6. Connections and pooling
|
|
82
|
+
|
|
83
|
+
- Each connection is a backend process. Keep the total across all app instances small (a rule of thumb is a few connections per database CPU core; measure from there), not one per request thread.
|
|
84
|
+
- Put PgBouncer (or the platform's pooler) in front when many app instances or serverless functions connect. In `transaction` pool mode, session state does not survive between transactions: no session `SET`, advisory session locks, `LISTEN`, or temp tables across transactions. Server-side prepared statements need pooler support (PgBouncer 1.21+ `max_prepared_statements`) or must be disabled in the driver.
|
|
85
|
+
- Set `statement_timeout` per role or per request for web traffic so a runaway query can't pin a connection.
|
|
86
|
+
|
|
87
|
+
## 7. Backups
|
|
88
|
+
|
|
89
|
+
- Logical: `pg_dump -Fc dbname > db.dump`, restore with `pg_restore -d target db.dump`. Good for small databases and moving data between versions.
|
|
90
|
+
- Physical with point-in-time recovery: a base backup (`pg_basebackup` or a tool such as pgBackRest or WAL-G) plus continuous WAL archiving. Use this for production.
|
|
91
|
+
- A backup you have never restored is not a backup. Schedule a restore test and record how long it takes.
|
|
92
|
+
- Managed services: confirm the retention window and PITR setting rather than assuming.
|
|
93
|
+
|
|
94
|
+
## Never
|
|
95
|
+
|
|
96
|
+
- Never run `EXPLAIN ANALYZE`, `VACUUM FULL`, `REINDEX` without `CONCURRENTLY`, or any DDL against production without the user's explicit go-ahead.
|
|
97
|
+
- Never disable a constraint or trigger to make a load "faster" without a plan to re-validate.
|
|
98
|
+
- Never build SQL by string concatenation with user input. Use bind parameters.
|
|
99
|
+
- Never change a `postgresql.conf` setting without stating the old value, the new value and how to revert.
|
|
100
|
+
|
|
101
|
+
## Report back
|
|
102
|
+
|
|
103
|
+
For a tuning task: the query, the plan's key problem (one line), the change made, before and after timings and buffers, and anything you could not test. For a design task: the DDL, one line per non-obvious choice, and the indexes with the query each one serves.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"should_trigger": [
|
|
3
|
+
"This Postgres query takes 4 seconds, here's the EXPLAIN ANALYZE, what index do I need?",
|
|
4
|
+
"Should I use a GIN index or an expression index for filtering on a JSONB column?",
|
|
5
|
+
"Design the PostgreSQL tables for subscriptions, invoices and payments with proper constraints",
|
|
6
|
+
"We keep getting deadlock detected errors in Postgres when two workers update balances",
|
|
7
|
+
"Set up PgBouncer for our Postgres database, the app keeps running out of connections",
|
|
8
|
+
"What's the right way to back up a production PostgreSQL database with point-in-time recovery?"
|
|
9
|
+
],
|
|
10
|
+
"should_not_trigger": [
|
|
11
|
+
"Our MySQL InnoDB table has gap lock deadlocks on insert, how do we avoid them?",
|
|
12
|
+
"Plan a zero-downtime migration to change orders.id from int to bigint",
|
|
13
|
+
"Review this pull request's migrations for locking hazards and missing indexes",
|
|
14
|
+
"Write the Prisma schema and client queries for a blog with posts and comments",
|
|
15
|
+
"Add caching with Redis in front of the product lookup endpoint"
|
|
16
|
+
]
|
|
17
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# Reading PostgreSQL plans
|
|
2
|
+
|
|
3
|
+
Run `EXPLAIN (ANALYZE, BUFFERS, VERBOSE) <query>;` on a realistic copy. Add `SETTINGS` to show non-default planner settings. For a write, wrap it:
|
|
4
|
+
|
|
5
|
+
```sql
|
|
6
|
+
BEGIN;
|
|
7
|
+
EXPLAIN (ANALYZE, BUFFERS) UPDATE orders SET status = 'paid' WHERE id = 42;
|
|
8
|
+
ROLLBACK;
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## What each number means
|
|
12
|
+
|
|
13
|
+
- `cost=startup..total`: planner estimate in arbitrary units. Compare only within one plan.
|
|
14
|
+
- `rows=`: estimated rows (first parenthesis) vs actual rows (`actual ... rows=`). A 10x or bigger gap means the planner is guessing; fix stats before anything else.
|
|
15
|
+
- `loops=`: how many times the node ran. Actual time and rows are **per loop**; multiply to get the total.
|
|
16
|
+
- `Buffers: shared hit=` pages found in cache, `read=` pages read from disk or OS cache, `dirtied`/`written` for writes.
|
|
17
|
+
- `Rows Removed by Filter`: rows read then discarded. Large numbers point to a missing or unusable index.
|
|
18
|
+
|
|
19
|
+
## Nodes and what they suggest
|
|
20
|
+
|
|
21
|
+
| Node | Usually fine when | Problem sign and fix |
|
|
22
|
+
|---|---|---|
|
|
23
|
+
| Seq Scan | small table, or most rows needed | big table, few rows returned: add an index matching the filter |
|
|
24
|
+
| Index Scan | selective filter | many loops inside a nested loop: check join order and estimates |
|
|
25
|
+
| Index Only Scan | `Heap Fetches` near 0 | high `Heap Fetches`: table needs `VACUUM` so the visibility map is current |
|
|
26
|
+
| Bitmap Heap Scan | medium selectivity | `Recheck Cond` removing many rows with `lossy` blocks: raise `work_mem` for that query |
|
|
27
|
+
| Nested Loop | outer side small | outer side large because of a bad estimate: fix stats or rewrite |
|
|
28
|
+
| Hash Join | medium/large inputs | `Batches` > 1: hash spilled to disk, raise `work_mem` for that session |
|
|
29
|
+
| Merge Join | both inputs already sorted | an explicit `Sort` below it on a huge input |
|
|
30
|
+
| Sort | `Sort Method: quicksort Memory` | `external merge Disk`: add an index matching `ORDER BY`, or raise `work_mem` locally |
|
|
31
|
+
| Limit + Sort | top-N heapsort | scanning the whole table to return 10 rows: index on the sort key |
|
|
32
|
+
|
|
33
|
+
## Fixing bad estimates
|
|
34
|
+
|
|
35
|
+
1. `ANALYZE table_name;` then re-plan.
|
|
36
|
+
2. Correlated columns (`city`, `postcode`): `CREATE STATISTICS s (dependencies, ndistinct) ON city, postcode FROM addresses; ANALYZE addresses;`
|
|
37
|
+
3. Skewed column: `ALTER TABLE t ALTER COLUMN c SET STATISTICS 1000; ANALYZE t;`
|
|
38
|
+
4. Generic plan for prepared statements chose badly: test with literal values, and consider `plan_cache_mode = force_custom_plan` for that session only.
|
|
39
|
+
|
|
40
|
+
## Non-sargable predicates and rewrites
|
|
41
|
+
|
|
42
|
+
| Slow form | Index-friendly form |
|
|
43
|
+
|---|---|
|
|
44
|
+
| `WHERE date(created_at) = '2024-01-01'` | `WHERE created_at >= '2024-01-01' AND created_at < '2024-01-02'` |
|
|
45
|
+
| `WHERE lower(email) = $1` with a plain index | expression index `ON users (lower(email))` |
|
|
46
|
+
| `WHERE id::text = $1` | compare with the column's own type |
|
|
47
|
+
| `WHERE a = $1 OR b = $1` | two indexed queries joined with `UNION` (or rely on a BitmapOr if both are indexed) |
|
|
48
|
+
| `ORDER BY id LIMIT 20 OFFSET 100000` | keyset: `WHERE id > $last_id ORDER BY id LIMIT 20` |
|
|
49
|
+
| `NOT IN (subquery)` with nullable column | `NOT EXISTS (...)` (also correct with NULLs) |
|
|
50
|
+
|
|
51
|
+
## Finding the slow queries
|
|
52
|
+
|
|
53
|
+
```sql
|
|
54
|
+
-- needs the pg_stat_statements extension
|
|
55
|
+
SELECT calls, round(total_exec_time) AS total_ms, round(mean_exec_time, 1) AS mean_ms, query
|
|
56
|
+
FROM pg_stat_statements ORDER BY total_exec_time DESC LIMIT 20;
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
`auto_explain` (with `auto_explain.log_min_duration`) logs plans of slow statements as they run in staging or production.
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# PostgreSQL locks: what blocks what
|
|
2
|
+
|
|
3
|
+
## Table lock levels you meet most
|
|
4
|
+
|
|
5
|
+
| Lock | Taken by | Blocks |
|
|
6
|
+
|---|---|---|
|
|
7
|
+
| ACCESS SHARE | `SELECT` | only ACCESS EXCLUSIVE |
|
|
8
|
+
| ROW EXCLUSIVE | `INSERT`, `UPDATE`, `DELETE` | SHARE and stronger (for example plain `CREATE INDEX`) |
|
|
9
|
+
| SHARE UPDATE EXCLUSIVE | `VACUUM`, `ANALYZE`, `CREATE INDEX CONCURRENTLY`, `VALIDATE CONSTRAINT` | other schema changes, not reads or writes |
|
|
10
|
+
| SHARE | plain `CREATE INDEX` | all writes to the table |
|
|
11
|
+
| SHARE ROW EXCLUSIVE | `ADD FOREIGN KEY` (on both tables) | writes |
|
|
12
|
+
| ACCESS EXCLUSIVE | most `ALTER TABLE`, `DROP`, `TRUNCATE`, `VACUUM FULL` | everything, including `SELECT` |
|
|
13
|
+
|
|
14
|
+
`REINDEX` without `CONCURRENTLY` takes SHARE on the table (blocks writes) and ACCESS EXCLUSIVE on the index (blocks queries that would use it).
|
|
15
|
+
|
|
16
|
+
The queue matters: an `ALTER TABLE` waiting for ACCESS EXCLUSIVE behind one long transaction makes every later `SELECT` wait behind it. Always set `lock_timeout` before DDL on a busy table:
|
|
17
|
+
|
|
18
|
+
```sql
|
|
19
|
+
SET lock_timeout = '3s';
|
|
20
|
+
SET statement_timeout = '15min';
|
|
21
|
+
ALTER TABLE ...;
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
If it times out, retry later; don't raise the timeout to minutes.
|
|
25
|
+
|
|
26
|
+
## Who is blocking whom
|
|
27
|
+
|
|
28
|
+
```sql
|
|
29
|
+
SELECT a.pid, a.state, a.wait_event_type, a.wait_event,
|
|
30
|
+
pg_blocking_pids(a.pid) AS blocked_by,
|
|
31
|
+
now() - a.xact_start AS xact_age, left(a.query, 120) AS query
|
|
32
|
+
FROM pg_stat_activity a
|
|
33
|
+
WHERE a.datname = current_database() AND a.pid <> pg_backend_pid()
|
|
34
|
+
ORDER BY xact_age DESC NULLS LAST;
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Long `idle in transaction` sessions at the top are the usual culprit. `pg_cancel_backend(pid)` cancels the query; `pg_terminate_backend(pid)` drops the connection. Ask the user before running either on a shared server.
|
|
38
|
+
|
|
39
|
+
## Row locks
|
|
40
|
+
|
|
41
|
+
- `FOR UPDATE`: you will update or delete the row.
|
|
42
|
+
- `FOR NO KEY UPDATE`: you will update non-key columns; does not block inserts of child rows referencing it. Plain `UPDATE` of non-key columns takes this.
|
|
43
|
+
- `FOR SHARE`: others must not update or delete it.
|
|
44
|
+
- `FOR KEY SHARE`: others must not delete it or change its key; non-key updates still proceed. FK checks take this on the parent row.
|
|
45
|
+
- `NOWAIT` fails immediately instead of waiting; `SKIP LOCKED` skips locked rows (job queues only, it gives an inconsistent view).
|
|
46
|
+
|
|
47
|
+
## Deadlocks
|
|
48
|
+
|
|
49
|
+
The server log line `deadlock detected` lists both statements. Fix by locking rows in one order everywhere (sort IDs before a batch update), keeping transactions short, and not mixing `SELECT ... FOR SHARE` then `UPDATE` on the same rows from two sessions.
|
|
50
|
+
|
|
51
|
+
## Advisory locks
|
|
52
|
+
|
|
53
|
+
`pg_advisory_xact_lock(key)` serialises work on an app-level key (for example one cron job at a time) and releases at commit. Session-level `pg_advisory_lock` does not work safely behind a transaction-mode pooler.
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: prd-writing
|
|
3
|
+
description: Product requirements document (PRD) drafting that starts from the user problem and the evidence for it, sets goals and explicit non-goals, describes target users and scenarios, writes numbered requirements each with testable acceptance criteria and a priority, picks success and guardrail metrics with baselines, lists open questions with owners, and plans a staged rollout. Use when a product manager or engineer needs a PRD, product spec or feature brief written, reviewed or tightened before design and engineering commit to building it.
|
|
4
|
+
license: MIT
|
|
5
|
+
compatibility: Any Agent Skills host. No tools required; reads existing docs or code when the user points to them.
|
|
6
|
+
metadata:
|
|
7
|
+
kete-loom/version: "0.1.0"
|
|
8
|
+
kete-loom/category: docs
|
|
9
|
+
kete-loom/risk: writes-files
|
|
10
|
+
kete-loom/owner: "Kete-org"
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# PRD writing
|
|
14
|
+
|
|
15
|
+
A PRD says what problem to solve, for whom, and how you will know it worked. It does not say how to build it; that belongs in a design doc or an implementation plan.
|
|
16
|
+
|
|
17
|
+
## 0. Before you write
|
|
18
|
+
|
|
19
|
+
1. Collect what exists: the request, user research, support tickets, analytics, sales notes, earlier docs. Search the repo or docs folder if the user points to one.
|
|
20
|
+
2. Answer these five questions. If you cannot answer the first two, **stop and ask the user**; do not invent a problem or evidence.
|
|
21
|
+
- What problem, for which users?
|
|
22
|
+
- What evidence says it is real and worth solving now (numbers, quotes, tickets, lost deals)?
|
|
23
|
+
- What does success look like, measurably?
|
|
24
|
+
- What is out of scope?
|
|
25
|
+
- What deadline or constraint is fixed (legal date, launch event, contract)?
|
|
26
|
+
3. Find the house template. If the team has one, use its headings and add missing sections below rather than replacing it.
|
|
27
|
+
|
|
28
|
+
## 1. Problem and evidence
|
|
29
|
+
|
|
30
|
+
- State the problem from the user's side in two to four sentences. No solution words ("we need a dashboard") in the problem statement.
|
|
31
|
+
- List evidence with its source and date. Mark anecdote as anecdote. If evidence is thin, say so and add "validate the problem" as an open question.
|
|
32
|
+
- Say why now: what it costs to wait.
|
|
33
|
+
|
|
34
|
+
## 2. Goals and non-goals
|
|
35
|
+
|
|
36
|
+
- Goals: three at most, each an outcome, not a feature ("cut time to first invoice below 5 minutes", not "add an invoice wizard").
|
|
37
|
+
- Non-goals: things a reader could reasonably expect that you will not do. Each non-goal prevents a later argument, so be specific.
|
|
38
|
+
|
|
39
|
+
## 3. Users and scenarios
|
|
40
|
+
|
|
41
|
+
- Name the primary user segment and any secondary ones. Use real segments the team already tracks, not invented personas with names and hobbies.
|
|
42
|
+
- Write three to six scenarios: who, situation, what they try to do, what success looks like for them. Include at least one edge or failure scenario (no data yet, permissions missing, offline, large account).
|
|
43
|
+
|
|
44
|
+
## 4. Requirements
|
|
45
|
+
|
|
46
|
+
Number every requirement so reviews and tickets can cite it. Use this shape:
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
R3 (Must): An admin can invite a teammate by email from the Members page.
|
|
50
|
+
Acceptance:
|
|
51
|
+
- Given an admin on Members, when they submit a valid email, then an invite is sent and appears as Pending.
|
|
52
|
+
- Given an email already on the team, when they submit it, then they see "already a member" and no invite is sent.
|
|
53
|
+
- Invites expire after 7 days. (Open question Q2: confirm with security.)
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Rules:
|
|
57
|
+
|
|
58
|
+
- Priority on every requirement: Must, Should or Could. If more than about half are Must, push back: ask what ships if time runs out.
|
|
59
|
+
- Acceptance criteria are observable and testable. Ban "fast", "easy", "intuitive" and "seamless" unless given a number or a check.
|
|
60
|
+
- Cover non-functional needs the user cares about: performance targets, accessibility, privacy and data retention, localisation, permissions, audit.
|
|
61
|
+
- Describe behaviour, not UI layout or architecture, unless the constraint is real (for example "must work inside the existing mobile app").
|
|
62
|
+
|
|
63
|
+
## 5. Metrics
|
|
64
|
+
|
|
65
|
+
- One primary success metric tied to the goals, with current baseline, target and the date you will read it.
|
|
66
|
+
- One to three guardrail metrics that must not get worse (error rate, support tickets, churn, latency).
|
|
67
|
+
- Say where each metric comes from. If the event or query does not exist yet, add tracking as a requirement.
|
|
68
|
+
- If there is no baseline, say so; do not guess one.
|
|
69
|
+
|
|
70
|
+
## 6. Open questions and risks
|
|
71
|
+
|
|
72
|
+
Table of open questions, each with an owner and a date it must be answered by. Risks get a likelihood, an impact and a mitigation. Anything legal, privacy, security or pricing related gets flagged for the owning team; do not answer it yourself.
|
|
73
|
+
|
|
74
|
+
## 7. Rollout
|
|
75
|
+
|
|
76
|
+
- Stages: internal, beta or percentage rollout, general availability. Say who is in each and what signal moves you to the next.
|
|
77
|
+
- Feature flag or kill switch, and what turning it off does to users mid-flow.
|
|
78
|
+
- Migration of existing data or users, support and docs readiness, and who announces it.
|
|
79
|
+
- For deploy mechanics (canary, blue-green, flags) defer to the `deployment-strategies` skill if available.
|
|
80
|
+
|
|
81
|
+
## Output format
|
|
82
|
+
|
|
83
|
+
Write the PRD as Markdown (or into the user's template) with these headings in order:
|
|
84
|
+
|
|
85
|
+
```
|
|
86
|
+
# <Feature>: PRD
|
|
87
|
+
Status: Draft | In review | Approved Owner: <name> Last updated: <date>
|
|
88
|
+
## Summary (three sentences: problem, proposal, expected result)
|
|
89
|
+
## Problem and evidence
|
|
90
|
+
## Goals
|
|
91
|
+
## Non-goals
|
|
92
|
+
## Users and scenarios
|
|
93
|
+
## Requirements (R1..Rn, priority, acceptance criteria)
|
|
94
|
+
## Metrics (primary, guardrails, baseline, target, source)
|
|
95
|
+
## Open questions (Q1..Qn, owner, due)
|
|
96
|
+
## Risks
|
|
97
|
+
## Rollout
|
|
98
|
+
## Appendix (research links, mockups)
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Keep it short enough to read in ten minutes. Move research detail to the appendix.
|
|
102
|
+
|
|
103
|
+
## Reviewing an existing PRD
|
|
104
|
+
|
|
105
|
+
Check in this order and report findings as a list, most serious first:
|
|
106
|
+
|
|
107
|
+
1. Is the problem stated without a solution, and is there evidence?
|
|
108
|
+
2. Are goals outcomes with numbers? Are non-goals present?
|
|
109
|
+
3. Does every requirement have a priority and testable acceptance criteria?
|
|
110
|
+
4. Is there a primary metric with a baseline and a guardrail?
|
|
111
|
+
5. Do open questions have owners and dates?
|
|
112
|
+
6. Is there a rollout and a way to turn it off?
|
|
113
|
+
|
|
114
|
+
## Never
|
|
115
|
+
|
|
116
|
+
- Never invent user quotes, research findings, metrics or baselines. Mark gaps as open questions.
|
|
117
|
+
- Never pick an implementation (database, framework, architecture) in the PRD; record it as a constraint only if it truly is one.
|
|
118
|
+
- Never mark the PRD Approved; only the named approvers can.
|
|
119
|
+
|
|
120
|
+
## Neighbours
|
|
121
|
+
|
|
122
|
+
- Recording a technical decision: `architecture-decision-records`.
|
|
123
|
+
- Turning an agreed PRD into files and steps: the `planner` agent or `/plan-feature`.
|
|
124
|
+
- Sizing the work: `estimation-and-scoping`.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"should_trigger": [
|
|
3
|
+
"Write a PRD for letting admins invite teammates by email, here are the support tickets asking for it",
|
|
4
|
+
"Can you turn these customer interview notes into a product requirements doc with goals, non-goals and acceptance criteria?",
|
|
5
|
+
"Review this product spec draft and tell me what's missing before we hand it to engineering",
|
|
6
|
+
"I need a feature brief for offline mode in the field app: problem, success metrics and rollout stages"
|
|
7
|
+
],
|
|
8
|
+
"should_not_trigger": [
|
|
9
|
+
"Break the invite-teammates feature down into files to change and tests to write first",
|
|
10
|
+
"Record our decision to use Postgres instead of DynamoDB as an architecture decision record",
|
|
11
|
+
"How many weeks will the offline mode feature take? Give me a range with confidence",
|
|
12
|
+
"Write the release notes for version 2.4 that shipped the invite feature",
|
|
13
|
+
"Rewrite the README getting-started section so new contributors can run the app"
|
|
14
|
+
]
|
|
15
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: prisma-patterns
|
|
3
|
+
description: Prisma ORM practice for TypeScript backends, detecting whether the project is on Prisma 6, 7 or the Prisma 8 contract-based release, then covering schema modelling, the migrate dev versus deploy workflow, include and select to kill N+1 queries, sequential and interactive transactions, pool sizing behind serverless functions and PgBouncer, and injection-safe raw SQL. Use when editing schema.prisma or a Prisma contract, creating or deploying Prisma migrations, debugging slow Prisma queries or connection pool timeouts, or writing $queryRaw.
|
|
4
|
+
license: MIT
|
|
5
|
+
compatibility: Any Agent Skills host. Needs Node and the project's package manager to run the Prisma CLI. Prisma 7 needs Node 20.19 or later and a driver adapter; Prisma 8 differs a lot, see the reference file.
|
|
6
|
+
metadata:
|
|
7
|
+
kete-loom/version: "0.1.0"
|
|
8
|
+
kete-loom/category: data
|
|
9
|
+
kete-loom/risk: runs-commands
|
|
10
|
+
kete-loom/requires: "node, npx"
|
|
11
|
+
kete-loom/owner: "Kete-org"
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
# Prisma patterns
|
|
15
|
+
|
|
16
|
+
Prisma changed shape twice in a short time. Find out which major version the project uses **before** writing a line, then follow the rules for that version.
|
|
17
|
+
|
|
18
|
+
## 0. Detect the version first
|
|
19
|
+
|
|
20
|
+
1. Read `package.json` for `prisma` and `@prisma/client` (Prisma 6 or 7) or `@prisma/orm-postgres` / `@prisma/orm-mongo` (Prisma 8). Confirm with the project's package manager, for example `npx prisma --version`.
|
|
21
|
+
2. Look for the schema: `prisma/schema.prisma` with `generator` and `datasource` blocks means 6 or 7. A `contract.prisma` starting with `// use prisma-8` means 8.
|
|
22
|
+
3. If it's Prisma 8, read `references/prisma-8.md` and use its command and API names. The rest of this file describes 6 and 7.
|
|
23
|
+
4. **Never upgrade the major version as a side effect.** On a Prisma 7 project, a bare `npm install prisma` can pull the Prisma 8 CLI; pin it (`npm install --save-dev prisma@7`). Ask the user before any major upgrade.
|
|
24
|
+
5. Find the migration history (`prisma/migrations/`) and how CI deploys it. Read `references/workflow.md` before creating or deploying a migration.
|
|
25
|
+
|
|
26
|
+
## 1. Schema design (6 and 7)
|
|
27
|
+
|
|
28
|
+
- In Prisma 7, the `generator` block needs an explicit `output` path, datasource URLs move to `prisma.config.ts`, and the client is created with a driver adapter (for example `@prisma/adapter-pg`). Follow the pattern already in the project.
|
|
29
|
+
- Use `@id @default(cuid())`, `uuid()` or `autoincrement()` consistently with the existing models. Map to existing table and column names with `@@map` and `@map` instead of renaming the database.
|
|
30
|
+
- Add `@@index` for every foreign key you filter or join on. PostgreSQL never indexes foreign key columns on its own. MySQL (InnoDB) does when real foreign keys exist, but not with `relationMode = "prisma"`, which needs the indexes added by hand.
|
|
31
|
+
- Use `@@unique` for real invariants (`@@unique([tenantId, email])`), and set `onDelete` explicitly on relations (`Cascade`, `Restrict`, `SetNull`) rather than relying on defaults.
|
|
32
|
+
- Money: `Decimal` (`@db.Decimal(12, 2)`) or integer minor units, never `Float`. Timestamps: `DateTime @default(now())` and `@updatedAt`.
|
|
33
|
+
- Enums are fine for small closed sets; adding a value is a migration.
|
|
34
|
+
|
|
35
|
+
## 2. Queries and N+1
|
|
36
|
+
|
|
37
|
+
- Ask for related data in the same call: `include: { posts: true }` or a nested `select`. A loop that calls `findUnique` or `findMany` per parent row is N+1; replace it with one `findMany({ where: { id: { in: ids } } })` or an `include`.
|
|
38
|
+
- `select` only the fields the caller needs, especially on wide tables and in list endpoints.
|
|
39
|
+
- `relationLoadStrategy` is still a Preview feature: it needs `previewFeatures = ["relationJoins"]` in the generator and works on PostgreSQL, CockroachDB and MySQL. With the flag on, `"join"` (one SQL query) is the default and `"query"` sends one query per relation level. Measure both on deep includes, and don't add a preview flag without telling the user.
|
|
40
|
+
- Paginate with `cursor` + `take` on an indexed unique field for large lists; `skip` scans skipped rows.
|
|
41
|
+
- Use `createMany`, `updateMany`, `deleteMany` for bulk work instead of loops; they don't return the rows (use `createManyAndReturn` where supported).
|
|
42
|
+
- To see the SQL, construct the client with `log: ["query"]` in development, then run `EXPLAIN` on the slow statement in the database.
|
|
43
|
+
|
|
44
|
+
## 3. Transactions
|
|
45
|
+
|
|
46
|
+
- **Nested writes** (`create` with nested `create`/`connect`) are already one transaction. Prefer them for parent-and-children writes.
|
|
47
|
+
- **Sequential**: `prisma.$transaction([a, b])` runs independent operations atomically.
|
|
48
|
+
- **Interactive**: `prisma.$transaction(async (tx) => { ... })` for read-then-write logic. Use `tx` for every query inside; a query on `prisma` runs outside the transaction. Defaults are `maxWait` 2000 ms and `timeout` 5000 ms; raise them only with a reason.
|
|
49
|
+
- Never do network calls (payments, email, HTTP) inside an interactive transaction: it holds a connection and row locks while it waits.
|
|
50
|
+
- For concurrency-sensitive updates, use an atomic update (`update({ where: { id, version }, data: { balance: { decrement: 10 }, version: { increment: 1 } } })`) or `isolationLevel: "Serializable"` with a retry on serialization failure (`P2034`).
|
|
51
|
+
|
|
52
|
+
## 4. Connections and serverless
|
|
53
|
+
|
|
54
|
+
- Create **one** client per process and reuse it. In dev servers with hot reload, keep it on `globalThis` so reloads don't open new pools.
|
|
55
|
+
- Prisma 6: the pool size comes from `connection_limit` in the URL (default `num_physical_cpus * 2 + 1`) and `pool_timeout` (default 10 s). Prisma 7: the driver adapter owns the pool, for example `new PrismaPg({ connectionString, max: 10 })`; `pg` defaults to 10 connections and no acquire timeout, so set `connectionTimeoutMillis`.
|
|
56
|
+
- Serverless functions multiply pools: every warm instance holds its own. Size per-instance pools small (1 to 5), and put a pooler in front (PgBouncer in transaction mode, Supabase's or Neon's pooler, or Prisma Accelerate). On Prisma 6 with PgBouncer, add `pgbouncer=true` to the URL.
|
|
57
|
+
- Migrations must use a **direct** (unpooled) connection: `directUrl` in Prisma 6, the URL in `prisma.config.ts` in Prisma 7.
|
|
58
|
+
- Pool timeout errors (`P2024`) mean the pool is exhausted: look for slow or long transactions and missing `await`s before raising the pool size.
|
|
59
|
+
|
|
60
|
+
## 5. Raw SQL
|
|
61
|
+
|
|
62
|
+
- Use tagged templates: ``prisma.$queryRaw`SELECT * FROM "User" WHERE email = ${email}` ``. Values become bound parameters.
|
|
63
|
+
- Build dynamic fragments with `Prisma.sql` and lists with `Prisma.join(ids)`. Identifiers (table or column names) can't be parameters; pick them from a fixed allow-list in code.
|
|
64
|
+
- `$queryRawUnsafe` / `$executeRawUnsafe` and `Prisma.raw` with any user input are SQL injection. Use them only with `$1` placeholders and parameters passed separately, and flag any other use in review.
|
|
65
|
+
- Prefer TypedSQL (`.sql` files in `prisma/sql/`, run through `prisma generate --sql`) for complex reads that must stay typed. Check whether your version still needs the `typedSql` preview feature.
|
|
66
|
+
|
|
67
|
+
## Never
|
|
68
|
+
|
|
69
|
+
- Run `prisma migrate dev`, `prisma migrate reset` or `prisma db push` against a shared, staging or production database.
|
|
70
|
+
- Edit a migration that has already been applied anywhere except your machine.
|
|
71
|
+
- Swallow Prisma errors: map known codes (`P2002` unique violation, `P2025` record not found) to domain errors and rethrow the rest.
|
|
72
|
+
- Return raw Prisma models from an API without choosing fields; it leaks columns such as password hashes.
|
|
73
|
+
|
|
74
|
+
## Report format (when reviewing)
|
|
75
|
+
|
|
76
|
+
```
|
|
77
|
+
Prisma review: <scope>
|
|
78
|
+
Version: Prisma <6|7|8>, provider <postgresql|mysql|sqlite|mongodb|...>
|
|
79
|
+
Findings:
|
|
80
|
+
1. [severity] <file:line>: <problem> → <fix>
|
|
81
|
+
Migrations: <state of prisma/migrations, drift or pending>
|
|
82
|
+
Not verified: <anything you could not run>
|
|
83
|
+
```
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"should_trigger": [
|
|
3
|
+
"Our Prisma resolvers fire a query per post to load the author, how do I fix this N+1?",
|
|
4
|
+
"We get P2024 timed out fetching a new connection from the pool on Vercel with Prisma",
|
|
5
|
+
"Add a status enum to the Order model in schema.prisma and create the migration",
|
|
6
|
+
"Is this $queryRawUnsafe call with a template string safe from SQL injection?",
|
|
7
|
+
"Should we run prisma migrate dev or migrate deploy in our GitHub Actions release job?",
|
|
8
|
+
"How do interactive transactions work in Prisma when transferring a balance between two accounts?"
|
|
9
|
+
],
|
|
10
|
+
"should_not_trigger": [
|
|
11
|
+
"Tune this slow Postgres query and add the right index with EXPLAIN ANALYZE",
|
|
12
|
+
"Write an Entity Framework Core migration for the new Orders table",
|
|
13
|
+
"Model a one-to-many relationship in Hibernate with JPA annotations",
|
|
14
|
+
"Design the document schema and indexes for a MongoDB collection of orders",
|
|
15
|
+
"Set up Redis as a session store with TTLs",
|
|
16
|
+
"Plan a zero-downtime column rename across our Django and Rails services"
|
|
17
|
+
]
|
|
18
|
+
}
|