Logs backtest metrics, experiment parameters, and queries MLflow runs via Python API with QuantStats integration for trading metrics.
Ships in devops-tools. 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.
Read when SKILL.md points to them; scripts run unread.
Unified read/write MLflow operations via Python API with QuantStats integration for comprehensive trading metrics.
ADR: 2025-12-12-mlflow-python-skill
Note: This skill uses Pandas (MLflow API requires it). The
mlflow-pythonpath is auto-skipped by the Polars preference hook.
Self-Evolving Skill: This skill improves through use. If instructions are wrong, parameters drifted, or a workaround was needed — fix this file immediately, don't defer. Only update for real, reproducible issues.
CAN Do:
CANNOT Do:
MLflow uses separate environment variables for credentials (NOT embedded in URI):
# Option 1: .env.local + uv --env-file (recommended)
# Create .env.local (gitignored) in the skill directory with the lines below,
# then run scripts as: uv run --env-file .env.local scripts/<script>.py
MLFLOW_TRACKING_URI=http://mlflow.example.com:5000
MLFLOW_TRACKING_USERNAME=<user>
MLFLOW_TRACKING_PASSWORD=<password>
# Option 2: Direct environment variables
export MLFLOW_TRACKING_URI="http://mlflow.example.com:5000"
export MLFLOW_TRACKING_USERNAME="<user>"
export MLFLOW_TRACKING_PASSWORD="<password>"
/usr/bin/env bash << 'SKILL_SCRIPT_EOF'
ROOT="$(cc-plugin-root devops-tools)"
cd "$ROOT/skills/mlflow-python"
uv run scripts/query_experiments.py experiments
SKILL_SCRIPT_EOF
/usr/bin/env bash << 'SKILL_SCRIPT_EOF_2'
ROOT="$(cc-plugin-root devops-tools)"
cd "$ROOT/skills/mlflow-python"
uv run scripts/log_backtest.py \
--experiment "crypto-backtests" \
--run-name "btc_momentum_v2" \
--returns path/to/returns.csv \
--params '{"strategy": "momentum", "timeframe": "1h"}'
SKILL_SCRIPT_EOF_2
uv run scripts/query_experiments.py experiments
uv run scripts/query_experiments.py runs \
--experiment "crypto-backtests" \
--filter "metrics.sharpe_ratio > 1.5" \
--order-by "metrics.sharpe_ratio DESC"
uv run scripts/create_experiment.py \
--name "crypto-backtests-2025" \
--description "Q1 2025 cryptocurrency trading strategy backtests"
uv run scripts/get_metric_history.py \
--run-id abc123 \
--metrics sharpe_ratio,cumulative_return
The log_backtest.py script calculates 70+ metrics via QuantStats, including:
| Category | Metrics |
|---|---|
| Ratios | sharpe, sortino, calmar, omega, treynor |
| Returns | cagr, total_return, avg_return, best, worst |
| Drawdown | max_drawdown, avg_drawdown, drawdown_days |
| Trade | win_rate, profit_factor, payoff_ratio, consecutive_wins/losses |
| Risk | volatility, var, cvar, ulcer_index, serenity_index |
| Advanced | kelly_criterion, recovery_factor, risk_of_ruin, information_ratio |
See quantstats-metrics.md for full list.
| Script | Purpose |
|---|---|
log_backtest.py | Log backtest returns with QuantStats metrics |
query_experiments.py | Search experiments and runs (replaces CLI) |
create_experiment.py | Create new experiment with metadata |
get_metric_history.py | Retrieve metric time-series data |
Configuration comes from MLFLOW_* environment variables. Create .env.local (gitignored) for credentials and load it per command with uv run --env-file .env.local scripts/<script>.py:
MLFLOW_TRACKING_URI=http://mlflow.example.com:5000
MLFLOW_TRACKING_USERNAME=<user>
MLFLOW_TRACKING_PASSWORD=<password>
This skill replaces the CLI-based mlflow-query skill. Key differences:
| Feature | mlflow-query (old) | mlflow-python (new) |
|---|---|---|
| Log metrics | Not supported | mlflow.log_metrics() |
| Log params | Not supported | mlflow.log_params() |
| Query runs | CLI text parsing | DataFrame output |
| Metric history | Workaround only | Native support |
| Auth pattern | Embedded in URI | Separate env vars |
See migration-from-cli.md for detailed mapping.
| Issue | Cause | Solution |
|---|---|---|
| Connection refused | MLflow server not running | Verify MLFLOW_TRACKING_URI and server status |
| Authentication failed | Wrong credentials | Check MLFLOW_TRACKING_USERNAME and PASSWORD in .env |
| Experiment not found | Experiment name typo | Run query_experiments.py experiments to list all |
| QuantStats import error | Missing dependency | uv add quantstats in skill directory |
| Pandas import warning | Expected for this skill | Ignore - MLflow requires Pandas (hook-excluded) |
| Run creation fails | Experiment doesn't exist | Use create_experiment.py to create first |
| Metric history empty | Wrong run_id or metric name | Verify run_id with query_experiments.py runs |
| Returns CSV parse error | Wrong date format or columns | Check CSV has date index and returns column |
After this skill completes, check before closing:
Only update if the issue is real and reproducible — not speculative.
references/authentication.md (opens in a new tab)references/evolution-log.md (opens in a new tab)references/migration-from-cli.md (opens in a new tab)references/quantstats-metrics.md (opens in a new tab)references/query-patterns.md (opens in a new tab)scripts/create_experiment.py (opens in a new tab)scripts/get_metric_history.py (opens in a new tab)scripts/log_backtest.py (opens in a new tab)scripts/query_experiments.py (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
23 skills in this plugin
/agentic-process-monitorMonitor background processes from Claude Code with sentinel files, heartbeat liveness and subagent polling, to detect completion, failure, hang or timeout. TRIGGERS - monitor background process, sentinel file, heartbeat./claude-code-proxy-patternsClaude Code OAuth proxy patterns and anti-patterns for multi-provider model routing./clickhouse-cloud-managementClickHouse Cloud user and permission management. TRIGGERS - create ClickHouse user, ClickHouse permissions, ClickHouse Cloud credentials./devops-tools:mlflow-pythonfrom devops-tools
npx claudepluginhub terrylica/cc-skills --plugin devops-tools