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-ddfa1a33" })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
Pet Care Planner & Tracker
Creates a pet care schedule with vet appointments, medications, feeding routines, and exercise plans. Researches breed-specific care via Brave Search and tracks medical history. Prerequisites: brave-search MCP.
Book-to-Action Notes Generator
Researches a book's key ideas via Brave Search, generates structured chapter summaries with actionable takeaways, and creates an implementation checklist. Prerequisites: brave-search MCP.
Company Due Diligence Researcher
Conducts comprehensive research on a company via Brave Search covering financials, leadership, culture, news, and competitive landscape. Generates a diligence brief for job seekers, investors, or partners. Prerequisites: brave-search MCP, python3.