| name | data-cleaning |
| description | End-to-end data preprocessing pipeline to transform raw files (CSV, Excel, Parquet) into AI-Ready assets. Use this skill when the user requests to clean data, handle missing values, fix data types, remove duplicates, standardize formats, or prepare datasets for model training. Includes automatic profiling and dataset card generation. |
Data Cleaning SOP
Follow this standard procedure to transform raw data into high-quality AI-Ready assets.
Core Directives
- Never read full datasets into context. Always use
data_profile tool or Python scripts to inspect data.
- Code-as-Action. Perform all transformations via
python_executor. Do not simulate changes in text.
- Immutability. Never overwrite the raw file. Save output as
*_cleaned.parquet (preferred) or *_cleaned.csv.
Workflow
Phase 1: Profile & Diagnose
Before writing any cleaning code, understand the data state.
- Run
data_profile(file_path) to get schema, shape, and sample rows.
- Identify issues: Missing values (NaN), inconsistent types (Object vs Float), duplicates, or outliers.
Phase 2: Plan & Script
Construct a cleaning script. Use the bundled template to ensure robustness.
- Read the template:
read_file("skills/data-cleaning/scripts/template_clean.py").
- Modify the template to implement specific cleaning logic based on Phase 1 findings.
- Rule of Thumb:
- Missing Values: Impute (mean/median/mode) if <5% missing; drop if critical; use
bfill/ffill for time-series.
- Types: Enforce explicit types (
astype). Convert timestamps (pd.to_datetime).
- Output: Prefer
parquet for type preservation.
Phase 3: Execute & Verify
- Run the script using
python_executor.
- If the script fails, analyze the Traceback, fix the code, and retry.
- Upon success, verify the output file exists and has the expected shape.
Phase 4: Document (The AI-Ready Standard)
Data is not "AI-Ready" without documentation.
- Read the standard format:
read_file("skills/data-cleaning/references/datacard_template.md").
- Generate a
README_dataset.md summarizing:
- Source of data.
- Changes applied (e.g., "Imputed 5% missing values in 'Temperature' column").
- Final schema and usage constraints.