用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/a5c-ai/babysitter --skill operational-dashboard-generator命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
正在显示 SKILL.md
基于 SOC 职业分类
| name | operational-dashboard-generator |
| description | Operational dashboard generation skill for KPI visualization and real-time monitoring. |
| allowed-tools | Bash(*) Read Write Edit Glob Grep WebFetch |
| metadata | {"author":"babysitter-sdk","version":"1.0.0","category":"continuous-improvement","backlog-id":"SK-IE-037"} |
| 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 operational-dashboard-generator - a specialized skill for generating operational dashboards with KPI visualization and real-time monitoring capabilities.
This skill enables AI-powered dashboard generation including:
import pandas as pd
import numpy as np
from dataclasses import dataclass
from typing import List, Dict, Optional
from enum import Enum
class KPICategory(Enum):
SAFETY = "safety"
QUALITY = "quality"
DELIVERY = "delivery"
COST = "cost"
PRODUCTIVITY = "productivity"
MORALE = "morale"
@dataclass
class KPIDefinition:
id: str
name: str
category: KPICategory
formula: str
unit: str
target: float
warning_threshold: float
critical_threshold: float
higher_is_better: bool = True
frequency: str = "daily"
def create_kpi_library():
"""Standard industrial KPI definitions"""
return [
KPIDefinition(
id="oee", name="OEE", category=KPICategory.PRODUCTIVITY,
formula="availability * performance * quality",
unit="%", target=85, warning_threshold=75, critical_threshold=65
),
KPIDefinition(
id="fpy", name="First Pass Yield", category=KPICategory.QUALITY,
formula="good_units / total_units * 100",
unit="%", target=98, warning_threshold=95, critical_threshold=90
),
KPIDefinition(
id="otd", name="On-Time Delivery", category=KPICategory.DELIVERY,
formula="on_time_orders / total_orders * 100",
unit="%", target=98, warning_threshold=95, critical_threshold=90
),
KPIDefinition(
id="trir", name="Total Recordable Incident Rate", category=KPICategory.SAFETY,
formula="incidents * 200000 / hours_worked",
unit="per 200k hrs", target=0.5, warning_threshold=1.0, critical_threshold=2.0,
higher_is_better=False
),
KPIDefinition(
id="productivity", name="Labor Productivity", category=KPICategory.PRODUCTIVITY,
formula="units_produced / labor_hours",
unit="units/hr", target=25, warning_threshold=20, critical_threshold=15
),
KPIDefinition(
id="scrap_rate", name="Scrap Rate", category=KPICategory.COST,
formula="scrap_cost / production_cost * 100",
unit="%", target=1.0, warning_threshold=2.0, critical_threshold=3.0,
higher_is_better=False
)
]
def calculate_kpi(kpi: KPIDefinition, data: dict):
"""Calculate KPI value from data"""
# Simple formula evaluation (in production, use safe eval)
try:
value = eval(kpi.formula, {"__builtins__": {}}, data)
# Determine status
if kpi.higher_is_better:
if value >= kpi.target:
status = "green"
elif value >= kpi.warning_threshold:
status = "yellow"
else:
status = "red"
else:
if value <= kpi.target:
status = "green"
elif value <= kpi.warning_threshold:
status = "yellow"
else:
status = "red"
return {
"kpi_id": kpi.id,
"name": kpi.name,
"value": round(value, 2),
"unit": kpi.unit,
"target": kpi.target,
"status": status,
"gap_to_target": round(value - kpi.target, 2)
}
except Exception as e:
return {"kpi_id": kpi.id, "error": str(e)}
def generate_dashboard_layout(kpis: List[KPIDefinition], layout_type: str = "standard"):
"""
Generate dashboard layout configuration
layout_type: 'standard', 'executive', 'operational', 'lean'
"""
if layout_type == "standard":
layout = {
"type": "grid",
"columns": 4,
"rows": 3,
"sections": [
{
"id": "header",
"row": 1, "col_span": 4,
"content": "title_and_period_selector"
},
{
"id": "summary_cards",
"row": 2, "col_span": 4,
"content": "kpi_summary_cards",
"kpis": [k.id for k in kpis[:6]]
},
{
"id": "trends",
"row": 3, "col": 1, "col_span": 2,
"content": "trend_charts"
},
{
: ,
: , : , : ,
:
}
]
}
layout_type == :
layout = {
: ,
: [
{: , : , : },
{: , : , : },
{: , : , : }
]
}
layout_type == :
layout = {
: ,
: ,
: [
{: , : , : },
{: , : , : },
{: , : , : },
{: , : , : }
],
: [, , ]
}
layout
():
{
: ,
: kpi.,
: kpi.name,
: {
: ,
: ,
: ,
:
},
: {
: kpi.target,
: kpi.warning_threshold,
: kpi.critical_threshold
},
: kpi. [, , ]
}
def analyze_kpi_trends(historical_data: pd.DataFrame, kpi_id: str,
periods: int = 30):
"""
Analyze trends for a KPI
historical_data: DataFrame with ['date', 'kpi_id', 'value']
"""
kpi_data = historical_data[historical_data['kpi_id'] == kpi_id].copy()
kpi_data = kpi_data.sort_values('date').tail(periods)
if len(kpi_data) < 2:
return {"error": "Insufficient data for trend analysis"}
values = kpi_data['value'].values
dates = kpi_data['date'].values
# Calculate statistics
current = values[-1]
previous = values[-2]
change = current - previous
change_pct = (change / previous * 100) if previous != 0 else 0
# Moving averages
ma_7 = np.mean(values[-7:]) if len(values) >= 7 else np.mean(values)
ma_30 = np.mean(values[-30:]) if len(values) >= 30 else np.mean(values)
# Trend direction (linear regression)
x = np.arange(len(values))
slope, intercept = np.polyfit(x, values, 1)
if slope > 0.01:
trend_direction = "improving"
elif slope < -0.01:
trend_direction =
:
trend_direction =
std_dev = np.std(values)
cv = (std_dev / np.mean(values) * ) np.mean(values) !=
{
: kpi_id,
: (current, ),
: (previous, ),
: (change, ),
: (change_pct, ),
: trend_direction,
: (slope, ),
: (ma_7, ),
: (ma_30, ),
: (std_dev, ),
: (cv, ),
: values.tolist()
}
def configure_alerts(kpis: List[KPIDefinition], notification_config: dict):
"""
Configure alert rules for dashboard
notification_config: {'email': [], 'sms': [], 'teams': []}
"""
alerts = []
for kpi in kpis:
# Warning alert
alerts.append({
"alert_id": f"{kpi.id}_warning",
"kpi_id": kpi.id,
"level": "warning",
"condition": f"value {'<' if kpi.higher_is_better else '>'} {kpi.warning_threshold}",
"message": f"{kpi.name} has reached warning level",
"notifications": notification_config.get('email', []),
"frequency": "first_occurrence"
})
# Critical alert
alerts.append({
"alert_id": f"{kpi.id}_critical",
"kpi_id": kpi.id,
"level": "critical",
"condition": f"value {'<' if kpi.higher_is_better else '>'} {kpi.critical_threshold}",
: ,
: notification_config.get(, []) + notification_config.get(, []),
: ,
:
})
alerts.append({
: ,
: kpi.,
: ,
: ,
: ,
: notification_config.get(, []),
:
})
{
: alerts,
: (alerts),
: (notification_config.keys())
}
def configure_drilldowns(kpi: KPIDefinition, dimensions: list):
"""
Configure drill-down paths for a KPI
dimensions: ['shift', 'line', 'product', 'operator']
"""
drilldowns = []
for i, dim in enumerate(dimensions):
drilldowns.append({
"level": i + 1,
"dimension": dim,
"aggregation": "sum" if "count" in kpi.formula else "avg",
"chart_type": "bar" if i < 2 else "table",
"filter_enabled": True
})
# Add time-based drilldown
drilldowns.append({
"level": len(dimensions) + 1,
"dimension": "time",
"granularity": ["month", "week", "day", "shift", "hour"],
"chart_type": "line",
"default_granularity": "day"
})
return {
"kpi_id": kpi.id,
"drilldown_path": drilldowns,
"max_levels": len(drilldowns)
}
def export_dashboard_config(layout: dict, kpis: List[dict],
alerts: List[dict], drilldowns: List[dict]):
"""
Export complete dashboard configuration
"""
config = {
"dashboard": {
"name": "Operations Dashboard",
"version": "1.0",
"refresh_rate_seconds": 300,
"timezone": "local"
},
"layout": layout,
"kpis": kpis,
"widgets": [],
"alerts": alerts,
"drilldowns": drilldowns,
"data_sources": [
{
"id": "production_db",
"type": "database",
"refresh": "5min"
},
{
"id": "mes_api",
"type": "api",
"refresh": "realtime"
}
],
"filters": [
{"id": "date_range", "type": "date_range", "default": "last_30_days"},
{"id": "shift", : , : [, , ]},
{: , : , : }
]
}
kpi kpis:
config[].append({
: ,
: ,
: kpi[],
:
})
config
This skill integrates with the following processes:
performance-monitoring-setup.jsvisual-management-implementation.jscontinuous-improvement-program.js{
"dashboard_config": {
"name": "Operations Dashboard",
"layout": "standard",
"refresh_rate": 300
},
"kpis": [
{
"id": "oee",
"name": "OEE",
"current_value": 82.5,
"target": 85,
"status": "yellow",
"trend": "improving"
}
],
"alerts": {
"active": 2,
"critical": 0,