Agent skill

Residual Edge Analyzer

by tradermonty in tradermonty/claude-trading-skills

Separate a strategy return series into declared baseline exposure and residual edge with returns-based OLS attribution, HAC inference, rolling stability, alternate-baseline sensitivity, and regime…

MITAuto-check passedBusiness, Finance & HR

Install Residual Edge Analyzer

skills CLI
$ npx skills add tradermonty/claude-trading-skills --skill residual-edge-analyzer -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install tradermonty/claude-trading-skills residual-edge-analyzer --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/tradermonty/claude-trading-skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/residual-edge-analyzer .claude/skills/residual-edge-analyzer && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
residual-edge-analyzer
GitHub stars
3k
Token cost
~1.5k tokens
SKILL.md length
606 words
Files
8 (incl. scripts, references)
Skills in repo
74
Repo updated
First seen
Licence
MIT

At a glance

Separate a strategy return series into declared baseline exposure and residual edge with returns-based OLS attribution, HAC inference, rolling stability, alternate-baseline sensitivity, and regime…

  • Works in 5 steps: Define the question before inspecting… → Validate the return-series contract → Run the analyzer → …
  • Evaluating whether backtest
  • SKILL.md covers Overview, Prerequisites, Workflow and Boundaries, plus 1 more section
  • Runs Python scripts from its folder; calls python3

What it does

Residual Edge Analyzer is an agent skill from tradermonty/claude-trading-skills. Separate a strategy return series into declared baseline exposure and residual edge with returns-based OLS attribution, HAC inference, rolling stability, alternate-baseline sensitivity, and regime breakdowns. Use when evaluating whether backtest, out-of-sample, or live returns contain independent alpha beyond market, equal-weight, momentum, sector, or user-supplied factor returns; when explaining whether a drawdown came from baseline exposure or strategy-specific behavior; or when a strategy needs an attribution…

Its SKILL.md is about 1.5k tokens, which your agent loads only when the skill is triggered. The skill folder holds 11 other files, including scripts and reference files (for example `agents/openai.yaml`, `references/input-contract.md` and `references/methodology.md`).

It sits in Business, Finance & HR, covering Trading and backtesting and Quality gates. The repository describes itself as: Claude Code skills for equity investors and traders — market analysis, technical charting, economic calendars, screeners, and trading strategy development. The licence is MIT.

When your agent uses it

  • Evaluating whether backtest
  • Live returns contain independent alpha beyond market
  • User-supplied factor returns
  • Explaining whether a drawdown came from baseline exposure

Example prompts

  • “/residual-edge-analyzer”

Requirements

  • Python 3

Workflow steps

5 steps, taken from the step headings in SKILL.md.

  1. Define the question before inspecting results
  2. Validate the return-series contract
  3. Run the analyzer
  4. Interpret the evidence
  5. Hand off findings

What it can do on your machine

Read from SKILL.md and the folder at commit c8d58f0. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Ships 3 files in scripts/ (Python), which the agent can run.

    Shell commands in SKILL.md call:

    • python3

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Residual Edge Analyzer loads about 1.5k tokens when it runs, and up to ~3.4k if it reads all its reference files. Until then it costs about 181 tokens; SKILL.md has 606 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~181
When it runs · the whole SKILL.md, loaded when a task matches
~1.5k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~3.4k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); the scripts in this folder are not scanned.

SKILL.md

The full file from tradermonty/claude-trading-skills at commit c8d58f0, republished under its MIT licence (© tradermonty). 606 words, ~1,490 tokens.

Download SKILL.mdSave it as .claude/skills/residual-edge-analyzer/SKILL.md (or your agent's skills folder). This skill also uses 7 other files; get the full folder from GitHub.
name
residual-edge-analyzer
description
Separate a strategy return series into declared baseline exposure and residual edge with returns-based OLS attribution, HAC inference, rolling stability, alternate-baseline sensitivity, and regime breakdowns. Use when evaluating whether backtest, out-of-sample, or live returns contain independent alpha beyond market, equal-weight, momentum, sector, or user-supplied factor returns; when explaining whether a drawdown came from baseline exposure or strategy-specific behavior; or when a strategy needs an attribution quality gate after backtesting. Do not use for holdings-based Brinson attribution, feature-level Shapley explanations, or analysis from summary metrics without a dated return series.

Residual Edge Analyzer

Overview

Test whether a strategy's apparent performance survives explicit comparison with predeclared baseline return series. Produce an auditable JSON artifact and a concise Markdown report without fetching data or changing trading exposure.

Treat this as a falsification gate after backtest-expert, not as trade authorization.

Prerequisites

  • Use Python 3.9+.
  • Prepare one CSV containing an ISO date, strategy return, and every baseline return on the same row.
  • Prepare a JSON specification following the input contract.
  • Supply actual period returns. Do not substitute CAGR, Sharpe, cumulative P&L, or other summary metrics.

Workflow

1. Define the question before inspecting results

State the claimed independent edge in one sentence. Select a primary baseline that is a plausible simple copy of the strategy, then select at least one alternate baseline model.

Record these declarations in the config:

  • baseline_selection: predeclared
  • strategy_return_basis and baseline_return_basis: both gross or both net
  • analysis_scope: out_of_sample, live, or in_sample
  • universe_data: point_in_time, current_constituents, or not_applicable

Every declaration is mandatory for a decision-grade verdict. Omitting one is treated as undeclared, not as benign, and drops the report to REVIEW_REQUIRED. not_applicable exists so that a baseline with no universe membership can be declared explicitly rather than left blank.

Do not choose a baseline because it gives the preferred residual result.

2. Validate the return-series contract

Require:

  • unique ISO dates;
  • finite numeric returns greater than -100%;
  • identical frequency and cost basis across strategy and baselines;
  • point-in-time membership for same-universe equal-weight or momentum baselines;
  • regime labels defined independently of the loss periods being explained.

Stop if the input lacks a dated strategy return series. Report summary-only input as insufficient rather than inventing observations.

3. Run the analyzer
bash
python3 skills/residual-edge-analyzer/scripts/analyze_residual_edge.py \
  --input reports/strategy_returns.csv \
  --config reports/residual_edge_config.json \
  --output-json reports/residual_edge_report.json \
  --output-markdown reports/residual_edge_report.md

The script runs the predeclared primary model and all sensitivity models in one execution. It uses an intercept OLS model and HAC/Newey-West standard errors. It reports the residual edge ratio as annualized alpha divided by annualized residual volatility; do not calculate a Sharpe ratio from raw OLS residual mean because an intercept makes that mean zero.

Show full SKILL.md (278 more words)Show less
4. Interpret the evidence

Use the four statuses as diagnostic labels:

  • RESIDUAL_EDGE: alpha, residual edge ratio, and rolling stability clear configured thresholds.
  • BASELINE_EXPLAINED: baseline R-squared is high while residual evidence is weak.
  • RESIDUAL_FRAGILE: results fail one or more robustness gates or change across declared baseline models. Also use this status when rolling analysis is disabled, unavailable, incomplete, or no sensitivity model was supplied.
  • INSUFFICIENT_EVIDENCE: the sample is below the configured minimum.

Read decision_eligibility separately. A statistically interesting result remains REVIEW_REQUIRED when critical provenance, cost-basis, sample, or multicollinearity warnings exist, when rolling evidence is unavailable, or when no alternate baseline was tested.

Inspect:

  1. primary and sensitivity-model status;
  2. annualized alpha and HAC t-stat;
  3. residual edge ratio and residual autocorrelation;
  4. rolling alpha stability;
  5. VIF for multi-factor models;
  6. active-return breakdown across predeclared regimes.
5. Hand off findings
  • Send baseline-choice, OOS, and stability findings back to backtest-expert.
  • Send recurring residual failure regimes to signal-postmortem.
  • Pass only evidence and operating constraints to trade-performance-coach.
  • Never change position size, exposure, or orders automatically.

Boundaries

  • Do not call this holdings-based contribution analysis. Brinson allocation, selection, and interaction effects require historical holdings, benchmark weights, and constituent returns.
  • Do not claim stock-selection alpha from a market-index-only baseline.
  • Do not build equal-weight baselines from current constituents and label them point-in-time.
  • Do not interpret in-sample residual edge as confirmed alpha.
  • Do not mine many regime definitions after seeing losses. Predeclare a small set and confirm findings out of sample.
  • Do not assume high R-squared makes a strategy worthless; capacity, tail behavior, costs, and implementation value require separate evidence.

Resources

  • scripts/analyze_residual_edge.py — deterministic CSV-to-JSON/Markdown analyzer.
  • references/input-contract.md — CSV/config contract and runnable example.
  • references/methodology.md — statistical definitions, interpretation, and limitations.

© tradermonty, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 7 other files (scripts, references) in skills/residual-edge-analyzer of tradermonty/claude-trading-skills.

  • SKILL.md
  • agents/openai.yaml
  • references/input-contract.md
  • references/methodology.md
  • requirements.txt
  • scripts/analyze_residual_edge.py
  • scripts/tests/conftest.py
  • scripts/tests/test_analyze_residual_edge.py

Open the folder on GitHubat commit c8d58f0

Compare with similar skills

Residual Edge Analyzer next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Residual Edge Analyzer compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Residual Edge Analyzer this skilltradermonty/claude-trading-skills3k—~1.5kAutomated safety check: PassMIT
Performance Testingfacioquo/stock-indicators-dotnet1.2k—~1.1kAutomated safety check: PassApache-2.0
Tushare Datazillionare/zillionare3222 repos~2.3kAutomated safety check: PassNone
Tradingview MCPatilaahmettaner/tradingview-mcp5k—~1.3kAutomated safety check: PassMIT
Digital Oraclekomako-workshop/digital-oracle878—~5.9kAutomated safety check: PassMIT
Polyclawchainstacklabs/polyclaw3591 repos~2kAutomated safety check: PassApache-2.0

Similar skills

  • Performance Testing

    facioquo/stock-indicators-dotnet

    Benchmark indicators with BenchmarkDotNet in tools/performance — add Series, Buffer, Stream, and style-comparison benchmarks, spot-check one indicator against committed baselines, evaluate the full…

    1.2k GitHub stars~1.1k tokensUpdated yesterday
    Business, Finance & HRAuto-check passed
  • Tushare Data

    zillionare/zillionare

    面向中文自然语言的 Tushare 数据研究技能。用于把“看看这只股票最近怎么样”“帮我查财报趋势”“最近哪个板块最强”“北向资金在买什么”“给我导出一份行情数据”这类请求,转成可执行的数据获取、清洗、对比、筛选、导出与简要分析流程。适用于 A 股、指数、ETF/基金、财务、估值、资金流、公告新闻、板块概念与宏观数据等研究场景。

    322 GitHub starsUsed in 2 repos~2.3k tokens
    Business, Finance & HRAuto-check passed
  • Tradingview MCP

    atilaahmettaner/tradingview-mcp

    AI Trading Intelligence — live prices, 30+ technical indicators, backtesting (6 strategies), walk-forward overfitting detection, trade logs, equity curves, licensed news sentiment (Marketaux), and…

    5k GitHub stars~1.3k tokensUpdated yesterday
    Business, Finance & HRAuto-check passed
  • Digital Oracle

    komako-workshop/digital-oracle

    Answer prediction questions using market trading data, not opinions.

    878 GitHub stars~5.9k tokensUpdated 2 mo ago
    Business, Finance & HRAuto-check passed
  • Polyclaw

    chainstacklabs/polyclaw

    Trade on Polymarket via split + CLOB execution. An agent skill from chainstacklabs/polyclaw.

    359 GitHub starsUsed in 1 repo~2k tokens
    Business, Finance & HRAuto-check passed
  • Markdown

    facioquo/stock-indicators-dotnet

    Format and lint Markdown in this repository against GitHub Flavored Markdown and its markdownlint-cli2 configuration — headers, lists, code fences, callouts (VitePress containers on docs-site pages…

    1.2k GitHub stars~812 tokensUpdated yesterday
    Business, Finance & HRAuto-check passed

More from tradermonty/claude-trading-skills

All 74 skills in this repo
  • Technical Analyst

    tradermonty/claude-trading-skills

    This skill should be used when analyzing weekly price charts for stocks, stock indices, cryptocurrencies, or forex pairs.

    3k GitHub starsUsed in 4 repos~4.6k tokens
    Auto-check passed
  • Theme Detector

    tradermonty/claude-trading-skills

    Detect and analyze trending market themes across sectors. An agent skill from tradermonty/claude-trading-skills.

    3k GitHub starsUsed in 2 repos~4.9k tokens
    Auto-check passed
  • Trader Memory Core

    tradermonty/claude-trading-skills

    Track investment theses across their lifecycle — from screening idea to closed position with postmortem.

    3k GitHub starsUsed in 2 repos~4.3k tokens
    Auto-check passed
  • Edge Strategy Reviewer

    tradermonty/claude-trading-skills

    Critically review strategy drafts from edge-strategy-designer for edge plausibility, overfitting risk, sample size adequacy, and execution realism.

    3k GitHub starsUsed in 1 repo~988 tokens
    Auto-check passed
  • Sector Analyst

    tradermonty/claude-trading-skills

    This skill should be used when analyzing sector rotation patterns and market cycle positioning.

    3k GitHub starsUsed in 1 repo~2.3k tokens
    Auto-check passed
  • Stanley Druckenmiller Investment

    tradermonty/claude-trading-skills

    Druckenmiller Strategy Synthesizer - Integrates 8 upstream skill outputs (Market Breadth, Uptrend Analysis, Market Top, Macro Regime, FTD Detector, VCP Screener, Theme Detector, CANSLIM Screener)…

    3k GitHub starsUsed in 1 repo~2k tokens
    Auto-check passed

Questions about Residual Edge Analyzer

What does Residual Edge Analyzer do?

Separate a strategy return series into declared baseline exposure and residual edge with returns-based OLS attribution, HAC inference, rolling stability, alternate-baseline sensitivity, and regime…. Residual Edge Analyzer is an agent skill from tradermonty/claude-trading-skills. Separate a strategy return series into declared baseline exposure and residual edge with returns-based OLS attribution, HAC inference, rolling stability, alternate-baseline sensitivity, and regime breakdowns.

When should I use Residual Edge Analyzer?

Residual Edge Analyzer fits situations like: evaluating whether backtest; live returns contain independent alpha beyond market; user-supplied factor returns; explaining whether a drawdown came from baseline exposure.

How do I install Residual Edge Analyzer in Claude Code?

Run `npx skills add tradermonty/claude-trading-skills --skill residual-edge-analyzer -a claude-code`. Or copy the skill folder (skills/residual-edge-analyzer in tradermonty/claude-trading-skills) into .claude/skills/residual-edge-analyzer in your project. Claude Code loads it when a task matches its description.

How do I install Residual Edge Analyzer in Codex?

Run `npx skills add tradermonty/claude-trading-skills --skill residual-edge-analyzer -a codex`. Or copy the skill folder (skills/residual-edge-analyzer in tradermonty/claude-trading-skills) into .agents/skills/residual-edge-analyzer in your project. Codex loads it when a task matches its description.

Can I use Residual Edge Analyzer in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add tradermonty/claude-trading-skills --skill residual-edge-analyzer -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/residual-edge-analyzer, .gemini/skills/residual-edge-analyzer, .github/skills/residual-edge-analyzer and .opencode/skills/residual-edge-analyzer in your project.

What does Residual Edge Analyzer need to run?

Going by SKILL.md and its folder, Residual Edge Analyzer needs Python for the scripts in its folder and the command-line tools its instructions call (python3). Our summary lists: Python 3.

Does Residual Edge Analyzer access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Residual Edge Analyzer safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. The check reads SKILL.md only: the scripts in the folder are not scanned, so read them before running anything.

What licence does Residual Edge Analyzer use?

Residual Edge Analyzer is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Residual Edge Analyzer use?

About 1.5k tokens (SKILL.md is roughly 6k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 1.9k tokens, read only when the agent opens those files.

What are the alternatives to Residual Edge Analyzer?

Skills that share tags, products or a category with Residual Edge Analyzer: Performance Testing (facioquo/stock-indicators-dotnet, 1.2k stars), Tushare Data (zillionare/zillionare, 322 stars), Tradingview MCP (atilaahmettaner/tradingview-mcp, 5k stars) and Digital Oracle (komako-workshop/digital-oracle, 878 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Residual Edge Analyzer?

tradermonty (a GitHub user) maintains it in tradermonty/claude-trading-skills, which has 2,982 GitHub stars. The repository holds 74 skills in this directory. The repository was last updated on October 11, 2026.

Source: tradermonty/claude-trading-skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.