Agent skill

Simulation Study

by pedrohcgs in pedrohcgs/claude-code-my-workflow

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…

MITAuto-check: notesDatabases

Install Simulation Study

skills CLI
$ npx skills add pedrohcgs/claude-code-my-workflow --skill simulation-study -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install pedrohcgs/claude-code-my-workflow simulation-study --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/pedrohcgs/claude-code-my-workflow.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.claude/skills/simulation-study .claude/skills/simulation-study && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
simulation-study
GitHub stars
1.6k
Token cost
~2.9k tokens
SKILL.md length
828 words
Files
1
Skills in repo
59
Repo updated
First seen
Licence
MIT

At a glance

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…

  • Works in 7 steps: Pre-Flight Report → The DGP → Estimator Grid → …
  • The user says run a Monte Carlo simulation
  • SKILL.md covers Constraints, Workflow Phases, Script Structure and Important, plus 1 more section
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Simulation Study is an agent skill from pedrohcgs/claude-code-my-workflow. 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…

Its SKILL.md is about 2.9k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Databases, covering Database administration. The repository describes itself as: A ready-to-fork Claude Code template for academics using LaTeX/Beamer + R. Multi-agent review, quality gates, adversarial QA, and replication protocols. The licence is MIT.

When your agent uses it

  • The user says run a Monte Carlo simulation
  • Simulation study
  • Check the bias/coverage of an estimator
  • Compare estimators in simulation

Example prompts

  • “run a Monte Carlo simulation”
  • “simulation study”
  • “check the bias/coverage of an estimator”
  • “/simulation-study”

Requirements

  • Pre-approved tools (allowed-tools): Read, Grep, Glob, Write, Edit, Bash, Agent, Task, Monitor

Workflow steps

7 steps, taken from the step headings in SKILL.md.

  1. Pre-Flight Report
  2. The DGP
  3. Estimator Grid
  4. Replication Engine
  5. Metrics & Summary
  6. Figures
  7. Save & Review

What it can do on your machine

Read from SKILL.md and the folder at commit ae72617. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves these tools, so the agent can use them without asking each time:

    • Read
    • Grep
    • Glob
    • Write
    • Edit
    • Bash
    • Agent
    • Task
    • Monitor

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are r and markdown).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Simulation Study loads about 2.9k tokens when it runs. Until then it costs about 167 tokens; SKILL.md has 828 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~167
When it runs · the whole SKILL.md, loaded when a task matches
~2.9k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check: notes

The automated check noted patterns worth knowing about, such as sudo or a known installer.

  • NotePre-approves every shell command (allowed-tools: Bash)SKILL.md
    allowed-tools: Read, Grep, Glob, Write, Edit, Bash, Agent, Task, Monitor

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from pedrohcgs/claude-code-my-workflow at commit ae72617, republished under its MIT licence (© pedrohcgs). 828 words, ~2,872 tokens.

Download SKILL.mdSave it as .claude/skills/simulation-study/SKILL.md (or your agent's skills folder).
name
simulation-study
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/`.
allowed-tools
Read, Grep, Glob, Write, Edit, Bash, Agent, Task, Monitor
argument-hint
[estimator(s) and DGP to study, or path to a script/paper to simulate from]
disable-model-invocation
true
effort
high
metadata.author
Claude Code Academic Workflow
metadata.version
1.0.0

/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 — 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 §2).
  • Follow .claude/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

**Research question:** [what finite-sample property is being demonstrated]
**Target estimand:** [ATT / ATE / coefficient θ — and how its TRUE value is computed from the DGP params]
**Maintained assumptions:** [the FULL list the estimator(s) under study require — A1 … An, every one]
**Regime:** [IN-ASSUMPTION — all hold | OUT-OF-ASSUMPTION — relaxes A[k] only, severity grid {…}, targeting pseudo-estimand …]
**Verification:** [per assumption, the checkable property of the DGP that establishes it — by construction or by an assertion]
**DGP:** [structure + the parameters that define it; what is held fixed vs. varied]
**Estimator grid:** [list each estimator + which estimand it targets + how it returns est/se/CI]
**Design grid:** [sample sizes, parameter values, scenarios to sweep]
**Replications R:** [value] → implied MCSE on coverage ≈ sqrt(0.95·0.05/R) = [value]
**Metrics:** bias, empirical SE, RMSE, coverage, size/power — each with MCSE
**Conventions read:** simulation-conventions.md, r-code-conventions.md

If the estimand or its true value is ambiguous, stop and ask before writing code.

If an assumption cannot be verified — you cannot name the property of the DGP that establishes it — the run is not IN-ASSUMPTION, and per the firewall no within-assumption claim may rest on it. Say so in the Pre-Flight Report rather than letting the header assert what was never checked.

Phase 1: The DGP

Write one parameterized function that returns a dataset. Compute and return (or store) the true target value from the parameters.

r
generate_data <- function(n, params) {
  # ... generate covariates, treatment, outcome from params ...
  list(data = df, truth = compute_truth(params))   # truth from params, never from an estimate
}

The header's Verified lines are earned here: every assumption the regime block claims holds by a check gets that check written into the script (a large-draw assertion, a condition number, a stopifnot() on the parameter bounds), run once at setup. An assumption whose verification exists only in the comment is asserted, not verified.

Phase 2: Estimator Grid

Each estimator is a function data -> list(est, se, ci_lo, ci_hi, converged). State the estimand each one targets; an estimator scored against a mismatched truth is a bug, not a finding.

Phase 3: Replication Engine
  • set.seed(YYYYMMDD) once. For parallel reps use RNGkind("L'Ecuyer-CMRG") and furrr::furrr_options(seed = TRUE).
  • One run = generate data → run every estimator → record a row per estimator with est, se, ci_lo, ci_hi, converged.
  • Pre-allocate / bind results into a tibble of R × (#estimators) rows. Track non-convergence; never silently drop.
Phase 4: Metrics & Summary

Per estimator × scenario, against truth:

  • Bias = mean(est) - truth (+ MCSE = sd(est)/sqrt(R))
  • Empirical SE = sd(est); RMSE = sqrt(mean((est - truth)^2))
  • Coverage = mean(ci_lo <= truth & truth <= ci_hi) (+ MCSE = sqrt(p(1-p)/R))
  • Size / power = rejection rate under the null / alternative DGP
  • Failures = count of non-converged reps

Build a tidy summary table; report MCSE next to every headline metric.

Phase 5: Figures

Use ggplot2 with the project theme: bias / coverage vs. sample size (or scenario), with reference lines (0 bias, nominal coverage). Transparent background, explicit dimensions (per r-code-conventions.md §4).

Show full SKILL.md (325 more words)Show less
Phase 6: Save & Review
  1. saveRDS() the raw per-rep tibble and the summary table to output/; also write the summary as .csv/.tex.

  2. Run the review:

    Delegate to the sim-reviewer agent:
    "Review the simulation script at scripts/R/[name].R"

    The agent is read-only and returns its report; save it to quality_reports/[name]_sim_review.md.

  3. Address Critical/High findings (coverage-vs-truth, estimand mismatch, missing MCSE, dropped reps, an unstated or unverified regime) before presenting.

  4. Apply the firewall to the presentation itself. Every claim you are about to make must cite a run whose regime can bear it — consistency, valid analytic standard errors, nominal coverage, and shipping a default require an IN-ASSUMPTION run and nothing else (simulation-conventions.md §2). Carry the regime in every caption — and per row wherever a severity grid mixes the two.


Script Structure

r
# ============================================================
# [Title] — Monte Carlo simulation
# Author: [project context]
# Purpose: [property being demonstrated]
# Estimand: [target + how truth is computed]
# Maintained assumptions: [A1 ... An — the FULL list the estimator requires]
# Regime: [IN-ASSUMPTION | OUT-OF-ASSUMPTION: relaxes A[k] only, severity ...,
#          targeting pseudo-estimand ...]
# Verified: [per assumption, the property that was actually checked, not asserted]
# Outputs: output/[name]_raw.rds, [name]_summary.{rds,csv}
# ============================================================

# 0. Setup ----
library(tidyverse)
library(furrr)            # parallel reps (optional)
plan(multisession)        # enable parallel workers; omit this line to run sequentially
RNGkind("L'Ecuyer-CMRG")
set.seed(20260531)        # once, YYYYMMDD (simulation-conventions.md §3)
R   <- 2000L              # MCSE on coverage near .95 ≈ 0.005
dir.create("output", recursive = TRUE, showWarnings = FALSE)

# 1. DGP ----
generate_data <- function(n, params) { ... }     # returns list(data, truth)

# 2. Estimators ----
estimators <- list(tsls = est_tsls, liml = est_liml)    # each -> est, se, ci, converged

# 3. Run one replication ----
run_one_rep <- function(rep_id, n, params) { ... }      # -> tibble rows (one per estimator)

# 4. Replicate ----
raw <- future_map_dfr(seq_len(R), run_one_rep, n = n, params = params,
                      .options = furrr_options(seed = TRUE))

# 5. Summarize (vs truth, with MCSE) ----
# Group by EVERY design-grid dimension you sweep (estimator, n, scenario, ...) so
# each group has a single true value. Use per-row `truth` — never `truth[1]` — so a
# truth that varies across the grid can't be silently mis-scored. Score only the
# converged reps; report failures separately.
summary_tbl <- raw |>
  filter(converged) |>
  group_by(estimator) |>                       # add n, scenario, ... as needed
  summarise(
    R_eff    = n(),
    bias     = mean(est - truth),
    emp_se   = sd(est),
    rmse     = sqrt(mean((est - truth)^2)),
    coverage = mean(ci_lo <= truth & truth <= ci_hi),
    .groups  = "drop"
  ) |>
  mutate(
    bias_mcse = emp_se / sqrt(R_eff),
    cov_mcse  = sqrt(coverage * (1 - coverage) / R_eff)
  )

failures <- raw |> group_by(estimator) |> summarise(n_fail = sum(!converged), .groups = "drop")

# Size/power: add `power = mean(reject)` (+ `sp_mcse = sqrt(power*(1-power)/R_eff)`)
# to the summary above — each estimator must emit a per-rep `reject = p_value < alpha`
# column. Size = rejection rate under the null DGP; power = under the alternative.

# 6. Export ----
saveRDS(raw, "output/[name]_raw.rds")
saveRDS(summary_tbl, "output/[name]_summary.rds")
write_csv(summary_tbl, "output/[name]_summary.csv")

Important

  • State the regime, then respect the firewall. A DGP that violates a maintained assumption produces a table on which every other check here passes — and a within-assumption claim built on it is unsupported however clean the numbers look.
  • The truth comes from the DGP, never from an estimate. Coverage is the CI containing the true parameter.
  • No result without an MCSE. If two estimators differ by less than ~2× MCSE, say so.
  • Save raw, not just summary. A number that exists only in the console cannot be audited or put on a slide.
  • Count your failures. Silently dropped non-converged reps bias every metric.

Long-running simulations: use the Monitor tool

Large grids (many scenarios × large R) can run for many minutes. Background-launch via Bash with run_in_background: true, writing R stdout and stderr to a log (e.g. Rscript scripts/R/[name].R > output/[name].log 2>&1), and run the Monitor tool with a command that tails that log through grep --line-buffered, matching progress milestones (e.g. a progressr update) and failure signatures (Error, Execution halted), instead of polling with sleep. Monitor has no job-id parameter: the stdout of its own command is the event stream. See data-analysis/SKILL.md and the guide's Cost-Conscious Parallelism section.

© pedrohcgs, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .claude/skills/simulation-study of pedrohcgs/claude-code-my-workflow.

Open the folder on GitHubat commit ae72617

Compare with similar skills

Simulation Study next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Simulation Study compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Simulation Study this skillpedrohcgs/claude-code-my-workflow1.6k—~2.9kAutomated safety check: NotesMIT
Hybrid Cloud Outboxesgetsentry/sentry46k—~4.8kAutomated safety check: PassCustom licence
Replicate Video AdJingyi-Wu-Richael/replicate-video-ad1071 repos~1.6kAutomated safety check: PassNone
Sea Orm 2FlyinPancake/yoink112—~2.9kAutomated safety check: PassApache-2.0
Pixel Perfect ReplicationYu-369/VibeCurb979—~8.7kAutomated safety check: PassMIT
Horse Database PoolingHashLoad/horse1.4k—~1.4kAutomated safety check: PassMIT

Similar skills

  • Hybrid Cloud Outboxes

    getsentry/sentry

    Official

    Guide for creating and maintaining outbox-based eventually consistent operations in Sentry.

    46k GitHub stars~4.8k tokensUpdated today
    DatabasesAuto-check passed
  • Replicate Video Ad

    Jingyi-Wu-Richael/replicate-video-ad

    Analyze a reference video frame by frame and turn its visual grammar, story beats, dialogue, product reveal, proof sequence, and conversion structure into a production-ready ecommerce story-ad…

    107 GitHub starsUsed in 1 repo~1.6k tokens
    DatabasesAuto-check passed
  • Sea Orm 2

    FlyinPancake/yoink

    Expert guidance for SeaORM 2.0, Rust's async ORM with strongly-typed columns, nested ActiveModels, Entity Loader API, and entity-first workflow.

    112 GitHub stars~2.9k tokensUpdated 3 days ago
    DatabasesAuto-check passed
  • Image-to-code replication pipeline. An agent skill from Yu-369/VibeCurb.

    979 GitHub stars~8.7k tokensUpdated 2 mo ago
    DatabasesAuto-check passed
  • Guide for setting up thread-safe database connection pooling (FireDAC / UniDAC) in multithreaded Horse applications.

    1.4k GitHub stars~1.4k tokensUpdated yesterday
    DatabasesAuto-check passed
  • Redis Clustering

    redis/agent-skills

    Official

    Redis Cluster and replication guidance covering hash tags for multi-key operations, avoiding CROSSSLOT errors, and reading from replicas to scale read-heavy workloads.

    165 GitHub starsUsed in 1 repo~1k tokens
    DatabasesAuto-check passed

More from pedrohcgs/claude-code-my-workflow

All 59 skills in this repo
  • Devils Advocate

    pedrohcgs/claude-code-my-workflow

    Adversarial 5-7 question challenge to a deck's pedagogical choices — ordering, prerequisites, cognitive load, motivation.

    1.6k GitHub starsUsed in 2 repos~641 tokens
    Auto-check passed
  • Vaccinate

    pedrohcgs/claude-code-my-workflow

    Qualify a check before it is allowed to clear anything — prove it can detect the failure it is meant to catch.

    1.6k GitHub stars~2.1k tokensUpdated 10 days ago
    Auto-check: notes
  • Compile Latex

    pedrohcgs/claude-code-my-workflow

    Compile a Beamer LaTeX slide deck with XeLaTeX (3 passes + bibtex).

    1.6k GitHub starsUsed in 1 repo~492 tokens
    Auto-check: notes
  • Context Status

    pedrohcgs/claude-code-my-workflow

    Show current context status and session health. An agent skill from pedrohcgs/claude-code-my-workflow.

    1.6k GitHub starsUsed in 1 repo~613 tokens
    Auto-check: notes
  • Disclosure Check

    pedrohcgs/claude-code-my-workflow

    Pre-screen analysis outputs (tables, figures, logs) built on restricted or confidential data for statistical-disclosure-limitation problems before any release.

    1.6k GitHub starsUsed in 1 repo~2.6k tokens
    Auto-check: notes
  • Stata Replication

    pedrohcgs/claude-code-my-workflow

    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…

    1.6k GitHub starsUsed in 1 repo~2.1k tokens
    Auto-check: notes

Categories

Questions about Simulation Study

What does Simulation Study do?

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…. Simulation Study is an agent skill from pedrohcgs/claude-code-my-workflow. 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.

When should I use Simulation Study?

Simulation Study fits situations like: the user says run a Monte Carlo simulation; simulation study; check the bias/coverage of an estimator; compare estimators in simulation.

How do I install Simulation Study in Claude Code?

Run `npx skills add pedrohcgs/claude-code-my-workflow --skill simulation-study -a claude-code`. Or copy the skill folder (.claude/skills/simulation-study in pedrohcgs/claude-code-my-workflow) into .claude/skills/simulation-study in your project. Claude Code loads it when a task matches its description.

How do I install Simulation Study in Codex?

Run `npx skills add pedrohcgs/claude-code-my-workflow --skill simulation-study -a codex`. Or copy the skill folder (.claude/skills/simulation-study in pedrohcgs/claude-code-my-workflow) into .agents/skills/simulation-study in your project. Codex loads it when a task matches its description.

Can I use Simulation Study in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add pedrohcgs/claude-code-my-workflow --skill simulation-study -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/simulation-study, .gemini/skills/simulation-study, .github/skills/simulation-study and .opencode/skills/simulation-study in your project.

What does Simulation Study need to run?

SKILL.md names no scripts, command-line tools or credentials: Simulation Study is instructions for the agent only. Its frontmatter pre-approves these tools: Read, Grep, Glob, Write, Edit, Bash, Agent, Task, Monitor.

Does Simulation Study access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Simulation Study safe to install?

Our automated static check of SKILL.md found notes only (pre-approves every shell command (allowed-tools: bash)), nothing it rates as a warning. It is not a guarantee. Review the folder before installing.

What licence does Simulation Study use?

Simulation Study is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Simulation Study use?

About 2.9k tokens (SKILL.md is roughly 11k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Simulation Study?

Skills that share tags, products or a category with Simulation Study: Hybrid Cloud Outboxes (getsentry/sentry, 46k stars), Replicate Video Ad (Jingyi-Wu-Richael/replicate-video-ad, 107 stars), Sea Orm 2 (FlyinPancake/yoink, 112 stars) and Pixel Perfect Replication (Yu-369/VibeCurb, 979 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Simulation Study?

pedrohcgs (a GitHub user) maintains it in pedrohcgs/claude-code-my-workflow, which has 1,645 GitHub stars. The repository holds 59 skills in this directory. The repository was last updated on September 27, 2026.

Source: pedrohcgs/claude-code-my-workflow on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.