Skip to content

Skill: Generate DQ Rules

Skill: Generate DQ Rules

Context

This is a Claude Code slash-command skill (.claude/commands/dq-rules.md) that generates a structured set of data quality rules from a business requirement or data description. Install it in your project and invoke it with /dq-rules [requirement text] to get a rule set ready for your data contract or dbt schema.yml.

Unlike the interactive DQ Rules from Business Requirements prompt, this skill is designed for repeated use inside a build-cli session — you invoke it with one command and get structured output directly in your workflow.

The Prompt

Generate a set of data quality rules from the following business requirement or data description.
For each rule provide:
- **Rule name** (snake_case, short)
- **Description** (plain language — what it checks)
- **DQ dimension** (Completeness / Uniqueness / Validity / Consistency / Timeliness / Accuracy)
- **Implementation hint** (SQL WHERE clause, dbt test type, or Great Expectations check name)
- **Severity** (Critical / Major / Minor)
Group rules by dimension. Flag any requirements that are ambiguous and need clarification before a rule can be written.
$ARGUMENTS

How to Install as a Claude Code Slash-Command

  1. Copy the prompt text above (the content between the triple backticks, including $ARGUMENTS).
  2. Create the file .claude/commands/dq-rules.md in your project root (or ~/.claude/commands/dq-rules.md for global use).
  3. Paste the prompt text as the entire file content.
  4. The $ARGUMENTS token is replaced by Claude Code with whatever text you type after the slash-command.

Usage Instructions

Once installed, invoke the skill in a build-cli session:

/dq-rules All customer records must have a non-null email address in valid email format. No two customers may share the same email address. Country code must be a valid ISO 3166-1 alpha-2 value.

Claude Code will generate a grouped rule set with rule name, description, DQ dimension, implementation hint, and severity for each rule. Ambiguous requirements are flagged for clarification before rules are written.

Output tip: Ask for the output in schema.yml format if you want directly usable dbt test YAML.