account-research
Research a company or person and get actionable sales intel. Works standalone with web search, supercharged when you connect…
\"Solve the newsvendor problem for single-period ordering decisions under uncertain demand. Use this skill when the user needs to determine optimal order quantity for perishable goods, seasonal products, or one-time purchase decisions — even if they say 'how much to order for
Claude Code
$ npx -y skills add charlieviettq/awesome-agent-skill --skill algo-sc-newsvendor --agent claude-code
Codex
$ npx skills add charlieviettq/awesome-agent-skill --skill algo-sc-newsvendor -a codex -y
Cursor
$ npx skills add charlieviettq/awesome-agent-skill --skill algo-sc-newsvendor -a cursor -y
Gemini CLI
$ npx skills add charlieviettq/awesome-agent-skill --skill algo-sc-newsvendor -a gemini-cli -y
GitHub Copilot
$ npx skills add charlieviettq/awesome-agent-skill --skill algo-sc-newsvendor -a github-copilot -y
OpenCode
$ npx skills add charlieviettq/awesome-agent-skill --skill algo-sc-newsvendor -a opencode -y
Windsurf
$ npx skills add charlieviettq/awesome-agent-skill --skill algo-sc-newsvendor -a windsurf -y
name: "\"algo-sc-newsvendor\"" description: "\"Solve the newsvendor problem for single-period ordering decisions under uncertain demand. Use this skill when the user needs to determine optimal order quantity for perishable goods, seasonal products, or one-time purchase decisions — even if they say 'how much to order for this season', 'perishable inventory', or 'single-period ordering'.\"." allowed-tools: Bash, Read, Write, Edit, Glob, Grep
The newsvendor model determines optimal order quantity for a single selling period with uncertain demand. Balances overage cost (Co = cost - salvage) against underage cost (Cu = price - cost). Optimal Q* satisfies: P(D ≤ Q*) = Cu / (Cu + Co). Known as the critical ratio solution.
**Trigger conditions:**
**When NOT to use:**
IRON LAW: The Critical Ratio Determines Optimal Service Level Q* = F⁻¹(Cu / (Cu + Co)) where F⁻¹ is the inverse demand CDF. If margin is high relative to cost (Cu >> Co), order MORE (high service level). If margin is low relative to excess cost (Co >> Cu), order LESS (low service level). The optimal solution almost NEVER equals expected demand.
Define: unit cost (c), selling price (p), salvage value (v), demand distribution (mean μ, std σ). Compute: Cu = p - c, Co = c - v. **Gate:** p > c > v (profitable with positive overage cost), demand distribution estimated.
1. Critical ratio: CR = Cu / (Cu + Co) = (p - c) / (p - v) 2. If demand ~ Normal(μ, σ): Q* = μ + z(CR) × σ where z(CR) = inverse normal CDF at CR 3. Expected profit = Cu × E[min(Q,D)] - Co × E[max(Q-D, 0)] 4. Expected units sold = μ - σ × L(z) where L(z) is the standard loss function
Check: Q* > 0, CR between 0 and 1, Q* is above or below μ depending on whether CR > or < 0.5. **Gate:** Q* directionally correct relative to mean demand.
Return optimal order quantity with profit analysis.
{
"optimal_quantity": 130,
"critical_ratio": 0.71,
"expected_profit": 2800,
"expected_leftover": 15,
"expected_stockout_probability": 0.29,
"metadata": {"price": 50, "cost": 20, "salvage": 5, "demand_mean": 100, "demand_std": 30}
}**Input:** p=$50, c=$20, v=$5, D~Normal(100, 30) **Expected:** Cu=30, Co=15, CR=30/45=0.667, z=0.43, Q*=100+0.43×30=113 units.
| Input | Expected | Why | |-------|----------|-----| | v = 0 (total loss) | Lower Q*, conservative | High overage cost pushes order down | | p >> c (high margin) | Q* well above mean | Worth risking excess to avoid lost sales | | σ = 0 (certain demand) | Q* = μ exactly | No uncertainty, order exactly demand |
| Script | Description | Usage | |--------|-------------|-------| | `scripts/newsvendor.py` | Compute newsvendor optimal quantity, expected profit, and fill rate | `python scripts/newsvendor.py --help` |
Run `python scripts/newsvendor.py --verify` to execute built-in sanity tests.
Curated skill pack for LLM agents in engineer and science workflow (Cursor & Claude ready).
Research a company or person and get actionable sales intel. Works standalone with web search, supercharged when you connect…
Evaluate LLM agents and tool-using workflows—task success, tool accuracy, latency/cost, safety, and regression suites. Use when…
Design agent tools and CLI surfaces—schemas, naming, errors, idempotency, and discoverability for LLM callers. Use when defining…
\"Implement and select ad bidding strategies from manual CPC to automated target-CPA and target-ROAS. Use this skill when the…
\"Optimize advertising budget allocation across campaigns using marginal returns analysis. Use this skill when the user needs to…
\"Build CTR prediction models for estimating ad click-through rates from features. Use this skill when the user needs to predict…
You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or…
Ask which skill or flow fits your situation. A router over the skills in this repo.