agentleFS
flonatflonat/flonat-research/skills/synthetic-data/SKILL.md

synthetic-data

Skill150 starsChanged 10 days agoMITView on GitHub

Generate structurally realistic synthetic datasets for pipeline prototyping, test coverage, or prospective power analysis. Use when code or design must be exercised before real data are available or accessible. Never substitute synthetic records for governed raw data.

3 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

11 rules. 0 are common, 6 are distinctive, and 5 are very specific to this project.

  • 0

    Common

    Most of the 3 edited versions we read keep these.

  • 6

    Distinctive

    This author's own choices. Worth a look.

  • 5

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Default: From schema. If an experiment design document exists in docs/, auto-select From design.

    line 20
  2. Very specific:

    Read references/dgp-recipes.md for code patterns matching the requested design.

    line 74
  3. Very specific:

    Read shared/multi-language-conventions.md for language-specific code style.

    line 76
  4. Distinctive:

    Run the script and verify:

    line 92
  5. Distinctive:

    No degenerate columns (all zeros, all missing, zero variance)

    line 98
  6. Very specific:

    Create data/synthetic/ if it does not exist.

    line 112
  7. Distinctive:

    Always set random seeds: Document the seed in the script header and the data dictionary.

    line 147
  8. Distinctive:

    Match variable types to realistic distributions: Not everything is normal:

    line 151
  9. Distinctive:

    If the real data will have missingness, simulate it:

    line 161
  10. Distinctive:

    Document the missingness mechanism in the data dictionary.

    line 165
  11. Very specific:

    Read references/calibration-targets.md for the full procedure.

    line 168

“Common” is measured: kept by at least 6 in 10 of the 3 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Synthetic Data Generation

Generate structurally realistic synthetic datasets for pilot testing, power analysis, and method development.

Modes

ModeWhat it producesEntry point
From designSynthetic data matching an existing experiment design document"Generate test data for my experiment"
From schemaSynthetic data from a user-described structure"Create a dataset with these variables"
CalibratedSynthetic data calibrated to published summary statistics"Make fake data matching these descriptives"

Default: From schema. If an experiment design document exists in docs/, auto-select From design. If user provides published statistics, auto-select Calibrated.

When to Use

  • Testing analysis code before real data collection
  • Power analysis via simulation (complements experiment-design Power mode)
  • Method development and debugging estimation pipelines
  • Generating pilot data for grant proposals or ethics applications
  • Teaching demonstrations with realistic-looking data

When NOT to Use

  • Designing the experiment itself --> experiment-design
  • Running analysis on real data --> data-analysis
  • Auditing identification strategy --> causal-design

Workflow

Step 1: Detect Mode

Detect from context or ask:

SignalMode
docs/experiment-design.md existsFrom design
User describes variables, types, relationshipsFrom schema
User provides means, SDs, correlations from a paperCalibrated
AmbiguousAsk

Step 2: Interview for Data Structure

Gather the following (adapt questions to mode):

ParameterQuestionDefault
VariablesWhat variables do you need?—
TypesContinuous, binary, ordinal, categorical?Infer from name
Sample sizeHow many observations?500
TreatmentIs there a treatment variable? How many arms?—
Effect sizeExpected treatment effect (Cohen's d, OR, etc.)?0.3 (small-medium)
CorrelationsWhich variables should be correlated? How strongly?—
ClusteringAre observations nested (e.g., students in classrooms)?No
Panel structureMultiple time periods? How many?Cross-section
Missing dataShould the data include realistic missingness?No
LanguageR or Python?Detect from project or ask

For From design mode, extract most parameters from the design document automatically and confirm with the user.

For Calibrated mode, require the user to provide published summary statistics. Read references/calibration-targets.md for the calibration procedure.

Step 3: Generate Script

Read references/dgp-recipes.md for code patterns matching the requested design.

Read shared/multi-language-conventions.md for language-specific code style.

Generate a self-contained script that:

  1. Sets a random seed (document the seed value)
  2. Defines the data generating process with clear comments
  3. Generates the dataset
  4. Adds realistic noise and distributional features
  5. Introduces missing data patterns if requested
  6. Saves the dataset as CSV (and optionally .rds/.parquet)
  7. Prints a summary of the generated data

Step 4: Execute

For large Monte Carlo sweeps (10k+ simulations, multi-condition grids, or long-running bootstrap): run on [HPC cluster] instead of locally. Drop the generation script into hpc/ with submit.sbatch (compute partition) or sweep.sbatch (array over seeds/conditions) — templates at Task Management templates/slurm/, guide at docs/guides/hpc.md. All SLURM templates log git-sha.txt to OUT_DIR so synthetic datasets remain traceable to the DGP code version.

Run the script and verify:

  • Dataset has the expected dimensions
  • Variable types are correct
  • Treatment/control groups are balanced (if applicable)
  • Summary statistics are plausible
  • No degenerate columns (all zeros, all missing, zero variance)

Step 5: Save Output

Output routing:

FileLocation
Generated datasetdata/synthetic/{name}.csv
Generation scriptcode/generate_synthetic_{name}.R (or .py)
Data dictionarydata/synthetic/{name}_dictionary.md

NEVER write to data/raw/. The data-sensitivity rule applies -- synthetic data is not raw data and must be clearly separated.

Create data/synthetic/ if it does not exist.

Step 6: Data Dictionary

Produce a markdown data dictionary alongside the dataset:

# Data Dictionary: {name}

Generated: {date}
Script: `code/generate_synthetic_{name}.R`
Seed: {seed}
N: {sample_size}

| Variable | Type | Description | Distribution | Parameters |
|----------|------|-------------|-------------- |------------|
| id | integer | Unique identifier | Sequential | 1 to N |
| treatment | binary | Treatment assignment | Bernoulli | p = 0.5 |
| outcome | continuous | Primary outcome | Normal | mu = 0, sigma = 1 (control) |
| ... | ... | ... | ... | ... |

## Treatment Effects
- True ATE: {value}
- True CATE by subgroup: {if applicable}

## Missing Data
- Mechanism: {MCAR/MAR/MNAR}
- Rate: {percentage} of {variable}

Key Principles

Reproducibility

  • Always set random seeds. Document the seed in the script header and the data dictionary.
  • Script must be fully self-contained -- running it again with the same seed produces identical output.

Realism

  • Match variable types to realistic distributions. Not everything is normal:
    • Income, reaction times --> log-normal or gamma
    • Likert scales --> ordinal with floor/ceiling effects
    • Count data --> Poisson or negative binomial
    • Proportions --> beta
    • Binary outcomes --> Bernoulli with realistic base rates
  • Include realistic noise. Treatment effects should be embedded in noisy data, not clean signal.
  • Add heterogeneity. Real data has heterogeneous treatment effects -- consider adding subgroup variation.

Missing Data

  • If the real data will have missingness, simulate it:
    • MCAR: Random deletion at a fixed rate
    • MAR: Missingness depends on observed variables (e.g., higher income --> less missing)
    • MNAR: Missingness depends on the missing value itself (e.g., depressed people less likely to respond)
  • Document the missingness mechanism in the data dictionary.

Calibration (Calibrated Mode)

  • Read references/calibration-targets.md for the full procedure.
  • Require published summary statistics as input (means, SDs, correlations, effect sizes).
  • Validate that the synthetic data matches the targets within tolerance.
  • Report discrepancies between target and achieved statistics.

Mode: From Design

Workflow

  1. Locate design document -- check docs/experiment-design.md, docs/pre-analysis-plan.md, log/plans/
  2. Extract parameters:
    • Treatment arms and assignment mechanism
    • Primary and secondary outcomes (types, expected distributions)
    • Covariates and their roles
    • Sample size and any clustering/stratification
    • Expected effect sizes from the power analysis
  3. Confirm with user -- present extracted parameters and ask for adjustments
  4. Generate -- follow Steps 3-6 above

Integration with experiment-design

The design document produced by experiment-design Design mode contains everything needed:

  • Hypotheses with expected signs --> treatment effect directions
  • Conditions and randomization --> treatment assignment DGP
  • Outcome measures and scales --> variable types and distributions
  • Power analysis results --> sample size and effect size

Mode: From Schema

Workflow

  1. Interview -- ask user to describe each variable (or provide a sketch)
  2. Infer structure -- detect relationships from the description:
    • "X causes Y" --> include causal pathway
    • "A and B are correlated" --> induce correlation via shared latent factor
    • "C moderates the effect" --> include interaction term
  3. Generate -- follow Steps 3-6 above

Common Requests

User saysInterpret as
"A standard survey dataset"Demographics + Likert DVs + treatment + attention checks
"Panel data"Units x time with unit and time fixed effects
"Something like [paper name]"Switch to Calibrated mode, use paper's descriptives

Mode: Calibrated

Workflow

  1. Collect targets -- user provides published summary statistics:
    • Means and standard deviations
    • Correlation matrix (or key correlations)
    • Effect sizes from regression tables
    • Sample size
    • Distribution shapes (skew, kurtosis) if reported
  2. Read references/calibration-targets.md for the calibration procedure
  3. Generate with matching -- use the Cholesky decomposition or copula method to match the target correlation structure
  4. Validate -- compare synthetic descriptives to targets, report match quality
  5. Save -- follow Steps 5-6 above, include calibration targets in the data dictionary

Cross-References

ResourceWhen read
references/dgp-recipes.mdAll modes (code patterns for each design type)
references/calibration-targets.mdCalibrated mode (matching procedure)
shared/multi-language-conventions.mdAll modes (code style)
experiment-design skillFrom design mode (reads its design documents)
data-analysis skillConsumes synthetic data for pipeline testing
data-sensitivity ruleNever write to data/raw/
design-before-results ruleSynthetic data supports locking the design before real data

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.