herdr-code-review
Spawn a fresh reviewer agent in a new sibling pane of the current Herdr workspace, delegate a full team-code-review pass to it, then collect and relay its report. Use when the user explicitly asks for a code review in a new, separate, or fresh Herdr agent or pane, or otherwise asks to delegate a review through Herdr. Do not trigger merely because a Herdr session is detected; a plain code-review request runs team-code-review in the current agent. Requires HERDR_ENV=1.
dgalarza · 已有静态检查记录
安装与使用
运行命令前先阅读来源与依赖说明。复制命令不会自动安装或执行。
npx skills add dgalarza/agent-skills --skill herdr-code-review技能说明
name: herdr-code-review description: Spawn a fresh reviewer agent in a new sibling pane of the current Herdr workspace, delegate a full team-code-review pass to it, then collect and relay its report. Use when the user explicitly asks for a code review in a new, separate, or fresh Herdr agent or pane, or otherwise asks to delegate a review through Herdr. Do not trigger merely because a Herdr session is detected; a plain code-review request runs team-code-review in the current agent. Requires HERDR_ENV=1.
Herdr Code Review
Delegate a code review to a fresh coding agent started in a new sibling pane of the current Herdr workspace. The spawned reviewer executes the team-code-review skill end to end and returns its report in the pane. This skill owns only the handoff and the reviewer lifecycle; it does not perform the review itself.
0. Decide whether to delegate
Before spawning anything, verify delegation is actually wanted:
test "${HERDR_ENV:-}" = 1
- Not inside Herdr: say that Herdr control is unavailable and run the
team-code-reviewskill in the current agent instead. Do not attempt Herdr commands. - Already the delegated reviewer: if your current assigned review pass explicitly contains the marker
HERDR_CODE_REVIEW_REVIEWER=1, you are the spawned reviewer, not the caller. Do not spawn another agent; executeteam-code-reviewdirectly and return the report where it was requested. This prevents recursive reviewer spawning even if this skill is loaded by mistake. - User wants the review in the current agent: run
team-code-reviewdirectly without this handoff. - Inside Herdr and delegation is requested: continue below.
Every new review or re-review requires a fresh agent session, including reviewing fixes or repeating an unchanged target. Never send a new pass to the old reviewer or resume its session. If a new pass is requested directly in the reviewer pane, hand control back to the original caller for replacement; do not close your own pane or review again in the existing context.
1. Discover the caller
Load the herdr skill and follow its session checks, CLI discovery, layout rules, and safety rules. If that skill is unavailable, verify HERDR_ENV=1 and read herdr --skill. The installed CLI is authoritative; inspect herdr --help, herdr agent, and herdr pane before controlling panes.
Resolve the calling pane explicitly, never the UI-focused pane:
herdr pane current --current
herdr agent get <caller-pane-id>
Read the caller pane ID from .result.pane.pane_id and its recognized agent kind from .result.agent.agent in the agent-get response. Confirm the kind is supported by the installed herdr agent command. The reviewer must be the same agent runtime/kind as the caller: pi → pi, Claude Code → claude, Codex → codex. Do not infer it from the underlying model provider, agent name, or another pane. Do not resume or clone the caller's conversation; the reviewer needs fresh context.
If detection fails, explain the problem and ask how to proceed rather than guessing a kind. Do not silently substitute a different agent kind.
2. Prepare an exact handoff
Before launching, resolve enough scope to make the child's task self-contained:
- Absolute repository/worktree path and caller working directory.
- Own-work versus another contributor's PR, including PR URL/number if applicable.
- Resolved base/head commit SHAs for a committed review.
- For uncommitted work, explicitly state whether staged, unstaged, and untracked files are included, and identify the intended files/hunks. Do not substitute
HEADfor the working-tree diff or include unrelated edits. - User constraints, non-goals, relevant context from the conversation, and known checks already run.
- Absolute path to this installation's
team-code-review/SKILL.mdso the child loads the same version.
The child can discover repository instructions and stack profiles itself. Do not perform the full review before delegating. Keep the reviewed files unchanged while it works; if the target changes, resolve the new scope and rerun the affected review rather than presenting stale findings.
3. Replace the previous reviewer before each new pass
Waiting for the current pass, resolving its blocking question, or retrieving its complete report is a continuation, not a new review. Reviewing fixes or asking for another assessment is a new pass and uses a newly started agent.
The original caller owns this lifecycle. Retain the reviewer pane ID, unique agent name, kind, and session identity returned by agent start, together with the review target and original caller pane ID. Before replacement:
- Preserve the previous report in the original conversation if it has completed and has not yet been relayed.
- Inspect the recorded pane with
herdr agent get <previous-reviewer-pane-id>and compare its live identity to the recorded reviewer. Do not identify ownership from a similar name, cwd, or kind alone. If identity cannot be verified, ask the user before closing anything. If the recorded pane is already gone, proceed without closing a substitute. - Close only that verified, dedicated reviewer pane with
herdr pane close <previous-reviewer-pane-id>. This terminates the old agent; renaming it, clearing its display, or sending a reset prompt does not create a fresh session. A user-requested new pass supersedes an unfinished old pass; disclose that it is being stopped and do not report it as completed. Never close the original caller or a pane repurposed for other work. - Confirm closure succeeded, then launch a fresh reviewer below. If closure fails, resolve the failure before launching a duplicate.
If a re-review request arrives in the reviewer itself, direct it back to the recorded original caller for replacement. Do not self-close, recursively delegate, or let a marker from the previous pass authorize another review in the same session.