toolkit/packages/skills/start-local/SKILL.md
Start local development environment with auto-detected services in a persistent tmux session
npx skillsauth add stevengonsalvez/agents-in-a-box start-localInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Start local development environment with auto-detected services in a persistent tmux session.
/start-local # Uses .env or .env.development
/start-local staging # Uses .env.staging
/start-local production # Uses .env.production
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
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)
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
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
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
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
# 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
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
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 ""
.tmux-dev-session.jsondocumentation
Report reflect drain spend over a time window — tokens split by cached (cache_read), uncached writes (cache_creation), and io (input+output), with a $ estimate, grouped by day / outcome / model / transcript. Reads the drainer's cost log and surfaces outlier runs and cache-reuse health (the 41.5M-token failure mode = low cache reuse + high cache writes). Use to answer "what is reflection costing me" for the last day / week.
development
Show fleet status — every claude session running on the host, merged across ainb + claude-peers broker + background jobs. Use when you need to enumerate sessions before composing an action, see which sessions have a peer registered (broker-routable) vs tmux-only, check the `summary` of each session, or pipe the list into jq for filtering. Default output: text table. Pass --format json for LLM consumption.
testing
Ordered multi-step prompts to fleet targets, ack-gated between steps via JSONL assistant-turn-end detection. Use for cycles like disconnect→reconnect→verify, or any flow where step N+1 requires step N to have completed first. The skill BLOCKS until each target's transcript shows the next assistant turn finishing OR per-step timeout fires (default 300s).
development
Center control panel — enumerate every claude session that is blocked waiting on something: a user answer (AskUserQuestion fired), an API error retry, an idle assistant turn-end with no follow-up, or an explicit WAITING: marker. Returns rich JSON with signal kind + context per session. Use this when you've stepped away from the fleet and want one place to see everything that wants your attention and answer it.