$npx -y skills add Undertone0809/rudder --skill rudder-worktree-preview-maintainerUse when starting the current Rudder checkout as a temporary managed local preview with a stable URL, readiness check, logs, stop command, and cleanup path for manual inspection of the current branch or worktree.
| 1 | # Rudder Worktree Preview Maintainer |
| 2 | |
| 3 | Run the current Rudder checkout as a temporary preview so the user can inspect |
| 4 | the feature in a browser without leaving a foreground command running. |
| 5 | |
| 6 | This skill is for the common post-implementation hand-off: the branch already |
| 7 | contains the work, and the user wants a local URL to test. It is not a PR |
| 8 | checkout workflow, it is not a broad process cleanup workflow, and it is not |
| 9 | the canonical developer environment for Codex-managed worktrees. |
| 10 | |
| 11 | Rudder's normal `pnpm dev` entrypoint is the canonical development path. In |
| 12 | Codex-managed worktrees under `~/.codex/worktrees/<id>/<repo>`, `pnpm dev` |
| 13 | auto-derives an isolated `RUDDER_HOME`, instance id, server port, embedded |
| 14 | PostgreSQL port, and worktree branding when no repo-local `.rudder/` config |
| 15 | exists. Use this preview skill only when the user wants a managed background |
| 16 | preview handoff with health verification, logs, and a stop command. |
| 17 | |
| 18 | Preview readiness is environment proof, not product proof. A healthy URL means |
| 19 | the checkout can be opened; it does not prove that a feature, workflow, agent |
| 20 | path, or UI regression is fixed. When this skill is used inside a lifecycle |
| 21 | handoff or review gate, the owning workflow must still exercise the relevant |
| 22 | route, command, agent run, or Desktop/browser interaction and report the |
| 23 | observed terminal state. |
| 24 | |
| 25 | ## Use This Skill When |
| 26 | |
| 27 | - The user asks to run the current branch or current worktree locally. |
| 28 | - The user wants to manually test a recently implemented UI or workflow change. |
| 29 | - The assistant needs to hand off a stable preview URL after implementation |
| 30 | without leaving `pnpm dev` in the foreground. |
| 31 | - The user asks for logs, a stop command, or a temporary preview that can be |
| 32 | cleaned up independently. |
| 33 | - The task is to provide a preview URL, not to package Desktop or publish a |
| 34 | release. |
| 35 | |
| 36 | ## Do Not Use This Skill When |
| 37 | |
| 38 | - The user asks to check out or preview a GitHub PR; use |
| 39 | `pr-local-preview-maintainer` instead. |
| 40 | - The user asks only to stop or clean local dev processes; use |
| 41 | `stop-rudder-dev-maintainer` instead. |
| 42 | - The user is asking why Codex worktrees interfere, how normal development |
| 43 | should be isolated, or whether `pnpm dev` is using the current worktree. In |
| 44 | that case inspect `scripts/dev-local-env.mjs`, `doc/engineering/DEVELOPING.md`, and the |
| 45 | `/api/health` payload for the active dev runtime. |
| 46 | - The user simply wants to develop inside the current Codex worktree. Use |
| 47 | `pnpm dev`, which should auto-isolate Codex-managed worktrees, instead of |
| 48 | starting a separate `/tmp/rudder-worktree-preview` instance. |
| 49 | - The change needs packaged Desktop verification; follow the Desktop validation |
| 50 | workflow in the repo docs. |
| 51 | - The user wants production-like `pnpm prod` behavior rather than a dev preview. |
| 52 | |
| 53 | ## Default Workflow |
| 54 | |
| 55 | ### 1. Inspect the current worktree |
| 56 | |
| 57 | Start from the repository root and record the current branch: |
| 58 | |
| 59 | ```bash |
| 60 | git status --short --branch |
| 61 | git branch --show-current |
| 62 | ``` |
| 63 | |
| 64 | Do not switch branches, reset files, or stop unrelated runtimes. A dirty |
| 65 | worktree is normal after implementation work. |
| 66 | |
| 67 | ### 2. Choose isolated runtime settings |
| 68 | |
| 69 | The preview is intentionally temporary and may use a different instance than |
| 70 | the canonical `pnpm dev` runtime for the same worktree. Tell the user this if |
| 71 | they are comparing data between surfaces. |
| 72 | |
| 73 | Prefer a branch-derived instance id, a non-default app port, and an isolated |
| 74 | `RUDDER_HOME` under `/tmp`: |
| 75 | |
| 76 | ```text |
| 77 | RUDDER_INSTANCE_ID=<branch-slug> |
| 78 | PORT=<free-port> |
| 79 | RUDDER_HOME=/tmp/rudder-worktree-preview/<branch-slug>/home |
| 80 | ``` |
| 81 | |
| 82 | Use `3100` only when the user explicitly asks for the default dev runtime and |
| 83 | the port is free. Otherwise choose a free port starting near `3310`. |
| 84 | |
| 85 | If the user wants the same data and instance as their normal Codex worktree |
| 86 | development surface, do not use this launcher by default. Start or inspect |
| 87 | `pnpm dev` instead and verify the `/api/health` response matches the expected |
| 88 | worktree-derived instance id. |
| 89 | |
| 90 | If embedded PostgreSQL works, use a free |
| 91 | `RUDDER_EMBEDDED_POSTGRES_PORT`. If embedded PostgreSQL fails in the local |
| 92 | environment, use a dedicated external database for this preview instead of |
| 93 | reusing another Rudder instance's database. |
| 94 | |
| 95 | ### 3. Use the bundled launcher first |
| 96 | |
| 97 | From the repo root: |
| 98 | |
| 99 | ```bash |
| 100 | bash .agents/skills/maintainer/rudder-worktree-preview-maintainer/scripts/start_current_branch_preview.sh |
| 101 | ``` |
| 102 | |
| 103 | The launcher: |
| 104 | |
| 105 | - derives an instance id from the current branch |
| 106 | - finds free app and embedded PostgreSQL ports |
| 107 | - starts `@rudderhq/server` with Vite dev middleware |
| 108 | - uses `tmux` when available, then `launchctl` on macOS |
| 109 | - waits for `/api/health` |
| 110 | - prints the URL, logs, and stop command |
| 111 | |
| 112 | Useful options: |
| 113 | |
| 114 | ```bash |
| 115 | bash .agents/skills/maintainer/rudder-worktree |