用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/a5c-ai/babysitter --skill inventory-optimizer命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
Reference for querying the Atlas knowledge graph through its MCP tools — the SECONDARY enrichment/comparison layer that adds best-practice context to systems you have ALREADY scanned from your real sources (`az`, repos, dirs). Use when you need to look up nodes, edges, kinds, clusters, stats, or wiki pages in Atlas to compare against your real inventory. (atlas graph, query atlas, atlas mcp, search the graph, graph neighbors, atlas record, atlas kinds, enrichment layer)
Atlas turns your STATED NEED into a real systems atlas by SCANNING your actual sources (Azure via `az`, git repos, local dirs) and process/data mining them, THEN enriching against the Atlas knowledge graph. Use this skill when asked to inventory/map your real systems, scan your cloud + repos + directories, mine the real processes or data they contain, or collect their real constraints/gotchas. (atlas, scan my systems, inventory our azure account, map my repos, real systems atlas, process mining, data mining, collect nuances, system discovery)
This skill should be used when the user asks to "find skills in the wild", "assimilate popular workflows", "discover SKILL.md files in repos", "research external skills", "find workflow patterns", "survey the skill landscape", "what skills exist out there", or wants to investigate public repositories for extractable processes, babysitter plugins, and reusable procedural insights. Searches GitHub for SKILL.md files, classifies repos by archetype, and maintains structured research under docs/reference-repos/.
正在显示 SKILL.md
基于 SOC 职业分类
| name | inventory-optimizer |
| description | Inventory optimization skill for safety stock, reorder point, and order quantity calculations. |
| allowed-tools | Bash(*) Read Write Edit Glob Grep WebFetch |
| metadata | {"author":"babysitter-sdk","version":"1.0.0","category":"supply-chain","backlog-id":"SK-IE-025"} |
| graph | {"domains":["domain:industrial-engineering"],"skillAreas":["skill-area:statistical-analysis","skill-area:organizational-design","skill-area:data-analysis"],"roles":["role:operations-analyst","role:research-engineer"]} |
You are inventory-optimizer - a specialized skill for optimizing inventory policies including safety stock, reorder points, and order quantities.
This skill enables AI-powered inventory optimization including:
import numpy as np
import pandas as pd
def abc_analysis(items: pd.DataFrame, value_column: str, quantity_column: str):
"""
ABC classification based on annual value (Pareto analysis)
A: Top 80% of value (typically 20% of items)
B: Next 15% of value (typically 30% of items)
C: Remaining 5% of value (typically 50% of items)
"""
# Calculate annual value
items = items.copy()
items['annual_value'] = items[value_column] * items[quantity_column]
items = items.sort_values('annual_value', ascending=False)
# Calculate cumulative percentage
total_value = items['annual_value'].sum()
items['cum_value'] = items['annual_value'].cumsum()
items['cum_pct'] = items['cum_value'] / total_value * 100
# Assign ABC class
def assign_class(pct):
if pct <= 80:
return 'A'
elif pct <= 95:
return 'B'
else:
return 'C'
items['ABC_class'] = items['cum_pct'].apply(assign_class)
return items
def xyz_analysis(items: pd.DataFrame, demand_history_columns: list):
items = items.copy()
demand_data = items[demand_history_columns]
items[] = demand_data.mean(axis=)
items[] = demand_data.std(axis=)
items[] = items[] / items[]
():
cv < :
cv < :
:
items[] = items[].apply(assign_xyz)
items
():
matrix = items.groupby([, ]).size().unstack(fill_value=)
recommendations = {
: ,
: ,
: ,
: ,
: ,
: ,
: ,
: ,
:
}
{
: matrix,
: recommendations
}
def economic_order_quantity(annual_demand: float, ordering_cost: float,
holding_cost_per_unit: float):
"""
Classic EOQ calculation
EOQ = sqrt(2 * D * S / H)
D: Annual demand
S: Ordering cost per order
H: Holding cost per unit per year
"""
eoq = np.sqrt((2 * annual_demand * ordering_cost) / holding_cost_per_unit)
# Calculate associated costs
orders_per_year = annual_demand / eoq
annual_ordering_cost = orders_per_year * ordering_cost
average_inventory = eoq / 2
annual_holding_cost = average_inventory * holding_cost_per_unit
total_cost = annual_ordering_cost + annual_holding_cost
return {
"EOQ": round(eoq, 0),
"orders_per_year": round(orders_per_year, 1),
"order_interval_days": round(365 / orders_per_year, 1),
"annual_ordering_cost": round(annual_ordering_cost, 2),
"annual_holding_cost": round(annual_holding_cost, 2),
"total_relevant_cost": round(total_cost, 2),
"average_inventory": round(average_inventory, 0)
}
def eoq_with_quantity_discounts(annual_demand: float, ordering_cost: float,
holding_rate: float, price_breaks: list):
"""
EOQ with quantity discounts
price_breaks: [(min_qty, unit_price), ...]
"""
results = []
min_qty, unit_price (price_breaks, key= x: x[], reverse=):
holding_cost = unit_price * holding_rate
eoq = np.sqrt(( * annual_demand * ordering_cost) / holding_cost)
eoq < min_qty:
order_qty = min_qty
:
order_qty = eoq
orders_per_year = annual_demand / order_qty
annual_ordering = orders_per_year * ordering_cost
annual_holding = (order_qty / ) * holding_cost
annual_purchase = annual_demand * unit_price
total_cost = annual_ordering + annual_holding + annual_purchase
results.append({
: min_qty,
: unit_price,
: (eoq, ),
: (order_qty, ),
: (total_cost, )
})
optimal = (results, key= x: x[])
{
: results,
: optimal
}
from scipy import stats
def safety_stock_service_level(demand_std: float, lead_time_mean: float,
lead_time_std: float = 0, service_level: float = 0.95):
"""
Calculate safety stock for desired service level
Accounts for variability in both demand and lead time
"""
# Z-score for service level
z = stats.norm.ppf(service_level)
if lead_time_std > 0:
# Combined variability
# SS = z * sqrt(LT * sigma_d^2 + d_avg^2 * sigma_LT^2)
# Simplified: SS = z * sigma_d * sqrt(LT)
combined_std = np.sqrt(lead_time_mean * demand_std**2)
safety_stock = z * combined_std
else:
# Only demand variability
safety_stock = z * demand_std * np.sqrt(lead_time_mean)
return {
"safety_stock": round(safety_stock, 0),
"service_level": service_level,
"z_score": round(z, 2),
"demand_std": demand_std,
"lead_time": lead_time_mean
}
def safety_stock_fill_rate(demand_mean: float, demand_std: float,
order_quantity: float, target_fill_rate: float = 0.98):
"""
Calculate safety stock for target fill rate
Fill rate: proportion of demand satisfied from stock
"""
target_shortage = ( - target_fill_rate) * order_quantity
ss (, (demand_std * ), ):
z = ss / demand_std
loss = demand_std * (stats.norm.pdf(z) - z * ( - stats.norm.cdf(z)))
loss <= target_shortage:
{
: ss,
: target_fill_rate,
: - loss / order_quantity
}
{: (demand_std * ), : }
def calculate_reorder_point(average_demand_per_period: float,
lead_time_periods: float,
safety_stock: float):
"""
Calculate reorder point (r)
r = d * L + SS
d: Average demand per period
L: Lead time in periods
SS: Safety stock
"""
lead_time_demand = average_demand_per_period * lead_time_periods
reorder_point = lead_time_demand + safety_stock
return {
"reorder_point": round(reorder_point, 0),
"lead_time_demand": round(lead_time_demand, 0),
"safety_stock": round(safety_stock, 0),
"interpretation": f"Order when inventory reaches {round(reorder_point, 0)} units"
}
def optimize_rQ_policy(annual_demand: float, demand_std_per_period: float,
lead_time_periods: float, ordering_cost: float,
holding_cost_per_unit: float, service_level: float = 0.95):
"""
Optimize continuous review policy
r: Reorder point
Q: Order quantity (EOQ)
"""
# Calculate Q using EOQ
eoq_result = economic_order_quantity(annual_demand, ordering_cost, holding_cost_per_unit)
Q = eoq_result['EOQ']
# Calculate safety stock for service level
ss_result = safety_stock_service_level(
demand_std=demand_std_per_period,
lead_time_mean=lead_time_periods,
service_level=service_level
)
SS = ss_result['safety_stock']
# Calculate reorder point
periods_per_year = 12 # Assuming monthly
avg_demand_per_period = annual_demand / periods_per_year
r = avg_demand_per_period * lead_time_periods + SS
return {
"policy": "(r, Q)",
"reorder_point": round(r, 0),
"order_quantity": round(Q, 0),
"safety_stock": round(SS, 0),
"service_level": service_level,
"average_inventory": round(Q/2 + SS, 0),
"annual_cost": eoq_result['total_relevant_cost']
}
def optimize_RS_policy(annual_demand: float, demand_std_per_period: float,
review_period_periods: float, lead_time_periods: float,
holding_cost_per_unit: float, service_level: float = 0.95):
"""
Optimize periodic review policy
R: Review period
S: Order-up-to level
"""
z = stats.norm.ppf(service_level)
# Protection period = review period + lead time
protection_period = review_period_periods + lead_time_periods
# Average demand during protection period
periods_per_year = 12
avg_demand_per_period = annual_demand / periods_per_year
avg_demand_protection = avg_demand_per_period * protection_period
# Standard deviation during protection period
std_protection = demand_std_per_period * np.sqrt(protection_period)
# Safety stock
SS = z * std_protection
# Order-up-to level
S = avg_demand_protection + SS
# Average inventory (approximation)
avg_order_qty = avg_demand_per_period * review_period_periods
avg_inventory = avg_order_qty / 2 + SS
return {
"policy": "(R, S)",
"review_period": review_period_periods,
"order_up_to_level": round(S, 0),
"safety_stock": round(SS, 0),
"service_level": service_level,
"average_inventory": round(avg_inventory, 0),
"annual_holding_cost": round(avg_inventory * holding_cost_per_unit, 2)
}
This skill integrates with the following processes:
inventory-optimization-analysis.jsdemand-forecasting-model-development.jswarehouse-layout-slotting-optimization.js{
"item": "SKU-12345",
"abc_class": "A",
"xyz_class": "X",
"policy": "(r, Q)",
"reorder_point": 450,
"order_quantity": 200,
"safety_stock": 85,
"service_level": 0.95,
"average_inventory": 185,
"annual_cost": 5420.50,
"recommendations": [
"Consider vendor-managed inventory given high volume"
]
}