Skip to content
cccskills
FreePublished on GitHub

query-validation

SQL query review for correctness, performance, and best practices. Activate when a query needs review before production use, shows unexpected results, or runs too slowly.

The English summary is being prepared. Showing the original description.

See how to install

Files included (8)

  • SKILL.md2.2 KB
  • assets/optimization_recommendations.md1.3 KB
  • assets/query_review_template.md1.7 KB
  • references/engine_specific_guide.md5.1 KB
  • references/sql_anti_patterns.md3.9 KB
  • scripts/cardinality_estimator.py3.6 KB
  • scripts/explain_plan_parser.py3.7 KB
  • scripts/sql_lint.py3.2 KB

SKILL.md (original)

Review the instructions the agent will receive before you install.

When to use

  • A SQL query is about to be promoted to a production dashboard or report
  • A query is returning surprising or incorrect results
  • A query is running slowly and needs performance review
  • You want to catch anti-patterns (implicit conversions, SELECT *, unbounded CTEs) before they cause incidents

Process

  1. Lint the query — run scripts/sql_lint.py (sqlglot-based) to catch syntax errors, unsupported functions for the target engine, and style violations. Fix hard errors before continuing.
  2. Review anti-patterns — compare the query structure against references/sql_anti_patterns.md. Flag any present anti-patterns with a severity rating.
  3. Parse the explain plan — if an EXPLAIN or query profile output is available, run scripts/explain_plan_parser.py to extract slow steps (full table scans, missing indexes, high row estimates).
  4. Estimate cardinality — run scripts/cardinality_estimator.py if schema stats are available to flag joins that might fan-out unexpectedly.
  5. Check engine-specific behaviour — consult references/engine_specific_guide.md for the target engine (Snowflake / BigQuery / Postgres / Redshift) to verify date functions, window behaviour, and clustering assumptions.
  6. Produce review output — fill in assets/query_review_template.md with findings; for any performance issues found, complete assets/optimization_recommendations.md.

Inputs the skill needs

  • Required: the SQL query text
  • Required: target database engine (Snowflake / BigQuery / Postgres / Redshift / other)
  • Optional: relevant table schemas (column names, types, approximate row counts)
  • Optional: EXPLAIN / query profile output
  • Optional: expected business logic — what should the query calculate?

Output

  • assets/query_review_template.md (filled) — categorised findings: correctness, performance, style
  • assets/optimization_recommendations.md (filled, if issues found) — ranked rewrite suggestions with expected impact

Reviews

No reviews yet. Tell others what you thought.

Comments

No login needed. Share how it worked for you, ask a question, or note where it did not run.

No comments yet. Be the first to write one.

Comments are published right away. Do not include personal information such as email addresses or phone numbers. Up to 2 URLs.

0 / 1,000 characters

This form is protected by reCAPTCHA, and the Google Privacy Policy and Terms of Service apply.

More skills from this repository

Rigorous A/B test statistical analysis. Use when analyzing experiment results, calculating statistical significance, checking for sample ratio mismatch, or validating test design before launch.

The English summary is being prepared. Showing the original description.

nimrodfisher/data-analytics-skills481Updated Sep 25, 2026

Track and document analytical assumptions and decisions. Use when making analytical choices, documenting trade-offs, ensuring transparency, or creating audit trails for analytical work.

The English summary is being prepared. Showing the original description.

nimrodfisher/data-analytics-skills481Updated Sep 25, 2026

Structured, reproducible analysis documentation. Use when documenting analysis findings, creating analysis notebooks, ensuring reproducibility, or building analysis archives for future reference.

The English summary is being prepared. Showing the original description.

nimrodfisher/data-analytics-skills481Updated Sep 25, 2026

Structure analysis approach before starting work. Use when receiving new analysis requests, breaking down complex questions into steps, or planning iterative analysis workflows.

The English summary is being prepared. Showing the original description.

nimrodfisher/data-analytics-skills481Updated Sep 25, 2026

Pre-delivery quality assurance for analysis work. Use when reviewing analysis before sharing with stakeholders, checking for completeness, validating assumptions, or ensuring clarity of recommendations.

The English summary is being prepared. Showing the original description.

nimrodfisher/data-analytics-skills481Updated Sep 25, 2026

Post-analysis learning and process improvement. Use when completing major analysis projects, documenting lessons learned, or improving team analytical practices.

The English summary is being prepared. Showing the original description.

nimrodfisher/data-analytics-skills481Updated Sep 25, 2026

See all skills by nimrodfisher

Report a problem with this skill