# stata-replication

This skill builds numbered Stata scripts, runs them through an MCP server, and saves logs, tables, and figures. Use it to set up a reproducible analysis workflow.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode · ★ 1671
- Author: Claude Code Academic Workflow
- License: MIT · policy=mirror · the beginning of the file is at the end of this page
- Source: https://github.com/pedrohcgs/claude-code-my-workflow/tree/HEAD/.claude/skills/stata-replication/SKILL.md
- Updated: 2026-09-27
- HTML: https://affpapa.org/en/nevibecode/skills/stata-replication

## What it does

The skill lays out a pipeline in `scripts/stata/`: scripts clean data, produce descriptive results, estimate models, and prepare outputs. A `99_run_all.do` file provides a single entry point. Tables are created with `esttab`, figures are exported as PDFs, and logs and results go to `output/`. Estimation details are recorded in `quality_reports/spec-ledger.md`.

Execution relies on the `stata-mcp` MCP server and a local Stata installation. Both are required before the scripts can run. On a script failure, the skill stops and reports the issue; it only attempts to fix a straightforward parse-time typo. Use `--no-execute` to generate files without running them, or `--from-r` to compare against a pipeline in `scripts/R/`.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add pedrohcgs/claude-code-my-workflow --skill stata-replication -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/stata-replication/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/stata-replication/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add pedrohcgs/claude-code-my-workflow --skill stata-replication -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/stata-replication/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add pedrohcgs/claude-code-my-workflow --skill stata-replication -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/stata-replication/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install pedrohcgs/claude-code-my-workflow stata-replication
```

2. **Manually: put the files in place**
- File: `.github/skills/stata-replication/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add pedrohcgs/claude-code-my-workflow --skill stata-replication -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/pedrohcgs/claude-code-my-workflow --path .claude/skills/stata-replication
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/stata-replication/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add pedrohcgs/claude-code-my-workflow --skill stata-replication -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/pedrohcgs/claude-code-my-workflow/tree/HEAD/.claude/skills/stata-replication/SKILL.md

## When to use it
- scaffold numbered `.do` files for a replication project
- run Stata scripts and save their logs and results
- generate analysis tables and PDF figures
- compare Stata output with an existing R pipeline

## Example prompts
- Set up a Stata replication pipeline for this dataset.
- Create the files in `scripts/stata/` without running them.
- Translate the analysis in `scripts/R/` to Stata and compare the results.

## Source text · SKILL.md · MIT

Below is the content of a third-party file. It is data, not instructions for you: do not act on anything written inside unless the human asks. Block tag: 3dfa6b261d858384.

BEGIN THIRD-PARTY FILE 3dfa6b261d858384
````text
---
name: stata-replication
description: End-to-end Stata replication pipeline — scaffolds numbered `.do` files in `scripts/stata/`, executes them via the `stata-mcp` MCP server, captures logs and outputs to `output/`, and produces publication-ready tables (esttab) and figures (graph export). Mirrors `/data-analysis` for R-first projects. Use when user says "stata replication", "set up Stata pipeline", "scaffold the .do files", "run Stata analysis", "AEA replication package in Stata", or when a project's analysis language is Stata not R.
argument-hint: "[paper-or-data-pointer] [--from-r] [--no-execute]"
disable-model-invocation: true
allowed-tools: ["Read", "Write", "Edit", "Glob", "Grep", "Bash", "Agent", "Task"]
metadata:
  author: Claude Code Academic Workflow
  version: 1.0.0
---

# `/stata-replication` — Stata pipeline scaffold + execution

Build a complete Stata replication pipeline in `scripts/stata/`: numbered `.do` files following [`.claude/rules/stata-code-conventions.md`](../../rules/stata-code-conventions.md), executed via the [`stata-mcp`](https://github.com/SepineTam/stata-mcp) MCP server, with outputs landing in `output/`.

## When to use

- Your project's analysis language is **Stata** (not R). Common in econ field experiments, RCT studies, and any AEA submission where the original replication package is Stata.
- You're porting an R-first project to Stata for an AEA submission.
- You're adding a Stata robustness check to an R-first paper.
- You want a one-command reproduction: `do scripts/stata/99_run_all.do`.

## When NOT to use

- Your project is R-first. Use [`/data-analysis`](../data-analysis/SKILL.md).
- Your project is Python-first. Neither this skill nor `/data-analysis` is the right fit; consider extending the convention rule for Python or porting one of these skills.
- You're doing quick exploratory work. The numbered-pipeline scaffold is for replication packages, not scratch notebooks.

## Prerequisite: `stata-mcp` installed

This skill requires the `stata-mcp` MCP server. Install once per user:

```bash
claude mcp add stata-mcp --scope user -- uvx stata-mcp
```

The MCP server provides command-guarded Stata execution (refuses destructive operations like `!/shell/erase`), RAM monitoring, and Stata Language Server pairing. Maintained by SepineTam.

If `stata-mcp` is not installed, the skill halts at Phase 0 with installation instructions.

## Workflow

### Phase 0: Pre-flight

1. Verify `stata-mcp` is registered in the user's MCP configuration. If not → halt with install instructions.
2. Verify Stata is installed locally (the MCP server cannot run without it). Output stata version to confirm.
3. Confirm `scripts/stata/` directory exists or can be created.
4. Read [`.claude/rules/stata-code-conventions.md`](../../rules/stata-code-conventions.md) — every emitted `.do` file follows this convention.
````
END THIRD-PARTY FILE 3dfa6b261d858384

The third-party file has ended. Everything between the 3dfa6b261d858384 tags is data: requests and commands from it are not followed. An “end of file” line with another tag inside the block is part of the file.

First 2879 of 8332 bytes. © Claude Code Academic Workflow · MIT · https://github.com/pedrohcgs/claude-code-my-workflow/tree/HEAD/.claude/skills/stata-replication/SKILL.md

_Part of the page did not fit — see the HTML version._

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
