Global Workflow Collaboration Constraints (long-conversation drift prevention)
- This skill must not be used as an isolated entry point. When the user requests a complete paper, Word generation, continuation of the workflow, or the stage is uncertain, first return to
paper-workflow-orchestratorto determine the current S0-S8 stage. - Before starting or continuing a formal task of this skill, you must run:
python .claude/skills/paper-workflow-orchestrator/scripts/workflow_guard.py --skill authoritative-data-harvester - If the output
[WORKFLOW FAIL]or the reportstatus != "PASS", stop this skill, and backfill the preceding stages according topaper_output/qa/workflow_guard_report.json's failed items; do not continue from memory. - This skill only writes
paper_output/artifacts within its own contract scope; after completion, you must return topaper-workflow-orchestratorto determine the next step, and usecontext-memory-keeperto record completed artifacts, blockers, and the next step. - In long conversations, if the context grows long, the stage is uncertain, or the user invokes skills separately, first run:
Then readpython .claude/skills/paper-workflow-orchestrator/scripts/workflow_guard.py --statuspaper_output/qa/workflow_guard_report.json、paper_output/preflight_report.json、paper_output/input_manifest.json、paper_output/results/run_manifest.jsonand this skill's upstream JSON contract, and continue according to the report'srecommended_skillandnext_action. - Before continuing the workflow, you must treat
paper_output/context/workflow_memory.jsonas a long-term breakpoint record; if itscurrent_step、next_step、recommended_skillandworkflow_guard.py --statusare inconsistent, the guard report takes precedence. - After completing this skill's artifacts each time, first return to
paper-workflow-orchestratoror runworkflow_guard.py --status, then update workflow memory:
After updating, readpython .claude/skills/context-memory-keeper/scripts/update_workflow_memory.pypaper_output/context/workflow_memory.json/.mdto confirm the next step and recommended skill have been recorded.
Execution contract
- Upstream input: the variable requirements given by the user, or
paper_output/step1/problem_analysis.json、paper_output/plan/model_route.json's identified external data requirements. - Required output: a reproducible data source description, scraping or download plan, and save the raw/processed data and source information to
crawled_data/, preferably includingcrawled_data/sources.json。 - Downstream handoff:
data-cleaning-and-visualizationreadscrawled_data/to perform unified cleaning, chart planning, and paper-grade figures. - Recommended next step: after data is persisted, proceed to
data-cleaning-and-visualization; for a complete paper goal, return topaper-workflow-orchestratorto determine subsequent stages. - Failure fallback: if automatic acquisition is impossible, provide same-tier authoritative alternative sources, scope differences, and manual download paths; do not use unsourced or non-citable data to pass off as authoritative data.
Objective
In mathematical modeling tasks, quickly find "authoritative, citable, reproducible" public data sources, and obtain data in a way that minimizes web scraping and prioritizes APIs/bulk downloads, ultimately outputting:
- Data acquisition script/plan (including links, parameters, time range, field explanations)
- Raw data and cleaned data (CSV/Parquet)
- Data dictionary and citation information (source, update time, license/terms, access date)
When to invoke
- When authoritative/official data sources are needed (statistics bureaus, international organizations, government open data)
- When a reproducible data scraping workflow is needed (fixed API parameters, repeatable execution)
- When a variable list already exists but data is missing, or alternative indicators need to be supplemented
General principles (must be followed)
- Prioritize official APIs or Bulk Download; use HTML parsing only as a last resort.
- Comply with robots.txt and the terms of service, respect rate limits; do not bypass login/payment/captcha.
- The entire process must be reproducible: record the source URL, API parameters, access date, version/update time, field meanings, and units.
- Data quality first: align definitions, units, frequency, and geographic scope; clearly define strategies for handling missing and anomalous data.
Standard workflow (output according to this every time it is executed)
1) Requirement normalization
Output a "data requirements table" that includes at least:
- Variable names (Chinese and English), units, expected frequency (daily/monthly/yearly), time range
- Geographic granularity (country/province/city/grid) and definition notes
- Allowed substitute indicators (when the primary indicator is unavailable)
2) Source selection strategy (authoritative first, convenience second)
Prioritize matching by task type:
- Macro/development: World Bank, IMF, OECD, UNData
- Population/society: UN DESA, World Bank, national statistical offices/censuses
- Public health: WHO (when necessary, supplement with secondary aggregation sources and annotate the source chain)
- Weather/climate: NOAA, NASA (choose according to open policies)
- European Union statistics: Eurostat
- China: National Bureau of Statistics, ministry open data, local statistical bureaus (prefer downloadable/API options)
3) Access method decision tree
- Official API available: use the API directly
- No API but bulk download available (CSV/Excel/ZIP): direct-link download
- Webpage tables only: first look for the XHR/JSON behind the page; if that still does not work, then do HTML parsing
4) Scraping implementation specifications
The delivered script must have:
- Parameterization: start/end, region, indicator, output_dir
- Robustness: retries (exponential backoff), timeouts, rate limiting, caching/resume from checkpoints
- Persistence: separate raw/ and processed/ directories; retain original responses or original files
- Logging: record only necessary information, do not output sensitive information
5) Cleaning and validation (minimum requirements)
- Fields: unified naming (snake_case), type conversion, unit conversion, time index alignment
- Missing data: explain the reason for missingness (unavailable/gap/definition change), and provide a handling strategy
- Anomalies: basic rule validation (range, threshold for year-over-year/month-over-month jumps)
- Spot checks: compare sample rows against source pages/metadata
6) Deliverables checklist (must be output)
- Data files: raw.*, processed.csv (or parquet)
- Metadata: sources.json (name/url/access_method/params/license/updated_at/accessed_at)
- Data dictionary: field meanings, units, frequency, geographic granularity, missing-data strategy
- Citation format: reference entries that can be used directly in papers/reports
Commonly used authoritative data sources (extensible)
- World Bank Data API
- IMF Data
- UNData / UN agencies
- OECD Data
- Eurostat
- WHO
- NOAA / NASA
- National statistical offices and government open data platforms
User input template (for quick start)
- "I want to do [topic] modeling, with variables [A,B,C]; time [YYYY-YYYY]; region [country/province/city]; please provide authoritative sources and a reproducible data acquisition script + cleaning results."
- "I need official data for [a certain indicator], preferably via API; if not, bulk download; please output sources.json + processed.csv."
Failure fallback strategy
When a source is unavailable/restricted:
- Switch to an authoritative source at the same level (e.g., UN ↔ World Bank ↔ OECD)
- Switch to an alternative indicator and clearly specify the differences in definitions
- Deliver only the most authoritative downloadable version, and explain why automated retrieval is not possible
Directory conventions (aligned with the project globally)
- Raw downloads and API responses are recommended to be saved to:
crawled_data/raw/。 - Cleaned structured data is recommended to be saved to:
crawled_data/processed/。 - Source and reproducibility information is recommended to be saved as:
crawled_data/sources.json(including url, parameters, access date, license/terms).
Before and after linkage
- Subsequent steps usually begin with:
data-cleaning-and-visualization(unify and clean the data incrawled_data/and produce charts). - To continue to a paper draft: return to
paper-workflow-orchestrator。
Constraints (must be followed)
- Memory Interaction (required):
- After obtaining data: must call
context-memory-keeper, record the "new data source name" and "storage path" toShort-term Workbench。
- After obtaining data: must call
- This skill is only responsible for "obtaining authoritative data and ensuring reproducibility"; it is not responsible for directly writing the paper body; outputs must be written to disk in
crawled_data/。 - If the data is to enter the paper, two points must be satisfied at the same time:
crawled_data/sources.jsonrecord citable source information in.- Subsequently call
data-cleaning-and-visualization, clean the data and generatepaper_output/figures/evidence charts.