/spml:data-preparationfrom spml
Guides TDD-first construction and transformation of ML training datasets, validating data processing logic on small-scale data before full-scale runs.
Ships in spml. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Before building a full dataset, validate your data processing logic on a small scale. Write tests first, implement processing code, analyze the output, then scale up. This prevents wasting hours/days on incorrect processing logic and avoids dangerous data operations (accidental deletion, corruption).
Core principle: Do NOT run full-scale until small-scale validation passes.
Do NOT run full-scale data processing until: 1. Tests are written and passing on small-scale data 2. Small-scale data analysis confirms correctness 3. User has explicitly approved scaling upYou MUST complete these in order:
Ask the user (one question at a time):
Write these tests BEFORE writing any data processing code:
def test_target_framework_can_load():
"""Target DataLoader loads the processed data without errors."""
dataset = load_with_target_framework("output/small_scale/")
assert len(dataset) > 0
def test_all_expected_fields_present():
"""All required fields exist, no unexpected extra fields."""
sample = dataset[0]
assert set(sample.keys()) == {"input_ids", "attention_mask", "labels"} # adapt to actual fields
def test_field_dtypes_correct():
"""Each field has the correct dtype and shape."""
sample = dataset[0]
assert sample["input_ids"].dtype == torch.long
assert sample["input_ids"].shape == (max_seq_len,)
def test_encoding_correct():
"""Text encoding, categorical mapping, special tokens are correct."""
sample = dataset[0]
# Verify specific encoding rules for your data
def test_batch_load_time_acceptable():
"""Single batch loads within acceptable time."""
import time
dataloader = create_dataloader("output/small_scale/", batch_size=32)
start = time.perf_counter()
batch = next(iter(dataloader))
elapsed = time.perf_counter() - start
print(f"Single batch load time: {elapsed:.4f}s")
assert elapsed < 1.0 # adjust threshold per use case
Run tests to verify they FAIL (processing code doesn't exist yet).
Write the data processing code to make Step 3 tests pass.
Data operations (add, delete, modify) are inherently dangerous. Follow these rules:
| Rule | Why |
|---|---|
| Copy-first | Execute on a small-scale copy first, confirm correct, then operate on original |
| Destructive ops need confirmation | Delete/overwrite must not auto-execute — require explicit user confirmation |
| Generate new files, don't modify in-place | Prefer writing to a new output directory over overwriting source files |
Data processing code MUST include:
tqdm or equivalent progress barsfrom tqdm import tqdm
def process_dataset(input_path, output_path):
raw_data = load_raw(input_path)
processed = []
for item in tqdm(raw_data, desc="Processing"):
processed.append(transform(item))
# Checkpoint every N items for resumability
save(processed, output_path)
Run tests to verify they PASS.
After tests pass, analyze the processed small-scale data:
| Check | How |
|---|---|
| Label distribution | Compare with original source, confirm no introduced bias |
| Feature distribution | Key features' min/max/mean/std, check for anomalies |
| Missing rate | Per-field missing ratio within expected range |
| Sample spot check | Print 5-10 samples, human review end-to-end correctness |
| Dedup check | Confirm no unexpected duplicate samples |
def analyze_processed_data(dataset):
"""Print analysis for human review."""
print(f"Total samples: {len(dataset)}")
print(f"\n--- Label Distribution ---")
# label counts / percentages
print(f"\n--- Feature Statistics ---")
# min, max, mean, std for key features
print(f"\n--- Missing Rate ---")
# per-field missing count / percentage
print(f"\n--- Sample Spot Check (first 5) ---")
for i in range(min(5, len(dataset))):
print(f"\nSample {i}: {dataset[i]}")
print(f"\n--- Duplicate Check ---")
# check for exact duplicates
Present results to user. Get explicit approval before proceeding to full-scale.
After user approves small-scale results:
Running full-scale data processing.
Estimated time: [X hours/minutes]
Monitor progress: tail -f logs/processing.log
Progress bar: visible in terminal via tqdm
Output location: [path]
Resume if interrupted: re-run the same command, it will skip completed chunks
| Symptom | Likely Cause |
|---|---|
| DataLoader throws error | Format mismatch: check dtype, field names, file structure |
| Fields missing | Transform logic drops fields, or source data has unexpected schema |
| Wrong dtype | Encoding step produces wrong type, or missing cast |
| Distribution skewed vs source | Filter/sampling logic introduces bias |
| Duplicates appear | Join/merge logic creates cartesian product |
| Load time too slow | Wrong file format for access pattern, missing indexing, no chunking |
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub qqhard/superpowers-ml --plugin spml17 skills in this plugin
/autoresearchUse when running an automated research loop — reads protocol, dispatches Researcher subagent, runs eval + compliance, manages git state, accumulates experience across iterations/autoresearch-createUse when the user wants to start an Auto Research workflow - explicit entry point that activates autoresearch mode and routes into brainstorming for protocol definition/autoresearch-handoffUse after VP passes when the experiment needs automated iteration — verifies base code, generates research protocol, and produces startup prompt for autonomous exploration/autoresearch-runUse when the user wants to execute an Auto Research loop - explicit entry point that locates the protocol and starts the autonomous iteration/diagnosticsUse when ML training isn't converging, shows anomalous behavior, or runs too slowly - systematic diagnosis for training failures, early anomalies, and efficiency bottlenecks/experiment-planningUse when you have an ML experiment design or requirements for a multi-step ML task, before touching code2 plugins ship this exact skill · first indexed Jul 15, 2026
Other plugins' skills for the same job