Agent skill

Algo Sc Newsvendor

by asgard-ai-platform in asgard-ai-platform/skills

Solve the newsvendor problem for single-period ordering decisions under uncertain demand.

MITAuto-check passed

Install Algo Sc Newsvendor

skills CLI
$ npx skills add asgard-ai-platform/skills --skill algo-sc-newsvendor -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install asgard-ai-platform/skills algo-sc-newsvendor --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/asgard-ai-platform/skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/algo-sc-newsvendor .claude/skills/algo-sc-newsvendor && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
algo-sc-newsvendor
GitHub stars
242
Token cost
~1.1k tokens
SKILL.md length
434 words
Files
5 (incl. scripts, references)
Skills in repo
207
Repo updated
First seen
Licence
MIT

At a glance

Solve the newsvendor problem for single-period ordering decisions under uncertain demand.

  • Works in 4 steps: Input Validation → Core Algorithm → Verification → …
  • The user needs to determine optimal order quantity for perishable goods
  • SKILL.md covers Overview, When to Use, Algorithm and Output Format, plus 4 more sections
  • Runs Python scripts from its folder; calls python

What it does

Algo Sc Newsvendor is an agent skill from asgard-ai-platform/skills. 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'.

Its SKILL.md is about 1.1k tokens, which your agent loads only when the skill is triggered. The skill folder holds 7 other files, including scripts and reference files (for example `examples/sample_input.json`, `references/constrained-newsvendor.md` and `references/demand-fitting.md`).

The repository describes itself as: 301 open-source coding agent skills across 22 domains — methodology, judgment & gotchas packaged as Claude Agent Skills for the Asgard AI Platform. The licence is MIT.

When your agent uses it

  • The user needs to determine optimal order quantity for perishable goods
  • Seasonal products
  • One-time purchase decisions — even if they say how much to order for this season
  • Perishable inventory

Example prompts

  • “how much to order for this season”
  • “perishable inventory”
  • “single-period ordering”
  • “/algo-sc-newsvendor”

Requirements

  • Python 3

Workflow steps

4 steps, taken from the step headings in SKILL.md.

  1. Input Validation
  2. Core Algorithm
  3. Verification
  4. Output

What it can do on your machine

Read from SKILL.md and the folder at commit 4e7f4f8. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Ships 1 file in scripts/ (Python), which the agent can run.

    Shell commands in SKILL.md call:

    • python

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Algo Sc Newsvendor loads about 1.1k tokens when it runs, and up to ~6.1k if it reads all its reference files. Until then it costs about 90 tokens; SKILL.md has 434 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~90
When it runs · the whole SKILL.md, loaded when a task matches
~1.1k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~6.1k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); the scripts in this folder are not scanned.

SKILL.md

The full file from asgard-ai-platform/skills at commit 4e7f4f8, republished under its MIT licence (© asgard-ai-platform). 434 words, ~1,099 tokens.

Download SKILL.mdSave it as .claude/skills/algo-sc-newsvendor/SKILL.md (or your agent's skills folder). This skill also uses 4 other files; get the full folder from GitHub.
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'.
metadata.category
WP-41 供應鏈演算法
metadata.tags
supply-chain, newsvendor, inventory, demand-uncertainty

Newsvendor Model

Overview

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.

When to Use

Trigger conditions:

  • One-time or seasonal purchasing decisions (fashion, holiday goods, event tickets)
  • Perishable products with no restocking opportunity
  • Setting initial stocking levels before demand is observed

When NOT to use:

  • For continuous replenishment with stable demand (use EOQ)
  • When backorders are acceptable and demand carries over (multi-period models)

Algorithm

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.
Phase 1: Input Validation

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.

Phase 2: Core Algorithm
  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
Phase 3: Verification

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.

Phase 4: Output

Return optimal order quantity with profit analysis.

Output Format

json
{
  "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}
}

Examples

Sample I/O

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.

Show full SKILL.md (187 more words)Show less
Edge Cases
InputExpectedWhy
v = 0 (total loss)Lower Q*, conservativeHigh overage cost pushes order down
p >> c (high margin)Q* well above meanWorth risking excess to avoid lost sales
σ = 0 (certain demand)Q* = μ exactlyNo uncertainty, order exactly demand

Gotchas

  • Distribution choice matters: Normal allows negative demand. For low-mean items, use Poisson or truncated normal. For high CV, use lognormal.
  • Demand estimation: The hardest part is estimating μ and σ. Use historical data, expert judgment, or Bayesian updating from early sales signals.
  • Risk aversion: The newsvendor model is risk-neutral. Risk-averse decision makers systematically under-order relative to Q*. Adjust for behavioral bias.
  • Multi-product constraints: With a shared budget constraint across products, solve the constrained newsvendor (Lagrangian relaxation).
  • Salvage value assumption: Assumes all excess can be salvaged at v. If disposal has a cost (v < 0), the model still works but Q* drops further.

Scripts

ScriptDescriptionUsage
scripts/newsvendor.pyCompute newsvendor optimal quantity, expected profit, and fill ratepython scripts/newsvendor.py --help

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

References

  • For multi-product constrained newsvendor, see references/constrained-newsvendor.md
  • For demand distribution fitting, see references/demand-fitting.md

© asgard-ai-platform, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 4 other files (scripts, references) in algo-sc-newsvendor of asgard-ai-platform/skills.

  • SKILL.md
  • examples/sample_input.json
  • references/constrained-newsvendor.md
  • references/demand-fitting.md
  • scripts/newsvendor.py

Open the folder on GitHubat commit 4e7f4f8

Compare with similar skills

Algo Sc Newsvendor next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Algo Sc Newsvendor compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Algo Sc Newsvendor this skillasgard-ai-platform/skills242—~1.1kAutomated safety check: PassMIT
Vc Problem Solvingwithkynam/vibecode-pro-max-kit1.1k1 repos~1.1kAutomated safety check: PassMIT
Is This A Problemanthropics/claude-for-legal9.6k2 repos~2.3kAutomated safety check: PassApache-2.0
CSS Orderthedaviddias/Front-End-Checklist74k—~404Automated safety check: PassMIT
Focus Orderthedaviddias/Front-End-Checklist74k—~519Automated safety check: PassMIT
Heading Orderthedaviddias/Front-End-Checklist74k—~452Automated safety check: PassMIT

Similar skills

  • Vc Problem Solving

    withkynam/vibecode-pro-max-kit

    Apply systematic problem-solving techniques when stuck. An agent skill from withkynam/vibecode-pro-max-kit.

    1.1k GitHub starsUsed in 1 repo~1.1k tokens
    Auto-check passed
  • Is This A Problem

    anthropics/claude-for-legal

    Official

    Fast "is this a problem?" answer for the quick Slack question — pattern-matches against your calibration.

    9.6k GitHub starsUsed in 2 repos~2.3k tokens
    Business, Finance & HRAuto-check passed
  • CSS Order

    thedaviddias/Front-End-Checklist

    A skill your agent uses when reviewing stylesheets, component styles, and responsive behavior related to Order CSS files correctly.

    74k GitHub stars~404 tokensUpdated 4 days ago
    Frontend & DesignAuto-check passed
  • Focus Order

    thedaviddias/Front-End-Checklist

    A skill your agent uses when reviewing rendered HTML, interactive components, or design-system patterns related to Ensure logical focus order.

    74k GitHub stars~519 tokensUpdated 4 days ago
    Frontend & DesignAuto-check passed
  • Heading Order

    thedaviddias/Front-End-Checklist

    A skill your agent uses when reviewing rendered HTML, interactive components, or design-system patterns related to Maintain logical heading order.

    74k GitHub stars~452 tokensUpdated 4 days ago
    Frontend & DesignAuto-check passed
  • Food Ordering

    asgeirtj/system_prompts_leaks

    Prepare restaurant food orders for delivery or pickup; use for cart, checkout and tracking.

    69k GitHub stars~1.4k tokensUpdated yesterday
    Auto-check passed

More from asgard-ai-platform/skills

All 207 skills in this repo
  • Algo Ecom Bm25

    asgard-ai-platform/skills

    Implement BM25 ranking function for e-commerce product search relevance scoring.

    242 GitHub stars~1.4k tokensUpdated 4 mo ago
    Auto-check passed
  • Algo Mfg Cpk

    asgard-ai-platform/skills

    Calculate Cpk process capability index to assess whether a process meets specification requirements.

    242 GitHub stars~1.1k tokensUpdated 4 mo ago
    Auto-check passed
  • Algo Price Elasticity

    asgard-ai-platform/skills

    Calculate price elasticity of demand to quantify how price changes affect sales volume.

    242 GitHub stars~1.1k tokensUpdated 4 mo ago
    Auto-check passed
  • Algo Rank Bayesian

    asgard-ai-platform/skills

    Apply Bayesian averaging to rank items by combining observed ratings with prior expectations.

    242 GitHub stars~1.1k tokensUpdated 4 mo ago
    Auto-check passed
  • Algo Rank Elo

    asgard-ai-platform/skills

    Implement Elo rating system to rank items or players from pairwise comparison outcomes.

    242 GitHub stars~1.1k tokensUpdated 4 mo ago
    Auto-check passed
  • Algo Rank Wilson

    asgard-ai-platform/skills

    Calculate Wilson Score confidence intervals for ranking items by positive proportion with sample size correction.

    242 GitHub stars~1.1k tokensUpdated 4 mo ago
    Auto-check passed

Questions about Algo Sc Newsvendor

What does Algo Sc Newsvendor do?

Solve the newsvendor problem for single-period ordering decisions under uncertain demand. Algo Sc Newsvendor is an agent skill from asgard-ai-platform/skills. Solve the newsvendor problem for single-period ordering decisions under uncertain demand.

When should I use Algo Sc Newsvendor?

Algo Sc Newsvendor fits situations like: the user needs to determine optimal order quantity for perishable goods; seasonal products; one-time purchase decisions — even if they say how much to order for this season; perishable inventory.

How do I install Algo Sc Newsvendor in Claude Code?

Run `npx skills add asgard-ai-platform/skills --skill algo-sc-newsvendor -a claude-code`. Or copy the skill folder (algo-sc-newsvendor in asgard-ai-platform/skills) into .claude/skills/algo-sc-newsvendor in your project. Claude Code loads it when a task matches its description.

How do I install Algo Sc Newsvendor in Codex?

Run `npx skills add asgard-ai-platform/skills --skill algo-sc-newsvendor -a codex`. Or copy the skill folder (algo-sc-newsvendor in asgard-ai-platform/skills) into .agents/skills/algo-sc-newsvendor in your project. Codex loads it when a task matches its description.

Can I use Algo Sc Newsvendor in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add asgard-ai-platform/skills --skill algo-sc-newsvendor -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/algo-sc-newsvendor, .gemini/skills/algo-sc-newsvendor, .github/skills/algo-sc-newsvendor and .opencode/skills/algo-sc-newsvendor in your project.

What does Algo Sc Newsvendor need to run?

Going by SKILL.md and its folder, Algo Sc Newsvendor needs Python for the scripts in its folder and the command-line tools its instructions call (python). Our summary lists: Python 3.

Does Algo Sc Newsvendor access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Algo Sc Newsvendor safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. The check reads SKILL.md only: the scripts in the folder are not scanned, so read them before running anything.

What licence does Algo Sc Newsvendor use?

Algo Sc Newsvendor is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Algo Sc Newsvendor use?

About 1.1k tokens (SKILL.md is roughly 4.4k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 5k tokens, read only when the agent opens those files.

What are the alternatives to Algo Sc Newsvendor?

Skills that share tags, products or a category with Algo Sc Newsvendor: Vc Problem Solving (withkynam/vibecode-pro-max-kit, 1.1k stars), Is This A Problem (anthropics/claude-for-legal, 9.6k stars), CSS Order (thedaviddias/Front-End-Checklist, 74k stars) and Focus Order (thedaviddias/Front-End-Checklist, 74k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Algo Sc Newsvendor?

asgard-ai-platform (a GitHub organization) maintains it in asgard-ai-platform/skills, which has 242 GitHub stars. The repository holds 207 skills in this directory. The repository was last updated on June 6, 2026.

Source: asgard-ai-platform/skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.