monte-carlo-validation-notebook
Generates SQL validation notebooks for dbt PR changes with before/after comparison queries.
npx skills add sickn33/agentic-awesome-skills --skill monte-carlo-validation-notebook --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
What it does
Generates a SQL Notebook with validation queries for dbt changes, targeting changed dbt models (under models/ or snapshots/) identified from a PR URL or local repository. It outputs an import URL for MC Bridge SQL Notebook interface containing parameters for prod_db and dev_db and includes validation queries per model based on whether the model is new or modified. It also resolves the schema for each model using a dedicated script and accounts for dbt_project.yml routing rules, producing per-model metadata such as table name and inferred schema.
How it works
- Determines mode automatically from the target argument (PR URL -> PR mode; local path -> Local mode).
- Phase 1: Phase 1 gathers changed files, filters to .sql under models/ or snapshots/, determines affected models, and reads file content or diffs accordingly. In PR mode, it uses gh pr view to fetch PR number, repo, files, and diff, then for each changed model file, retrieves full content at head SHA. It locates dbt_project.yml by probing common project roots and saves to a temp workspace. In Local mode, it checks the current branch, determines base branch, lists changed .sql files, diffs them, and reads local model files. It also finds dbt_project.yml in the workspace.
- Phase 2: For each changed model, extracts metadata (output table name from file path), resolves schema with resolve_dbt_schema.py, and reads config blocks for materialized, unique_key, cluster_by. It scans for key segmentation fields and time axis, and identifies changed diff elements (fields, filters, joins, unique_key, new columns). It classifies models as new or modified based on the diff; new models skip Phase 2b, but Phase 2a still applies.
- Phase 3: Generates validation queries for each model. Uses placeholders {{prod_db}} and {{dev_db}} in conjunction with a per-model hardcoded SCHEMA from the schema resolution. Distinguishes patterns for NEW models (dev_db only) and MODIFIED models (prod and dev). Applies various patterns for total row count, sample data, core segmentation, uniqueness, NULL rate checks, and time-axis continuity when applicable. For modified models, includes changed-field distribution and time-based analyses depending on diff and time axis presence. All references and placeholders are produced in the specified YAML/import URL format and preserve exact syntax for placeholders and table references.
When to use it
Use this when validating dbt model or snapshot changes with Monte Carlo SQL Notebook queries, either from a GitHub PR or a local dbt repository.
What it can touch
- Tools: claude-code, cursor, codex
- Executes helper scripts located at:
${CLAUDE_PLUGIN_ROOT}/skills/monte-carlo-validation-notebook/scripts/for resolving dbt schemas and encoding notebooks. - Works with a generated URL:
<MC_BASE_URL>/notebooks/import#<base64-encoded-yaml>to open the notebook in MC Bridge.
Caveats
- Generated SQL uses ANSI-compatible syntax and may require minor adjustments per warehouse quirks.
- If schema resolution fails, the process stops for that model and does not generate the notebook.
- The notebook requires prerequisites: gh (GitHub CLI) for PR mode, python3, and pyyaml.
- Maximum of 10 models are processed if more are changed; a warning is issued and the rest are skipped.
- Time axis detection relies on specific patterns (is_incremental, cluster_by, known time fields) and may skip time-axis queries if none is found.
> **Tip:** This skill works well with Sonnet. Run `/model sonnet` before invoking for faster generation. Generate a SQL Notebook with validation queries for dbt changes. **Arguments:** $ARGUMENTS ## When to Use Use this skill when the user wants to validate dbt model or snapshot changes with Monte Carlo SQL Notebook queries, either from a GitHub PR or a local dbt repository. Parse the arguments: - **Target** (required): first argument — a GitHub PR URL or local dbt repo path - **MC Base URL** (optional): `--mc-base-url <URL>` — defaults to `https://getmontecarlo.com` - **Models** (optional): `--models <model1,model2,...>` — comma-separated list of model filenames (without `.sql` extension) to generate queries for. Only these models will be included. By default, all changed models are included up to a maximum of 10. --- # Setup **Prerequisites:** - **`gh`** (GitHub CLI) — required for PR mode. Must be authenticated (`gh auth status`). - **`python3`** — required for helper scripts. - **`pyyaml`** — install with `pip3 install pyyaml` (or `pip install pyyaml`, `uv pip install pyyaml`, etc.) **Note:** Generated SQL uses ANSI-compatible syntax that works across Snowflake, BigQuery, Redsh
- When to Use
- Parameter Cell Spec
- Phase 1: Get Changed Files
- If PR mode (GitHub PR):
- If Local mode (Local Directory):
- Model Selection (applies to both modes)
- Phase 2: Parse Changed Models
- 2a. Model Metadata
- 2b. Diff Analysis
- 2c. Model Classification
- Phase 3: Generate Validation Queries
- Query Patterns for NEW Models
- Query Patterns for MODIFIED Models
- Phase 4: Build Notebook YAML
gh pr view <PR#> --repo <owner>/<repo> --json number,title,author,mergedAt,headRefOid gh pr view <PR#> --repo <owner>/<repo> --json files --jq '.files[].path' gh pr diff <PR#> --repo <owner>/<repo> git rev-parse --abbrev-ref HEAD git diff --name-only <base_branch>...HEAD -- '*.sql' git diff <base_branch>...HEAD -- <file_path> find . -name "dbt_project.yml" -type f | head -1 gh api repos/monte-carlo-data/mc-bridge/readme --jq '.content' | base64 --decode
What does the monte-carlo-validation-notebook skill do?
Generates SQL validation notebooks for dbt PR changes with before/after comparison queries.
How do I install it?
Run `npx skills add sickn33/agentic-awesome-skills --skill monte-carlo-validation-notebook --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From sickn33/agentic-awesome-skills, a repository with 44,414 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.