$npx -y skills add QinghongLin/data2story-skill --skill data2storyData Journalist Agent (Data2Story) — orchestrator: turn a dataset into a blog. Runs detective → analyst → editor → designer → programmer → auditor → inspector in sequence. Creates a versioned project folder for each run.
| 1 | # Data Journalist Agent (Data2Story) |
| 2 | |
| 3 | Turn **$ARGUMENTS** into a blog. Orchestrates the roles below in sequence. |
| 4 | |
| 5 | ## Setup |
| 6 | |
| 7 | Resolve paths before doing anything: |
| 8 | |
| 9 | - Never hard-code machine-local paths and never ask the user to export path variables. |
| 10 | - Resolve `SKILL_DIR` = the directory containing this `SKILL.md` (`.../skills/data2story`) |
| 11 | - Resolve `ARCHIVE_DIR` = the ancestor directory that contains `skills/` (two levels up from `SKILL_DIR`, i.e. `SKILL_DIR/../..`) |
| 12 | - Resolve `DATA2STORY_ROOT` = parent of `ARCHIVE_DIR` |
| 13 | - Commands below use symbolic placeholders such as `ARCHIVE_DIR`; replace them with resolved, quoted paths before running Bash. |
| 14 | - `DATA_NAME` = the dataset folder name (e.g. `pick_a_card`) |
| 15 | - `DATA_DIR` = if `$ARGUMENTS` is an existing path, use that path; otherwise use `DATA2STORY_ROOT/data/{DATA_NAME}` |
| 16 | - `TIMESTAMP` = current time formatted as `MMDD_HHMM` (e.g. `0401_1618`): `date +%m%d_%H%M` (run in bash) |
| 17 | - `PROJECT_DIR` = `DATA2STORY_ROOT/project/{DATA_NAME}/blog_{MODEL}_{TIMESTAMP}` |
| 18 | - Create `PROJECT_DIR/`, `PROJECT_DIR/assets/`, `PROJECT_DIR/code/` |
| 19 | |
| 20 | ## Archival |
| 21 | |
| 22 | Immediately after creating `PROJECT_DIR`, snapshot the current skills: |
| 23 | |
| 24 | ```bash |
| 25 | mkdir -p PROJECT_DIR/archival |
| 26 | cp -r ARCHIVE_DIR/skills PROJECT_DIR/archival/skills |
| 27 | ``` |
| 28 | |
| 29 | This preserves the exact skill versions used for this run. |
| 30 | |
| 31 | ## Tools available |
| 32 | |
| 33 | All media tools route through OpenRouter. Set `OPENROUTER_API_KEY` before any generation call. |
| 34 | |
| 35 | Media generation is the Designer's job, so the media tools (text2image, text2video, image2video, text2music, embeddings) live under `SKILL_DIR/designer/scripts/openrouter-*/`. The full list — default models and exact `python3 ...` invocations — is in **[`designer/references/tools.json`](designer/references/tools.json)**; full per-tool docs are each tool's own `SKILL.md` under `SKILL_DIR/designer/scripts/openrouter-*/`. |
| 36 | |
| 37 | ## Pipeline Overview |
| 38 | |
| 39 | The pipeline is a single linear sequence that produces a traceable HTML blog from raw data: |
| 40 | |
| 41 | ``` |
| 42 | DATA → Detective → Analyst → Editor → Designer → Programmer → Auditor → Inspector → final index.html + viewer.html |
| 43 | ``` |
| 44 | |
| 45 | Run each stage in order. Each stage reads the previous artifact(s) before starting. Do not proceed to the next stage until the current artifact is complete. |
| 46 | |
| 47 | ### Stage 1 — Detective |
| 48 | Input: `DATA_DIR` |
| 49 | Output: `PROJECT_DIR/detective.json` |
| 50 | What: Researches external context — background knowledge, domain history, related findings, why this data matters. Each finding gets a `det_xx` ID. |
| 51 | |
| 52 | ### Stage 2 — Analyst |
| 53 | Input: `DATA_DIR`, `PROJECT_DIR/detective.json` |
| 54 | Output: `PROJECT_DIR/code/*.py`, `PROJECT_DIR/analyst.json` |
| 55 | What: Exhaustive quantitative analysis of the data, informed by detective's context. All code saved to `code/` as runnable scripts. Each finding gets an `ana_xx` ID with `calculation` (file + lines + output) and `data_table` (chart-ready data). |
| 56 | |
| 57 | ### Stage 3 — Editor |
| 58 | Input: `PROJECT_DIR/detective.json`, `PROJECT_DIR/analyst.json` |
| 59 | Output: `PROJECT_DIR/editor.md`, `PROJECT_DIR/editor.json` |
| 60 | What: Editorial decisions — which findings matter, what the narrative arc is, what the blog argues. Each section gets an `edt_xx` ID with explicit references to `ana_xx` findings and `det_xx` context. No visual design. |
| 61 | |
| 62 | ### Stage 4 — Designer |
| 63 | Input: `PROJECT_DIR/editor.md`, `PROJECT_DIR/editor.json`, `PROJECT_DIR/analyst.json` |
| 64 | Output: `PROJECT_DIR/designer.json`, `PROJECT_DIR/assets/*` |
| 65 | What: Data-driven creative visual decisions — how to present each point using charts, images, video, audio, maps, interactives, stat callouts, instances, or text-only treatment when appropriate. The media mix should emerge from the dataset's properties, not from a fixed checklist. The page should be **multimedia-rich by default**: borrow the visual language from the shared [`frontend-design`](../frontend-design/) skill and use all five channels (chart, image, video, audio, interactive/map) unless a channel's documented fallback would be fabricated or purely decorative. Each visual gets a `des_xx` ID with `data_source` pointing to `ana_xx` data_tables when data-driven. Generates selected assets. No HTML. |
| 66 | |
| 67 | ### Stage 5 — Programmer |
| 68 | Input: `PROJECT_DIR/editor.md`, `PROJECT_DIR/editor.json`, `PROJECT_DIR/analyst.json`, `PROJECT_DIR/designer.json` |
| 69 | Output: `PROJECT_DIR/index.html` |
| 70 | What: Implements the final blog in HTML. Applies the theme/accent recorded in `designer.json` `page_rhythm` and borrows component + token recipes from the [`frontend-design`](../frontend-design/) skill. Resolves chart data from analyst.json data_tables (NO raw data access). Tags every element with `data-edt`, `data-ana`, `data-det`, `data- |