agentleFS
MicrosoftKnown publishermicrosoft/HRDIUtilities/DQ-CoWorker/.github/instructions/copilot-instructions.md

HRDIUtilities / instructions

Copilot instructions6 starsChanged 5 months agoMITView on GitHub

Add a comment at the end of every file you create or modify: Contains AI-generated edits. - Python files: # Contains AI-generated edits. - SQL files: -- Contains AI-generated edits. - Markdown / YAML / CSV: <!-- Contains AI-generated edits. --> - Notebooks (.ipynb): add a markdown cell at the end with > Contains AI-generated edits. This workspace implements the DQ-Coworker — an intelligent Data Quality framework for enterprise data platforms. All code, notebooks, and metadata produced here must align…

The file

Show its rules and text

We split this copilot-instructions.md into the rules it gives an agent

30 rules. About 0 are common, 16 are distinctive, and 14 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈16

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 14

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Add a comment at the end of every file you create or modify: Contains AI-generated edits.

    line 9
  2. Distinctive:

    When a user asks you to recommend, design, generate, review, or execute any Data Quality checks, always consult the DQSkillRecommender …

    line 24
  3. Distinctive:

    Never place Silver or Gold DQ logic in the Bronze layer, and never skip Bronze checks before promoting data to Silver.

    line 40
  4. Distinctive:

    When generating or modifying DQ metadata (CSV, Delta table, or dict):

    line 47
  5. Very specific:

    Every rule must have: RuleID, RuleName, DQDimension, RuleType, Entity, EntityType, WorkflowGroup, ObjectWeight, IsActive.

    line 49
  6. Very specific:

    Always populate AIConfidenceScore and AIRecommendationReason for any AI-generated rule.

    line 56
  7. Very specific:

    Use AllowedVariance = 0 as the default.

    line 58
  8. Very specific:

    Follow .github/python-coding.instructions.md (snake_case, PEP 8, type hints, docstrings).

    line 69
  9. Very specific:

    All DQ validation functions must be modular, parameterised, and return a standard result dict with keys: dimension, check, entity, …

    line 70
  10. Very specific:

    Use the function signatures from dq_functions.py as the canonical pattern.

    line 73
  11. Distinctive:

    Never hardcode connection strings, credentials, storage paths, or workspace IDs.

    line 78
  12. Distinctive:

    Use parameters or environment variables.

    line 79
  13. Distinctive:

    All custom SQL injected by users must be validated for syntax before execution.

    line 80
  14. Distinctive:

    Never execute untrusted raw SQL strings directly — parameterise or validate first.

    line 81
  15. Very specific:

    Use NULLIF to guard against division-by-zero in percentage calculations.

    line 86
  16. Very specific:

    Prefer COUNT(*) FILTER (WHERE ...) syntax for Spark SQL / Fabric SQL.

    line 87
  17. Very specific:

    Always alias computed columns clearly (e.g., AS null_pct, AS dup_count).

    line 88
  18. Very specific:

    Always include a results aggregation cell that computes an overall DQ Score as passed_checks / total_checks * 100.

    line 98
  19. Distinctive:

    Always include a final Markdown summary cell with pass/fail statistics.

    line 100
  20. Distinctive:

    When presenting DQ check recommendations to a user:

    line 106
  21. Distinctive:

    Use the structured recommendation format:

    line 109
  22. Very specific:

    If a check is rejected, ask for the rejection reason and record it in AIRejectionReason.

    line 120
  23. Distinctive:

    If a user modifies a threshold, confirm the change and update the metadata row before moving to the next check.

    line 122
  24. Distinctive:

    If a user provides custom SQL or Python logic, validate syntax and confirm acceptance before incorporating.

    line 124
  25. Distinctive:

    When analysing a column, apply these automatic rules before asking the user:

    line 132
  26. Distinctive:

    Do not generate code that bypasses row-level security, column masking, or workspace access controls.

    line 157
  27. Distinctive:

    When generating connection code, always use managed identity / service principal patterns — never username/password in code.

    line 159
  28. Very specific:

    Every P1 rule failure must trigger an alert.

    line 166
  29. Distinctive:

    Write DQ results to a persistent Delta table after each run for trending.

    line 167
  30. Very specific:

    Always emit a DQ score metric keyed as dq_score_<entity>_<layer>.

    line 169

≈ “Common” is an estimate: at least 1 in 5 of the 3,779 Copilot instructions files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
copilot-instructions.md

DQ-Coworker – GitHub Copilot Workspace Instructions

File Annotation

Add a comment at the end of every file you create or modify: Contains AI-generated edits.

  • Python files: # Contains AI-generated edits.
  • SQL files: -- Contains AI-generated edits.
  • Markdown / YAML / CSV: <!-- Contains AI-generated edits. -->
  • Notebooks (.ipynb): add a markdown cell at the end with > Contains AI-generated edits.

Project Purpose

This workspace implements the DQ-Coworker — an intelligent Data Quality framework for enterprise data platforms. All code, notebooks, and metadata produced here must align with the DQ-Coworker architecture documented in .github/prompts/DQSkillRecommender.prompts.md.prompt.md.

When a user asks you to recommend, design, generate, review, or execute any Data Quality checks, always consult the DQSkillRecommender prompt for dimension definitions, threshold guidance, metadata schema, and code patterns.


Architecture Context

This project operates across three data layers. Always respect layer boundaries:

LayerRoleDQ Focus
BronzeRaw ingestionAvailability, Completeness (keys), Validity (format), Uniqueness, Freshness, Timeliness
SilverCleansed / transformedAccuracy, Consistency, Referential Integrity, Conformity, full Completeness
GoldAnalytical / reportingAccuracy (reconciliation), Freshness (SLA), Distribution drift, Cross-system Consistency

Never place Silver or Gold DQ logic in the Bronze layer, and never skip Bronze checks before promoting data to Silver.


DQ Metadata Schema Rules

When generating or modifying DQ metadata (CSV, Delta table, or dict):

  1. Every rule must have: RuleID, RuleName, DQDimension, RuleType, Entity, EntityType, WorkflowGroup, ObjectWeight, IsActive.
  2. Auto-derive where possible: RuleLevel, DataType, IsNullable, IsPrimaryKey, IsForeignKey, LayerTarget, GeneratedBy, GeneratedTimestamp.
  3. Set FailedPipelineInd = Y only for P1 rules on primary keys, financial fields, or regulatory-tagged columns.
  4. Always populate AIConfidenceScore and AIRecommendationReason for any AI-generated rule.
  5. Use AllowedVariance = 0 as the default; only increase after explicit human approval.
  6. Valid ObjectWeight values: P1 (critical), P2 (required), P3 (optional).
  7. Valid WorkflowGroup values: Bronze, Silver, Gold, or a custom domain name.

Code Generation Standards

Python

  • Follow .github/python-coding.instructions.md (snake_case, PEP 8, type hints, docstrings).
  • All DQ validation functions must be modular, parameterised, and return a standard result dict with keys: dimension, check, entity, attribute, passed, details, evaluated_at.
  • Use the function signatures from dq_functions.py as the canonical pattern.
  • Functions must be platform-agnostic: support both Pandas DataFrames and PySpark DataFrames where feasible. Use isinstance(df, pd.DataFrame) guards.
  • Target compatibility: Microsoft Fabric, Azure Synapse, Databricks, and standalone PySpark.
  • Never hardcode connection strings, credentials, storage paths, or workspace IDs. Use parameters or environment variables.
  • All custom SQL injected by users must be validated for syntax before execution. Never execute untrusted raw SQL strings directly — parameterise or validate first.

SQL

  • Follow .github/general-coding.instructions.md.
  • Use NULLIF to guard against division-by-zero in percentage calculations.
  • Prefer COUNT(*) FILTER (WHERE ...) syntax for Spark SQL / Fabric SQL.
  • Always alias computed columns clearly (e.g., AS null_pct, AS dup_count).

Notebooks

  • Structure every generated DQ notebook using the 17-cell sequence defined in Section 7 of the DQSkillRecommender prompt.
  • Cell 1 must be a Markdown title cell with: entity name, WorkflowGroup, platform target, and generation timestamp.
  • Cell 2 must auto-detect the execution platform (Fabric / Databricks / Synapse / local) and set PLATFORM variable.
  • Always include a results aggregation cell that computes an overall DQ Score as passed_checks / total_checks * 100.
  • Always include a final Markdown summary cell with pass/fail statistics.

Human-in-the-Loop Rules

When presenting DQ check recommendations to a user:

  1. Present checks one entity at a time, grouped by DQ dimension.
  2. Use the structured recommendation format:
    Entity    : <name>
    Attribute : <col>     Dimension : <dimension>
    Rule      : <RuleName>
    Reason    : <why recommended>
    Threshold : <value>   Severity  : P1 / P2 / P3
    [APPROVE] [REJECT] [MODIFY THRESHOLD] [ADD CUSTOM LOGIC]
  3. Never generate the final metadata CSV or notebook without at least one explicit human approval.
  4. If a check is rejected, ask for the rejection reason and record it in AIRejectionReason.
  5. If a user modifies a threshold, confirm the change and update the metadata row before moving to the next check.
  6. If a user provides custom SQL or Python logic, validate syntax and confirm acceptance before incorporating.
  7. Summarise approved / rejected / modified counts before emitting output.

DQ Dimension Mapping Shortcuts

When analysing a column, apply these automatic rules before asking the user:

Column TraitRecommended Dimensions
Primary keyUniqueness, Completeness, Validity
Foreign keyIntegrity, Referential Integrity
NOT NULL constraintCompleteness
Timestamp / date columnTimeliness, Freshness
Numeric (amount, quantity)Accuracy (range), Validity
Low-cardinality categoricalValidity (allowed values)
Email / phone / postal patternValidity (regex)
PII / financial / regulatoryCompleteness, Validity, Accuracy (P1)
Date-range pair (start / end)Consistency (temporal)
High-cardinality identifierUniqueness

Security & Governance

  • Never log, display, or store raw PII values in DQ result outputs. Log counts and percentages only.
  • Tag all rules touching PII or regulated data with appropriate DataClassification and RegulatoryTag fields.
  • Validate all user-supplied regex patterns are safe (no ReDoS risk) before compiling.
  • Do not generate code that bypasses row-level security, column masking, or workspace access controls.
  • When generating connection code, always use managed identity / service principal patterns — never username/password in code.

Observability & Alerting

  • Every P1 rule failure must trigger an alert. Default AlertChannel = Teams.
  • Write DQ results to a persistent Delta table after each run for trending.
  • Enable TrendingEnabled = Y by default for all P1 and P2 rules.
  • Always emit a DQ score metric keyed as dq_score_<entity>_<layer>.

Output Formats

Requested OutputFormat
DQ metadataCSV with headers matching the metadata schema in DQSkillRecommender prompt
Validation libraryPython module dq_functions.py with functions per Section 5.1
DQ runnerPython module dq_runner.py with dispatch router per Section 5.2
Notebook.ipynb following the 17-cell structure in Section 7
Architecture diagramASCII art aligned with Section 8.1
DQ resultsJSON array of result dicts, one per rule executed
<!-- Contains AI-generated edits. -->

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.