AGENT SKILL

monte-carlo-analysis

Use this skill whenever the user asks to run a Monte Carlo simulation, model risk or uncertainty with random sampling, estimate P5/P50/P95 outcomes, or produce a probability distribution for project timelines, portfolio returns, downtime, costs, or similar uncertain variables. Trigger on phrases like 'run a Monte Carlo', 'simulate outcomes', 'probability chart for best and worst case', or when they give min/most-likely/max (or mean/std) and want thousands of iterations. Do NOT trigger for deterministic forecasts with no uncertainty, or for generic charts unrelated to simulation.

License 许可
MIT
最近更新
2026-11-13
Stars
★ 105
Forks
120

01 前言 Front Matter

name
monte-carlo-analysis
description
Use this skill whenever the user asks to run a Monte Carlo simulation, model risk or uncertainty with random sampling, estimate P5/P50/P95 outcomes, or produce a probability distribution for project timelines, portfolio returns, downtime, costs, or similar uncertain variables. Trigger on phrases like 'run a Monte Carlo', 'simulate outcomes', 'probability chart for best and worst case', or when they give min/most-likely/max (or mean/std) and want thousands of iterations. Do NOT trigger for deterministic forecasts with no uncertainty, or for generic charts unrelated to simulation.

02 资源文件 10

03 SKILL.md 正文

Convert an unstructured risk question into a structured Monte Carlo run via the bundled scripts/monte_carlo.py toolkit. Sample from the right distribution, summarise percentiles, and return a histogram PNG plus spreadsheet export. Offer an interactive HTML chart when the user asks for it.

Instructions

  1. Cognitive intake. Detect the core question (timeline, financial risk, yield, downtime, claims, etc.). If the user did not give enough numbers to parameterise a distribution, stop and ask — do not invent bounds. Prompt with the distribution options below.

  2. Choose a distribution:

    • Triangular — user gives Minimum, Most Likely (peak), Maximum.
    • Normal — user gives Mean and Std Dev (optional base_modifier for portfolio / compounding style: outcome = base * (1 + return)).
    • Uniform — every value between Minimum and Maximum is equally likely.
    • Log-normal — non-negative, right-skewed risks; user gives log-scale mean and sigma. Highlight the Mean vs P50 gap when skew is large.
    • Poisson — count of rare events in a fixed interval; user gives lambda (expected count per interval, e.g. outages per month).
    • Weibull — time-to-failure / reliability; user gives shape (k) and scale (λ). Shape < 1 → infant mortality, = 1 → exponential, > 1 → wear-out.
    • Beta — bounded probability [0, 1] or percentage; user gives alpha and beta. Useful for proportions, conversion rates, or task-completion estimates.
    • Exponential — memoryless inter-arrival times; user gives scale (mean = 1 / rate). Good for time between random events (calls, failures, requests).
  3. Defaults. If simulations are unspecified, use 10000. Prefer a clear chart_title and x_axis_label in the user's domain units (days, USD, hours).

  4. Execute with the toolkit (import or CLI). Always produce:

    • Summary stats: mean, P5, P50, P95
    • PNG histogram with P5 / P50 / P95 marker lines
    • CSV of all iterations (opens in Excel)

    Also produce when asked:

    • Interactive HTML — self-contained Chart.js page with live sliders per distribution parameter, a simulations count slider, and a P-threshold calculator (P(outcome < X) = ?)
    • .xlsx workbook (requires openpyxl; otherwise point them to the CSV)
import sys
sys.path.insert(0, "scripts")
from monte_carlo import simulate

result = simulate({
    "distribution": "triangular",
    "low": 12, "peak": 18, "high": 45,
    "simulations": 10000,
    "chart_title": "Cloud migration duration (days)",
    "x_axis_label": "Days",
    "html": True,          # optional interactive Chart.js page with live controls
    "excel": True,         # optional .xlsx (falls back to CSV if openpyxl missing)
    "out_prefix": "simulation",
})
# result keys: mean, p5, p50, p95, brief_summary, chart_path, csv_path, …
  1. Present results in domain language:

    • P5 = downside / late / risk baseline
    • P50 = median expectation
    • P95 = optimistic / upper ceiling (or severe upside for cost/risk)
    • Show or link the PNG; mention CSV/Excel paths; offer HTML if not requested yet.
    • Always end with a brief summary (2–3 sentences). Prefer result["brief_summary"] from the toolkit; you may lightly rephrase it into the user's domain (days, dollars, hours) without changing the numbers.
  2. Response layout (adapt labels to the domain):

### Simulation Analytics Report
Ran {simulations} iterations ({distribution}).

| Metric | Value |
| --- | --- |
| P5 (risk baseline) | {p5} |
| P50 (median) | {p50} |
| P95 (upper) | {p95} |
| Mean | {mean} |

Histogram: {chart_path}
Raw iterations: {csv_path}

### Brief summary
{brief_summary}

Guardrails

  • Never run the script when required parameters are missing — ask first.
  • Do not fabricate distribution parameters or claim false precision.
  • Prefer the bundled toolkit over hand-rolled NumPy each time, for consistent charts and exports.
  • Keep LLM replies to the summary payload; do not dump all iteration rows into chat.

Bundled files

  • scripts/monte_carlo.py — simulation engine, PNG, CSV/Excel, interactive HTML
  • references/cheatsheet.md — parameters, CLI, test prompts
  • assets/sample_triangular.json — demo payload (project timeline)
  • assets/sample_normal.json — demo payload (portfolio returns)
  • assets/sample_lognormal.json — demo payload (skewed downtime)
  • assets/sample_poisson.json — demo payload (event count per interval)
  • assets/sample_weibull.json — demo payload (component lifetime)
  • assets/sample_exponential.json — demo payload (time between arrivals)

04 同仓库更多 Skills

microsoft
microsoft/cat-agent-skills

stakeholder-and-decision-map

Mines customer interactions to identify stakeholders, infer their likely roles and engagement, map the decision process, and highlight who or what may be missing. Use when asked to "map a deal's buying group", identify influential or missing stakeholders, "assess who has gone quiet", or "explain how the customer will decide". Do not use for phased engagement plans, contact sequences, choosing or drafting outreach to the single next contact, seller or team performance reviews, or contacting, scheduling, or changing records.

★ 105
microsoft
microsoft/cat-agent-skills

sales-progress-update

Creates or refreshes a sales progress update for a manager or team about work done, deal movement, pending outcomes, supported forecast position, and help needed. Use when asked to "create my weekly sales update", "refresh my sales progress deck", "report my forecast position", "where do I stand against my quarter forecast", or "catch my manager up on committed deals". Do NOT use for non-sales project updates, a since-date deal change digest, momentum or blocker analysis, meeting prep, or outreach drafting.

★ 105
microsoft
microsoft/cat-agent-skills

submission-assemble

Put the checked CSR or 510(k) sections together in template order with a reviewer-facing open-items register, as a draft package for human sign-off. Use when the user asks "assemble the CSR draft", "put the module together for review", "build the review package with the open items on top", "compile the 510(k) sections in order" or "package this up for the submission lead". Do NOT use for assembling an unchecked draft - use consistency-check instead. Do NOT use for loading protocol, SAP or TLF sources - use source-ingest instead. Do NOT use for compiling general documents or slide decks - use the built-in docx or pptx skill instead. Do NOT use for filing or submitting to a regulator - use the sponsor's validated gateway, operated by a human, instead. Guardrail: draft for human approval only (L1); status is draft_clean or draft_open_items, never submitted.

行政与办公人员文档处理演示文稿
★ 105
microsoft
microsoft/cat-agent-skills

source-ingest

Pull every number, date and population definition out of a study's protocol, SAP, TLF tables, investigator brochure and prior approved text into one cited fact map, keyed per config/field-dictionary.json, before any CSR or 510(k) section is written. Use when the user asks "here's the locked TLF set and SAP, set up the CSR", "load the protocol and tables before we start drafting", "what figures do we have from the database lock?", "pull the disposition counts out of Table 14.1.1" or "ingest the IB for the 510(k)". Do NOT use for drafting or assembling submission sections - use section-draft or submission-assemble instead. Do NOT use for reconciling a patient's medications - use the discharge-care-transition plugin instead. Guardrail: reads and cites sources only; never estimates, rounds or invents a fact.

★ 105
microsoft
microsoft/cat-agent-skills

section-plan

Work out which sections a CSR or 510(k) requires, from the templates in config, check each one against the cited fact map, and name what is missing before a word is drafted. Use when the user asks "what do we still need before we can draft the CSR?", "which sections are ready to start?", "what's blocking the performance data section?", "do we have everything for the synopsis?" or "map our tables to the E3 structure". Do NOT use for writing section language - use section-draft instead. Do NOT use for cross-checking a finished draft - use consistency-check instead. Do NOT use for outlining general Word documents or business reports - use the built-in docx skill instead. Only structures with a template in config are supported. Guardrail: plans only; never marks a section ready on a missing fact and never invents a structure.

文档处理
★ 105
microsoft
microsoft/cat-agent-skills

section-draft

Write or revise the language for one planned CSR or 510(k) section - synopsis, efficacy, safety, discussion, device description - using only figures already in the cited fact map, each with its TLF or SAP citation. Use when the user asks "draft the Synopsis from our locked tables", "write up safety from Table 14.3.1", "give me a first pass at the discussion", "draft the device description for the 510(k)" or "tighten the wording of the Discussion section". Do NOT use for supplying a number not already in source_facts - use source-ingest instead. Do NOT use for verifying a draft's figures - use consistency-check instead. Do NOT use for appeal letters, clinical notes or discharge summaries - use the matching HLS plugin instead. Guardrail: drafts for human approval only (L1); never asserts an unsourced number or harmonises two figures.

★ 105