agentleFS
hollandkevinthollandkevint/data-product-operator/skills/data-pipeline-quality/SKILL.md

data-pipeline-quality

Skill5 starsChanged 2 months agoMITView on GitHub

Automated data quality checks for pipelines. Testing pyramids, dbt test patterns, data contracts, circuit breakers, and monitoring. Use when implementing data quality checks, writing dbt tests, defining data contracts, setting up pipeline validation, building automated quality monitoring, or when someone asks "how do I test my data pipeline?" For quality scoring methodology (the 5-dimension rubric), see data-quality-assessment.

The file

We split this skill into the rules it gives an agent

2 rules. About 0 are common, 2 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Run tests in this order. Cheapest and fastest first:

    line 16
  2. Distinctive:

    Never auto-heal data quality issues in production.

    line 93

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “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

Testing Pyramid for Data

Run tests in this order. Cheapest and fastest first:

LayerWhat It CatchesExamples
Schema tests (run first)Structural failuresColumn types, not-null, uniqueness, accepted values
Business rule testsLogic errorsCross-field validation, referential integrity, range checks
Integration tests (run last)System-level driftCross-system reconciliation, end-to-end row counts

Schema tests are cheap. Run them on every pipeline execution. Business rule tests are mid-tier — run them on staging and production. Integration tests are expensive — run them on a schedule (daily or pre-release).

dbt Test Patterns

Generic tests for reusable checks. Apply across models:

models:
  - name: fct_encounters
    columns:
      - name: encounter_id
        tests: [not_null, unique]
      - name: encounter_type
        tests:
          - accepted_values:
              values: ['inpatient', 'outpatient', 'emergency', 'observation']
      - name: patient_id
        tests:
          - relationships:
              to: ref('dim_patient')
              field: patient_id

Custom generic test for row count tolerance:

{% test row_count_within_tolerance(model, min_count, max_count) %}
select count(*) as row_count
from {{ model }}
having count(*) < {{ min_count }} or count(*) > {{ max_count }}
{% endtest %}

Singular tests for business logic specific to one model. Use singular tests when the logic doesn't generalize.

Data Contracts

A data contract is a product spec for your data. It defines what consumers can depend on.

contract:
  name: fct_encounters
  version: 2
  owner: data-platform-team
  sla:
    freshness: "< 4 hours from source update"
    completeness: ">= 99.5% of expected rows"
    accuracy: ">= 99.9% match to source of record"
  schema:
    encounter_id: {type: bigint, nullable: false, unique: true}
    patient_id: {type: bigint, nullable: false}
    encounter_date: {type: date, nullable: false}

Producer responsibilities: Meet the SLA, notify consumers before breaking changes, version the schema.

Consumer expectations: Query only contracted fields, respect the grain, report quality issues.

Circuit Breakers

Wire quality gates into pipeline stages. When a check fails, block the pipeline and alert.

  • Schema violation: Block immediately. Bad schema corrupts everything downstream.
  • Row count outside tolerance: Block and alert. Investigate before proceeding.
  • Freshness SLA breach: Alert the on-call. Don't block unless downstream consumers can't tolerate stale data.
  • Business rule failure: Block if the failure rate exceeds threshold (e.g., >1% of rows). Alert if below.

Cross-reference data-quality-assessment for the 4-stage quality model (detect → assess → respond → prevent).

Never auto-heal data quality issues in production. Alert, block, investigate. Auto-fixes mask root causes and erode trust faster than stale data.

Monitoring

Track quality over time, not just point-in-time pass/fail:

  • Row count trends: Compare expected and observed counts within the same scope. Abrupt or gradual changes suggest checks; their shape does not establish source or pipeline root cause. Test competing explanations.
  • Freshness: Separate source-event time, arrival time and processing time against the consumer's requirement. A successful run can process stale or incomplete inputs. Track the relevant lag distribution and coverage.
  • Anomaly detection: Choose statistical or fixed thresholds for the risk, seasonality and available history. Confirm expected ranges with the owner; a statistical alert does not replace an acceptance rule.

Cross-References

For quality scoring methodology (the 5-dimension rubric and maturity model), see data-quality-assessment. This skill covers how to automate those checks in your pipeline.

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.