Source profileQuality 90/100

Aperivue/medsci-skills/skills/clean-data/SKILL.md

clean-data

Interactive data profiling and cleaning assistant for medical research. Three-stage workflow (profile, flag, code-generate) with user approval gates at each step. Handles missing values, outliers, duplicates, and type mismatches in CSV/Excel clinical data. Does NOT auto-clean — all decisions require researcher confirmation.

Source repository stars
237
Declared platforms
0
Static risk flags
0
Last source update
2026-08-05
Source checked
2026-08-06

Decision brief

What it does—and where it fits

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.

Best for

    Not for

    • Missing values (detection, simple imputation code, MICE setup)
    • Outliers (statistical detection via IQR and Z-score)

    Compatibility matrix

    Platform support, with evidence labels

    PlatformStatusEvidenceWhat to check
    CodexNot declaredNo explicit evidencePortability before use
    Claude CodeNot declaredNo explicit evidencePortability before use
    CursorNot declaredNo explicit evidencePortability before use
    Gemini CLINot declaredNo explicit evidencePortability before use
    Open the compatibility checker

    Installation

    Inspect first. Install second.

    The source command is displayed only when detected. A safe inspection prompt is always available so your agent can explain every action before execution.

    Source-detected install commandSource
    npx skills add https://github.com/Aperivue/medsci-skills --skill "skills/clean-data"
    Safe inspection promptEditorial

    Inspect the Agent Skill "clean-data" from https://github.com/Aperivue/medsci-skills/blob/8b39515657a0e0a575d91b1b00b6f3df4f7bb90f/skills/clean-data/SKILL.md at commit 8b39515657a0e0a575d91b1b00b6f3df4f7bb90f. List every install step, command, network request, credential, file read/write, external action, and rollback step. Explain whether it fits my task. Do not install or execute anything until I approve.

    Workflow

    What the source asks the agent to do

    1. 01

      Three-Stage Workflow

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

      Generate a Python profiling script (pandas-based) that produces:Variable count, row count, data typesMissing value count and percentage per variable
    2. 02

      Stage 1: Profiling

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

      Generate a Python profiling script (pandas-based) that produces:Variable count, row count, data typesMissing value count and percentage per variable
    3. 03

      Stage 2: Flagging

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

      Missing values: Variables with 5% missing, pattern analysis (MCAR/MAR/MNAR heuristic)Statistical outliers: IQR method (Q1 - 1.5IQR, Q3 + 1.5IQR) and Z-score (|z| 3)Duplicates: Exact row duplicates AND near-duplicates (same patient ID, different dates)
    4. 04

      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-flagDuplicate removal: Exact dedup with logging
    5. 05

      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.

      Provide only the data dictionary / codebook for profiling guidanceOr use a local-only environment with no network accessThis 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.

    Permission review

    Static risk signals and limitations

    No configured static risk pattern was detected

    This is not proof of safety. Runtime behavior, indirect dependencies, and hidden external systems are outside the static scan.

    Evidence record

    Why each signal appears

    EvidenceSourceComputedTestedEditorial
    SignalValueEvidence typeMeaning
    Quality score90/100ComputedDocumentation, specificity, maintenance, and trust rules
    Repository stars237SourceRepository attention, not individual Skill quality
    Compatibility0 platformsSourceDeclared in the catalog source record
    Usage guideautomated source guideEditorialGenerated or reviewed according to the visible evidence level

    Pinned source

    Provenance and original SKILL.md

    Repository
    Aperivue/medsci-skills
    Skill path
    skills/clean-data/SKILL.md
    Commit
    8b39515657a0e0a575d91b1b00b6f3df4f7bb90f
    License
    MIT
    Collected
    2026-08-06
    Default branch
    main
    View the original SKILL.md

    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
    • Implausible-value & cross-field validity rules: ${CLAUDE_SKILL_DIR}/references/implausible_value_rules.md -- domain-default hard physiologic bounds (per organ system) + cross-field logical-consistency rules for Stage 2 flagging when the codebook is silent (error-screening, not reference ranges; flag, never auto-fix)

    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: Use the codebook's valid range when provided; when the codebook is silent, apply the domain-default hard physiologic bounds in references/implausible_value_rules.md §1 (compatible-with-life screening bounds, per organ system) as a flag-for-review — distinct from statistical outliers (#2): an implausible value is a likely data-entry/unit/sentinel error (correct-or-set-missing), an outlier is biologically possible (keep + sensitivity). Check units before calling a bound violation an error. Never auto-fix. 5b. Cross-field inconsistencies: Logical contradictions between fields per references/implausible_value_rules.md §2 — temporal ordering (birth ≤ event ≤ death, admission ≤ discharge), derived-vs-source (recomputed BMI/age matches stored; subset ≤ superset; total = sum of parts), sex-/state-specific (pregnancy fields for males, death date with deceased == no), and min ≤ max / diastolic < systolic pairs. Flag with the rule that fired; High severity for a hard contradiction.

    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.

    Alternatives

    Compare before choosing

    Computed 9832,785

    K-Dense-AI/scientific-agent-skills

    dask

    Distributed computing for larger-than-RAM pandas/NumPy workflows. Use when you need to scale existing pandas/NumPy code beyond memory or across clusters. Best for parallel file processing, distributed ML, integration with existing pandas code. For out-of-core analytics on single machine use vaex; for in-memory speed use polars.

    Computed 9632,785

    K-Dense-AI/scientific-agent-skills

    scanpy

    Standard single-cell RNA-seq analysis pipeline. Use for QC, normalization, dimensionality reduction (PCA/UMAP/t-SNE), clustering, differential expression, visualization, and converting R-friendly single-cell formats such as Seurat or SingleCellExperiment RDS files into h5ad for Scanpy. Best for exploratory scRNA-seq analysis with established workflows. For deep learning models use scvi-tools; for data format questions use anndata.

    Computed 934,969

    dotnet/skills

    coverage-analysis

    Project-wide code coverage and CRAP (Change Risk Anti-Patterns) score analysis for .NET projects. Calculates CRAP scores per method and surfaces risk hotspots — complex code with low coverage that is dangerous to modify. Use to diagnose why coverage is stuck or plateaued, identify what methods block improvement, or get project-wide coverage analysis with risk ranking. USE FOR: coverage stuck, coverage plateau, can't increase coverage, what's blocking coverage, coverage gap, CRAP scores, risk hot

    Computed 9267,140

    ruvnet/ruflo

    agent-hierarchical-coordinator

    Agent skill for hierarchical-coordinator - invoke with $agent-hierarchical-coordinator