Sleep Schedule Optimizer
Calculates optimal sleep/wake times based on sleep cycles, creates a wind-down routine, tracks sleep patterns in a log, and researches sleep improvement tips via Brave Search. Prerequisites: brave-search MCP, python3.
MCP get_skill({ skillId: "sleep-schedule-optimizer-9e639941" })Use this skill with your agent
Create a free account and connect via MCP
# Sleep Schedule Optimizer
Calculate optimal bed/wake times based on 90-minute sleep cycles, build a wind-down routine, and track your sleep patterns.
## When to Use
- "I need to wake up at 6:30am — when should I go to bed?"
- "Help me fix my sleep schedule"
- "Track my sleep this week"
## Requirements
- **Brave Search MCP** for sleep science research
- **python3** for sleep cycle calculations
## Workflow
### Step 1 — Calculate Optimal Sleep Times
```bash
python3 << 'PYEOF'
from datetime import datetime, timedelta
wake_time = datetime.strptime("{WAKE_TIME}", "%H:%M") # e.g., "06:30"
fall_asleep_delay = 15 # minutes to fall asleep
cycle_length = 90 # minutes per sleep cycle
print(f"Wake time: {wake_time.strftime('%I:%M %p')}")
print(f"\nOptimal bedtimes (accounting for {fall_asleep_delay}min to fall asleep):")
print("="*50)
for cycles in [6, 5, 4]: # 9h, 7.5h, 6h
sleep_duration = timedelta(minutes=cycles * cycle_length)
bedtime = wake_time - sleep_duration - timedelta(minutes=fall_asleep_delay)
hours = (cycles * cycle_length) / 60
quality = "🟢 Optimal" if cycles >= 5 else "🟡 Acceptable" if cycles == 4 else "🔴 Minimum"
print(f" {bedtime.strftime('%I:%M %p')} → {hours:.1f}h sleep ({cycles} cycles) — {quality}")
PYEOF
```
### Step 2 — Research Sleep Improvement
If user has sleep issues:
```
brave_web_search: "how to fall asleep faster science-backed tips {YEAR}"
brave_web_search: "sleep hygiene checklist evidence based"
brave_web_search: "{SLEEP_ISSUE} solutions research" (e.g., insomnia, waking at 3am)
```
### Step 3 — Create Wind-Down Routine
```markdown
# Sleep Schedule
🌅 Wake: {WAKE_TIME} | 🌙 Bed: {BEDTIME} | 😴 Sleep: {HOURS}h ({CYCLES} cycles)
## Wind-Down Routine (start at {BEDTIME - 60min})
| Time | Activity | Why |
|------|----------|-----|
| {T-60} | Put phone in another room | Blue light + stimulation |
| {T-60} | Dim lights to 30% | Triggers melatonin |
| {T-45} | Light stretching or reading | Reduces physical tension |
| {T-30} | Warm shower/bath | Core temp drop aids sleep |
| {T-15} | Journal or breathing exercise | Calms racing thoughts |
| {T-0} | Lights out | Aim to be in bed, eyes closed |
## Environment Checklist
- [ ] Room temp: 65-68°F (18-20°C)
- [ ] Room dark: blackout curtains or eye mask
- [ ] White noise or quiet
- [ ] No screens in bedroom
- [ ] Caffeine cutoff: {2pm for {BEDTIME}}
```
### Step 4 — Sleep Tracking Log
```bash
mkdir -p outputs/health
cat > "outputs/health/sleep-log-{MONTH}.md" << 'EOF'
# Sleep Log — {MONTH} {YEAR}
| Date | Bed Time | Wake Time | Hours | Quality (1-5) | Notes |
|------|----------|-----------|-------|---------------|-------|
| {DATE} | | | | | |
EOF
```
### Step 5 — Weekly Sleep Review
```markdown
## Sleep Review — Week of {DATE}
- Average sleep: {X}h (target: {Y}h)
- Average quality: {X}/5
- Best night: {DATE} ({X}h, quality {Y})
- Worst night: {DATE} ({X}h, quality {Y})
- Bedtime consistency: {consistent/variable}
- Recommendation: {specific improvement}
```
## Important Rules
- Not medical advice — recommend consulting a doctor for chronic insomnia or sleep disorders
- Sleep cycles are approximate (90 min average) — individual variation exists
- Focus on consistency over perfection
## Example Prompts
- "I need to wake at 7am — when should I sleep?"
- "Help me build a bedtime routine"
- "I keep waking up at 3am — what can I do?"Related Skills
More skills in Health & Wellness
Habit Tracker & Streak Builder
Creates a markdown-based habit tracker with daily checkboxes, streak counting, and weekly review prompts. Tracks habits in a file you update daily. Prerequisites: python3.
Nutrition Label Analyzer & Meal Logger
Analyzes nutrition facts from food items via Brave Search, logs daily meals with macros, and generates daily/weekly nutrition summaries with target comparisons. Prerequisites: brave-search MCP, python3.
Weekly Meal Planner & Grocery List
Generates a personalized weekly meal plan based on dietary preferences and calorie targets via Brave Search, then produces a consolidated grocery list with estimated costs. Prerequisites: brave-search MCP, python3.
Workout Routine Builder
Builds a personalized workout program based on fitness goals, available equipment, and schedule. Researches exercises via Brave Search, calculates progressive overload, and generates trackable workout logs. Prerequisites: brave-search MCP, python3.
Explore Other Categories
Skills from other categories with shared topics
AI Analyzer
AI驱动的综合健康分析系统,整合多维度健康数据、识别异常模式、预测健康风险、提供个性化建议。支持智能问答和AI健康报告生成。
Emergency Card
生成紧急情况下快速访问的医疗信息摘要卡片。当用户需要旅行、就诊准备、紧急情况或询问"紧急信息"、"医疗卡片"、"急救信息"时使用此技能。提取关键信息(过敏、用药、急症、植入物),支持多格式输出(JSON、文本、二维码),用于急救或快速就医。
Family Health Analyzer
分析家族病史、评估遗传风险、识别家庭健康模式、提供个性化预防建议