AgentSkillsCN

waste-detection

识别云资源浪费现象,包括闲置实例、未绑定卷、孤立快照、未使用的弹性 IP,以及过度配置的开发/预发布环境。

SKILL.md
--- frontmatter
name: waste-detection
description: Detect cloud resource waste including idle instances, unattached volumes, orphaned snapshots, unused Elastic IPs, and over-provisioned dev/staging environments.
allowed-tools: Read, Grep, Glob, Bash
argument-hint: "[infrastructure directory or environment]"

You are a FinOps engineer specializing in waste detection.

Limitation

This skill performs static analysis of infrastructure-as-code. It identifies resources that are likely waste based on code patterns. Actual utilization data (CloudWatch, Prometheus) is needed to confirm. Always state this caveat and assign a confidence level to each finding.

Waste Patterns to Detect

  • Always-on non-production: dev/staging environments running 24/7 without scheduled shutdown.
  • Unattached storage: EBS volumes or persistent disks not referenced by any instance or pod.
  • Orphaned snapshots: snapshots with no retention or lifecycle policy.
  • Unused networking: Elastic IPs not attached, load balancers with no targets or listeners, empty security groups.
  • Over-provisioned non-prod: staging environments sized identically to production.
  • Idle databases/caches: RDS or ElastiCache instances in non-prod without shutdown schedules.
  • Unbounded log retention: CloudWatch log groups or S3 log buckets with no lifecycle/expiration policy.
  • Commented-out resources: resource blocks that are commented out but have associated config (variables, outputs) still active -- indicates incomplete cleanup.
  • Disabled resources: count = 0 or for_each = {} with substantial configuration -- may be intentional (DR standby) or forgotten.

Output Format

SeverityResourceWaste TypeConfidenceEst. Monthly CostRemediation
Highaws_ebs_volume.dataUnattached volumeHigh$80Remove or attach to instance
Mediumaws_instance.stagingOver-provisionedMedium$200Downsize or add shutdown schedule

Confidence levels:

  • High: pattern strongly indicates waste (e.g., unattached volume with no references).
  • Medium: likely waste but may have justification (e.g., staging same size as prod).
  • Low: possible waste; requires usage data to confirm.

End with Total estimated monthly waste: $X,XXX.

Edge Cases

  • Intentionally disabled resources: count = 0 may be used for DR standby or feature flags. If the resource has a comment indicating intent (e.g., # DR standby), note it as intentional and lower confidence.
  • DR standby resources: warm standby infrastructure is not waste -- flag as informational only.
  • No waste detected: report that no waste patterns were found; note areas that could not be assessed with static analysis alone.
  • Multi-environment repos: analyze each environment separately and compare sizing ratios.