agentleFS
krzysukrzysu/market-skills/skills/market-breadth/SKILL.md

market-breadth

Skill3 starsChanged 4 months agoMITView on GitHub

Cross-sectional breadth: what share of a watchlist basket outperformed the benchmark (default BTC) over a rolling N-day window. Ticker-agnostic rotation read — returns pct_beating, median member return, leaders/laggards, and an alt_rotation/mixed/btc_led regime label with uncalibrated bands. Use to decide whether the multi-day swing book leans into alts or into BTC this week.

2 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

2 rules. About 0 are common, 1 is distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    When members lack history — each series needs >= 2 usable daily closes.

    line 33
  2. Distinctive:

    Never raises at the CLI; the explicit request is never substituted.

    line 119

≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

market-breadth

Cross-sectional breadth read. One call → one breadth payload: the percentage of a market-watchlist basket whose N-day return is strictly greater than the benchmark's. Ticker-agnostic — there is no positional ticker; the universe comes from a watchlist basket and the benchmark resolves from the same registry (alias btc → canonical ticker). Logic lives skill-local in lib.py (compute_breadth pure math, analyze for resolution + fetch); the skill is deliberately NOT registered in analysis/registry.py (ADR-0010).

When NOT to use

  • As an entry-timing signal — breadth is a rotation/regime read for the multi-day swing book, not a per-ticker trigger. Use market-* / strategy-* skills for entries.
  • As an L2 input — it is not a pattern detector: no single ticker, no {pattern, signals, input_scores, narrative} shape, not consumable by L3 composition code (ADR-0010).
  • For conviction or sizing — not wired into L3 conviction or risk sizing yet; narrate-only.
  • When members lack history — each series needs >= 2 usable daily closes; members with less are excluded and named in errors[].

Quick Start

uv run skills/market-breadth/scripts/run.py --json

Defaults: --basket is tier_1 (falling back to the first non-empty watchlist basket when tier_1 is absent — substitution disclosed in errors[]), --window-days=7, --benchmark=btc.

Flags

FlagDefaultNotes
--jsonhumanEmit the AXI envelope to stdout.
--basket=NAMEtier_1, falling back to the first non-empty watchlist basket (disclosed in errors[])Watchlist basket to measure. An explicit name is used verbatim: missing/empty explicit basket → AXI empty state, never raises. Empty value (--basket=) → usage error, exit 2.
--window-days=N7Requested lookback in days. <= 0 → usage error, exit 2. Longer than the shortest available history → truncated to the effective window, disclosed in errors[].
--benchmark=ALIASbtcBenchmark alias resolved through the watchlist; the resolved ticker is excluded from the member set.
--fulloffFull payload instead of the default field projection.
--fields=<csv>default schemaProject specific fields.
--toonoffOpt-in TOON encoding.

What it returns

{
  "data": {
    "window_days": 7,
    "effective_window_days": 7,
    "benchmark": "BTCUSD",
    "basket": "tier_1",
    "members": 19,
    "pct_beating": 63.2,
    "btc_return_pct": 10.53,
    "median_alt_return_pct": 16.6,
    "regime": "alt_rotation",
    "leaders": [{"ticker": "<TICKER>", "return_pct": 91.36}],
    "laggards": [{"ticker": "<TICKER>", "return_pct": 2.88}],
    "narrative": "Breadth 7d: 63.2% of 19 members beating BTCUSD (BTCUSD +10.53%, median +16.60%) -> alt_rotation. Regime bands (>=60 / <=40) are uncalibrated first guesses - trust pct_beating, not the label.",
    "errors": []
  },
  "count": null,
  "errors": [],
  "help": ["..."]
}
  • members is the pct_beating denominator: members actually measured. Members excluded for unusable history are named in errors[].
  • Ties do not count as beating — a member whose return equals the benchmark's is not beating. The strict comparison runs on unrounded returns, so a member strictly above the benchmark on raw values still counts even when both round to the same 2dp value; reported values are rounded to 2dp.
  • benchmark is the resolved canonical watchlist ticker, not a display string.
  • leaders / laggards are the top/bottom 3 measured members, deterministic on ties (sorted by return, then ticker).

Regime bands

pct_beatingregimeReading
>= 60.0alt_rotationBroad participation — alt swing setups more likely to follow through
<= 40.0btc_ledNarrow breadth — alt breakouts more likely to fail
betweenmixedNo rotation edge

These bands are uncalibrated first guesses, picked by hand rather than fitted against historical data. The raw pct_beating is always in the payload and the narrative repeats the caveat — trust the number, not the label. Calibration is a follow-up once there is history to calibrate against.

Edge cases

  • No --basket given → the default is tier_1; when it is absent from the watchlist (or empty), the first non-empty basket in watchlist insertion order is measured instead and errors[] carries [BREADTH BASKET DEFAULTED — preferred 'tier_1' not in watchlist; used '<basket>']. The payload's basket field is the name actually measured. When tier_1 is used as-is there is no diagnostic.
  • Missing / empty explicit basket (--basket=<NAME> given, name missing or empty in the registry) → AXI empty state (data: null, count: 0), errors[] names the basket, help[] lists the available basket names. Never raises at the CLI; the explicit request is never substituted.
  • --basket= (empty value) → usage error, exit 2.
  • Unresolvable or ambiguous benchmark alias → empty state naming the alias.
  • Window truncation → one shared effective window: min(window_days, shortest available history across every measured series and the benchmark) — never compare a 7d alt return against a 3d benchmark return. The payload carries effective_window_days and errors[] carries [BREADTH WINDOW TRUNCATED — requested Nd, used Md (shortest available history)]. No exception.
  • Member fetch failure or short history → excluded from the measurement and named in errors[] ([BREADTH <TICKER> FETCH FAILED ...] / [BREADTH <TICKER> SKIPPED ...]); the rest of the basket still returns.
  • Benchmark in the basket → dropped silently from the member set (comparing the benchmark to itself is meaningless).
  • Benchmark with < 2 usable closes → empty state with an actionable error.

Output envelope (AXI)

--json output follows the canonical AXI envelope (ADR-0004) — {data, count, errors, help[]}. Default schema is the minimal field list (basket, window_days, members, pct_beating, regime, narrative); --fields=<csv> projects, --full returns everything. count is null (one cross-sectional reading). Errors are never cached state.

Home view (no-arg mode)

No-arg mode prints the home view from the last cached successful run ($XDG_DATA_HOME/market-skills/market-breadth_last.json), or the "no cached state" fallback on a fresh install.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.