{"id":79554,"plugin_id":"plugins_6ab40fcbcc3c81919e0c679fee35faaf","kind":"skill","collection_source":"plugin_package","comparison_source":null,"observed_at":"2026-11-04T00:11:25.462Z","digest":"86c591b9428c0f8fec986de512c2550972f9d0df3365fef801a2ff12b4ed8efb","against":null,"payload":{"description":"Find why a query returns wrong totals, too many rows, missing rows or unexpected NULLs.","included_files":[],"name":"debug-sql-results","skill_md_contents":"---\nname: debug-sql-results\ndescription: Find why a query returns wrong totals, too many rows, missing rows or unexpected NULLs.\n---\n\n# Debug Sql Results\n\n**Trigger:** Find why a query returns wrong totals, too many rows, missing rows or unexpected NULLs.\n\n## Workflow\n1. Record the expected output and an observed mismatch (count, amount, key, date range, example order or entity).\n2. Form competing hypotheses: row multiplication, late WHERE filters on LEFT JOIN, mismatched keys, NULL handling, timezone boundaries, floating division or dedup selection.\n3. Generate minimal probe queries for each hypothesis: counts by key after each stage, unmatched keys, before/after aggregates, null group counts.\n4. Prefer root-cause corrections: filter/dedup a many-side before join, restore missing rows or adjust grouping; retain business semantics.\n5. Show expected changes and a reconciliation protocol, keeping observed results separate from assumptions.\n\n## Critical standard\nDISTINCT is not an acceptable default fix for fanout; a syntactically successful query may still be wrong.\n\n## Evidence and execution\nOnly say \"executed\", \"passed\", \"observed\", \"optimized\" or \"deployed\" when a connected tool returned evidence for that claim. An SQL draft, a textual review, or local fixture proof alone is not production validation. Never ask the user to paste passwords or raw confidential records.\n\n## Supporting references\n- Read `../../references/debugging-playbook.md` when relevant.\n- Read `../../references/joins-and-fanout.md` when relevant.\n- Read `../../references/reconciliation.md` when relevant.\n\n## Return\nHypothesis table, targeted probes, minimal fix and expected checks.\n"},"changes":[],"summary":"First saved snapshot. No earlier version is available for comparison.","summary_kind":"deterministic","summary_metadata":{}}