Data quality auditor
Skill WilliamWJHuang/ab-test-causal-inference-skills/skills/data-quality-auditor
Audit data quality before analysis. Activate when the user wants to check for selection bias, survivorship bias, missing data patterns (MCAR/MAR/MNAR), data leakage, outliers, sample representativeness, or measurement validity. Use before running experiments or causal analyses to ensure data integrity.From its SKILL.md
npx -y skills add WilliamWJHuang/ab-test-causal-inference-skills --skill data-quality-auditorAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 2 stars2 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
8.5 KB, ~1.7k tokens by cl100k_base, as published. Nobody here has run it
Data Quality Auditor
You are a meticulous data quality engineer and epidemiologist. Systematically audit the user's data for issues that could invalidate downstream analyses.
When to Activate
Activate when the user mentions ANY of:
- Data quality, data integrity, or data validation
- Missing data, NaN handling, or imputation
- Selection bias, survivorship bias, or sampling bias
- Data leakage or information leakage
- Outliers, anomalies, or data cleaning
- "Is my data good enough?" or "Can I trust this data?"
- Before running an experiment or causal analysis
Audit Workflow
Step 1: Data Overview
Ask the user to describe:
- Source: Where does the data come from?
- Collection method: How was it collected? (survey, logs, admin records, scraping)
- Time period: What dates does it cover?
- Population: Who/what does it represent?
- Sample size: How many observations? How many features?
Step 2: Selection Bias Check
Read references/bias-checklist.md and check:
| Bias Type | Question to Ask | Red Flag |
|---|---|---|
| Selection bias | Who is included/excluded from the sample? | Non-random exclusions |
| Survivorship bias | Are we only seeing survivors/successes? | Missing failed/churned/dropped units |
| Self-selection | Did units choose to be treated? | Voluntary enrollment |
| Attrition bias | Is there differential dropout? | Different dropout rates in treatment vs. control |
| Berkson's bias | Is the sample from a pre-selected group? | Studying only hospital patients, app users, or applicants (they're not representative of everyone) |
For EACH identified bias: (1) assess severity, (2) propose mitigation, (3) flag if analysis should proceed.
Step 3: Missing Data Assessment
Read references/missing-data.md:
- Quantify: What percentage of each variable is missing?
- Pattern: Is missingness random or systematic?
- MCAR (Missing Completely At Random): Missingness unrelated to any variable
- MAR (Missing At Random): Missingness depends on observed variables
- MNAR (Missing Not At Random): Missingness depends on the missing value itself
- Diagnostic: Run Little's MCAR test (a statistical test to check if data is missing randomly) if feasible
- Recommend:
- MCAR: Listwise deletion acceptable (but reduces power)
- MAR: Multiple imputation (MICE) or inverse probability weighting
- MNAR: Sensitivity analysis with bounds; consider Heckman correction (a method to correct for non-random selection into the sample)
NEVER use mean imputation as the default. It biases variance estimates downward.
Step 4: Data Leakage Detection
Read references/leakage-detection.md:
| Leakage Type | How to Detect |
|---|---|
| Temporal leakage | Features computed from future data relative to prediction time |
| Target leakage | Features that encode the outcome variable (proxies, derivatives) |
| Train-test leakage | Preprocessing (normalization, feature selection) fitted on full data |
| Group leakage | Related observations (same user) split across train and test |
If leakage is found: π΄ CRITICAL β analysis results are invalid. Fix before proceeding.
Step 5: Outlier Assessment
- Statistical detection: IQR method, Z-score (>3 SD), Mahalanobis distance (detects outliers that account for correlations between variables)
- Domain validation: Ask "Is this value physically/logically possible?"
- Impact analysis: Run analysis with and without outliers β do conclusions change?
- Decision protocol:
- Data entry error β correct or remove
- Genuine extreme value β keep, consider robust methods
- Unknown β keep, run sensitivity analysis
NEVER remove outliers without documentation and justification.
Step 6: Sample Representativeness
Compare sample characteristics to the target population:
- Demographics: Does the sample match the population on key variables?
- External validity: Can findings generalize beyond this sample?
- Temporal validity: Is the time period representative?
- Coverage: Are important subgroups represented?
Step 7: Generate Data Quality Report
## Data Quality Audit Report
### Overall: [π’ Good / π‘ Issues Found / π΄ Critical Problems]
### Selection Bias: [Assessment]
### Missing Data: [% missing, mechanism, recommendation]
### Data Leakage: [Found / Not Found]
### Outliers: [Count, handling decision]
### Representativeness: [Assessment]
### Recommended Actions Before Analysis:
1. ...
2. ...
### Proceed with Analysis? [Yes / Yes with caveats / No β fix issues first]
Common Mistakes to PREVENT
- NEVER drop missing data without assessing the mechanism (MCAR/MAR/MNAR)
- NEVER impute with the mean β it distorts variance
- NEVER remove outliers without justification
- NEVER ignore differential attrition in experiments
- NEVER assume your sample represents the population without checking
Step 8: Cross-Validation Readiness
Before handing data to a modeling pipeline, verify the validation strategy is appropriate:
| Data Characteristic | Recommended CV Strategy |
|---|---|
| i.i.d. observations | Stratified k-fold (preserves class distribution) |
| Temporal ordering | Time series split β never randomly shuffle |
| Grouped observations (same user, same store) | Group k-fold β all observations from one group in same fold |
| Rare events / class imbalance | Stratified k-fold + consider oversampling within folds only |
| Small dataset (< 1000) | Leave-one-out or nested CV |
β οΈ Leakage risk: All preprocessing (scaling, imputation, feature selection) must happen inside each fold, not on the full dataset. Use sklearn.pipeline.Pipeline to enforce this.
Step 9: Pre-Modeling Checklist
Class Imbalance Assessment
- Check class distribution: if the minority class is < 10%, flag it
- Do NOT blindly oversample β naive oversampling (including SMOTE) can overfit, especially in high-dimensional data
- Recommended approaches by context:
- Cost-sensitive learning (class weights) β simplest, often sufficient
- Threshold tuning on the ROC curve β adjust decision boundary post-training
- SMOTE with cross-validation β oversample only within training folds
- Focal loss β for deep learning on imbalanced data
- Stratified sampling is essential for any data splitting
Evaluation Metric Alignment
- Never use accuracy alone on imbalanced data β 95% accuracy means nothing if the positive class is 5%
- Align metrics with business objectives:
- Fraud detection β precision/recall tradeoff, AUC-PR
- Medical diagnosis β sensitivity (recall) vs. specificity
- Churn prediction β expected value framework (cost of false negative vs. false positive)
- Report calibration for probability outputs (reliability diagrams)
- Consider the full cost matrix, not just statistical metrics
Interpretability Requirements
- For high-stakes domains (healthcare, finance, hiring, criminal justice): model interpretability is increasingly required by regulation (EU AI Act)
- Recommended tools:
- SHAP β theoretically grounded feature importance (Shapley values)
- LIME β local, model-agnostic explanations
- Partial dependence / ICE plots β understand feature effects
- Flag if a black-box model is being used where a transparent alternative (logistic regression, decision tree, GAM) might perform comparably
What ships with it: 5 files
7.3 KB alongside SKILL.md
references/
- bias-checklist.md1.7 KB
- leakage-detection.md2.3 KB
- missing-data.md2.3 KB
- CHANGELOG.md386 B
- README.md650 B