correlation-crisis

correlation-crisis is a skill for Claude Code from mahmoud20138/Tradecraft. It costs 71 tokens per session (2,277 once invoked), scanned A, original, MIT.

A guide to measuring and managing portfolio risk when assets that usually move differently start moving together during market crises.

In plain words
What is it for?
Use it to study changing correlations, calculate VaR and CVaR, model fat-tailed losses, build regime-based correlation matrices, and choose hedges for different volatility conditions.
Why use it?
It helps reveal when diversification may stop protecting a portfolio and supports stress tests for unusually large losses.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the tradecraft plugin — 58 skills shipped together

Good fit Use it to study changing correlations, calculate VaR and CVaR, model fat-tailed losses, build regime-based correlation matrices, and choose hedges for different volatility conditions.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/mahmoud20138/tradecraft/correlation-crisis
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add mahmoud20138/Tradecraft --skill correlation-crisis
Clone the repo
git clone --depth 1 https://github.com/mahmoud20138/Tradecraft

Made for: Claude Code.

Or install tradecraft, the plugin that ships this one along with the rest of its 58 skills.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for correlation-crisis

README.md
[![agentmods](https://agentmods.dev/badge/skills/mahmoud20138/tradecraft/correlation-crisis/github.svg)](https://agentmods.dev/skills/mahmoud20138/tradecraft/correlation-crisis)
Your own site
<a href="https://agentmods.dev/skills/mahmoud20138/tradecraft/correlation-crisis"><img src="https://agentmods.dev/badge/skills/mahmoud20138/tradecraft/correlation-crisis/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for correlation-crisis

Your own site · 80×15
<a href="https://agentmods.dev/skills/mahmoud20138/tradecraft/correlation-crisis"><img src="https://agentmods.dev/badge/skills/mahmoud20138/tradecraft/correlation-crisis.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 71 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,277 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00071 $0.02277
Opus 5 $0.00036 $0.01138
Sonnet 5 $0.00014 $0.00455
Haiku 4.5 $0.00007 $0.00228

Measured 11d ago against content hash e4f8bc3a896f, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade A, and why

correlation-crisis scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 11d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugins/tradecraft/skills/correlation-crisis/SKILL.md · 248 lines

How it starts

The opening of the file, as written. The whole thing — 248 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Skill: Correlation Crisis & Tail Risk | Domain: trading/risk-and-portfolio | Category: risk | Level: advanced Tags: correlation, tail-risk, hedging, crisis, regime, diversification

Correlation Crisis & Tail Risk

1. The Correlation Problem

Normal Times vs Crisis

NORMAL REGIME (VIX < 20):
  Correlations are moderate and stable
  Diversification works as expected
  Asset A: +1%  Asset B: -0.3%  Asset C: +0.5%
  Portfolio: smoothed returns ✓

CRISIS REGIME (VIX > 30):
  Correlations spike toward 1.0
  "All correlations go to 1 in a crash"
  Asset A: -5%  Asset B: -4%  Asset C: -6%
  Portfolio: concentrated loss ✗

  Exception: USD, Treasuries, Gold often decouple
  (but not always — March 2020 everything sold)

Correlation Is Not Constant

def rolling_correlation(asset_a: pd.Series, asset_b: pd.Series,
                        window: int = 60) -> pd.Series:
    """60-day rolling correlation reveals regime shifts."""
    return asset_a.rolling(window).corr(asset_b)

# Key insight: when rolling correlation breaks out of its
# historical range, regime change is likely in progress

2. Measuring Tail Risk

Beyond Standard Deviation

Standard deviation assumes normal distribution.
Markets have fat tails. Use:

1. Value at Risk (VaR)
   - 95% VaR: "I expect to lose no more than X on 95% of days"
   - Limitation: says nothing about the worst 5%

2. Conditional VaR (CVaR / Expected Shortfall)
   - "When I DO exceed VaR, what's my expected loss?"
   - Average of losses beyond VaR threshold
   - This is the metric that matters for tail risk

3. Maximum Drawdown
   - Empirical worst case (so far)
   - Rule of thumb: future MDD ≈ 1.5-2× historical MDD

4. Tail Ratio
   - 95th percentile gain / abs(5th percentile loss)
   - >1.0 = positive skew (good)
   - <1.0 = negative skew (hidden risk)

Fat Tail Detection

from scipy.stats import kurtosis, jarque_bera

def tail_risk_report(returns: pd.Series) -> dict:
    kurt = kurtosis(returns)  # >0 means fat tails
    jb_stat, jb_pval = jarque_bera(returns)

    var_95 = returns.quantile(0.05)
    cvar_95 = returns[returns <= var_95].mean()

    tail_ratio = returns.quantile(0.95) / abs(returns.quantile(0.05))

    return {
        'kurtosis': kurt,           # Normal = 0, fat tails > 3
        'is_normal': jb_pval > 0.05,  # Almost always False for markets
        'var_95': var_95,
        'cvar_95': cvar_95,
        'tail_ratio': tail_ratio,
        'worst_day': returns.min(),
        'best_day': returns.max(),
    }

Read the full file on GitHub · 248 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 11d ago First seen · 248 lines · 71 tokens per session scan A e4f8bc3a896f

Subscribe to this mod's changes

correlation-crisis is a skill published in the GitHub repository mahmoud20138/Tradecraft (15 stars, last pushed 4mo ago), licensed MIT. It adds 71 tokens to every session and 2,277 once invoked, about $0.0004 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

comptable

Comptabilité, fiscalité et facturation pour entreprises françaises. Gère écritures PCG, déclarations TVA, IS/IR, clôture annuelle, liasse fiscale (2033/2065), FEC, états financiers, et chaîne facturation (mentions obligatoires, numérotation, Factur-X/UBL/CII, plateformes agréées PDP/PA, e-reporting, réforme 2026…

romainsimon/paperasse · 143 tokens

fiscaliste

Fiscaliste IA pour la fiscalité personnelle des particuliers français : optimisation et déclaration de l'impôt sur le revenu, IFI, revenus du capital, revenus fonciers, equity salarial, crypto-actifs et PER. Couvre le calcul de l'IR (barème, quotient familial, décote, PAS, CEHR, revenus exceptionnels), la déclaration…

romainsimon/paperasse · 302 tokens

controleur-fiscal

Inspecteur des finances publiques IA. Simule un contrôle fiscal DGFIP complet sur les comptes d'une entreprise française (SASU, EURL, SAS, SARL). Analyse le FEC, la liasse fiscale, les charges déduites, le compte courant d'associé, la TVA, l'IS selon 8 axes de vérification. Identifie les chefs de redressement…

romainsimon/paperasse · 136 tokens

commissaire-aux-comptes

Commissaire aux comptes IA pour l'audit des comptes annuels d'entreprises françaises. Applique la démarche NEP en 7 phases : prise de connaissance, contrôle du FEC, vérification du bilan, du compte de résultat, de la balance, de la liasse fiscale, et contrôles transversaux. Émet une opinion motivée sur la fiabilité…

romainsimon/paperasse · 123 tokens

syndic

Gère un parc de copropriétés en France avec vue portfolio consolidée. Couvre administration, comptabilité (décret 2005, plan comptable copro, 5 annexes), assemblées générales (convocation, PV, notification), appels de fonds, travaux, fournisseurs, recouvrement d'impayés et transition de syndic. Maîtrise les majorités…

romainsimon/paperasse · 194 tokens

invest

First-time fork users: run the invest-setup skill first to initialize. The main flow lives in this skill (the AI agent uses the CLI/MCP to view the portfolio / run the committee / replay decision history). The Web GUI has been retired (2026-07) — every capability is exposed via CLI subcommands / MCP tools. The backend…

longsizhuo/openInvest · 261 tokens