home / skills / trentshaines / dotfiles / trent-local-server

trent-local-server skill

/dot_claude/skills/trent-local-server

This skill deploys a local development server by launching backend and frontend in separate tmux panes for quick, parallel dev workflows.

npx playbooks add skill trentshaines/dotfiles --skill trent-local-server

Review the files below or copy the command above to add this skill to your agents.

Files (1)
SKILL.md
1.6 KB
---
name: trent-local-server
description: Deploy the duet local development server (backend + frontend) in tmux panes. Use when the user asks to start the local server, run the dev environment, or start backend/frontend.
---

# Local Server Deployment

Deploy the local development server by running both backend and frontend in separate tmux panes.

## Instructions

1. Split the current tmux pane horizontally to create a second pane
2. Split again to create a third pane (for the original shell to remain usable)
3. In the first split pane, run the backend:
   ```bash
   uv pip install -r backend/requirements.in && uvicorn backend.server_cs.server:app --reload
   ```
4. In the second split pane, run the frontend:
   ```bash
   cd frontend && yarn run dev --webpack
   ```

## Tmux Commands

Use pane IDs for robustness (relative targets like `{right}` fail when other panes exist):

```bash
# Split horizontally for backend, capturing the pane ID
BACKEND_PANE=$(tmux split-window -h -P -F '#{pane_id}')

# Run backend install and server in that pane using its ID
tmux send-keys -t "$BACKEND_PANE" 'uv pip install -r backend/requirements.in && uvicorn backend.server_cs.server:app --reload' Enter

# Split the backend pane vertically for frontend, capturing the pane ID
FRONTEND_PANE=$(tmux split-window -v -t "$BACKEND_PANE" -P -F '#{pane_id}')

# Run frontend in the new pane using its ID
tmux send-keys -t "$FRONTEND_PANE" 'cd frontend && yarn run dev --webpack' Enter
```

## Expected Result

- Backend API running at http://localhost:8000 (with hot reload)
- Frontend Next.js dev server running at http://localhost:3000
- Original pane remains available for other commands

Overview

This skill deploys a local development environment by launching backend and frontend dev servers in separate tmux panes. It automates pane creation and runs installation and start commands so the original shell stays available. Use it to quickly spin up both parts of the app with hot reload enabled.

How this skill works

The skill splits the current tmux session into dedicated panes, captures each pane ID, and sends commands to install dependencies and start the servers. The backend pane runs pip install and starts a Uvicorn app with --reload. The frontend pane changes into the frontend directory and runs the Next.js/Yarn dev server. Pane IDs are used to target commands reliably.

When to use it

  • You need to run both backend and frontend dev servers concurrently.
  • You want hot-reloading for backend and frontend during development.
  • You prefer a tmux-based workflow with separate panes for each service.
  • You need the original shell left available for other tasks or commands.

Best practices

  • Run the commands from the project root so relative paths resolve correctly.
  • Start tmux before invoking the skill to ensure panes are created in your current session.
  • Use captured pane IDs rather than relative targets to avoid targeting the wrong pane.
  • Keep dependency installs in a separate one-time step unless you need fresh installs each run.
  • Monitor logs in each pane and restart individual panes if a process crashes.

Example use cases

  • Spin up the API (Uvicorn) and frontend (Next.js) for local feature development and testing.
  • Quickly recreate the dev environment after a restart or when switching branches.
  • Run both servers during a demo while keeping a free pane for database queries or git commands.
  • Enable hot reload on both backend and frontend to speed up iterative development.

FAQ

Do I need tmux installed?

Yes. This skill uses tmux to create and control panes. Install tmux via your package manager if it is not present.

Can I change ports or commands?

Yes. Modify the send-keys commands to change ports, use a different process manager, or add environment variables before starting each server.