xiaohongshu
xiaohongshu
data-quality-test-generator
Generate comprehensive dbt test suites following FF Analytics data quality standards and dbt 1.10+ syntax. This skill should be used when creating tests for new dbt models, adding tests to existing models, standardizing test coverage, or implementing data quality gates. Covers grain uniqueness, F...
Full skill instructions
Generate comprehensive dbt test suites for Fantasy Football Analytics models following Kimball patterns, implementation requirements, and dbt 1.10+ syntax.
Use this skill proactively when:
CRITICAL: FF Analytics uses dbt 1.10+ which requires the new syntax:
data_tests: not tests:arguments: blockconfig: for test configuration (severity, where clauses)✅ CORRECT (dbt 1.10+):
data_tests:
- accepted_values:
arguments:
values: ['value1', 'value2']
config:
severity: error
❌ INCORRECT (old syntax):
tests:
- accepted_values:
values: ['value1', 'value2']
severity: error
Staging models normalize raw provider data and require schema conformance tests.
Test Priorities:
Example Pattern:
version: 2
models:
- name: stg_nflverse__weekly
description: "NFLverse weekly player stats"
columns:
- name: player_id
description: "gsis_id from nflverse"
data_tests:
- not_null
- name: season
data_tests:
- not_null
- dbt_utils.expression_is_true:
arguments:
expression: ">= 2020" # Reasonable season bounds
- name: week
data_tests:
- not_null
- accepted_values:
arguments:
values: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18]
- name: position
data_tests:
- not_null
- accepted_values:
arguments:
values: ['QB', 'RB', 'WR', 'TE', 'K', 'DEF']
See: references/example_staging_tests.yml
Fact tables capture measurable events and require grain + FK + measure validation.
Test Priorities:
dbt_utils.unique_combination_of_columnsExample Pattern:
version: 2
models:
- name: fact_player_stats
description: "Player statistics fact table (grain: player + game + stat)"
# Grain uniqueness test
data_tests:
- dbt_utils.unique_combination_of_columns:
arguments:
combination_of_columns:
- player_id
- game_id
- stat_name
- measure_domain
- stat_kind
config:
severity: error
columns:
# Foreign key to dim_player
- name: player_id
description: "Foreign key to dim_player (mfl_id)"
data_tests:
- not_null
- relationships:
arguments:
to: ref('dim_player')
field: player_id
# Foreign key to dim_game
- name: game_id
description: "Foreign key to dim_game"
data_tests:
- not_null
- relationships:
arguments:
to: ref('dim_game')
field: game_id
# 2x2 model enum: measure_domain
- name: measure_domain
description: "Real-world vs fantasy scoring dimension"
data_tests:
- not_null
- accepted_values:
arguments:
values: ['real_world', 'fantasy']
# 2x2 model enum: stat_kind
- name: stat_kind
description: "Actuals vs projections dimension"
data_tests:
- not_null
- accepted_values:
arguments:
values: ['actual', 'projection']
# Measure validation
- name: stat_value
description: "Value of the statistical measure"
data_tests:
- not_null
See: references/example_fact_tests.yml
Dimensions provide descriptive context and require uniqueness + SCD validation.
Test Priorities:
valid_from <= valid_to (or valid_to IS NULL for current)Example Pattern:
version: 2
models:
- name: dim_player
description: "Player dimension with SCD Type 2 history"
columns:
# Surrogate key
- name: player_sk
description: "Surrogate key for SCD Type 2"
data_tests:
- unique
- not_null
# Natural key
- name: player_id
description: "Natural key (mfl_id canonical)"
data_tests:
- not_null
# SCD Type 2 validity
- name: valid_from
description: "Start of validity period"
data_tests:
- not_null
- name: valid_to
description: "End of validity period (NULL = current)"
# SCD Type 2 date logic test
- name: _scd_validation
description: "Ensure valid_from <= valid_to when valid_to is not null"
data_tests:
- dbt_utils.expression_is_true:
arguments:
expression: "valid_from <= COALESCE(valid_to, CURRENT_DATE + INTERVAL '100 years')"
# Categorical attributes
- name: position
description: "Player position"
data_tests:
- accepted_values:
arguments:
values: ['QB', 'RB', 'WR', 'TE', 'K', 'DEF']
- name: status
description: "Active/Inactive/Retired"
data_tests:
- accepted_values:
arguments:
values: ['active', 'inactive', 'retired', 'unknown']
See: references/example_dimension_tests.yml
Marts are analytics-ready views requiring business logic validation.
Test Priorities:
Example Pattern:
version: 2
models:
- name: mart_fantasy_actuals_weekly
description: "Weekly fantasy points by player (analytics-ready)"
data_tests:
# Minimum row count threshold
- dbt_utils.expression_is_true:
arguments:
expression: "(SELECT COUNT(*) FROM {{ ref('mart_fantasy_actuals_weekly') }}) > 10000"
config:
severity: warn
columns:
- name: player_name
data_tests:
- not_null
- name: fantasy_points
description: "Total fantasy points for the week"
data_tests:
- not_null
- dbt_utils.expression_is_true:
arguments:
expression: ">= 0" # Fantasy points can't be negative
- name: games_played
data_tests:
- accepted_values:
arguments:
values: [0, 1] # Weekly grain, max 1 game per week
Implement freshness monitoring for critical data sources.
Example Freshness Policies (always check latest documentation for the most up to date policies)
Example Pattern:
version: 2
sources:
- name: nflverse
description: "NFLverse data provider"
freshness:
warn_after: {count: 24, period: hour}
error_after: {count: 48, period: hour}
tables:
- name: weekly
description: "Weekly player statistics"
identifier: "dt=*/**" # Partitioned by date
# Freshness test on max snapshot_date
freshness:
warn_after: {count: 24, period: hour}
error_after: {count: 48, period: hour}
The following tests are required in general:
Tests are auto-named by dbt. For custom tests, use descriptive names:
- name: _custom_business_rule
description: "Validate that revenue >= cost for all transactions"
config:
severity: warn # Use for non-critical tests
Use where clauses to filter test scope:
data_tests:
- relationships:
arguments:
to: ref('dim_player')
field: player_id
config:
where: "player_id IS NOT NULL AND season >= 2020"
test_suite_template.yml - Base template with dbt 1.10+ syntax for common test patternsexample_fact_tests.yml - Complete fact table test suite (fact_player_projections)example_staging_tests.yml - Staging model test patternsexample_dimension_tests.yml - Dimension table test patterns with SCD Type 2 validationThe 2×2 stat model uses consistent enums across all facts:
# measure_domain: real_world vs fantasy
- name: measure_domain
data_tests:
- accepted_values:
arguments:
values: ['real_world', 'fantasy']
# stat_kind: actual vs projection
- name: stat_kind
data_tests:
- accepted_values:
arguments:
values: ['actual', 'projection']
# horizon: projection timeframe (only for stat_kind='projection')
- name: horizon
data_tests:
- accepted_values:
arguments:
values: ['weekly', 'full_season', 'rest_of_season']
config:
where: "stat_kind = 'projection'"
- name: game_date
data_tests:
- dbt_utils.expression_is_true:
arguments:
expression: ">= '2020-01-01'" # Reasonable lower bound
- dbt_utils.expression_is_true:
arguments:
expression: "<= CURRENT_DATE + INTERVAL '1 year'" # No future dates beyond 1 year
# Ensure weekly totals match season totals
- name: _season_total_consistency
data_tests:
- dbt_utils.expression_is_true:
arguments:
expression: |
(
SELECT SUM(weekly_points)
FROM {{ ref('mart_weekly_points') }}
WHERE season = 2024
) = (
SELECT season_total
FROM {{ ref('mart_season_totals') }}
WHERE season = 2024
)
xiaohongshu
technical spec
product ux expert
database patterns
Conduct multi-agent task orchestration and workflow coordination.
Initialize project with Conductor artifacts (product definition,
Expert in web animations, transitions, and motion design using Framer Motion and CSS
Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...
PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.
Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...
Display project status, active tracks, and next actions
Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.
Generate, edit, and beat-sync AI video with leading models in one workspace.
The world's fastest calendar for remote work
Transform Your Design with AI Designer by ImgCreator.ai
Revolutionizing Video Production with AI-Powered Creativity
Extend an image past the frame and let AI fill the new aspect ratio.
Discover your celebrity doppelgänger with StarByFace!
ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.
Opus.ai: Revolutionize Your Web Experience