Guide developers through setting up development environments with proper tools, dependencies, and configurations
Add this skill
npx mdskills install sickn33/environment-setup-guideComprehensive environment setup guide with excellent platform-specific examples and troubleshooting
1---2name: environment-setup-guide3description: "Guide developers through setting up development environments with proper tools, dependencies, and configurations"4---56# Environment Setup Guide78## Overview910Help developers set up complete development environments from scratch. This skill provides step-by-step guidance for installing tools, configuring dependencies, setting up environment variables, and verifying the setup works correctly.1112## When to Use This Skill1314- Use when starting a new project and need to set up the development environment15- Use when onboarding new team members to a project16- Use when switching to a new machine or operating system17- Use when troubleshooting environment-related issues18- Use when documenting setup instructions for a project19- Use when creating development environment documentation2021## How It Works2223### Step 1: Identify Requirements2425I'll help you determine what needs to be installed:26- Programming language and version (Node.js, Python, Go, etc.)27- Package managers (npm, pip, cargo, etc.)28- Database systems (PostgreSQL, MongoDB, Redis, etc.)29- Development tools (Git, Docker, IDE extensions, etc.)30- Environment variables and configuration files3132### Step 2: Check Current Setup3334Before installing anything, I'll help you check what's already installed:35```bash36# Check versions of installed tools37node --version38python --version39git --version40docker --version41```4243### Step 3: Provide Installation Instructions4445I'll give platform-specific installation commands:46- **macOS:** Using Homebrew47- **Linux:** Using apt, yum, or package manager48- **Windows:** Using Chocolatey, Scoop, or direct installers4950### Step 4: Configure the Environment5152Help set up:53- Environment variables (.env files)54- Configuration files (.gitconfig, .npmrc, etc.)55- IDE settings (VS Code, IntelliJ, etc.)56- Shell configuration (.bashrc, .zshrc, etc.)5758### Step 5: Verify Installation5960Provide verification steps to ensure everything works:61- Run version checks62- Test basic commands63- Verify database connections64- Check environment variables are loaded6566## Examples6768### Example 1: Node.js Project Setup6970```markdown71## Setting Up Node.js Development Environment7273### Prerequisites74- macOS, Linux, or Windows75- Terminal/Command Prompt access76- Internet connection7778### Step 1: Install Node.js7980**macOS (using Homebrew):**81\`\`\`bash82# Install Homebrew if not installed83/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"8485# Install Node.js86brew install node87\`\`\`8889**Linux (Ubuntu/Debian):**90\`\`\`bash91# Update package list92sudo apt update9394# Install Node.js and npm95curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -96sudo apt install -y nodejs97\`\`\`9899**Windows (using Chocolatey):**100\`\`\`powershell101# Install Chocolatey if not installed102Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))103104# Install Node.js105choco install nodejs106\`\`\`107108### Step 2: Verify Installation109110\`\`\`bash111node --version # Should show v20.x.x or higher112npm --version # Should show 10.x.x or higher113\`\`\`114115### Step 3: Install Project Dependencies116117\`\`\`bash118# Clone the repository119git clone https://github.com/your-repo/project.git120cd project121122# Install dependencies123npm install124\`\`\`125126### Step 4: Set Up Environment Variables127128Create a \`.env\` file:129\`\`\`bash130# Copy example environment file131cp .env.example .env132133# Edit with your values134nano .env135\`\`\`136137Example \`.env\` content:138\`\`\`139NODE_ENV=development140PORT=3000141DATABASE_URL=postgresql://localhost:5432/mydb142API_KEY=your-api-key-here143\`\`\`144145### Step 5: Run the Project146147\`\`\`bash148# Start development server149npm run dev150151# Should see: Server running on http://localhost:3000152\`\`\`153154### Troubleshooting155156**Problem:** "node: command not found"157**Solution:** Restart your terminal or run \`source ~/.bashrc\` (Linux) or \`source ~/.zshrc\` (macOS)158159**Problem:** "Permission denied" errors160**Solution:** Don't use sudo with npm. Fix permissions:161\`\`\`bash162mkdir ~/.npm-global163npm config set prefix '~/.npm-global'164echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.bashrc165source ~/.bashrc166\`\`\`167```168169### Example 2: Python Project Setup170171```markdown172## Setting Up Python Development Environment173174### Step 1: Install Python175176**macOS:**177\`\`\`bash178brew install python@3.11179\`\`\`180181**Linux:**182\`\`\`bash183sudo apt update184sudo apt install python3.11 python3.11-venv python3-pip185\`\`\`186187**Windows:**188\`\`\`powershell189choco install python --version=3.11190\`\`\`191192### Step 2: Verify Installation193194\`\`\`bash195python3 --version # Should show Python 3.11.x196pip3 --version # Should show pip 23.x.x197\`\`\`198199### Step 3: Create Virtual Environment200201\`\`\`bash202# Navigate to project directory203cd my-project204205# Create virtual environment206python3 -m venv venv207208# Activate virtual environment209# macOS/Linux:210source venv/bin/activate211212# Windows:213venv\Scripts\activate214\`\`\`215216### Step 4: Install Dependencies217218\`\`\`bash219# Install from requirements.txt220pip install -r requirements.txt221222# Or install packages individually223pip install flask sqlalchemy python-dotenv224\`\`\`225226### Step 5: Set Up Environment Variables227228Create \`.env\` file:229\`\`\`230FLASK_APP=app.py231FLASK_ENV=development232DATABASE_URL=sqlite:///app.db233SECRET_KEY=your-secret-key-here234\`\`\`235236### Step 6: Run the Application237238\`\`\`bash239# Run Flask app240flask run241242# Should see: Running on http://127.0.0.1:5000243\`\`\`244```245246### Example 3: Docker Development Environment247248```markdown249## Setting Up Docker Development Environment250251### Step 1: Install Docker252253**macOS:**254\`\`\`bash255brew install --cask docker256# Or download Docker Desktop from docker.com257\`\`\`258259**Linux:**260\`\`\`bash261# Install Docker262curl -fsSL https://get.docker.com -o get-docker.sh263sudo sh get-docker.sh264265# Add user to docker group266sudo usermod -aG docker $USER267newgrp docker268\`\`\`269270**Windows:**271Download Docker Desktop from docker.com272273### Step 2: Verify Installation274275\`\`\`bash276docker --version # Should show Docker version 24.x.x277docker-compose --version # Should show Docker Compose version 2.x.x278\`\`\`279280### Step 3: Create docker-compose.yml281282\`\`\`yaml283version: '3.8'284285services:286 app:287 build: .288 ports:289 - "3000:3000"290 environment:291 - NODE_ENV=development292 - DATABASE_URL=postgresql://postgres:password@db:5432/mydb293 volumes:294 - .:/app295 - /app/node_modules296 depends_on:297 - db298299 db:300 image: postgres:15301 environment:302 - POSTGRES_USER=postgres303 - POSTGRES_PASSWORD=password304 - POSTGRES_DB=mydb305 ports:306 - "5432:5432"307 volumes:308 - postgres_data:/var/lib/postgresql/data309310volumes:311 postgres_data:312\`\`\`313314### Step 4: Start Services315316\`\`\`bash317# Build and start containers318docker-compose up -d319320# View logs321docker-compose logs -f322323# Stop services324docker-compose down325\`\`\`326327### Step 5: Verify Services328329\`\`\`bash330# Check running containers331docker ps332333# Test database connection334docker-compose exec db psql -U postgres -d mydb335\`\`\`336```337338## Best Practices339340### ✅ Do This341342- **Document Everything** - Write clear setup instructions343- **Use Version Managers** - nvm for Node, pyenv for Python344- **Create .env.example** - Show required environment variables345- **Test on Clean System** - Verify instructions work from scratch346- **Include Troubleshooting** - Document common issues and solutions347- **Use Docker** - For consistent environments across machines348- **Pin Versions** - Specify exact versions in package files349- **Automate Setup** - Create setup scripts when possible350- **Check Prerequisites** - List required tools before starting351- **Provide Verification Steps** - Help users confirm setup works352353### ❌ Don't Do This354355- **Don't Assume Tools Installed** - Always check and provide install instructions356- **Don't Skip Environment Variables** - Document all required variables357- **Don't Use Sudo with npm** - Fix permissions instead358- **Don't Forget Platform Differences** - Provide OS-specific instructions359- **Don't Leave Out Verification** - Always include test steps360- **Don't Use Global Installs** - Prefer local/virtual environments361- **Don't Ignore Errors** - Document how to handle common errors362- **Don't Skip Database Setup** - Include database initialization steps363364## Common Pitfalls365366### Problem: "Command not found" after installation367**Symptoms:** Installed tool but terminal doesn't recognize it368**Solution:**369- Restart terminal or source shell config370- Check PATH environment variable371- Verify installation location372```bash373# Check PATH374echo $PATH375376# Add to PATH (example)377export PATH="/usr/local/bin:$PATH"378```379380### Problem: Permission errors with npm/pip381**Symptoms:** "EACCES" or "Permission denied" errors382**Solution:**383- Don't use sudo384- Fix npm permissions or use nvm385- Use virtual environments for Python386```bash387# Fix npm permissions388mkdir ~/.npm-global389npm config set prefix '~/.npm-global'390echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.bashrc391```392393### Problem: Port already in use394**Symptoms:** "Port 3000 is already in use"395**Solution:**396- Find and kill process using the port397- Use a different port398```bash399# Find process on port 3000400lsof -i :3000401402# Kill process403kill -9 <PID>404405# Or use different port406PORT=3001 npm start407```408409### Problem: Database connection fails410**Symptoms:** "Connection refused" or "Authentication failed"411**Solution:**412- Verify database is running413- Check connection string414- Verify credentials415```bash416# Check if PostgreSQL is running417sudo systemctl status postgresql418419# Test connection420psql -h localhost -U postgres -d mydb421```422423## Setup Script Template424425Create a `setup.sh` script to automate setup:426427```bash428#!/bin/bash429430echo "🚀 Setting up development environment..."431432# Check prerequisites433command -v node >/dev/null 2>&1 || { echo "❌ Node.js not installed"; exit 1; }434command -v git >/dev/null 2>&1 || { echo "❌ Git not installed"; exit 1; }435436echo "✅ Prerequisites check passed"437438# Install dependencies439echo "📦 Installing dependencies..."440npm install441442# Copy environment file443if [ ! -f .env ]; then444 echo "📝 Creating .env file..."445 cp .env.example .env446 echo "⚠️ Please edit .env with your configuration"447fi448449# Run database migrations450echo "🗄️ Running database migrations..."451npm run migrate452453# Verify setup454echo "🔍 Verifying setup..."455npm run test:setup456457echo "✅ Setup complete! Run 'npm run dev' to start"458```459460## Related Skills461462- `@brainstorming` - Plan environment requirements before setup463- `@systematic-debugging` - Debug environment issues464- `@doc-coauthoring` - Create setup documentation465- `@git-pushing` - Set up Git configuration466467## Additional Resources468469- [Node.js Installation Guide](https://nodejs.org/en/download/)470- [Python Virtual Environments](https://docs.python.org/3/tutorial/venv.html)471- [Docker Documentation](https://docs.docker.com/get-started/)472- [Homebrew (macOS)](https://brew.sh/)473- [Chocolatey (Windows)](https://chocolatey.org/)474- [nvm (Node Version Manager)](https://github.com/nvm-sh/nvm)475- [pyenv (Python Version Manager)](https://github.com/pyenv/pyenv)476477---478479**Pro Tip:** Create a `setup.sh` or `setup.ps1` script to automate the entire setup process. Test it on a clean system to ensure it works!480
Full transparency — inspect the skill content before installing.