start-local

Start local development environment with auto-detected services in a persistent tmux session

Best use case

start-local is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Start local development environment with auto-detected services in a persistent tmux session

Teams using start-local should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/start-local/SKILL.md --create-dirs "https://raw.githubusercontent.com/stevengonsalvez/agents-in-a-box/main/toolkit/packages/skills/start-local/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/start-local/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How start-local Compares

Feature / Agentstart-localStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Start local development environment with auto-detected services in a persistent tmux session

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# /start-local - Start Local Development Environment in tmux

Start local development environment with auto-detected services in a persistent tmux session.

## Usage

```bash
/start-local                 # Uses .env or .env.development
/start-local staging         # Uses .env.staging
/start-local production      # Uses .env.production
```

## Process

### Step 1: Determine Environment

```bash
ENVIRONMENT=${1:-development}
ENV_FILE=".env.${ENVIRONMENT}"

# Fallback to .env if specific file doesn't exist
if [ ! -f "$ENV_FILE" ] && [ "$ENVIRONMENT" = "development" ]; then
    ENV_FILE=".env"
fi

if [ ! -f "$ENV_FILE" ]; then
    echo "❌ Environment file not found: $ENV_FILE"
    ls -1 .env* 2>/dev/null
    exit 1
fi
```

### Step 2: Detect Project Type

```bash
detect_project_type() {
    if [ -f "package.json" ]; then
        grep -q "\"next\":" package.json && echo "nextjs" && return
        grep -q "\"vite\":" package.json && echo "vite" && return
        grep -q "\"react-scripts\":" package.json && echo "cra" && return
        grep -q "\"@vue/cli\":" package.json && echo "vue" && return
        echo "node"
    elif [ -f "requirements.txt" ] || [ -f "pyproject.toml" ]; then
        grep -q "django" requirements.txt pyproject.toml 2>/dev/null && echo "django" && return
        grep -q "flask" requirements.txt pyproject.toml 2>/dev/null && echo "flask" && return
        echo "python"
    elif [ -f "Cargo.toml" ]; then
        echo "rust"
    elif [ -f "go.mod" ]; then
        echo "go"
    else
        echo "unknown"
    fi
}

PROJECT_TYPE=$(detect_project_type)
```

### Step 3: Detect Required Services

```bash
NEEDS_SUPABASE=false
NEEDS_POSTGRES=false
NEEDS_REDIS=false

[ -f "supabase/config.toml" ] && NEEDS_SUPABASE=true
grep -q "postgres" "$ENV_FILE" 2>/dev/null && NEEDS_POSTGRES=true
grep -q "redis" "$ENV_FILE" 2>/dev/null && NEEDS_REDIS=true
```

### Step 4: Generate Random Port

```bash
DEV_PORT=$(shuf -i 3000-9999 -n 1)

while lsof -i :$DEV_PORT >/dev/null 2>&1; do
    DEV_PORT=$(shuf -i 3000-9999 -n 1)
done
```

### Step 5: Create tmux Session

```bash
PROJECT_NAME=$(basename "$(pwd)")
BRANCH=$(git branch --show-current 2>/dev/null || echo "main")
TIMESTAMP=$(date +%s)
SESSION="dev-${PROJECT_NAME}-${TIMESTAMP}"

tmux new-session -d -s "$SESSION" -n servers
```

### Step 6: Start Services

```bash
PANE_COUNT=0

# Main dev server
case $PROJECT_TYPE in
    nextjs|vite|cra|vue)
        tmux send-keys -t "$SESSION:servers.${PANE_COUNT}" "PORT=$DEV_PORT npm run dev 2>&1 | tee dev-server-${DEV_PORT}.log" C-m
        ;;
    django)
        tmux send-keys -t "$SESSION:servers.${PANE_COUNT}" "python manage.py runserver $DEV_PORT 2>&1 | tee dev-server-${DEV_PORT}.log" C-m
        ;;
    flask)
        tmux send-keys -t "$SESSION:servers.${PANE_COUNT}" "FLASK_RUN_PORT=$DEV_PORT flask run 2>&1 | tee dev-server-${DEV_PORT}.log" C-m
        ;;
    *)
        tmux send-keys -t "$SESSION:servers.${PANE_COUNT}" "PORT=$DEV_PORT npm run dev 2>&1 | tee dev-server-${DEV_PORT}.log" C-m
        ;;
esac

# Additional services (if needed)
if [ "$NEEDS_SUPABASE" = true ]; then
    PANE_COUNT=$((PANE_COUNT + 1))
    tmux split-window -v -t "$SESSION:servers"
    tmux send-keys -t "$SESSION:servers.${PANE_COUNT}" "supabase start" C-m
fi

if [ "$NEEDS_POSTGRES" = true ] && [ "$NEEDS_SUPABASE" = false ]; then
    PANE_COUNT=$((PANE_COUNT + 1))
    tmux split-window -v -t "$SESSION:servers"
    tmux send-keys -t "$SESSION:servers.${PANE_COUNT}" "docker-compose up postgres" C-m
fi

if [ "$NEEDS_REDIS" = true ]; then
    PANE_COUNT=$((PANE_COUNT + 1))
    tmux split-window -v -t "$SESSION:servers"
    tmux send-keys -t "$SESSION:servers.${PANE_COUNT}" "redis-server" C-m
fi

tmux select-layout -t "$SESSION:servers" tiled
```

### Step 7: Create Additional Windows

```bash
# Logs window
tmux new-window -t "$SESSION" -n logs
tmux send-keys -t "$SESSION:logs" "tail -f dev-server-${DEV_PORT}.log 2>/dev/null || sleep infinity" C-m

# Work window
tmux new-window -t "$SESSION" -n work

# Git window
tmux new-window -t "$SESSION" -n git
tmux send-keys -t "$SESSION:git" "git status" C-m
```

### Step 8: Save Metadata

```bash
cat > .tmux-dev-session.json <<EOF
{
  "session": "$SESSION",
  "project_name": "$PROJECT_NAME",
  "branch": "$BRANCH",
  "type": "$PROJECT_TYPE",
  "environment": "$ENVIRONMENT",
  "env_file": "$ENV_FILE",
  "dev_port": $DEV_PORT,
  "created": "$(date -Iseconds)"
}
EOF
```

### Step 9: Display Summary

```bash
echo ""
echo "✨ Dev Environment Started: $SESSION"
echo ""
echo "Environment: $ENVIRONMENT ($ENV_FILE)"
echo "Dev Server: http://localhost:$DEV_PORT"
[ "$NEEDS_SUPABASE" = true ] && echo "Supabase: http://localhost:54321"
echo ""
echo "Attach: tmux attach -t $SESSION"
echo "Detach: Ctrl+a d"
echo "Status: /tmux-status"
echo ""
```

## Notes

- Auto-detects framework/stack from project files
- Auto-detects services from .env and config files
- Random ports prevent conflicts
- Session persists across disconnects
- Metadata saved to `.tmux-dev-session.json`

Related Skills

start-ios

8
from stevengonsalvez/agents-in-a-box

Start iOS development with Simulator, dev server, and optional Poltergeist auto-rebuild

start-android

8
from stevengonsalvez/agents-in-a-box

Start Android development with Emulator, dev server, and optional Poltergeist auto-rebuild

workflow

8
from stevengonsalvez/agents-in-a-box

Guide through structured delivery workflow with plan, implement, validate phases

webapp-testing

8
from stevengonsalvez/agents-in-a-box

Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.

validate

8
from stevengonsalvez/agents-in-a-box

Verify implementation against specifications

ui-ux-pro-max

8
from stevengonsalvez/agents-in-a-box

UI/UX design intelligence. 67 styles, 96 palettes, 57 font pairings, 25 charts, 13 stacks (React, Next.js, Vue, Svelte, Astro, Nuxt, SwiftUI, React Native, Flutter, Tailwind, shadcn/ui, Jetpack Compose). Actions: plan, build, create, design, implement, review, fix, improve, optimize, enhance, refactor, check UI/UX code. Projects: website, landing page, dashboard, admin panel, e-commerce, SaaS, portfolio, blog, mobile app, .html, .tsx, .vue, .svelte. Elements: button, modal, navbar, sidebar, card, table, form, chart. Styles: glassmorphism, claymorphism, minimalism, brutalism, neumorphism, bento grid, dark mode, responsive, skeuomorphism, flat design. Topics: color palette, accessibility, animation, layout, typography, font pairing, spacing, hover, shadow, gradient.

tui-style-guide

8
from stevengonsalvez/agents-in-a-box

TUI style guide for consistent terminal interface design

token-usage

8
from stevengonsalvez/agents-in-a-box

Show Claude Code token usage across sessions — daily, weekly, per-project, and per-session breakdowns. Parses {{HOME_TOOL_DIR}}/projects/**/*.jsonl for consumption data. Use when the user asks about token usage, costs, how many tokens were used, session statistics, or wants a usage report.

tmux-status

8
from stevengonsalvez/agents-in-a-box

Show status of all tmux sessions including dev environments, spawned agents, and running processes

tmux-monitor

8
from stevengonsalvez/agents-in-a-box

Monitor and report status of all tmux sessions including dev environments, spawned agents, and running processes. Uses tmuxwatch for enhanced visibility.

tmux-message

8
from stevengonsalvez/agents-in-a-box

Reliable peer-to-peer message delivery to other Claude Code instances via tmux send-keys. Use as a fallback when claude-peers MCP send_message fails to surface in the receiver's inbox (delivered server-side but receiver never picks it up — observed behaviour). Also use when sending a directive to a known Claude Code TUI session by tmux session name or fuzzy hint, or when injecting a multi-line directive into a peer's prompt and submitting it. Trigger phrases — "claude-peers fallback", "tmux send-keys", "send to peer via tmux", "inject directive", "deliver to nanoclaw/hermes peer", "peer message". Tmux-only — won't reach peers running outside tmux.

test-driven-development

8
from stevengonsalvez/agents-in-a-box

Use when implementing any feature or bugfix, before writing implementation code. Enforces RED-GREEN-REFACTOR cycle with test-first approach.