SuperAPI AI Directory

analyze-high-unemployment-high-gdp-growth-fiscal-deficit-scenarios

Marketing & growth

View repository

Updated 10-15 21:41

About this skill

<essential_principles>

This skill focuses on a particular macroeconomic scenario:The labor market weakens markedly, but GDP remains at a high level. This combination has historically often been accompanied by:

  • A step-function rise in the fiscal deficit/GDP (automatic stabilizers + countercyclical spending)
  • Increased supply pressure on long-dated Treasury bonds
  • A potential rise in the term premium

Key insight: "30 years of history show that when jobs are soft enough, the deficit/GDP jumps from 6–7% to 12–17%"

Core measurement approach:

  • UJO = Unemployed_Level / Job_Openings_Level (unemployed persons/job openings ratio)
    • Can capture the early weakening phase in which "job openings fall quickly while unemployment has not yet risen"
  • ΔUR = Unemployment_Rate(t) - Unemployment_Rate(t-6M) (six-month change)
  • Sahm rule = 3M_MA(UR) - min(UR over last 12M) (trigger-based alert, ≥0.5 is a recession warning)

These indicators are used to define the triggers and grading (mild/moderate/severe) of "labor weakening events."

Core economic elasticities based on historical regression analysis for 2000-2025:

Coefficient Value Meaning
β_UR 0.59 For each ↑1ppt in the unemployment rate → deficit/GDP ↑0.59ppt
β_UJO 0.69 For each ↑1 in UJO → deficit/GDP ↑0.69ppt
β_JOLTS -0.07 For each ↑1M in job openings → deficit/GDP ↓0.07ppt
Lag 4Q Labor indicators lead the deficit by about 4 quarters

These elasticity coefficients are used for:

  • Quantitative projection of scenarios
  • Verifying the consistency of results from the event-group interval method
  • Sensitivity analysis

For detailed methodology see references/methodology.md。

"High GDP" is quantified as:

  • GDP_level_percentile: The percentile of the GDP level over the lookback period (for example, > 70% is treated as a high level)
  • GDP_growth_regime: Growth is still positive, or slows only slightly
  • (Advanced) Output gap/trend deviation

Only samples that simultaneously satisfy both "labor weakening" + "high GDP" conditions are included in the scenario analysis.

Model Use Output form
event_study_banding Event-group interval method "12–17%" range-type narrative, list of historical events
quantile_mapping Quantile mapping Conditional distribution of "which corner of history the present falls into"
robust_regression Robust regression projection Continuous scenario paths and intervals

By default, event_study_bandingis used, as it is closest to the "history shows..." narrative style.

This skill supports generating three-axis charts:

  • Left axis: Unemployed persons (red), job openings (blue) — in thousands
  • Right axis: Fiscal deficit/GDP (green) — percentage
  • Annotations: Historical crossover events (unemployment > job openings) and the corresponding deficit jump magnitudes
  • Scenario projections: Dashed lines show possible future paths (mild/moderate/severe)

The chart is drawn based on public FRED data, making it easy to track the historical evolution of the labor-fiscal relationship.

This skill usesno API key required public data sources:

  • FRED CSV: https://fred.stlouisfed.org/graph/fredgraph.csv?id={SERIES_ID}
    • Labor: UNRATE, UNEMPLOY, JTSJOL, ICSA
    • Macro: GDP, GDPC1
    • Fiscal: FYFSGDA188S (Federal Surplus/Deficit as % of GDP)
  • BEA: Backup GDP/fiscal data source

The script is located in the scripts/ directory and can be run directly.

</essential_principles>

  1. Construct labor tightness indicators: Calculate UJO, Sahm Rule, etc. from FRED data
  2. Define divergence events: Identify historical samples of "labor weakening + GDP at high levels"
  3. Estimate deficit range: Use three models to estimate the possible jump range of Deficit/GDP
  4. Generate scenario interpretation: Produce supply/rate risk interpretation for long-dated USTs
  5. Visualization output: Generate three-axis charts and scenario projections

Output: diagnostic information, deficit range projections, historical event samples, UST risk interpretation, visualization charts.

<quick_start>

Fastest way: run the default scenario analysis

cd skills/analyze-high-unemployment-high-gdp-growth-fiscal-deficit-scenarios
pip install pandas numpy requests matplotlib  # 首次使用
python scripts/analyzer.py --quick

Generate visualization charts (recommended):

python scripts/analyzer.py --visualize --scenario-type moderate

Or use the visualization script directly:

python scripts/visualizer.py --scenario moderate --years 25

Output examples:

{
  "skill": "analyze_high_unemployment_fiscal_deficit_scenarios",
  "as_of": "2026-01-21",
  "diagnostics": {
    "current_slack_percentile": 0.28,
    "high_gdp_condition": true,
    "triggered_labor_softening": false
  },
  "deficit_gdp_projection": {
    "baseline_deficit_gdp": 0.062,
    "conditional_range_next_8q": {
      "p25": 0.11, "p50": 0.135, "p75": 0.16
    },
    "n_episodes": 3
  }
}

Full scenario analysis + charts:

python scripts/analyzer.py --lookback 30 --horizon 8 --model event_study_banding --visualize --scenario-type severe --output result.json --chart-output chart.png

</quick_start>

  1. Quick diagnosis - View the current labor/GDP status and deficit risk determination
  2. Full scenario analysis - Run the complete historical event study and deficit range estimation
  3. Visualization charts - Generate three-axis charts and scenario projections
  4. Custom scenario simulation - Input custom unemployment shock scenarios for simulation
  5. Methodology learning - Understand the logic and models of the labor-fiscal linkage
  6. UST risk interpretation - Generate a supply/rate risk report for long-dated U.S. Treasuries

Please choose or directly provide analysis parameters.

After routing, read the corresponding document and execute.

<directory_structure>

analyze-high-unemployment-high-gdp-growth-fiscal-deficit-scenarios/
├── SKILL.md                           # 本文件(路由器)
├── skill.yaml                         # 前端展示元數據
├── manifest.json                      # 技能元數據
├── workflows/
│   ├── analyze.md                     # 完整情境分析工作流
│   ├── visualize.md                   # 視覺化圖表工作流
│   ├── scenario.md                    # 自訂情境推演工作流
│   └── ust-risk.md                    # UST 風險解讀工作流
├── references/
│   ├── data-sources.md                # FRED 系列代碼與資料來源
│   ├── methodology.md                 # 勞動-財政連結方法論
│   └── input-schema.md                # 完整輸入參數定義
├── templates/
│   ├── output-json.md                 # JSON 輸出模板
│   └── output-markdown.md             # Markdown 報告模板
├── scripts/
│   ├── analyzer.py                    # 主分析腳本(含視覺化整合)
│   ├── visualizer.py                  # 視覺化專用腳本
│   └── fetch_data.py                  # 數據抓取工具
└── output/                            # 圖表輸出目錄
    └── (generated charts)

</directory_structure>

<reference_index>

Methodology: references/methodology.md

  • Labor-fiscal linkage logic
  • Detailed explanation of the three analysis models
  • Event grouping and threshold definitions

Data sources: references/data-sources.md

  • FRED series codes (labor/GDP/fiscal)
  • Data frequency and alignment methods

Input parameters: references/input-schema.md

  • Complete parameter definitions
  • Default values and recommended ranges

</reference_index>

<workflows_index>

Workflow Purpose When to use
analyze.md Full scenario analysis When historical event study is needed
visualize.md Visualization charts When charts need to be generated
scenario.md Custom scenario simulation When inputting custom unemployment shocks
ust-risk.md UST risk interpretation When a bond market risk report is needed
</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
analyzer.py --quick Quickly diagnose current status
analyzer.py --lookback 30 --horizon 8 Full scenario analysis
analyzer.py --visualize --scenario-type moderate Analysis + visualization charts
visualizer.py --scenario moderate --years 25 Generate visualization charts separately
visualizer.py --scenario severe --output chart.png Specify output path
fetch_data.py --series UNRATE,JTSJOL,GDP Fetch FRED data
</scripts_index>

<input_schema_summary>

Core parameters

Parameter Type Default value Description
country string US Country code
lookback_years int 30 Lookback Years
frequency string quarterly Data Frequency
horizon_quarters int 8 Projection Quarters
model string event_study_banding Analysis Model
output_format string json Output Format

Labor Indicator Settings

Parameter Type Default Value Description
use_jolts bool true Use JOLTS
use_unemployment bool true Use Unemployment Rate
use_sahm_rule bool true Calculate Sahm Rule
slack_metric string unemployed_to_job_openings_ratio Tightness Measure

Visualization Parameters

Parameter Type Default Value Description
visualize bool false Whether to Generate Visualization Charts
scenario_type string moderate Scenario Type (mild/moderate/severe)
chart_output string auto Chart Output Path
no_show bool false Do Not Display Charts (Save Only)

Scenario Assumptions

Parameter Type Default Value Description
gdp_path string high_gdp_sticky GDP Path Assumption
unemployment_shock object {type, size, speed} Unemployment Shock Setting

For the complete parameter definitions, see references/input-schema.md。

</input_schema_summary>

<output_schema_summary>

{
  "skill": "analyze_high_unemployment_fiscal_deficit_scenarios",
  "inputs": {
    "country": "US",
    "lookback_years": 30,
    "slack_metric": "unemployed_to_job_openings_ratio",
    "model": "event_study_banding"
  },
  "diagnostics": {
    "current_slack_percentile": 0.28,
    "high_gdp_condition": true,
    "triggered_labor_softening": false
  },
  "elasticity_model": {
    "parameters": {
      "beta_ur": 0.59,
      "beta_ujo": 0.69,
      "beta_jolts": -0.07,
      "lag_quarters": 4
    },
    "interpretation": {
      "ur_effect": "每 1ppt 失業率上升 → 赤字/GDP 上升 0.59 ppt",
      "ujo_effect": "UJO 每上升 1 → 赤字/GDP 上升 0.69 ppt",
      "lag_effect": "勞動指標領先赤字約 4 季"
    },
    "conditional_means": {
      "deficit_when_loose": 5.6,
      "deficit_when_tight": 5.2
    }
  },
  "deficit_gdp_projection": {
    "baseline_deficit_gdp": 0.062,
    "conditional_range_next_8q": {
      "p25": 0.11, "p50": 0.135, "p75": 0.16, "min": 0.095, "max": 0.175
    },
    "n_episodes": 3,
    "episode_years": ["2001-2003", "2008-2010", "2020-2021"]
  },
  "interpretation": {
    "macro_story": "...",
    "ust_duration_implications": [...],
    "watchlist_switch_indicators": [...]
  },
  "visualization": {
    "chart_path": "output/fiscal_deficit_scenario_20260121.png",
    "scenario_type": "moderate",
    "projected_deficit_jump_bps": 600
  }
}

For the complete output structure, see templates/output-json.md。 </output_schema_summary>

<success_criteria> Upon successful execution, the following should be produced:

Data Analysis

  • Current labor tightness status (percentile, whether weakening is triggered)
  • High GDP condition determination result
  • Conditional distribution interval of Deficit/GDP (p25/p50/p75)
  • Historical sample event list (year, indicator values)
  • UST supply pressure channel interpretation
  • Risk appetite channel interpretation (the two forces of safe haven vs. supply)
  • Monitoring switch indicator list
  • Diagnostic information (current indicator values)

Visualization (if enabled)

  • Three-axis chart (job openings/unemployment/deficit GDP)
  • Historical crossover event annotations
  • Scenario projection dashed lines (mild/moderate/severe)
  • Recession period gray shading
  • JSON summary file </success_criteria>