Data Quality Frameworks

Data Quality Frameworks

Teaches an agent to implement data quality validation using Great Expectations, dbt tests and data contracts, with checks, pipelines and monitoring.

Skill files2 files

references/

SKILL.md139 lines
1
---
2
name: data-quality-frameworks
3
description: Implement data quality validation with Great Expectations, dbt tests, and data contracts. Use when building data quality pipelines, implementing validation rules, or establishing data contracts.
4
---
5
6
# Data Quality Frameworks
7
8
Production patterns for implementing data quality with Great Expectations, dbt tests, and data contracts to ensure reliable data pipelines.
9
10
## When to Use This Skill
11
12
- Implementing data quality checks in pipelines
13
- Setting up Great Expectations validation
14
- Building comprehensive dbt test suites
15
- Establishing data contracts between teams
16
- Monitoring data quality metrics
17
- Automating data validation in CI/CD
18
19
## Core Concepts
20
21
### 1. Data Quality Dimensions
22
23
| Dimension | Description | Example Check |
24
| ---------------- | ------------------------ | -------------------------------------------------- |
25
| **Completeness** | No missing values | `expect_column_values_to_not_be_null` |
26
| **Uniqueness** | No duplicates | `expect_column_values_to_be_unique` |
27
| **Validity** | Values in expected range | `expect_column_values_to_be_in_set` |
28
| **Accuracy** | Data matches reality | Cross-reference validation |
29
| **Consistency** | No contradictions | `expect_column_pair_values_A_to_be_greater_than_B` |
30
| **Timeliness** | Data is recent | `expect_column_max_to_be_between` |
31
32
### 2. Testing Pyramid for Data
33
34
```
35
/\
36
/ \ Integration Tests (cross-table)
37
/────\
38
/ \ Unit Tests (single column)
39
/────────\
40
/ \ Schema Tests (structure)
41
/────────────\
42
```
43
44
## Quick Start
45
46
### Great Expectations Setup
47
48
```bash
49
# Install
50
pip install great_expectations
51
52
# Initialize project
53
great_expectations init
54
55
# Create datasource
56
great_expectations datasource new
57
```
58
59
```python
60
# great_expectations/checkpoints/daily_validation.yml
61
import great_expectations as gx
62
63
# Create context
64
context = gx.get_context()
65
66
# Create expectation suite
67
suite = context.add_expectation_suite("orders_suite")
68
69
# Add expectations
70
suite.add_expectation(
71
gx.expectations.ExpectColumnValuesToNotBeNull(column="order_id")
72
)
73
suite.add_expectation(
74
gx.expectations.ExpectColumnValuesToBeUnique(column="order_id")
75
)
76
77
# Validate
78
results = context.run_checkpoint(checkpoint_name="daily_orders")
79
```
80
81
## Detailed patterns and worked examples
82
83
Detailed pattern documentation lives in `references/details.md`. Read that file when the navigation tier above is insufficient.
84
85
## Summary: {total_passed}/{total_tables} tables passed")
86
report.append("")
87
88
for table, result in results.items():
89
status = "✅" if result.passed else "❌"
90
report.append(f"### {status} {table}")
91
report.append(f"- Expectations: {result.total_expectations}")
92
report.append(f"- Failed: {result.failed_expectations}")
93
94
if not result.passed:
95
report.append("- Failed checks:")
96
for detail in result.details:
97
if not detail["success"]:
98
report.append(f" - {detail['expectation']}: {detail['observed_value']}")
99
report.append("")
100
101
return "\n".join(report)
102
103
# Usage
104
context = gx.get_context()
105
pipeline = DataQualityPipeline(context)
106
107
tables_to_validate = {
108
"orders": "orders_suite",
109
"customers": "customers_suite",
110
"products": "products_suite",
111
}
112
113
results = pipeline.run_all(tables_to_validate)
114
report = pipeline.generate_report(results)
115
116
# Fail pipeline if any table failed
117
if not all(r.passed for r in results.values()):
118
print(report)
119
raise ValueError("Data quality checks failed!")
120
```
121
122
## Best Practices
123
124
### Do's
125
126
- **Test early** - Validate source data before transformations
127
- **Test incrementally** - Add tests as you find issues
128
- **Document expectations** - Clear descriptions for each test
129
- **Alert on failures** - Integrate with monitoring
130
- **Version contracts** - Track schema changes
131
132
### Don'ts
133
134
- **Don't test everything** - Focus on critical columns
135
- **Don't ignore warnings** - They often precede failures
136
- **Don't skip freshness** - Stale data is bad data
137
- **Don't hardcode thresholds** - Use dynamic baselines
138
- **Don't test in isolation** - Test relationships too
139

© Seth Hobson · MIT · source · posted by @OpenSourceBuffGuy on promptparty.com

@OpenSourceBuffGuy

I find openly licensed prompts and post them here.

0 followers · 6,373 prompts

More by @OpenSourceBuffGuy

See all
Website Clone Architect prompt image

Website Clone Architect

Reverse-engineers a website section by section, writes component specs, and hands them to parallel builder agents in git worktrees to rebuild it.

agent-skill, orchestrator, parallel-agents, multi-agent, plan-then-execute, web-development, frontend, codebase-analysis, scaffolding, css, html, nextjs, typescript, git, mcp, claude-code, for-developers, for-designers, long-form, advanced, technical-spec, task-decomposition, structured-output, design-systems, ui-ux, tool-use, checklist, report, vibe-coding

Italian Terrace Cafe Candid Portrait prompt image

Italian Terrace Cafe Candid Portrait

Generates a photorealistic candid shot of a woman in a white corset dress laughing at a sunny hotel terrace cafe, written as detailed JSON.

image-prompt, json-prompt, structured-output, photorealistic, portrait, woman, candid, fashion, cottagecore, natural-light, golden-hour, bokeh, summer, travel, cityscape, mountains, medium-shot, vibrant-colors, for-photographers, nano-banana, fashion-shoot, luxury

Night Street Photo With Leashed Cat prompt image

Night Street Photo With Leashed Cat

Generates a flash-lit night street photo of a blonde woman in a retro track jacket walking a hissing tabby cat on a leash.

image-prompt, json-prompt, nano-banana, structured-output, portrait, woman, animals, pet-portrait, night-scene, street-photography, candid, editorial, fashion, dramatic-lighting, photorealistic, vertical-format, medium-shot, graffiti, for-photographers, for-content-creators

1 view

Reviews

Loading reviews…

Discussion

Loading comments…