monte-carlo-engine

Monte Carlo simulation engine skill for probabilistic modeling, risk quantification, and uncertainty propagation

509 stars

Best use case

monte-carlo-engine is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Monte Carlo simulation engine skill for probabilistic modeling, risk quantification, and uncertainty propagation

Teams using monte-carlo-engine should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/monte-carlo-engine/SKILL.md --create-dirs "https://raw.githubusercontent.com/a5c-ai/babysitter/main/library/specializations/domains/business/decision-intelligence/skills/monte-carlo-engine/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/monte-carlo-engine/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How monte-carlo-engine Compares

Feature / Agentmonte-carlo-engineStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Monte Carlo simulation engine skill for probabilistic modeling, risk quantification, and uncertainty propagation

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# Monte Carlo Engine

## Overview

The Monte Carlo Engine skill provides comprehensive probabilistic simulation capabilities for quantifying uncertainty, assessing risk, and propagating variability through complex models. It supports multiple sampling strategies, correlation handling, and statistical analysis of simulation outputs for data-driven decision support.

## Capabilities

- Random variate generation (normal, triangular, PERT, uniform, lognormal, beta, etc.)
- Latin Hypercube Sampling (LHS)
- Correlation structure handling (Cholesky decomposition, copulas)
- Convergence monitoring and adaptive iteration
- Statistical output analysis (mean, variance, percentiles)
- Tornado diagram generation
- Value at Risk (VaR) and CVaR calculation
- Parallel simulation execution

## Used By Processes

- Monte Carlo Simulation for Decision Support
- Strategic Scenario Development
- What-If Analysis Framework
- Predictive Analytics Implementation

## Usage

### Distribution Specification

```python
# Define input distributions
input_variables = {
    "revenue": {
        "distribution": "triangular",
        "parameters": {"min": 800000, "mode": 1000000, "max": 1500000}
    },
    "cost": {
        "distribution": "normal",
        "parameters": {"mean": 600000, "std": 50000}
    },
    "market_share": {
        "distribution": "PERT",
        "parameters": {"min": 0.05, "mode": 0.10, "max": 0.20}
    },
    "unit_price": {
        "distribution": "uniform",
        "parameters": {"min": 45, "max": 55}
    }
}
```

### Correlation Matrix

```python
# Define correlations between variables
correlations = {
    "variables": ["revenue", "cost", "market_share"],
    "matrix": [
        [1.0, 0.6, 0.3],   # revenue correlations
        [0.6, 1.0, 0.2],   # cost correlations
        [0.3, 0.2, 1.0]    # market_share correlations
    ]
}
```

### Model Function

```python
# Define the model to simulate
def profit_model(inputs):
    revenue = inputs["revenue"]
    cost = inputs["cost"]
    profit = revenue - cost
    return {"profit": profit, "margin": profit / revenue}
```

### Sampling Strategies

1. **Simple Random Sampling**: Standard Monte Carlo
2. **Latin Hypercube Sampling**: Better coverage with fewer samples
3. **Quasi-Monte Carlo**: Low-discrepancy sequences (Sobol, Halton)
4. **Importance Sampling**: Focus on tail events

### Convergence Monitoring

The skill monitors:
- Running mean and standard deviation
- Coefficient of variation convergence
- Percentile stability
- Adaptive stopping criteria

## Input Schema

```json
{
  "input_variables": {
    "variable_name": {
      "distribution": "string",
      "parameters": "object"
    }
  },
  "correlations": {
    "variables": ["string"],
    "matrix": "2D array"
  },
  "model": "function or expression",
  "simulation_options": {
    "iterations": "number",
    "sampling_method": "random|lhs|quasi_mc",
    "random_seed": "number",
    "parallel": "boolean",
    "convergence_threshold": "number"
  },
  "output_options": {
    "percentiles": ["number"],
    "risk_metrics": ["VaR", "CVaR"],
    "confidence_level": "number"
  }
}
```

## Output Schema

```json
{
  "summary_statistics": {
    "output_variable": {
      "mean": "number",
      "std": "number",
      "median": "number",
      "min": "number",
      "max": "number",
      "percentiles": "object"
    }
  },
  "risk_metrics": {
    "VaR": "number",
    "CVaR": "number",
    "probability_of_loss": "number"
  },
  "convergence_info": {
    "iterations_run": "number",
    "converged": "boolean",
    "stability_scores": "object"
  },
  "raw_results": "array (optional)",
  "tornado_data": "object",
  "visualization_paths": ["string"]
}
```

## Best Practices

1. Use at least 10,000 iterations for stable percentile estimates
2. Apply Latin Hypercube Sampling for efficiency
3. Validate input distributions with subject matter experts
4. Include correlations for realistic results
5. Monitor convergence before accepting results
6. Perform sensitivity analysis to identify key drivers
7. Document all distribution assumptions

## Integration Points

- Receives distributions from Risk Distribution Fitter
- Feeds into Sensitivity Analyzer for importance analysis
- Supports Value at Risk Calculator for risk metrics
- Connects with Decision Tree Builder for decision node valuation
- Integrates with Real Options Analyzer for option valuation

Related Skills

Ghidra/IDA Reverse Engineering Skill

509
from a5c-ai/babysitter

Deep integration with Ghidra and IDA Pro for binary analysis and reverse engineering

physics-engine

509
from a5c-ai/babysitter

Physics engine integration skill for rigid body dynamics and collision detection.

music-prompt-engineering

509
from a5c-ai/babysitter

Optimize and format prompts specifically for AI music generation platforms like Suno and Udio, including platform-specific syntax and tag optimization

video-prompt-engineering

509
from a5c-ai/babysitter

Optimize prompts for AI video generation platforms including Sora, Runway, Pika, and Kling

meta-analysis-engine

509
from a5c-ai/babysitter

Skill for conducting meta-analyses of research findings

bayesian-inference-engine

509
from a5c-ai/babysitter

Bayesian probabilistic reasoning for prior specification, posterior computation, and belief updating

monte-carlo-physics-simulator

509
from a5c-ai/babysitter

Monte Carlo simulation skill for statistical physics, particle transport, and stochastic processes

monte-carlo-simulation

509
from a5c-ai/babysitter

Monte Carlo methods for uncertainty quantification

type-inference-engine

509
from a5c-ai/babysitter

Implement and test type inference algorithms including Algorithm W and constraint-based inference

traffic-simulation-engine

509
from a5c-ai/babysitter

Traffic simulation skill for microsimulation, level of service, and signal optimization

hydrologic-modeling-engine

509
from a5c-ai/babysitter

Hydrologic modeling skill for rainfall-runoff analysis, flood frequency, and watershed analysis

hydraulic-analysis-engine

509
from a5c-ai/babysitter

Hydraulic analysis skill for open channel flow, culverts, and pipe networks