dev-server
Start the project's dev server in the background and set up a persistent log monitor. Use this whenever the user asks to start, run, or boot the dev server, or says 'run the server', 'start it up', 'k
SKILL.mdskills/dev-server/SKILL.md
GitHubDev Server + Monitor
Start the project's dev server in the background and attach a persistent Monitor so you're notified automatically on any error or warning — without polling.
Step 1 — Detect the start command
Inspect the project root (current working directory) in this priority order:
package.json— usenpm run devif a"dev"script exists, otherwisenpm startif"start"exists, otherwisenpm run serveif"serve"exists.pyproject.toml/setup.py— look for a[project.scripts]entry or a common entrypoint. If the project usesuv, preferuv run <entrypoint>. If it uses plain Python, usepython -m <module>or the script name.Makefile— usemake devif the target exists, otherwisemake runormake serve.Procfile— parse theweb:line and use that command.docker-compose.yml/compose.yml— usedocker compose uponly if no lighter-weight option was found above.
If nothing is found, tell the user and ask them to specify the command. Do not guess.
Once you have the command, tell the user: "Detected start command: <command>" before proceeding.
Step 2 — Kill any existing instance
Kill any running process that matches the detected command so the new instance starts clean. Use pkill -f with a distinctive substring from the command (e.g., pkill -f navidrome-feed, pkill -f 'npm run dev'). Follow with sleep 1 to let the port release. Suppress errors from pkill with 2>/dev/null.
Step 3 — Start the server in the background
Run the server with output redirected to /tmp/dev-server.log (truncate first so old logs don't accumulate):
truncate -s 0 /tmp/dev-server.log
<start-command> >> /tmp/dev-server.log 2>&1
Use run_in_background: true so the Bash tool doesn't block.
Wait 4–5 seconds, then tail the last 15 lines of /tmp/dev-server.log and confirm the server started cleanly (look for a "started", "listening", "running", or "Application started" line). If you see an immediate crash or import error, report it and fix it before continuing.
Step 4 — Monitor only if issues were found
Do not start a Monitor unconditionally. Instead:
- Check the startup tail from Step 3 for any ERROR, WARNING, Traceback, or Exception lines.
- If the startup log is clean — tell the user "Server is running cleanly. No monitor started — I'll only look at logs if you report a problem." Stop here.
- If the startup log contains errors or warnings — start exactly one Monitor (persistent):
tail -f /tmp/dev-server.log | grep --line-buffered -E "ERROR|WARNING|Error|Traceback|Exception|CRITICAL|failed|❌"
Set persistent: true. Tell the user what error was found and that the monitor is now active.
Notes
- Log file is always
/tmp/dev-server.logso it's easy totailmanually too. - If the server needs env vars (
.envfile), make sure the shell inherits them —uv runandnpm runpick up.envautomatically; for raw Python you may needdotenv runor to source.envfirst. - Only start one Monitor per session. If one is already running (check if you've already spawned it this session), skip Step 4.