用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/charliedream1/ai_quant_trade --skill backtest-diagnose命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
基于 SOC 职业分类
正在显示 SKILL.md
| name | backtest-diagnose |
| description | Diagnose failed or underperforming backtests, locate the root cause, and fix the issue |
| category | tool |
Use this skill when a user reports that a backtest failed, raised an error, or produced poor results.
read_file to inspect artifacts/metrics.csv, equity.csv, and trades.csvread_file to inspect code/signal_engine.py and config.jsonedit_file to modify the code, then rerun the backtestread_file to inspect the new metrics.csvexit_code != 0)| Error Type | Common Cause | Fix |
|---|---|---|
| ImportError | Missing dependency | bash("pip install xxx") |
| KeyError | DataFrame column-name mismatch | Check the actual column names in data_map |
| IndexError | Empty data or insufficient length | Add length checks |
| TypeError | Incorrect signal type | Ensure the return value is pd.Series |
trade_count=0): signal-logic bug. Conditions are too strict, so the signal stays at 0. Check whether entry and exit logic is reasonable, and inspect the signal series to confirm it is not all zeros.dropna is too aggressive.| Symptom | Root Cause | Fix |
|---|---|---|
| No data fetched | Invalid API token or code issue | Check config.json |
| Too little data | Date range too narrow | Expand the date range |
If you encounter the following keywords, do not modify the code. The problem is on the data-provider side:
rate limitAPI limitdaily limitInformation (common in Tushare API responses)These issues require the user to check the API token, switch data sources, or wait for the quota to reset.
artifacts/metrics.csv exists and is non-emptyartifacts/equity.csv exists and is non-emptytrade_count > 0 (0 trades means a signal bug)NaNexit_code == 0write_file, unless the structure is fundamentally brokenAfter modifying signal_engine.py, you must confirm:
bash("python -c \"import ast; ast.parse(open('code/signal_engine.py').read()); print('OK')\"")class SignalEngine: the file must define class SignalEnginedef generate: the class must contain a def generate methodaction_items Writing RulesAfter diagnosis, output actionable improvement suggestions:
"Change X from A to B" or "Add X logic in signal_engine.py""Change RSI threshold from 30 to 25 in signal_engine.py line 42""Add signals = signals.fillna(0) after signal calculation to prevent NaN propagation""Add a volume filter: skip buy signals when volume is below the 20-day average"