[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M72TJXTM3EEDE5BWGMHA9VM5":3,"skill-same:01M72TJXTM3EEDE5BWGMHA9VM5":67},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":18,"linkOnly":19,"markdownContent":20,"markdownBody":21,"frontMatter":22,"refName":23,"commitSha":24,"skillDirectory":25,"forksCount":26,"repositoryHtmlUrl":27,"repositoryHomepageUrl":6,"ownerHtmlUrl":28,"ownerBlogUrl":29,"ownerDescription":6,"updatedAt":30,"install":31,"resources":44},"01M72TJXTM3EEDE5BWGMHA9VM5","ywc-infra-optimize",null,"(ywc) Use when improving existing infrastructure: cost right-sizing, unused resource cleanup, reserved\u002Fspot adoption, drift remediation, and reliability hardening for AWS, GCP, Azure, or K8s. Triggers: \"인프라 개선\", \"비용 최적화\", \"optimize infrastructure\", \"インフラ最適化\", \"ywc-infra-optimize\". Do not use for greenfield infrastructure design (use ywc-infra-design), first-time IaC authoring (use ywc-iac-author), pre-apply review (use ywc-infra-review), or app hotspots (use ywc-performance-engineer).","yongwoon\u002Fywc-agent-toolkit","yongwoon","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F9317029?v=4","01M72SZSF6VKANKG5QTMV4V95S","01M72SZSG8HHC3W2CV5P7EJ5AH",8,"MIT","https:\u002F\u002Fgithub.com\u002Fyongwoon\u002Fywc-agent-toolkit\u002Fblob\u002Fmain\u002Fplugins\u002Fywc-agent-toolkit\u002Fskills\u002Fywc-infra-optimize\u002FSKILL.md",[],[],"2026-11-10 22:39:42",false,"---\nname: ywc-infra-optimize\ndescription: >-\n  (ywc) Use when improving existing infrastructure: cost right-sizing, unused\n  resource cleanup, reserved\u002Fspot adoption, drift remediation, and\n  reliability hardening for AWS, GCP, Azure, or K8s. Triggers: \"인프라 개선\",\n  \"비용 최적화\", \"optimize infrastructure\",\n  \"インフラ最適化\", \"ywc-infra-optimize\". Do not use for greenfield\n  infrastructure design (use ywc-infra-design), first-time IaC authoring (use\n  ywc-iac-author), pre-apply review (use ywc-infra-review), or app\n  hotspots (use ywc-performance-engineer).\n---\n\n# ywc-infra-optimize\n\n**Announce at start:** \"I'm using the ywc-infra-optimize skill to improve existing infrastructure under a SAFE\u002FCAUTION\u002FDANGER change loop with per-item terraform plan verification.\"\n\nThis skill is the infra counterpart to `ywc-refactor-clean`: cost right-sizing, unused-resource removal, reserved\u002Fspot adoption, drift detection, and reliability hardening planning against infrastructure that already exists. It borrows refactor-clean's Iron Law discipline — three independent witnesses before any change is recommended — but, in Codex v1, it is a **planning and classification surface**, not an execution worker. Terraform is the single fixed IaC tool for this toolkit; every analysis stops at `terraform plan`, never `apply`. SAFE, CAUTION, and DANGER classify how conservative the recommended next action should be; actual `.tf` edits route back through `ywc-iac-author`.\n\n## The Iron Law\n\n```text\nNEVER RECOMMEND A CHANGE AS READY WITHOUT (1) COST\u002FUTILIZATION DATA CONFIRMS THE CANDIDATE + (2) A PER-ITEM TERRAFORM PLAN CONFIRMS THE EXACT BLAST RADIUS + (3) THE CHANGE IS REVERSIBLE OR A SNAPSHOT EXISTS BEFORE IT LANDS\n```\n\nA resource a cost report flags \"idle\" but a per-item `terraform plan` shows referenced by another module or a DR failover path is **not** SAFE — that is a live dependency hiding behind a stale metric. An instance CloudWatch\u002FCloud Monitoring shows at 4% average CPU but that is a nightly-batch instance's daytime trough is **not** confirmed over-provisioned — utilization data needs a representative window (see `..\u002Freferences\u002Finfra\u002Flenses\u002Fcost.md`'s p95 guidance), not a single snapshot. Single-source confidence is not confirmation; the discipline requires an independent data witness (cost\u002Futilization report) plus a blast-radius witness (`terraform plan`) plus a reversibility guarantee — mirroring refactor-clean's tool + grep + test triad.\n\nIf a previously recommended SAFE change later proves risky, re-classify the item to CAUTION or DANGER before any authoring pass. Do not keep presenting it as SAFE once new evidence contradicts the original witnesses.\n\n## Rationalization Defense\n\nWhen tempted to bypass a rule, check this table first:\n\n| Excuse | Reality |\n|---|---|\n| \"I'll batch all the SAFE changes into one recommendation and let someone figure it out later\" | The point of SAFE is narrow blast radius and clear next action. A vague multi-item blob hides which change is actually low risk and which one needs a different owner. |\n| \"The cost tool says this resource is idle, so it's safe to destroy — skipping the third witness\" | A cost report is one signal, not confirmation. It cannot see a DR failover target, a quarterly batch job's off-cycle trough, or a cross-module reference the `terraform plan` blast-radius witness would catch. Skipping the plan witness or the reversibility check turns \"the tool said so\" into the sole basis for an irreversible action. |\n| \"This CAUTION item looks low-risk, I'll auto-execute it anyway\" | CAUTION exists precisely because \"looks low-risk\" is a judgment this skill is not authorized to make alone — reserved\u002Fspot adoption commits spend, and ambiguous utilization needs a human-reviewed authoring pass, not a confident guess. |\n| \"I'll skip the per-item plan confirmation since the batch plan already looked clean\" | A batch-level `terraform plan` can hide a wider blast radius inside one item. Per-item confirmation is what proves the exact resource changed, and nothing else did — the batch-level view cannot substitute for it. |\n| \"I'm already running `ywc-infra-review`, I'll execute the fix in the same pass\" | `ywc-infra-review` is diagnosis-only by design and has no write access. This skill is also diagnosis-and-planning only in Codex v1; remediation is always a separate authoring pass. |\n| \"The `terraform plan` for this DB destroy came back clean, so it's fine to proceed\" | `plan` succeeding proves syntactic validity, not safety. A destroy against a stateful resource is DANGER regardless of how confident the plan or the classification tool is — it escalates, it never auto-executes. |\n\n**Violating the letter of these rules is violating the spirit.** An optimization pass that trusts a single signal or turns planning into stealth execution turns a cost-saving loop into an outage risk.\n\n## Arguments\n\n| Parameter | Format | Example | Description |\n|-----------|--------|---------|-------------|\n| `--scope` | `--scope \u003Cpath>` | `--scope infra\u002Fmodules\u002Fcompute` | Restrict gather\u002Fclassify\u002Fexecute to a single Terraform module or path. Default: full IaC tree \u002F live infrastructure. |\n| `--dry-run` | flag | `--dry-run` | Run gather + classify only and skip optional advisory follow-ups. Since this skill does not execute changes, `--dry-run` mainly suppresses extra planning detail. |\n| `--skip-verify-done` | flag | `--skip-verify-done` | Skip the final `ywc-verify-done` handoff. Only valid when the upstream caller (e.g., a scheduled hygiene orchestrator) will run it. |\n\n## Workflow\n\n### Step 1: Determine scope + gather current state\n\nDetermine scope from `--scope`, or default to the full IaC tree \u002F live infrastructure. Run `terraform plan` (or `terraform plan -detailed-exitcode`) directly against the scoped module tree — this is the drift-detection signal: live infrastructure that has diverged from the committed `.tf` state.\n\nDispatch a Codex worker carrying the `ywc-performance-engineer` persona in read-only diagnostic mode, carrying the scoped Terraform and an explicit pointer to `..\u002Freferences\u002Finfra\u002Flenses\u002Fcost.md` and `..\u002Freferences\u002Ffinops.md`, to produce the cost\u002Futilization report: idle or orphaned resources, over-provisioned compute (against observed p95), and pricing-model mismatches (on-demand load that should be reserved\u002Fspot).\n\n> **Fan-out return contract**: this skill dispatches two workers (Steps 1 and 3). Each dispatch must return the bounded status payload from `..\u002Freferences\u002Fsubagent-status-actions.md` §3.5 — `Status | 1-line summary | artifact path | Concerns (\u003C=10 lines)`, with full findings\u002Fplans written to a file whose path is returned.\n\n### Step 2: Classify into SAFE \u002F CAUTION \u002F DANGER\n\nSort every candidate into exactly one tier. Items that match multiple tiers escalate to the highest tier — same rule as `ywc-refactor-clean`.\n\n| Tier | Pattern | Action |\n|---|---|---|\n| **SAFE** | *Cost\u002Fdrift*: confirmed-idle resource (zero utilization over a representative window + `terraform plan` shows no other module references it); a clearly over-provisioned instance (e.g., \u003C10% p95 CPU) with an unambiguous right-size target; drift where live state simply matches an already-approved-but-unapplied `.tf` change. *Reliability hardening* (additive, reversible, no recreation): enabling automated backups \u002F point-in-time recovery on a store that lacks them, adding a missing health\u002Freadiness check, raising an autoscaling floor to `min >= 2`, enabling deletion protection — checked against `..\u002Freferences\u002Finfra\u002Flenses\u002Freliability.md` | Step 3 — prepare a low-risk remediation plan |\n| **CAUTION** | Reserved\u002FSpot adoption (commits spend or trades availability); a resource with moderate or ambiguous utilization; drift where live diverges from code in a way that looks intentional (manual hotfix); right-sizing a resource with recent scaling history; adding a multi-AZ standby or read replica (cost + failover implications) | Step 4 — escalate, do not execute |\n| **DANGER** | Any destroy or recreate against a stateful resource (database, volume, bucket) regardless of tool confidence — including a reliability change whose plan would recreate rather than update the resource; a resource tagged\u002Ftied to compliance or DR; anything `git log` shows touched in the last 7 days | Step 4 — escalate, never execute in this skill |\n\n### Step 3: SAFE planning loop\n\nFor each SAFE item, in order — reliability-hardening SAFE items flow through this identical loop, checked against `..\u002Freferences\u002Finfra\u002Flenses\u002Freliability.md` instead of the cost lens:\n\n1. **Re-confirm the signal is still current.** Data gathered in Step 1 (cost\u002Futilization for cost items, the config gap itself for reliability items) can go stale on a large scope — re-check the specific resource before executing.\n2. **Capture the per-item plan baseline.** Run a per-item `terraform plan` on the target resource before recommending remediation — pre-state evidence that nothing beyond the classified candidate is already drifting.\n3. **Optionally consult** the read-only `ywc-cloud-engineer` persona when feasibility, provider nuance, or blast-radius interpretation is unclear. That consult stays advisory: it does not author files.\n4. **Record the recommended next action.** For example: `ywc-iac-author` should remove an idle resource block, adjust `instance_type`, add a backup setting, or fix drift with the minimal `.tf` edit. Include the expected blast radius in the recommendation.\n5. **Reject false SAFE cases.** If the per-item plan is wider than expected, or the consult exposes hidden coupling, re-classify the item to CAUTION and do not recommend it as SAFE.\n\n### Step 4: Escalate by tier, do not execute\n\nFor each SAFE, CAUTION, or DANGER item, emit a report entry (Output Format below) with the rationale and a concrete suggested next step — usually `$ywc-iac-author` for a reviewed remediation patch, or a direct question back to the user for a reserved\u002Fspot capacity commitment. SAFE means \"low-risk to author next\", not \"execute here\". DANGER especially never auto-executes regardless of how the classification tool scored it.\n\n### Step 5: Verify-done handoff\n\nHand off to `$ywc-verify-done` with the optimization report (Output Format below). Mandatory unless `--skip-verify-done` was passed by an upstream caller that will perform its own verify.\n\n## Output Format\n\n```text\nInfra Optimize Report\n─────────────────────────────────────────────────\nScope:           infra\u002F  (or --scope value)\nDrift detected:  2 resources diverged from committed .tf state\nCost\u002Futilization signal: ywc-performance-engineer persona (cost lens)\n\nPlanned next actions (SAFE):\n  - aws_eip.unused-1            remove via $ywc-iac-author; expected plan: destroy only this idle EIP\n  - aws_instance.worker         right-size via $ywc-iac-author: m5.4xlarge -> m5.large\n\nEscalated (CAUTION — not auto-authored):\n  - aws_instance.batch-runner   moderate utilization, recent scaling history — needs manual review\n\nEscalated (DANGER — not auto-authored):\n  - aws_db_instance.legacy      plan shows a destroy — stateful, requires explicit human approval\n\nVerification (per ywc-verify-done):\n  $ terraform plan (per-item, evidence only)\n  exit 0  (PASS — blast radius matched expectation on all 2 SAFE candidates)\n─────────────────────────────────────────────────\nEstimated monthly delta: -$340 (order of magnitude, cost lens estimate)\n```\n\n## Validation Checklist\n\nBefore declaring the optimization pass complete, verify:\n\n- [ ] Drift detection (`terraform plan`) ran against the declared scope\n- [ ] Cost\u002Futilization signal was gathered via the `ywc-performance-engineer` persona before classification\n- [ ] Every candidate is classified into exactly one tier (SAFE \u002F CAUTION \u002F DANGER); multi-tier matches escalate to the highest\n- [ ] Every SAFE item captured a per-item `terraform plan` baseline and an expected narrow blast radius before being recommended\n- [ ] Reliability-hardening candidates (missing backups\u002FPITR, health checks, autoscaling floors, deletion protection) were classified alongside cost\u002Fdrift candidates, not skipped\n- [ ] No SAFE \u002F CAUTION \u002F DANGER item was executed in this skill — all are reported with next actions only\n- [ ] No `terraform apply` was run at any point\n- [ ] Final `$ywc-verify-done` block uses the canonical wording (PASS \u002F FAIL), unless `--skip-verify-done` was passed\n\n## Common Mistakes\n\n- **Treating a clean per-item `terraform plan` as sufficient for a stateful destroy.** `plan` proves syntactic correctness, not safety — a destroy against a database is DANGER regardless of how clean the plan looks.\n- **Re-using Step 1's cost\u002Futilization snapshot for every item without re-checking.** Signals age; a resource idle three days ago at gather-time may be back in active use by execute-time on a slow-moving scope.\n- **Treating SAFE as permission to edit immediately.** SAFE means the evidence supports a low-risk follow-up authoring pass, not that this skill can write Terraform directly.\n- **Running this skill during a `ywc-infra-review` pass instead of separately.** Review is diagnosis-only and has no write access by design; mixing execution into a review pass collapses a boundary the rest of the toolkit relies on.\n\n## Integration\n\n- **Upstream**: `ywc-infra-review` (diagnosis that surfaces the cost\u002Fdrift\u002Freliability findings this skill classifies); direct user invocation for a scheduled optimization pass.\n- **Downstream**: `ywc-verify-done` (mandatory final claim, unless skipped); `ywc-iac-author` (re-authoring path for SAFE, CAUTION, and DANGER follow-ups).\n- **Consults**: `ywc-performance-engineer` persona (cost\u002Futilization signal, Step 1); `ywc-cloud-engineer` persona (read-only feasibility and blast-radius consult, Step 3).\n- **Must not be paired with**: greenfield topology design (`ywc-infra-design`), first-time authoring (`ywc-iac-author`), or a pre-apply-only review pass (`ywc-infra-review`) — those own separate lifecycle phases.\n\n## References\n\n| Reference | Use when |\n|---|---|\n| `..\u002Freferences\u002Finfra\u002Flenses\u002Fcost.md` | Step 1 — cost\u002Futilization signal gathering, right-sizing and waste taxonomy |\n| `..\u002Freferences\u002Ffinops.md` | Step 1 — the detailed FinOps taxonomy (reserved\u002Fspot, data-transfer cost) the `ywc-performance-engineer` persona reviews against |\n| `..\u002Freferences\u002Finfra\u002Flenses\u002Freliability.md` | Step 2\u002F3 — classification taxonomy for reliability-hardening SAFE\u002FCAUTION candidates (backups, health checks, autoscaling floors, deletion protection, multi-AZ) and the guardrail against a cost change dropping below the reliability floor |\n| `..\u002Freferences\u002Fsubagent-status-actions.md` | Steps 1 and 3 — the §3.5 bounded status-return contract each dispatch must follow so fan-out returns stay bounded |\n| `ywc-verify-done` | Step 5 — per-batch verification block shape (command + exit code + claim) — mandatory unless `--skip-verify-done` |\n","# ywc-infra-optimize\n\n**Announce at start:** \"I'm using the ywc-infra-optimize skill to improve existing infrastructure under a SAFE\u002FCAUTION\u002FDANGER change loop with per-item terraform plan verification.\"\n\nThis skill is the infra counterpart to `ywc-refactor-clean`: cost right-sizing, unused-resource removal, reserved\u002Fspot adoption, drift detection, and reliability hardening planning against infrastructure that already exists. It borrows refactor-clean's Iron Law discipline — three independent witnesses before any change is recommended — but, in Codex v1, it is a **planning and classification surface**, not an execution worker. Terraform is the single fixed IaC tool for this toolkit; every analysis stops at `terraform plan`, never `apply`. SAFE, CAUTION, and DANGER classify how conservative the recommended next action should be; actual `.tf` edits route back through `ywc-iac-author`.\n\n## The Iron Law\n\n```text\nNEVER RECOMMEND A CHANGE AS READY WITHOUT (1) COST\u002FUTILIZATION DATA CONFIRMS THE CANDIDATE + (2) A PER-ITEM TERRAFORM PLAN CONFIRMS THE EXACT BLAST RADIUS + (3) THE CHANGE IS REVERSIBLE OR A SNAPSHOT EXISTS BEFORE IT LANDS\n```\n\nA resource a cost report flags \"idle\" but a per-item `terraform plan` shows referenced by another module or a DR failover path is **not** SAFE — that is a live dependency hiding behind a stale metric. An instance CloudWatch\u002FCloud Monitoring shows at 4% average CPU but that is a nightly-batch instance's daytime trough is **not** confirmed over-provisioned — utilization data needs a representative window (see `..\u002Freferences\u002Finfra\u002Flenses\u002Fcost.md`'s p95 guidance), not a single snapshot. Single-source confidence is not confirmation; the discipline requires an independent data witness (cost\u002Futilization report) plus a blast-radius witness (`terraform plan`) plus a reversibility guarantee — mirroring refactor-clean's tool + grep + test triad.\n\nIf a previously recommended SAFE change later proves risky, re-classify the item to CAUTION or DANGER before any authoring pass. Do not keep presenting it as SAFE once new evidence contradicts the original witnesses.\n\n## Rationalization Defense\n\nWhen tempted to bypass a rule, check this table first:\n\n| Excuse | Reality |\n|---|---|\n| \"I'll batch all the SAFE changes into one recommendation and let someone figure it out later\" | The point of SAFE is narrow blast radius and clear next action. A vague multi-item blob hides which change is actually low risk and which one needs a different owner. |\n| \"The cost tool says this resource is idle, so it's safe to destroy — skipping the third witness\" | A cost report is one signal, not confirmation. It cannot see a DR failover target, a quarterly batch job's off-cycle trough, or a cross-module reference the `terraform plan` blast-radius witness would catch. Skipping the plan witness or the reversibility check turns \"the tool said so\" into the sole basis for an irreversible action. |\n| \"This CAUTION item looks low-risk, I'll auto-execute it anyway\" | CAUTION exists precisely because \"looks low-risk\" is a judgment this skill is not authorized to make alone — reserved\u002Fspot adoption commits spend, and ambiguous utilization needs a human-reviewed authoring pass, not a confident guess. |\n| \"I'll skip the per-item plan confirmation since the batch plan already looked clean\" | A batch-level `terraform plan` can hide a wider blast radius inside one item. Per-item confirmation is what proves the exact resource changed, and nothing else did — the batch-level view cannot substitute for it. |\n| \"I'm already running `ywc-infra-review`, I'll execute the fix in the same pass\" | `ywc-infra-review` is diagnosis-only by design and has no write access. This skill is also diagnosis-and-planning only in Codex v1; remediation is always a separate authoring pass. |\n| \"The `terraform plan` for this DB destroy came back clean, so it's fine to proceed\" | `plan` succeeding proves syntactic validity, not safety. A destroy against a stateful resource is DANGER regardless of how confident the plan or the classification tool is — it escalates, it never auto-executes. |\n\n**Violating the letter of these rules is violating the spirit.** An optimization pass that trusts a single signal or turns planning into stealth execution turns a cost-saving loop into an outage risk.\n\n## Arguments\n\n| Parameter | Format | Example | Description |\n|-----------|--------|---------|-------------|\n| `--scope` | `--scope \u003Cpath>` | `--scope infra\u002Fmodules\u002Fcompute` | Restrict gather\u002Fclassify\u002Fexecute to a single Terraform module or path. Default: full IaC tree \u002F live infrastructure. |\n| `--dry-run` | flag | `--dry-run` | Run gather + classify only and skip optional advisory follow-ups. Since this skill does not execute changes, `--dry-run` mainly suppresses extra planning detail. |\n| `--skip-verify-done` | flag | `--skip-verify-done` | Skip the final `ywc-verify-done` handoff. Only valid when the upstream caller (e.g., a scheduled hygiene orchestrator) will run it. |\n\n## Workflow\n\n### Step 1: Determine scope + gather current state\n\nDetermine scope from `--scope`, or default to the full IaC tree \u002F live infrastructure. Run `terraform plan` (or `terraform plan -detailed-exitcode`) directly against the scoped module tree — this is the drift-detection signal: live infrastructure that has diverged from the committed `.tf` state.\n\nDispatch a Codex worker carrying the `ywc-performance-engineer` persona in read-only diagnostic mode, carrying the scoped Terraform and an explicit pointer to `..\u002Freferences\u002Finfra\u002Flenses\u002Fcost.md` and `..\u002Freferences\u002Ffinops.md`, to produce the cost\u002Futilization report: idle or orphaned resources, over-provisioned compute (against observed p95), and pricing-model mismatches (on-demand load that should be reserved\u002Fspot).\n\n> **Fan-out return contract**: this skill dispatches two workers (Steps 1 and 3). Each dispatch must return the bounded status payload from `..\u002Freferences\u002Fsubagent-status-actions.md` §3.5 — `Status | 1-line summary | artifact path | Concerns (\u003C=10 lines)`, with full findings\u002Fplans written to a file whose path is returned.\n\n### Step 2: Classify into SAFE \u002F CAUTION \u002F DANGER\n\nSort every candidate into exactly one tier. Items that match multiple tiers escalate to the highest tier — same rule as `ywc-refactor-clean`.\n\n| Tier | Pattern | Action |\n|---|---|---|\n| **SAFE** | *Cost\u002Fdrift*: confirmed-idle resource (zero utilization over a representative window + `terraform plan` shows no other module references it); a clearly over-provisioned instance (e.g., \u003C10% p95 CPU) with an unambiguous right-size target; drift where live state simply matches an already-approved-but-unapplied `.tf` change. *Reliability hardening* (additive, reversible, no recreation): enabling automated backups \u002F point-in-time recovery on a store that lacks them, adding a missing health\u002Freadiness check, raising an autoscaling floor to `min >= 2`, enabling deletion protection — checked against `..\u002Freferences\u002Finfra\u002Flenses\u002Freliability.md` | Step 3 — prepare a low-risk remediation plan |\n| **CAUTION** | Reserved\u002FSpot adoption (commits spend or trades availability); a resource with moderate or ambiguous utilization; drift where live diverges from code in a way that looks intentional (manual hotfix); right-sizing a resource with recent scaling history; adding a multi-AZ standby or read replica (cost + failover implications) | Step 4 — escalate, do not execute |\n| **DANGER** | Any destroy or recreate against a stateful resource (database, volume, bucket) regardless of tool confidence — including a reliability change whose plan would recreate rather than update the resource; a resource tagged\u002Ftied to compliance or DR; anything `git log` shows touched in the last 7 days | Step 4 — escalate, never execute in this skill |\n\n### Step 3: SAFE planning loop\n\nFor each SAFE item, in order — reliability-hardening SAFE items flow through this identical loop, checked against `..\u002Freferences\u002Finfra\u002Flenses\u002Freliability.md` instead of the cost lens:\n\n1. **Re-confirm the signal is still current.** Data gathered in Step 1 (cost\u002Futilization for cost items, the config gap itself for reliability items) can go stale on a large scope — re-check the specific resource before executing.\n2. **Capture the per-item plan baseline.** Run a per-item `terraform plan` on the target resource before recommending remediation — pre-state evidence that nothing beyond the classified candidate is already drifting.\n3. **Optionally consult** the read-only `ywc-cloud-engineer` persona when feasibility, provider nuance, or blast-radius interpretation is unclear. That consult stays advisory: it does not author files.\n4. **Record the recommended next action.** For example: `ywc-iac-author` should remove an idle resource block, adjust `instance_type`, add a backup setting, or fix drift with the minimal `.tf` edit. Include the expected blast radius in the recommendation.\n5. **Reject false SAFE cases.** If the per-item plan is wider than expected, or the consult exposes hidden coupling, re-classify the item to CAUTION and do not recommend it as SAFE.\n\n### Step 4: Escalate by tier, do not execute\n\nFor each SAFE, CAUTION, or DANGER item, emit a report entry (Output Format below) with the rationale and a concrete suggested next step — usually `$ywc-iac-author` for a reviewed remediation patch, or a direct question back to the user for a reserved\u002Fspot capacity commitment. SAFE means \"low-risk to author next\", not \"execute here\". DANGER especially never auto-executes regardless of how the classification tool scored it.\n\n### Step 5: Verify-done handoff\n\nHand off to `$ywc-verify-done` with the optimization report (Output Format below). Mandatory unless `--skip-verify-done` was passed by an upstream caller that will perform its own verify.\n\n## Output Format\n\n```text\nInfra Optimize Report\n─────────────────────────────────────────────────\nScope:           infra\u002F  (or --scope value)\nDrift detected:  2 resources diverged from committed .tf state\nCost\u002Futilization signal: ywc-performance-engineer persona (cost lens)\n\nPlanned next actions (SAFE):\n  - aws_eip.unused-1            remove via $ywc-iac-author; expected plan: destroy only this idle EIP\n  - aws_instance.worker         right-size via $ywc-iac-author: m5.4xlarge -> m5.large\n\nEscalated (CAUTION — not auto-authored):\n  - aws_instance.batch-runner   moderate utilization, recent scaling history — needs manual review\n\nEscalated (DANGER — not auto-authored):\n  - aws_db_instance.legacy      plan shows a destroy — stateful, requires explicit human approval\n\nVerification (per ywc-verify-done):\n  $ terraform plan (per-item, evidence only)\n  exit 0  (PASS — blast radius matched expectation on all 2 SAFE candidates)\n─────────────────────────────────────────────────\nEstimated monthly delta: -$340 (order of magnitude, cost lens estimate)\n```\n\n## Validation Checklist\n\nBefore declaring the optimization pass complete, verify:\n\n- [ ] Drift detection (`terraform plan`) ran against the declared scope\n- [ ] Cost\u002Futilization signal was gathered via the `ywc-performance-engineer` persona before classification\n- [ ] Every candidate is classified into exactly one tier (SAFE \u002F CAUTION \u002F DANGER); multi-tier matches escalate to the highest\n- [ ] Every SAFE item captured a per-item `terraform plan` baseline and an expected narrow blast radius before being recommended\n- [ ] Reliability-hardening candidates (missing backups\u002FPITR, health checks, autoscaling floors, deletion protection) were classified alongside cost\u002Fdrift candidates, not skipped\n- [ ] No SAFE \u002F CAUTION \u002F DANGER item was executed in this skill — all are reported with next actions only\n- [ ] No `terraform apply` was run at any point\n- [ ] Final `$ywc-verify-done` block uses the canonical wording (PASS \u002F FAIL), unless `--skip-verify-done` was passed\n\n## Common Mistakes\n\n- **Treating a clean per-item `terraform plan` as sufficient for a stateful destroy.** `plan` proves syntactic correctness, not safety — a destroy against a database is DANGER regardless of how clean the plan looks.\n- **Re-using Step 1's cost\u002Futilization snapshot for every item without re-checking.** Signals age; a resource idle three days ago at gather-time may be back in active use by execute-time on a slow-moving scope.\n- **Treating SAFE as permission to edit immediately.** SAFE means the evidence supports a low-risk follow-up authoring pass, not that this skill can write Terraform directly.\n- **Running this skill during a `ywc-infra-review` pass instead of separately.** Review is diagnosis-only and has no write access by design; mixing execution into a review pass collapses a boundary the rest of the toolkit relies on.\n\n## Integration\n\n- **Upstream**: `ywc-infra-review` (diagnosis that surfaces the cost\u002Fdrift\u002Freliability findings this skill classifies); direct user invocation for a scheduled optimization pass.\n- **Downstream**: `ywc-verify-done` (mandatory final claim, unless skipped); `ywc-iac-author` (re-authoring path for SAFE, CAUTION, and DANGER follow-ups).\n- **Consults**: `ywc-performance-engineer` persona (cost\u002Futilization signal, Step 1); `ywc-cloud-engineer` persona (read-only feasibility and blast-radius consult, Step 3).\n- **Must not be paired with**: greenfield topology design (`ywc-infra-design`), first-time authoring (`ywc-iac-author`), or a pre-apply-only review pass (`ywc-infra-review`) — those own separate lifecycle phases.\n\n## References\n\n| Reference | Use when |\n|---|---|\n| `..\u002Freferences\u002Finfra\u002Flenses\u002Fcost.md` | Step 1 — cost\u002Futilization signal gathering, right-sizing and waste taxonomy |\n| `..\u002Freferences\u002Ffinops.md` | Step 1 — the detailed FinOps taxonomy (reserved\u002Fspot, data-transfer cost) the `ywc-performance-engineer` persona reviews against |\n| `..\u002Freferences\u002Finfra\u002Flenses\u002Freliability.md` | Step 2\u002F3 — classification taxonomy for reliability-hardening SAFE\u002FCAUTION candidates (backups, health checks, autoscaling floors, deletion protection, multi-AZ) and the guardrail against a cost change dropping below the reliability floor |\n| `..\u002Freferences\u002Fsubagent-status-actions.md` | Steps 1 and 3 — the §3.5 bounded status-return contract each dispatch must follow so fan-out returns stay bounded |\n| `ywc-verify-done` | Step 5 — per-batch verification block shape (command + exit code + claim) — mandatory unless `--skip-verify-done` |\n",{"name":5,"description":7},"main","7e8ac872e53df8c89d75663e031626281a2a2f5c","plugins\u002Fywc-agent-toolkit\u002Fskills\u002Fywc-infra-optimize",1,"https:\u002F\u002Fgithub.com\u002Fyongwoon\u002Fywc-agent-toolkit","https:\u002F\u002Fgithub.com\u002Fyongwoon","https:\u002F\u002Fwww.webhani.com","2026-11-08 17:14:59",{"source":8,"skillName":5,"commands":32,"prompt":42,"zipAvailable":43},[33,36,39],{"tool":34,"command":35},"npx","npx skills add yongwoon\u002Fywc-agent-toolkit --skill ywc-infra-optimize",{"tool":37,"command":38},"bunx","bunx skills add yongwoon\u002Fywc-agent-toolkit --skill ywc-infra-optimize",{"tool":40,"command":41},"pnpm","pnpm dlx skills add yongwoon\u002Fywc-agent-toolkit --skill ywc-infra-optimize","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fyongwoon\u002Fywc-agent-toolkit\u002Fblob\u002Fmain\u002Fplugins\u002Fywc-agent-toolkit\u002Fskills\u002Fywc-infra-optimize\u002FSKILL.md",true,[45,51,55,59,63],{"path":46,"resourceType":47,"resourceTypeDesc":48,"sizeBytes":49,"sourceHtmlUrl":50},"agents\u002Fopenai.yaml","REFERENCE","参考文档",552,"https:\u002F\u002Fgithub.com\u002Fyongwoon\u002Fywc-agent-toolkit\u002Fblob\u002Fmain\u002Fplugins\u002Fywc-agent-toolkit\u002Fskills\u002Fywc-infra-optimize\u002Fagents\u002Fopenai.yaml",{"path":52,"resourceType":47,"resourceTypeDesc":48,"sizeBytes":53,"sourceHtmlUrl":54},"README.en.md",2889,"https:\u002F\u002Fgithub.com\u002Fyongwoon\u002Fywc-agent-toolkit\u002Fblob\u002Fmain\u002Fplugins\u002Fywc-agent-toolkit\u002Fskills\u002Fywc-infra-optimize\u002FREADME.en.md",{"path":56,"resourceType":47,"resourceTypeDesc":48,"sizeBytes":57,"sourceHtmlUrl":58},"README.ja.md",2967,"https:\u002F\u002Fgithub.com\u002Fyongwoon\u002Fywc-agent-toolkit\u002Fblob\u002Fmain\u002Fplugins\u002Fywc-agent-toolkit\u002Fskills\u002Fywc-infra-optimize\u002FREADME.ja.md",{"path":60,"resourceType":47,"resourceTypeDesc":48,"sizeBytes":61,"sourceHtmlUrl":62},"README.ko.md",2937,"https:\u002F\u002Fgithub.com\u002Fyongwoon\u002Fywc-agent-toolkit\u002Fblob\u002Fmain\u002Fplugins\u002Fywc-agent-toolkit\u002Fskills\u002Fywc-infra-optimize\u002FREADME.ko.md",{"path":64,"resourceType":47,"resourceTypeDesc":48,"sizeBytes":65,"sourceHtmlUrl":66},"README.md",2947,"https:\u002F\u002Fgithub.com\u002Fyongwoon\u002Fywc-agent-toolkit\u002Fblob\u002Fmain\u002Fplugins\u002Fywc-agent-toolkit\u002Fskills\u002Fywc-infra-optimize\u002FREADME.md",[68,74,80,87,94,101],{"skillNo":69,"name":70,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":71,"categories":72,"keywords":73,"publishedAt":18},"01M72TQ84GTCPCV2VJ778V17TW","missing-frontmatter","https:\u002F\u002Fgithub.com\u002Fyongwoon\u002Fywc-agent-toolkit\u002Fblob\u002Fmain\u002Fscripts\u002Ffixtures\u002Fcodex-description-limit\u002Fmissing-frontmatter\u002FSKILL.md",[],[],{"skillNo":75,"name":76,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":77,"categories":78,"keywords":79,"publishedAt":18},"01M72TQ6M4BFWE7P9EPW0GZDCM","malformed-frontmatter","https:\u002F\u002Fgithub.com\u002Fyongwoon\u002Fywc-agent-toolkit\u002Fblob\u002Fmain\u002Fscripts\u002Ffixtures\u002Fcodex-description-limit\u002Fmalformed-frontmatter\u002FSKILL.md",[],[],{"skillNo":81,"name":82,"nameZh":6,"description":83,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":84,"categories":85,"keywords":86,"publishedAt":18},"01M72TQ3ESGKXZ4QRWGTX92BKJ","fixture-501-fail","(ywc) Use when aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa Do not use for x.","https:\u002F\u002Fgithub.com\u002Fyongwoon\u002Fywc-agent-toolkit\u002Fblob\u002Fmain\u002Fscripts\u002Ffixtures\u002Fcodex-description-limit\u002F501-fail\u002FSKILL.md",[],[],{"skillNo":88,"name":89,"nameZh":6,"description":90,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":91,"categories":92,"keywords":93,"publishedAt":18},"01M72TQ0HJ8H3R37J9WPWGKJZR","fixture-500-pass","(ywc) Use when aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa Do not use for x.","https:\u002F\u002Fgithub.com\u002Fyongwoon\u002Fywc-agent-toolkit\u002Fblob\u002Fmain\u002Fscripts\u002Ffixtures\u002Fcodex-description-limit\u002F500-pass\u002FSKILL.md",[],[],{"skillNo":95,"name":96,"nameZh":6,"description":97,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":98,"categories":99,"keywords":100,"publishedAt":18},"01M72TPWNCC7NEYD0D9N12KSQS","ywc-worktrees","(ywc) Use when creating, auditing, pruning, or resolving git worktrees for isolated task workspaces, whether delegated from an executor or used standalone. Triggers: \"worktree 생성\", \"worktree audit\", \"worktree 정리\", \"worktree prune\", \"ywc-worktrees\", \"create worktree\". Do not use for branch creation\u002Fdeletion alone, PR creation (use ywc-create-pr), CI or merge delivery (use ywc-finish-branch), task orchestration (use ywc-sequential-executor or ywc-parallel-executor), or non-git isolation.","https:\u002F\u002Fgithub.com\u002Fyongwoon\u002Fywc-agent-toolkit\u002Fblob\u002Fmain\u002Fplugins\u002Fywc-agent-toolkit\u002Fskills\u002Fywc-worktrees\u002FSKILL.md",[],[],{"skillNo":102,"name":103,"nameZh":6,"description":104,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":105,"categories":106,"keywords":107,"publishedAt":18},"01M72TPRNR3E6QWB91GM98ABBV","ywc-wayfinder","(ywc) Use when a large or uncertain change needs multi-session discovery with a deterministic local map and exactly one active ticket before planning or implementation. Triggers: \"wayfinder\", \"길찾기\", \"discovery map\", \"multi-session discovery\", \"탐색 ticket\", \"経路整理\", \"探索マップ\", \"ywc-wayfinder\". Do not use for ordinary planning (use ywc-plan), idea clarification (use ywc-brainstorm), direct implementation, or tracker\u002Fdatabase writes outside the local Markdown map.","https:\u002F\u002Fgithub.com\u002Fyongwoon\u002Fywc-agent-toolkit\u002Fblob\u002Fmain\u002Fplugins\u002Fywc-agent-toolkit\u002Fskills\u002Fywc-wayfinder\u002FSKILL.md",[],[]]