Skip to content
Automation
Skill

/analyze

End-to-end data analysis dispatching Coder and Data-engineer for implementation, coder-critic for review. Supports R, Stata, Python, Julia. Replaces /data-analysis.

From plugin
auto-empirical-research-skills
3.3k200 skills146 agents
Install
$ npx -y skills add brycewang-stanford/Auto-Empirical-Research-Skills --skill analyze --agent claude-code

How it fires

How this skill gets triggered: by you, by Claude, or both.

  • Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
  • You can call itInvoke it directly when you want it.
  • Slash command/analyze

Context preview

The summary Claude sees to decide when to auto-load this skill.

End-to-end data analysis dispatching Coder and Data-engineer for implementation, coder-critic for review. Supports R, Stata, Python, Julia. Replaces /data-analysis.

SKILL.md

analyze.SKILL.md
name: analyze
description: End-to-end data analysis dispatching Coder and Data-engineer for implementation, coder-critic for review. Supports R, Stata, Python, Julia. Replaces /data-analysis.
argument-hint: "[dataset path or goal] Options: --dual [lang1,lang2]"
allowed-tools: Read,Grep,Glob,Write,Edit,Bash,Task

Analyze

Run end-to-end data analysis by dispatching the **Coder** (analysis), **Data-engineer** (cleaning + figures), and **coder-critic** (code review).

**Input:** `$ARGUMENTS` — dataset path or description of analysis goal.

---

Workflow

Step 1: Context Gathering

1. Read .claude/references/domain-profile.md for field conventions 2. Read strategy memo in `quality_reports/` if it exists 3. Check CLAUDE.md for language preference (R/Stata/Python/Julia) 4. Scan existing scripts in `scripts/` for project patterns

Step 2: Data Preparation (if needed)

If raw data provided, dispatch **Data-engineer** first:

  • Clean and wrangle raw data
  • Handle missing values, construct variables per strategy memo
  • Generate summary statistics table
  • Create publication-quality descriptive figures
  • Save cleaned data, codebook, and figures

Step 3: Main Analysis

Dispatch **Coder** agent:

  • Stage 0: Data loading (from cleaned data or raw)
  • Stage 1: Main specification (from strategy memo or user description)
  • Stage 2: Robustness checks
  • Stage 3: Publication-ready output (tables to `paper/tables/`, figures to `paper/figures/`)
  • Produce `results_summary.md` with all estimates, SEs, and key statistics (MANDATORY)
  • Save scripts to `scripts/R/` (or appropriate language directory)

The Coder follows these principles:

  • **Script structure:** Use the Script Structure Template below
  • **Packages:** `fixest` for panel data, `modelsummary` for tables, `ggplot2` for figures
  • **Standard errors:** Cluster at appropriate level (match treatment assignment)
  • **Output:** `.tex` tables for LaTeX, `.pdf`/`.png` figures, `.rds` for intermediate objects
  • **No hardcoded paths.** All paths relative to repository root.
  • **saveRDS everything.** Every computed object (estimates, model fits, data frames, summary statistics) gets serialized to `.rds` for downstream use by the writer and other agents.

Step 4: Code Review

Dispatch **coder-critic** agent — run the full 12-category checklist:

**Strategic (categories 1-3):** 1. **Code-strategy alignment** — Does the code implement the strategy memo faithfully? Correct dependent variable, treatment, controls, fixed effects, sample restrictions? 2. **Sanity checks** — Are summary statistics printed before regressions? Do coefficient signs match economic intuition? Are sample sizes reasonable? 3. **Robustness sufficiency** — Are required robustness checks present? Alternative specifications, placebo tests, sensitivity analysis per strategy memo?

**Code Quality (categories 4-12):** 4. **Structure** — Does the script follow the standard template? Clear section headers, logical flow from setup to export? 5. **Console hygiene** — No spurious `print()` statements polluting output. Intentional output only. 6. **Reproducibility** — `set.seed()` at top if any stochastic elements. No absolute paths. All packages loaded at top. Directory creation with `showWarnings = FALSE`. 7. **Functions** — Repeated logic extracted into functions. No copy-paste code blocks with minor variations. 8. **Figure quality** — Publication-ready: proper axis labels, titles, legends, font sizes. Consistent theme across all figures. 9. **RDS pattern** — Every computed object (models, data frames, summary stats) saved via `saveRDS()` for downstream use. Not just final outputs — intermediate objects too. 10. **Comments** — Section headers present. Non-obvious code commented. No commented-out dead code left behind. 11. **Error handling** — Graceful handling of missing files, empty data subsets, convergence failures. Informative error messages. 12. **Polish** — Consistent naming conventions. No magic numbers. Clean whitespace. Professional quality ready for replication package.

If strategy memo exists, cross-reference code against stated design. Save report to `quality_reports/[script]_code_review.md`.

Step 5: Fix Issues

If coder-critic finds Critical or Major issues: 1. Re-dispatch Coder with specific fixes (max 3 rounds) 2. Re-run coder-critic to verify fixes

Step 6: Present Results

1. **Results summary** — key estimates with SEs and interpretation (from `results_summary.md`) 2. **Scripts created** — paths and descriptions 3. **Output files** — tables in `paper/tables/`, figures in `paper/figures/` 4. **Code review score** — from coder-critic 5. **TODO items** — missing data, additional specifications needed

---

Script Structure Template

# ============================================================
# [Descriptive Title]
# Author: [from project context]
# Purpose: [What this script does]
# Inputs: [Data files]
# Outputs: [Figures, tables, RDS files]
# ============================================================

# 0. Setup ----
library(tidyverse)
library(fixest)
library(modelsummary)

set.seed(42)

dir.create("paper/tables", recursive = TRUE, showWarnings = FALSE)
dir.create("paper/figures", recursive = TRUE, showWarnings = FALSE)

# 1. Data Loading ----

# 2. Exploratory Analysis ----

# 3. Main Analysis ----

# 4. Tables and Figures ----

# 5. Export ----
# saveRDS(model_fit, "scripts/R/output/model_fit.rds")
# saveRDS(main_results, "scripts/R/output/main_results.rds")

---

Results Summary (Mandatory Artifact)

Every analysis run MUST produce `results_summary.md` containing:

  • All point estimates with standard errors and significance levels
  • Sample sizes for each specification
  • Key summary statistics (means, medians, standard deviations of main variables)
  • Robustness check results (brief table or comparison)
  • Any flags or anomalies discovered during analysis

This file is the primary handoff artifact to the writer agent. Without it, the writer ca

Read more
Ships withauto-empirical-research-skills

📌 文档结构(2026-07-22 起): 本文件是中文默认入口 —— banner + badges + 信任面 + 9 阶段流水线速览 + 76 行合集总表。 每个合集的完整描述、按用途分组、精确数字、验证方法在 docs/CONTENT_ZH.md(扩展正文,总表行内的 → 直接跳转到对应锚点)。 English version: README-en.md · 中文扩展正文:docs/CONTENT_ZH.md · README-zh-CN.md 已弃用(重定向占位) 🌐 语言: English |

Get the whole plugin