$npx -y skills add Undertone0809/rudder --skill stop-rudder-dev-maintainerUse when the user explicitly asks to stop, restart, kill, or clean Rudder repo-local pnpm dev processes or local dev runtime residue, including “把 pnpm dev 停了”, “重启 dev”, or “清掉 dev 残留”.
| 1 | # Stop Rudder Dev Maintainer |
| 2 | |
| 3 | Keep Rudder local dev runtime maintenance tight and safe. |
| 4 | |
| 5 | The job is usually simple: |
| 6 | |
| 7 | - identify the current Rudder dev runtime processes |
| 8 | - stop them gracefully |
| 9 | - confirm whether anything was actually running |
| 10 | |
| 11 | Do not broaden that into generic process cleanup for the whole machine. |
| 12 | |
| 13 | ## Fast Applicability Check |
| 14 | |
| 15 | Before doing any process or port investigation, classify the user's current |
| 16 | task: |
| 17 | |
| 18 | - Use the full workflow when the task is about the repo-local development |
| 19 | runtime, such as stopping or restarting `pnpm dev`. |
| 20 | - If the task is mainly about production/local-prod data, packaged Desktop, |
| 21 | organizations, database cleanup, backups, migrations, or API maintenance, |
| 22 | this skill is not the main workflow. Do not spend time inspecting broad |
| 23 | process lists for those tasks. |
| 24 | - If the user explicitly included this skill as a safety preflight for a |
| 25 | non-dev task, run only the bundled script once, report whether it found a |
| 26 | `pnpm dev` runtime, and move on. |
| 27 | |
| 28 | Packaged Desktop, `pnpm prod`, `pnpm rudder run`, and embedded Postgres owned by |
| 29 | `/Applications/Rudder.app` are out of scope. Leave them running unless the user |
| 30 | explicitly asks to stop the production/local-prod runtime. |
| 31 | |
| 32 | ## Scope |
| 33 | |
| 34 | This skill is only for the current Rudder checkout. |
| 35 | |
| 36 | It is designed around the repo-root development flow: |
| 37 | |
| 38 | ```bash |
| 39 | pnpm dev |
| 40 | ``` |
| 41 | |
| 42 | That flow launches `scripts/dev-shell.mjs`, which in turn manages the local dev runner and desktop shell. |
| 43 | |
| 44 | ## Default Workflow |
| 45 | |
| 46 | ### 1. Use the bundled script first |
| 47 | |
| 48 | From the repo root: |
| 49 | |
| 50 | ```bash |
| 51 | bash .agents/skills/maintainer/stop-rudder-dev-maintainer/scripts/stop_rudder_dev.sh |
| 52 | ``` |
| 53 | |
| 54 | Preview only: |
| 55 | |
| 56 | ```bash |
| 57 | bash .agents/skills/maintainer/stop-rudder-dev-maintainer/scripts/stop_rudder_dev.sh --dry-run |
| 58 | ``` |
| 59 | |
| 60 | If the script prints `No matching Rudder dev processes found.`, stop the skill |
| 61 | workflow there unless the user's request is specifically to diagnose why dev is |
| 62 | still running. Do not follow with broad `ps`, `lsof`, or app-process searches |
| 63 | just because another Rudder process exists. |
| 64 | |
| 65 | ### 2. What the script should target |
| 66 | |
| 67 | The script is allowed to stop only repo-local Rudder dev processes such as: |
| 68 | |
| 69 | - the root `pnpm dev` / `scripts/dev-shell.mjs` process |
| 70 | - `scripts/dev-runner.mjs` |
| 71 | - the desktop dev Electron process for this repo |
| 72 | - repo-local Rudder dev helper processes that belong to the same runtime |
| 73 | |
| 74 | It must not kill unrelated `pnpm`, `node`, `vite`, or Electron work from other repos. |
| 75 | It must not stop packaged Desktop or local production runtime processes. |
| 76 | |
| 77 | ### 3. Verification |
| 78 | |
| 79 | After stopping processes, verify with focused checks: |
| 80 | |
| 81 | ```bash |
| 82 | ps -Ao pid=,command= | rg 'scripts/dev-shell\.mjs|scripts/dev-runner\.mjs|electron/cli\.js dist/main\.js' |
| 83 | lsof -nP -iTCP:3100 -sTCP:LISTEN |
| 84 | ``` |
| 85 | |
| 86 | Use the verification to distinguish these cases clearly: |
| 87 | |
| 88 | - nothing was running |
| 89 | - Rudder dev was running and is now stopped |
| 90 | - some targeted processes survived graceful shutdown |
| 91 | |
| 92 | Run these verification checks after the script stops something or reports |
| 93 | survivors. For a simple "nothing was running" result, the script output is |
| 94 | enough unless the user asked for a deeper diagnosis. |
| 95 | |
| 96 | ## Escalation Rules |
| 97 | |
| 98 | - Prefer graceful shutdown with `SIGTERM`. |
| 99 | - If the bundled script reports survivors, show the exact survivors before using a hard kill. |
| 100 | - Use `--force` only when the user explicitly wants a hard stop or when graceful shutdown already failed and the user still wants everything down. |
| 101 | - Never use `pkill pnpm`, `killall node`, or similarly broad commands. |
| 102 | |
| 103 | ## Restart Requests |
| 104 | |
| 105 | If the user asks to restart dev: |
| 106 | |
| 107 | 1. stop the current Rudder dev runtime with the bundled script |
| 108 | 2. verify that the old runtime is gone |
| 109 | 3. start the requested dev command |
| 110 | 4. report the new process state |
| 111 | |
| 112 | Do not assume restart means "kill every local development process". |
| 113 | |
| 114 | ## Report Format |
| 115 | |
| 116 | Reply briefly with: |
| 117 | |
| 118 | - whether a running Rudder dev runtime was found |
| 119 | - which process groups were stopped |
| 120 | - whether anything survived graceful shutdown |
| 121 | |
| 122 | Example: |
| 123 | |
| 124 | ```text |
| 125 | 已停止当前 Rudder `pnpm dev` 运行时。 |
| 126 | 关闭了 `scripts/dev-shell.mjs` 和其子进程,`3100` 端口当前没有监听。 |
| 127 | ``` |