\"algo-sc-eoq\"

SkillFiles & storage

This skill lets your AI calculate Economic Order Quantity, the order size that keeps the combined cost of ordering and holding inventory as low as possible. Once added, your AI can tell you how much to order, what batch size is optimal, and when to reorder.

Available today. Use it from your connected AI after setup.

After adding the skill, ask your AI a question like 'how much should I order' or 'what is my optimal batch size' and it will run the calculation for you.

Then ask your AI: use the \"algo-sc-eoq\" skill

What your AI can do with it

  • Calculate the optimal order size for your inventory
  • Balance how often you order against what storage costs you
  • Set reorder points for the items you stock
  • Find the order quantity that minimizes total inventory cost

What this skill tells your AI

The instructions your AI receives, as published by charlieviettq/awesome-agent-skill in .claude/skills/algo-sc-eoq/SKILL.md and read by ahel’s review.

Overview

EOQ determines the order quantity that minimizes total inventory cost = ordering cost + holding cost. Formula: EOQ = √(2DS/H) where D=annual demand, S=ordering cost per order, H=holding cost per unit per year. Assumes constant demand and instantaneous replenishment.

When to Use

Trigger conditions:

  • Setting standard order quantities for inventory replenishment
  • Balancing ordering frequency against warehousing costs
  • Baseline calculation before applying safety stock adjustments

When NOT to use:

  • When demand is highly uncertain (use newsvendor model)
  • When products are perishable with short shelf life
  • When quantity discounts change the cost structure significantly

Algorithm

IRON LAW: EOQ Assumes CONSTANT, KNOWN Demand
If demand is variable or uncertain, EOQ gives the wrong answer.
Real-world application: use EOQ as a starting point, then add
safety stock for demand variability and lead time uncertainty.
Total cost curve is flat near EOQ — ±20% from optimal Q changes
total cost by only ~2%.

Phase 1: Input Validation

Determine: D (annual demand in units), S (fixed cost per order), H (holding cost per unit per year = unit cost × holding rate, typically 20-30% of unit value). Gate: All costs positive, demand estimate reasonable.

Phase 2: Core Algorithm

  1. EOQ = √(2 × D × S / H)
  2. Number of orders per year = D / EOQ
  3. Reorder point = d × L (daily demand × lead time in days)
  4. Total annual cost = (D/Q × S) + (Q/2 × H) at Q = EOQ

Phase 3: Verification

Check: ordering cost component ≈ holding cost component (they're equal at EOQ). Total cost is at minimum. Gate: Ordering cost ≈ holding cost (±5%).

Phase 4: Output

Return EOQ with cost breakdown and reorder point.

Output Format

{
  "eoq": 500,
  "orders_per_year": 20,
  "reorder_point": 150,
  "annual_cost": {"ordering": 2000, "holding": 2000, "total": 4000},
  "metadata": {"demand": 10000, "order_cost": 100, "holding_cost": 4.0}
}

Examples

Sample I/O

Input: D=10,000 units/year, S=$100/order, H=$4/unit/year Expected: EOQ = √(2×10000×100/4) = √500000 = 707 units

Edge Cases

InputExpectedWhy
Very high S, low HLarge EOQ, few ordersMinimize expensive ordering
Very low S, high HSmall EOQ, frequent ordersMinimize expensive holding
D = 0EOQ = 0, no orderingNo demand, no orders needed

Gotchas

  • Holding cost underestimation: H should include: capital cost, storage, insurance, obsolescence, handling. Companies often only count warehouse rent, understating true H.
  • Flat cost curve: Total cost is insensitive near EOQ. Rounding EOQ to a convenient number (full pallet, container) costs very little.
  • Quantity discounts: Price breaks at certain quantities may make it cheaper to order MORE than EOQ. Compare total cost at EOQ vs discount breakpoints.
  • Lead time variability: EOQ doesn't address when to order, only how much. Add safety stock: SS = z × σ_demand × √(lead time).
  • Multi-item coordination: When multiple items share ordering costs (same supplier), use joint replenishment models, not individual EOQs.

Scripts

ScriptDescriptionUsage
scripts/eoq.pyCompute Economic Order Quantity and cost breakdownpython scripts/eoq.py --help

Run python scripts/eoq.py --verify to execute built-in sanity tests.

References

  • For EOQ with quantity discounts, see references/eoq-discounts.md
  • For safety stock calculation, see algo-sc-safety-stock

Signals

GitHub stars
26
Forks
9
Last commit
Jul 2026
Advanced
Catalog kind
skill
Gateway key
algo-sc-eoq
Source
github.com/charlieviettq/awesome-agent-skill