04-grain-validation

Installation
SKILL.md

Fact Table Grain Validation (Pre-Merge)

Overview

Gold layer merge scripts must produce DataFrames whose grain matches the DDL PRIMARY KEY. This skill provides runtime validation patterns to catch grain mismatches before MERGE execution, preventing costly errors and table rewrites.

Key Principle: DDL PRIMARY KEY reveals the grain. Merge script must match that grain.

Companion skill: For grain type selection during design, see design-workers/01-grain-definition/SKILL.md.

When to Use This Skill

  • Creating fact table merge scripts (Silver → Gold)
  • Validating that DataFrame grain matches DDL PRIMARY KEY before MERGE
  • Debugging DELTA_MERGE_UNRESOLVED_EXPRESSION or duplicate row errors
  • Adding pre-merge grain validation to existing merge scripts

Common Failure Pattern

Installs
1
GitHub Stars
2
First Seen
Mar 8, 2026
04-grain-validation — databricks-solutions/vibe-coding-workshop-template