AGENT SKILL

pr-local-preview-maintainer

Use when checking out, running, previewing, reviewing, or validating a GitHub pull request locally in a safe worktree, including PR preview URLs, local screenshots, readiness checks, logs, and cleanup instructions.

License 许可
Apache-2.0
最近更新
2026-11-08
Stars
★ 296
Forks
31

01 前言 Front Matter

name
pr-local-preview-maintainer
description
Use when checking out, running, previewing, reviewing, or validating a GitHub pull request locally in a safe worktree, including PR preview URLs, local screenshots, readiness checks, logs, and cleanup instructions.

02 资源文件 1

03 SKILL.md 正文

PR Local Preview Maintainer

Run pull requests in a disposable local worktree and give the user a stable preview link. The point is to let the user review the PR while protecting their current working tree and making UI changes visible.

Default Workflow

1. Preserve the current workspace

Start by checking the repository state:

git status --short --branch
gh pr view <number> --json number,title,state,headRefName,headRepositoryOwner,url,isCrossRepository

If the current worktree has local changes, do not run gh pr checkout there. Create or reuse a sibling worktree instead. This avoids overwriting unrelated work and keeps the PR preview easy to remove later.

Use a predictable path:

<repo-parent>/<repo-name>-pr-<number>

For this repository, PR 8 should become:

/Users/zeeland/projects/rudder-oss-pr-8

If the directory already exists, inspect it before reusing it:

git -C <worktree-path> status --short --branch
git -C <worktree-path> branch --show-current

If it is dirty, ask only if the dirty changes conflict with the user's goal. Otherwise, pick a suffixed path such as <repo-name>-pr-<number>-preview.

2. Check out the PR in the worktree

Create the worktree from the remote base, then check out the PR branch inside it:

git worktree add --detach <worktree-path> origin/main
gh pr checkout <number> --branch zeelandc/pr-<number>

If main is not the base branch, use the PR's actual base ref. Prefer a local branch name that makes the preview purpose clear and follows the user's branch prefix convention when the repository defines one.

After checkout, verify:

git status --short --branch

3. Install dependencies only when needed

Check whether dependencies are present:

test -d node_modules && echo node_modules-present || echo node_modules-missing

If missing, install them from the worktree:

pnpm install

Report install warnings only when they affect the preview. Routine peer or bin link warnings can be mentioned briefly.

4. Choose isolated runtime settings

Before starting, inspect occupied ports and existing local runtimes:

lsof -nP -iTCP:<candidate-port> -sTCP:LISTEN

For Rudder, prefer:

RUDDER_INSTANCE_ID=pr-<number>
PORT=<free-api-port>
RUDDER_EMBEDDED_POSTGRES_PORT=<free-pg-port>

Use 3100 only if it is free and the user clearly wants the default instance. If another Rudder dev runtime is already running, leave it alone and use a separate port and instance ID.

Example:

env RUDDER_INSTANCE_ID=pr-8 PORT=3118 RUDDER_EMBEDDED_POSTGRES_PORT=54358 pnpm dev

5. Start the preview so it survives hand-off

Use tmux when available. It keeps the preview alive after the assistant turn ends and gives the user a simple way to inspect logs.

tmux new-session -d -s rudder-pr-<number> -c <worktree-path> \
  'env RUDDER_INSTANCE_ID=pr-<number> PORT=<port> RUDDER_EMBEDDED_POSTGRES_PORT=<pg-port> pnpm dev'

If tmux is not available, use another managed background process and capture logs to /tmp/<repo-name>-pr-<number>.log. Do not leave an opaque process running without telling the user how to stop it.

6. Wait for readiness

Poll the health endpoint or the app's equivalent readiness check:

curl -fsS http://127.0.0.1:<port>/api/health

If the app has no health endpoint, use the first meaningful route and check for a successful response. For frontend-only apps, load the dev server URL and confirm it serves HTML.

When startup fails, inspect the session logs before returning:

tmux capture-pane -pt rudder-pr-<number> -S -160

Fix straightforward startup issues yourself when they are local environment problems, such as missing dependencies or port conflicts. Do not edit PR source code unless the user asked for a fix.

7. Decide whether UI screenshots are required

Screenshots are required when any of these are true:

  • the PR title, files, or user request mentions UI, layout, pages, components, CSS, design, screenshots, visual review, browser behavior, or interaction
  • changed files live under ui/, desktop/, frontend route files, component directories, stylesheets, or public assets
  • the user says they want to "see" the effect

Use Browser Use for local browser inspection when available. Capture the important screen or flow after the preview is running. Store temporary screenshots outside the repository, for example:

/tmp/rudder-pr-<number>-<view>.png

For non-UI backend/API PRs, a health check plus a task-specific API smoke check is usually enough. If the user still needs to review manually, provide the URL.

8. Hand-off format

Keep the final response short and concrete:

PR <number> is running in <worktree-path>.

Open: http://127.0.0.1:<port>
Logs: tmux attach -t rudder-pr-<number>
Stop: tmux kill-session -t rudder-pr-<number>

Health check passed: <brief status>
Screenshots: <paths or embedded images when UI changed>

If screenshots were required but could not be captured, say exactly why and what verification did run.

Cleanup Requests

When the user asks to close, stop, or clean up the preview, stop only the PR preview session and verify its port is free:

tmux kill-session -t rudder-pr-<number>
lsof -nP -iTCP:<port> -sTCP:LISTEN

Do not remove the worktree unless the user explicitly asks for cleanup. If they do ask to remove it, verify the worktree has no uncommitted changes first.

Safety Notes

  • Never use destructive Git commands in the user's main worktree to make a PR checkout succeed.
  • Do not stop unrelated Rudder dev sessions just because the default port is in use; choose an isolated port instead.
  • Keep PR preview data isolated with a dedicated RUDDER_INSTANCE_ID.
  • If source edits become necessary, pause and state that the task has shifted from previewing a PR to fixing it.

04 同仓库更多 Skills

Undertone0809
Undertone0809/rudder

Source Synthesis

Synthesize evidence into a concise conclusion.

★ 296
Undertone0809
Undertone0809/rudder

Evidence Research

Gather and cite evidence before reaching a conclusion.

资料检索与研究
★ 296
Undertone0809
Undertone0809/rudder

deep-research

Conducts enterprise-grade research with multi-source synthesis, citation tracking, and verification. Produces citation-backed reports through a structured pipeline with source credibility scoring, and grounds abstract findings in concrete examples, cases, counterexamples, or mini-scenarios when helpful. Triggers on "deep research", "comprehensive analysis", "research report", "compare X vs Y", "analyze trends", or "state of the art". Not for simple lookups, debugging, or questions answerable with 1-2 searches.

资料检索与研究
★ 296
Undertone0809
Undertone0809/rudder

visualize

Create safe inline visual explanations in Rudder Chat. Use when asked for a chart, plot, diagram, timeline, comparison, static map, simulator, scenario view, or compact visual that materially improves understanding. Prefer Mermaid for static node-and-edge structures; use Rudder's runtime-neutral HTML/SVG/CSS message envelope for custom geometry. Rudder visuals are declarative and scriptless: convert simulator requests to static scenarios or disclosure-based comparisons and never rely on JavaScript, network access, or external assets.

前端开发
★ 296
Undertone0809
Undertone0809/rudder

skill-creator

Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy.

Skill与智能体开发
★ 296
Undertone0809
Undertone0809/rudder

rudder-docs

Use when the user asks how Rudder works; needs current Rudder docs, exact behavior, commands, contracts, APIs, or source evidence; asks to create, hire, or configure Rudder agents; or asks to scaffold, develop, or verify Rudder plugins. For explicit creation requests, verify the current interface before acting within existing authorization. Do not use for greetings, ordinary work merely running inside Rudder, routine actions already clear from the active context and typed tools, non-Rudder plugin work, or general coding and research tasks that do not ask about Rudder.

★ 296