data-quality-gate
БесплатноБез исполняемых скриптовНе проверенAdd or extend data validation checks in the pipeline when data quality issues are detected — null-percentage thresholds, value ranges, referential integrity…
от zakelfassi★ 18 звёзд на GitHubОб этом скилле
Data Quality Gate
Add or extend validation checks that block bad data from propagating through the pipeline.
Inputs
- Stage name where the gate should run (e.g.,
customer_events) - Check type:
null_rate|range|referential|row_count|custom - Column(s) affected
- Threshold or reference table (depending on check type)
- Severity:
warn(log and continue) orfail(halt the pipeline)
Steps
Identify where to add the gate Gates run after ingestion (raw → staging) or after a transform (staging → marts). Most gaps are caught earliest; prefer adding checks at the earliest stage where the data is available.
Write the check
Null-rate check:
def check_null_rate(df, column, threshold=0.05): rate = df[column].isnull().mean() if rate > threshold: raise DataQualityError( f"{column} null rate {rate:.1%} exceeds threshold {threshold:.1%}" )Range check:
def check_range(df, column, min_val, max_val): out_of_range = df[(df[column] < min_val) | (df[column] > max_val)] if len(out_of_range) > 0: raise DataQualityError( f"{column}: {len(out_of_range)} rows outside [{min_val}, {max_val}]" )Referential integrity check:
def check_referential(df, fk_column, reference_df, pk_column): orphans = df[~df[fk_column].isin(reference_df[pk_column])] if len(orphans) > 0: raise DataQualityError( f"{fk_column}: {len(orphans)} rows with no matching {pk_column}" )Row-count sanity check:
def check_row_count(df, min_rows, max_rows=None): n = len(df) if n < min_rows: raise DataQualityError(f"Only {n} rows; expected at least {min_rows}") if max_rows and n > max_rows: raise DataQualityError(f"{n} rows exceeds max {max_rows}")Register the check in the stage's test suite Add the check to
pipelines/ingestion/{stage_name}/tests/test_quality.pyor the dbt schema YAML:# dbt schema - name: {column} tests: - not_null - dbt_utils.accepted_range: min_value: {min} max_value: {max}Set the severity
warn: emit a metric + log; allow the pipeline to continue.fail: raiseDataQualityError; the scheduler marks the run as failed. Document the choice and rationale in the check's docstring.
Test the check Write a test that intentionally violates the threshold and confirms the exception is raised:
def test_null_rate_fails(): bad_df = pd.DataFrame({"col": [None] * 10}) with pytest.raises(DataQualityError): check_null_rate(bad_df, "col", threshold=0.05)Document in the data dictionary Add a "Quality checks" section to
docs/data-dictionary/{stage_name}.md:Check Column Threshold Severity null_rate {col} < 5% fail
Conventions
- All checks are functions in
pipelines/quality/checks.py; imported by stage test files DataQualityErroris defined inpipelines/quality/errors.py- Metrics emitted:
data_quality.{stage}.{check}.{column}(gauge, 0=pass, 1=fail) - Null-rate thresholds are per-column, not global
- Referential checks are
warnseverity by default unless the FK is critical for downstream joins
Edge Cases
- Threshold is too tight and causes false positives: Increase the threshold and document the change in git with a comment; don't just bump it silently.
- Data arrives in batches (some partitions are empty): Add a
min_rows_per_partitioncheck rather than a total row-count check. - Reference table is unavailable (API down): Wrap the referential check in a try/except; emit a
warn-level metric and continue rather than failing the pipeline. - Check runs too slowly on large datasets: Sample 10% of rows for range/null checks; document the sampling in the check's docstring.
Установить data-quality-gate в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл data-quality-gate?
Add or extend data validation checks in the pipeline when data quality issues are detected — null-percentage thresholds, value ranges, referential integrity, and row-count sanity checks. Use when a pipeline breaks on bad data, when onboarding a new dataset, or when asked to "add a quality check for {column}".
Как установить скилл data-quality-gate?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл data-quality-gate запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
от Anthropicdiscernment-nudge
After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
от Anthropicdata-consolidate
Joins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
от Anthropicinspection-to-capa
Runs the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…
от Anthropic