用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/a5c-ai/babysitter --skill production-scheduler命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 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 | production-scheduler |
| description | Production scheduling skill with sequencing rules, resource allocation, and schedule optimization. |
| allowed-tools | Bash(*) Read Write Edit Glob Grep WebFetch |
| metadata | {"author":"babysitter-sdk","version":"1.0.0","category":"production-planning","backlog-id":"SK-IE-029"} |
| 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 production-scheduler - a specialized skill for production scheduling including job sequencing, resource allocation, and schedule optimization.
This skill enables AI-powered production scheduling including:
import pandas as pd
import numpy as np
from datetime import datetime, timedelta
def apply_dispatch_rules(jobs: pd.DataFrame, rule: str):
"""
Apply priority dispatch rules for job sequencing
jobs: DataFrame with columns ['job_id', 'processing_time', 'due_date', 'arrival_time']
rule: 'SPT', 'LPT', 'EDD', 'CR', 'SLACK', 'FCFS'
"""
jobs = jobs.copy()
current_time = jobs['arrival_time'].min()
if rule == 'SPT': # Shortest Processing Time
jobs['priority'] = jobs['processing_time']
sequence = jobs.sort_values('priority')
elif rule == 'LPT': # Longest Processing Time
jobs['priority'] = -jobs['processing_time']
sequence = jobs.sort_values('priority')
elif rule == 'EDD': # Earliest Due Date
jobs['priority'] = jobs['due_date']
sequence = jobs.sort_values('priority')
elif rule == 'CR': # Critical Ratio
jobs['time_remaining'] = (jobs['due_date'] - current_time).dt.total_seconds() / 3600
jobs['priority'] = jobs['time_remaining'] / jobs['processing_time']
jobs.loc[jobs['priority'] <= 0, 'priority'] = 0.001 # Urgent jobs first
sequence = jobs.sort_values('priority')
elif rule == 'SLACK': # Minimum Slack
jobs['time_remaining'] = (jobs['due_date'] - current_time).dt.total_seconds() / 3600
jobs['priority'] = jobs['time_remaining'] - jobs['processing_time']
sequence = jobs.sort_values('priority')
elif rule == 'FCFS': # First Come First Served
sequence = jobs.sort_values('arrival_time')
return {
"rule": rule,
"sequence": sequence['job_id'].tolist(),
"jobs": sequence
}
def calculate_schedule_metrics(schedule: pd.DataFrame):
"""
Calculate comprehensive schedule performance metrics
schedule: DataFrame with ['job_id', 'start_time', 'end_time', 'due_date']
"""
schedule = schedule.copy()
# Completion time (flow time)
schedule['completion_time'] = schedule['end_time']
# Lateness (can be positive or negative)
schedule['lateness'] = (schedule['end_time'] - schedule['due_date']).dt.total_seconds() / 3600
# Tardiness (max of lateness and 0)
schedule['tardiness'] = schedule['lateness'].apply(lambda x: max(0, x))
# Earliness
schedule['earliness'] = schedule['lateness'].apply(lambda x: abs(min(0, x)))
# Binary late indicator
schedule['is_late'] = schedule['lateness'] > 0
metrics = {
'makespan': (schedule['end_time'].max() - schedule['start_time'].min()).total_seconds() / 3600,
'mean_flow_time': schedule['completion_time'].mean(),
'total_tardiness': schedule['tardiness'].sum(),
'max_tardiness': schedule['tardiness'].max(),
'number_tardy': schedule[].(),
: ( - schedule[].mean()) * ,
: schedule[].mean(),
: schedule[].()
}
{
: metrics,
: schedule
}
from collections import defaultdict
def job_shop_schedule(jobs: list, machines: list):
"""
Job shop scheduling using dispatching rules
jobs: list of {'job_id': str, 'operations': [(machine, processing_time), ...], 'due_date': datetime}
machines: list of machine IDs
"""
# Initialize machine availability
machine_available = {m: 0 for m in machines}
job_completion = defaultdict(lambda: 0)
schedule = []
# Process jobs operation by operation
for job in jobs:
job_id = job['job_id']
prev_end = 0
for op_idx, (machine, proc_time) in enumerate(job['operations']):
# Start time is max of machine availability and job's previous operation end
start_time = max(machine_available[machine], prev_end)
end_time = start_time + proc_time
schedule.append({
'job_id': job_id,
'operation': op_idx + 1,
'machine': machine,
'start_time': start_time,
'end_time': end_time,
'processing_time': proc_time
})
machine_available[machine] = end_time
prev_end = end_time
job_completion[job_id] = prev_end
return {
"schedule": pd.DataFrame(schedule),
"makespan": max(job_completion.values()),
"machine_utilization": calculate_machine_utilization(schedule, machines)
}
():
makespan = (s[] s schedule)
utilization = {}
machine machines:
machine_ops = [s s schedule s[] == machine]
busy_time = (s[] s machine_ops)
utilization[machine] = busy_time / makespan * makespan >
utilization
def johnson_algorithm(jobs: list):
"""
Johnson's algorithm for 2-machine flow shop
Minimizes makespan
jobs: list of {'job_id': str, 'machine1_time': float, 'machine2_time': float}
"""
# Separate into two sets
set_i = [] # Jobs where machine1_time <= machine2_time
set_ii = [] # Jobs where machine1_time > machine2_time
for job in jobs:
if job['machine1_time'] <= job['machine2_time']:
set_i.append(job)
else:
set_ii.append(job)
# Sort set_i by machine1_time ascending
set_i.sort(key=lambda x: x['machine1_time'])
# Sort set_ii by machine2_time descending
set_ii.sort(key=lambda x: x['machine2_time'], reverse=True)
# Optimal sequence is set_i followed by set_ii
optimal_sequence = set_i + set_ii
# Calculate makespan
m1_end = 0
m2_end = 0
schedule = []
for job in optimal_sequence:
# Machine 1 processing
m1_start = m1_end
m1_end = m1_start + job['machine1_time']
# Machine 2 processing (must wait for both machine 1 and previous job on machine 2)
m2_start = max(m1_end, m2_end)
m2_end = m2_start + job['machine2_time']
schedule.append({
'job_id': job['job_id'],
'machine1_start': m1_start,
'machine1_end': m1_end,
'machine2_start': m2_start,
: m2_end
})
{
: [j[] j optimal_sequence],
: m2_end,
: schedule
}
def resource_constrained_schedule(tasks: list, resources: dict, dependencies: dict):
"""
Schedule tasks with resource constraints and dependencies
tasks: list of {'task_id': str, 'duration': float, 'resources': {resource: amount}}
resources: {resource: available_amount}
dependencies: {task_id: [predecessor_task_ids]}
"""
# Track task status
scheduled = {}
resource_timeline = {r: [] for r in resources}
# Get tasks in topological order
remaining = set(t['task_id'] for t in tasks)
task_dict = {t['task_id']: t for t in tasks}
current_time = 0
max_time = 1000 # Safety limit
while remaining and current_time < max_time:
# Find eligible tasks (all predecessors complete)
eligible = []
for task_id in remaining:
predecessors = dependencies.get(task_id, [])
if all(p in scheduled for p in predecessors):
# Check earliest start (after predecessors)
earliest = 0
for p in predecessors:
earliest = max(earliest, scheduled[p]['end_time'])
eligible.append((task_id, earliest))
# Try to schedule eligible tasks
for task_id, earliest in (eligible, key= x: x[]):
task = task_dict[task_id]
start_time = (earliest, current_time)
can_schedule =
resource, amount task.get(, {}).items():
amount > resources.get(resource, ):
can_schedule =
can_schedule:
end_time = start_time + task[]
scheduled[task_id] = {
: task_id,
: start_time,
: end_time,
: task[]
}
remaining.remove(task_id)
current_time +=
{
: (scheduled.values()),
: (s[] s scheduled.values()) scheduled ,
: (remaining)
}
def generate_gantt_data(schedule: pd.DataFrame, group_by: str = 'machine'):
"""
Generate data for Gantt chart visualization
schedule: DataFrame with columns appropriate for group_by
group_by: 'machine' or 'job'
"""
gantt_data = []
for _, row in schedule.iterrows():
gantt_data.append({
'Task': row[group_by] if group_by in row else row.get('job_id', 'Unknown'),
'Start': row['start_time'],
'Finish': row['end_time'],
'Resource': row.get('job_id', row.get('machine', 'Unknown')),
'Duration': row['end_time'] - row['start_time']
})
return {
"gantt_data": gantt_data,
"timeline_start": min(g['Start'] for g in gantt_data),
"timeline_end": max(g['Finish'] for g in gantt_data),
"resources": list(set(g['Resource'] for g in gantt_data))
}
This skill integrates with the following processes:
production-scheduling-optimization.jscapacity-planning-analysis.js{
"schedule": {
"sequence": ["J1", "J3", "J2", "J4"],
"rule_applied": "EDD"
},
"metrics": {
"makespan": 42,
"mean_flow_time": 24.5,
"total_tardiness": 8,
"percent_on_time": 75
},
"gantt_data": [...],
"recommendations": [
"Consider SPT rule to minimize flow time",
"Job J4 is critical path - prioritize"
]
}