From spml
Guides ML experiment design by exploring ideas, collecting context, and confirming validation scope before implementation.
How this skill is triggered — by the user, by Claude, or both
Slash command
/spml:ml-brainstormingThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Help turn ML ideas into fully formed experiment designs through natural collaborative dialogue.
Help turn ML ideas into fully formed experiment designs through natural collaborative dialogue.
Start by understanding the current project context, then ask questions one at a time to refine the idea. Once you understand what you're building, present the design and get user approval.
Core ML principle: "Not working" is reasonable in ML, but the process must be correct. A bad implementation mistaken for a bad strategy wastes entire research directions. This skill ensures we design experiments that can distinguish the two.
Do NOT invoke any implementation skill, write any code, scaffold any project, or take any implementation action until you have presented a design and the user has approved it. This applies to EVERY project regardless of perceived simplicity.Every project goes through this process. A single ablation, a data pipeline tweak, a hyperparameter sweep — all of them. "Simple" ML tasks are where unexamined assumptions cause the most wasted GPU hours. The design can be short, but you MUST present it and get approval.
You MUST create a task for each of these items and complete them in order:
<experiment_dir>/plans/YYYY-MM-DD-<topic>-design.md and commitspml:experiment-planning skill to create implementation planWhen the orchestrator passes existing design doc content (from directory state detection), you are in revision mode.
In revision mode, you MUST edit the existing design doc in place. Do NOT create a new design file. Do NOT re-ask questions that are already answered in the existing design."Current design: [1-3 sentence summary of hypothesis, approach, validation scope]. What do you want to change?"
"experiment: revise design — [what changed]"spml:experiment-planning (which will also be in revision mode)After revision, append an Impact section to the design doc:
## Impact on Plan
- Subtask N: [needs update because X changed]
- Subtask M: [unaffected]
- New subtask needed: [description]
This Impact section guides downstream plan revision.
spml:experiment-planning (revision mode)digraph ml_brainstorming {
"Revision mode?" [shape=diamond style=filled fillcolor=lightyellow];
"Read existing design\nPresent summary" [shape=box];
"Ask delta questions" [shape=box];
"Explore project context" [shape=box];
"Collect ML context" [shape=box];
"Ask clarifying questions" [shape=box];
"Confirm validation scope" [shape=box];
"Propose 2-3 approaches" [shape=box];
"Present design sections" [shape=box];
"User approves design?" [shape=diamond];
"Write/edit design doc" [shape=box];
"Spec self-review\n(fix inline)" [shape=box];
"User reviews spec?" [shape=diamond];
"Invoke spml:experiment-planning" [shape=doublecircle];
"Revision mode?" -> "Read existing design\nPresent summary" [label="yes"];
"Revision mode?" -> "Explore project context" [label="no"];
"Read existing design\nPresent summary" -> "Ask delta questions";
"Ask delta questions" -> "Confirm validation scope";
"Explore project context" -> "Collect ML context";
"Collect ML context" -> "Ask clarifying questions";
"Ask clarifying questions" -> "Confirm validation scope";
"Confirm validation scope" -> "Propose 2-3 approaches";
"Propose 2-3 approaches" -> "Present design sections";
"Present design sections" -> "User approves design?";
"User approves design?" -> "Present design sections" [label="no, revise"];
"User approves design?" -> "Write/edit design doc" [label="yes"];
"Write/edit design doc" -> "Spec self-review\n(fix inline)";
"Spec self-review\n(fix inline)" -> "User reviews spec?";
"User reviews spec?" -> "Write/edit design doc" [label="changes requested"];
"User reviews spec?" -> "Invoke spml:experiment-planning" [label="approved"];
}
The terminal state is invoking spml:experiment-planning. Do NOT invoke any other implementation skill.
Ask about (one at a time, skip what's already clear):
experiments/my-experiment/). All generated plans and docs will be saved under this directory.every N steps) and does evaluation need both checkpoint-based and in-memory entry modes?full validation unless the user explicitly wants a narrower scopeFor experiment/ablation tasks, clarify:
If ANY of the following are true, you MUST immediately enter the autoresearch protocol definition flow below:
spml:autoresearch-create was invoked earlier in this conversation (autoresearch mode is already confirmed)Do NOT explore the project first. Do NOT dispatch Explore agents or read code before asking the user. Ask the user questions first — they know what they want to research. Only explore specific directories AFTER the user tells you where the experiment is.
When autoresearch is detected, ask the following questions one at a time, in order. Do NOT batch questions. Wait for each answer before asking the next.
python eval.py --checkpoint best.pt) that outputs the metric value. This script will be fixed before the loop starts — the agent cannot modify it. Do you have one, or do we need to build it?" (metric name, direction, eval script/command)metric_category)performance. "We need a profile_command that produces kernel/op-level timing to stdout each round, so the Researcher targets real hotspots instead of guessing. Provide a runnable command (e.g., python profile.py --steps 50 running torch.profiler and printing a top-N table). If you don't have one yet, we'll record it as a VP-L1 build TODO — handoff will validate it before the loop starts." (maps to profile_command)name — readable label.new_module — module:attr import path. Must be inside the Variable.files declared in Q3. If not, push back: "this module lives outside the Variable file set — either add its file to Variable, or relocate the kernel."baseline_module — module:attr import path. Must be inside the Fixed.files declared in Q2. If not, push back: "the baseline must be locked — add its file to Fixed, or this guardrail can't preserve the contract."fixture — module:attr of a zero-arg callable returning (args, kwargs).tolerance — default {atol: 1e-3, rtol: 1e-3}; user can override.train_command and eval_command are NOT asked here — they are determined during the build phase (VP L1) and extracted by handoff into the protocol.
Only AFTER collecting these answers, explore the experiment directory (if existing) to understand the base code.
The Validation Pyramid runs once per experiment, on the single [INTEGRATION] subtask (the assembled training pipeline). Code subtasks (model class, dataset, evaluator core, etc.) are validated by standard TDD + spec/quality review and do NOT run VP. Walk through what L0 and L1 should check on the integration subtask.
L0: ML Static Checks (spml:ml-static-checks) — runs on the [INTEGRATION] subtask
L1: ML Runtime Validation (spml:ml-runtime-validator) — runs on the [INTEGRATION] subtask after L0 passes
User can skip L1 on the integration subtask — EXCEPT when autoresearch is detected. Autoresearch requires a verified baseline before the iteration loop can start; skipping L1 means the assembled baseline code was never proven to run, and the autonomous loop will fail from round 1. When autoresearch is detected, L1 is mandatory and non-negotiable regardless of task simplicity. L0 cannot be skipped on the integration subtask — it is cheap (seconds) and gates L1. Record decisions in natural language in the design doc.
When the task includes validation or evaluation beyond a trivial final metric, confirm the evaluation design explicitly:
every 500 stepsfull validation unless the user explicitly overrides itAfter defining the eval metric, collect the full set of acceptance dimensions for this experiment. These are used by verification to judge overall success, and by ml-iteration as the Supervisor's review rubric.
Ask:
"Beyond the metric, what does a 'good-enough' version of this training look like? Consider speed (first-step time, MFU), log quality (what fields, what cadence), stability (no NaN, no crashes), and anything else we discussed. I'll record these as review_criteria."
Record the response as a structured block in the design doc:
review_criteria:
metrics:
- name: <eval metric name>
direction: ">=" | "<=" | "=="
threshold: <value>
performance:
- <constraint, e.g., "first_step_time <= 30s">
- <constraint, e.g., "mfu >= 0.30">
observability:
- <expectation, e.g., "per-step loss / grad_norm / step_time">
stability:
- <expectation, e.g., "no NaN / Inf">
custom:
- <any other expectation raised in the conversation>
Any sub-section may be empty if not discussed. metrics is strongly recommended; others are context-dependent.
This field is required in the design doc — training-handoff will prompt the user to add it if missing.
If the task involves constructing or transforming datasets:
Documentation:
<experiment_dir>/plans/YYYY-MM-DD-<topic>-design.mdSpec Self-Review: After writing the spec document, look at it with fresh eyes:
review_criteria align with the stated hypothesis?Fix any issues inline. No need to re-review — just fix and move on.
User Review Gate: After the spec review pass, ask the user to review the written spec before proceeding:
"Spec written and committed to
<path>. Please review it and let me know if you want to make any changes before we start the implementation plan."
Wait for the user's response. If they request changes, make them and re-run the spec review. Only proceed once the user approves.
Required design doc contents:
review_criteria block with at least metrics populatedWhen autoresearch is detected, the design doc includes an additional section:
## Autoresearch Protocol
research_question: <from user>
max_rounds: <from user>
target: <from user, or "none">
train_command: <from VP L1 baseline run — handoff extracts>
initial_hints: <from user, or empty>
### Fixed(不可变:代码 + 条件)
- files: <from user — framework code that must not change>
- time_limit: <from user>
- epoch_limit: <from user>
### Variable(可变:代码 + 条件)
- files: <from user — the only files Researcher may modify>
- 可调范围: <from user>
### Eval
- metric: <from user>
- direction: maximize / minimize
- command: <from user or derived from base code>
- metric_category: <performance | accuracy | other — from Q5>
### Profile (omit this block iff metric_category != performance)
- command: <profile_command — from Q6, or "TODO: build in VP L1" if user has none yet>
### Kernel Targets (omit this block iff Q7 = no)
- name: <readable label>
new_module: <module:attr>
baseline_module: <module:attr>
fixture: <module:attr>
tolerance: { atol: <float>, rtol: <float> }
# repeat for each target
This section is the routing signal: downstream ml-subagent-dev will present the "Research" option at Post-Completion Gate when it detects this section.
Implementation:
spml:experiment-planning skill to create a detailed implementation planspml:experiment-planning is the next step.npx claudepluginhub qqhard/superpowers-mlCreates detailed ML experiment implementation plans with atomic subtasks, validation criteria, and revision support. Use before writing code for multi-step ML tasks.
Turns a rough deep learning research idea into a falsifiable experiment plan with hypothesis, baseline, metric, and compute budget before writing code.
Generates validated, runnable implementation plans for ML pipelines, architecture designs, and multi-step projects grounded in official framework documentation.