HKUDS/Vibe-Trading/agent/src/skills/backtest-diagnose/SKILL.md
backtest-diagnose
Diagnose failed or underperforming backtests, locate the root cause, and fix the issue
- Source repository stars
- 29,558
- Declared platforms
- 0
- Static risk flags
- 0
- Last source update
- 2026-08-04
- Source checked
- 2026-08-04
Decision brief
What it does—and where it fits
Diagnose failed or underperforming backtests, locate the root cause, and fix the issue
Not for
- Tasks that require unconfirmed production actions or broad system permissions.
- Environments where the pinned source and install steps cannot be inspected.
Compatibility matrix
Platform support, with evidence labels
| Platform | Status | Evidence | What to check |
|---|---|---|---|
| Codex | Not declared | No explicit evidence | Portability before use |
| Claude Code | Not declared | No explicit evidence | Portability before use |
| Cursor | Not declared | No explicit evidence | Portability before use |
| Gemini CLI | Not declared | No explicit evidence | Portability before use |
Installation
Inspect first. Install second.
The source command is displayed only when detected. A safe inspection prompt is always available so your agent can explain every action before execution.
npx skills add https://github.com/HKUDS/Vibe-Trading --skill "agent/src/skills/backtest-diagnose"Inspect the Agent Skill "backtest-diagnose" from https://github.com/HKUDS/Vibe-Trading/blob/3a752d5a8ed088633040893de1cc9e6dc712596f/agent/src/skills/backtest-diagnose/SKILL.md at commit 3a752d5a8ed088633040893de1cc9e6dc712596f. List every install step, command, network request, credential, file read/write, external action, and rollback step. Explain whether it fits my task. Do not install or execute anything until I approve.
Workflow
What the source asks the agent to do
- 01
Diagnostic Workflow
1. Read existing artifacts: use readfile to inspect artifacts/metrics.csv, equity.csv, and trades.csv 2. Read the code: use readfile to inspect code/signalengine.py and config.json 3. Classify the issue: determine the root cause using the error taxonomy below 4. Apply the fix: u…
Read existing artifacts: use readfile to inspect artifacts/metrics.csv, equity.csv, and trades.csvRead the code: use readfile to inspect code/signalengine.py and config.jsonClassify the issue: determine the root cause using the error taxonomy below - 02
Error Taxonomy
1. Zero trades (tradecount=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. 2. Late trades (first trade occurs more than 2 years after the ba…
Zero trades (tradecount=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.Late trades (first trade occurs more than 2 years after the backtest start): data-filtering bug. The lookback window may be too long, or the initial data segment may have been dropped. Shorten the window or check whethe…Capital utilization < 50% (mostly in cash): position-sizing bug. Signal triggers may be too sparse, or the position-sizing logic may be wrong. - 03
Runtime Errors (exitcode != 0)
Review the “Runtime Errors (exitcode != 0)” section in the pinned source before continuing.
Review and apply the “Runtime Errors (exitcode != 0)” source section. - 04
Logic Bugs (Backtest Succeeds but Results Are Abnormal)
1. Zero trades (tradecount=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. 2. Late trades (first trade occurs more than 2 years after the ba…
Zero trades (tradecount=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.Late trades (first trade occurs more than 2 years after the backtest start): data-filtering bug. The lookback window may be too long, or the initial data segment may have been dropped. Shorten the window or check whethe…Capital utilization < 50% (mostly in cash): position-sizing bug. Signal triggers may be too sparse, or the position-sizing logic may be wrong. - 05
Data Errors
Review the “Data Errors” section in the pinned source before continuing.
Review and apply the “Data Errors” source section.
Permission review
Static risk signals and limitations
No configured static risk pattern was detected
This is not proof of safety. Runtime behavior, indirect dependencies, and hidden external systems are outside the static scan.
Evidence record
Why each signal appears
| Signal | Value | Evidence type | Meaning |
|---|---|---|---|
| Quality score | 88/100 | Computed | Documentation, specificity, maintenance, and trust rules |
| Repository stars | 29,558 | Source | Repository attention, not individual Skill quality |
| Compatibility | 0 platforms | Source | Declared in the catalog source record |
| Usage guide | automated source guide | Editorial | Generated or reviewed according to the visible evidence level |
Pinned source
Provenance and original SKILL.md
- Repository
- HKUDS/Vibe-Trading
- Skill path
- agent/src/skills/backtest-diagnose/SKILL.md
- Commit
- 3a752d5a8ed088633040893de1cc9e6dc712596f
- License
- MIT
- Collected
- 2026-08-04
- Default branch
- main
View the original SKILL.md
Backtest Diagnosis
Overview
Use this skill when a user reports that a backtest failed, raised an error, or produced poor results.
Diagnostic Workflow
- Read existing artifacts: use
read_fileto inspectartifacts/metrics.csv,equity.csv, andtrades.csv - Read the code: use
read_fileto inspectcode/signal_engine.pyandconfig.json - Classify the issue: determine the root cause using the error taxonomy below
- Apply the fix: use
edit_fileto modify the code, then rerun the backtest - Verify the fix: use
read_fileto inspect the newmetrics.csv
Error Taxonomy
Runtime Errors (exit_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 |
Logic Bugs (Backtest Succeeds but Results Are Abnormal)
- Zero trades (
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. - Late trades (first trade occurs more than 2 years after the backtest start): data-filtering bug. The lookback window may be too long, or the initial data segment may have been dropped. Shorten the window or check whether
dropnais too aggressive. - Capital utilization < 50% (mostly in cash): position-sizing bug. Signal triggers may be too sparse, or the position-sizing logic may be wrong.
- Open position at the end (a position still exists when the backtest ends): exit-timing bug. Forced liquidation may be missing, or exit logic does not cover the final segment.
Data Errors
| 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 |
Data-Source Error Ignore List
If you encounter the following keywords, do not modify the code. The problem is on the data-provider side:
- a provider-side "no data available" response
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.
Hard-Gate Checklist
artifacts/metrics.csvexists and is non-emptyartifacts/equity.csvexists and is non-emptytrade_count > 0(0trades means a signal bug)- The equity series contains no
NaN exit_code == 0
Fixing Principles
- Use edit_file to make precise code fixes instead of rewriting the entire file with
write_file, unless the structure is fundamentally broken - Fix the bug only, do not change strategy logic unless the user explicitly asks
- Fix one issue at a time, and rerun the backtest immediately after each fix
- Limit yourself to at most 3 repair iterations
Post-Fix Validation Rules
After modifying signal_engine.py, you must confirm:
- AST syntax passes:
bash("python -c \"import ast; ast.parse(open('code/signal_engine.py').read()); print('OK')\"") - Contains
class SignalEngine: the file must defineclass SignalEngine - Contains
def generate: the class must contain adef generatemethod - Rerun the backtest: after the fix, rerun the backtest and verify the results
action_items Writing Rules
After diagnosis, output actionable improvement suggestions:
- Format:
"Change X from A to B"or"Add X logic in signal_engine.py" - Be specific about parameter values, filenames, and function names
- Provide at least 2 items
- Examples:
"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"
Alternatives
Compare before choosing
alirezarezvani/claude-skills
app-store-optimization
App Store Optimization (ASO) toolkit for researching keywords, analyzing competitor rankings, generating metadata suggestions, and improving app visibility on Apple App Store and Google Play Store. Use when the user asks about ASO, app store rankings, app metadata, app titles and descriptions, app store listings, app visibility, or mobile app marketing on iOS or Android. Supports keyword research and scoring, competitor keyword analysis, metadata optimization, A/B test planning, launch checklist
wanshuiyin/Auto-claude-code-research-in-sleep
citation-audit
Use it for operations and research tasks; the detail page covers purpose, installation, and practical steps.
dotnet/skills
migrate-vstest-to-mtp
Migrates .NET test projects from VSTest to Microsoft.Testing.Platform (MTP). Use when user asks to "migrate to MTP", "switch from VSTest", "enable Microsoft.Testing.Platform", "use MTP runner", set OutputType=Exe only for test projects in Directory.Build.props, or mentions EnableMSTestRunner, EnableNUnitRunner, or UseMicrosoftTestingPlatformRunner. USE FOR: MTP behavioral differences vs VSTest (exit code 8, zero tests discovered, --ignore-exit-code, TESTINGPLATFORM_EXITCODE_IGNORE); centralizing
aaron-he-zhu/aaron-marketing-skills
social-selling-planner
Use when the user asks to "set up my founder social-selling routine", "build a daily engagement block for target accounts", or "turn funding / hiring signals into selling plays"; produces the founder/seller daily operating block — a time-boxed engagement-block spec (substantive value-add comments on target-account posts, never a pitch), warm-touch-before-ask cadence rules, trigger-response plays consuming the social-pulse-monitor B2B trigger watchlist (funding / hiring / launch signals), and a q