Margin Analysis & Profit Optimization

Analyze gross, operating, and net margins by product line, customer segment, and channel. Identify margin erosion patterns and build pricing power.

3,891 stars
Complexity: easy

About this skill

The Margin Analysis & Profit Optimization skill provides a structured framework for AI agents to delve deep into a business's financial health. It systematically breaks down revenue into different margin layers (Gross, Contribution, Operating, Net) and then segments these margins by product lines, customer tiers, channels, and geography. This multi-faceted approach helps identify specific areas of profitability and inefficiency. Users can leverage this skill for critical business decisions such as quarterly margin reviews, setting pricing strategies for new products or discounts, evaluating cost structure changes, and preparing for board meetings or investor reports. It's also highly valuable during post-acquisition integration to model blended margins effectively. By meticulously detecting margin erosion patterns—like declining gross margins, increased discounting, or disproportionate cost growth—the skill helps pinpoint underlying issues. Furthermore, it assesses an organization's pricing power based on factors like switching costs, differentiation, and market position, providing actionable insights to strengthen pricing strategies and ultimately optimize overall profitability.

Best use case

The primary use case is providing a deep analytical understanding of a company's profitability drivers and erosion points. Businesses seeking to refine pricing strategies, manage costs more effectively, or improve overall financial performance, especially in finance, sales, and executive leadership roles, will benefit most from its insights.

Analyze gross, operating, and net margins by product line, customer segment, and channel. Identify margin erosion patterns and build pricing power.

Users can expect a structured analysis report highlighting margin performance across segments, identified erosion patterns, an assessment of pricing power, and actionable recommendations for profit optimization.

Practical example

Example input

Analyze our Q3 2023 margin performance. Focus on our SaaS product lines, enterprise vs. SMB segments, and assess our pricing power given recent market changes. Use provided financial statements.

Example output

Q3 2023 Margin Analysis:
* Gross Margin: SaaS Product A (75%), Product B (62%). Product B shows 3% QoQ decline.
* Segment Margins: Enterprise customers (28% operating margin), SMB (15%). SMB operating costs increased 5% QoQ.
* Erosion: Product B's GM decline; SMB support costs up, CAC > LTV.
* Pricing Power: Score 14/20. Strong differentiation for Product A, but Product B faces commodity risk.
* Recommendations: Re-evaluate Product B pricing, optimize SMB support workflows.

When to use this skill

  • Quarterly margin reviews
  • Pricing decisions (new product, discount, bundle strategy)
  • Cost structure changes (new vendor, headcount, infrastructure)
  • Board prep or investor reporting

When not to use this skill

  • When comprehensive financial data (revenue, COGS, variable costs) is unavailable or inaccurate.
  • For non-financial analysis tasks, such as market research or content generation.
  • In very early-stage startups without defined product lines or customer segments.
  • As a substitute for professional accounting or legal advice.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/afrexai-margin-analysis/SKILL.md --create-dirs "https://raw.githubusercontent.com/openclaw/skills/main/skills/1kalin/afrexai-margin-analysis/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/afrexai-margin-analysis/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How Margin Analysis & Profit Optimization Compares

Feature / AgentMargin Analysis & Profit OptimizationStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityeasyN/A

Frequently Asked Questions

What does this skill do?

Analyze gross, operating, and net margins by product line, customer segment, and channel. Identify margin erosion patterns and build pricing power.

How difficult is it to install?

The installation complexity is rated as easy. You can find the installation instructions above.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

Related Guides

SKILL.md Source

# Margin Analysis & Profit Optimization

Analyze gross, operating, and net margins by product line, customer segment, and channel. Identify margin erosion patterns and build pricing power.

## When to Use
- Quarterly margin reviews
- Pricing decisions (new product, discount approval, bundle strategy)
- Cost structure changes (new vendor, headcount, infrastructure)
- Board prep or investor reporting
- Post-acquisition integration (blended margin modeling)

## Framework

### Step 1: Margin Stack (Top → Bottom)
Break revenue into layers. For each product/service line:

| Layer | Formula | Healthy Range |
|-------|---------|--------------|
| Gross Margin | (Revenue - COGS) / Revenue | 60-80% (SaaS), 30-50% (services), 20-40% (manufacturing) |
| Contribution Margin | (Revenue - Variable Costs) / Revenue | 40-70% |
| Operating Margin | EBIT / Revenue | 15-30% (mature), -20-10% (growth) |
| Net Margin | Net Income / Revenue | 10-25% (healthy), varies by stage |

### Step 2: Margin by Segment
Split margins across:
- **Product lines** — which products subsidize others?
- **Customer tiers** — enterprise vs mid-market vs SMB
- **Channels** — direct sales vs partner vs self-serve
- **Geography** — domestic vs international (FX, compliance costs)

### Step 3: Erosion Detection
Flag these patterns:
- Gross margin declining >2% QoQ without volume increase
- Discount frequency increasing (>30% of deals discounted)
- Customer acquisition cost (CAC) growing faster than LTV
- Support costs per customer rising (hidden COGS)
- Infrastructure costs scaling faster than revenue

### Step 4: Pricing Power Assessment
Score 1-5 on each:
1. **Switching costs** — how hard is it to leave?
2. **Differentiation** — can customers get this elsewhere?
3. **Value quantification** — can you prove $ ROI?
4. **Market position** — leader, challenger, or commodity?
5. **Contract structure** — annual, multi-year, usage-based?

Total 20+ = strong pricing power. Below 12 = commodity risk.

### Step 5: Optimization Levers

**Revenue side:**
- Price increase (1% price increase = 8-12% profit increase for most businesses)
- Upsell/cross-sell (expansion revenue at near-zero marginal cost)
- Usage-based pricing tiers (capture value from power users)
- Annual prepay discounts (improve cash flow, lock retention)

**Cost side:**
- Vendor renegotiation (benchmark against 3+ alternatives)
- Infrastructure right-sizing (cloud cost audits save 20-40%)
- Automation of manual processes (support, onboarding, billing)
- Headcount-to-revenue ratio optimization

### Step 6: Scenario Modeling
Build three scenarios for next 4 quarters:

| Scenario | Revenue Growth | Margin Change | Action |
|----------|---------------|---------------|--------|
| Base | Current trajectory | Flat | Maintain |
| Bull | +20% growth | +3-5% margin | Invest in scaling |
| Bear | -10% decline | -5-8% margin | Cut to protect cash |

For each: model cash runway, breakeven timeline, and hiring capacity.

## 2026 Benchmarks by Industry

| Industry | Gross Margin | Operating Margin | Net Margin |
|----------|-------------|-----------------|------------|
| SaaS (B2B) | 70-85% | 15-30% | 10-25% |
| Professional Services | 50-70% | 15-25% | 10-20% |
| Fintech | 60-75% | 10-25% | 8-20% |
| Healthcare Tech | 55-70% | 10-20% | 5-15% |
| Manufacturing | 25-45% | 8-15% | 5-12% |
| E-commerce | 30-50% | 5-15% | 3-10% |
| Construction Tech | 35-55% | 10-20% | 5-12% |
| Legal Tech | 65-80% | 20-35% | 15-25% |
| Real Estate Tech | 40-60% | 10-20% | 5-15% |
| Recruitment Tech | 55-70% | 12-22% | 8-18% |

## Red Flags
- Gross margin below industry median for 2+ quarters
- Negative contribution margin on any product (you're paying customers to use it)
- Operating margin declining while revenue grows (scaling inefficiency)
- Net margin negative with no clear path to breakeven
- Customer concentration >30% of revenue from top 3 accounts

## Output Template
```
MARGIN ANALYSIS — [Company/Division] — [Period]

Revenue: $X | Gross Margin: X% | Operating Margin: X% | Net Margin: X%
QoQ Trend: [improving/flat/declining]
vs Industry Benchmark: [above/at/below] by X%

TOP 3 FINDINGS:
1. [Finding + $ impact]
2. [Finding + $ impact]
3. [Finding + $ impact]

RECOMMENDATIONS:
1. [Action] → Expected margin impact: +X%
2. [Action] → Expected margin impact: +X%
3. [Action] → Expected margin impact: +X%

90-DAY PRIORITY: [Single highest-leverage action]
```

## Resources
- [AI Revenue Leak Calculator](https://afrexai-cto.github.io/ai-revenue-calculator/) — find where margins are eroding
- [Industry Context Packs](https://afrexai-cto.github.io/context-packs/) ($47) — vertical-specific margin benchmarks and optimization playbooks
- [Agent Setup Wizard](https://afrexai-cto.github.io/agent-setup/) — automate margin monitoring with AI agents

Related Skills

Commercial Lease Analyzer

3891
from openclaw/skills

Analyze commercial leases (office, retail, industrial, warehouse) for hidden costs, unfavorable terms, and negotiation leverage. Use when reviewing a new lease, renegotiating a renewal, or comparing multiple lease options.

Business Analysis

Profit Margin Analyzer

3891
from openclaw/skills

Analyze and optimize profit margins across your business. Identifies margin compression, pricing opportunities, and cost levers.

Investment Analysis & Portfolio Management Engine

3891
from openclaw/skills

Complete investment analysis, portfolio construction, risk management, and trade execution methodology. Works across stocks, crypto, ETFs, bonds, and alternatives. Zero dependencies — pure agent skill.

Finance & Investing

FP&A Command Center — Financial Planning & Analysis Engine

3891
from openclaw/skills

You are a senior FP&A professional. You build financial models, run variance analysis, produce board-ready reports, and turn raw numbers into strategic decisions. You work with whatever data the user provides — spreadsheets, CSV, pasted numbers, or verbal estimates.

Finance & Analytics

Cloud Cost Optimization Audit

3891
from openclaw/skills

Analyze cloud infrastructure spend across AWS, Azure, and GCP. Identify waste, rightsizing opportunities, and reserved instance savings.

data-analysis-partner

3891
from openclaw/skills

智能数据分析 Skill,输入 CSV/Excel 文件和分析需求,输出带交互式 ECharts 图表的 HTML 自包含分析报告

Data & Research

onchain-contract-token-analysis

3891
from openclaw/skills

Analyze smart contracts, token mechanics, permissions, fee flows, upgradeability, market risks, and likely attack surfaces for onchain projects. Use when reviewing ERC-20s, launchpads, vaults, staking systems, LP fee routing, ownership controls, proxy setups, or suspicious token behavior.

Security

resume-analysis

3891
from openclaw/skills

简历分析 skill。用于诊断整份简历的完整性、清晰度、岗位相关性、成果表达和结构质量。当用户说“分析简历”“看看我的简历”“简历诊断”时使用。

Workflow & Productivity

ad-creative-analysis

3891
from openclaw/skills

Analyze ad creatives (images and videos) extracted from competitor research. Use when given a directory of ad images, video files, or transcripts to evaluate ad quality, score visual and messaging effectiveness, assign a scale score for viral/engagement potential, and generate a cross-creative pattern summary. Triggered by requests like "analyze these ads", "score these creatives", "what hooks are competitors using", "evaluate the ad library", "give me a scale score", "analyze the ad folder", or "what's working in these ads".

Amazon Listing Optimizer — Free Listing Analysis & Keyword Research

3891
from openclaw/skills

**Free alternative to Helium 10 ($97/mo) and Jungle Scout ($49/mo).**

Amazon FBA Fee Calculator — Know Your REAL Profit

3891
from openclaw/skills

**Stop guessing. Know exactly what you'll make before you sell a single unit.**

swotpal-swot-analysis

3891
from openclaw/skills

Professional SWOT analysis and competitive comparison powered by SWOTPal.com