name: dev-script description: Generate a dev.sh script that uses tmux to manage development services (dev server, database, etc.) with flags for clean, restart, down, and db-only modes. argument-hint: "[project-name]" disable-model-invocation: true
Dev Script Generator
Generate a dev.sh bash script for the current project. The script uses tmux to manage development services in named sessions with split panes.
When to Use
Use this skill when the user needs to:
- •Set up a tmux-based development environment with multiple services
- •Generate a script for managing dev server, database, and other services
- •Create a standardized dev.sh script with common flags (--clean, --db, --restart, --down)
- •Automate development workflow with tmux sessions and split panes
Steps
- •
Gather Required Information Ask the user for the following if not provided via
$ARGUMENTSor context:- •Session/project name — used as the tmux session name (e.g.,
myapp) - •Services to run — what commands run in each pane (e.g.,
bun dev,docker compose up,cargo watch) - •Package manager — for the
--cleanflag reinstall step (e.g.,bun,npm,pnpm) - •Files to remove on clean — lock files and dependency dirs to delete (e.g.,
node_modules bun.lockb)
- •Session/project name — used as the tmux session name (e.g.,
- •
Generate the dev.sh Script
The generated
dev.shmust follow this exact pattern:Argument parsing
Support these flags via a
for arg in "$@"loop withcase:Flag Variable Purpose --cleanCLEANFull teardown: stop services, delete deps, reinstall, then start --dbDB_ONLYStart only the database/infrastructure service --restartRESTARTKill existing session and recreate --downDOWNShut everything down and exit All default to
false.Session existence check
bashSESSION_EXISTS=false if tmux has-session -t <name> 2>/dev/null; then SESSION_EXISTS=true fiMode handlers (in this order)
- •--down: Kill tmux session if exists, stop infrastructure (e.g.,
docker compose down), thenexit 0. - •--clean: Kill session, stop infrastructure with
-v, remove dependency files, reinstall,sleep 1, setSESSION_EXISTS=false. Does NOT exit — falls through to start. - •--db: Kill existing session, create new session with only the infrastructure service, attach,
exit 0. - •--restart / session exists: Kill existing session, fall through to creation.
Session creation
- •Create a detached tmux session with the first service in the first pane
- •Split the window vertically for each additional service
- •Select the first pane after setup
- •Print what was created
Attach
bashtmux attach -t <name>
- •--down: Kill tmux session if exists, stop infrastructure (e.g.,
- •
Output the Script Write the script to
dev.shin the project root and make it executable withchmod +x dev.sh.