Skip to content

DQ Rules from Business Requirements

DQ Rules from Business Requirements

Context

Business requirements describe what data should look like from a business perspective, but they rarely specify the testable data quality rules that enforce those requirements in a pipeline or data contract. This prompt takes a written business requirement and generates a structured set of DQ rules ready for implementation — covering all relevant DQ dimensions (Completeness, Uniqueness, Validity, Consistency, Timeliness, Accuracy) and including a concrete implementation hint for each rule.

If the requirement is vague, the AI will ask clarifying questions — answer them before generating the rule set. Review the severity assignments: the AI defaults to conservative severity; adjust based on your domain knowledge.

The Prompt

I have a business requirement for a dataset. Please generate a comprehensive set of data quality
rules from it.
For each rule, provide:
- Rule name (short, snake_case)
- Description (plain language — what it checks)
- Dimension (Completeness / Uniqueness / Validity / Consistency / Timeliness / Accuracy)
- Implementation hint (SQL WHERE clause, dbt test, or Great Expectations check)
- Severity (Critical / Major / Minor)
Business requirement:
[PASTE REQUIREMENT HERE]
Dataset/table name: [TABLE NAME]
Known columns: [LIST COLUMN NAMES AND TYPES IF AVAILABLE]

Usage Instructions

  1. Open build-cli in your terminal.
  2. Copy the prompt above.
  3. Paste the business requirement exactly as written — do not paraphrase.
  4. Include the dataset name and column list if available; this helps the AI generate more specific implementation hints.
  5. Review the generated rules:
    • Add them to your data contract or dbt schema.yml — do not leave them only in the chat.
    • For dbt projects: ask for the output in schema.yml format to get directly usable YAML.
    • Adjust severity based on your domain knowledge — the AI defaults to conservative severity.

Example Output

For the requirement: “All customer records must have a valid email address and a non-null country code. No two customers may share the same email address.”

The AI will produce rules such as:

Rule nameDescriptionDimensionImplementation hintSeverity
email_not_nullemail_address must not be null or emptyCompletenessWHERE email_address IS NULL OR TRIM(email_address) = ''Critical
email_valid_formatemail_address must match a valid email patternValidityWHERE email_address NOT LIKE '%@%.%' (simplified; use REGEXP for full validation)Major
email_uniqueNo two customer records may share the same email_addressUniquenessdbt unique test on email_addressCritical
country_code_not_nullcountry_code must not be nullCompletenessWHERE country_code IS NULLCritical
country_code_valid_isocountry_code must be a valid ISO 3166-1 alpha-2 codeValidityaccepted_values dbt test with full ISO listMajor