agentleFS
MicrosoftKnown publishermicrosoft/chaos-studio/copilot-cli-plugin/skills/setup-scenario/SKILL.md

setup-scenario

Skill3 starsChanged 5 months agoMITView on GitHub

Discover recommended scenarios, build and validate a ScenarioConfiguration, and auto-fix resource permissions.

The file

We split this skill into the rules it gives an agent

4 rules. About 0 are common, 2 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

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

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

    If you are an autonomous agent with no user to prompt, use the MCP tools directly: chaos_refresh_recommendations, …

    line 14
  2. Very specific:

    All discovery, configuration, validation, and permission-fix logic lives in scripts/Invoke-SetupScenario.ps1.

    line 20
  3. Distinctive:

    Run the script (no parameters needed for the first call).

    line 25
  4. Distinctive:

    When exit 2 is followed by exit 3 on re-run, combine both answers in the next invocation:

    line 58

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “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

SetupScenario — Scenario Discovery, Configuration & Validation

⛔ ABSOLUTE RULE: Do NOT improvise, skip, or substitute any step. On ANY error, STOP and wait for the user.

When to use this skill (vs. the MCP server)

This skill is the human-interactive path: it shares state with the rest of the pipeline, prompts via exit codes, and renders cards. Use it when there is a user in the loop.

If you are an autonomous agent with no user to prompt, use the MCP tools directly: chaos_refresh_recommendations, chaos_list_recommended_scenarios, chaos_create_scenario_configuration, chaos_validate_scenario_configuration, chaos_fix_resource_permissions. See mcp/README.md.

Both surfaces target Microsoft.Chaos 2026-05-01-preview and use the local az login session for auth.

How It Works

All discovery, configuration, validation, and permission-fix logic lives in scripts/Invoke-SetupScenario.ps1. The script drives the Chaos Studio operations through the az chaos CLI extension — workspace evaluation, recommendation listing, scenario selection routing, parameter resolution, configuration creation, and the validate→fix→re-validate loop.

The AI orchestrator's only job is:

  1. Set $env:STARTCHAOS_STATE_PATH to ${SESSION_DIR}/startchaos-state.json.
  2. Run the script (no parameters needed for the first call).
  3. Handle exit codes that require user input (see below).
  4. Re-run the script with the user's answers as parameters.

Prerequisites

  • state.workspace.status == "done" (workspace must exist; the script refuses otherwise)
  • state.context.subscriptionId populated

Running the Script

$env:STARTCHAOS_STATE_PATH = "<session-dir>/startchaos-state.json"
& "<skill-dir>/scripts/Invoke-SetupScenario.ps1" @args

On resume: re-runs short-circuit when state.setup.status == "done".

Exit Codes → AI Actions

ExitMeaningAI Action
0Configuration created and validatedDone — summary already rendered by script.
1Hard errorSTOP. Render the error from script output. Wait for user. State has setup.lastError.
2Scenario selection neededRead state.setup.recommendedScenarios (or the script's rendered list). ask_user for one name. Re-run with -ScenarioName <chosen>.
3Parameter mode neededShow the parameter table from the script output. ask_user which parameters they want to override (or accept defaults). Re-run with -ParameterMode autofill and -ParameterValues @{ key = 'value' } for any overrides.

Important: Manual mode does NOT work

-ParameterMode manual uses Read-Host prompts that do not render in a non-interactive AI session. Always use -ParameterMode autofill combined with -ParameterValues for any overrides the user requests.

Important: Exit 2 → 3 chaining

When exit 2 is followed by exit 3 on re-run, combine both answers in the next invocation:

& Invoke-SetupScenario.ps1 -ScenarioName "ZoneDown-1.0" -ParameterMode "autofill" -ParameterValues @{ duration = 'PT5M' }

Script Parameters

ParameterDescription
-ScenarioNameSelected scenario (e.g. ZoneDown-1.0). Bypasses the selection prompt. Equivalent to $env:STARTCHAOS_SCENARIO.
-ParameterModeautofill (always use this — manual does not work in AI sessions).
-ParameterValuesHashtable of parameter overrides applied on top of defaults, e.g. @{ duration = 'PT5M' }.

What the Script Handles (no AI logic needed)

  • Workspace evaluation via az chaos workspace refresh-recommendation (CLI awaits the LRO) + show-evaluation summary
  • Scenario list (az chaos scenario list) filtered to recommendation.recommendationStatus == "Recommended"
  • Auto-select when exactly one scenario is recommended; pause-and-emit-exit-2 otherwise
  • ScenarioConfiguration create (az chaos scenario config create, --scenario-id auto-derived) with parameter merge (defaults + overrides)
  • Validate (az chaos scenario config validate) → if not Succeeded → az chaos scenario config fix-permissions → re-validate
  • RBAC propagation retry loop (up to 5 minutes, 20s interval) gated to permission-related errors only
  • Atomic state writes with error envelopes
  • Idempotent re-runs

Related Skills

  • create-workspace — must complete before this skill
  • run-scenario — next phase after setup

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.