{"id":79570,"plugin_id":"plugins_6ab40fcbcc3c81919e0c679fee35faaf","kind":"skill","collection_source":"plugin_package","comparison_source":null,"observed_at":"2026-11-04T00:11:26.021Z","digest":"f8114238ff6396c97b00d5180585424609f9bb03594024038c9bbc6ece2f812c","against":null,"payload":{"description":"Write ranking, running totals, top-N and deterministic deduplication SQL.","included_files":[],"name":"window-ranking-dedup","skill_md_contents":"---\nname: window-ranking-dedup\ndescription: Write ranking, running totals, top-N and deterministic deduplication SQL.\n---\n\n# Window Ranking Dedup\n\n**Trigger:** Write ranking, running totals, top-N and deterministic deduplication SQL.\n\n## Workflow\n1. Define the partition key, desired row grain, order direction and precise tie behavior.\n2. Choose ROW_NUMBER, RANK or DENSE_RANK according to ties, or an aggregate/window when row retention differs.\n3. For latest-record selection, add a complete deterministic order using version, updated timestamp and final immutable unique tie-breaker.\n4. Filter window results at the correct logical level using a CTE/subquery or dialect-supported QUALIFY.\n5. Include validation that one winner is selected per business key and explain whether a re-run with late data changes the winner.\n\n## Critical standard\nNo nondeterministic ROW_NUMBER with an incomplete ORDER BY for production deduplication.\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/windows-and-dedup.md` when relevant.\n- Read `../../references/dialects.md` when relevant.\n\n## Return\nDialect-specific SQL with explicit tie semantics and uniqueness probes.\n"},"changes":[],"summary":"First saved snapshot. No earlier version is available for comparison.","summary_kind":"deterministic","summary_metadata":{}}