The Optimized Developer Workflow
An optimized workflow is not about working faster on individual tasks. It is about eliminating waste, reducing context switching, automating repetitive work, and ensuring that every step adds value. The best developers do not just write good code. They build systems and habits that make everything around the code more efficient.
Workflow Optimization Principles
- Automate repetitive tasks: If you do something more than twice, automate it
- Reduce context switching: Batch similar tasks together, minimize interruptions
- Shorten feedback loops: Find problems as early as possible in the pipeline
- Make the right thing easy: Paved paths and good defaults prevent mistakes
- Measure and improve: Track cycle time, deployment frequency, and failure rate
Feature Development Workflow
# 1. Start from a clean, up-to-date main branch
git checkout main
git pull --rebase origin main
# 2. Create a feature branch with descriptive name
git checkout -b feat/user-notifications
# 3. Make small, focused commits
git add src/components/NotificationBell.tsx
git commit -m "feat(notifications): add notification bell component"
git add src/hooks/useNotifications.ts
git commit -m "feat(notifications): add useNotifications hook"
git add src/app/api/notifications/route.ts
git commit -m "feat(notifications): add notifications API endpoint"
# 4. Push and create PR
git push -u origin feat/user-notifications
gh pr create --title "feat: add user notification system" \
--body "## Summary
- Add notification bell component in the header
- Real-time updates via WebSocket
- Mark as read functionality
## Test plan
- [ ] Notifications appear in real time
- [ ] Marking as read updates the UI
- [ ] Works on mobile viewports"
# 5. After review, merge with squash
gh pr merge --squash --delete-branch
Git Workflow Automation
# Shell functions for common git workflows (~/.zshrc)
# Create feature branch from updated main
feature() {
git checkout main &&
git pull --rebase origin main &&
git checkout -b "feat/$1"
}
# Usage: feature user-notifications
# Create a bugfix branch
bugfix() {
git checkout main &&
git pull --rebase origin main &&
git checkout -b "fix/$1"
}
# Usage: bugfix login-redirect
# Push current branch and create a draft PR
draft() {
local branch=$(git branch --show-current)
git push -u origin "$branch"
gh pr create --draft --fill
}
# Sync current branch with main (rebase)
sync() {
local branch=$(git branch --show-current)
git fetch origin main &&
git rebase origin/main
}
# Clean up merged branches
cleanup() {
git checkout main &&
git pull &&
git branch --merged | grep -v "main|master|*" | xargs -n 1 git branch -d
echo "Cleaned up merged branches"
}
CI/CD Pipeline Design
# .github/workflows/ci.yml
name: CI
on:
pull_request:
branches: [main]
push:
branches: [main]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
- run: npm ci
- run: npm run lint
- run: npm run typecheck
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
- run: npm ci
- run: npm test -- --coverage
- uses: codecov/codecov-action@v4
build:
runs-on: ubuntu-latest
needs: [lint, test]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
- run: npm ci
- run: npm run build
Task Management Integration
# Use GitHub CLI to manage issues from the terminal
gh issue list --assignee @me # My open issues
gh issue create --title "Bug: ..." --label bug # Create issue
gh issue view 42 # View issue details
gh pr checks # Check CI status
gh pr review --approve # Approve a PR
gh pr merge --squash # Merge PR
# Link commits to issues automatically
git commit -m "fix(auth): handle expired tokens
Fixes #42" # Closes issue #42 when PR merges
Productivity Techniques
Time Blocking for Deep Work
Protect blocks of uninterrupted time for coding. Research shows it takes 23 minutes to regain focus after an interruption. Batch meetings and communications into specific time blocks and defend your deep work time.
The 2-Minute Rule
If a task takes less than 2 minutes, do it immediately. Reply to that PR comment, fix that typo, update that config. Small tasks that accumulate create mental overhead.
Code Review Efficiency
# Efficient code review workflow
# 1. Checkout the PR locally for thorough review
gh pr checkout 123
# 2. Run the project to test changes
npm run dev
# 3. Run tests related to changes
npm test -- --related
# 4. Leave review comments
gh pr review 123 --comment --body "Looks good overall, a few suggestions..."
gh pr review 123 --approve
Environment Management
# Use direnv for automatic environment loading
# .envrc in project root
export DATABASE_URL="postgresql://localhost:5432/myapp"
export REDIS_URL="redis://localhost:6379"
export NODE_ENV="development"
# direnv automatically loads when you cd into the project
# and unloads when you leave
# Install direnv
brew install direnv
# Add to ~/.zshrc: eval "$(direnv hook zsh)"
# Allow the .envrc file
direnv allow .
// docker-compose.yml for local development services
version: "3.8"
services:
postgres:
image: postgres:16
environment:
POSTGRES_DB: myapp
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
ports:
- "5432:5432"
volumes:
- postgres-data:/var/lib/postgresql/data
redis:
image: redis:7-alpine
ports:
- "6379:6379"
maildev:
image: maildev/maildev
ports:
- "1080:1080" # Web UI
- "1025:1025" # SMTP
volumes:
postgres-data:
Workflow Optimization Checklist
- Setup time: New developers can run the project within 15 minutes of cloning
- Hot reload: Code changes are visible in under 1 second
- Pre-commit hooks: Linting and formatting run automatically before commits
- CI pipeline: Runs lint, typecheck, test, and build on every PR in under 5 minutes
- Deployment: Merging to main automatically deploys to production
- Monitoring: Errors and performance issues are automatically reported