mcpbeat Sign in

Residual Edge Analyzer Skill for Claude

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.

21k tokens
context cost
the whole folder, loaded on every use
7
files
ships runnable scripts
0
copies elsewhere
how many repositories repackaged it
2557
stars on the repo
on the repository, not the skill itself

Install

one command, takes just this skill from the repository
npx skills add https://github.com/tradermonty/claude-trading-skills --skill residual-edge-analyzer

The instruction itself

11 sections, as written by the author

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

references/input-contract.md.

  • 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

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.

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:

  • primary and sensitivity-model status;
  • annualized alpha and HAC t-stat;
  • residual edge ratio and residual autocorrelation;
  • rolling alpha stability;
  • VIF for multi-factor models;
  • 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.

Other skills for the same job

different authors, same section of the catalogue
XLSX
by anthropics
vendor ×15

Comprehensive spreadsheet creation, editing, and analysis with support for formulas, formatting, data analysis, and visualization. When Claude needs to work with spreadsheets (.xlsx, .xlsm, .csv, .tsv, etc) for: (1) Creating new spreadsheets with formulas and formatting, (2) Reading or analyzing data, (3) Modify existing spreadsheets while preserving formulas, (4) Data analysis and visualization in spreadsheets, or (5) Recalculating formulas

5k tokens scripts
XLSX
by w95
×7

Use this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing .xlsx, .xlsm, .csv, or .tsv file (e.g., adding columns, computing formulas, formatting, charting, cleaning messy data); create a new spreadsheet from scratch or from other data sources; or convert between tabular file formats. Trigger especially when the user references a spreadsheet file by name or path — even casually (like \"the xlsx in my downloads\") — and wants something done to it or produced from it. Also trigger for cleaning or restructuring messy tabular data files (malformed rows, misplaced headers, junk data) into proper spreadsheets. The deliverable must be a spreadsheet file. Do NOT trigger when the primary deliverable is a Word document, HTML report, standalone Python script, database pipeline, or Google Sheets API integration, even if tabular data is involved.

3k tokens
Raffle Winner Picker
by frostant
×5

Picks random winners from lists, spreadsheets, or Google Sheets for giveaways, raffles, and contests. Ensures fair, unbiased selection with transparency.

949 tokens
Fda Database
by christophacham
×4

Query openFDA API for drugs, devices, adverse events, recalls, regulatory submissions (510k, PMA), substance identification (UNII), for FDA regulatory data analysis and safety research.

32k tokens scripts
Matlab
by christophacham
×4

MATLAB and GNU Octave numerical computing for matrix operations, data analysis, visualization, and scientific computing. Use when writing MATLAB/Octave scripts for linear algebra, signal processing, image processing, differential equations, optimization, statistics, or creating scientific visualizations. Also use when the user needs help with MATLAB syntax, functions, or wants to convert between MATLAB and Python code. Scripts can be executed with MATLAB or the open-source GNU Octave interpreter.

25k tokens
Umap Learn
by ComeOnOliver
×4

UMAP dimensionality reduction. Fast nonlinear manifold learning for 2D/3D visualization, clustering preprocessing (HDBSCAN), supervised/parametric UMAP, for high-dimensional data.

14k tokens
D3 Viz
by chrisvoncsefalvay
×3

Creating interactive data visualisations using d3.js. This skill should be used when creating custom charts, graphs, network diagrams, geographic visualisations, or any complex SVG-based data visualisation that requires fine-grained control over visual elements, transitions, or interactions. Use this for bespoke visualisations beyond standard charting libraries, whether in React, Vue, Svelte, vanilla JavaScript, or any other environment.

20k tokens
Alphafold Database
by christophacham
×3

Access AlphaFold 200M+ AI-predicted protein structures. Retrieve structures by UniProt ID, download PDB/mmCIF files, analyze confidence metrics (pLDDT, PAE), for drug discovery and structural biology.

7k tokens

How to use it

Copy the folder

Take tradermonty/residual-edge-analyzer from the repository into ~/.claude/skills for personal use, or into .claude/skills inside a project.

Check the name does not clash

The agent identifies a skill by the name field in its header. Two skills with the same name cannot sit side by side — one of them will be ignored.