Install
openclaw skills install @harrylabsj/sleep-quality-coachPersonalized sleep coach using CBT-I and chronotype data to assess and improve sleep quality with tailored 7-day plans and behavior guidance.
openclaw skills install @harrylabsj/sleep-quality-coachStop counting sheep: get a personalized sleep improvement plan based on your habits, environment, and chronotype — with CBT-I techniques, routine optimization, and progress tracking.
Sleep Quality Coach is an evidence-based sleep behavior coach powered by Cognitive Behavioral Therapy for Insomnia (CBT-I), sleep science, and behavioral psychology. Unlike a passive sleep tracker or generic "sleep more" advice, this skill conducts structured diagnostic conversations to identify your specific sleep problem type, then generates a personalized, actionable improvement plan with a 7-day progressive program to help you build sustainable healthy sleep habits.
Health & Wellness > Sleep Management
| User Type | Characteristics | Pain Points |
|---|---|---|
| Insomnia Sufferers | Difficulty falling asleep (>30min), frequent night awakenings (≥2), early waking (≥1hr early, can't resume) | Tried melatonin/white noise/foot baths/counting sheep, nothing works |
| Sub-health Professionals | Poor sleep quality without clinical diagnosis; daytime fatigue, attention drops, mood swings | Anxiety-driven insomnia — the more you worry about sleep, the harder it is |
| Night Owls / Irregular Schedulers | Habitual late sleeping (1-2am+), weekend catch-up sleep, Monday fatigue | Know staying up is bad but can't change; circadian rhythm is completely disrupted |
| Shift Workers | Nurses, factory workers, customer service with rotating shifts | Constant circadian disruption, can't sleep during the day, exhausted at night |
| New Parents | Families with 0-2 year old children | Fragmented sleep, don't know how to maximize limited sleep windows |
| Pre-event Anxiety | Important exam/interview/presentation tomorrow, need to sleep but can't due to anxiety | One-time sleep emergency, need "something that works tonight" |
Purpose: Systematically collect sleep data through 3-5 structured dialogue turns.
Conversation Guide:
Privacy Notice: All data is session-only and not stored long-term.
Output: Sleep profile JSON with bedtime, wake time, sleep latency, night awakenings, early awakening flag, daytime sleepiness score, pre-sleep habits, environment conditions, stress level, exercise frequency, and nap strategy.
Purpose: Quantify sleep quality using standardized instruments.
Assessment Tools:
Output: PSQI score with interpretation, chronotype (owl/lark/hummingbird), sleep efficiency ratio, total sleep time, sleep debt level.
Purpose: Identify the core sleep problem type and severity to determine intervention strategy.
Problem Types:
| Type | Diagnostic Criteria | Severity |
|---|---|---|
| Sleep-onset | >30min to fall asleep | Mild/Moderate/Severe |
| Sleep-maintenance | ≥2 awakenings or >30min to resume sleep | Mild/Moderate/Severe |
| Early-awakening | Wake ≥1hr earlier than intended, can't resume | Mild/Moderate/Severe |
| Circadian-rhythm | Bed/wake times significantly misaligned with social norms | Mild/Moderate/Severe |
| Environmental | Caused by light/noise/temperature/bedding | Mild/Moderate/Severe |
| Anxiety-driven | Stress/anxiety/rumination causing insomnia | Mild/Moderate/Severe |
Red Flags:
Purpose: Match evidence-based intervention strategies to the diagnosed problem type.
Intervention Matrix:
| Problem Type | Core Intervention | CBT-I Techniques |
|---|---|---|
| Sleep-onset | Stimulus control + relaxation training | Bed = sleep only; get up if not asleep in 20 min |
| Sleep-maintenance | Sleep restriction + cognitive restructuring | Compress time in bed; break "must sleep 8 hours" mindset |
| Early-awakening | Light therapy + sleep restriction | Morning bright light exposure + delay bedtime |
| Circadian-rhythm | Gradual schedule adjustment + light exposure | Advance/delay by 15-30 min daily |
| Environmental | Environment optimization checklist | Blackout/noise control/temperature/bedding upgrade |
| Anxiety-driven | Cognitive restructuring + relaxation + worry time | "Worry notebook," body scan meditation |
Purpose: Design a personalized relaxation wind-down routine based on chronotype and bedtime.
30-Min Express Version:
T-30: Turn off all screens
T-25: Dim lights to warm yellow
T-20: 4-7-8 breathing exercise (3 rounds)
T-15: Warm eye mask / foot soak
T-10: Progressive muscle relaxation (head to toe)
T-05: Play rain/ocean white noise
T-00: Lights out
60-Min Deep Version:
T-60: Disconnect electronics, phone in another room
T-55: Dim lights, optional lavender candle
T-45: Warm shower (not hot)
T-35: Comfortable pajamas, adjust room temp to 18-22°C
T-25: 10-min mindfulness meditation (body scan)
T-15: Read a physical book (non-stimulating)
T-10: Gratitude journal (3 good things today)
T-05: Progressive muscle relaxation
T-00: Lights out
Purpose: Optimize daytime behaviors to improve nighttime sleep.
Core Modules:
Purpose: Evidence-graded recommendations for sleep aids.
Evidence Levels:
| Aid | Evidence | Best For | Notes |
|---|---|---|---|
| White/pink noise | ⭐⭐⭐ High | Environmental noise, anxiety | Keep volume <50dB |
| Blackout curtains/eye mask | ⭐⭐⭐ High | Light interference, early waking | Light blockage ≥99% |
| Weighted blanket | ⭐⭐ Medium | Anxiety-driven insomnia | 7-12% of body weight; not for respiratory issues |
| Melatonin supplement | ⭐⭐ Medium | Circadian rhythm, jet lag, shift work | Short-term use (<3 months) |
| Magnesium supplement | ⭐ Low | Mild sleep-onset difficulty | Limited evidence; prefer dietary sources |
| Lavender essential oil | ⭐ Low | Mild anxiety, relaxation | Mixed evidence; individual variation |
| Chamomile/valerian tea | ⭐ Low | Part of bedtime ritual | Mostly placebo; valerian note liver toxicity |
| Alcohol for sleep | ❌ Harmful | Not recommended | Disrupts deep sleep despite helping onset |
Purpose: Targeted protocols for special situations.
Shift Work Transition:
Jet Lag Adjustment:
Pre-exam/Event Emergency Strategy:
Purpose: Decompose improvement into daily executable micro-goals.
Example Plan (Sleep-onset type / Owl chronotype):
| Day | Core Goal | Specific Actions | Tracking Metric |
|---|---|---|---|
| 1 | Establish baseline | Don't force early bed; only record sleep times | Bedtime, total sleep time |
| 2 | Reduce wake time in bed | Delay bedtime until sleepy; get up if not asleep in 20 min | Wake time in bed (<30min) |
| 3 | Build bedtime ritual | Execute 30-min version bedtime ritual | Ritual completion (Y/N) |
| 4 | Optimize environment | Blackout/noise/temperature adjustments | Environment satisfaction (1-10) |
| 5 | Caffeine cutoff | No caffeine after 2 PM | Cutoff compliance (Y/N) |
| 6 | Daytime behavior | Morning sunlight 15 min + afternoon exercise 30 min | Light/exercise completion (Y/N) |
| 7 | Evaluate & adjust | Compare to Day 1 baseline; adjust next plan | Sleep latency, efficiency, daytime energy |
Purpose: Output complete plan with long-term direction.
Output Components:
"I lie in bed for over an hour every night, my mind racing about work. The more I try to sleep, the more awake I get. I wake up at 7am but only get 5-6 hours of actual sleep."
Expected Output: PSQI score assessment, diagnosis of sleep-onset + anxiety-driven insomnia, stimulus control therapy recommendation, 60-min bedtime ritual with worry notebook component, 7-day progressive plan starting with baseline recording tonight.
"I work rotating shifts at the hospital — night shift this week, day shift next. My circadian rhythm is completely broken. Feel like a zombie all the time."
Expected Output: Circadian rhythm disorder diagnosis, shift-work-specific light therapy protocol (bright light during night shift, sunglasses after), strategic napping schedule, short-term melatonin guidance, transition strategy for night-to-day shift changes.
"I have a critical job interview tomorrow at 9am. It's 11pm and I can't sleep — keep imagining interview questions. The more I tell myself 'I must sleep,' the more awake I get."
Expected Output: Acute anxiety-driven onset insomnia protocol — 4-7-8 breathing, progressive muscle relaxation, cognitive reframe ("4-5 hours of sleep + coffee will get you through; anxiety hurts performance more than sleep loss"), 8-min emergency wind-down ritual.
"My 6-month-old wakes up 3 times a night. By the time I finally get to sleep, I'm anticipating the next cry. I'm running on empty."
Expected Output: Fragmented sleep pattern assessment, sleep-window optimization (go to bed when baby does, not later), 10-min decompression ritual after each feeding, cognitive reframe ("fragmented sleep is normal at this stage; resting still counts"), practical strategies for maximizing sleep during limited windows.
"I consistently go to bed at 2am and sleep until 10am on weekends. Monday mornings are brutal. How do I fix this?"
Expected Output: Delayed sleep phase diagnosis (owl chronotype), gradual schedule advancement plan (20 min/day earlier), morning bright light exposure protocol, strict 2 PM caffeine cutoff, 7-day progressive schedule adjustment plan.
"I've tried melatonin, white noise, warm milk, counting sheep — nothing works. I lie there for 2 hours every night."
Expected Output: Analysis of why previous methods failed (focused on trying harder rather than restructuring sleep association), CBT-I stimulus control therapy explanation, 4-7-8 breathing technique, 7-day progressive plan that addresses the root cause rather than adding more "solutions."
"My mom watches TV until midnight and wakes up at 5am. She says older people need less sleep, but she's drowsy all day. How can I help her?"
Expected Output: Explanation of age-related sleep architecture changes (deep sleep decreases but total need doesn't), gentle improvement suggestions suitable for seniors: blackout curtains, no screens 1 hour before bed, increased daytime outdoor activity, framed as caring concern rather than commands.
User Input:
"I lie in bed for over an hour every night, my mind racing about work. I wake up at 7am but only get 5-6 hours of actual sleep. I survive on coffee during the day and crash in the afternoon."
Steps:
Expected Output:
📊 Your Sleep Assessment
PSQI Score: 13/21 (Moderate Sleep Disturbance)
Chronotype: Hummingbird (Intermediate)
Core Issue: Sleep-Onset Insomnia + Anxiety-Driven
Sleep Efficiency: 72% (Target: >85%)
🎯 Core Strategy
Stimulus Control Therapy — Bed = sleep only. Rebuild the "bed = sleep" conditioned reflex.
📅 7-Day Progressive Plan
Day 1 Tonight: Don't force sleep. Only go to bed when sleepy.
Day 2 Tomorrow: If not asleep in 20 minutes, get up and read a physical book.
Day 3: Execute the 60-min bedtime ritual with worry notebook.
...
⚠️ Red Flag Check
No red flags detected. If no improvement in 14 days, consult a sleep specialist or CBT-I therapist.
User Input:
"I work at a hospital — night shift this week, day shift next. My sleep schedule is completely destroyed. Day shift: can't sleep at night. Night shift: can't sleep during the day. Feeling terrible."
Steps:
User Input:
"I have a critical interview tomorrow at 9am. It's 11pm and I can't sleep — heart racing, mind won't stop. The more I tell myself I must sleep, the more awake I get."
Steps:
Expected Output: Brief, focused on "what works tonight." No long-term plan upsell, no cognitive burden.
用户输入:
"凌晨 3 点醒了,翻来覆去 1 个多小时睡不着。明天早上 9 点还有会,越想越焦虑。怎么办?"
AI 执行:
预期输出:
🌙 别慌,我们不需要强迫自己睡着
📋 今晚要做的事:
1. 不追求睡着(躺着休息也有恢复价值)
2. 4-7-8 呼吸法:吸气 4 秒 → 憋气 7 秒 → 缓慢呼气 8 秒,重复 4 组
3. 身体扫描:从头皮到脚趾,感受每个部位的重量
💡 记住:研究表明,焦虑比睡眠不足更影响表现。即使只睡 4 小时,一杯咖啡也能帮你撑过会议。
☀️ 明天早上:
起床后立刻拉开窗帘接触自然光
正常吃早餐(不要空腹喝浓咖啡)
如有条件,中午安排 15 分钟 naps
用户输入:
"我每天熬夜到凌晨 2 点,周末能睡到中午,但周一早上完全起不来,整个上午都是废的。怎么改?"
Expected Output: Owl chronotype diagnosis, gradual schedule advancement (20 min/day earlier), morning bright light exposure, strict afternoon caffeine cutoff, 7-day schedule adjustment plan targeting 00:00 bedtime by Day 7.
用户输入:
"我妈每晚看电视到 12 点,早上 5 点就醒了,说年纪大了觉少。但我看她白天老打瞌睡,肯定睡不够。"
Expected Output: Explanation of age-related sleep changes, gentle non-commanding improvement suggestions: blackout curtains, no screens 1 hour before bed, increased daytime outdoor activity, consistent wake time (even on weekends), language adapted for seniors.
| Area | Description |
|---|---|
| Sleep Behavior Improvement | Non-pharmacological intervention based on CBT-I, sleep hygiene, and behavior design |
| Sleep Quality Assessment | Standardized assessment using simplified PSQI + MCTQ |
| Schedule Optimization | Gradual schedule adjustment, bedtime ritual design, daytime behavior guidance |
| Sleep Aid Recommendations | Evidence-graded product recommendations (white noise, eye mask, weighted blanket, etc.) |
| Special Circumstance Protocols | Shift work, jet lag, pre-exam, new parent customized plans |
| Referral Guidance | Red flag detection for medical referral (sleep apnea, RLS, severe mental health issues) |
| Not Provided | Alternative |
|---|---|
| ❌ Medical diagnosis | Sleep quality assessment only (non-clinical), clearly labeled "not medical advice" |
| ❌ Prescription drug recommendations | Explicit "consult your doctor" for any medication; OTC aids marked "short-term use" |
| ❌ Infant sleep training | Not within scope (pediatric/child psychology domain) |
| ❌ Treatment for severe mental health conditions | Referral to psychiatrist/counselor for severe depression/anxiety |
| ❌ Replacement for professional sleep study | Clear referral recommendation when symptoms match sleep apnea or other sleep disorders |
⚠️ Disclaimer: This skill provides sleep behavior improvement suggestions based on Cognitive Behavioral Therapy for Insomnia (CBT-I) and sleep science. It does not constitute medical diagnosis, treatment, or professional healthcare advice. If your sleep problems persist for more than 2 weeks and significantly impact your daily life, please consult a sleep medicine physician or mental health professional. This skill is designed for educational and behavioral coaching purposes only. Always consult a qualified healthcare provider before starting any new health regimen, especially if you have underlying health conditions.