# Cost Optimization

> Cost optimization skill. Review SmartCMP FinOps recommendations or analyze one cloud, software, hardware, virtualized, VM, or database resource for platform-confirmed and LLM-inferred savings opportunities. Use active policy evidence, bounded resource cost facts, risk assessment, and conservative saving estimates; remediate only existing findings through native day2 repair and track remediation state.

- Skill: `cloudchef/cost-optimization` (Agent Skill, multi-file: 5 files)
- Install (CLI): `npx skillmds@latest add cloudchef/cost-optimization`
- Raw SKILL.md: https://api.skillmd.com/api/skills/cloudchef/cost-optimization/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: DevOps & Infra
- Author: CloudChef (https://skillmd.com/u/cloudchef)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/cloudchef/cost-optimization

---


# cost-optimization

Use this skill to work through cost optimization recommendations from
discovery to remediation tracking.

## Handlers and helpers

`scripts/adapter.py` contains all five Tool handlers for listing, analysis,
execution, and tracking. `scripts/_cost_object_actions.py` remains separate
because the embedded assistant Context resolver calls it to build resource
actions; it is not a one-command forwarding script.

## Workflow

Choose the entry path that matches the user's object:

1. Analyze an existing recommendation:
   - Call `smartcmp_list_cost_recommendations`
   - Optionally request related policy counts
   - Call `smartcmp_analyze_cost_recommendation`
   - Let SmartCMP Provider resolve the related `resourceId`
   - Merge normalized resource `type + properties` into the analysis facts
   - Returns multi-dimensional recommendations (P0/P1/P2 priority)
   - Includes risk assessment and best practice guidance
   - Shows saving contribution, policy history, and resource operational context
2. Analyze a resource directly:
   - Call `smartcmp_analyze_resource_cost` with an exact visible name or recent list `#` selection
   - Read resource facts, enabled applicable policy configurations, latest resource executions,
     and active violations without triggering policy execution
   - Use the returned `analysisContract` to keep platform facts separate from `llm_potential`
   - Read [references/RESOURCE_ANALYSIS.md](references/RESOURCE_ANALYSIS.md) for VM, AWS RDS,
     and generic resource reasoning rules
3. Call `smartcmp_execute_cost_optimization` for native day2 repair only after
   the user explicitly requests it
4. Track remediation state with `smartcmp_track_cost_optimization`

## Analysis Output Enhancement

`smartcmp_analyze_cost_recommendation` provides:

- **P0 Primary Action**: Provider recommendation (remediate / configure_platform_policy / manual_review)
- **P1 Risk Assessment**: Risk level (high/medium/low) with specific warnings
- **P1 Configuration Guide**: When fixType is missing, explains how to configure day2 repair
- **P1 Saving Priority**: Contribution percentage to global optimizable amount
- **P2 Policy History**: Compliance rate trend and violation recurrence count
- **Resource Context**: Resource type, component type, status, OS, and normalized datasource facts

## Safety Boundary

The skill only performs platform-native remediation through:

- `POST /compliance-policies/violations/day2/fix/{id}`

It does not call AWS or Azure APIs directly.

Resource-first analysis is read-only. It must not call:

- `POST /compliance-policies/execute`
- `POST /compliance-policies/violations/day2/fix/{id}`

Only an existing platform violation may enter the separate remediation flow. An
`llm_potential` result is never executable.

## Resource Enrichment

SmartCMP Provider resolves and reads resource evidence whenever a
recommendation includes `resourceId`.

- Pull resource details before rendering the final analysis output.
- Merge resource status/type/OS and normalized facts into `facts` and
  downstream recommendations.
- If resource lookup is unavailable, continue with policy/violation analysis as
  a best-effort degradation path.

