<essential_principles>
- CPI (fixed weights): BLS Relative Importance, updated annually or every two years, reflecting a "fixed basket"
- PCE (dynamic/chained weights): BEA nominal expenditure shares, adjusted monthly with actual consumer behavior
Key insight: When consumers spend money on items whose "prices are less volatile," if inflation in these items rises, PCE will reflect this upward pressure more sensitively than CPI.
Identification logic:
- Find consumer spending buckets with higher PCE weights
- Within these buckets, screen for those with lower price volatility
- If inflation in these buckets has recently turned positive or accelerated, flag as PCE upside risk
PCE covers a broader set of items than CPI:
- Employer-paid healthcare
- Services provided by nonprofit institutions to households
- Implicit fees for certain financial services
These scope differences also cause CPI/PCE divergence. See references/cpi-pce-methodology.md。
This skill usesno API key required data sources:
- FRED CSV:
https://fred.stlouisfed.org/graph/fredgraph.csv?id={SERIES_ID} - BLS Public API:
https://api.bls.gov/publicAPI/v2/timeseries/data/
The script is located in the scripts/ directory and can be run directly.
</essential_principles>
Output three layers of signals:
- Headline level: CPI vs PCE divergence(bps)
- Attribution: which buckets are driving PCE (weighted contribution)
- Risk framing: observation points and continuity risk assessment
<quick_start>
Fastest way: run a quick check
cd skills/us-cpi-pce-comparator
pip install pandas numpy requests # 首次使用
python scripts/cpi_pce_analyzer.py --quick
Example output:
{
"headline": {"cpi_yoy": 2.65, "pce_yoy": 2.79, "gap_bps": 14},
"core": {"cpi_core_yoy": 2.65, "pce_core_yoy": 2.83, "gap_bps": 18},
"momentum": {"cpi_3m_saar": 2.07, "pce_3m_saar": 2.82}
}
Full analysis:
python scripts/cpi_pce_analyzer.py --start 2020-01-01 --measure yoy
</quick_start>
- Quick check - view the latest CPI/PCE divergence data
- Full analysis - run the complete three-step analysis workflow
- Methodology learning - understand the deeper reasons for CPI/PCE differences
Please choose or directly provide analysis parameters.
After routing, read the corresponding document and execute.
<directory_structure>
us-cpi-pce-comparator/
├── SKILL.md # 本文件(路由器)
├── skill.yaml # 前端展示元數據
├── workflows/
│ ├── analyze.md # 完整分析工作流
│ └── quick-check.md # 快速檢查工作流
├── references/
│ ├── data-sources.md # FRED/BLS 系列代碼與資料來源
│ ├── cpi-pce-methodology.md # CPI/PCE 方法論深度解析
│ └── implementation.md # 計算公式與程式碼範例
├── templates/
│ ├── output-json.md # JSON 輸出模板
│ └── output-markdown.md # Markdown 報告模板
└── scripts/
├── fetch_fred_data.py # FRED 資料抓取(無需 API key)
├── fetch_bls_data.py # BLS 資料抓取
└── cpi_pce_analyzer.py # 主分析腳本
</directory_structure>
<reference_index>
Methodology: references/cpi-pce-methodology.md
- The five major differences between CPI vs PCE (weights, scope, formula, housing, population)
- Divergence patterns and trading implications
- How the Fed interprets the two indicators
Data sources: references/data-sources.md
- FRED CSV endpoint (no API key required)
- FRED series code mapping table
- Bucket definitions and approximate calculations
Implementation guide: references/implementation.md
- Inflation calculation formulas (YoY, MoM SAAR, QoQ SAAR)
- Weight effect calculation
- Volatility analysis
</reference_index>
<workflows_index>
| Workflow | Purpose | When to use |
|---|---|---|
| analyze.md | Complete three-step analysis | When in-depth analysis is needed |
| quick-check.md | Quick check of divergence | Daily monitoring or quick answers |
| </workflows_index> |
<templates_index>
| Template | Purpose |
|---|---|
| output-json.md | JSON output structure definition |
| output-markdown.md | Markdown report template |
| </templates_index> |
<scripts_index>
| Script | Command | Purpose |
|---|---|---|
| cpi_pce_analyzer.py | --quick |
Quick check of the latest divergence |
| cpi_pce_analyzer.py | --start DATE --measure yoy |
Full analysis |
| fetch_fred_data.py | --series CPIAUCSL,PCEPI |
Fetch FRED data |
| fetch_bls_data.py | --full |
Fetch BLS CPI data |
| </scripts_index> |
<input_schema>
</input_schema>
<output_schema>
See templates/output-json.md for the complete structure definition.
Summary:
{
"headline": {"cpi_yoy": 2.65, "pce_yoy": 2.79, "gap_bps": 14},
"low_vol_high_weight_buckets": [{"bucket": "...", "signal": "upside"}],
"attribution": {"top_contributors": [...], "weight_effect_bps": 12},
"interpretation": ["..."],
"caveats": ["..."]
}
</output_schema>
<success_criteria> A successful analysis should produce:
- CPI/PCE divergence value at the headline level (bps)
- Identify low-volatility, high PCE weight buckets
- Weighted inflation contribution by bucket (attribution)
- If a baseline exists, produce the 'less baseline' deviation
- Actionable interpretation and risk alerts
- Clearly annotate data limitations and approximation handling </success_criteria>