opencode-knowledge-work 0.0.0-stage → 0.1.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 +212 -0
- package/README.md +124 -2
- package/content/bio-research/.mcp.json +48 -0
- package/content/bio-research/CONNECTORS.md +23 -0
- package/content/bio-research/LICENSE +202 -0
- package/content/bio-research/README.md +83 -0
- package/content/bio-research/skills/bio-research-instrument-data-to-allotrope/LICENSE.txt +201 -0
- package/content/bio-research/skills/bio-research-instrument-data-to-allotrope/SKILL.md +280 -0
- package/content/bio-research/skills/bio-research-instrument-data-to-allotrope/references/asm_schema_overview.md +226 -0
- package/content/bio-research/skills/bio-research-instrument-data-to-allotrope/references/field_classification_guide.md +503 -0
- package/content/bio-research/skills/bio-research-instrument-data-to-allotrope/references/flattening_guide.md +254 -0
- package/content/bio-research/skills/bio-research-instrument-data-to-allotrope/references/supported_instruments.md +151 -0
- package/content/bio-research/skills/bio-research-instrument-data-to-allotrope/requirements.txt +26 -0
- package/content/bio-research/skills/bio-research-instrument-data-to-allotrope/scripts/convert_to_asm.py +543 -0
- package/content/bio-research/skills/bio-research-instrument-data-to-allotrope/scripts/export_parser.py +481 -0
- package/content/bio-research/skills/bio-research-instrument-data-to-allotrope/scripts/flatten_asm.py +254 -0
- package/content/bio-research/skills/bio-research-instrument-data-to-allotrope/scripts/validate_asm.py +1102 -0
- package/content/bio-research/skills/bio-research-nextflow-development/LICENSE.txt +201 -0
- package/content/bio-research/skills/bio-research-nextflow-development/SKILL.md +290 -0
- package/content/bio-research/skills/bio-research-nextflow-development/references/geo-sra-acquisition.md +416 -0
- package/content/bio-research/skills/bio-research-nextflow-development/references/installation.md +96 -0
- package/content/bio-research/skills/bio-research-nextflow-development/references/pipelines/atacseq.md +138 -0
- package/content/bio-research/skills/bio-research-nextflow-development/references/pipelines/rnaseq.md +118 -0
- package/content/bio-research/skills/bio-research-nextflow-development/references/pipelines/sarek.md +145 -0
- package/content/bio-research/skills/bio-research-nextflow-development/references/troubleshooting.md +137 -0
- package/content/bio-research/skills/bio-research-nextflow-development/scripts/check_environment.py +452 -0
- package/content/bio-research/skills/bio-research-nextflow-development/scripts/config/genomes.yaml +148 -0
- package/content/bio-research/skills/bio-research-nextflow-development/scripts/config/pipelines/atacseq.yaml +187 -0
- package/content/bio-research/skills/bio-research-nextflow-development/scripts/config/pipelines/rnaseq.yaml +147 -0
- package/content/bio-research/skills/bio-research-nextflow-development/scripts/config/pipelines/sarek.yaml +233 -0
- package/content/bio-research/skills/bio-research-nextflow-development/scripts/detect_data_type.py +300 -0
- package/content/bio-research/skills/bio-research-nextflow-development/scripts/generate_samplesheet.py +455 -0
- package/content/bio-research/skills/bio-research-nextflow-development/scripts/manage_genomes.py +521 -0
- package/content/bio-research/skills/bio-research-nextflow-development/scripts/sra_geo_fetch.py +732 -0
- package/content/bio-research/skills/bio-research-nextflow-development/scripts/utils/__init__.py +69 -0
- package/content/bio-research/skills/bio-research-nextflow-development/scripts/utils/file_discovery.py +189 -0
- package/content/bio-research/skills/bio-research-nextflow-development/scripts/utils/ncbi_utils.py +808 -0
- package/content/bio-research/skills/bio-research-nextflow-development/scripts/utils/sample_inference.py +290 -0
- package/content/bio-research/skills/bio-research-nextflow-development/scripts/utils/validators.py +256 -0
- package/content/bio-research/skills/bio-research-scientific-problem-selection/LICENSE.txt +201 -0
- package/content/bio-research/skills/bio-research-scientific-problem-selection/SKILL.md +269 -0
- package/content/bio-research/skills/bio-research-scientific-problem-selection/references/01-intuition-pumps.md +264 -0
- package/content/bio-research/skills/bio-research-scientific-problem-selection/references/02-risk-assessment.md +323 -0
- package/content/bio-research/skills/bio-research-scientific-problem-selection/references/03-optimization-function.md +481 -0
- package/content/bio-research/skills/bio-research-scientific-problem-selection/references/04-parameter-strategy.md +396 -0
- package/content/bio-research/skills/bio-research-scientific-problem-selection/references/05-decision-tree.md +85 -0
- package/content/bio-research/skills/bio-research-scientific-problem-selection/references/06-adversity-planning.md +123 -0
- package/content/bio-research/skills/bio-research-scientific-problem-selection/references/07-problem-inversion.md +152 -0
- package/content/bio-research/skills/bio-research-scientific-problem-selection/references/08-integration-synthesis.md +173 -0
- package/content/bio-research/skills/bio-research-scientific-problem-selection/references/09-meta-framework.md +504 -0
- package/content/bio-research/skills/bio-research-scvi-tools/LICENSE.txt +201 -0
- package/content/bio-research/skills/bio-research-scvi-tools/SKILL.md +155 -0
- package/content/bio-research/skills/bio-research-scvi-tools/references/atac_peakvi.md +398 -0
- package/content/bio-research/skills/bio-research-scvi-tools/references/batch_correction_sysvi.md +417 -0
- package/content/bio-research/skills/bio-research-scvi-tools/references/citeseq_totalvi.md +420 -0
- package/content/bio-research/skills/bio-research-scvi-tools/references/data_preparation.md +286 -0
- package/content/bio-research/skills/bio-research-scvi-tools/references/environment_setup.md +254 -0
- package/content/bio-research/skills/bio-research-scvi-tools/references/label_transfer.md +373 -0
- package/content/bio-research/skills/bio-research-scvi-tools/references/multiome_multivi.md +384 -0
- package/content/bio-research/skills/bio-research-scvi-tools/references/rna_velocity_velovi.md +410 -0
- package/content/bio-research/skills/bio-research-scvi-tools/references/scarches_mapping.md +401 -0
- package/content/bio-research/skills/bio-research-scvi-tools/references/scrna_integration.md +429 -0
- package/content/bio-research/skills/bio-research-scvi-tools/references/spatial_deconvolution.md +438 -0
- package/content/bio-research/skills/bio-research-scvi-tools/references/troubleshooting.md +420 -0
- package/content/bio-research/skills/bio-research-scvi-tools/scripts/cluster_embed.py +212 -0
- package/content/bio-research/skills/bio-research-scvi-tools/scripts/differential_expression.py +220 -0
- package/content/bio-research/skills/bio-research-scvi-tools/scripts/integrate_datasets.py +237 -0
- package/content/bio-research/skills/bio-research-scvi-tools/scripts/model_utils.py +634 -0
- package/content/bio-research/skills/bio-research-scvi-tools/scripts/prepare_data.py +169 -0
- package/content/bio-research/skills/bio-research-scvi-tools/scripts/train_model.py +370 -0
- package/content/bio-research/skills/bio-research-scvi-tools/scripts/transfer_labels.py +224 -0
- package/content/bio-research/skills/bio-research-scvi-tools/scripts/validate_adata.py +397 -0
- package/content/bio-research/skills/bio-research-single-cell-rna-qc/LICENSE.txt +201 -0
- package/content/bio-research/skills/bio-research-single-cell-rna-qc/SKILL.md +175 -0
- package/content/bio-research/skills/bio-research-single-cell-rna-qc/references/scverse_qc_guidelines.md +186 -0
- package/content/bio-research/skills/bio-research-single-cell-rna-qc/scripts/qc_analysis.py +232 -0
- package/content/bio-research/skills/bio-research-single-cell-rna-qc/scripts/qc_core.py +233 -0
- package/content/bio-research/skills/bio-research-single-cell-rna-qc/scripts/qc_plotting.py +235 -0
- package/content/bio-research/skills/bio-research-start/SKILL.md +79 -0
- package/content/customer-support/.mcp.json +40 -0
- package/content/customer-support/CONNECTORS.md +19 -0
- package/content/customer-support/LICENSE +202 -0
- package/content/customer-support/README.md +140 -0
- package/content/customer-support/skills/customer-support-customer-escalation/SKILL.md +248 -0
- package/content/customer-support/skills/customer-support-customer-research/SKILL.md +252 -0
- package/content/customer-support/skills/customer-support-draft-response/SKILL.md +418 -0
- package/content/customer-support/skills/customer-support-kb-article/SKILL.md +351 -0
- package/content/customer-support/skills/customer-support-ticket-triage/SKILL.md +275 -0
- package/content/data/.mcp.json +36 -0
- package/content/data/CONNECTORS.md +18 -0
- package/content/data/LICENSE +202 -0
- package/content/data/README.md +121 -0
- package/content/data/skills/data-analyze/SKILL.md +119 -0
- package/content/data/skills/data-build-dashboard/SKILL.md +924 -0
- package/content/data/skills/data-create-viz/SKILL.md +154 -0
- package/content/data/skills/data-data-context-extractor/SKILL.md +227 -0
- package/content/data/skills/data-data-context-extractor/references/domain-template.md +147 -0
- package/content/data/skills/data-data-context-extractor/references/example-output.md +198 -0
- package/content/data/skills/data-data-context-extractor/references/skill-template.md +148 -0
- package/content/data/skills/data-data-context-extractor/references/sql-dialects.md +121 -0
- package/content/data/skills/data-data-context-extractor/scripts/package_data_skill.py +126 -0
- package/content/data/skills/data-data-visualization/SKILL.md +305 -0
- package/content/data/skills/data-explore-data/SKILL.md +325 -0
- package/content/data/skills/data-sql-queries/SKILL.md +428 -0
- package/content/data/skills/data-statistical-analysis/SKILL.md +245 -0
- package/content/data/skills/data-validate-data/SKILL.md +383 -0
- package/content/data/skills/data-write-query/SKILL.md +122 -0
- package/content/design/.mcp.json +44 -0
- package/content/design/CONNECTORS.md +18 -0
- package/content/design/README.md +117 -0
- package/content/design/skills/design-accessibility-review/SKILL.md +128 -0
- package/content/design/skills/design-design-critique/SKILL.md +118 -0
- package/content/design/skills/design-design-handoff/SKILL.md +131 -0
- package/content/design/skills/design-design-system/SKILL.md +190 -0
- package/content/design/skills/design-research-synthesis/SKILL.md +92 -0
- package/content/design/skills/design-user-research/SKILL.md +41 -0
- package/content/design/skills/design-ux-copy/SKILL.md +107 -0
- package/content/engineering/.mcp.json +48 -0
- package/content/engineering/CONNECTORS.md +19 -0
- package/content/engineering/README.md +136 -0
- package/content/engineering/skills/engineering-architecture/SKILL.md +85 -0
- package/content/engineering/skills/engineering-code-review/SKILL.md +118 -0
- package/content/engineering/skills/engineering-debug/SKILL.md +95 -0
- package/content/engineering/skills/engineering-deploy-checklist/SKILL.md +78 -0
- package/content/engineering/skills/engineering-documentation/SKILL.md +49 -0
- package/content/engineering/skills/engineering-incident-response/SKILL.md +158 -0
- package/content/engineering/skills/engineering-standup/SKILL.md +75 -0
- package/content/engineering/skills/engineering-system-design/SKILL.md +42 -0
- package/content/engineering/skills/engineering-tech-debt/SKILL.md +32 -0
- package/content/engineering/skills/engineering-testing-strategy/SKILL.md +33 -0
- package/content/enterprise-search/.mcp.json +36 -0
- package/content/enterprise-search/CONNECTORS.md +21 -0
- package/content/enterprise-search/LICENSE +202 -0
- package/content/enterprise-search/README.md +157 -0
- package/content/enterprise-search/skills/enterprise-search-digest/SKILL.md +173 -0
- package/content/enterprise-search/skills/enterprise-search-knowledge-synthesis/SKILL.md +258 -0
- package/content/enterprise-search/skills/enterprise-search-search/SKILL.md +178 -0
- package/content/enterprise-search/skills/enterprise-search-search-strategy/SKILL.md +222 -0
- package/content/enterprise-search/skills/enterprise-search-source-management/SKILL.md +173 -0
- package/content/finance/.mcp.json +32 -0
- package/content/finance/CONNECTORS.md +20 -0
- package/content/finance/LICENSE +202 -0
- package/content/finance/README.md +92 -0
- package/content/finance/skills/finance-audit-support/SKILL.md +374 -0
- package/content/finance/skills/finance-close-management/SKILL.md +221 -0
- package/content/finance/skills/finance-financial-statements/SKILL.md +335 -0
- package/content/finance/skills/finance-journal-entry/SKILL.md +131 -0
- package/content/finance/skills/finance-journal-entry-prep/SKILL.md +186 -0
- package/content/finance/skills/finance-reconciliation/SKILL.md +175 -0
- package/content/finance/skills/finance-sox-testing/SKILL.md +218 -0
- package/content/finance/skills/finance-variance-analysis/SKILL.md +266 -0
- package/content/human-resources/.mcp.json +28 -0
- package/content/human-resources/CONNECTORS.md +19 -0
- package/content/human-resources/README.md +138 -0
- package/content/human-resources/skills/human-resources-comp-analysis/SKILL.md +92 -0
- package/content/human-resources/skills/human-resources-draft-offer/SKILL.md +82 -0
- package/content/human-resources/skills/human-resources-interview-prep/SKILL.md +37 -0
- package/content/human-resources/skills/human-resources-onboarding/SKILL.md +104 -0
- package/content/human-resources/skills/human-resources-org-planning/SKILL.md +28 -0
- package/content/human-resources/skills/human-resources-people-report/SKILL.md +99 -0
- package/content/human-resources/skills/human-resources-performance-review/SKILL.md +149 -0
- package/content/human-resources/skills/human-resources-policy-lookup/SKILL.md +94 -0
- package/content/human-resources/skills/human-resources-recruiting-pipeline/SKILL.md +31 -0
- package/content/legal/.mcp.json +36 -0
- package/content/legal/CONNECTORS.md +21 -0
- package/content/legal/LICENSE +202 -0
- package/content/legal/README.md +234 -0
- package/content/legal/skills/legal-brief/SKILL.md +208 -0
- package/content/legal/skills/legal-compliance-check/SKILL.md +274 -0
- package/content/legal/skills/legal-legal-response/SKILL.md +457 -0
- package/content/legal/skills/legal-legal-risk-assessment/SKILL.md +265 -0
- package/content/legal/skills/legal-meeting-briefing/SKILL.md +220 -0
- package/content/legal/skills/legal-review-contract/SKILL.md +358 -0
- package/content/legal/skills/legal-signature-request/SKILL.md +104 -0
- package/content/legal/skills/legal-triage-nda/SKILL.md +262 -0
- package/content/legal/skills/legal-vendor-check/SKILL.md +159 -0
- package/content/manifest.json +86 -0
- package/content/marketing/.mcp.json +60 -0
- package/content/marketing/CONNECTORS.md +20 -0
- package/content/marketing/LICENSE +202 -0
- package/content/marketing/README.md +90 -0
- package/content/marketing/skills/marketing-brand-review/SKILL.md +276 -0
- package/content/marketing/skills/marketing-campaign-plan/SKILL.md +308 -0
- package/content/marketing/skills/marketing-competitive-brief/SKILL.md +331 -0
- package/content/marketing/skills/marketing-content-creation/SKILL.md +157 -0
- package/content/marketing/skills/marketing-draft-content/SKILL.md +117 -0
- package/content/marketing/skills/marketing-email-sequence/SKILL.md +220 -0
- package/content/marketing/skills/marketing-performance-report/SKILL.md +392 -0
- package/content/marketing/skills/marketing-seo-audit/SKILL.md +190 -0
- package/content/operations/.mcp.json +32 -0
- package/content/operations/CONNECTORS.md +20 -0
- package/content/operations/README.md +135 -0
- package/content/operations/skills/operations-capacity-plan/SKILL.md +113 -0
- package/content/operations/skills/operations-change-request/SKILL.md +121 -0
- package/content/operations/skills/operations-compliance-tracking/SKILL.md +44 -0
- package/content/operations/skills/operations-process-doc/SKILL.md +82 -0
- package/content/operations/skills/operations-process-optimization/SKILL.md +39 -0
- package/content/operations/skills/operations-risk-assessment/SKILL.md +40 -0
- package/content/operations/skills/operations-runbook/SKILL.md +87 -0
- package/content/operations/skills/operations-status-report/SKILL.md +77 -0
- package/content/operations/skills/operations-vendor-review/SKILL.md +104 -0
- package/content/pdf-viewer/.mcp.json +8 -0
- package/content/pdf-viewer/CONNECTORS.md +15 -0
- package/content/pdf-viewer/LICENSE +202 -0
- package/content/pdf-viewer/README.md +57 -0
- package/content/pdf-viewer/commands/annotate.md +51 -0
- package/content/pdf-viewer/commands/fill-form.md +73 -0
- package/content/pdf-viewer/commands/open.md +34 -0
- package/content/pdf-viewer/commands/sign.md +54 -0
- package/content/pdf-viewer/skills/pdf-viewer-view-pdf/SKILL.md +147 -0
- package/content/product-management/.mcp.json +72 -0
- package/content/product-management/CONNECTORS.md +22 -0
- package/content/product-management/LICENSE +202 -0
- package/content/product-management/README.md +118 -0
- package/content/product-management/commands/brainstorm.md +120 -0
- package/content/product-management/skills/product-management-competitive-brief/SKILL.md +302 -0
- package/content/product-management/skills/product-management-metrics-review/SKILL.md +388 -0
- package/content/product-management/skills/product-management-product-brainstorming/SKILL.md +273 -0
- package/content/product-management/skills/product-management-roadmap-update/SKILL.md +266 -0
- package/content/product-management/skills/product-management-sprint-planning/SKILL.md +94 -0
- package/content/product-management/skills/product-management-stakeholder-update/SKILL.md +352 -0
- package/content/product-management/skills/product-management-synthesize-research/SKILL.md +312 -0
- package/content/product-management/skills/product-management-write-spec/SKILL.md +250 -0
- package/content/productivity/.mcp.json +44 -0
- package/content/productivity/CONNECTORS.md +18 -0
- package/content/productivity/LICENSE +202 -0
- package/content/productivity/README.md +97 -0
- package/content/productivity/skills/dashboard.html +3111 -0
- package/content/productivity/skills/productivity-memory-management/SKILL.md +323 -0
- package/content/productivity/skills/productivity-start/SKILL.md +158 -0
- package/content/productivity/skills/productivity-task-management/SKILL.md +91 -0
- package/content/productivity/skills/productivity-update/SKILL.md +168 -0
- package/content/sales/.mcp.json +100 -0
- package/content/sales/CONNECTORS.md +36 -0
- package/content/sales/LICENSE +202 -0
- package/content/sales/README.md +148 -0
- package/content/sales/skills/sales-account-context/SKILL.md +94 -0
- package/content/sales/skills/sales-account-plan/SKILL.md +95 -0
- package/content/sales/skills/sales-account-research/SKILL.md +99 -0
- package/content/sales/skills/sales-account-tiering/SKILL.md +101 -0
- package/content/sales/skills/sales-call-prep/SKILL.md +111 -0
- package/content/sales/skills/sales-call-summary/SKILL.md +111 -0
- package/content/sales/skills/sales-close-plan/SKILL.md +106 -0
- package/content/sales/skills/sales-competitive-intelligence/SKILL.md +102 -0
- package/content/sales/skills/sales-create-an-asset/SKILL.md +105 -0
- package/content/sales/skills/sales-crm-hygiene-check/SKILL.md +103 -0
- package/content/sales/skills/sales-customer-health/SKILL.md +108 -0
- package/content/sales/skills/sales-customer-voice/SKILL.md +94 -0
- package/content/sales/skills/sales-daily-briefing/SKILL.md +61 -0
- package/content/sales/skills/sales-deal-advance-gap/SKILL.md +102 -0
- package/content/sales/skills/sales-deal-review/SKILL.md +105 -0
- package/content/sales/skills/sales-deal-signals/SKILL.md +96 -0
- package/content/sales/skills/sales-deal-slip-scenario/SKILL.md +101 -0
- package/content/sales/skills/sales-draft-outreach/SKILL.md +116 -0
- package/content/sales/skills/sales-end-of-day/SKILL.md +114 -0
- package/content/sales/skills/sales-expansion-whitespace/SKILL.md +97 -0
- package/content/sales/skills/sales-forecast/SKILL.md +100 -0
- package/content/sales/skills/sales-handle-objection/SKILL.md +93 -0
- package/content/sales/skills/sales-inbox-sweep/SKILL.md +114 -0
- package/content/sales/skills/sales-lead-triage/SKILL.md +105 -0
- package/content/sales/skills/sales-log-activity/SKILL.md +111 -0
- package/content/sales/skills/sales-pipeline-review/SKILL.md +97 -0
- package/content/sales/skills/sales-renewal-radar/SKILL.md +95 -0
- package/content/sales/skills/sales-rep-context/SKILL.md +90 -0
- package/content/sales/skills/sales-route-lead/SKILL.md +111 -0
- package/content/sales/skills/sales-schedule-meeting/SKILL.md +99 -0
- package/content/sales/skills/sales-setup/SKILL.md +195 -0
- package/content/sales/skills/sales-stakeholder-map/SKILL.md +107 -0
- package/content/sales/skills/sales-team-pipeline/SKILL.md +105 -0
- package/content/sales/skills/sales-update-opportunity/SKILL.md +111 -0
- package/content/sales/skills/sales-weekly-wrap/SKILL.md +90 -0
- package/content/sales/skills/sales-win-loss-review/SKILL.md +88 -0
- package/content/small-business/.mcp.json +148 -0
- package/content/small-business/README.md +117 -0
- package/content/small-business/skills/small-business-ad-manager/SKILL.md +128 -0
- package/content/small-business/skills/small-business-ad-manager/reference/ad_copy.md +112 -0
- package/content/small-business/skills/small-business-ad-manager/reference/change_playbook.md +127 -0
- package/content/small-business/skills/small-business-ad-manager/reference/data_sources.md +100 -0
- package/content/small-business/skills/small-business-ad-manager/reference/diagnostics.md +89 -0
- package/content/small-business/skills/small-business-ad-manager/reference/gotchas.md +181 -0
- package/content/small-business/skills/small-business-ap-processor/SKILL.md +158 -0
- package/content/small-business/skills/small-business-ap-processor/reference/coding_rules.md +70 -0
- package/content/small-business/skills/small-business-ap-processor/reference/gotchas.md +131 -0
- package/content/small-business/skills/small-business-ap-processor/reference/intake_and_extraction.md +82 -0
- package/content/small-business/skills/small-business-ap-processor/reference/matching_and_exceptions.md +80 -0
- package/content/small-business/skills/small-business-ap-processor/reference/payment_run.md +77 -0
- package/content/small-business/skills/small-business-brand-style/SKILL.md +106 -0
- package/content/small-business/skills/small-business-build-agent/SKILL.md +105 -0
- package/content/small-business/skills/small-business-build-agent/reference/capture.md +133 -0
- package/content/small-business/skills/small-business-build-agent/reference/gotchas.md +204 -0
- package/content/small-business/skills/small-business-build-agent/reference/skill_authoring.md +165 -0
- package/content/small-business/skills/small-business-build-connector/SKILL.md +102 -0
- package/content/small-business/skills/small-business-build-connector/reference/discovery.md +120 -0
- package/content/small-business/skills/small-business-build-connector/reference/gotchas.md +237 -0
- package/content/small-business/skills/small-business-build-connector/reference/paths.md +106 -0
- package/content/small-business/skills/small-business-build-connector/reference/use-zapier.md +128 -0
- package/content/small-business/skills/small-business-business-pulse/SKILL.md +181 -0
- package/content/small-business/skills/small-business-business-pulse/reference/data_sources.md +173 -0
- package/content/small-business/skills/small-business-business-pulse/reference/gotchas.md +103 -0
- package/content/small-business/skills/small-business-business-pulse/reference/output_template.md +109 -0
- package/content/small-business/skills/small-business-business-pulse/reference/thresholds.md +71 -0
- package/content/small-business/skills/small-business-business-pulse/reference/v2_sources.md +63 -0
- package/content/small-business/skills/small-business-call-list/SKILL.md +82 -0
- package/content/small-business/skills/small-business-canva-creator/SKILL.md +448 -0
- package/content/small-business/skills/small-business-canva-creator/reference/canva-api.md +208 -0
- package/content/small-business/skills/small-business-canva-creator/reference/examples/boutique-brief-campaign.md +181 -0
- package/content/small-business/skills/small-business-canva-creator/reference/gotchas.md +380 -0
- package/content/small-business/skills/small-business-canva-creator/reference/hubspot-staging.md +137 -0
- package/content/small-business/skills/small-business-cash-flow-snapshot/SKILL.md +251 -0
- package/content/small-business/skills/small-business-cash-flow-snapshot/reference/examples/worked-example.md +92 -0
- package/content/small-business/skills/small-business-cash-flow-snapshot/reference/gotchas.md +62 -0
- package/content/small-business/skills/small-business-cash-flow-snapshot/reference/v2_sources.md +84 -0
- package/content/small-business/skills/small-business-close-month/SKILL.md +86 -0
- package/content/small-business/skills/small-business-content-strategy/SKILL.md +152 -0
- package/content/small-business/skills/small-business-content-strategy/reference/examples/retail-boutique-example.md +71 -0
- package/content/small-business/skills/small-business-content-strategy/reference/gotchas.md +104 -0
- package/content/small-business/skills/small-business-content-strategy/reference/v2_sources.md +40 -0
- package/content/small-business/skills/small-business-contract-review/SKILL.md +158 -0
- package/content/small-business/skills/small-business-contract-review/reference/docusign-fetch.md +32 -0
- package/content/small-business/skills/small-business-contract-review/reference/examples/flagged-summary-saas.md +97 -0
- package/content/small-business/skills/small-business-contract-review/reference/gmail-fetch.md +30 -0
- package/content/small-business/skills/small-business-contract-review/reference/gotchas.md +105 -0
- package/content/small-business/skills/small-business-contract-review/reference/m365-fetch.md +60 -0
- package/content/small-business/skills/small-business-crm-autopilot/SKILL.md +162 -0
- package/content/small-business/skills/small-business-crm-autopilot/reference/cleanup-checklist.md +82 -0
- package/content/small-business/skills/small-business-crm-autopilot/reference/examples/cleanup-deal.md +83 -0
- package/content/small-business/skills/small-business-crm-autopilot/reference/examples/log-call-happy-path.md +68 -0
- package/content/small-business/skills/small-business-crm-autopilot/reference/examples/log-email-happy-path.md +50 -0
- package/content/small-business/skills/small-business-crm-autopilot/reference/gotchas.md +110 -0
- package/content/small-business/skills/small-business-crm-autopilot/reference/hubspot-fields.md +62 -0
- package/content/small-business/skills/small-business-crm-autopilot/reference/lightweight_crm.md +125 -0
- package/content/small-business/skills/small-business-crm-autopilot/reference/salesforce-fields.md +122 -0
- package/content/small-business/skills/small-business-crm-autopilot/reference/standing_mode.md +144 -0
- package/content/small-business/skills/small-business-grant-rfp-writer/SKILL.md +162 -0
- package/content/small-business/skills/small-business-grant-rfp-writer/reference/drafting.md +129 -0
- package/content/small-business/skills/small-business-grant-rfp-writer/reference/go_no_go.md +125 -0
- package/content/small-business/skills/small-business-grant-rfp-writer/reference/gotchas.md +180 -0
- package/content/small-business/skills/small-business-grant-rfp-writer/reference/opportunity_sources.md +90 -0
- package/content/small-business/skills/small-business-grant-rfp-writer/reference/org_profile.md +81 -0
- package/content/small-business/skills/small-business-grow-pipeline/SKILL.md +92 -0
- package/content/small-business/skills/small-business-growth-pulse/SKILL.md +143 -0
- package/content/small-business/skills/small-business-growth-pulse/reference/data_sources.md +113 -0
- package/content/small-business/skills/small-business-growth-pulse/reference/gotchas.md +175 -0
- package/content/small-business/skills/small-business-growth-pulse/reference/output_template.md +122 -0
- package/content/small-business/skills/small-business-growth-pulse/reference/thresholds.md +110 -0
- package/content/small-business/skills/small-business-hiring-screener/SKILL.md +137 -0
- package/content/small-business/skills/small-business-hiring-screener/reference/candidate_comms.md +132 -0
- package/content/small-business/skills/small-business-hiring-screener/reference/fair_screening.md +103 -0
- package/content/small-business/skills/small-business-hiring-screener/reference/gotchas.md +183 -0
- package/content/small-business/skills/small-business-hiring-screener/reference/onboarding.md +82 -0
- package/content/small-business/skills/small-business-hiring-screener/reference/rubric.md +122 -0
- package/content/small-business/skills/small-business-inbox-manager/SKILL.md +130 -0
- package/content/small-business/skills/small-business-inbox-manager/reference/digest_format.md +110 -0
- package/content/small-business/skills/small-business-inbox-manager/reference/gotchas.md +220 -0
- package/content/small-business/skills/small-business-inbox-manager/reference/handoffs.md +77 -0
- package/content/small-business/skills/small-business-inbox-manager/reference/reply_drafting.md +116 -0
- package/content/small-business/skills/small-business-inbox-manager/reference/triage_rules.md +72 -0
- package/content/small-business/skills/small-business-inventory-planner/SKILL.md +126 -0
- package/content/small-business/skills/small-business-inventory-planner/reference/data_sources.md +94 -0
- package/content/small-business/skills/small-business-inventory-planner/reference/gotchas.md +153 -0
- package/content/small-business/skills/small-business-inventory-planner/reference/po_drafting.md +92 -0
- package/content/small-business/skills/small-business-inventory-planner/reference/seasonality.md +112 -0
- package/content/small-business/skills/small-business-inventory-planner/reference/velocity_and_reorder.md +154 -0
- package/content/small-business/skills/small-business-invoice-chase/SKILL.md +131 -0
- package/content/small-business/skills/small-business-invoice-chase/reference/examples/firm-reminder.md +28 -0
- package/content/small-business/skills/small-business-invoice-chase/reference/examples/gentle-reminder.md +27 -0
- package/content/small-business/skills/small-business-invoice-chase/reference/gotchas.md +75 -0
- package/content/small-business/skills/small-business-invoice-chase/reference/tone-matching.md +44 -0
- package/content/small-business/skills/small-business-invoice-chase/reference/v2_sources.md +78 -0
- package/content/small-business/skills/small-business-job-post-builder/SKILL.md +204 -0
- package/content/small-business/skills/small-business-job-post-builder/reference/docusign-routing.md +63 -0
- package/content/small-business/skills/small-business-job-post-builder/reference/examples/worked-example.md +110 -0
- package/content/small-business/skills/small-business-job-post-builder/reference/existing-document-merge.md +58 -0
- package/content/small-business/skills/small-business-job-post-builder/reference/gotchas.md +68 -0
- package/content/small-business/skills/small-business-job-post-builder/reference/interview-guide-structure.md +93 -0
- package/content/small-business/skills/small-business-job-post-builder/reference/job-post-structure.md +62 -0
- package/content/small-business/skills/small-business-job-post-builder/reference/offer-letter-template.md +145 -0
- package/content/small-business/skills/small-business-job-post-builder/reference/role-intake.md +73 -0
- package/content/small-business/skills/small-business-lead-finder/SKILL.md +119 -0
- package/content/small-business/skills/small-business-lead-finder/reference/gotchas.md +152 -0
- package/content/small-business/skills/small-business-lead-finder/reference/icp_method.md +97 -0
- package/content/small-business/skills/small-business-lead-finder/reference/output_template.md +124 -0
- package/content/small-business/skills/small-business-lead-finder/reference/scoring.md +92 -0
- package/content/small-business/skills/small-business-lead-finder/reference/sourcing.md +78 -0
- package/content/small-business/skills/small-business-lead-triage/SKILL.md +81 -0
- package/content/small-business/skills/small-business-lead-triage/reference/examples/happy-path-triage.md +68 -0
- package/content/small-business/skills/small-business-lead-triage/reference/gotchas.md +76 -0
- package/content/small-business/skills/small-business-lead-triage/reference/hubspot-scoring.md +169 -0
- package/content/small-business/skills/small-business-marketing-monday/SKILL.md +108 -0
- package/content/small-business/skills/small-business-monday-brief/SKILL.md +97 -0
- package/content/small-business/skills/small-business-month-end-prep/SKILL.md +331 -0
- package/content/small-business/skills/small-business-month-end-prep/reference/close-packet-format.md +127 -0
- package/content/small-business/skills/small-business-month-end-prep/reference/examples/pl-narrative.md +52 -0
- package/content/small-business/skills/small-business-month-end-prep/reference/gotchas.md +113 -0
- package/content/small-business/skills/small-business-month-end-prep/reference/paypal-settlements.md +110 -0
- package/content/small-business/skills/small-business-month-end-prep/reference/quickbooks-reconcile.md +71 -0
- package/content/small-business/skills/small-business-month-end-prep/reference/v2_sources.md +125 -0
- package/content/small-business/skills/small-business-month-end-prep/reference/xero-reconcile.md +175 -0
- package/content/small-business/skills/small-business-month-end-prep/reference/zoho-books-reconcile.md +168 -0
- package/content/small-business/skills/small-business-outreach-composer/SKILL.md +144 -0
- package/content/small-business/skills/small-business-outreach-composer/reference/gotchas.md +213 -0
- package/content/small-business/skills/small-business-outreach-composer/reference/output_template.md +147 -0
- package/content/small-business/skills/small-business-outreach-composer/reference/sequence_patterns.md +99 -0
- package/content/small-business/skills/small-business-outreach-composer/reference/slop_test.md +164 -0
- package/content/small-business/skills/small-business-pay-the-bills/SKILL.md +101 -0
- package/content/small-business/skills/small-business-payroll-prep/SKILL.md +139 -0
- package/content/small-business/skills/small-business-payroll-prep/reference/anomaly_rules.md +99 -0
- package/content/small-business/skills/small-business-payroll-prep/reference/books_sync.md +72 -0
- package/content/small-business/skills/small-business-payroll-prep/reference/gotchas.md +153 -0
- package/content/small-business/skills/small-business-payroll-prep/reference/run_sheet_format.md +90 -0
- package/content/small-business/skills/small-business-payroll-prep/reference/timesheet_intake.md +118 -0
- package/content/small-business/skills/small-business-plan-payroll/SKILL.md +88 -0
- package/content/small-business/skills/small-business-proposal-builder/SKILL.md +168 -0
- package/content/small-business/skills/small-business-proposal-builder/reference/discovery_extraction.md +138 -0
- package/content/small-business/skills/small-business-proposal-builder/reference/gotchas.md +184 -0
- package/content/small-business/skills/small-business-proposal-builder/reference/output_template.md +128 -0
- package/content/small-business/skills/small-business-proposal-builder/reference/pricing_method.md +125 -0
- package/content/small-business/skills/small-business-proposal-builder/reference/proposal_structure.md +120 -0
- package/content/small-business/skills/small-business-reactivate/SKILL.md +109 -0
- package/content/small-business/skills/small-business-report-builder/SKILL.md +142 -0
- package/content/small-business/skills/small-business-report-builder/reference/data_sources.md +168 -0
- package/content/small-business/skills/small-business-report-builder/reference/gotchas.md +155 -0
- package/content/small-business/skills/small-business-report-builder/reference/output_template.md +109 -0
- package/content/small-business/skills/small-business-report-builder/reference/report_spec.md +109 -0
- package/content/small-business/skills/small-business-report-builder/reference/saved_reports.md +50 -0
- package/content/small-business/skills/small-business-report-pack/SKILL.md +83 -0
- package/content/small-business/skills/small-business-restock/SKILL.md +88 -0
- package/content/small-business/skills/small-business-review-reputation/SKILL.md +130 -0
- package/content/small-business/skills/small-business-review-reputation/reference/churn-signals.md +110 -0
- package/content/small-business/skills/small-business-review-reputation/reference/examples/example-report.md +150 -0
- package/content/small-business/skills/small-business-review-reputation/reference/gotchas.md +164 -0
- package/content/small-business/skills/small-business-review-reputation/reference/response-patterns.md +123 -0
- package/content/small-business/skills/small-business-review-reputation/reference/sources.md +116 -0
- package/content/small-business/skills/small-business-seo-ai-visibility/SKILL.md +143 -0
- package/content/small-business/skills/small-business-seo-ai-visibility/reference/ai_visibility.md +173 -0
- package/content/small-business/skills/small-business-seo-ai-visibility/reference/audit_checklist.md +134 -0
- package/content/small-business/skills/small-business-seo-ai-visibility/reference/catalog_refresh.md +126 -0
- package/content/small-business/skills/small-business-seo-ai-visibility/reference/content_rewrite.md +113 -0
- package/content/small-business/skills/small-business-seo-ai-visibility/reference/gotchas.md +211 -0
- package/content/small-business/skills/small-business-smb-onboard/SKILL.md +82 -0
- package/content/small-business/skills/small-business-smb-onboard/reference/examples/happy-path.md +190 -0
- package/content/small-business/skills/small-business-smb-onboard/reference/gotchas.md +111 -0
- package/content/small-business/skills/small-business-smb-onboard/reference/onboard-checklist.md +99 -0
- package/content/small-business/skills/small-business-smb-onboard/reference/website-research.md +82 -0
- package/content/small-business/skills/small-business-smb-router/SKILL.md +216 -0
- package/content/small-business/skills/small-business-smb-router/reference/connector-map.md +96 -0
- package/content/small-business/skills/small-business-social-content-engine/SKILL.md +162 -0
- package/content/small-business/skills/small-business-social-content-engine/reference/calendar.md +116 -0
- package/content/small-business/skills/small-business-social-content-engine/reference/canva-api.md +208 -0
- package/content/small-business/skills/small-business-social-content-engine/reference/examples/okonkwo-campaign.md +190 -0
- package/content/small-business/skills/small-business-social-content-engine/reference/gotchas.md +447 -0
- package/content/small-business/skills/small-business-social-content-engine/reference/publishing.md +166 -0
- package/content/small-business/skills/small-business-social-content-engine/reference/shopify-assets.md +77 -0
- package/content/small-business/skills/small-business-speed-to-lead/SKILL.md +172 -0
- package/content/small-business/skills/small-business-speed-to-lead/reference/approval.md +61 -0
- package/content/small-business/skills/small-business-speed-to-lead/reference/gotchas.md +167 -0
- package/content/small-business/skills/small-business-speed-to-lead/reference/qualification.md +153 -0
- package/content/small-business/skills/small-business-speed-to-lead/reference/response_patterns.md +184 -0
- package/content/small-business/skills/small-business-tax-prep/SKILL.md +85 -0
- package/content/small-business/skills/small-business-tax-season-organizer/SKILL.md +210 -0
- package/content/small-business/skills/small-business-tax-season-organizer/reference/calculation-assumptions.md +177 -0
- package/content/small-business/skills/small-business-tax-season-organizer/reference/connector-queries.md +267 -0
- package/content/small-business/skills/small-business-tax-season-organizer/reference/examples/quarterly-estimate.md +92 -0
- package/content/small-business/skills/small-business-tax-season-organizer/reference/examples/year-end-1099.md +102 -0
- package/content/small-business/skills/small-business-tax-season-organizer/reference/gotchas.md +104 -0
- package/content/small-business/skills/small-business-tax-season-organizer/reference/output-formats.md +68 -0
- package/content/small-business/skills/small-business-ticket-deflector/SKILL.md +164 -0
- package/content/small-business/skills/small-business-ticket-deflector/reference/examples/deny-refund-request.md +98 -0
- package/content/small-business/skills/small-business-ticket-deflector/reference/examples/respond-refund-request.md +77 -0
- package/content/small-business/skills/small-business-ticket-deflector/reference/gotchas.md +57 -0
- package/index.ts +84 -0
- package/package.json +30 -3
|
@@ -0,0 +1,428 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: sql-queries
|
|
3
|
+
description: Write correct, performant SQL across all major data warehouse dialects (Snowflake, BigQuery, Databricks, PostgreSQL, etc.). Use when writing queries, optimizing slow SQL, translating between dialects, or building complex analytical queries with CTEs, window functions, or aggregations.
|
|
4
|
+
user-invocable: false
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# SQL Queries Skill
|
|
8
|
+
|
|
9
|
+
Write correct, performant, readable SQL across all major data warehouse dialects.
|
|
10
|
+
|
|
11
|
+
## Dialect-Specific Reference
|
|
12
|
+
|
|
13
|
+
### PostgreSQL (including Aurora, RDS, Supabase, Neon)
|
|
14
|
+
|
|
15
|
+
**Date/time:**
|
|
16
|
+
```sql
|
|
17
|
+
-- Current date/time
|
|
18
|
+
CURRENT_DATE, CURRENT_TIMESTAMP, NOW()
|
|
19
|
+
|
|
20
|
+
-- Date arithmetic
|
|
21
|
+
date_column + INTERVAL '7 days'
|
|
22
|
+
date_column - INTERVAL '1 month'
|
|
23
|
+
|
|
24
|
+
-- Truncate to period
|
|
25
|
+
DATE_TRUNC('month', created_at)
|
|
26
|
+
|
|
27
|
+
-- Extract parts
|
|
28
|
+
EXTRACT(YEAR FROM created_at)
|
|
29
|
+
EXTRACT(DOW FROM created_at) -- 0=Sunday
|
|
30
|
+
|
|
31
|
+
-- Format
|
|
32
|
+
TO_CHAR(created_at, 'YYYY-MM-DD')
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
**String functions:**
|
|
36
|
+
```sql
|
|
37
|
+
-- Concatenation
|
|
38
|
+
first_name || ' ' || last_name
|
|
39
|
+
CONCAT(first_name, ' ', last_name)
|
|
40
|
+
|
|
41
|
+
-- Pattern matching
|
|
42
|
+
column ILIKE '%pattern%' -- case-insensitive
|
|
43
|
+
column ~ '^regex_pattern$' -- regex
|
|
44
|
+
|
|
45
|
+
-- String manipulation
|
|
46
|
+
LEFT(str, n), RIGHT(str, n)
|
|
47
|
+
SPLIT_PART(str, delimiter, position)
|
|
48
|
+
REGEXP_REPLACE(str, pattern, replacement)
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
**Arrays and JSON:**
|
|
52
|
+
```sql
|
|
53
|
+
-- JSON access
|
|
54
|
+
data->>'key' -- text
|
|
55
|
+
data->'nested'->'key' -- json
|
|
56
|
+
data#>>'{path,to,key}' -- nested text
|
|
57
|
+
|
|
58
|
+
-- Array operations
|
|
59
|
+
ARRAY_AGG(column)
|
|
60
|
+
ANY(array_column)
|
|
61
|
+
array_column @> ARRAY['value']
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
**Performance tips:**
|
|
65
|
+
- Use `EXPLAIN ANALYZE` to profile queries
|
|
66
|
+
- Create indexes on frequently filtered/joined columns
|
|
67
|
+
- Use `EXISTS` over `IN` for correlated subqueries
|
|
68
|
+
- Partial indexes for common filter conditions
|
|
69
|
+
- Use connection pooling for concurrent access
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
### Snowflake
|
|
74
|
+
|
|
75
|
+
**Date/time:**
|
|
76
|
+
```sql
|
|
77
|
+
-- Current date/time
|
|
78
|
+
CURRENT_DATE(), CURRENT_TIMESTAMP(), SYSDATE()
|
|
79
|
+
|
|
80
|
+
-- Date arithmetic
|
|
81
|
+
DATEADD(day, 7, date_column)
|
|
82
|
+
DATEDIFF(day, start_date, end_date)
|
|
83
|
+
|
|
84
|
+
-- Truncate to period
|
|
85
|
+
DATE_TRUNC('month', created_at)
|
|
86
|
+
|
|
87
|
+
-- Extract parts
|
|
88
|
+
YEAR(created_at), MONTH(created_at), DAY(created_at)
|
|
89
|
+
DAYOFWEEK(created_at)
|
|
90
|
+
|
|
91
|
+
-- Format
|
|
92
|
+
TO_CHAR(created_at, 'YYYY-MM-DD')
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
**String functions:**
|
|
96
|
+
```sql
|
|
97
|
+
-- Case-insensitive by default (depends on collation)
|
|
98
|
+
column ILIKE '%pattern%'
|
|
99
|
+
REGEXP_LIKE(column, 'pattern')
|
|
100
|
+
|
|
101
|
+
-- Parse JSON
|
|
102
|
+
column:key::string -- dot notation for VARIANT
|
|
103
|
+
PARSE_JSON('{"key": "value"}')
|
|
104
|
+
GET_PATH(variant_col, 'path.to.key')
|
|
105
|
+
|
|
106
|
+
-- Flatten arrays/objects
|
|
107
|
+
SELECT f.value FROM table, LATERAL FLATTEN(input => array_col) f
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
**Semi-structured data:**
|
|
111
|
+
```sql
|
|
112
|
+
-- VARIANT type access
|
|
113
|
+
data:customer:name::STRING
|
|
114
|
+
data:items[0]:price::NUMBER
|
|
115
|
+
|
|
116
|
+
-- Flatten nested structures
|
|
117
|
+
SELECT
|
|
118
|
+
t.id,
|
|
119
|
+
item.value:name::STRING as item_name,
|
|
120
|
+
item.value:qty::NUMBER as quantity
|
|
121
|
+
FROM my_table t,
|
|
122
|
+
LATERAL FLATTEN(input => t.data:items) item
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
**Performance tips:**
|
|
126
|
+
- Use clustering keys on large tables (not traditional indexes)
|
|
127
|
+
- Filter on clustering key columns for partition pruning
|
|
128
|
+
- Set appropriate warehouse size for query complexity
|
|
129
|
+
- Use `RESULT_SCAN(LAST_QUERY_ID())` to avoid re-running expensive queries
|
|
130
|
+
- Use transient tables for staging/temp data
|
|
131
|
+
|
|
132
|
+
---
|
|
133
|
+
|
|
134
|
+
### BigQuery (Google Cloud)
|
|
135
|
+
|
|
136
|
+
**Date/time:**
|
|
137
|
+
```sql
|
|
138
|
+
-- Current date/time
|
|
139
|
+
CURRENT_DATE(), CURRENT_TIMESTAMP()
|
|
140
|
+
|
|
141
|
+
-- Date arithmetic
|
|
142
|
+
DATE_ADD(date_column, INTERVAL 7 DAY)
|
|
143
|
+
DATE_SUB(date_column, INTERVAL 1 MONTH)
|
|
144
|
+
DATE_DIFF(end_date, start_date, DAY)
|
|
145
|
+
TIMESTAMP_DIFF(end_ts, start_ts, HOUR)
|
|
146
|
+
|
|
147
|
+
-- Truncate to period
|
|
148
|
+
DATE_TRUNC(created_at, MONTH)
|
|
149
|
+
TIMESTAMP_TRUNC(created_at, HOUR)
|
|
150
|
+
|
|
151
|
+
-- Extract parts
|
|
152
|
+
EXTRACT(YEAR FROM created_at)
|
|
153
|
+
EXTRACT(DAYOFWEEK FROM created_at) -- 1=Sunday
|
|
154
|
+
|
|
155
|
+
-- Format
|
|
156
|
+
FORMAT_DATE('%Y-%m-%d', date_column)
|
|
157
|
+
FORMAT_TIMESTAMP('%Y-%m-%d %H:%M:%S', ts_column)
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
**String functions:**
|
|
161
|
+
```sql
|
|
162
|
+
-- No ILIKE, use LOWER()
|
|
163
|
+
LOWER(column) LIKE '%pattern%'
|
|
164
|
+
REGEXP_CONTAINS(column, r'pattern')
|
|
165
|
+
REGEXP_EXTRACT(column, r'pattern')
|
|
166
|
+
|
|
167
|
+
-- String manipulation
|
|
168
|
+
SPLIT(str, delimiter) -- returns ARRAY
|
|
169
|
+
ARRAY_TO_STRING(array, delimiter)
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
**Arrays and structs:**
|
|
173
|
+
```sql
|
|
174
|
+
-- Array operations
|
|
175
|
+
ARRAY_AGG(column)
|
|
176
|
+
UNNEST(array_column)
|
|
177
|
+
ARRAY_LENGTH(array_column)
|
|
178
|
+
value IN UNNEST(array_column)
|
|
179
|
+
|
|
180
|
+
-- Struct access
|
|
181
|
+
struct_column.field_name
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
**Performance tips:**
|
|
185
|
+
- Always filter on partition columns (usually date) to reduce bytes scanned
|
|
186
|
+
- Use clustering for frequently filtered columns within partitions
|
|
187
|
+
- Use `APPROX_COUNT_DISTINCT()` for large-scale cardinality estimates
|
|
188
|
+
- Avoid `SELECT *` -- billing is per-byte scanned
|
|
189
|
+
- Use `DECLARE` and `SET` for parameterized scripts
|
|
190
|
+
- Preview query cost with dry run before executing large queries
|
|
191
|
+
|
|
192
|
+
---
|
|
193
|
+
|
|
194
|
+
### Redshift (Amazon)
|
|
195
|
+
|
|
196
|
+
**Date/time:**
|
|
197
|
+
```sql
|
|
198
|
+
-- Current date/time
|
|
199
|
+
CURRENT_DATE, GETDATE(), SYSDATE
|
|
200
|
+
|
|
201
|
+
-- Date arithmetic
|
|
202
|
+
DATEADD(day, 7, date_column)
|
|
203
|
+
DATEDIFF(day, start_date, end_date)
|
|
204
|
+
|
|
205
|
+
-- Truncate to period
|
|
206
|
+
DATE_TRUNC('month', created_at)
|
|
207
|
+
|
|
208
|
+
-- Extract parts
|
|
209
|
+
EXTRACT(YEAR FROM created_at)
|
|
210
|
+
DATE_PART('dow', created_at)
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
**String functions:**
|
|
214
|
+
```sql
|
|
215
|
+
-- Case-insensitive
|
|
216
|
+
column ILIKE '%pattern%'
|
|
217
|
+
REGEXP_INSTR(column, 'pattern') > 0
|
|
218
|
+
|
|
219
|
+
-- String manipulation
|
|
220
|
+
SPLIT_PART(str, delimiter, position)
|
|
221
|
+
LISTAGG(column, ', ') WITHIN GROUP (ORDER BY column)
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
**Performance tips:**
|
|
225
|
+
- Design distribution keys for collocated joins (DISTKEY)
|
|
226
|
+
- Use sort keys for frequently filtered columns (SORTKEY)
|
|
227
|
+
- Use `EXPLAIN` to check query plan
|
|
228
|
+
- Avoid cross-node data movement (watch for DS_BCAST and DS_DIST)
|
|
229
|
+
- `ANALYZE` and `VACUUM` regularly
|
|
230
|
+
- Use late-binding views for schema flexibility
|
|
231
|
+
|
|
232
|
+
---
|
|
233
|
+
|
|
234
|
+
### Databricks SQL
|
|
235
|
+
|
|
236
|
+
**Date/time:**
|
|
237
|
+
```sql
|
|
238
|
+
-- Current date/time
|
|
239
|
+
CURRENT_DATE(), CURRENT_TIMESTAMP()
|
|
240
|
+
|
|
241
|
+
-- Date arithmetic
|
|
242
|
+
DATE_ADD(date_column, 7)
|
|
243
|
+
DATEDIFF(end_date, start_date)
|
|
244
|
+
ADD_MONTHS(date_column, 1)
|
|
245
|
+
|
|
246
|
+
-- Truncate to period
|
|
247
|
+
DATE_TRUNC('MONTH', created_at)
|
|
248
|
+
TRUNC(date_column, 'MM')
|
|
249
|
+
|
|
250
|
+
-- Extract parts
|
|
251
|
+
YEAR(created_at), MONTH(created_at)
|
|
252
|
+
DAYOFWEEK(created_at)
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
**Delta Lake features:**
|
|
256
|
+
```sql
|
|
257
|
+
-- Time travel
|
|
258
|
+
SELECT * FROM my_table TIMESTAMP AS OF '2024-01-15'
|
|
259
|
+
SELECT * FROM my_table VERSION AS OF 42
|
|
260
|
+
|
|
261
|
+
-- Describe history
|
|
262
|
+
DESCRIBE HISTORY my_table
|
|
263
|
+
|
|
264
|
+
-- Merge (upsert)
|
|
265
|
+
MERGE INTO target USING source
|
|
266
|
+
ON target.id = source.id
|
|
267
|
+
WHEN MATCHED THEN UPDATE SET *
|
|
268
|
+
WHEN NOT MATCHED THEN INSERT *
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
**Performance tips:**
|
|
272
|
+
- Use Delta Lake's `OPTIMIZE` and `ZORDER` for query performance
|
|
273
|
+
- Leverage Photon engine for compute-intensive queries
|
|
274
|
+
- Use `CACHE TABLE` for frequently accessed datasets
|
|
275
|
+
- Partition by low-cardinality date columns
|
|
276
|
+
|
|
277
|
+
---
|
|
278
|
+
|
|
279
|
+
## Common SQL Patterns
|
|
280
|
+
|
|
281
|
+
### Window Functions
|
|
282
|
+
|
|
283
|
+
```sql
|
|
284
|
+
-- Ranking
|
|
285
|
+
ROW_NUMBER() OVER (PARTITION BY user_id ORDER BY created_at DESC)
|
|
286
|
+
RANK() OVER (PARTITION BY category ORDER BY revenue DESC)
|
|
287
|
+
DENSE_RANK() OVER (ORDER BY score DESC)
|
|
288
|
+
|
|
289
|
+
-- Running totals / moving averages
|
|
290
|
+
SUM(revenue) OVER (ORDER BY date_col ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) as running_total
|
|
291
|
+
AVG(revenue) OVER (ORDER BY date_col ROWS BETWEEN 6 PRECEDING AND CURRENT ROW) as moving_avg_7d
|
|
292
|
+
|
|
293
|
+
-- Lag / Lead
|
|
294
|
+
LAG(value, 1) OVER (PARTITION BY entity ORDER BY date_col) as prev_value
|
|
295
|
+
LEAD(value, 1) OVER (PARTITION BY entity ORDER BY date_col) as next_value
|
|
296
|
+
|
|
297
|
+
-- First / Last value
|
|
298
|
+
FIRST_VALUE(status) OVER (PARTITION BY user_id ORDER BY created_at ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING)
|
|
299
|
+
LAST_VALUE(status) OVER (PARTITION BY user_id ORDER BY created_at ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING)
|
|
300
|
+
|
|
301
|
+
-- Percent of total
|
|
302
|
+
revenue / SUM(revenue) OVER () as pct_of_total
|
|
303
|
+
revenue / SUM(revenue) OVER (PARTITION BY category) as pct_of_category
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
### CTEs for Readability
|
|
307
|
+
|
|
308
|
+
```sql
|
|
309
|
+
WITH
|
|
310
|
+
-- Step 1: Define the base population
|
|
311
|
+
base_users AS (
|
|
312
|
+
SELECT user_id, created_at, plan_type
|
|
313
|
+
FROM users
|
|
314
|
+
WHERE created_at >= DATE '2024-01-01'
|
|
315
|
+
AND status = 'active'
|
|
316
|
+
),
|
|
317
|
+
|
|
318
|
+
-- Step 2: Calculate user-level metrics
|
|
319
|
+
user_metrics AS (
|
|
320
|
+
SELECT
|
|
321
|
+
u.user_id,
|
|
322
|
+
u.plan_type,
|
|
323
|
+
COUNT(DISTINCT e.session_id) as session_count,
|
|
324
|
+
SUM(e.revenue) as total_revenue
|
|
325
|
+
FROM base_users u
|
|
326
|
+
LEFT JOIN events e ON u.user_id = e.user_id
|
|
327
|
+
GROUP BY u.user_id, u.plan_type
|
|
328
|
+
),
|
|
329
|
+
|
|
330
|
+
-- Step 3: Aggregate to summary level
|
|
331
|
+
summary AS (
|
|
332
|
+
SELECT
|
|
333
|
+
plan_type,
|
|
334
|
+
COUNT(*) as user_count,
|
|
335
|
+
AVG(session_count) as avg_sessions,
|
|
336
|
+
SUM(total_revenue) as total_revenue
|
|
337
|
+
FROM user_metrics
|
|
338
|
+
GROUP BY plan_type
|
|
339
|
+
)
|
|
340
|
+
|
|
341
|
+
SELECT * FROM summary ORDER BY total_revenue DESC;
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
### Cohort Retention
|
|
345
|
+
|
|
346
|
+
```sql
|
|
347
|
+
WITH cohorts AS (
|
|
348
|
+
SELECT
|
|
349
|
+
user_id,
|
|
350
|
+
DATE_TRUNC('month', first_activity_date) as cohort_month
|
|
351
|
+
FROM users
|
|
352
|
+
),
|
|
353
|
+
activity AS (
|
|
354
|
+
SELECT
|
|
355
|
+
user_id,
|
|
356
|
+
DATE_TRUNC('month', activity_date) as activity_month
|
|
357
|
+
FROM user_activity
|
|
358
|
+
)
|
|
359
|
+
SELECT
|
|
360
|
+
c.cohort_month,
|
|
361
|
+
COUNT(DISTINCT c.user_id) as cohort_size,
|
|
362
|
+
COUNT(DISTINCT CASE
|
|
363
|
+
WHEN a.activity_month = c.cohort_month THEN a.user_id
|
|
364
|
+
END) as month_0,
|
|
365
|
+
COUNT(DISTINCT CASE
|
|
366
|
+
WHEN a.activity_month = c.cohort_month + INTERVAL '1 month' THEN a.user_id
|
|
367
|
+
END) as month_1,
|
|
368
|
+
COUNT(DISTINCT CASE
|
|
369
|
+
WHEN a.activity_month = c.cohort_month + INTERVAL '3 months' THEN a.user_id
|
|
370
|
+
END) as month_3
|
|
371
|
+
FROM cohorts c
|
|
372
|
+
LEFT JOIN activity a ON c.user_id = a.user_id
|
|
373
|
+
GROUP BY c.cohort_month
|
|
374
|
+
ORDER BY c.cohort_month;
|
|
375
|
+
```
|
|
376
|
+
|
|
377
|
+
### Funnel Analysis
|
|
378
|
+
|
|
379
|
+
```sql
|
|
380
|
+
WITH funnel AS (
|
|
381
|
+
SELECT
|
|
382
|
+
user_id,
|
|
383
|
+
MAX(CASE WHEN event = 'page_view' THEN 1 ELSE 0 END) as step_1_view,
|
|
384
|
+
MAX(CASE WHEN event = 'signup_start' THEN 1 ELSE 0 END) as step_2_start,
|
|
385
|
+
MAX(CASE WHEN event = 'signup_complete' THEN 1 ELSE 0 END) as step_3_complete,
|
|
386
|
+
MAX(CASE WHEN event = 'first_purchase' THEN 1 ELSE 0 END) as step_4_purchase
|
|
387
|
+
FROM events
|
|
388
|
+
WHERE event_date >= CURRENT_DATE - INTERVAL '30 days'
|
|
389
|
+
GROUP BY user_id
|
|
390
|
+
)
|
|
391
|
+
SELECT
|
|
392
|
+
COUNT(*) as total_users,
|
|
393
|
+
SUM(step_1_view) as viewed,
|
|
394
|
+
SUM(step_2_start) as started_signup,
|
|
395
|
+
SUM(step_3_complete) as completed_signup,
|
|
396
|
+
SUM(step_4_purchase) as purchased,
|
|
397
|
+
ROUND(100.0 * SUM(step_2_start) / NULLIF(SUM(step_1_view), 0), 1) as view_to_start_pct,
|
|
398
|
+
ROUND(100.0 * SUM(step_3_complete) / NULLIF(SUM(step_2_start), 0), 1) as start_to_complete_pct,
|
|
399
|
+
ROUND(100.0 * SUM(step_4_purchase) / NULLIF(SUM(step_3_complete), 0), 1) as complete_to_purchase_pct
|
|
400
|
+
FROM funnel;
|
|
401
|
+
```
|
|
402
|
+
|
|
403
|
+
### Deduplication
|
|
404
|
+
|
|
405
|
+
```sql
|
|
406
|
+
-- Keep the most recent record per key
|
|
407
|
+
WITH ranked AS (
|
|
408
|
+
SELECT
|
|
409
|
+
*,
|
|
410
|
+
ROW_NUMBER() OVER (
|
|
411
|
+
PARTITION BY entity_id
|
|
412
|
+
ORDER BY updated_at DESC
|
|
413
|
+
) as rn
|
|
414
|
+
FROM source_table
|
|
415
|
+
)
|
|
416
|
+
SELECT * FROM ranked WHERE rn = 1;
|
|
417
|
+
```
|
|
418
|
+
|
|
419
|
+
## Error Handling and Debugging
|
|
420
|
+
|
|
421
|
+
When a query fails:
|
|
422
|
+
|
|
423
|
+
1. **Syntax errors**: Check for dialect-specific syntax (e.g., `ILIKE` not available in BigQuery, `SAFE_DIVIDE` only in BigQuery)
|
|
424
|
+
2. **Column not found**: Verify column names against schema -- check for typos, case sensitivity (PostgreSQL is case-sensitive for quoted identifiers)
|
|
425
|
+
3. **Type mismatches**: Cast explicitly when comparing different types (`CAST(col AS DATE)`, `col::DATE`)
|
|
426
|
+
4. **Division by zero**: Use `NULLIF(denominator, 0)` or dialect-specific safe division
|
|
427
|
+
5. **Ambiguous columns**: Always qualify column names with table alias in JOINs
|
|
428
|
+
6. **Group by errors**: All non-aggregated columns must be in GROUP BY (except in BigQuery which allows grouping by alias)
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: statistical-analysis
|
|
3
|
+
description: Apply statistical methods including descriptive stats, trend analysis, outlier detection, and hypothesis testing. Use when analyzing distributions, testing for significance, detecting anomalies, computing correlations, or interpreting statistical results.
|
|
4
|
+
user-invocable: false
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Statistical Analysis Skill
|
|
8
|
+
|
|
9
|
+
Descriptive statistics, trend analysis, outlier detection, hypothesis testing, and guidance on when to be cautious about statistical claims.
|
|
10
|
+
|
|
11
|
+
## Descriptive Statistics Methodology
|
|
12
|
+
|
|
13
|
+
### Central Tendency
|
|
14
|
+
|
|
15
|
+
Choose the right measure of center based on the data:
|
|
16
|
+
|
|
17
|
+
| Situation | Use | Why |
|
|
18
|
+
|---|---|---|
|
|
19
|
+
| Symmetric distribution, no outliers | Mean | Most efficient estimator |
|
|
20
|
+
| Skewed distribution | Median | Robust to outliers |
|
|
21
|
+
| Categorical or ordinal data | Mode | Only option for non-numeric |
|
|
22
|
+
| Highly skewed with outliers (e.g., revenue per user) | Median + mean | Report both; the gap shows skew |
|
|
23
|
+
|
|
24
|
+
**Always report mean and median together for business metrics.** If they diverge significantly, the data is skewed and the mean alone is misleading.
|
|
25
|
+
|
|
26
|
+
### Spread and Variability
|
|
27
|
+
|
|
28
|
+
- **Standard deviation**: How far values typically fall from the mean. Use with normally distributed data.
|
|
29
|
+
- **Interquartile range (IQR)**: Distance from p25 to p75. Robust to outliers. Use with skewed data.
|
|
30
|
+
- **Coefficient of variation (CV)**: StdDev / Mean. Use to compare variability across metrics with different scales.
|
|
31
|
+
- **Range**: Max minus min. Sensitive to outliers but gives a quick sense of data extent.
|
|
32
|
+
|
|
33
|
+
### Percentiles for Business Context
|
|
34
|
+
|
|
35
|
+
Report key percentiles to tell a richer story than mean alone:
|
|
36
|
+
|
|
37
|
+
```
|
|
38
|
+
p1: Bottom 1% (floor / minimum typical value)
|
|
39
|
+
p5: Low end of normal range
|
|
40
|
+
p25: First quartile
|
|
41
|
+
p50: Median (typical user)
|
|
42
|
+
p75: Third quartile
|
|
43
|
+
p90: Top 10% / power users
|
|
44
|
+
p95: High end of normal range
|
|
45
|
+
p99: Top 1% / extreme users
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
**Example narrative**: "The median session duration is 4.2 minutes, but the top 10% of users spend over 22 minutes per session, pulling the mean up to 7.8 minutes."
|
|
49
|
+
|
|
50
|
+
### Describing Distributions
|
|
51
|
+
|
|
52
|
+
Characterize every numeric distribution you analyze:
|
|
53
|
+
|
|
54
|
+
- **Shape**: Normal, right-skewed, left-skewed, bimodal, uniform, heavy-tailed
|
|
55
|
+
- **Center**: Mean and median (and the gap between them)
|
|
56
|
+
- **Spread**: Standard deviation or IQR
|
|
57
|
+
- **Outliers**: How many and how extreme
|
|
58
|
+
- **Bounds**: Is there a natural floor (zero) or ceiling (100%)?
|
|
59
|
+
|
|
60
|
+
## Trend Analysis and Forecasting
|
|
61
|
+
|
|
62
|
+
### Identifying Trends
|
|
63
|
+
|
|
64
|
+
**Moving averages** to smooth noise:
|
|
65
|
+
```python
|
|
66
|
+
# 7-day moving average (good for daily data with weekly seasonality)
|
|
67
|
+
df['ma_7d'] = df['metric'].rolling(window=7, min_periods=1).mean()
|
|
68
|
+
|
|
69
|
+
# 28-day moving average (smooths weekly AND monthly patterns)
|
|
70
|
+
df['ma_28d'] = df['metric'].rolling(window=28, min_periods=1).mean()
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
**Period-over-period comparison**:
|
|
74
|
+
- Week-over-week (WoW): Compare to same day last week
|
|
75
|
+
- Month-over-month (MoM): Compare to same month prior
|
|
76
|
+
- Year-over-year (YoY): Gold standard for seasonal businesses
|
|
77
|
+
- Same-day-last-year: Compare specific calendar day
|
|
78
|
+
|
|
79
|
+
**Growth rates**:
|
|
80
|
+
```
|
|
81
|
+
Simple growth: (current - previous) / previous
|
|
82
|
+
CAGR: (ending / beginning) ^ (1 / years) - 1
|
|
83
|
+
Log growth: ln(current / previous) -- better for volatile series
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### Seasonality Detection
|
|
87
|
+
|
|
88
|
+
Check for periodic patterns:
|
|
89
|
+
1. Plot the raw time series -- visual inspection first
|
|
90
|
+
2. Compute day-of-week averages: is there a clear weekly pattern?
|
|
91
|
+
3. Compute month-of-year averages: is there an annual cycle?
|
|
92
|
+
4. When comparing periods, always use YoY or same-period comparisons to avoid conflating trend with seasonality
|
|
93
|
+
|
|
94
|
+
### Forecasting (Simple Methods)
|
|
95
|
+
|
|
96
|
+
For business analysts (not data scientists), use straightforward methods:
|
|
97
|
+
|
|
98
|
+
- **Naive forecast**: Tomorrow = today. Use as a baseline.
|
|
99
|
+
- **Seasonal naive**: Tomorrow = same day last week/year.
|
|
100
|
+
- **Linear trend**: Fit a line to historical data. Only for clearly linear trends.
|
|
101
|
+
- **Moving average forecast**: Use trailing average as the forecast.
|
|
102
|
+
|
|
103
|
+
**Always communicate uncertainty**. Provide a range, not a point estimate:
|
|
104
|
+
- "We expect 10K-12K signups next month based on the 3-month trend"
|
|
105
|
+
- NOT "We will get exactly 11,234 signups next month"
|
|
106
|
+
|
|
107
|
+
**When to escalate to a data scientist**: Non-linear trends, multiple seasonalities, external factors (marketing spend, holidays), or when forecast accuracy matters for resource allocation.
|
|
108
|
+
|
|
109
|
+
## Outlier and Anomaly Detection
|
|
110
|
+
|
|
111
|
+
### Statistical Methods
|
|
112
|
+
|
|
113
|
+
**Z-score method** (for normally distributed data):
|
|
114
|
+
```python
|
|
115
|
+
z_scores = (df['value'] - df['value'].mean()) / df['value'].std()
|
|
116
|
+
outliers = df[abs(z_scores) > 3] # More than 3 standard deviations
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
**IQR method** (robust to non-normal distributions):
|
|
120
|
+
```python
|
|
121
|
+
Q1 = df['value'].quantile(0.25)
|
|
122
|
+
Q3 = df['value'].quantile(0.75)
|
|
123
|
+
IQR = Q3 - Q1
|
|
124
|
+
lower_bound = Q1 - 1.5 * IQR
|
|
125
|
+
upper_bound = Q3 + 1.5 * IQR
|
|
126
|
+
outliers = df[(df['value'] < lower_bound) | (df['value'] > upper_bound)]
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
**Percentile method** (simplest):
|
|
130
|
+
```python
|
|
131
|
+
outliers = df[(df['value'] < df['value'].quantile(0.01)) |
|
|
132
|
+
(df['value'] > df['value'].quantile(0.99))]
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### Handling Outliers
|
|
136
|
+
|
|
137
|
+
Do NOT automatically remove outliers. Instead:
|
|
138
|
+
|
|
139
|
+
1. **Investigate**: Is this a data error, a genuine extreme value, or a different population?
|
|
140
|
+
2. **Data errors**: Fix or remove (e.g., negative ages, timestamps in year 1970)
|
|
141
|
+
3. **Genuine extremes**: Keep them but consider using robust statistics (median instead of mean)
|
|
142
|
+
4. **Different population**: Segment them out for separate analysis (e.g., enterprise vs. SMB customers)
|
|
143
|
+
|
|
144
|
+
**Report what you did**: "We excluded 47 records (0.3%) with transaction amounts >$50K, which represent bulk enterprise orders analyzed separately."
|
|
145
|
+
|
|
146
|
+
### Time Series Anomaly Detection
|
|
147
|
+
|
|
148
|
+
For detecting unusual values in a time series:
|
|
149
|
+
|
|
150
|
+
1. Compute expected value (moving average or same-period-last-year)
|
|
151
|
+
2. Compute deviation from expected
|
|
152
|
+
3. Flag deviations beyond a threshold (typically 2-3 standard deviations of the residuals)
|
|
153
|
+
4. Distinguish between point anomalies (single unusual value) and change points (sustained shift)
|
|
154
|
+
|
|
155
|
+
## Hypothesis Testing Basics
|
|
156
|
+
|
|
157
|
+
### When to Use
|
|
158
|
+
|
|
159
|
+
Use hypothesis testing when you need to determine whether an observed difference is likely real or could be due to random chance. Common scenarios:
|
|
160
|
+
|
|
161
|
+
- A/B test results: Is variant B actually better than A?
|
|
162
|
+
- Before/after comparison: Did the product change actually move the metric?
|
|
163
|
+
- Segment comparison: Do enterprise customers really have higher retention?
|
|
164
|
+
|
|
165
|
+
### The Framework
|
|
166
|
+
|
|
167
|
+
1. **Null hypothesis (H0)**: There is no difference (the default assumption)
|
|
168
|
+
2. **Alternative hypothesis (H1)**: There is a difference
|
|
169
|
+
3. **Choose significance level (alpha)**: Typically 0.05 (5% chance of false positive)
|
|
170
|
+
4. **Compute test statistic and p-value**
|
|
171
|
+
5. **Interpret**: If p < alpha, reject H0 (evidence of a real difference)
|
|
172
|
+
|
|
173
|
+
### Common Tests
|
|
174
|
+
|
|
175
|
+
| Scenario | Test | When to Use |
|
|
176
|
+
|---|---|---|
|
|
177
|
+
| Compare two group means | t-test (independent) | Normal data, two groups |
|
|
178
|
+
| Compare two group proportions | z-test for proportions | Conversion rates, binary outcomes |
|
|
179
|
+
| Compare paired measurements | Paired t-test | Before/after on same entities |
|
|
180
|
+
| Compare 3+ group means | ANOVA | Multiple segments or variants |
|
|
181
|
+
| Non-normal data, two groups | Mann-Whitney U test | Skewed metrics, ordinal data |
|
|
182
|
+
| Association between categories | Chi-squared test | Two categorical variables |
|
|
183
|
+
|
|
184
|
+
### Practical Significance vs. Statistical Significance
|
|
185
|
+
|
|
186
|
+
**Statistical significance** means the difference is unlikely due to chance.
|
|
187
|
+
|
|
188
|
+
**Practical significance** means the difference is large enough to matter for business decisions.
|
|
189
|
+
|
|
190
|
+
A difference can be statistically significant but practically meaningless (common with large samples). Always report:
|
|
191
|
+
- **Effect size**: How big is the difference? (e.g., "Variant B improved conversion by 0.3 percentage points")
|
|
192
|
+
- **Confidence interval**: What's the range of plausible true effects?
|
|
193
|
+
- **Business impact**: What does this translate to in revenue, users, or other business terms?
|
|
194
|
+
|
|
195
|
+
### Sample Size Considerations
|
|
196
|
+
|
|
197
|
+
- Small samples produce unreliable results, even with significant p-values
|
|
198
|
+
- Rule of thumb for proportions: Need at least 30 events per group for basic reliability
|
|
199
|
+
- For detecting small effects (e.g., 1% conversion rate change), you may need thousands of observations per group
|
|
200
|
+
- If your sample is small, say so: "With only 200 observations per group, we have limited power to detect effects smaller than X%"
|
|
201
|
+
|
|
202
|
+
## When to Be Cautious About Statistical Claims
|
|
203
|
+
|
|
204
|
+
### Correlation Is Not Causation
|
|
205
|
+
|
|
206
|
+
When you find a correlation, explicitly consider:
|
|
207
|
+
- **Reverse causation**: Maybe B causes A, not A causes B
|
|
208
|
+
- **Confounding variables**: Maybe C causes both A and B
|
|
209
|
+
- **Coincidence**: With enough variables, spurious correlations are inevitable
|
|
210
|
+
|
|
211
|
+
**What you can say**: "Users who use feature X have 30% higher retention"
|
|
212
|
+
**What you cannot say without more evidence**: "Feature X causes 30% higher retention"
|
|
213
|
+
|
|
214
|
+
### Multiple Comparisons Problem
|
|
215
|
+
|
|
216
|
+
When you test many hypotheses, some will be "significant" by chance:
|
|
217
|
+
- Testing 20 metrics at p=0.05 means ~1 will be falsely significant
|
|
218
|
+
- If you looked at many segments before finding one that's different, note that
|
|
219
|
+
- Adjust for multiple comparisons with Bonferroni correction (divide alpha by number of tests) or report how many tests were run
|
|
220
|
+
|
|
221
|
+
### Simpson's Paradox
|
|
222
|
+
|
|
223
|
+
A trend in aggregated data can reverse when data is segmented:
|
|
224
|
+
- Always check whether the conclusion holds across key segments
|
|
225
|
+
- Example: Overall conversion goes up, but conversion goes down in every segment -- because the mix shifted toward a higher-converting segment
|
|
226
|
+
|
|
227
|
+
### Survivorship Bias
|
|
228
|
+
|
|
229
|
+
You can only analyze entities that "survived" to be in your dataset:
|
|
230
|
+
- Analyzing active users ignores those who churned
|
|
231
|
+
- Analyzing successful companies ignores those that failed
|
|
232
|
+
- Always ask: "Who is missing from this dataset, and would their inclusion change the conclusion?"
|
|
233
|
+
|
|
234
|
+
### Ecological Fallacy
|
|
235
|
+
|
|
236
|
+
Aggregate trends may not apply to individuals:
|
|
237
|
+
- "Countries with higher X have higher Y" does NOT mean "individuals with higher X have higher Y"
|
|
238
|
+
- Be careful about applying group-level findings to individual cases
|
|
239
|
+
|
|
240
|
+
### Anchoring on Specific Numbers
|
|
241
|
+
|
|
242
|
+
Be wary of false precision:
|
|
243
|
+
- "Churn will be 4.73% next quarter" implies more certainty than is warranted
|
|
244
|
+
- Prefer ranges: "We expect churn between 4-6% based on historical patterns"
|
|
245
|
+
- Round appropriately: "About 5%" is often more honest than "4.73%"
|