src/autoskillit/skills_extended/implement-experiment/SKILL.md
Deploy experiment artifacts in an isolated git worktree following an approved experiment plan, with per-phase commits.
npx skillsauth add talont-org/autoskillit implement-experimentInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Implement an experiment plan in an isolated git worktree. All experiment
artifacts are created inside a single self-contained folder under research/.
The worktree is left intact for the orchestrator to run the experiment, test,
and merge separately.
This skill reads the experiment plan and follows its implementation phases. The plan specifies the directory layout, what scripts to write, what data to generate, and what environment to set up. This skill builds all of it.
research recipe (phase 2)/autoskillit:implement-experiment {plan_path}
{plan_path} — Absolute path to the experiment plan file (required). Scan
tokens after the skill name for the first path-like token (starts with /,
./, or .autoskillit/).
NEVER:
pytest with no args or targeting the entire repo
(the orchestrator handles full test execution via test_check)research/ subfoldergit merge commands (all branch content must be applied via
git cherry-pick or git checkout <branch> -- <file>)run_in_background: true is prohibited)ALWAYS:
model: "sonnet" when spawning all subagents via the Task toolresearch/ subfoldertests/test_{script_name}.py alongside each experiment script created in Step 4pytest --collect-only after creating tests to verify discovery before committingEdit call on any file, ensure you have issued a Read on that file earlier in this session. Claude Code rejects Edit on unread files — the retry wastes a full API turn at current context size. If you are uncertain whether a file was read, issue a targeted Read (offset + limit to the region you plan to edit) rather than risk an error.If this skill hits the Claude context limit mid-execution, the headless session
terminates with needs_retry=true in the tool response. The worktree remains
intact on disk with all commits made up to that point.
The orchestrator should NOT retry this skill — retrying creates a brand-new worktree, discarding all partial progress. Instead, route to the next step (run-experiment) which can work with whatever was committed.
/, ./,
{{AUTOSKILLIT_TEMP}}/, or .autoskillit/ — that token is the plan path.
Ignore any non-path words that appear before it. If no path-like token is
found, treat the entire argument string as pasted plan content. Verify the
resolved file exists before proceeding.research/YYYY-MM-DD-{slug}/)environment.yml is needed)git status --porcelain — if dirty, warn user.CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
WORKTREE_NAME="research-$(date +%Y%m%d-%H%M%S)"
WORKTREE_PATH="../worktrees/${WORKTREE_NAME}"
git worktree add -b "${WORKTREE_NAME}" "${WORKTREE_PATH}"
WORKTREE_PATH="$(cd "${WORKTREE_PATH}" && pwd)"
# Record the base branch for reliable discovery:
mkdir -p "{{AUTOSKILLIT_TEMP}}/worktrees/${WORKTREE_NAME}"
echo "${CURRENT_BRANCH}" > "{{AUTOSKILLIT_TEMP}}/worktrees/${WORKTREE_NAME}/base-branch"
# Set upstream tracking if possible:
REMOTE=$(git remote get-url upstream >/dev/null 2>&1 && echo upstream || echo origin)
if ! git fetch "$REMOTE" "${CURRENT_BRANCH}" 2>/dev/null; then
echo "NOTE: Branch '${CURRENT_BRANCH}' has no remote tracking ref on $REMOTE."
fi
if ! git -C "${WORKTREE_PATH}" branch --set-upstream-to="${REMOTE}/${CURRENT_BRANCH}" "${WORKTREE_NAME}" 2>/dev/null; then
echo "NOTE: Could not set upstream tracking for '${WORKTREE_NAME}' → '$REMOTE/${CURRENT_BRANCH}'."
fi
Immediately after the worktree is created, output these tokens so the execution layer can capture them even if context is exhausted later:
IMPORTANT: Emit the structured output tokens as literal plain text with no markdown formatting on the token names. Do not wrap token names in
**bold**,*italic*, or any other markdown. The adjudicator performs a regex match on the exact token name — decorators cause match failure.
worktree_path = ${WORKTREE_PATH}
branch_name = ${WORKTREE_NAME}
Before implementing anything, launch subagents (model: "sonnet") to understand the codebase context needed for the experiment. The following are minimum required — launch as many additional subagents as needed.
Minimum subagents:
Subagent A — Codebase Context:
Understand the code areas the experiment will interact with. Identify APIs, data structures, functions, and modules that experiment scripts will need to reference or call. Report imports, interfaces, and patterns the scripts should follow.
Subagent B — Compute Environment Requirements:
Assess the compute environment needed to execute the experiment. Determine what system-level tools, libraries, or runtime capabilities the experiment requires. If the experiment plan specifies an environment.yml, examine it — identify any non-standard dependencies that need system packages installed alongside the micromamba environment. Report what the Dockerfile or container setup needs to provide beyond the base micromamba image.
Additional subagents (launch as many as needed):
The environment is already prepared by setup-environment (upstream in the
recipe). Read env_mode from context to understand what environment was
provisioned (docker, micromamba-host, or unavailable). This step writes
the Dockerfile template and environment.yml into the worktree as
reproducibility artifacts — it does NOT build or install anything.
3a — Write the Dockerfile:
Locate the environment.yml in the planned research directory. The YAML's
name: field is the MAMBA_ENV slug (e.g., 2026-04-13-my-experiment).
Write ${RESEARCH_DIR}/Dockerfile based on the canonical template at
src/autoskillit/assets/research/Dockerfile.template in the project root,
substituting ${MAMBA_ENV} with the actual environment name from environment.yml:
FROM mambaorg/micromamba:1.0-bullseye-slim
SHELL ["/bin/bash", "-c"]
ARG MAMBA_ENV="{slug}"
USER root
RUN apt-get --allow-releaseinfo-change update \
&& apt-get install -y --no-install-recommends procps git curl build-essential \
&& apt-get clean -y && rm -rf /var/lib/apt/lists/*
RUN curl -sL https://taskfile.dev/install.sh | sh -s -- -b /usr/local/bin
RUN rm -f /root/.bashrc \
&& echo "source /etc/container.bashrc" >> /etc/bash.bashrc \
&& echo "set +u" > /etc/container.bashrc \
&& echo 'eval "$(micromamba shell hook --shell=bash)"' >> /etc/container.bashrc
ENV BASH_ENV=/etc/container.bashrc
ENV ENV=/etc/container.bashrc
COPY {slug}.yaml /opt/research/env/
RUN micromamba create -f /opt/research/env/{slug}.yaml && micromamba clean -afy
RUN echo "micromamba activate {slug}" >> /etc/container.bashrc
3b — Write ${RESEARCH_DIR}/Taskfile.yml:
version: '3'
vars:
SLUG: "{slug}"
IMAGE: "research-{{.SLUG}}"
RESEARCH_DIR:
sh: pwd
tasks:
run-experiment:
desc: Run experiment inside container (volume-mounts research dir)
cmds:
- docker run --rm -v "{{.RESEARCH_DIR}}:/workspace" {{.IMAGE}} bash -c "cd /workspace && python scripts/run.py"
dir: "{{.RESEARCH_DIR}}"
test:
desc: Run pytest test suite inside container
cmds:
- docker run --rm -v "{{.RESEARCH_DIR}}:/workspace" {{.IMAGE}} bash -c "cd /workspace && pytest tests/ -v"
dir: "{{.RESEARCH_DIR}}"
Adjust the run-experiment command to match the actual entry-point script from the experiment plan.
3c — Write environment.yml and note env_mode:
If the experiment plan specifies an environment.yml, write it to
${RESEARCH_DIR}/environment.yml. This file is committed to the worktree
as a reproducibility artifact — reviewers can inspect exact dependency
versions.
Note the env_mode from context (set by setup-environment):
docker — a container image was pre-built; run-experiment will execute inside itmicromamba-host — a host environment was created; run-experiment will use micromamba rununavailable — no environment could be provisioned; run-experiment will emit blocked_experimentnone — standard environment, no special setup neededDo NOT invoke any container or environment construction commands. The environment is already ready.
All commands from this point must run from ${WORKTREE_PATH}. Use absolute
paths to avoid CWD drift across Bash tool calls.
Follow the implementation phases from the experiment plan. The plan specifies what to create in each phase. Typical phases include:
research/ subfolder
layout. If the plan specifies an environment.yml, create it and build
the environment with micromamba.For each phase, begin implementation immediately (no announcement):
pre-commit run --all-files and stage any auto-fixed files before
each commit.Test creation (required alongside each script phase):
When implementing experiment scripts in Phases 2 and 3, also create a corresponding
tests/test_{script_name}.py for each script:
{WORKTREE_PATH}/research/{slug}/tests/ and conftest.py if not yet presentanalysis.py), create tests/test_analysis.py covering:
pytest --collect-only {WORKTREE_PATH}/research/{slug}/tests/ to confirm
pytest can discover all test files. Fix any import errors before committing.The plan is the authority on what phases exist and what each phase creates. Follow it.
Copy the experiment plan into the research folder for reference:
RESEARCH_DIR=$(ls -d "${WORKTREE_PATH}"/research/*/ 2>/dev/null | head -1)
cp "${PLAN_PATH}" "${RESEARCH_DIR}experiment-plan.md"
git -C "${WORKTREE_PATH}" add research/ && git -C "${WORKTREE_PATH}" commit -m "Add experiment plan to research folder"
Pre-commit is only relevant when the worktree has a .pre-commit-config.yaml.
Research worktrees do not — skip pre-commit for them.
if [ -f "${WORKTREE_PATH}/.pre-commit-config.yaml" ]; then
cd "${WORKTREE_PATH}" && pre-commit run --all-files
# Fix any formatting or linting issues, then re-stage and re-commit.
else
echo "No .pre-commit-config.yaml found — skipping pre-commit (research worktree)."
fi
Output to terminal:
${WORKTREE_PATH}${WORKTREE_NAME}research/ subfolder created inside the worktreeExplicitly state: "Worktree left intact for orchestrator to run experiment and test."
Then emit these structured output tokens:
IMPORTANT: Emit the structured output tokens as literal plain text with no markdown formatting on the token names. Do not wrap token names in
**bold**,*italic*, or any other markdown. The adjudicator performs a regex match on the exact token name — decorators cause match failure.
worktree_path = ${WORKTREE_PATH}
branch_name = ${WORKTREE_NAME}
git worktree list, suggest git worktree prunedevelopment
Generate YAML recipes for .autoskillit/recipes/. Use when user says "make script skill", "generate script", "script a workflow", "write a script", "create a script", "new recipe", "write a pipeline", or when loaded by other skills for script formatting.
data-ai
Create Uncertainty Representation visualization planning spec showing error bar definitions, distribution-aware alternatives, and multi-seed variance protocols. Statistical lens answering "How is uncertainty honestly represented?"
data-ai
Create Temporal Dynamics visualization planning spec showing axis scaling (linear vs log), smoothing disclosure, epoch/step alignment, run aggregation (mean + variance bands), early-stopping markers, and wall-clock vs step-count x-axis. Temporal lens answering "Are training dynamics shown clearly and honestly?"
data-ai
Create Narrative Story Arc visualization planning spec showing visual consistency across the report (same color = same model everywhere), logical figure progression, redundant figure detection, and narrative dependency between figures. Narrative lens answering "Do the figures tell a coherent story across the report?"