# Residual Edge Analyzer

Separate a strategy return series into declared baseline exposure and residual edge...

- Repository: https://github.com/tradermonty/claude-trading-skills (3536 stars)
- Category: Engineering
- License: MIT
- Last updated: 2026-11-01
- Runs scripts: yes, review before use

## Install

Claude Code: `npx skills add tradermonty/claude-trading-skills --skill residual-edge-analyzer -g -a claude-code -y`
Codex: `npx skills add tradermonty/claude-trading-skills --skill residual-edge-analyzer -g -a codex -y`
Cursor: `npx skills add tradermonty/claude-trading-skills --skill residual-edge-analyzer -g -a cursor -y`
Gemini CLI: `npx skills add tradermonty/claude-trading-skills --skill residual-edge-analyzer -g -a gemini-cli -y`

## 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.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# 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](https://github.com/tradermonty/claude-trading-skills/blob/main/skills/residual-edge-analyzer/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:

The rest: https://github.com/tradermonty/claude-trading-skills/blob/HEAD/skills/residual-edge-analyzer/SKILL.md
