ProSkillsLibraryFreePassScan
Data & SQL

Data & SQL · agent skill

Pipeline Debugger

Finds the first bad table and fixes it at source.

What it does

Loads when it is needed

Your agent loads it when a pipeline, dbt model or dashboard number is wrong or late. It carries 5 rules and reads a profile.md with your details before it starts, so the output matches your brand and project.

Same prompt, with and without

Dashboard revenue nearly doubled

Prompt · Revenue for 2025-03-14 on the finance dashboard is 41,870 but Stripe's payout report says 22,940. dbt on Snowflake, Airflow loads raw. Can you find it?

Lineage: raw_stripe_charges -> stg_charges -> int_charges_enriched -> fct_daily_revenue
Counts for 2025-03-14 (created_at UTC), I ran these:
  raw_stripe_charges    rows 1,312   distinct charge_id 1,312
  stg_charges           rows 1,312   distinct charge_id 1,312
  int_charges_enriched  rows 2,391   distinct charge_id 1,312
-- models/int_charges_enriched.sql
select c.charge_id, c.amount_cents, c.created_at, d.country, d.tax_region
from {{ ref('stg_charges') }} c
left join {{ ref('dim_customer_history') }} d on d.customer_id = c.customer_id
-- dim_customer_history: one row per customer per address change (customer_id, valid_from, valid_to, is_current)

Profile used: Snowflake, dbt + Airflow, ~2M charges; layers raw_/stg_/int_/fct_, snake_case, _at timestamps

Without the skill
Found it: a fan-out join in int_charges_enriched. dim_customer_history has one row per customer per address change, and you're joining only on customer_id. Every charge for a customer with N address versions gets repeated N times. That matches your counts: 1,312 distinct charge_ids but 2,391 rows, a ratio of about 1.82, and your revenue ratio (41,870 / 22,940) is about 1.83. The fix is to join to the version that was valid when the charge happened: left join {{ ref('dim_customer_history') }} d on d.customer_id = c.customer_id and c.created_at >= d.valid_from and c.created_at < coalesce(d.valid_to, '9999-12-31') Check that valid_to is exclusive and that windows for one customer don't overlap, otherwise you will still get duplicates. A quick check: select customer_id, count(*) from dim_customer_history where is_current group by 1 having count(*) > 1; To prevent it from happening again, add a dbt unique test on charge_id in int_charges_enriched (and a row-count test against stg_charges). Fan-out on a join is the classic reason a number is higher at one layer than the one before it. After fixing, re-run and compare to Stripe. Note that Stripe payouts are net of fees and timing differences, so a small gap can remain; compare to the charges report for the date.
With the skill
Pipeline debug: fct_daily_revenue, 2025-03-14 Symptom: 41,870 on the dashboard vs 22,940 in the Stripe payout report (source of truth). Lineage: raw_stripe_charges -> stg_charges -> int_charges_enriched -> fct_daily_revenue First bad table: int_charges_enriched (last good: stg_charges) Evidence raw / stg: 1,312 rows, 1,312 distinct charge_id (good) int_charges_enriched: 2,391 rows, 1,312 distinct charge_id: 1,079 extra rows Ratio 2,391 / 1,312 = 1.82, and 41,870 / 22,940 = 1.83, so the rows account for the inflated sum. Classification: join fan-out. dim_customer_history keeps one row per address change, so d.customer_id = c.customer_id matches every historical version of a customer and repeats the charge for each. Confirm with: SELECT customer_id, COUNT(*) FROM dim_customer_history GROUP BY 1 HAVING COUNT(*) > 1; (expect many rows). Fix at the source (point-in-time join): left join {{ ref('dim_customer_history') }} d on d.customer_id = c.customer_id and c.created_at >= d.valid_from and c.created_at < coalesce(d.valid_to, '9999-12-31'::timestamp_tz) Regression tests - unique + not_null on int_charges_enriched.charge_id - singular test returning rows when count(stg_charges) <> count(int_charges_enriched) - dim_customer_history: no overlapping validity windows per customer_id Backfill plan (awaiting your approval): find the first date where the counts diverge, run dbt run --select int_charges_enriched+ from there, expect int rows to equal stg rows per day, then sum 2025-03-14 to 22,940. Not checked: when the history rows first appeared, whether fct is incremental, and 22,940 net vs gross of refunds.

Both answers from the same model (Claude sonnet), 2026-10-16. The one without the skill was written in a separate session that never saw it. Shortened where marked with …

Install

One command, in your project

It detects your agent; add --agent all for every agent.

npx proskills-cli add data-pipeline-debugger --order <order id from your receipt>

Or copy the skill folder (the one holding SKILL.md) into the directory your agent reads, then restart it or start a new session.

AgentThis projectEvery project
Claude Code.claude/skills/~/.claude/skills/
Cursor.agents/skills/ (or .cursor/skills/)~/.cursor/skills/
Codex.agents/skills/~/.agents/skills/
Gemini CLI.agents/skills/ (or .gemini/skills/)~/.gemini/skills/

Changelog

What changed

  • v1.0.0 · 2026-10-16
    • First versioned release: Finds the first bad table and fixes it at source.
    • Scanned 100/100 before release.

Keep it current with npx proskills-cli update; your profile.md is never touched. Everyone who bought it gets the update free and an email when it lands.

Same collection

More from Data & SQL

The scan checks spec compliance, token cost, clarity and security patterns. A clean scan is not a guarantee: static scanners can be evaded. Scan any skill yourself.