detect-us-equity-valuation-percentile-extreme

detect-us-equity-valuation-percentile-extreme is a skill for Claude Code, Codex from fatfingererr/macro-skills. It costs 84 tokens per session (3,492 once invoked), scanned A, original, MIT.

A financial-analysis skill that converts stock valuation measures such as price-to-earnings and price-to-book ratios into historical percentiles, then combines them into an overall score.

In plain words
What is it for?
Use it to assess whether equities appear extremely overvalued, compare conditions with periods such as 1929, 1965, or 1999, and review later returns, drawdowns, and volatility.
Why use it?
It puts different valuation measures on the same 0–100 scale and helps identify when the market resembles historically expensive periods. The result is an approximate reconstruction using public data, not exact Bloomberg data.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to assess whether equities appear extremely overvalued, compare conditions with periods such as 1929, 1965, or 1999, and review later returns, drawdowns, and volatility.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/fatfingererr/macro-skills/detect-us-equity-valuation-percentile-extreme
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 fatfingererr/macro-skills --skill detect-us-equity-valuation-percentile-extreme
Clone the repo
git clone --depth 1 https://github.com/fatfingererr/macro-skills

Made for: Claude Code, Codex.

Its marketplace also offers this one on its own, as the plugin detect-us-equity-valuation-percentile-extreme/plugin install detect-us-equity-valuation-percentile-extreme after adding the marketplace above.

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 detect-us-equity-valuation-percentile-extreme

README.md
[![agentmods](https://agentmods.dev/badge/skills/fatfingererr/macro-skills/detect-us-equity-valuation-percentile-extreme/github.svg)](https://agentmods.dev/skills/fatfingererr/macro-skills/detect-us-equity-valuation-percentile-extreme)
Your own site
<a href="https://agentmods.dev/skills/fatfingererr/macro-skills/detect-us-equity-valuation-percentile-extreme"><img src="https://agentmods.dev/badge/skills/fatfingererr/macro-skills/detect-us-equity-valuation-percentile-extreme/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 detect-us-equity-valuation-percentile-extreme

Your own site · 80×15
<a href="https://agentmods.dev/skills/fatfingererr/macro-skills/detect-us-equity-valuation-percentile-extreme"><img src="https://agentmods.dev/badge/skills/fatfingererr/macro-skills/detect-us-equity-valuation-percentile-extreme.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 84 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,492 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.00084 $0.03492
Opus 5 $0.00042 $0.01746
Sonnet 5 $0.00017 $0.00698
Haiku 4.5 $0.00008 $0.00349

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

Security

Grade A, and why

detect-us-equity-valuation-percentile-extreme 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 12d ago.

The scan reads SKILL.md. This mod also ships 3 executable files (scripts/fetch_valuation_data.py, scripts/valuation_percentile.py, scripts/visualize_valuation.py), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

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.

skills/detect-us-equity-valuation-percentile-extreme/SKILL.md · 305 lines

How it starts

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

<essential_principles>

將不同單位的估值指標(PE、PB、CAPE 等)統一成「0-100 的歷史分位數」:

  • 分位數 = 100 × (歷史中 ≤ 當前值的樣本數 / 總樣本數)
  • 例:CAPE 位於歷史第 98 分位 → 過去 130 年只有 2% 的時間比現在更貴
  • 統一單位後,可跨指標合成「綜合估值分位數」

合成公式:composite_percentile = 加權平均(各指標分位數)

支援三種合成方式:

方式 公式 適用場景
mean 算術平均 各指標同等重要
median 中位數 抵抗單一指標異常拉升
trimmed_mean 去極端平均 穩健估計

重要:各指標可能有不同歷史長度,預設使用「各自歷史」計算分位數再合成。

if composite_percentile >= extreme_threshold (預設 95):
    → 判定「歷史極端高估」
    → 觸發風險解讀流程

歷史類比事件識別:

  1. 找出合成分位數超過門檻的峰值
  2. episode_min_gap_days 去重(預設 10 年內只保留最高點)
  3. 輸出:1929、1965、1999、2021、當前...

「估值極端高」≠「明天崩盤」,但歷史特徵是:

  • 風險分布不對稱:下跌尾巴變厚
  • 未來中期報酬壓縮:估值均值回歸壓低長期報酬上限
  • 波動先升後跌:事件後 6-12 月波動率通常上升

輸出事後統計:

  • 未來 180/365/1095 天報酬分布
  • 最大回撤中位數與尾部風險
  • 波動率變化機率

本 skill 使用公開替代資料,非彭博原始數據:

  • Shiller CAPE: Robert Shiller 公開資料集(可回溯至 1871 年)
  • 市值/GDP: FRED 公開數據(可回溯至 1950 年代)
  • PE/PB/PS: 公開金融資料(歷史較短,約 30-50 年)

必須揭露

  • 各指標可得期間不同
  • 合成分位數為「近似重建」,非精確複製

</essential_principles>

  1. 收集估值指標:從公開數據源取得 PE、CAPE、PB、PS、市值/GDP 等
  2. 計算分位數:將各指標轉換為歷史分位數(0-100)
  3. 合成總分:加權平均(或中位數)得到綜合估值分位數
  4. 判定極端:若總分 ≥ 門檻(預設 95),觸發極端高估警報
  5. 歷史類比:找出歷史上的類似事件(1929、1965、1999 等)
  6. 事後統計:計算這些事件後的報酬、回撤、波動變化

輸出:當前狀態、各指標分位數、歷史類比事件、風險解讀。

<quick_start>

最快的方式:執行視覺化分析

cd skills/detect-us-equity-valuation-percentile-extreme
pip install pandas numpy yfinance requests matplotlib openpyxl xlrd  # 首次使用
python scripts/visualize_valuation.py -o output

輸出:

  • output/us_valuation_percentile_YYYY-MM-DD.png - 歷史走勢圖(類似 @ekwufinance 風格)
  • output/us_valuation_breakdown_YYYY-MM-DD.png - 各指標分位數分解圖
  • output/us_valuation_analysis_YYYY-MM-DD.json - JSON 結果

圖表特色

  • 多指標合成分位數的歷史走勢(非單一時間點)
  • 歷史峰值標記:1929、1965、1999、2021
  • S&P 500 指數疊加(對數刻度)
  • 當前「新高」標註

快速檢查(純 JSON)

python scripts/valuation_percentile.py --quick

完整分析

python scripts/valuation_percentile.py \
  --as_of_date 2026-01-21 \
  --universe "^GSPC" \
  --metrics "cape,mktcap_to_gdp,trailing_pe,pb" \
  --output result.json

</quick_start>

  1. 視覺化分析(推薦) - 生成歷史走勢圖表,標記歷史峰值
  2. 快速檢查 - 查看目前的估值分位數與極端狀態
  3. 完整分析 - 執行完整的歷史分位數分析與風險解讀
  4. 歷史類比 - 深入分析歷史極端高估事件與事後表現
  5. 方法論學習 - 了解估值分位數模型的邏輯
  6. 自訂參數 - 指定估值指標、門檻、合成方式等

請選擇或直接提供分析參數。

路由後,閱讀對應文件並執行。

<directory_structure>

detect-us-equity-valuation-percentile-extreme/
├── SKILL.md                           # 本文件(路由器)
├── skill.yaml                         # 前端展示元數據
├── manifest.json                      # 技能元數據
├── workflows/
│   ├── execute-analysis.md            # 完整分析工作流
│   ├── visualize-analysis.md          # 視覺化分析工作流
│   └── historical-episodes.md         # 歷史類比分析工作流
├── references/
│   ├── methodology.md                 # 估值分位數方法論
│   ├── data-sources.md                # 資料來源與代碼
│   ├── valuation-metrics.md           # 估值指標定義
│   └── input-schema.md                # 完整輸入參數定義
├── templates/
│   ├── output-json.md                 # JSON 輸出模板
│   └── output-markdown.md             # Markdown 報告模板
├── scripts/
│   ├── valuation_percentile.py        # 主分析腳本
│   ├── visualize_valuation.py         # 視覺化腳本(歷史走勢圖)
│   └── fetch_valuation_data.py        # 資料抓取工具
└── examples/
    └── sample_output.json             # 範例輸出

</directory_structure>

Read the full file on GitHub · 305 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. 12d ago First seen · 305 lines · 84 tokens per session scan A 229a982bcab8

Subscribe to this mod's changes

detect-us-equity-valuation-percentile-extreme is a skill published in the GitHub repository fatfingererr/macro-skills (3 stars, last pushed 7mo ago), licensed MIT. It adds 84 tokens to every session and 3,492 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-31.

Related

Other skills, from other repositories

sector-rotation

An analysis framework for comparing industries in the Chinese A-share stock market, using business conditions, price momentum, valuation, and money flows. It produces rankings and higher- or lower-allocation suggestions.

HKUDS/Vibe-Trading · 39 tokens

strategy-pivot-designer

Detect backtest iteration stagnation and generate structurally different strategy pivot proposals when parameter tuning reaches a local optimum.

tradermonty/claude-trading-skills · 28 tokens

twitter-reader

Read Twitter/X for financial research using opencli (read-only). Use this skill whenever the user wants to read their Twitter feed, search for financial tweets, view bookmarks, look up user profiles, or gather market sentiment from Twitter/X. Triggers include: "check my feed", "search Twitter for", "show my…

himself65/finance-skills · 161 tokens

chenhao-limit-up

A framework for judging Chinese A-share stocks that have reached the daily price-rise limit, using market mood, sector leadership, and trading momentum.

questflowai/investorskills · 44 tokens

furusato

A Japanese hometown-tax donation manager for furusato nozei, a system where donations to municipalities can qualify for an income-tax or local-tax deduction. It reads donation receipts, stores donation records, and calculates deduction limits.

kazukinagata/shinkoku · 102 tokens

reading-receipt

An image-reading workflow for extracting structured information from receipts, invoices, and hometown-tax donation certificates. It can first extract text from PDFs and otherwise read their images.

kazukinagata/shinkoku · 64 tokens