Agent skill

Algo Sc Safety Stock

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

Calculate safety stock levels to buffer against demand and lead time uncertainty.

MITAuto-check passed

Install Algo Sc Safety Stock

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

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

GitHub CLI
$ gh skill install asgard-ai-platform/skills algo-sc-safety-stock --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-safety-stock .claude/skills/algo-sc-safety-stock && 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-safety-stock
GitHub stars
242
Token cost
~1.1k tokens
SKILL.md length
449 words
Files
5 (incl. scripts, references)
Skills in repo
207
Repo updated
First seen
Licence
MIT

At a glance

Calculate safety stock levels to buffer against demand and lead time uncertainty.

  • Works in 4 steps: Input Validation → Core Algorithm → Verification → …
  • The user needs to set inventory buffers
  • 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 Safety Stock is an agent skill from asgard-ai-platform/skills. Calculate safety stock levels to buffer against demand and lead time uncertainty. Use this skill when the user needs to set inventory buffers, determine service level trade-offs, or optimize safety stock across SKUs — even if they say 'how much buffer inventory', 'stockout prevention', or 'service level calculation'.

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/intermittent-demand.md` and `references/multi-echelon.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 set inventory buffers
  • Determine service level trade-offs
  • Optimize safety stock across SKUs — even if they say how much buffer inventory
  • Stockout prevention

Example prompts

  • “how much buffer inventory”
  • “stockout prevention”
  • “service level calculation”
  • “/algo-sc-safety-stock”

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 Safety Stock loads about 1.1k tokens when it runs, and up to ~6.8k if it reads all its reference files. Until then it costs about 85 tokens; SKILL.md has 449 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~85
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.8k

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). 449 words, ~1,135 tokens.

Download SKILL.mdSave it as .claude/skills/algo-sc-safety-stock/SKILL.md (or your agent's skills folder). This skill also uses 4 other files; get the full folder from GitHub.
name
algo-sc-safety-stock
description
Calculate safety stock levels to buffer against demand and lead time uncertainty. Use this skill when the user needs to set inventory buffers, determine service level trade-offs, or optimize safety stock across SKUs — even if they say 'how much buffer inventory', 'stockout prevention', or 'service level calculation'.
metadata.category
WP-41 供應鏈演算法
metadata.tags
supply-chain, safety-stock, inventory, service-level

Safety Stock Calculation

Overview

Safety stock is buffer inventory held to protect against demand and lead time variability. Formula: SS = z × √(LT × σ²_d + d² × σ²_LT) where z=service factor, LT=lead time, σ_d=demand std dev, d=avg demand, σ_LT=lead time std dev. Directly trades inventory cost against stockout risk.

When to Use

Trigger conditions:

  • Setting inventory buffers for variable-demand items
  • Choosing target service levels and computing required safety stock
  • Optimizing safety stock across a portfolio of SKUs

When NOT to use:

  • When demand is deterministic (use EOQ without safety stock)
  • For one-time purchase decisions (use newsvendor model)

Algorithm

IRON LAW: Safety Stock Is a TRADE-OFF, Not a Target
More safety stock = fewer stockouts but higher holding cost.
The relationship is non-linear: going from 95% to 99% service level
roughly DOUBLES safety stock. Going from 99% to 99.9% doubles it
again. Always quantify the cost of each service level increment.
z-values: 90%→1.28, 95%→1.65, 99%→2.33, 99.9%→3.09.
Phase 1: Input Validation

Collect: historical demand data (weekly/monthly), lead time data (average and variability), target service level, unit cost and holding rate. Gate: Minimum 12 periods of demand data, lead time estimates available.

Phase 2: Core Algorithm
  1. Compute demand statistics: average demand (d), demand standard deviation (σ_d)
  2. Compute lead time statistics: average LT, LT standard deviation (σ_LT)
  3. Compute combined variability: σ_combined = √(LT × σ²_d + d² × σ²_LT)
  4. Look up z for target service level
  5. Safety stock = z × σ_combined
  6. Reorder point = d × LT + SS
Phase 3: Verification

Simulate: using historical demand, would the computed SS have prevented stockouts at the target service level? Gate: Simulated service level matches target (±2%).

Phase 4: Output

Return safety stock with cost impact and service level analysis.

Output Format

json
{
  "safety_stock": 250,
  "reorder_point": 850,
  "service_level": 0.95,
  "annual_holding_cost": 5000,
  "metadata": {"avg_demand_weekly": 120, "demand_cv": 0.3, "avg_lead_time_weeks": 5}
}

Examples

Sample I/O

Input: Weekly demand: avg=100, σ=30. Lead time: avg=4 weeks, σ=1 week. Target: 95%. Expected: σ_combined = √(4×900 + 10000×1) = √(3600+10000) = √13600 = 116.6. SS = 1.65 × 116.6 = 192 units.

Show full SKILL.md (197 more words)Show less
Edge Cases
InputExpectedWhy
Zero demand variabilitySS from LT variability onlyσ_d = 0, only lead time risk remains
Zero lead time variabilitySS from demand variability onlyσ_LT = 0, standard formula simplifies
Very long lead timeHigh SSMore uncertainty accumulates over longer periods

Gotchas

  • Normal distribution assumption: Formula assumes normally distributed demand. Highly intermittent demand (many zeros) needs different approaches (Poisson, negative binomial).
  • Demand forecast error, not demand variability: If you use a forecast, SS should buffer forecast ERROR (σ_error), not raw demand variability.
  • Service level definition: Cycle service level (probability of no stockout per cycle) ≠ fill rate (fraction of demand met from stock). Companies often mean fill rate but calculate cycle SL.
  • Lead time data quality: Lead time variability is often poorly tracked. Underestimating σ_LT leads to insufficient safety stock.
  • ABC segmentation: Don't apply the same service level to all SKUs. A-items (high revenue) deserve 99%; C-items may be fine at 90%.

Scripts

ScriptDescriptionUsage
scripts/safety_stock.pyCompute safety stock and reorder point with combined demand/lead-time variabilitypython scripts/safety_stock.py --help

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

References

  • For multi-echelon safety stock optimization, see references/multi-echelon.md
  • For intermittent demand methods, see references/intermittent-demand.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-safety-stock of asgard-ai-platform/skills.

  • SKILL.md
  • examples/sample_input.json
  • references/intermittent-demand.md
  • references/multi-echelon.md
  • scripts/safety_stock.py

Open the folder on GitHubat commit 4e7f4f8

Compare with similar skills

Algo Sc Safety Stock 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 Safety Stock compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Algo Sc Safety Stock this skillasgard-ai-platform/skills242—~1.1kAutomated safety check: PassMIT
Safety Stock Reviewdavila7/claude-code-templates33k—~869Automated safety check: PassMIT
Buffer Calculatoraipoch/medical-research-skills1.9k—~1.8kAutomated safety check: PassMIT
Lead Magnetssickn33/agentic-awesome-skills47k2 repos~2.8kAutomated safety check: PassMIT
Inventory Demand Planningsickn33/agentic-awesome-skills47k8 repos~6.5kAutomated safety check: PassMIT
Lead Magnetscoreyhaines31/marketingskills54k5 repos~2.8kAutomated safety check: PassMIT

Similar skills

  • Safety Stock Review

    davila7/claude-code-templates

    Size or audit safety stock with assumption checks - the zsigmasqrt(LT) formula plus an empirical stress test of what it actually delivers (cycle service vs fill rate) per variability class.

    33k GitHub stars~869 tokensUpdated yesterday
    Testing & QAAuto-check passed
  • Buffer Calculator

    aipoch/medical-research-skills

    Calculate precise buffer recipes with accurate mass and volume measurements for molecular biology and biochemistry.

    1.9k GitHub stars~1.8k tokensUpdated 24 days ago
    Auto-check passed
  • Lead Magnets

    sickn33/agentic-awesome-skills

    Plan and optimize lead magnets for email capture and lead generation.

    47k GitHub starsUsed in 2 repos~2.8k tokens
    Marketing & SEOAuto-check passed
  • Inventory Demand Planning

    sickn33/agentic-awesome-skills

    Codified expertise for demand forecasting, safety stock optimisation, replenishment planning, and promotional lift estimation at multi-location retailers.

    47k GitHub starsUsed in 8 repos~6.5k tokens
    Data & AnalyticsAuto-check passed
  • Lead Magnets

    coreyhaines31/marketingskills

    When the user wants to create, plan, or optimize a lead magnet for email capture or lead generation.

    54k GitHub starsUsed in 5 repos~2.8k tokens
    Marketing & SEOAuto-check passed
  • Apify Lead Generation

    sickn33/agentic-awesome-skills

    Scrape leads from multiple platforms using Apify Actors. An agent skill from sickn33/agentic-awesome-skills.

    47k GitHub starsUsed in 2 repos~1.2k tokens
    Marketing & SEOAuto-check: notes

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 Safety Stock

What does Algo Sc Safety Stock do?

Calculate safety stock levels to buffer against demand and lead time uncertainty. Algo Sc Safety Stock is an agent skill from asgard-ai-platform/skills. Calculate safety stock levels to buffer against demand and lead time uncertainty.

When should I use Algo Sc Safety Stock?

Algo Sc Safety Stock fits situations like: the user needs to set inventory buffers; determine service level trade-offs; optimize safety stock across SKUs — even if they say how much buffer inventory; stockout prevention.

How do I install Algo Sc Safety Stock in Claude Code?

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

How do I install Algo Sc Safety Stock in Codex?

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

Can I use Algo Sc Safety Stock 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-safety-stock -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-safety-stock, .gemini/skills/algo-sc-safety-stock, .github/skills/algo-sc-safety-stock and .opencode/skills/algo-sc-safety-stock in your project.

What does Algo Sc Safety Stock need to run?

Going by SKILL.md and its folder, Algo Sc Safety Stock 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 Safety Stock 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 Safety Stock 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 Safety Stock use?

Algo Sc Safety Stock 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 Safety Stock use?

About 1.1k tokens (SKILL.md is roughly 4.5k 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 5.7k tokens, read only when the agent opens those files.

What are the alternatives to Algo Sc Safety Stock?

Skills that share tags, products or a category with Algo Sc Safety Stock: Safety Stock Review (davila7/claude-code-templates, 33k stars), Buffer Calculator (aipoch/medical-research-skills, 1.9k stars), Lead Magnets (sickn33/agentic-awesome-skills, 47k stars) and Inventory Demand Planning (sickn33/agentic-awesome-skills, 47k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Algo Sc Safety Stock?

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.