Cost Efficiency Analyzer
Analyzes cost structure and operational efficiency by examining COGS,
operating expenses, and their ratios relative to revenue over time.
Prerequisites
No inputs required unless the user asks about a specific quarter.
Default: analyze the most recent quarter (Q3 2025) with comparison to Q2 2025.
Steps
Step 1: Fetch cost data
Fetch the quarter(s) needed:
get_financial_data(period="Q3 2025")
get_financial_data(period="Q2 2025")
If the user asks for a different quarter, fetch that instead.
Step 2: Fetch benchmarks
get_kpi_benchmarks()
Extract:
gross_margin_pct: formula and benchmark (40%)
opex_ratio: formula and benchmark (30%) — note: lower is better
Step 3: Compute cost metrics
Use python_exec to calculate cost efficiency metrics:
# Q3 2025 data
r3 = 4200000; cogs3 = 1890000; opex3 = 1050000; ebitda3 = 1260000
# Q2 2025 data (for comparison)
r2 = 3800000; cogs2 = 1710000; opex2 = 980000; ebitda2 = 1110000
def cost_metrics(revenue, cogs, opex, ebitda, label):
gross_profit = revenue - cogs
gross_margin = round(gross_profit / revenue * 100, 1)
cogs_pct = round(cogs / revenue * 100, 1)
opex_pct = round(opex / revenue * 100, 1)
total_cost = cogs + opex
total_cost_pct = round(total_cost / revenue * 100, 1)
ebitda_margin = round(ebitda / revenue * 100, 1)
cost_per_rev = round(total_cost / revenue, 4) # $ of cost per $ of revenue
print(f"\n{label}:")
print(f" COGS: ${cogs:,} ({cogs_pct}% of revenue)")
print(f" Operating Expenses: ${opex:,} ({opex_pct}% of revenue)")
print(f" Total Cost: ${total_cost:,} ({total_cost_pct}% of revenue)")
print(f" Gross Margin: {gross_margin}% (benchmark: 40%)")
print(f" EBITDA Margin: {ebitda_margin}% (benchmark: 15%)")
print(f" Cost per $1 revenue: ${cost_per_rev:.4f}")
return {"gross_margin": gross_margin, "opex_pct": opex_pct, "cogs_pct": cogs_pct,
"total_cost_pct": total_cost_pct}
m3 = cost_metrics(r3, cogs3, opex3, ebitda3, "Q3 2025")
m2 = cost_metrics(r2, cogs2, opex2, ebitda2, "Q2 2025")
# QoQ cost efficiency change
print(f"\nQoQ Cost Efficiency Change (Q2 → Q3):")
print(f" COGS ratio: {m2['cogs_pct']}% → {m3['cogs_pct']}% ({m3['cogs_pct']-m2['cogs_pct']:+.1f}pp)")
print(f" OpEx ratio: {m2['opex_pct']}% → {m3['opex_pct']}% ({m3['opex_pct']-m2['opex_pct']:+.1f}pp)")
print(f" Total cost%: {m2['total_cost_pct']}% → {m3['total_cost_pct']}% ({m3['total_cost_pct']-m2['total_cost_pct']:+.1f}pp)")
Step 4: Benchmark assessment
For each cost ratio, assign status vs benchmark:
- Gross Margin: GREEN ≥ 40%, YELLOW 35–40%, RED < 35%
- OpEx Ratio: GREEN ≤ 30%, YELLOW 30–35%, RED > 35% (lower is better)
Step 5: Present results
Format your response as:
Cost Structure Table — current quarter
| Cost Item |
Amount |
% of Revenue |
Benchmark |
Status |
QoQ Cost Efficiency — did cost ratios improve or worsen vs prior quarter?
Cost Efficiency Verdict — one paragraph: is cost management healthy,
where is the risk, and what should leadership watch?
1---2name: cost-efficiency-analyzer3description: Analyzes cost structure, cost efficiency, and expense management from P&L data.4 Use when the user asks about costs, expenses, COGS, operating expenses, cost ratios,5 cost control, spending efficiency, margin compression from cost side, or wants to6 understand where money is going. Also use for "are we spending too much", "cost breakdown",7 "expense analysis", or "how efficient are our operations". NOT for revenue or top-line analysis.8metadata:9 source: https://skillmd.com/skills/awslabs/cost-efficiency-analyzer10 version: "1.0"11 tags: finance, cost, expenses, efficiency, operations12mcp_tools:13 - get_financial_data14 - get_kpi_benchmarks15---1617# Cost Efficiency Analyzer1819Analyzes cost structure and operational efficiency by examining COGS,20operating expenses, and their ratios relative to revenue over time.2122## Prerequisites2324No inputs required unless the user asks about a specific quarter.25Default: analyze the most recent quarter (Q3 2025) with comparison to Q2 2025.2627## Steps2829### Step 1: Fetch cost data3031Fetch the quarter(s) needed:3233 get_financial_data(period="Q3 2025")34 get_financial_data(period="Q2 2025")3536If the user asks for a different quarter, fetch that instead.3738### Step 2: Fetch benchmarks3940 get_kpi_benchmarks()4142Extract:43- `gross_margin_pct`: formula and benchmark (40%)44- `opex_ratio`: formula and benchmark (30%) — note: lower is better4546### Step 3: Compute cost metrics4748Use python_exec to calculate cost efficiency metrics:4950```python51# Q3 2025 data52r3 = 4200000; cogs3 = 1890000; opex3 = 1050000; ebitda3 = 12600005354# Q2 2025 data (for comparison)55r2 = 3800000; cogs2 = 1710000; opex2 = 980000; ebitda2 = 11100005657def cost_metrics(revenue, cogs, opex, ebitda, label):58 gross_profit = revenue - cogs59 gross_margin = round(gross_profit / revenue * 100, 1)60 cogs_pct = round(cogs / revenue * 100, 1)61 opex_pct = round(opex / revenue * 100, 1)62 total_cost = cogs + opex63 total_cost_pct = round(total_cost / revenue * 100, 1)64 ebitda_margin = round(ebitda / revenue * 100, 1)65 cost_per_rev = round(total_cost / revenue, 4) # $ of cost per $ of revenue6667 print(f"\n{label}:")68 print(f" COGS: ${cogs:,} ({cogs_pct}% of revenue)")69 print(f" Operating Expenses: ${opex:,} ({opex_pct}% of revenue)")70 print(f" Total Cost: ${total_cost:,} ({total_cost_pct}% of revenue)")71 print(f" Gross Margin: {gross_margin}% (benchmark: 40%)")72 print(f" EBITDA Margin: {ebitda_margin}% (benchmark: 15%)")73 print(f" Cost per $1 revenue: ${cost_per_rev:.4f}")74 return {"gross_margin": gross_margin, "opex_pct": opex_pct, "cogs_pct": cogs_pct,75 "total_cost_pct": total_cost_pct}7677m3 = cost_metrics(r3, cogs3, opex3, ebitda3, "Q3 2025")78m2 = cost_metrics(r2, cogs2, opex2, ebitda2, "Q2 2025")7980# QoQ cost efficiency change81print(f"\nQoQ Cost Efficiency Change (Q2 → Q3):")82print(f" COGS ratio: {m2['cogs_pct']}% → {m3['cogs_pct']}% ({m3['cogs_pct']-m2['cogs_pct']:+.1f}pp)")83print(f" OpEx ratio: {m2['opex_pct']}% → {m3['opex_pct']}% ({m3['opex_pct']-m2['opex_pct']:+.1f}pp)")84print(f" Total cost%: {m2['total_cost_pct']}% → {m3['total_cost_pct']}% ({m3['total_cost_pct']-m2['total_cost_pct']:+.1f}pp)")85```8687### Step 4: Benchmark assessment8889For each cost ratio, assign status vs benchmark:90- Gross Margin: GREEN ≥ 40%, YELLOW 35–40%, RED < 35%91- OpEx Ratio: GREEN ≤ 30%, YELLOW 30–35%, RED > 35% (lower is better)9293### Step 5: Present results9495Format your response as:96971. **Cost Structure Table** — current quarter9899 | Cost Item | Amount | % of Revenue | Benchmark | Status |100 |-----------|--------|-------------|-----------|--------|1011022. **QoQ Cost Efficiency** — did cost ratios improve or worsen vs prior quarter?1031043. **Cost Efficiency Verdict** — one paragraph: is cost management healthy,105 where is the risk, and what should leadership watch?