Skip to main content
skill CX Codex

macro-regime — Claude Code skill for India’s market regime

The macro-regime Claude Code skill classifies the structural regime of Indian equities from monthly market and macro data. It runs for questions about breadth, rates, the rupee, or crude.

MIT ★ 69 updated 2026-11-13

Install into Claude Code · Plugin marketplace All methods and platforms ↓
/plugin marketplace add Shubhamkumartrichy/claude-trading-skills-india
/plugin install india-trading-skills@india-trading-skills
Open on GitHub

What macro-regime does

The skill reads monthly indicators for Indian equities and assigns a regime such as Broadening, Risk-off, or Easing. It compares equal-weight or small-cap performance with NIFTY and tracks banks, cyclical and defensive groups, gold, bond yields, USD/INR, Brent, and India VIX. Each series gets a 6- versus 12-month moving-average state and a date for its latest turn.

The output includes the regime label and supporting evidence, a count of components that turned, market tilts, and the readings that could change the label. The macro.py script can work offline with CSV files. Fetching data with --fetch, or running without --csv-dir, requires yfinance, installed with pip install yfinance; that download path will not run without the package.

What it helps with

  • identify whether participation in the market advance is broadening
  • compare small-cap performance with NIFTY
  • check the state of India’s yield curve
  • assess how crude and the rupee align with the market regime

Example prompts for the agent

  • Classify the current structural regime for Indian equities from monthly data.
  • Check whether small caps are leading NIFTY and market breadth is improving.
  • Show India’s yield-curve state and the readings that could change the regime.

How to install macro-regime

1Plugin marketplace

/plugin marketplace add Shubhamkumartrichy/claude-trading-skills-india
/plugin install india-trading-skills@india-trading-skills

This installs the whole india-trading-skills plugin with all its skills

2Skills CLI (Vercel)

npx skills add Shubhamkumartrichy/claude-trading-skills-india --skill macro-regime -a claude-code

3Manually: put the files in place

~/.claude/skills/macro-regime/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/macro-regime/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about macro-regime

How do I install macro-regime in Claude Code?

Add the marketplace with /plugin marketplace add Shubhamkumartrichy/claude-trading-skills-india, then install the skill with /plugin install india-trading-skills@india-trading-skills.

What does macro-regime do?

It classifies Indian equities using monthly market and macro series, then reports supporting signals, market tilts, and readings that could change the label.

What does macro-regime need to run?

Offline analysis uses CSV files. Fetching data with --fetch, or running without --csv-dir, requires Python 3 and yfinance, installed with pip install yfinance.

Source text

SKILL.md · MIT
---
name: macro-regime
description: |
  Structural (6–24 month) macro regime for Indian equities from monthly cross-asset lines: equal
  weight or smallcap vs NIFTY (broadening), size, NIFTY Bank leadership, cyclicals vs defensives,
  NIFTY vs gold in rupees, India 10-year G-sec and the yield curve (10y minus T-bill or repo),
  USD/INR, Brent, the US 10-year and India VIX. Each line gets a 6- vs 12-month crossover state
  and its last turn. Output: a regime label (Broadening, Narrow, Inflationary squeeze, Easing,
  Risk-off, Transitional) with evidence, an "N of M turned" count, tilts and what would flip it.
  macro.py works offline from CSVs.

  Use when the user asks: "what is the macro regime", "is the market broadening or narrowing",
  "are smallcaps leading", "is the yield curve inverted in India", "how do crude and the rupee
  affect the market", "is RBI easing helping stocks", "equity vs gold", "should I tilt to
  defensives this year", "big-picture positioning", or before a quarterly allocation review.
---

# Macro Regime (India)

**Not the same as `market-regime`.** That skill reads NIFTY's daily tape (distribution days,
follow-through) over a horizon of weeks and sets the exposure ceiling. This one works on month-end
data over 6–24 months. It asks which kind of market India is in (who leads, and whether crude, the
rupee and rates are helping or hurting) and changes only a few times per cycle. Use it for the
quarterly allocation tilt, then let the faster skills time entries inside it.

## Commands

```bash
python3 scripts/macro.py series                                    # file names, tickers, sources
python3 scripts/macro.py status --csv-dir macro_data/              # label, evidence, table, tilts
python3 scripts/macro.py status --csv-dir yields/ --fetch --json   # CSVs for yields, Yahoo for the rest
python3 scripts/macro.py history --csv-dir macro_data/ --months 36
python3 scripts/macro.py component curve --csv-dir macro_data/     # one gauge month by month
```
Flags: `--as-of YYYY-MM[-DD]` (replay), `--closed-months` (drop the month in progress), `--fast 6`,
`--slow 12`, `--recent 3` (turn window), `--band-pct 0.25` / `--band-bp 5` (dead band),
`--ticker KEY=TICKER`, `--period 10y`, `--json` (strict JSON). Loader helpers are shared with
`../technical-analysis/scripts/ta.py`. Errors print one `error:` line and exit 2.

## Inputs: one CSV per series, any subset

A date column plus a close/price/yield column is enough. Daily, weekly or monthly rows all work
(the last value of each month is used). Null rows are skipped. Investing.com exports (MM/DD/YYYY,
"Price" column) are detected from the whole file. Name each file after the series key or label
(`series` lists the aliases).

| Key | Series | Yahoo | Status | Where else |
|---|---|---|---|---|
| NIFTY, BANK | NIFTY 50, NIFTY Bank | ^NSEI, ^NSEBANK | confirmed | niftyindices.com historical data |
| SMALLCAP, MIDCAP | Smallcap 250, Midcap 150 | NIFTYSMLCAP250.NS, NIFTYMIDCAP150.NS | confirmed | niftyindices.com |
| EQUALWEIGHT | NIFTY50 Equal Weight | — | csv-only | niftyindices.com strategy indices |
| FMCG, PHARMA / METAL, REALTY, PSUBANK | defensive / cyclical baskets | ^CNXFMCG ... ^CNXPSUBANK | confirmed | niftyindices.com |
| GOLD | GOLDBEES (gold in ₹) | GOLDBEES.NS | unconfirmed | broker history, MCX or IBJA prices |
| IN10Y | India 10-year G-sec yield | — | csv-only | RBI DBIE, CCIL/FBIL, Investing.com export |
| SHORT | 91-day T-bill or repo rate | — | csv-only | RBI DBIE, FBIL; a repo file needs only change dates |
| USDINR | USD/INR | INR=X (or USDINR=X) | unconfirmed | RBI/FBIL reference rate |
| BRENT | Brent crude | BZ=F | unconfirmed | EIA, Investing.com |
| US10Y | US 10-year | ^TNX | unconfirmed | FRED DGS10 |
| VIX | India VIX | ^INDIAVIX | unconfirmed | nseindia.com historical VIX |

"Confirmed" means daily history was served in this pack's 2026-10-31 Yahoo probe (shared with
`sector-rotation`). "Unconfirmed" tickers are the usual symbols, but Yahoo rate-limited (HTTP 429)
the 2026-11-12 check, so they were not verified. Use `--ticker` or a CSV if one fails. G-sec yields
are not on Yahoo. `--fetch` (or no `--csv-dir`) needs `pip install yfinance`.

## Method

1. Month-end values. One missing month is bridged; a longer hole drops older data (with a warning).
   A repo series is carried forward between policy changes. Ten lines: price ratios (concentration, size, banks, cyclical/defensive baskets, NIFTY/gold) and
   levels (10-year, USD/INR, Brent, US 10-year, VIX). Baskets are equal-weight after rebasing to
   100. Without equal weight, smallcap/NIFTY becomes the concentration line and midcap/NIFTY the
   size line, so no ratio is counted twice.
2. State = 6-month SMA vs 12-month SMA of the line, with a dead band (0.25% for ratios, 5bp for
   yields). A **turn** is a change of direction, dated by the month it happened. A fitted 6-month
   slope labels the trend as running or fading (for example "rising, fading"). 6- and 12-month
   changes are shown in % (or bp for yields).
3. Curve = 10y minus the short rate, with the same crossover (steepening/flattening; bull or bear
   from the 10y direction), plus an **inversion flag** with the start month.
4. Transition count: "N of M components turned in the last 3 months". 0 = stable, under 25% =
   isolated, 25–50% = rotation building, 50% or more = broad transition. It is a tally, not a
   probability. The month in progress is flagged as provisional.

## Regime labels (the first one that matches is the headline; others are listed as "also matching")

| Label | Rule | Tends to favour / hurt (tendencies, not predictions) |
|---|---|---|
| Inflationary squeeze | ≥2 of Brent, USD/INR, 10y rising, none falling | IT and pharma exporters, upstream oil, gold, short debt / OMCs, paints, aviation, NBFCs, realty |
| Risk-off / contraction | ≥3 equity ratios falling incl. NIFTY/gold (cyc/def if no gold); 2 if VIX ≥22 | FMCG, pharma, gold, cash / smallcaps, PSU banks, metals, leverage |
| Broadening risk-on | concentration/size rising, none falling, ≥60% of equity ratios rising | mid/small caps, capex, PSU banks, metals / defensives, gold weight |
| Narrow / concentrated | breadth pair falling, none rising | heavyweights, large-cap quality / small-cap breakouts |
| Easing tailwind | 10y falling + a backer (steepening curve, crude down, US yields down, firmer rupee); not crude and rupee both up | banks, NBFCs, realty, autos, gilt duration |
| Transitional / mixed | none of the above | balance; use the faster skills |

The squeeze ranks first because crude feeds India's current account, the rupee and CPI together,
and that combination has repeatedly kept RBI tight. "What would change the label" flips one gauge
at a time and lists the flips that alter the headline, nearest crossover first.

## Reading the components in India

- **Breadth and size:** equal weight or smallcap rising against NIFTY means money is spreading out
  (retail/SIP flows, domestic cyclicals). A narrow tape means FII money is sitting in the
  heavyweights. Smallcap/NIFTY tends to turn before the index does, in both directions.
- **NIFTY Bank / NIFTY:** credit growth and the rate cycle. PSU banks lead in capex upcycles.
  Private banks lead when FIIs return.
- **Cyclicals vs defensives:** metals, realty and PSU banks track the capex/PSU cycle and global
  metals. FMCG and pharma lead when rural demand or global growth is weak.
- **NIFTY / gold:** gold is the Indian household's hedge, and rupee depreciation lifts it twice.
  Gold winning for months is a warning about risk appetite, not just a bullion trade.
- **10-year and curve:** read with the RBI cycle. Cuts usually show up as bull steepening (the
  short rate falls faster). An inverted 10y–T-bill curve is rare in India and usually comes from
  liquidity squeezes (advance-tax outflows, defending the rupee), so check the cause.
- **USD/INR:** a weaker rupee usually comes with FII outflows (see `fii-dii-flows`). It helps IT and
  pharma earnings but raises imported inflation.
- **Brent:** India imports about 85% of its crude, so rising crude hurts the current account, the
  rupee, OMC margins and inflation together. Falling crude is a quiet tailwind.
- **US 10-year:** rising US yields pull FPI debt and equity money back home, pressuring the rupee
  and Indian valuations.
- **India VIX:** the level is banded like `market-regime` (13/17/22/30). The trend matters more here.

## How it sits with the other skills

`macro-regime` (quarters) → `market-regime` (weeks, exposure ceiling) → `market-breadth` and
`sector-rotation` (which stocks and sectors) → `fii-dii-flows` (who is buying). Use the label to set
the tilt and the faster skills to time it. When the two regimes disagree (squeeze here, confirmed
uptrend there), size down rather than pick one. Feed the tilts into `portfolio-review`.

## Limits

- Few regime shifts per decade, so each past example is one data point. The rules are judgement,
  not fitted. Ratios can trend for years (smallcap/NIFTY fell through 2018–20), so a state is
  context, not a timing signal.
- The 6/12-month averages lag by design: a turn is confirmed months after the price low or high.
- Yahoo index history can be short or patchy, and the G-sec, equal-weight and repo series are
  CSV-only. Under 5 components the coverage is graded "thin"; say so when you quote the label.
- Baskets are fixed (FMCG+Pharma vs Metal+Realty+PSU Bank). Supply DEFENSIVE.csv or CYCLICAL.csv
  to use your own series.

## Output

```
Regime: [label] | coverage m/10 ([grade]) | month [YYYY-MM] (data to [date])
For/against: [legs] | Transition: N of M turned in the last 3 months | table | tilts | would change
```
_Educational analysis, not investment advice. Data: [files/tickers + month-end dates]._

© Shubham Kumar · MIT · Shubhamkumartrichy/claude-trading-skills-india

Similar skills

All skills for Finance and business →
AION Indian Market Intelligence for Macro Event & Sector Impact Analysis AION-Analytics-India AION Indian Market Intelligence for Macro Event & Sector Impact Analysis is an MCP server for Claude Code that turns an Indian financial headline into a signed per-sector impact vector. CX Codex +1 ★ 24repo stars llmquant-macro LLMQuant llmquant-macro — a skill for Claude Code and five other environments that routes macro research: dashboards, Fed and central-bank previews, macro-to-portfolio mapping. It opens the matching workflow and pulls data from LLMQuant Data. CX Codex +1 557installs macro-regime-detector tradermonty macro-regime-detector — a skill for Claude Code and other code assistants that identifies structural macro regime shifts across a 1–2 year horizon using cross-asset ratio analysis. CX Codex +1 4,100installs analyzing-macro-malware-in-office-documents mahipal analyzing-macro-malware-in-office-documents examines malicious VBA macros in Word, Excel, and PowerPoint files. Use it to inspect suspicious attachments and reconstruct an attack chain. CX Codex +1 350installs excel-macro-creator Jeremy Longshore The excel-macro-creator skill assists with Excel macro tasks by producing code, configurations, and step-by-step guidance. It activates when related phrases appear in a request. CX Codex +1 4installs trading-expert personamanagmentlayer trading-expert equips your agent to build algorithmic trading logic, write Python strategies, and run backtests. Useful when designing execution algorithms or risk metrics. CX Codex +1 970installs

From the same set36

The whole set →
sector-rotation The sector-rotation Claude Code skill compares NSE sectors with the NIFTY 50 using returns and relative strength. It runs for questions about sector leadership, rotation, and shifts between cyclical and defensive groups. CX Codex +1 ★ 69repo stars market-breadth This Claude Code skill measures how many NSE and BSE stocks are moving with an index. It runs for questions about market breadth, advances versus declines, or midcap participation. CX Codex +1 ★ 69repo stars pair-trading The pair-trading Claude Code skill tests NSE stock pairs for cointegration and measures their spread. It responds to requests for hedge ratios, z-scores, or a pair-trade plan. CX Codex +1 ★ 69repo stars exhaustion-reversal exhaustion-reversal is a Claude Code skill that scores fading NSE/BSE stock moves and maps entry or exit plans. It activates for questions about rallies, reversals, or news reactions. CX Codex +1 ★ 69repo stars market-valuation The market-valuation Claude Code skill measures valuation and speculative heat in Indian equities using NSE index history and other market figures. It activates for questions about NIFTY valuations, IPO activity or a possible bubble. CX Codex +1 ★ 69repo stars fii-dii-flows The fii-dii-flows Claude Code skill reads Indian equity flow data for FII/FPI and DII from downloaded CSVs. It responds to requests about institutional selling, futures positions, holdings changes, and stock deals. CX Codex +1 ★ 69repo stars backtest-lab The backtest-lab Claude Code skill tests rule-based swing strategies on NSE and BSE daily data. It activates for requests to backtest a rule, inspect drawdowns, or account for trading charges. CX Codex +1 ★ 69repo stars indian-market-structure The indian-market-structure Claude Code skill explains how India’s stock markets operate. It answers questions about NSE and BSE sessions, order types, settlement, and trading restrictions. CX Codex +1 ★ 69repo stars

Project sponsors

Companies that keep this analytics open