Use when creating matplotlib/strategy charts. Use when user asks to "draw", "chart", "plot", or "visualize" a strategy, backtest result, or price series.
How this skill is triggered — by the user, by Claude, or both
Slash command
/investment-autoresearch:strategy-chartThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Generate matplotlib charts for backtesting strategy results. Chart is saved to `/tmp/chart.png`.
Generate matplotlib charts for backtesting strategy results. Chart is saved to /tmp/chart.png.
import matplotlib
matplotlib.use("Agg") # Non-interactive backend — required for headless environments
import matplotlib.pyplot as plt
# ... create figure ...
plt.savefig("/tmp/chart.png", dpi=150, bbox_inches="tight",
facecolor=fig.get_facecolor(), edgecolor="none")
plt.close()
colors = {
"bg": "#1a1a2e", "panel": "#16213e", "text": "#e0e0e0",
"grid": "#2a2a4a", "equity": "#00d4aa", "price": "#6c7b95",
"buy": "#00ff88", "sell": "#ff4466", "drawdown": "#ff6b6b",
"vix": "#ffa726",
}
fig.patch.set_facecolor(colors["bg"])
for ax in axes:
ax.set_facecolor(colors["panel"])
ax.tick_params(colors=colors["text"])
ax.spines["top"].set_visible(False)
ax.spines["right"].set_visible(False)
3-panel layout for backtesting charts:
Panel 1 (3x height): Price + Equity curve + Buy/Sell markers + Stats box
Panel 2 (1.5x): Drawdown fill
Panel 3 (1x): VIX or volatility indicator with threshold lines
fig, axes = plt.subplots(3, 1, figsize=(16, 12),
gridspec_kw={"height_ratios": [3, 1.5, 1]})
The chart is saved to /tmp/chart.png. Copy it wherever needed:
cp /tmp/chart.png ~/charts/$(date +%Y-%m-%d)-strategy.png
| Mistake | Fix |
|---|---|
Forgetting matplotlib.use("Agg") | Required for non-interactive (headless) chart generation |
| Not closing figure | Always plt.close() after savefig to free memory |
npx claudepluginhub lucemia/investment-autoresearch --plugin investment-autoresearchProvides a checklist for code reviews covering functionality, security, performance, maintainability, tests, and quality. Use for pull requests, audits, team standards, and developer training.