⚙️ Automation

Development Environment Setup

Generate scripts to automate development environment configuration for new team members

★★☆ Intermediate 20 min January 13, 2025

Use Case

Onboarding new developers requires setting up consistent development environments. Cowork can create comprehensive setup scripts that automate the entire process.

Example Prompt

I need to create a development environment setup script for our team. The project requires:

- Node.js 20.x (via nvm)
- Python 3.11 (via pyenv)
- Docker Desktop
- PostgreSQL 15
- Redis
- VS Code with specific extensions
- Git configuration

Please create:
1. A setup.sh script for macOS
2. A setup.ps1 for Windows
3. A verification script to check everything is installed
4. A README with manual steps if needed

Save to ~/Projects/team-setup/

What Cowork Does

  1. Requirement Analysis: Parses software requirements
  2. Script Generation: Creates platform-specific installers
  3. Dependency Order: Sequences installations correctly
  4. Verification: Adds health checks for each component
  5. Documentation: Generates setup guides

Sample Output

#!/bin/bash
# setup.sh - macOS Development Environment Setup

set -e

echo "🚀 Starting development environment setup..."

# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
NC='\033[0m'

# Check for Homebrew
if ! command -v brew &> /dev/null; then
    echo "Installing Homebrew..."
    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
fi

# Install nvm
echo "📦 Installing nvm..."
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"

# Install Node.js 20
echo "📦 Installing Node.js 20..."
nvm install 20
nvm use 20
nvm alias default 20

# Install pyenv
echo "🐍 Installing pyenv..."
brew install pyenv
echo 'eval "$(pyenv init -)"' >> ~/.zshrc
eval "$(pyenv init -)"

# Install Python 3.11
pyenv install 3.11.0
pyenv global 3.11.0

# Install Docker Desktop
echo "🐳 Installing Docker..."
brew install --cask docker

# Install PostgreSQL 15
echo "🐘 Installing PostgreSQL..."
brew install postgresql@15
brew services start postgresql@15

# Install Redis
echo "📮 Installing Redis..."
brew install redis
brew services start redis

# Install VS Code
echo "📝 Installing VS Code..."
brew install --cask visual-studio-code

# VS Code Extensions
echo "Installing VS Code extensions..."
EXTENSIONS=(
    "ms-python.python"
    "dbaeumer.vscode-eslint"
    "esbenp.prettier-vscode"
    "ms-azuretools.vscode-docker"
    "eamodio.gitlens"
    "bradlc.vscode-tailwindcss"
)

for ext in "${EXTENSIONS[@]}"; do
    code --install-extension "$ext" || true
done

# Git configuration
echo "🔧 Configuring Git..."
read -p "Enter your Git name: " git_name
read -p "Enter your Git email: " git_email
git config --global user.name "$git_name"
git config --global user.email "$git_email"
git config --global init.defaultBranch main
git config --global pull.rebase true

echo -e "${GREEN}✅ Setup complete!${NC}"
echo "Please restart your terminal for all changes to take effect."
#!/bin/bash
# verify.sh - Verify installation

echo "🔍 Verifying installations..."

check_command() {
    if command -v $1 &> /dev/null; then
        echo "✅ $1: $($1 --version 2>&1 | head -1)"
    else
        echo "❌ $1: NOT FOUND"
        return 1
    fi
}

check_service() {
    if brew services list | grep "$1" | grep -q "started"; then
        echo "✅ $1 service: running"
    else
        echo "❌ $1 service: not running"
        return 1
    fi
}

FAILED=0

check_command node || FAILED=1
check_command npm || FAILED=1
check_command python3 || FAILED=1
check_command docker || FAILED=1
check_command psql || FAILED=1
check_command redis-cli || FAILED=1
check_command code || FAILED=1
check_command git || FAILED=1

check_service postgresql@15 || FAILED=1
check_service redis || FAILED=1

if [ $FAILED -eq 0 ]; then
    echo ""
    echo "🎉 All checks passed!"
else
    echo ""
    echo "⚠️  Some checks failed. Please review above."
fi

Tips

  • Keep scripts idempotent (safe to run multiple times)
  • Include version pinning for reproducibility
  • Add rollback/uninstall options
  • Test on fresh systems before sharing