Every developer knows the feeling: you sit down to code, open your laptop, and somehow two hours disappear into Slack messages, email threads, and "just quickly checking" something. By lunch, you've written maybe 50 lines of actual code.
I've been there. For years, I started each day reactively—responding to whatever demanded attention first. Then I stumbled onto a simple 15-minute morning routine that completely transformed my productivity. Here's exactly what I do and how you can steal it.
The Problem: Context Switching is Killing Your Code
Research from the University of California found that it takes an average of 23 minutes to fully regain focus after an interruption. If you check Slack three times in an hour, you've essentially lost that hour to context-switching overhead.
The math is brutal:
- 8-hour workday
- 10 interruptions (conservative estimate)
- 23 minutes recovery each
- 3.8 hours lost daily
That's nearly half your day gone before you write a single meaningful line of code.
The 15-Minute Morning Routine
Here's my exact routine, broken into three 5-minute blocks:
Block 1: The Brain Dump (5 minutes)
Before opening any apps, I write down everything swirling in my head. Not in a fancy tool—just a plain text file:
# I use this alias in my .zshrc
alias dump='nvim ~/notes/$(date +%Y-%m-%d)-dump.md'
The file looks like this:
# 2026-03-04 Brain Dump
## Must do today
- Fix the auth bug in /api/login
- Review Sarah's PR #234
## Nagging thoughts
- Need to update dependencies soon
- Should we switch to Postgres 16?
## Blocked on
- Waiting for design specs from Tom
This externalization is crucial. Your brain is for having ideas, not holding them. Get everything out so your working memory is free for actual coding.
Block 2: The One Thing (5 minutes)
Now I identify my One Thing—the single task that, if completed, makes today a win. Not three things. One.
I write it on a sticky note and put it on my monitor:
TODAY'S ONE THING: Fix auth bug so users can log in
Everything else is secondary. This sounds obvious, but most developers start their day with a vague sense of "lots to do" rather than a clear target.
Here's a simple script I use to remind myself throughout the day:
#!/usr/bin/env python3
# save as ~/bin/one-thing.py
import os
from datetime import date
from pathlib import Path
def get_one_thing():
today = date.today().isoformat()
file_path = Path.home() / "notes" / f"{today}-dump.md"
if not file_path.exists():
return "No brain dump found. Run 'dump' first!"
content = file_path.read_text()
# Extract first item under "Must do today"
lines = content.split('\n')
for i, line in enumerate(lines):
if 'must do today' in line.lower():
if i + 1 < len(lines) and lines[i + 1].startswith('- '):
return lines[i + 1][2:]
return "No priority found in today's dump"
if __name__ == "__main__":
print(f"🎯 ONE THING: {get_one_thing()}")
Add it to your shell prompt or run it whenever you feel distracted.
Block 3: Environment Lockdown (5 minutes)
The final block is about removing temptation. I:
- Close email and Slack entirely (not minimized—closed)
- Set my phone to Do Not Disturb
- Open only what I need for my One Thing
For the code part, I use a simple script to launch my focused workspace:
#!/bin/bash
# ~/bin/focus-mode
# Kill distractions
pkill -f slack 2>/dev/null
pkill -f discord 2>/dev/null
pkill -f mail 2>/dev/null
# Set macOS/Linux Do Not Disturb (adjust for your OS)
# macOS:
shortcuts run "Turn On Focus" 2>/dev/null
# Block distracting sites for 2 hours
if command -v hostblock &> /dev/null; then
hostblock add twitter.com reddit.com news.ycombinator.com --duration 2h
fi
# Open my coding environment
cd ~/projects/current
tmux new-session -d -s work
tmux send-keys -t work 'nvim .' Enter
tmux attach -t work
echo "🔒 Focus mode activated. Get that One Thing done."
The Results: What Actually Changed
After 30 days of this routine:
- Deep work sessions went from 1-2 hours/day to 4-5 hours/day
- PR merge time dropped because I was reviewing first thing, not at 4pm
- Anxiety decreased because my brain wasn't holding open loops
- Estimation accuracy improved since I knew what actually filled my days
The most surprising change? I started finishing early. Not because I was working more hours, but because those hours actually counted.
Common Objections (And How I Handle Them)
"I need to be responsive to my team."
Set a specific Slack check-in time—say, 10am and 2pm. Tell your team. Most "urgent" messages can wait 2 hours. True emergencies will find you (phone call, someone walking over).
"15 minutes is too long, I just want to code."
The 15 minutes saves you 3+ hours of fragmented, low-quality work. It's the highest-ROI investment you'll make all day.
"My brain dump takes longer than 5 minutes."
That's fine initially. As you build the habit, you get faster. Also, if you have that much mental clutter, you really need to externalize it.
Key Takeaways
Brain dump before anything else. Externalize your mental load into a file.
Identify your One Thing. A single, clear priority beats a vague to-do list.
Lock down your environment. Close distractions; don't rely on willpower.
Batch communication. Designate specific times for Slack/email.
Measure what matters. Track deep work hours, not just "time at desk."
Try It Tomorrow
Here's your challenge: Tomorrow morning, before checking anything, spend 15 minutes on this routine. Brain dump, identify your One Thing, lock down distractions.
One day won't transform your career. But if you do it for a week, you'll feel the difference. Do it for a month, and you'll wonder how you ever worked any other way.
The code doesn't care about your good intentions. It only cares about your focused attention. Give it that, and everything changes.
What's your morning routine for getting into flow? Drop a comment below—I'm always looking to optimize.
Top comments (0)