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 qualityrules 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
- Open build-cli in your terminal.
- Copy the prompt above.
- Paste the business requirement exactly as written — do not paraphrase.
- Include the dataset name and column list if available; this helps the AI generate more specific implementation hints.
- 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.ymlformat 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 name | Description | Dimension | Implementation hint | Severity |
|---|---|---|---|---|
email_not_null | email_address must not be null or empty | Completeness | WHERE email_address IS NULL OR TRIM(email_address) = '' | Critical |
email_valid_format | email_address must match a valid email pattern | Validity | WHERE email_address NOT LIKE '%@%.%' (simplified; use REGEXP for full validation) | Major |
email_unique | No two customer records may share the same email_address | Uniqueness | dbt unique test on email_address | Critical |
country_code_not_null | country_code must not be null | Completeness | WHERE country_code IS NULL | Critical |
country_code_valid_iso | country_code must be a valid ISO 3166-1 alpha-2 code | Validity | accepted_values dbt test with full ISO list | Major |