一键导入
slo-deployment-gate
Deterministic procedure to evaluate SLO error budget for a target service and emit an ALLOW or BLOCK deployment gate decision.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Deterministic procedure to evaluate SLO error budget for a target service and emit an ALLOW or BLOCK deployment gate decision.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Deterministic procedure to watch an ARM deployment, evaluate a health gate, and automatically cancel + redeploy the last-known-good template on breach.
Deterministic procedure to find tag-non-compliant Azure resources, emit a fixed-format report, and (on explicit authorisation) deploy ARM patches to apply missing tags.
Deterministic procedure to inspect an ARM template, cross-reference affected resources via ARG, categorize each change, flag policy violations and dependency fan-out, and emit a fixed-format risk report.
Deterministic procedure to surface top cost-driving resources by querying ARG for new/resized resources in a time window, joined with owner tags, and emit a fixed-format markdown report.
Deterministic procedure to provision, monitor, and cancel pre-approved ARM golden-path template deployments with naming guardrails, tag enforcement, and compliance checks.
Deterministic procedure to compare a checked-in ARM template with live Azure state and emit a property-level drift report in markdown + JSON patch (RFC 6902) format.
| name | slo-deployment-gate |
| description | Deterministic procedure to evaluate SLO error budget for a target service and emit an ALLOW or BLOCK deployment gate decision. |
Inputs:
scope: name of a runbook under runbooks/<scope>.yaml. Defaults to prod.service: name of the target service to gate (matches slo_service tag in ARG).template: path to the ARM template the user wants to deploy (relative to workspace root).mode: one of gate (default), deploy (gate + would-deploy on ALLOW), status (check last gate result).runbooks/<scope>.yaml as raw text. If a sibling runbooks/<scope>.values.yaml
exists, parse it and substitute every ${key} token in the runbook text with the
corresponding value. Then parse the substituted text as YAML. If <scope>.values.yaml
is missing, abort with:
ABORT: runbooks/<scope>.values.yaml missing — copy <scope>.values.yaml.example and fill in real values.subscriptions[], slo_targets (map of service →
{budget_threshold_pct, window_days, approval_required_below_pct}),
budget_source, approval_timeout_minutes (default 30),
block_on_active_incident (default true).slo_targets entry for ${service}. If not found, abort with:
ABORT: service '${service}' not in runbook slo_targets — add it to prod.yaml.skills/slo-deployment-gate/rules/rules.yaml. Compute SHA-256 of the file
contents; keep first 8 hex chars as ruleset_hash8.run_id = "SLO-" + UTC date YYYYMMDD + "-" + scope + "-" + ruleset_hash8.NOTE (ratification #7):
validate_queryis NOT in the tool allowlist. Go directly:generate_query→execute_query. Do not callvalidate_query.
For each rule in rules.yaml in file order:
rule.kql is missing → record status: SKIPPED and continue.${service} placeholder in rule.kql with the input service name,
and ${subscriptions} with the subscription list from the runbook.generate_query with query_text = rule.kql, subscriptions = runbook.subscriptions.
generate_query returns an error → record status: INVALID, store the error, continue.execute_query with the query returned by generate_query (or the raw KQL if
generate_query returns the input unchanged).
execute_query errors → record status: INVALID, store error.execute_query returns empty result AND rule.skip_if_unavailable == true
→ record status: SKIPPED REASON=resourcechanges-unavailable and continue.rule_id.KEY LIMITATION: SLO error budget percentage is NOT directly queryable via ARG. ARG can locate the App Insights / Log Analytics workspace resource (R001) and read tags/properties (R002), but cannot read metric values such as error rate or availability percentage. The actual budget % must come from an external source.
v1 behaviour: read the budget value from
slo_targets.<service>.simulated_budget_pctin the runbook. This is a hardcoded test value for PoC purposes. Production wiring: replace with an Azure Monitor query, Prometheus scrape, or external SLO platform API call — outside the scope of this ARM MCP PoC.
workspace_resource_id = null.
Gate emits STATUS=OUT_OF_SCOPE REASON=arg-cannot-read-metrics WORKSPACE=null.
Decision = BLOCK (fail-closed: cannot evaluate budget without workspace).workspace_resource_id = first row's id.budget_tag_pct column is non-empty → use that value as budget_pct.
Else → read budget_pct from slo_targets.<service>.simulated_budget_pct.
Emit STATUS=OUT_OF_SCOPE REASON=arg-cannot-read-metrics WORKSPACE=<id> to
indicate that live metric value is not available via ARG.budget_threshold_pct = slo_targets.<service>.budget_threshold_pct.budget_pct > budget_threshold_pct → DECISION=ALLOWbudget_pct ≤ budget_threshold_pct → DECISION=BLOCKapproval_timeout_minutes) → DECISION=BLOCK (TIMEOUT)block_on_active_incident == true:
incident_warning in the output template.skip_if_unavailable triggered → record STATUS=SKIPPED REASON=resourcechanges-unavailable.DECISION=BLOCK and the user provides a bypass command with a valid
CR-XXXXXX or INC-XXXXXX reference:
^(CR|INC)-[0-9]{6}$.ALLOW (BYPASS).exports/bypass-audit.jsonl:
{"timestamp_utc":"<ISO8601>","service":"<service>","budget_pct":<n>,"cr_or_incident_ref":"<ref>","approver":"<copilot-user>","run_id":"<run_id>"}
gatetemplates/output-gate-result.md.{{run_id}}, {{scope}}, {{service}}, {{generated_utc}}, {{ruleset_hash8}},
{{budget_pct}}, {{budget_threshold_pct}}, {{window_days}},
{{decision}}, {{workspace_resource_id}}, {{slo_status_row}},
{{incident_warning}} (empty string if no active incidents),
{{bypass_ref}} (empty string if not a bypass).exports/gate-<run_id>.md.deploy (gate + would-deploy simulation)gate mode flow first.DECISION=BLOCK or DECISION=BLOCK (TIMEOUT):
DECISION=ALLOW or DECISION=ALLOW (BYPASS):
templates/output-report.md.{{run_id}}, {{scope}}, {{service}}, {{generated_utc}},
{{template_path}}, {{decision}}, {{budget_pct}}.create_template_deployment in v1.
Write a ## Would-Deploy Notice section confirming what would have been deployed.{{would_deploy_command}} = the create_template_deployment call that
would be made (template path + parameters), formatted as a code block.exports/report-<run_id>.md.statustemplates/output-gate-result.md.exports/gate-<run_id>*.md for this scope + service.STATUS=NO_PRIOR_GATE_RUN.INVALID and continue.rules.yaml cannot be read: abort with ABORT: rules.yaml unreadable.slo_targets entry missing: abort (see Step 1).# SLO Deployment Gate Result.# SLO Deployment Gate — Deploy Report.**Decision:** ALLOW or **Decision:** BLOCK (or with suffix).exports/.