authoring-data-quality-checks
Fungsinya
Skill ini menambahkan tes otomatis ke tabel dan view data Anda, seperti memeriksa bahwa sebuah kolom tidak pernah kosong. Ditujukan untuk orang yang ingin menangkap data buruk sebelum sampai ke laporan.
Kapan dipakai
- βSaat Anda ingin memeriksa tabel atau view dari nilai kosong, duplikat, atau referensi yang hilang.
- βSaat Anda perlu memastikan bahwa sebuah tabel disegarkan dalam batas waktu tertentu.
- βSaat Anda ingin menambahkan pemeriksaan kustom yang ditulis dalam HogQL untuk sebuah aturan bisnis.
Link skill
https://github.com/PostHog/posthog/blob/master/products/data_quality/skills/authoring-data-quality-checks/SKILL.mdSalin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.
Cara pakai
Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.
Pesan siap tempel
Untuk Claude Code, Codex, atau Cursor: jalankan di folder proyek, lalu skill langsung terpasang.
Unduh SKILL.md lalu taruh di folder skill agen Anda.
Contoh permintaan ke AI
βTolong tambahkan pemeriksaan untuk memastikan tidak ada pesanan di tabel pesanan saya yang ID pelanggannya kosong.β
5 skill baru setiap minggu. 1 menit baca.
Cara kerjanya
Setiap pemeriksaan adalah asersi kecil yang menghitung baris yang gagal. Pemeriksaan dianggap lulus jika tidak menemukan baris gagal, mirip dengan tes dbt, dan hanya jumlah serta kueri yang disimpan.
Konten teknis (SKILL.md asli)
Teks asli dari pembuat, dalam bahasa Inggris, langsung dari GitHub.
Authoring data quality checks
A check is one assertion about one warehouse table, view, or HogQL catalog metric. It compiles to a
count-only HogQL query and passes when it finds zero failing rows, like dbt test. Failing rows are
never stored; only counts and the compiled query are, so to see the offending rows you re-run the
stored query yourself.
row_count is the exception. It passes when the observed count is within its configured min/max
bounds, so its failed_row_count comes back null and its stored query returns that single count,
not offending rows. Read the observed count to judge it rather than looking for matched rows.
Reads go through SQL (system.information_schema.data_quality_*); writes and runs go through the
data-quality MCP tools.
Before you write anything: look
Two queries save you from the two most common mistakes β duplicating a check, and checking a column that doesn't exist.
-- What is already covered?
SELECT name, subject_name, column_name, check_type, config, severity, last_status
FROM system.information_schema.data_quality_checks
WHERE subject_name = 'orders'
-- What columns are there, and what do they mean?
SELECT column_name, data_type, description
FROM system.information_schema.columns
WHERE table_name = 'orders'
Re-creating a byte-identical check is a harmless no-op β checks are keyed by a fingerprint of the subject, type, column, and config, so an identical create upserts. A near-duplicate is not harmless: it doubles the noise for whoever reads the results. If an existing check's assertion is close but wrong, edit the existing check. Updates preserve its identity and history; the subject stays fixed by the URL. An edit that duplicates another check's assertion is rejected.
Choosing checks
Aim for a handful that would actually catch a real regression, not blanket coverage. A model with twenty checks nobody reads is worse than three that fail meaningfully.
Reach for these first, in roughly this order:
not_nullon the columns downstream joins and filters depend on. The single highest-value check. A null join key silently drops rows.uniqueon whatever the model claims is its grain. Ifordersis one row per order, say so.relationshipson foreign keys. Catches the join that quietly stopped matching after an upstream change.accepted_valueson status and category columns whose downstream logic branches on them.freshnesson the timestamp column of anything that syncs. Catches a dead pipeline, which no row-level check will.row_countbounds when you know the plausible range. Good for catching a truncated sync.custom_sqlonly when nothing above expresses the invariant β e.g. cross-column arithmetic (select 1 from orders where total != subtotal + tax). Every row it returns counts as a failure.
Call posthog:data-quality-check-types for each type's exact config schema rather than guessing.
One tool set covers every kind of subject. Call posthog:data-quality-subjects for the tables,
views and metrics you can read, then pass the subject_type and id it gives you as
subject_type and subject_uuid in posthog:data-quality-check-create. Only a subject marked
editable can carry a check; the others can still be the target of a relationships check. After that a check is
addressed by its own id: -update, -delete, -run and -results take no subject.
Checks on PostHog tables
events, persons and groups take checks like any other subject: pass
subject_type: "posthog_table" with the id posthog:data-quality-subjects gives you. Every check
type works on them, and relationships can point at one as its target too.
These tables are large, so consider lookback_hours before you author a check on one. It bounds
the rows the check reads by the table's own time column: timestamp on events, and created_at
on persons and groups, which is when each was first seen rather than when it last changed.
Without it the check reads the whole table, which is allowed and sometimes what you want -- an
unbounded unique on events.uuid says something a windowed one cannot. A check that runs out of
ClickHouse's execution budget reports errored with the message; adding a window is usually the fix.
On a relationships check, lookback_hours bounds the rows it checks and to_lookback_hours
bounds the rows it looks for a match among. Set the second one carefully: a narrow t
Pertanyaan umum
Apakah baris yang buruk disimpan di suatu tempat?
Tidak. Hanya jumlah dan kueri yang telah dikompilasi yang disimpan, sehingga Anda perlu menjalankan kueri sendiri untuk melihat baris bermasalah.
Apakah akan membuat pemeriksaan duplikat?
Skill memeriksa pemeriksaan yang sudah ada terlebih dahulu, dan membuat ulang pemeriksaan yang identik tidak berbahaya.
Apa yang dilakukan pemeriksaan jumlah baris?
Pemeriksaan lulus jika jumlah baris berada dalam batas minimum dan maksimum yang Anda tetapkan.
Detail
Deskripsi asli dari pembuat
Adds and runs data quality checks (dbt-test style assertions) on a project's warehouse tables and saved-query views, and HogQL catalog metrics: not-null, uniqueness, accepted values, referential integrity, row-count bounds, freshness, and custom HogQL. Metrics support custom SQL checks only. Use when asked to test a model, validate a view, check for nulls or duplicates, add data quality checks, find out why a number looks wrong, or judge whether a warehouse table is trustworthy before using it in an analysis. To describe what data *means* (metrics, certifications, joins), see setting-up-data-c
repo: PostHog/posthog
Popularitas
- Bintang GitHub
- 41k
- Peringkat
- #6854
- Lisensi
- β
- Diperbarui
- 2/11/2026
Komentar
- β¦
Skill lain dari repositori ini
depot-ci
41kMembantu agent Anda menyiapkan dan menjalankan alur kerja Depot CI, alternatif GitHub Actions, termasuk memigrasikan alur kerja yang ada dan membaca log eksekusi.
depot-container-builds
41kMembantu agent Anda membangun image Docker di builder jarak jauh Depot, termasuk image multi-platform, pengiriman ke registry, dan perbaikan kegagalan build.
depot-github-runners
41kMembantu agent Anda memindahkan job GitHub Actions ke runner yang dikelola Depot, memilih ukuran dan label runner, serta memecahkan masalah pengaturan runner.
editing-agents-md
41kMembantu agent Anda memutuskan apakah sebuah aturan layak masuk ke berkas AGENTS.md atau CLAUDE.md, dan menulisnya agar tetap dipatuhi tanpa membuat berkas membengkak.
Skill serupa
discrawl
394kMemungkinkan agent Anda mencari dan merangkum arsip pesan Discord lokal yang tersimpan, memeriksa seberapa baru arsipnya, dan membaca pesan langsung.
clickhouse-io
280kMembantu agent Anda mengoptimalkan query dan skema di database ClickHouse dengan praktik terbaik analitik berperforma tinggi. Gunakan saat query analitik terlalu lambat.
scientific-db-pubmed-database
280kMembantu agent Anda mencari artikel ilmiah di bidang biomedis. Berguna untuk riset yang membutuhkan informasi medis spesifik.