# Simulation Study

Scaffold and run a reproducible Monte Carlo simulation study in R, a declared...

- Repository: https://github.com/pedrohcgs/claude-code-my-workflow (1676 stars)
- Category: Engineering
- License: MIT
- Last updated: 2026-09-27
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add pedrohcgs/claude-code-my-workflow --skill simulation-study -g -a claude-code -y`
Codex: `npx skills add pedrohcgs/claude-code-my-workflow --skill simulation-study -g -a codex -y`
Cursor: `npx skills add pedrohcgs/claude-code-my-workflow --skill simulation-study -g -a cursor -y`
Gemini CLI: `npx skills add pedrohcgs/claude-code-my-workflow --skill simulation-study -g -a gemini-cli -y`

## Description

Scaffold and run a reproducible Monte Carlo simulation study in R, a declared assumption regime, a parameterized DGP, an estimator grid, a seeded replication loop, and a summary of bias, RMSE, empirical SE, coverage, size/power with Monte Carlo standard errors. Use when the user says "run a Monte Carlo simulation", "simulation study", "check the bias/coverage of an estimator", "compare estimators in simulation", "size and power simulation", "Monte Carlo experiment", or wants to demonstrate an estimator's finite-sample properties. Produces a numbered R script in `scripts/R/` and saves per-replication raw results + a summary table to `output/`.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# `/simulation-study`, Monte Carlo Simulation Study

Design and run a Monte Carlo experiment that characterizes an estimator's finite-sample behavior, then review it for the bugs that quietly invalidate simulation evidence.

**Input:** `$ARGUMENTS`, a description of the estimator(s) and DGP to study (e.g., "compare 2SLS vs LIML under weak instruments with heteroskedasticity"), or a pointer to an existing script/paper whose simulation you want to reproduce or extend.

---

## Constraints

- **Follow [`.claude/rules/simulation-conventions.md`](../../rules/simulation-conventions.md)**, the simulation contract (DGP, truth, estimand, MCSE, assumption regime) is non-negotiable.
- **Declare the assumption regime in the script header** and respect the firewall, an out-of-assumption run never supports a within-assumption claim ([`simulation-conventions.md`](../../rules/simulation-conventions.md) §2).
- **Follow [`.claude/rules/r-code-conventions.md`](../../rules/r-code-conventions.md)** for general R standards (header, `library()` at top, relative paths, numerical discipline).
- **Save the script** to `scripts/R/` with a numbered, descriptive name (e.g., `scripts/R/sim_2sls_vs_liml.R`).
- **Save outputs** (per-rep raw tibble, summary table, figures) to `output/`.
- **`saveRDS()` the per-replication raw results**, not just the summary, re-aggregation and the review pass need them.
- **Run the `sim-reviewer` agent** on the generated script before presenting results, then address Critical/High findings.

---

## Workflow Phases

### Phase 0: Pre-Flight Report

**Before writing any code, produce a Pre-Flight Report** showing you have pinned down the experiment. This prevents the most common failure mode, a beautiful results table built on a mismatched estimand or a coverage-against-the-estimate bug.

```markdown
## Pre-Flight Report, Simulation Design

The rest: https://github.com/pedrohcgs/claude-code-my-workflow/blob/HEAD/.claude/skills/simulation-study/SKILL.md
