用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/franklee16/academic-research-skills --skill api-data-fetcher命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
Structured hypothesis formulation from observations. Use when you have experimental observations or data and need to formulate testable hypotheses with predictions, propose mechanisms, and design experiments to test them. Follows scientific method framework. For open-ended ideation use scientific-brainstorming; for automated LLM-driven hypothesis testing on datasets use hypogenic.
Transforms raw user requests into structured, outcome-focused prompts for Claude Cowork. Use when the user wants to optimize or rewrite a prompt for Cowork, needs help structuring a multi-step task for autonomous execution, or says things like "optimize this Cowork prompt", "rewrite for Cowork", or "make this a Cowork prompt". Outputs a single code block with the rewritten prompt following the GOAL/CONTEXT LOADING/IDENTITY/SUCCESS CRITERIA/INPUTS/CONSTRAINTS/CHECKPOINT RULE structure.
This skill should be used when the user asks to "brainstorm research ideas", "use 5W1H framework", "identify research gaps", "conduct gap analysis", "start research project", "conduct literature review", "define research question", "select research method", "plan research", or mentions research project initiation phase. Provides comprehensive guidance for research startup workflow from idea generation to planning.
基于 SOC 职业分类
正在显示 SKILL.md
| name | api-data-fetcher |
| description | Fetch economic data from FRED, World Bank, and other APIs |
| workflow_stage | data |
| compatibility | ["claude-code","cursor","codex","gemini-cli"] |
| author | Awesome Econ AI Community |
| version | 1.0.0 |
| tags | ["Python","API","FRED","World-Bank","data-collection"] |
This skill helps economists fetch data from major economic data APIs including FRED (Federal Reserve Economic Data), World Bank, IMF, BLS, and OECD. It generates clean, documented Python code with proper error handling.
Ask the user:
| Data Type | Best Source | Package |
|---|---|---|
| US macro | FRED | fredapi |
| Global development | World Bank | wbdata |
| Labor statistics | BLS | bls |
| Cross-country | OECD | pandasdmx |
| Financial | Yahoo Finance | yfinance |
Include:
"""
Economic Data Fetcher
=====================
Downloads macroeconomic data from FRED and World Bank APIs.
Requires: fredapi, wbdata, pandas
Setup: Set FRED_API_KEY environment variable
Get a free key from: https://fred.stlouisfed.org/docs/api/api_key.html
"""
import os
import pandas as pd
from datetime import datetime, timedelta
from typing import List, Optional, Dict
# ============================================
# FRED Data Fetcher
# ============================================
def fetch_fred_series(
series_ids: List[str],
start_date: str = "2000-01-01",
end_date: Optional[str] = None,
api_key: Optional[str] = None
) -> pd.DataFrame:
"""
Fetch time series data from FRED.
Parameters
----------
series_ids : list of str
FRED series IDs (e.g., ['GDP', 'UNRATE', 'CPIAUCSL'])
start_date : str
Start date in YYYY-MM-DD format
end_date : str, optional
End date (defaults to today)
api_key : str, optional
FRED API key (defaults to FRED_API_KEY env var)
Returns
-------
pd.DataFrame
DataFrame with date index and series as columns
Example
-------
>>> df = fetch_fred_series(['GDP', 'UNRATE'], '2010-01-01')
"""
try:
from fredapi import Fred
except ImportError:
raise ImportError("Install fredapi: pip install fredapi")
# Get API key
api_key = api_key or os.environ.get('FRED_API_KEY')
api_key:
ValueError(
)
fred = Fred(api_key=api_key)
end_date = end_date datetime.now().strftime()
data = {}
series_id series_ids:
:
series = fred.get_series(
series_id,
observation_start=start_date,
observation_end=end_date
)
data[series_id] = series
()
Exception e:
()
df = pd.DataFrame(data)
df.index.name =
df
FRED_SERIES = {
: ,
: ,
: ,
: ,
: ,
: ,
: ,
: ,
: ,
: ,
: ,
: ,
: ,
: ,
}
() -> pd.DataFrame:
:
wbdata
ImportError:
ImportError()
end_year = end_year datetime.now().year
all_data = []
indicator_code, indicator_name indicators.items():
:
data = wbdata.get_dataframe(
{indicator_code: indicator_name},
country=countries,
)
data = data.reset_index()
all_data.append(data)
()
Exception e:
()
all_data:
df = all_data[]
other_df all_data[:]:
df = df.merge(other_df, on=[, ], how=)
df[] = pd.to_datetime(df[]).dt.year
df = df[(df[] >= start_year) & (df[] <= end_year)]
df
pd.DataFrame()
WORLD_BANK_INDICATORS = {
: ,
: ,
: ,
: ,
: ,
: ,
: ,
: ,
: ,
: ,
: ,
}
__name__ == :
us_macro = fetch_fred_series(
series_ids=[, , , ],
start_date=
)
()
(us_macro.tail())
us_macro.to_csv()
()
indicators = {
: ,
: ,
:
}
cross_country = fetch_world_bank_data(
indicators=indicators,
countries=[, , , , , , , ],
start_year=
)
()
(cross_country.head())
cross_country.to_csv(, index=)
()
pip install fredapi wbdata pandas
Set environment variables:
export FRED_API_KEY="your_key_here"