How this skill is triggered — by the user, by Claude, or both
Slash command
/autotune:autotuneThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
You are setting up an autotune session: a health-aware optimization loop that edits code, benchmarks changes, keeps improvements, repairs failures, and pauses with a reason when recovery is exhausted.
You are setting up an autotune session: a health-aware optimization loop that edits code, benchmarks changes, keeps improvements, repairs failures, and pauses with a reason when recovery is exhausted.
Ask the user (or infer from context) the following:
pnpm test, make bench, python train.py)time_ms, size_kb, loss)ms, KB, ``)lower or higher is better?If the user provided a clear goal in their prompt, you can infer reasonable defaults and confirm rather than asking many questions.
Set up scoped permissions so autotune scripts and git operations run without manual confirmation:
bash ${CLAUDE_PLUGIN_ROOT}/bin/setup-permissions.sh .
This adds only autotune-specific permissions (its own scripts, autotune.sh, git commit -m "autotune:*", etc.) to .claude/settings.local.json. Existing settings are preserved.
git checkout -b autotune/<goal-slug>-$(date +%Y%m%d)
Read all files in scope. Understand the workload deeply before writing anything. This understanding is critical for generating good optimization ideas.
autotune.mdWrite the living session document:
# Autotune: <goal>
## Objective
<what we're optimizing and why>
## Setup
- **Command**: `./autotune.sh`
- **Metric**: <name> (<unit>, <direction> is better)
- **Files in scope**: <list>
- **Constraints**: <constraints or "none">
## What's Been Tried
(nothing yet)
## Dead Ends
(none yet)
## Key Wins
(none yet)
## Current Best
Baseline: pending first run
autotune.shWrite the benchmark script. It MUST:
METRIC <name>=<value> on stdoutgrep -P (macOS lacks Perl regex). Use sed, awk, or python3 -c for extraction instead.venv/bin or venv/bin) before running Python commandsExample for test speed:
#!/bin/bash
set -e
# Run tests and capture timing
start=$(python3 -c "import time; print(time.time())")
pnpm test --silent 2>/dev/null
end=$(python3 -c "import time; print(time.time())")
elapsed=$(python3 -c "print(round(($end - $start) * 1000, 1))")
echo "METRIC time_ms=$elapsed"
Example for bundle size:
#!/bin/bash
set -e
pnpm build --silent 2>/dev/null
size=$(du -sb dist/ | awk '{print $1}')
echo "METRIC size_bytes=$size"
Make it executable: chmod +x autotune.sh
autotune.checks.sh (optional)If the user specified correctness constraints, write a checks script:
#!/bin/bash
set -e
pnpm typecheck
pnpm test
pnpm lint
Make it executable: chmod +x autotune.checks.sh
autotune.config.json (recommended)Write a config file when the user gave you enough context to set reasonable budgets:
{
"autoResume": "prompt",
"mode": "optimize",
"health": {
"maxNoImprovementRuns": 5,
"maxCrashStreak": 2
},
"recovery": {
"playbooks": ["rebaseline", "shrink_scope", "diagnose", "pause"],
"maxHealingAttempts": 3,
"pauseOnExhaustedRecovery": true
}
}
Bias toward conservative defaults. The goal is sustained useful work, not endless churn.
If the user doesn't already have a status line configured, suggest adding autotune's to ~/.claude/settings.json:
{
"statusLine": {
"type": "command",
"command": "bash ${CLAUDE_PLUGIN_ROOT}/bin/statusline.sh"
}
}
This shows health state, experiment count, streaks, elapsed time, cost, and context usage at the bottom of the Claude Code window — updated after each assistant message.
# Initialize
bash ${CLAUDE_PLUGIN_ROOT}/bin/init-experiment.sh \
--name "<goal-slug>" \
--metric "<metric_name>" \
--unit "<unit>" \
--direction "<lower|higher>"
# Run baseline
bash ${CLAUDE_PLUGIN_ROOT}/bin/run-experiment.sh --command "./autotune.sh"
# Log baseline (use the parsed_primary value from run output)
bash ${CLAUDE_PLUGIN_ROOT}/bin/log-experiment.sh \
--metric <baseline_value> \
--status keep \
--description "baseline" \
[--metrics '<secondary_metrics_json>']
git add autotune.md autotune.sh autotune.jsonl .autotune.state
git add autotune.checks.sh 2>/dev/null || true
git commit -m "autotune: initialize session for <goal>"
Immediately begin the autotune loop. Generate your first optimization idea based on your understanding of the source code, and start experimenting.
Stay autonomous through normal failures, but respect health state and recovery budgets.
The loop:
bash ${CLAUDE_PLUGIN_ROOT}/bin/run-experiment.sh --command "./autotune.sh"bash ${CLAUDE_PLUGIN_ROOT}/bin/log-experiment.sh --metric <value> --status <status> --description "<what you tried>"health_state, decision_reason, and next_modeUse autotune explain whenever you need a compact summary of the current state and recommended next action.
npx claudepluginhub hwuiwon/autotune --plugin autotuneCreates, edits, and optimizes skills for Claude Code, including drafting, evaluating with test prompts, iterating on performance, and improving skill descriptions for better triggering accuracy.