Data Analysis logo

Data Analysis

Community
HaipingXu
data-analysis

This skill should be used when the user asks to "run data analysis", "analyze this dataset", "regress Y on X", "run the main regressions", "produce tables and figures", "end-to-end analysis", "write analysis script", "set up panel regression", "exploratory data analysis", or "produce publication-ready output". Provides end-to-end data analysis workflow for social science research in Python (primary) or Stata, from data loading through publication-ready tables and figures.

Overview

PublisherHaipingXu
Repositorysocial-science-claude-scholar
Skill namedata-analysis
Stars
26
Forks
5
Bundled files
Instructions only
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by HaipingXu on GitHub. Read the source before you install it.

Installation

Install the Data Analysis AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/HaipingXu/social-science-claude-scholar/tree/main/skills/data-analysis
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/HaipingXu/social-science-claude-scholar.git /tmp/social-science-claude-scholar
mkdir -p .claude/skills
cp -r /tmp/social-science-claude-scholar/skills/data-analysis .claude/skills/data-analysis
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Data Analysis in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Data Analysis on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Data Analysis is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Data Analysis Workflow — Social Science Research

End-to-end data analysis: load, explore, analyze, and produce publication-ready output. Primary language is Python (transitioning from Stata); Stata workflows are also supported.

Input: Dataset path or description of analysis goal (e.g., "regress log wages on education with individual fixed effects using PSID panel 2000-2020").


Constraints

  • Use relative paths everywhere — no hardcoded absolute paths
  • Set seed once at top for all stochastic operations
  • Save all scripts to scripts/ with descriptive names
  • Save all outputs (figures, tables, processed data) to output/
  • Follow coding-style.md for Python file structure

Workflow Phases

Phase 1: Setup

Python setup:

python
# ============================================================
# [Descriptive Title]
# Purpose: [What this script does]
# Inputs:  [Data files]
# Outputs: [Figures, tables, parquet/pickle files]
# ============================================================

import random
import numpy as np
import pandas as pd
from pathlib import Path

# Set seed
SEED = 42
random.seed(SEED)
np.random.seed(SEED)

# Paths
ROOT = Path(__file__).parent.parent
DATA = ROOT / "data"
OUTPUT = ROOT / "output"
(OUTPUT / "figures").mkdir(parents=True, exist_ok=True)
(OUTPUT / "tables").mkdir(parents=True, exist_ok=True)

Stata setup:

stata
clear all
set more off
set seed 42

global root  "/path/to/project"  // SET THIS
global data  "$root/data"
global out   "$root/output"

Phase 2: Exploratory Data Analysis

Generate diagnostic outputs before running regressions:

  • Summary statistics: means, SDs, min/max, missingness
  • Distributions: histograms for key variables
  • Time trends: if panel data, plot key variables over time
  • Treatment/control balance: compare groups before treatment
  • Correlation: between outcome and main predictors

Save all EDA figures to output/figures/eda/.

Phase 3: Main Analysis

Python — panel regression (linearmodels / pyfixest):

python
# Fixed effects regression with clustered SE
from pyfixest.estimation import feols

# Baseline
m1 = feols("log_wage ~ educ | ind_id + year", data=df, vcov={"CRV1": "state"})

# With controls
m2 = feols("log_wage ~ educ + exp + exp2 | ind_id + year", data=df, vcov={"CRV1": "state"})

print(m1.summary())
print(m2.summary())

Python — DID with staggered adoption (pyfixest):

python
from pyfixest.estimation import feols
from pyfixest.report import etable

# Two-way FE (baseline, biased under staggered)
twfe = feols("y ~ i(rel_time, ref=-1) | unit + year", data=df, vcov={"CRV1": "unit"})

# Sun & Abraham (2021) heterogeneity-robust
sa = feols("y ~ sunab(cohort, rel_time) | unit + year", data=df, vcov={"CRV1": "unit"})

Stata — equivalent:

stata
reghdfe log_wage educ, absorb(ind_id year) cluster(state)
estimates store m1

reghdfe log_wage educ exp c.exp#c.exp, absorb(ind_id year) cluster(state)
estimates store m2

Phase 4: Publication-Ready Output

Regression tables — Python:

python
from pyfixest.report import etable

# Export to LaTeX
etable([m1, m2, m3],
       file="output/tables/table1.tex",
       digits=3,
       coef_fmt="b (se)")

Figures — Python (ggplot-style with plotnine):

python
from plotnine import ggplot, aes, geom_point, geom_line, theme_bw, labs, ggsave

fig = (ggplot(df_plot, aes(x="year", y="estimate", ymin="ci_low", ymax="ci_high"))
       + geom_point()
       + geom_line()
       + theme_bw()
       + labs(x="Year", y="Coefficient Estimate", title="Event Study"))

ggsave(fig, "output/figures/event_study.pdf", width=7, height=5)
ggsave(fig, "output/figures/event_study.png", width=7, height=5, dpi=300)

Save objects for reuse:

python
import pickle

with open("output/reg_results.pkl", "wb") as f:
    pickle.dump({"m1": m1, "m2": m2}, f)

Phase 5: Quality Check

Before finalizing:

  1. Verify script runs top-to-bottom without errors
  2. Check: Are SEs clustered at the right level? Justify in a comment.
  3. Check: Is the effect size economically meaningful? Add a sentence.
  4. Check: Are all output files labeled and self-contained?
  5. Apply quality-gates scoring (target ≥ 80)

Common Analysis Patterns

Event Study / DID Pre-Trends

python
# Plot coefficients from dynamic DID
twfe_coefs = twfe.coef().reset_index()
twfe_coefs["t"] = twfe_coefs["Coefficient"].str.extract(r"rel_time::(-?\d+)").astype(float)
# Plot with CI bands — see Phase 4 for plotnine code

IV / 2SLS

python
from pyfixest.estimation import feols

# First stage + IV
iv = feols("y ~ x2 | id + year | x1 ~ z1", data=df, vcov={"CRV1": "state"})
print(iv.first_stage())  # F-statistic

RDD

python
from rdrobust import rdrobust, rdplot

rdd = rdrobust(y=df["outcome"], x=df["running"], c=0)
rdplot(y=df["outcome"], x=df["running"], c=0)

Stata-to-Python Translation Reference

StataPython (pyfixest/linearmodels)Notes
reghdfe y x, absorb(id year) cluster(g)feols("y ~ x | id + year", vcov={"CRV1": "g"})Check if df-adjustment differs
areg y x, absorb(id) cluster(g)feols("y ~ x | id", vcov={"CRV1": "g"})Equivalent
ivreg2 y (x=z), cluster(g)feols("y ~ 1 | id | x ~ z", vcov={"CRV1": "g"})First stage F-stat: iv.first_stage()
bootstrap, reps(999): reg y xresample + loopMatch seed, reps, bootstrap type
estout m1 m2 using t.texetable([m1, m2], file="t.tex")pyfixest ≥ 0.18

Important

  • Reproduce, don't guess. If the user specifies a regression, run exactly that specification.
  • Show your work. Print summary statistics before jumping to regressions.
  • Check for issues. Look for multicollinearity, outliers, treatment overlap.
  • Comment identification logic. Each regression should have a 1-2 line comment explaining what variation is being exploited and what threat is being addressed.

Frequently asked questions

What does the Data Analysis AI skill do?

This skill should be used when the user asks to "run data analysis", "analyze this dataset", "regress Y on X", "run the main regressions", "produce tables and figures", "end-to-end analysis", "write analysis script", "set up panel regression", "exploratory data analysis", or "produce publication-ready output". Provides end-to-end data analysis workflow for social science research in Python (primary) or Stata, from data loading through publication-ready tables and figures.

Why use Data Analysis on TypingMind?

Because you install it once and use it with any model. Data Analysis is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Data Analysis in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/HaipingXu/social-science-claude-scholar/tree/main/skills/data-analysis. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Data Analysis?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Data Analysis?

As many as you like. As long as a model supports skills, you can use Data Analysis with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Data Analysis AI skill free?

It is published on GitHub by HaipingXu. Check the repository for licensing terms. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇