New to Claude Skills? Learn how to install them →

tradermonty on GitHub

Macro Regime Detector

Free

Identify long-term macro regime transitions for strategic positioning.

Get this skill

Free · Opens the source repo

What Macro Regime Detector does

The Macro Regime Detector skill is designed to analyze macroeconomic conditions and detect structural regime transitions over a 1-2 year horizon. By leveraging cross-asset ratio analysis, this skill assesses various indicators, including market concentration, yield curve dynamics, credit conditions, and sector rotations. It provides insights into whether the market is in a state of concentration, broadening, contraction, inflationary pressures, or transitional phases. This information is crucial for investors and portfolio managers looking to make informed long-term decisions based on macroeconomic trends.

To operate, the skill utilizes a combination of historical data and real-time indicators. It fetches data for multiple ETFs and applies a structured methodology to identify regime shifts. The analysis is conducted using Python scripts that require specific dependencies to be installed. Users can execute the skill by running a straightforward command that initiates the data retrieval process and generates a comprehensive report detailing the current macro regime and transition signals.

The output includes both structured data for programmatic access and a human-readable Markdown report. This report not only summarizes the current regime assessment but also provides a dashboard of transition signals, component details, and recommendations for portfolio positioning. Additionally, users can reference historical regimes to understand past market behaviors in similar contexts. This skill is particularly useful for those who need to assess long-term market positioning based on macroeconomic indicators and trends.

When to use it

Use this skill when you need to understand current macro regimes or anticipate market transitions based on key economic indicators.

When not to use it

This skill is not suitable for short-term trading decisions or for users seeking daily market snapshots.

What you can build with it

Understanding Market Regimes

When analyzing the current state of the market, this skill helps identify whether it is in a concentration or broadening phase.

Long-term Portfolio Strategy

Use the skill to inform strategic portfolio positioning based on macroeconomic indicators and regime shifts.

Historical Context Analysis

When a user seeks to understand how current conditions compare to historical regimes, the skill provides relevant insights.

How to install Macro Regime Detector

View source

1. Install with the skills CLI

npx skills add tradermonty/claude-trading-skills/macro-regime-detector --agent claude-code

2. Or install it manually

Download the skill folder and drop it into ~/.claude/skills/ for all projects, or .claude/skills/ to scope it to one repo. Restart Claude Code so it picks up the new skill.

Anthropic's agentic coding CLI, and the reference implementation of Agent Skills. Drop a skill folder into ~/.claude/skills and Claude Code loads it automatically whenever a task matches the skill's description. Claude Code docs

Inside SKILL.md

Written by tradermonty

Macro Regime Detector

Detect structural macro regime transitions using monthly-frequency cross-asset ratio analysis. This skill identifies 1-2 year regime shifts that inform strategic portfolio positioning.

When to Use

  • User asks about current macro regime or regime transitions
  • User wants to understand structural market rotations (concentration vs broadening)
  • User asks about long-term positioning based on yield curve, credit, or cross-asset signals
  • User references RSP/SPY ratio, IWM/SPY, HYG/LQD, or other cross-asset ratios
  • User wants to assess whether a regime change is underway

Workflow

  1. Load reference documents for methodology context:

    • references/regime_detection_methodology.md
    • references/indicator_interpretation_guide.md
  2. Execute the main analysis script:

    python3 -m pip install -r skills/macro-regime-detector/requirements.txt
    uv run python3 skills/macro-regime-detector/scripts/macro_regime_detector.py --output-dir reports/
    

    This fetches 600 days of data for 9 ETFs. With an FMP key, the client tries FMP first and fetches Treasury rates (~10 API calls total), then falls back to yfinance for unavailable ETF history. Without an FMP key, it runs in yfinance-only mode and uses SHY/TLT as the yield-curve fallback.

    The detector fails closed and writes no report when none of its six components has usable data. Do not treat a missing report or non-zero exit as a valid low-transition regime.

  3. Read the generated Markdown report and present findings to user.

  4. Provide additional context using references/historical_regimes.md when user asks about historical parallels.

Prerequisites

  • Python dependencies (required): install requirements.txt, including yfinance and requests
  • FMP API Key (optional): set FMP_API_KEY or pass --api-key to use FMP and Treasury data before the yfinance/SHY-TLT fallbacks
  • The FMP free tier may not serve every ETF; unavailable symbols automatically use yfinance

6 Components

#ComponentRatio/DataWeightWhat It Detects
1Market ConcentrationRSP/SPY25%Mega-cap concentration vs market broadening
2Yield Curve10Y-2Y spread20%Interest rate cycle transitions
3Credit ConditionsHYG/LQD15%Credit cycle risk appetite
4Size FactorIWM/SPY15%Small vs large cap rotation
5Equity-BondSPY/TLT + correlation15%Stock-bond relationship regime
6Sector RotationXLY/XLP10%Cyclical vs defensive appetite

5 Regime Classifications

  • Concentration: Mega-cap leadership, narrow market
  • Broadening: Expanding participation, small-cap/value rotation
  • Contraction: Credit tightening, defensive rotation, risk-off
  • Inflationary: Positive stock-bond correlation, traditional hedging fails
  • Transitional: Multiple signals but unclear pattern

Output

  • macro_regime_YYYY-MM-DD_HHMMSS.json — Structured data for programmatic use
  • macro_regime_YYYY-MM-DD_HHMMSS.md — Human-readable report with:
    1. Current Regime Assessment
    2. Transition Signal Dashboard
    3. Component Details
    4. Regime Classification Evidence
    5. Portfolio Posture Recommendations

Relationship to Other Skills

AspectMacro Regime DetectorMarket Top DetectorMarket Breadth Analyzer
Time Horizon1-2 years (structural)2-8 weeks (tactical)Current snapshot
Data GranularityMonthly (6M/12M SMA)Daily (25 business days)Daily CSV
Detection TargetRegime transitions10-20% correctionsBreadth health score
API Calls~10~330 (Free CSV)

Script Arguments

python3 macro_regime_detector.py [options]

Options:
  --api-key KEY       FMP API key (default: $FMP_API_KEY)
  --output-dir DIR    Output directory (default: current directory)
  --days N            Days of history to fetch (default: 600)

Resources

  • references/regime_detection_methodology.md — Detection methodology and signal interpretation
  • references/indicator_interpretation_guide.md — Guide for interpreting cross-asset ratios
  • references/historical_regimes.md — Historical regime examples for context

Frequently asked questions about Macro Regime Detector

Similar skills