agentleFS
kyle-chalmerskyle-chalmers/streamsnow/skills/sql-review/SKILL.md

sql-review

Skill17 starsChanged 32 days agoMITView on GitHub

Prove an app's numbers against live Snowflake and leave a record a person signs. Builds or repairs the app's sql_review/ page files, checks objects, grants and DDL drift, runs every section as aggregates, has reviewer agents judge the logic, drops findings the evidence does not support, and writes the committed review log. Use when the user says "review the SQL", "are these numbers right", "trace the data", "audit the lineage", before a release or deploy, or from /review-app --sql. It spends warehouse credits, so run it when asked, not on your own initiative.

10 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use code-review.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • GoogleSkill

    code-review

    Adversarial systems, concurrency, memory-model, and architecture code review protocol. Use this skill whenever asked to review code, PRs, diffs, or branches in Filament.

    Also in 4 projects that use this

The file

We split this skill into the rules it gives an agent

5 rules. 0 are common, 1 is distinctive, and 4 are very specific to this project.

  • 0

    Common

    Most of the 8 edited versions we read keep these.

  • 1

    Distinctive

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Every fact comes from a streamsnow sql-review command as JSON with a stable id.

    line 12
  2. Very specific:

    Read these outputs, never result rows.

    line 36
  3. Very specific:

    If a reviewer re-ran a page, run compare again (offline) so its rows are not stale.

    line 58
  4. Very specific:

    Write it: the same command without --dry-run.

    line 63
  5. Distinctive:

    No row-level data or small-group breakdowns in a finding, the log, or chat: pass or fail, row counts, top-level totals.

    line 73

“Common” is measured: kept by at least 6 in 10 of the 8 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

/sql-review

Repo overlay: if .streamsnow/overlays/sql-review.md exists in this repo, read it first — committed, repo-specific additions/overrides (_shared/overlays.md). Outside Claude Code, also read _shared/other-agents.md.

Every fact comes from a streamsnow sql-review command as JSON with a stable id; agents only judge, every finding cites those IDs, a verifier drops what the evidence does not support, and log refuses anything uncited. Judgment, never a gate: streamsnow validate-app alone passes or fails a ship. Run it on request and before a release or deploy.

Preflight

  1. Resolve the slug; read the app's AGENTS.md (Data notes) and REQUIREMENTS.md.
  2. Offline gate: streamsnow sql-review check <slug>. No index.yaml, coverage gaps or marker findings → build the index first, per authoring.md. Drift → streamsnow sql-review generate <slug>, committed on its own: the live commands refuse page files that do not match what the app runs. --offline stops here and reports the coverage.
  3. Connection: streamsnow doctor. None → stop after step 2 and name the enabler (streamsnow configure, then snow connection add); never invent results. The live commands run as snowflake.roles.ci_role (the deployed app's role) with secondary roles off; if the user does not hold it, ask which role to use and add --role. The commands also use objects.default_warehouse; if that role cannot use it, add --warehouse with one it can.

Facts (JSON only)

  1. streamsnow sql-review probe <slug>: objects exist, direct grants, DDL drift, every section compiles with its columns. Keep the run_id it prints; add --run <run_id> from here on.
  2. streamsnow sql-review run <slug> --run <run_id> (--page NN for one page): rows, totals, an order-insensitive hash and timing per section, computed in Snowflake.
  3. Read these outputs, never result rows. Do not run sections yourself, and never call snow sql directly: the commands guard every statement before it is sent.
  4. Screen (skip with --no-screen): preview in review mode, open every page at its default filters, stop the preview, then streamsnow sql-review compare <slug> --run <run_id>, per screen.md. Its mismatches go to the page reviewers, never straight to the log.

Judgment

  1. In parallel (Claude Code: one message, several Task calls): agent streamsnow:sql-review-page once per page, and streamsnow:sql-review-object once per object in sql_review/app_specific_reporting_objects/. Without subagents, follow reviewers/page.md and reviewers/object.md yourself, one brief at a time. Each brief names its inputs, the one file it writes, and its result.
  2. Optimizer (reviewers/optimizer.md) for each section run marked slow (over 10 s), or for all with --optimize. Every rewrite it proposes is backed by streamsnow sql-review bench <slug> --run <run_id> --metric NN#n --sql-file <candidate> with equivalent: true. It proposes diffs, never applies them, never suggests a bigger warehouse.
  3. Verifier (reviewers/verifier.md), a fresh agent per page batch: it re-reads every cited result, tries to refute each finding, and keeps or drops it with a reason.

Log

  1. If a reviewer re-ran a page, run compare again (offline) so its rows are not stale. Merge the kept findings into findings.json in the run directory, shaped per findings.md. Validate with streamsnow sql-review log <slug> --run <run_id> --findings <file> --dry-run; a refusal names the finding and why. Fix the citation or drop the finding; never invent evidence.
  2. Write it: the same command without --dry-run. It writes sql_review/review_log/YYYY-MM-DD_<shortsha>.md and updates the README's latest review.
  3. streamsnow sql-review check <slug>, then commit the log and sql_review/README.md alone: chore(sql-review): <slug> review <YYYY-MM-DD>. Fixes come later, in their own commits, after the user agrees to each.
  4. Report: the log path, blocker / major / minor counts and the top findings. Tell the user the sign-off block (Reviewer, Date, Decision) is theirs to fill in. Never fill it in.

Rules

  • No row-level data or small-group breakdowns in a finding, the log, or chat: pass or fail, row counts, top-level totals.
  • A human applies DDL outside app data; propose it, deploy only when the user says to. App-data objects (governance.app_data) are applied by the deploy job (streamsnow objects-sql).
  • Data judgment follows tracing.md: never claim upstream is broken without cited evidence, and tell "missing" from "not visible to this role" apart.
  • Exit codes: 1 means a check failed (report it as a fact); 2 means nothing ran (fix the cause: a stale page file, the scaffold placeholder, a refused statement, no connection).

Done when

The log is committed with every finding cited and verified, every screen mismatch either cited or dropped by the verifier (or --no-screen), check is clean, and the user knows the sign-off is theirs. With --offline: check is clean or its gaps are reported.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.