---
name: sleep-optimizer
description: |
  Evidence-based sleep optimization system covering sleep hygiene, circadian rhythm alignment, bedroom environment design, relaxation protocols, and sleep schedule engineering. Helps users identify and correct sleep disruptors for consistently restorative rest.
  Use when the user asks about sleep optimizer, or needs help with evidence-based sleep optimization system covering sleep hygiene, circadian rhythm alignment, bedroom environment design, relaxation protocols, and sleep schedule engineering.
  Do NOT use when the request requires professional medical advice or falls outside the scope of sleep optimizer.
license: Apache-2.0
metadata:
  author: foundry-skills
  version: "1.0.0"
  tags: "health-wellness sleep guide"
  category: "health-wellness"
  subcategory: "preventive-health"
  depends: ""
  disclaimer: "not-medical-advice"
  difficulty: "intermediate"
---

# Sleep Optimizer

> **Disclaimer:** This skill provides general wellness and health information for educational purposes only. It does NOT constitute medical advice, diagnosis, or treatment recommendations. The information provided is not a substitute for professional medical judgment. Always consult a qualified healthcare professional before making decisions about your health, starting a new fitness program, or changing your diet. If you are experiencing a medical emergency, contact emergency services immediately.

## When to Use

**Use this skill when:**
- User asks about sleep optimizer
- User needs guidance on sleep optimizer topics
- User wants a structured approach to sleep optimizer

**Do NOT use when:**
- Request requires professional consultation beyond educational guidance
- User needs emergency assistance

## Questions to Ask the User First

```
SLEEP ASSESSMENT QUESTIONNAIRE
================================

1. CURRENT SLEEP PATTERN:
   - Typical bedtime: ___
   - Time to fall asleep (sleep onset latency): ___ minutes
   - Number of nighttime awakenings: ___
   - Time awake during the night (total): ___ minutes
   - Wake-up time: ___
   - Time actually getting out of bed: ___
   - Total time in bed: ___ hours
   - Estimated actual sleep time: ___ hours

2. SLEEP QUALITY (1-10, where 10 is perfect): ___

3. PRIMARY SLEEP CONCERNS:
   [ ] Difficulty falling asleep
   [ ] Difficulty staying asleep
   [ ] Waking too early
   [ ] Not feeling rested despite sleeping enough
   [ ] Excessive daytime sleepiness
   [ ] Irregular schedule (shift work, travel)
   [ ] Snoring or breathing issues
   [ ] Restless legs or limb movements
   [ ] Nightmares or sleep terrors
   [ ] Sleepwalking or sleep talking

4. DAYTIME FUNCTIONING:
   - Energy level (1-10): ___
   - Caffeine consumption: ___ cups/day, last cup at ___
   - Alcohol consumption: ___ drinks/week, typically at ___
   - Napping: [ ] Yes (___ minutes at ___) [ ] No
   - Exercise: ___ days/week, typically at ___
   - Screen time before bed: ___ minutes

5. SLEEP ENVIRONMENT:
   - Room temperature: ___
   - Room darkness (1-10, 10=pitch black): ___
   - Noise level: [ ] Silent [ ] Some [ ] Noisy
   - Mattress age: ___ years
   - Bed partner: [ ] Yes [ ] No
   - Pets in bed: [ ] Yes [ ] No
   - Electronics in bedroom: ___

6. LIFESTYLE FACTORS:
   - Work schedule: ___
   - Stress level (1-10): ___
   - Current medications: ___
   - Medical conditions: ___
   - Shift work: [ ] Yes [ ] No
   - Frequent travel/time zones: [ ] Yes [ ] No

7. SLEEP GOAL:
   - Desired sleep duration: ___ hours
   - Desired bedtime: ___
   - Desired wake time: ___
```

## Sleep Science Fundamentals

### Sleep Architecture

A normal sleep cycle lasts approximately 90 minutes and repeats 4-6 times per night:

```
SLEEP CYCLE STRUCTURE (one ~90-minute cycle)
=============================================

  AWAKE ----+
            |
  NREM 1 ---+--- Light sleep (5-10 min) - easily awakened
            |
  NREM 2 ---+--- True sleep onset (10-25 min) - body temp drops
            |
  NREM 3 ---+--- Deep/slow-wave sleep (20-40 min) - physical restoration
            |
  REM ------+--- Dream sleep (10-60 min) - mental restoration
            |
  [Cycle repeats]

Early night: More deep sleep (NREM 3)
Late night: More REM sleep
```

### Sleep Duration Recommendations (National Sleep Foundation)

| Age Group | Recommended | May Be Appropriate | Not Recommended |
|-----------|------------|-------------------|-----------------|
| Teenager (14-17) | 8-10 hours | 7-11 hours | <7 or >11 |
| Young Adult (18-25) | 7-9 hours | 6-10 hours | <6 or >10 |
| Adult (26-64) | 7-9 hours | 6-10 hours | <6 or >10 |
| Older Adult (65+) | 7-8 hours | 5-9 hours | <5 or >9 |

### Circadian Rhythm

Your internal body clock runs on approximately a 24-hour cycle, regulated by:

**Zeitgebers (time cues):**
1. **Light** (strongest cue) - Bright light in morning advances clock; light at night delays it
2. **Meal timing** - Regular meals reinforce circadian rhythm
3. **Physical activity** - Exercise timing signals the body clock
4. **Social interaction** - Consistent social schedules help regulate rhythm
5. **Temperature** - Core body temperature naturally dips at night

**Chronotype:**
- **Early bird (lion):** Natural sleep ~9:30 PM - 5:30 AM, peak energy morning
- **Intermediate (bear):** Natural sleep ~11 PM - 7 AM, peak energy mid-morning
- **Night owl (wolf):** Natural sleep ~12:30 AM - 8:30 AM, peak energy afternoon/evening

## Sleep Hygiene Checklist

### The Complete Sleep Hygiene Protocol

```
SLEEP HYGIENE AUDIT
=====================
Rate each item: [Y] Yes/Good  [N] No/Needs Work  [?] Unsure

SCHEDULE
[ ] Consistent bedtime (within 30 min, including weekends)
[ ] Consistent wake time (within 30 min, including weekends)
[ ] Sleep window matches my chronotype
[ ] 7-9 hours allocated for sleep

EVENING ROUTINE (1-2 hours before bed)
[ ] Screens off or using blue light filters 60+ min before bed
[ ] Avoid stimulating content (news, arguments, intense shows)
[ ] Relaxation routine in place (reading, stretching, bath)
[ ] Dim lighting in the home after sunset
[ ] No heavy meals within 2-3 hours of bedtime
[ ] No alcohol within 3 hours of bedtime
[ ] No caffeine after 2 PM (or 8+ hours before bed)
[ ] No intense exercise within 3 hours of bedtime

BEDROOM ENVIRONMENT
[ ] Temperature: 60-67F (15-19C)
[ ] Darkness: Room is very dark (blackout curtains/eye mask)
[ ] Noise: Quiet or consistent white noise
[ ] Mattress is comfortable and supportive
[ ] Pillows support neck alignment
[ ] Bedroom used only for sleep and intimacy
[ ] No visible clocks (prevents clock-watching anxiety)
[ ] Phone is silenced or out of the room

DAYTIME HABITS
[ ] Morning sunlight exposure within 30 min of waking (10-15 min)
[ ] Regular physical activity (but not too close to bedtime)
[ ] Limited napping (20 min max, before 3 PM)
[ ] Consistent meal times
[ ] Adequate hydration (but tapering before bed)
[ ] Stress management practices

ITEMS NEEDING IMPROVEMENT:
1. _______________
2. _______________
3. _______________
```

## Bedroom Environment Optimization

### Temperature
- **Optimal range:** 60-67F (15.5-19.5C)
- Core body temperature must drop 2-3F to initiate sleep
- A warm bath 1-2 hours before bed paradoxically helps (vasodilation cools core)
- Layer bedding so you can adjust during the night
- Consider cooling mattress pads if you run hot

### Light
- **Goal:** As close to pitch darkness as possible
- Blackout curtains or cellular shades
- Cover LED lights on electronics with tape
- Eye mask as backup (silk or contoured)
- Nightlight only if necessary (red/amber, never blue/white)
- Dawn simulation alarm clock for gentle waking

### Sound
- **Goal:** Consistent, non-stimulating sound environment
- White noise machine or fan for consistent background
- Earplugs (NRR 30+ for noisy environments)
- Address structural noise issues (weather stripping, rugs)
- Avoid falling asleep to TV or podcasts (variable stimulation)

### Air Quality
- Open window slightly if possible (fresh air and slight cooling)
- Air purifier if allergies are an issue
- Humidity: 30-50% (humidifier or dehumidifier as needed)
- Clean bedding weekly (dust mites are a common sleep disruptor)

### Mattress and Pillow Guide
| Sleep Position | Mattress Firmness | Pillow Loft |
|---------------|------------------|-------------|
| Back sleeper | Medium to medium-firm | Medium loft |
| Side sleeper | Medium to medium-soft | High loft (shoulder gap) |
| Stomach sleeper | Firm | Low loft or flat |
| Combination | Medium | Adjustable loft |

**Replace mattress:** Every 7-10 years or when sagging/uncomfortable
**Replace pillows:** Every 1-2 years

## Sleep Schedule Design

### Calculating Your Ideal Sleep Window

```
SLEEP SCHEDULE CALCULATOR
===========================

Step 1: Required wake time (work/life): ___:___ AM

Step 2: Target sleep duration: ___ hours

Step 3: Sleep onset latency (time to fall asleep): ~___ min

Step 4: Calculate bedtime:
  Wake time - sleep duration - onset latency = bedtime
  Example: 6:30 AM - 8 hrs - 15 min = 10:15 PM bedtime

Step 5: Wind-down routine start:
  Bedtime - 60 min = start dimming lights, begin routine
  Example: 10:15 PM - 60 min = 9:15 PM start routine

MY SCHEDULE:
  9:__ PM - Begin wind-down routine
  __:__ PM - In bed, lights out
  __:__ AM - Wake time (alarm)
  __:__ AM - Out of bed (no snooze)
  __:__ AM - Bright light exposure
```

### Adjusting Your Schedule (Gradual Shifting)
- Shift bedtime and wake time by **15-30 minutes** every 2-3 days
- Do NOT try to shift by more than 1 hour at once
- Use morning light exposure to anchor the new schedule
- Avoid sleeping in on weekends by more than 30-60 minutes

### Sleep Restriction Therapy (for insomnia - use with caution)
This is a clinical technique. Consider working with a sleep specialist.

1. Calculate actual sleep time (e.g., 5.5 hours)
2. Set sleep window to match actual sleep time (not less than 5 hours)
3. Pick fixed wake time; calculate bedtime (wake 6 AM - 5.5 hrs = 12:30 AM)
4. Stay in bed ONLY during this window
5. When sleeping 85%+ of time in bed for 5 days, extend window by 15 min
6. Repeat until reaching target duration

## Screen Time Management

### Blue Light and Melatonin
- Blue light (450-495nm) suppresses melatonin production
- Even dim blue light within 2 hours of bed delays sleep onset
- The issue is both wavelength AND brightness

### Screen Management Protocol
| Time Before Bed | Action |
|----------------|--------|
| 3+ hours | No restrictions needed |
| 2 hours | Enable night mode / blue light filter on all devices |
| 1 hour | Reduce screen brightness to minimum; prefer non-screen activities |
| 30 min | Screens off completely |
| In bed | No screens whatsoever |

### Blue Light Filter Settings
- **iPhone/iPad:** Settings > Display > Night Shift (schedule sunset to sunrise)
- **Android:** Settings > Display > Night Light
- **Windows:** Settings > Display > Night Light
- **Mac:** System Preferences > Displays > Night Shift
- **Browser:** Install f.lux or use built-in reader mode
- **Hardware:** Blue-light-blocking glasses (amber/orange lens)

## Relaxation Techniques Before Bed

### 10-Minute Wind-Down Routine

```
BEDTIME RELAXATION SEQUENCE
=============================

Minutes 1-3: GENTLE STRETCHING
  - Neck rolls (30 sec each direction)
  - Shoulder shrugs and release (5 reps)
  - Seated forward fold (30 sec)
  - Supine twist (30 sec each side)
  - Legs up the wall (60 sec)

Minutes 4-7: BREATHING
  - 4-7-8 breathing: 4 cycles
    (Inhale 4 sec, hold 7 sec, exhale 8 sec)

Minutes 8-10: BODY SCAN
  - Lie in bed, eyes closed
  - Scan from toes to head
  - At each area, tense for 3 sec, then release
  - Notice the feeling of relaxation spreading
```

### Cognitive Shuffle (for racing thoughts)
1. Think of a random word (e.g., "garden")
2. For each letter, picture unrelated things starting with that letter
3. G: giraffe... guitar... glacier... grape...
4. A: airplane... anchor... apricot... arrow...
5. The randomness bores the brain's planning center into sleep

### Sleep Journaling (Brain Dump)
Before bed, write for 5 minutes:
- Worries and to-dos for tomorrow (get them out of your head)
- Three things that went well today
- Tomorrow's plan (so you stop planning in bed)

## Common Sleep Disruptors and Solutions

| Disruptor | Impact | Solution |
|-----------|--------|----------|
| Caffeine | Blocks adenosine for 6-8 hours | No caffeine after 2 PM |
| Alcohol | Fragments sleep, suppresses REM | Stop 3+ hours before bed |
| Late meals | Raises core temperature, causes reflux | Last meal 2-3 hours before bed |
| Stress/worry | Activates sympathetic nervous system | Brain dump journal, relaxation routine |
| Irregular schedule | Disrupts circadian rhythm | Fixed wake time 7 days/week |
| Napping too long | Reduces sleep pressure | Max 20 min, before 3 PM |
| Blue light | Suppresses melatonin | Screens off 30-60 min before bed |
| Bedroom too warm | Prevents core temp drop | Set thermostat to 60-67F |
| Clock watching | Creates anxiety about sleep | Remove visible clocks |
| Trying too hard | Performance anxiety about sleep | Paradoxical intention - try to stay awake |

## Napping Strategy

### Optimal Nap Durations
| Duration | Type | Benefits | Drawbacks |
|----------|------|----------|-----------|
| 10-20 min | Power nap | Alertness boost, no grogginess | Limited restorative benefit |
| 30 min | Avoid | Sleep inertia (grogginess) | Wakes from deep sleep |
| 90 min | Full cycle | Full restoration, creativity | Time-consuming |

### Nap Rules
- Before 3 PM only (to preserve nighttime sleep drive)
- Set an alarm (prevent oversleeping)
- Dark, quiet environment
- If you have insomnia, avoid napping entirely

## Sleep Tracking Interpretation

### What to Track
- Bedtime and wake time
- Estimated sleep onset latency
- Number of awakenings
- Subjective sleep quality (1-10)
- Energy level next day (1-10)
- Factors (caffeine, alcohol, exercise, stress)

### Sleep Tracking Journal Template

```
WEEKLY SLEEP LOG
==================
       | Mon | Tue | Wed | Thu | Fri | Sat | Sun |
-------|-----|-----|-----|-----|-----|-----|-----|
Bed    |     |     |     |     |     |     |     |
Asleep |     |     |     |     |     |     |     |
Wakes  |     |     |     |     |     |     |     |
Up     |     |     |     |     |     |     |     |
Total  |     |     |     |     |     |     |     |
Quality|     |     |     |     |     |     |     |
Energy |     |     |     |     |     |     |     |
Notes  |     |     |     |     |     |     |     |

Sleep Efficiency = (Time asleep / Time in bed) x 100
Target: 85% or higher

This week's efficiency: ___%
```

### Wearable/App Data Interpretation
- Consumer sleep trackers (Fitbit, Apple Watch, Oura) are **reasonably accurate for total sleep time** but **less accurate for sleep stages**
- Use trends over weeks, not individual night readings
- If tracker says you slept poorly but you feel fine, trust how you feel
- Clinical-grade measurement requires polysomnography (sleep study)

## When to See a Sleep Specialist

Seek professional evaluation if you experience:
- Chronic insomnia (3+ nights/week for 3+ months)
- Loud snoring with witnessed breathing pauses (possible sleep apnea)
- Excessive daytime sleepiness despite adequate sleep time
- Restless, uncomfortable leg sensations at night
- Acting out dreams physically (REM behavior disorder)
- Falling asleep involuntarily during the day
- Sleep problems not improving with good sleep hygiene
- Reliance on sleep medication for more than a few weeks


## Output Format

```
SLEEP OPTIMIZER OUTPUT
======================

Section 1: Assessment / Analysis
- Key findings
- Recommendations

Section 2: Action Plan
- Step-by-step guidance
- Timeline if applicable

Section 3: Resources
- Relevant references
- Next steps
```

## Example

**Input:** "Help me get started with sleep optimizer"

**Output:** A structured sleep optimizer plan tailored to the user's specific situation, following the process outlined above.

## Edge Cases

- **Incomplete information:** Ask clarifying questions before proceeding. Do not assume details the user has not provided.
- **Out of scope requests:** Redirect to appropriate professional resources when the request exceeds educational guidance.
- **Conflicting requirements:** Present trade-offs clearly and let the user decide priorities.
