Tested demoQuality 99/100

HKUDS/Vibe-Trading/agent/src/skills/strategy-generate/SKILL.md

strategy-generate

Create, modify, and optimize quantitative trading strategies, then backtest and evaluate them.

Source repository stars
31,651
Declared platforms
0
Static risk flags
0
Last source update
2026-08-24
Source checked
2026-08-25

Decision brief

What it does: where it fits

1. Requirements parsing: parse user intent, extract instrument codes, time range, and strategy logic, then write config.json 2. Strategy design: think through the 5 questions of data / signal / position sizing / backtest / validation 3. Strategy coding: write code/signalengine.p…

Best for

    Not for

    • Tasks that require unconfirmed production actions or broad system permissions.
    • Environments where the pinned source and install steps cannot be inspected.
    Controlled single-run demoChecked 2026-08-20

    What changed when the Skill was used

    In this controlled same-task single run, enabling strategy-generate changed the output from 2326 non-whitespace characters and 14 headings to 2275 characters and 11 headings. Matches among 8 signals extracted from the pinned source changed from 0 to 1. Both actual outputs are shown; this is a structural observation, not a quality score or a universal performance claim.

    Same test task

    Create a design direction and implementation handoff for a developer tool that compares two API responses. Prioritize the repeated user workflow and responsive behavior. The deliverable must specifically reflect this user intent: Create, modify, and optimize quantitative trading strategies, then backtest and evaluate them.

    Without the Skill
    Screenshot of the actual model output for strategy-generate without the Skill

    Baseline: 2326 non-whitespace characters, 14 headings, and 53 list items.

    With the Skill
    Screenshot of the actual model output for strategy-generate with the Skill

    With Skill: 2275 non-whitespace characters, 11 headings, and 46 list items.

    ObservationWithout SkillWith Skill
    Source-signal coverage0/8: none1/8: design
    Output structure2326 chars · 14 headings · 53 list items · 1 code blocks2275 chars · 11 headings · 46 list items · 0 code blocks
    Verification and caution signals3 verification signals · 1 risk/limitation signals6 verification signals · 7 risk/limitation signals

    A prompt you can use

    Use the strategy-generate Skill pinned at 7329cb096a73 for my task. Follow its source-specific constraints around `strategy-generate`, `parsing`, `strategy`, `design`, then return the finished deliverable with explicit assumptions, verification, failure conditions, and limits. Do not treat the Skill text as a factual source or claim that a single demonstration proves universal performance.

    Method and limitationsExpand

    Test method

    • Baseline and treatment used the same task, model (gpt-5.3-codex-low), and runner; the only planned difference was whether the complete target Skill text was injected.
    • The treatment used snapshot 7329cb096a7361f975f532c77fef5c93e31561c5; the current source commit 7329cb096a7361f975f532c77fef5c93e31561c5 was verified against content hash 80af9675e358. The baseline explicitly prohibited loading any Skill or external rule file.
    • The same deterministic script counted characters, headings, lists, code blocks, verification terms, caution terms, and source signals in both artifacts. Source signals: `strategy-generate`, `parsing`, `strategy`, `design`, `signalengine`, `contract`, `quality`, `checklist`.
    • The visuals are local screenshots of the actual Markdown artifacts in a fixed 1200 × 800 evidence canvas, not recreated product mockups. Raw JSON artifacts and request records are retained in the research directory.

    Do not over-read this demo

    • This is one controlled demonstration per condition, not a multi-run statistical benchmark; the model is stochastic.
    • Character, structure, and keyword counts show observable differences but cannot by themselves prove correctness, originality, or business impact.
    • The task is a representative test designed for repeatability, not every real-world use of the Skill; rerun after a material source change.
    Editorial review
    SkillSignal editorial
    Runner
    Cursor Agent 2026.08.11-e8db854
    Model
    gpt-5.3-codex-low
    Refresh due
    2026-11-18
    Reviewed commit
    7329cb096a7361f975f532c77fef5c93e31561c5
    Test snapshot
    7329cb096a7361f975f532c77fef5c93e31561c5

    Compatibility matrix

    Platform support, with evidence labels

    PlatformStatusEvidenceWhat to check
    CodexNot declaredNo explicit evidencePortability before use
    Claude CodeNot declaredNo explicit evidencePortability before use
    CursorNot declaredNo explicit evidencePortability before use
    Gemini CLINot declaredNo explicit evidencePortability before use
    Open the compatibility checker

    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.

    Source-detected install commandSource
    npx skills add https://github.com/HKUDS/Vibe-Trading --skill "agent/src/skills/strategy-generate"
    Safe inspection promptEditorial

    Inspect the Agent Skill "strategy-generate" from https://github.com/HKUDS/Vibe-Trading/blob/99e84abaad965f75dd15cab2fcb0f3f61d30577b/agent/src/skills/strategy-generate/SKILL.md at commit 99e84abaad965f75dd15cab2fcb0f3f61d30577b. 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

    1. 01

      Workflow

      1. Requirements parsing: parse user intent, extract instrument codes, time range, and strategy logic, then write config.json 2. Strategy design: think through the 5 questions of data / signal / position sizing / backtest / validation 3. Strategy coding: write code/signalengine.p…

      Requirements parsing: parse user intent, extract instrument codes, time range, and strategy logic, then write config.jsonStrategy design: think through the 5 questions of data / signal / position sizing / backtest / validationStrategy coding: write code/signalengine.py (following the SignalEngine contract)
    2. 02

      Review Criteria

      1. artifacts/metrics.csv exists and is non-empty 2. artifacts/equity.csv exists and is non-empty 3. exitcode == 0 (backtest exits normally) 4. The equity column in equity.csv contains no NaN values 5. tradecount 0 (zero trades = signal bug)

      artifacts/metrics.csv exists and is non-emptyartifacts/equity.csv exists and is non-emptyexitcode == 0 (backtest exits normally)
    3. 03

      Requirements Parsing

      Extract the following from the user's description: - Instrument codes: process them according to the normalization rules below - Time range: if the user does not specify dates, default to 10 years back from today (for example, if today is 2026-03-18, then startdate=2016-03-18, e…

      Instrument codes: process them according to the normalization rules belowTime range: if the user does not specify dates, default to 10 years back from today (for example, if today is 2026-03-18, then startdate=2016-03-18, enddate=2026-03-18)Strategy logic: entry / exit conditions and indicator parameters
    4. 04

      Strategy Design

      Before writing code, think through these 5 questions:

      Data requirements: what fields are needed (basic OHLCV only, daily valuation fields such as pe/pb/roe, or statement fields such as incometotalrevenue / finaindicatorroe?), data frequency (daily), and market (which deter…Signal logic: what are the entry conditions? What are the exit conditions? Direction (long / short / long-short)? Are there filters (volume, trend confirmation, and so on)?Position management: equal-weight allocation or scaling in/out? Risk control (stop-loss, maximum position)? In portfolio strategies, once top N names are selected, each weight = 1/N
    5. 05

      SignalEngine Contract

      Hard constraints: - The signal Series index must align exactly with the input DataFrame index - Include all required imports (numpy, pandas, and so on) - Do not hardcode dates or stock codes (read them from config.json) - Do not include an if name == "main" block - Pure pandas /…

      The signal Series index must align exactly with the input DataFrame indexInclude all required imports (numpy, pandas, and so on)Do not hardcode dates or stock codes (read them from config.json)

    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

    EvidenceSourceComputedTestedEditorial
    SignalValueEvidence typeMeaning
    Quality score99/100ComputedDocumentation, specificity, maintenance, and trust rules
    Repository stars31,651SourceRepository attention, not individual Skill quality
    Compatibility0 platformsSourceDeclared in the catalog source record
    Usage guidetested outcome pageTestedGenerated or reviewed according to the visible evidence level

    Pinned source

    Provenance and original SKILL.md

    Repository
    HKUDS/Vibe-Trading
    Skill path
    agent/src/skills/strategy-generate/SKILL.md
    Commit
    99e84abaad965f75dd15cab2fcb0f3f61d30577b
    License
    MIT
    Collected
    2026-08-25
    Default branch
    main
    View the original SKILL.md

    Workflow

    1. Requirements parsing: parse user intent, extract instrument codes, time range, and strategy logic, then write config.json
    2. Strategy design: think through the 5 questions of data / signal / position sizing / backtest / validation
    3. Strategy coding: write code/signal_engine.py (following the SignalEngine contract)
    4. Syntax check: bash("python -c \"import ast; ast.parse(open('code/signal_engine.py').read()); print('OK')\"")
    5. Run backtest: call the backtest tool (built into the engine; no need to write run_backtest.py)
    6. Evaluate results: read artifacts/metrics.csv and judge by the review criteria
    7. Iterative fixing: if results are poor, modify with edit_file → run backtest → re-evaluate

    You only need to write signal_engine.py and config.json. The backtest tool automatically handles data loading and backtest execution.

    Requirements Parsing

    Extract the following from the user's description:

    • Instrument codes: process them according to the normalization rules below
    • Time range: if the user does not specify dates, default to 10 years back from today (for example, if today is 2026-03-18, then start_date=2016-03-18, end_date=2026-03-18)
    • Strategy logic: entry / exit conditions and indicator parameters

    If critical information is missing, you must ask the user instead of guessing:

    • Instrument not specified → ask which instrument they want to backtest (offer several popular suggestions)
    • Strategy description is vague (for example, "help me build a strategy") → provide 2-3 strategy directions for the user to choose from
    • Mixed markets but not clearly specified → confirm the data source

    Write config.json first, then write code. config.json must be placed in the root of run_dir.

    Strategy Design

    Before writing code, think through these 5 questions:

    1. Data requirements: what fields are needed (basic OHLCV only, daily valuation fields such as pe/pb/roe, or statement fields such as income_total_revenue / fina_indicator_roe?), data frequency (daily), and market (which determines the data source)
    2. Signal logic: what are the entry conditions? What are the exit conditions? Direction (long / short / long-short)? Are there filters (volume, trend confirmation, and so on)?
    3. Position management: equal-weight allocation or scaling in/out? Risk control (stop-loss, maximum position)? In portfolio strategies, once top N names are selected, each weight = 1/N
    4. Backtest parameters: time range, initial capital (default 1,000,000), commission (default 0.1%)
    5. Validation checklist: signal consistency (no NaN signals), position check (normalized to prevent leverage), and completeness of generated artifacts

    There is no need to output a JSON design document. Express these design decisions directly in code.

    SignalEngine Contract

    class SignalEngine:
        def generate(self, data_map: Dict[str, pd.DataFrame]) -> Dict[str, pd.Series]:
            """
            Args:
                data_map: code -> DataFrame (columns: open, high, low, close, volume, DatetimeIndex)
                         If config.extra_fields is specified, pe, pb, roe, and similar daily_basic columns will also be present.
                         If config.fundamental_fields is specified, PIT-safe statement columns such as
                         income_total_revenue, income_n_income, and fina_indicator_roe will also be present.
            Returns:
                code -> signal Series, value range [-1.0, 1.0]
                1.0 = fully long, 0.5 = half position, 0.0 = flat, -1.0 = fully short
                Portfolio strategy: selected stocks split weights equally (for example top 10 -> each 0.1)
                Legacy integer signals {-1, 0, 1} remain compatible (treated as -100% / 0% / 100%)
            """
    

    Hard constraints:

    • The signal Series index must align exactly with the input DataFrame index
    • Include all required imports (numpy, pandas, and so on)
    • Do not hardcode dates or stock codes (read them from config.json)
    • Do not include an if __name__ == "__main__" block
    • Pure pandas / numpy implementation, with no external signal libraries
    • Output plain Python code, not Markdown fences

    Quality Checklist

    Self-check after writing signal_engine.py:

    • All imports are included (numpy, pandas, typing, and so on)
    • No undefined variables
    • Signal logic is consistent with the strategy description
    • Boundary handling: for empty data or insufficient history before the lookback window, use fillna(0) or skip
    • Portfolio strategy: once N stocks are selected, each weight = 1/N (for example top 10 → each 0.1), unselected names = 0
    • Signal values stay within [-1.0, 1.0]

    Instrument Code Normalization

    • 6-digit China A-share codes → automatically append suffix: codes starting with 600/601/603.SH, all others → .SZ
    • US stocks: uppercase letters + .US, such as AAPL.US (yfinance converts automatically)
    • Hong Kong stocks: digits + .HK, such as 700.HK (yfinance converts automatically)
    • Canadian stocks: Yahoo ticker + .TO for TSX or .V for TSXV, such as TD.TO or PNG.V
    • Cryptocurrencies: BTC-USDT format (OKX spot pairs, must use the hyphen -, not slash /)
      • The user may write BTC/USDT, but config.json must use "BTC-USDT"

    Cryptocurrency Notes

    • Code format: must be XXX-USDT (uppercase + hyphen), such as BTC-USDT and ETH-USDT
    • source: must be set to "okx"
    • extra_fields: must be null (OKX does not support fundamentals)
    • Data format: DataLoader has already normalized the output to match China A-shares exactly: open, high, low, close, volume + DatetimeIndex
    • No special handling needed in strategy code: signal_engine.py should be written the same way as for China A-shares; do not add extra data conversion for OKX

    Market Detection and Data Sources

    PatternMarketsourceExtra Fields
    ^\d{6}\.(SZ|SH|BJ)$China A-sharestushareextra_fields: pe, pb, pe_ttm, ps_ttm, dv_ttm, total_mv, circ_mv, roe; fundamental_fields: income/balancesheet/cashflow/fina_indicator
    ^[A-Z]+\.US$US stocksyfinance-
    ^\d{3,5}\.HK$Hong Kong stocksyfinance-
    ^[A-Z0-9&.-]+\.(TO|V)$Canadian stocks (TSX / TSXV)yahoo / yfinance-
    ^[A-Z]+-USDT$Cryptocurrencyokx-

    extra_fields selection logic: only China A-shares (tushare) support daily valuation fields. If the strategy needs PE/PB/ROE and similar daily_basic fields, specify them in config.json.extra_fields and DataLoader will retrieve them automatically. Hong Kong, US, Canadian stocks, and crypto do not support extra_fields.

    fundamental_fields selection logic: use this for China A-share financial statement pre-filters. The runner queries income, balancesheet, cashflow, and/or fina_indicator through the Tushare fundamental provider, then merges rows into daily bars only after their announcement/disclosure date. Output columns are prefixed by table name, for example income_total_revenue, income_n_income, balancesheet_total_hldr_eqy_exc_min_int, and fina_indicator_roe.

    config.json Format

    {
      "source": "auto",
      "codes": ["000001.SZ"],
      "start_date": "2016-03-18",
      "end_date": "2026-03-18",
      "interval": "1D",
      "initial_cash": 1000000,
      "commission": 0.001,
      "extra_fields": null,
      "fundamental_fields": null,
      "optimizer": null,
      "optimizer_params": {},
      "engine": "daily",
      "position_adjustment": "rebalance",
      "rebalance_tolerance": 0.05,
      "validation": null
    }
    
    • source: "auto" (recommended, auto-select by code format) / "tushare" / "yfinance" / "okx" / "akshare" / "ccxt"
      • "auto" supports mixed instruments. For example, ["000001.SZ", "BTC-USDT"] will be automatically routed to tushare and okx
      • Futures codes (e.g. "IF2406.CFFEX", "ESZ4") and forex pairs (e.g. "EUR/USD") are also auto-routed
    • interval: candlestick interval, default "1D". Supported values: "1m" / "5m" / "15m" / "30m" / "1H" / "4H" / "1D"
      • The annualization factor for minute backtests is inferred automatically from source (252 trading days for China A-shares, 365 calendar days for crypto)
      • Minute backtests can be very data-heavy. Recommended limits are no more than 30 days for 1m, or 1 year for 1H
    • extra_fields: China A-shares can use values such as ["pe", "pb", "roe"]; other markets should use null
    • fundamental_fields: optional China A-share statement fields, such as {"income": ["total_revenue", "n_income"], "fina_indicator": ["roe"]}; use null unless the strategy needs financial statement pre-filtering
    • optimizer: optional, one of "equal_volatility" / "risk_parity" / "mean_variance" / "max_diversification" / "turnover_aware" / null (equal-weight by default)
    • optimizer_params: optimizer parameters, such as {"lookback": 60}. mean_variance additionally supports {"risk_free": 0.0}; turnover_aware supports {"risk_aversion": 1.0, "turnover_penalty": 0.5} (L1 penalty on weight changes; tune to data frequency)
    • engine: backtest engine, default "daily". For options strategies, set "options" (requires OptionsSignalEngine)
    • position_adjustment: always state this explicitly — the two modes produce different books from the same signals, and neither is right for every strategy.
      • "rebalance" executes every target change with market fills and weighted-average entry accounting. It also re-sizes whenever the held weight has drifted from the target, and a strategy restates its target on every bar, so a constant target means a fill on every bar: measured on a 40-bar rising series, a constant 20% target produced 40 fills instead of 1, with the fees, slippage and transaction taxes that follow. A strategy that rebalances on its own schedule (e.g. rebalance_freq=20) will still trade daily here.
      • "hold" keeps a same-direction position until it exits or reverses, so the weight drifts with price and a requested resize is not executed. Dropped requests are counted in the report as dropped_target_adjustment_count, with the first twenty listed, so a rebalance count that does not match the trade log is explained rather than silent.
      • Rule of thumb: "rebalance" when the target weight itself carries the strategy (optimizers, risk budgets, continuous scaling); "hold" when entries and exits carry it and the weight in between is incidental.
    • rebalance_tolerance: drift band around the target, as a fraction of it, used only under "rebalance". A resize executes once the held weight has moved further than this from its target; a changed target breaches any sane band on its own, so target changes always execute. Default 0.0 means no band, and then the resize test is decided by the slippage width alone — measured on a constant 20% target over 60 bars, 0.0 produced 60 fills, 0.02 produced 12, and 0.05 produced 5 while the weight never left 0.21. State it for any strategy with its own rebalance cadence, otherwise a rebalance_freq=20 strategy still trades every bar. 0.05 is a reasonable starting point, not a recommendation with evidence behind it — it is your modelling choice and the report records the value the run used.
    • initial_cash: default 1,000,000
    • commission: default 0.1%
    • validation: optional statistical validation after backtest completes. Omit to skip. Example:
      "validation": {
        "monte_carlo": {"n_simulations": 1000},
        "bootstrap": {"n_bootstrap": 1000, "confidence": 0.95},
        "walk_forward": {"n_windows": 5}
      }
      
      • monte_carlo: permutation test — shuffles trade order to compute p-value (is Sharpe significantly better than random?)
      • bootstrap: resamples daily returns to compute Sharpe 95% confidence interval
      • walk_forward: splits equity curve into N windows, checks performance consistency
      • Each key is optional — include only the validations you want
      • Can also run standalone on past results: python -m backtest.validation <run_dir>

    Review Criteria

    Hard Gates (any failure → passed=false)

    1. artifacts/metrics.csv exists and is non-empty
    2. artifacts/equity.csv exists and is non-empty
    3. exit_code == 0 (backtest exits normally)
    4. The equity column in equity.csv contains no NaN values
    5. trade_count > 0 (zero trades = signal bug)

    Scoring Rules

    • Successful backtest + complete artifacts + at least 1 trade → score ≥ 60passed
    • Poor return / low Sharpe alone should not push the score below 60; they are optimization suggestions only
    • score ≥ 60 = passed=true

    Bug Categories (reduce the score)

    1. Zero trades (trade_count=0): signal-logic bug, conditions may be too strict
    2. Late first trade (first trade > 2 years after backtest start): data-filtering bug or overly long lookback window
    3. Capital utilization < 50%: position-management bug, portfolio is flat most of the time
    4. Open position at the end (positions still open when backtest ends): exit-signal timing bug

    action_items Format

    If improvements are needed after evaluation, write action_items:

    • Format: "Change X from A to B" or "Add X logic in signal_engine.py"
    • Must be specific down to parameter values, file names, and function names
    • At least 2 items
    • Examples:
      • "Change short MA from 5 to 10 days to reduce whipsaw signals"
      • "Add stop-loss: force close when loss exceeds 5%"
      • "Add volume filter in signal_engine.py: only trigger buy on high volume"

    Cross-Market Strategies

    When the user requests a backtest with codes from different markets (e.g. ["000001.SZ", "BTC-USDT"]):

    • Set source: "auto" in config.json
    • The CompositeEngine handles calendar alignment, shared capital, and per-market rules automatically
    • Use volatility-adjusted weights so high-vol assets (crypto) don't dominate the risk budget
    • See the cross-market-strategy skill for per-market parameters, vol-adjustment, and example code

    Supporting Files

    Frequently asked questions

    What to verify before installation and use

    What does the strategy-generate source document cover?

    1. Requirements parsing: parse user intent, extract instrument codes, time range, and strategy logic, then write config.json 2. Strategy design: think through the 5 questions of data / signal / position sizing / backtest / validation 3. Strategy coding: write code/signalengine.p…

    How do I install strategy-generate?

    The source record exposes this install command: npx skills add https://github.com/HKUDS/Vibe-Trading --skill "agent/src/skills/strategy-generate". Inspect the command and pinned source before running it.

    Alternatives

    Compare before choosing

    Computed 100147

    oaustegard/claude-skills

    featuring

    Generate hierarchical _FEATURES.md files that describe what a codebase DOES from a user/consumer perspective, anchored to source symbols via tree-sitting. Supports large complex codebases through feature-driven decomposition into sub-feature files. Uses a multi-pass synthesis: orientation → detail → overview rewrite. Use when someone says "what does this do", "document features", "feature inventory", "_FEATURES.md", or needs to understand a codebase's purpose before modifying it. Complements tre

    Computed 9980

    vasilyu1983/AI-Agents-public

    qa-testing-ios

    Guides iOS testing with XCTest, XCUITest, Swift Testing, simctl, and xcresult. Use when choosing destinations, controlling flakes, or parsing test artifacts for native apps.

    Computed 9965

    brucesongs/kali-claw

    insecure-design

    Insecure Design (OWASP A06:2025) focuses on security flaws in system architecture and design phases, rather than code implementation-level bugs.

    Computed 9916

    NintendaDev/unikit-ai

    unikit-docs

    Generate and maintain the project's TECHNICAL documentation from its codebase — scans the project structure, tech stack, and module boundaries, then writes a lean README landing page plus detailed topic pages (architecture, modules, setup, build, APIs), only the docs that are relevant. Use whenever the user wants to create, update, or validate documentation of the CODE or the project itself, e.g. "generate documentation", "create docs", "write the README", "update the project docs", "document th