authoring-data-quality-checks
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…
Skill by PostHogOfficial
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/posthog-authoring-data-quality-checks-26333c
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: backend, testing, data
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions: not checked yet.
What's inside
- Skill name
authoring-data-quality-checks- Description
- 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-catalog instead. Trigger terms: data quality, data test, dbt test, not null check, uniqueness check, freshness check, referential integrity, row count check, validate model, is this table trustworthy.
- License
- MIT
- Instructions
- 181 lines in SKILL.md · view on GitHub
Files (1)
- SKILL.md
SKILL.md (first lines)
# 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.
```sql
-- 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_null` on the columns downstream joins and filters depend on.** The single highest-value
check. A null join key silently drops rows.
- **`unique` on whatever the model claims is its grain.** If `orders` is one row per order, say so.
- **`relationships` on foreign keys.** Catches the join that quietly stopped matching after an
upstream change.
- **`accepted_values` on status and category columns** whose downstream logic branches on them.
- **`freshness` on the timestamp column of anything that syncs.** Catches a dead pipeline, which no
row-level check will.
- **`row_count` bounds** when you know the plausible range. Good for catching a truncated sync.
- **`custom_sql`** only 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 target window
makes rows fail for being old rather than for being wrong.
`custom_sql` takes no `lookback_hours`. Put the time filter in the query yourself, or it reads the
whole table.
Nothing triggers these tables the way a sync triggers a source table, so their checks run on a
schedule, daily by default. Change it with `posthog:data-quality-check-schedule`.
## Checks on catalog metrics
Only metrics with a saved `HogQLQuery` definition support checks. Markdown, Trends, Funnels, event
series, and metrics without definitions do not. A metric can return any number of rows and columns.
Create a `custom_sql` check with an empty `column_name`. Include `{metric}` exactly once as a relation:
```sql
SELECT *
FROM {metric}
WHERE orders < 100
```
The check queries the owning metric's current saved output. The example assumes that output has an
`orders` column. Every returned row is a failure; zero rows passes. Query `{metric}` directly or
through a subquery. Metric check SQL cannot define CTEs, including nested CTEs and scalar `WITH`
bindings. CTEs and saved parameters inside the metric definition remain supported. Other placeholders
are not accepted in the check.
Use the metric's Tests tab, or `posthog:data-quality-check-create` with `subject_type: "metric"`.
The catalog addresses a metric by name, but a check names it by UUID. Pass `subject_type=metric` to
`posthog:data-quality-check-types` and it offers only Custom SQL.
Saving validates SQL composition without executing it. Run the check to verify column names and
results. Every run reloads the saved metric: if an edit removes a column used by the check, the next
run errors. Fix the check SQL or restore the expected metric output.
## Severity and triggers
**Severity** is a decision about consequences, not about confidence. Use `error` when the failure
means downstream numbers should not be trusted — those failures mark the subject `failing` and
notify. Use `warn` for things worth surfacing that nobody would act on today. When unsure, `warn` isFrom PostHog/skills, MIT.
Signals
- Stars
- 75
- Forks
- 8
- Open issues
- 2
- Last commit (this folder)
- Oct 6, 2026 (23 days ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- Repository
- github.com/PostHog/skills
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
Same skill elsewhere
Copies of this SKILL.md published by others; search shows only one of them.
- 0.678score
authoring-data-quality-checks
PostHogOfficial
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…
SkillAFreshness: A★ 95Claude Code +9 - 0.336score
authoring-data-quality-checks
anny-co
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…
SkillAFreshness: AClaude Code +9
More from PostHog
- 0.759score
PostHog MCP Server
PostHogOfficial
Official PostHog MCP Server for product analytics, feature flags, experiments, and more.
ConnectorAFreshness: ARemote★ 40.4KClaude Code +3 - 0.754score
code-reviewer
PostHog
Subagent "code-reviewer" from PostHog/posthog: Use this agent when you need expert code review of recently written or modified code.
TemplateAFreshness: A★ 40.4KClaude Code - 0.683score
authoring-log-alerts
PostHogOfficial
Author useful, low-noise log alerts on services in a PostHog project.
SkillAFreshness: A★ 95Claude Code +9 - 0.683score
auditing-experiments-flags
PostHogOfficial
Audit PostHog experiments and feature flags for configuration issues, staleness, and best-practice violations.
SkillAFreshness: A★ 95Claude Code +9 - 0.683score
analyzing-offline-evaluations
PostHogOfficial
Inspect and compare offline AI evaluation experiments, diagnose case-level regressions, and follow scorer history across application, model, or prompt changes.
SkillAFreshness: A★ 95Claude Code +9 - 0.683score
authoring-error-tracking-alerts
PostHogOfficial
Author error tracking alerts that fire when an issue is created, reopened, or starts spiking.
SkillAFreshness: A★ 95Claude Code +9
Cite this page
authoring-data-quality-checks skill. Agent Mart. https://agentmart.dev/skills/posthog-authoring-data-quality-checks-26333c (last updated 2026-10-24)