Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
aperivue avatar

Clean Data

  • 44 installs
  • 236 repo stars
  • Updated August 3, 2026
  • aperivue/medsci-skills

Clean Data is a skill that profiles clinical datasets, flags data-quality issues, and generates cleaning code under researcher approval, without auto-cleaning.

About

Clean Data is an interactive profiling and flagging assistant for clinical CSV/Excel datasets that runs a three-stage workflow: profile the data, flag potential issues, then generate cleaning code. A researcher uses it to surface missing values, outliers, duplicates, type mismatches, structural zeros, and reverse-coded scale items with approval gates at each step. It generates code and reports but does not auto-clean data, since every decision requires confirmation.

  • Three-stage interactive workflow: profile, flag, then generate cleaning code
  • Flags missing values, outliers, duplicates, type mismatches, and reverse-coded scales
  • Never auto-cleans; every cleaning decision requires researcher confirmation

Clean Data by the numbers

  • 44 all-time installs (skills.sh)
  • Ranked #973 of 2,064 Data Science & ML skills by installs in the Skillselion catalog
  • Data as of Aug 5, 2026 (Skillselion catalog sync)
At a glance

clean-data capabilities & compatibility

Capabilities
data cleaning · data profiling · data quality check
Use cases
data analysis · research
From the docs

What clean-data says it does

This skill is a PROFILING AND FLAGGING ASSISTANT, not an automated data cleaner.
SKILL.md
Every cleaning decision must be confirmed by the researcher.
SKILL.md
npx skills add https://github.com/aperivue/medsci-skills --skill clean-data

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs44
repo stars236
Last updatedAugust 3, 2026
Repositoryaperivue/medsci-skills

What it does

Profile and flag data-quality issues in clinical CSV/Excel datasets and generate cleaning code under researcher approval gates.

Who is it for?

Profiling and flagging data-quality issues in clinical datasets before analysis

Skip if: Automated unattended data cleaning, which it explicitly refuses

When should I use this skill?

when a researcher wants to profile, check, or clean clinical CSV/Excel data quality

What you get

A profiling report, flagged data-quality issues, and confirmed cleaning code

  • profiling report
  • flagged issue list
  • cleaning code

By the numbers

  • 3-stage workflow with approval gates
  • flags 8 issue categories

Files

SKILL.mdMarkdownGitHub ↗

Data Profiling and Cleaning Skill

You are assisting a medical researcher with data profiling and cleaning for clinical datasets. This is a three-stage interactive workflow. You generate code and reports -- you do NOT auto-clean data. Every cleaning decision requires explicit researcher confirmation.

Philosophy

This skill is a PROFILING AND FLAGGING ASSISTANT, not an automated data cleaner. Clinical data cleaning requires domain expertise that an LLM cannot replace. Every cleaning decision must be confirmed by the researcher.

DATA PRIVACY WARNING

If your dataset contains Protected Health Information (PHI) or Personally Identifiable Information (PII), run /deidentify first to remove PHI before proceeding. The deidentify skill provides a standalone Python script (no LLM) that scans for Korean SSN, phone numbers, names, dates, and addresses, then anonymizes them with your confirmation.

If *_deidentified.* files exist in the working directory, use those instead of raw data.

Alternatively: 1. Provide only the data dictionary / codebook for profiling guidance 2. Or use a local-only environment with no network access

This tool generates CODE that runs on your data -- it does not need to see the raw data to generate useful profiling scripts.

Reference Files

  • Profiling template: ${CLAUDE_SKILL_DIR}/references/profiling_template.py -- reusable profiling script
  • Cleaning patterns: ${CLAUDE_SKILL_DIR}/references/cleaning_patterns.md -- common clinical data patterns

Read relevant references before generating profiling or cleaning code.

Three-Stage Workflow

Stage 1: Profiling

Input: CSV/Excel file path OR data dictionary/codebook

Actions:

1. Generate a Python profiling script (pandas-based) that produces:

  • Variable count, row count, data types
  • Missing value count and percentage per variable
  • Unique value counts for categorical variables
  • Min/max/mean/median/SD for numeric variables
  • Distribution plots (histograms for numeric, bar charts for categorical)

2. If user provides a codebook: cross-reference variable names, expected types, expected ranges 3. Present summary table to user

Use ${CLAUDE_SKILL_DIR}/references/profiling_template.py as the base script. Adapt it to the specific dataset structure.

Gate: User reviews profiling output before proceeding. Ask:

"Here is the profiling summary. Would you like to proceed to Stage 2 (Flagging)?
Are there any variables you want to exclude or focus on?"

Stage 2: Flagging

Based on profiling results, flag potential issues in these categories:

1. Missing values: Variables with >5% missing, pattern analysis (MCAR/MAR/MNAR heuristic) 2. Statistical outliers: IQR method (Q1 - 1.5IQR, Q3 + 1.5IQR) and Z-score (|z| > 3) 3. Duplicates: Exact row duplicates AND near-duplicates (same patient ID, different dates) 4. Type mismatches: Numeric stored as string, dates in inconsistent formats 5. Implausible values: ONLY if codebook provides valid ranges; otherwise flag as "review needed" 6. Category inconsistencies: Typos in categorical values (e.g., "Male", "male", "M", "MALE") 7. Categorical-implied zeros: When a categorical variable defines a natural zero for a dose/duration variable (smoking_status == 'never' implies pack_years == 0, alcohol_use == 'never' implies grams_per_week == 0), flag any record where the implied zero is stored as NULL/missing instead of 0. This is a contradiction, not a missing-data pattern: a never-smoker with pack_years = NULL will be silently dropped by complete-case models or, worse, imputed to a non-zero dose by MICE — corrupting the exposure contrast. Suggested action: "Set dose = 0 where category == reference level; impute only the residual missingness among the exposed." Detected by scripts/check_structural_zero.py given the category↔dose mapping; pairs with /analyze-stats "Covariate Pitfalls: Structural Zeros & Dose/Duration Variables".

8. Reverse-coded scale items: When a multi-item Likert scale (Trust, Satisfaction, Burden, etc.) mixes positively- and negatively-worded items, every negatively-worded ("reverse") item must be recoded (min+max) - x before the scale total or Cronbach's alpha is computed. A reverse item left un-recoded correlates negatively with the rest of the scale and collapses alpha — often turning it negative. A negative alpha is almost never a real measurement phenomenon; it is a reverse-coding bug, and defending it as "multidimensional structure" loses a review round. Suggested action: "Recode reverse-worded items, then recompute reliability." Detected by scripts/check_reverse_coding.py (flags items with a negative item-rest correlation and a negative raw alpha, given the scale item columns); the recode itself is applied downstream by /analyze-stats likert_summary.py --reverse-items. Pairs with the global rule survey-scale-reliability.md.

Present the flag report as a structured table:

VariableIssue TypeCountSeveritySuggested Action
ageOutlier (IQR)3MediumReview: values 150, 200, -5
sexCategory inconsistency12LowHarmonize: Male/male/M -> "Male"
lab_dateType mismatch45HighParse to datetime
pack_yearsCategorical-implied zero12421HighSet 0 where smoking_status=='never' (structural zero, not missing)
trust_E3Reverse-coded item (raw α=-0.57)n/aHighRecode (6 - x) before reliability; negative α is a coding bug

Severity levels:

  • High: Likely data errors that will affect analysis (type mismatches, impossible values)
  • Medium: Potential issues that need expert review (statistical outliers, moderate missingness)
  • Low: Minor inconsistencies that are easy to fix (category labels, trailing whitespace)

Gate: User reviews flags and approves/rejects each suggested action. Ask:

"Please review the flagged issues above. For each row, indicate:
(A) Approve the suggested action, (R) Reject / keep as-is, or (M) Modify the action.
Only approved actions will generate cleaning code."

Stage 3: Code Generation

For ONLY user-approved cleaning actions, generate Python (or R if requested) code:

  • Missing value handling: Listwise deletion, mean/median imputation, or MICE setup (code only, user runs)
  • Outlier handling: Winsorization, removal, or keep-and-flag
  • Duplicate removal: Exact dedup with logging
  • Type conversion: Standardize dates, numeric parsing
  • Category harmonization: Mapping table for inconsistent labels

All generated code MUST include:

  • Before/after row counts printed to console
  • Logging of every modification to a cleaning log DataFrame
  • Reproducibility: np.random.seed(42) and random.seed(42) where applicable
  • Output: cleaned CSV + cleaning_log.csv
  • Clear comments explaining each cleaning step

End the generated script with this notice:

"This code implements ONLY the cleaning rules you approved. Review the cleaning_log.csv
output to verify all changes before proceeding to analysis."

Scope Limitations

Supported:

  • Missing values (detection, simple imputation code, MICE setup)
  • Outliers (statistical detection via IQR and Z-score)
  • Duplicates (exact and near-duplicate detection)
  • Type mismatches (numeric parsing, date standardization)
  • Category harmonization (case, abbreviation, whitespace)

NOT supported:

  • Domain-specific plausible ranges (unless codebook provided)
  • Complex imputation strategy selection (MICE setup only, user picks variables/method)
  • Natural language extraction from clinical notes
  • Image data cleaning or DICOM metadata
  • Automated decisions -- all cleaning requires researcher approval
This tool flags issues. Final cleaning decisions require your domain knowledge.

Cross-Skill Integration

  • clean-data sits BEFORE analyze-stats in the research pipeline
  • design-study can inform which variables to focus profiling on
  • manage-project tracks overall project state including data cleaning status
  • After cleaning, hand off to analyze-stats for statistical analysis

Output Format

Structure all reports using this template:

## Data Profiling Report

### Dataset Overview
- Rows: [N]
- Columns: [N]
- File size: [size]
- Date range: [if applicable]

### Variable Summary
| Variable | Type | Missing N (%) | Unique | Min | Max | Mean | SD |
|----------|------|---------------|--------|-----|-----|------|-----|
| ...      | ...  | ...           | ...    | ... | ... | ...  | ... |

### Flags
| Variable | Issue | Count | Severity | Suggested Action |
|----------|-------|-------|----------|-----------------|
| ...      | ...   | ...   | ...      | ...             |

### Cleaning Code
[Python/R script -- only for approved actions]

### Cleaning Log
[What was changed, how many rows affected, before/after counts]

Anti-Hallucination

  • Never fabricate variable names, dataset column names, or variable codings. If a variable mapping is uncertain, output [VERIFY: variable_name] and ask the user to confirm against the data dictionary.
  • Never fabricate statistical results — no invented p-values, effect sizes, confidence intervals, or sample sizes. All numbers must come from executed code output.
  • Never generate references from memory. Use /search-lit for all citations.
  • If a function, package, or API does not exist or you are unsure, say so explicitly rather than guessing.

Related skills

FAQ

Does clean-data automatically clean my data?

No, it is a profiling and flagging assistant; every cleaning decision requires explicit researcher confirmation.

What are the three stages?

Stage 1 profiling, Stage 2 flagging issues, and Stage 3 generating cleaning code, each behind a user approval gate.

Data Science & MLpipelinesetlanalytics

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.