Skip to content
Back to skills

Sql Report

ASecurity

Write a correct, readable analytics SQL query or report

  • 3 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added September 3, 2026
ai-agentsrustgosql

Security analysis

A100/100

Scanned September 3, 2026

npx -y skills add black141312/ada --skill sql-report --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Sql Report?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Sql Report
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/black141312-sql-report/badge)](https://www.skillsdirectory.com/skills/black141312-sql-report)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: sql-report
description: Write a correct, readable analytics SQL query or report
category: data-ml
---

# SQL Report

Use when answering an analytics question with SQL — metrics, cohorts, funnels, time series — where correctness of grain and joins matters more than cleverness.

1. State the question precisely: what's one row in the output (the grain), over what time window, and filtered how.
2. Identify the base tables and their grain; confirm join keys are unique on at least one side to avoid fan-out.
3. Build incrementally with CTEs — one logical step per CTE (filter, join, aggregate) — instead of nested subqueries.
4. Aggregate with explicit GROUP BY matching the SELECT, and use window functions for running totals, ranks, and period-over-period.
5. Guard against double counting from many-to-many joins; pre-aggregate to the right grain before joining.
6. Sanity-check totals against a known number, check for NULLs in keys, and review the row count.

## Rules
- Define the output grain first; most SQL bugs are a join that silently multiplies rows.
- Filter dates with half-open ranges (`>= start AND < end`) to avoid boundary and timezone errors.
- Beware aggregates over LEFT-joined NULLs — `COUNT(col)` skips NULLs, `SUM` treats them as zero; be intentional.
- Name CTEs for what they represent; avoid `SELECT *` in reports so the contract is explicit.
- Verify with a small spot-check (a single known entity) before trusting the aggregate.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…