data-quality-audit
Skill0 starsChanged 6 months agoMITView on GitHub
Runs a structured audit on a table covering nulls, duplicates, freshness, schema drift, primary key uniqueness, value distributions, and referential integrity. Use when the user mentions data quality, DQ check, audit this table, "can I trust this data", null check, dedup, freshness, or before relying on a new source.
4 other projects use a version of this.
Adopted by
Most recently taken up by
- strikersam/autonomous-ai-agencytheir own version, first seen Aug 30, 2026
- motao123/dev-workflow-kittheir own version, first seen Jun 13, 2026
- sp1e/claude-skillstheir own version, first seen Jun 9, 2026
- antonrisch/db-skillstheir own version, first seen Jan 24, 2026
Other versions4 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 4
- antonrisch/db-skills★ 9same name
- strikersam/autonomous-ai-agency★ 9same name
- motao123/dev-workflow-kit★ 1same name
- sp1e/claude-skills★ 1same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository14 other files it gives its agents.
- ab-test-analysisSkill
- ab-test-designSkill
- causal-inferenceSkill
- cohort-analysisSkill
- funnel-analysisSkill
- linear-regressionSkill
- logistic-regressionSkill
- metric-definitionSkill
- modular-sql-ctesSkill
- sql-correctness-reviewSkill
- sql-query-reviewSkill
- stakeholder-readoutSkill
- survival-analysisSkill
- warehouse-query-optimizationSkill
The file
We split this skill into the rules it gives an agent
3 rules. 0 are common, 2 are distinctive, and 1 is very specific to this project.
0
Common
Most of the 3 edited versions we read keep these.
2
Distinctive
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 10
Use before trusting data for analysis, modeling, or reporting.
- Very specific: line 17
Before kicking off any modeling skill (logistic-regression, survival-analysis, etc.)
- Distinctive: line 31
Run these in order. Stop and report if any check FAILS critically.
“Common” is measured: kept by at least 6 in 10 of the 3 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.
Files
Data Quality Audit
When to use this skill
Use before trusting data for analysis, modeling, or reporting. Triggers:
- "Audit this table"
- "Check the data quality of…"
- "Can I trust this data?"
- "Is fct_orders fresh?"
- "Are there duplicates in…"
- Before kicking off any modeling skill (
logistic-regression,survival-analysis, etc.)
Required inputs
| Input | Why it matters |
| Table name | What to audit |
| Stated primary key | What grain rows should be at |
| Expected freshness | How recent data should be |
| Critical columns | Columns where null/garbage breaks downstream |
| Foreign key columns | For referential integrity |
Workflow
Run these in order. Stop and report if any check FAILS critically.
1. Row count and time range
select
count(*) as row_count,
min(<time_col>) as earliest,
max(<time_col>) as latest,
datediff('hour', max(<time_col>), current_timestamp) as hours_since_latest
from <table>;Expected: non-zero rows, latest timestamp within freshness SLA.
Fail if: row count = 0, or hours_since_latest > freshness SLA × 1.5.
2. Primary key uniqueness
select <pk_cols>, count(*) as dupes
from <table>
group by <pk_cols>
having count(*) > 1
limit 100;Expected: zero rows.
Fail if: any duplicates. Investigate before proceeding.
3. Null check on critical columns
select
sum(case when <col_1> is null then 1 else 0 end) as nulls_col_1,
sum(case when <col_2> is null then 1 else 0 end) as nulls_col_2,
...
from <table>;Expected: zero nulls in PK and critical columns.
Warn if: > 1% nulls in non-critical columns.
4. Schema check
-- Snowflake
describe table <table>;
-- or
select column_name, data_type
from information_schema.columns
where table_name = '<table_upper>';Expected: columns and types match documentation.
Fail if: columns added/removed/retyped since last documented schema.
5. Value distribution sanity
-- For categorical columns
select <col>, count(*), count(*) * 1.0 / sum(count(*)) over () as share
from <table>
group by 1
order by 2 desc
limit 20;
-- For numeric columns
select
min(<col>),
percentile_cont(0.25) within group (order by <col>) as p25,
median(<col>) as p50,
percentile_cont(0.75) within group (order by <col>) as p75,
percentile_cont(0.99) within group (order by <col>) as p99,
max(<col>),
avg(<col>),
stddev(<col>)
from <table>;Expected: distributions match prior periods / business expectations.
Warn if: new category dominates, or numeric tail spans multiple orders of magnitude unexpectedly.
6. Referential integrity
select count(*) as orphan_rows
from <child_table> c
left join <parent_table> p on c.<fk_col> = p.<pk_col>
where p.<pk_col> is null;Expected: zero orphans.
Warn if: > 0.1% orphans (may indicate join logic issues downstream).
7. Time-series gaps (for event tables)
with daily_counts as (
select date_trunc('day', <time_col>) as d, count(*) as cnt
from <table>
where <time_col> >= dateadd('day', -30, current_date)
group by 1
)
select d, cnt,
lag(cnt) over (order by d) as prev_cnt,
cnt * 1.0 / lag(cnt) over (order by d) as pct_change
from daily_counts
order by d;Warn if: any day's count is < 50% or > 200% of prior day's count.
Fail if: any day has 0 rows when prior days have data (pipeline failure).
Output format
# Data Quality Audit: <schema.table>
## TL;DR
**Status:** <PASS | WARN | FAIL>
<one-line summary of any issues>
## Checks
| Check | Result | Status | Notes |
|---|---|---|---|
| Row count | 4,872,109 | PASS | |
| Freshness | 2.1h since latest | PASS | SLA: 24h |
| PK uniqueness | 0 dupes on (user_id, event_date) | PASS | |
| Critical nulls | 0 nulls in user_id, event_at | PASS | |
| Schema | 14 cols, matches docs | PASS | |
| Value distributions | event_name top 3 = login (62%), view (28%), purchase (8%) | PASS | normal |
| Referential integrity | 0 orphan user_id vs dim_users | PASS | |
| Time-series gaps | No missing days; max daily delta +18% | PASS | |
## Issues found
<none, or:>
- **FAIL: 142 duplicate PK rows.** Pipeline likely double-loaded 2026-04-12. Investigate `dbt_upload_log` for that date.
- **WARN: 5.2% nulls in `device_type`.** Recent mobile SDK update may have changed event schema.
## Recommended actions
- <e.g., "Block analysis until dedup is fixed">
- <e.g., "Coerce null device_type to 'unknown' downstream">
## Caveats
- <e.g., "Last 24h of data has pipeline-lag and shouldn't be trusted for freshness check">Validation checks (meta — does the audit itself work)
- All seven checks ran without query errors
- Each check has an explicit pass/warn/fail status
- Status reasoning is reproducible (numbers + thresholds, not vibes)
Edge cases & failure modes
- Slowly-changing-dimension tables: PK may not be uniqueness check candidate. Audit on
(pk, valid_from)instead. - Append-only event tables: late-arriving events are normal; treat as "data delay" not "data missing" if within reasonable bounds.
- Sampled tables: row count will be low by design. Document the sample rate and adjust expectations.
- Test/internal data mixed in: include an
is_test = falsefilter in the audit if applicable. - Sparse columns: high null % may be expected (e.g.,
referrer_urlfor organic users). Warn but don't fail.
Scripts
scripts/audit_table.sql— Parameterized Snowflake audit scriptscripts/audit_table.py— Run audit against any pandas DataFrame
python scripts/audit_table.py --input data.csv --pk user_id,event_date --critical user_id,event_at --time-col event_atRelated skills
modular-sql-ctes— fix sources structurally rather than band-aid downstreammetric-definition— pin down expected values so the audit has thresholds- Any modeling skill — always audit inputs first
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
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.

