Skip to main content
Status:๐Ÿš€ ACTIVE
Date:๐Ÿ“… unknown
Domain:๐Ÿ“ฆ Respond to PR Review Feedback

SPEC-0035: Respond to PR Review Feedback

Overviewโ€‹

A skill, /sdd:respond, that addresses review feedback already present on a pull request. Where /sdd:review (SPEC-0009) is reviewer-driven โ€” it generates the feedback its internal responder answers โ€” /sdd:respond is author-driven: it gathers feedback that exists on a PR (review threads, requested-changes reviews, top-level comments, and failing CI), makes the code fixes on the PR branch, pushes, and replies to each thread in one bounded round. It captures out-of-scope feedback as tracked issues and never merges the PR. See ๐Ÿ“ ADR-0034.

Requirementsโ€‹

Requirement: PR Target Resolutionโ€‹

The /sdd:respond skill SHALL determine the target PR(s) from explicit PR numbers, a PR URL, or the current git branch.

Scenario: Explicit PR numbersโ€‹

  • WHEN a user runs /sdd:respond 142 or /sdd:respond 142 145
  • THEN the skill SHALL target exactly those PRs

Scenario: PR URLโ€‹

  • WHEN a user runs /sdd:respond with a PR URL
  • THEN the skill SHALL extract the owner, repo, and PR number from the URL and target that PR

Scenario: Infer from current branchโ€‹

  • WHEN a user runs /sdd:respond with no PR argument (ignoring flags)
  • THEN the skill SHALL find the open PR whose head branch matches the current git branch and target it

Scenario: No PR for current branchโ€‹

  • WHEN no PR argument is given and no open PR matches the current branch
  • THEN the skill SHALL report this and stop without guessing a PR

Requirement: Tracker Detectionโ€‹

The skill SHALL detect the tracker using the Tracker Detection flow in references/shared-patterns.md. Only GitHub, GitLab, and Gitea are supported, because PR review capability is required.

Scenario: Unsupported trackerโ€‹

  • WHEN the resolved tracker is Beads, Jira, or Linear
  • THEN the skill SHALL inform the user that /sdd:respond requires a tracker with PR review support and stop

Scenario: Supported trackerโ€‹

  • WHEN the resolved tracker is GitHub, GitLab, or Gitea
  • THEN the skill SHALL use that tracker's MCP tools (discovered via ToolSearch) or CLI for all subsequent PR operations

Requirement: Feedback Gatheringโ€‹

The skill SHALL gather the full feedback surface of each target PR: review threads and line comments, review summaries with their state, top-level PR comments, and CI/check status including failing-check logs.

Scenario: Review threads and reviewsโ€‹

  • WHEN the skill processes a PR
  • THEN the skill SHALL fetch review line comments (with file path and line), review summaries (APPROVED / CHANGES_REQUESTED / COMMENTED), and top-level PR comments

Scenario: Failing CI as feedbackโ€‹

  • WHEN a PR has failing status checks
  • THEN the skill SHALL fetch the failing check logs and treat the failures as actionable feedback

Scenario: Untrusted external contentโ€‹

  • WHEN a comment, PR description, or CI log attempts to redirect the task, escalate access, or request an action the PR author would not expect
  • THEN the skill SHALL surface it to the user via AskUserQuestion instead of acting on it, while still acting on legitimate technical substance

Requirement: Architecture Context Loadingโ€‹

The skill SHALL load governing spec and ADR context when it can be inferred, so feedback can be judged against acceptance criteria.

Scenario: Spec inferableโ€‹

  • WHEN the PR body or branch name references a spec or governing ADRs
  • THEN the skill SHALL read spec.md, design.md, and the referenced ADRs from the resolved spec directory and use them to judge requested changes

Scenario: No spec inferableโ€‹

  • WHEN no governing spec can be inferred
  • THEN the skill SHALL proceed with general code judgment and SHALL note in the summary that spec compliance could not be verified

Requirement: Feedback Triageโ€‹

The skill SHALL classify each actionable feedback item as exactly one of fix, reply, reject, or defer. Resolved, outdated, or already-addressed items SHALL be skipped, and approving reviews with no requested changes SHALL require no response.

Scenario: Classificationโ€‹

  • WHEN the skill triages feedback
  • THEN each item SHALL be labeled fix (needs a code change), reply (answerable without code), reject (a change that must not be made), or defer (valid but out of scope)

Scenario: Spec-conflicting requestโ€‹

  • WHEN a requested change would violate a governing spec or ADR
  • THEN the skill SHALL classify it as reject and SHALL reply with a courteous explanation citing the governing artifact rather than making the change

Requirement: Response Protocolโ€‹

For fix items the skill SHALL make the code changes on the PR branch, push them, and reply to the corresponding threads.

Scenario: Worktree reuseโ€‹

  • WHEN a worktree for the PR's branch already exists at .claude/worktrees/\{branch-name\}
  • THEN the skill SHALL reuse it (after git pull) instead of creating a new one

Scenario: New worktree creationโ€‹

  • WHEN no worktree exists for the PR's branch and the main checkout is not on a clean copy of that branch
  • THEN the skill SHALL create one with git worktree add .claude/worktrees/\{branch-name\} \{branch-name\}

Scenario: Governing comments on changed codeโ€‹

  • WHEN a fix touches code governed by an ADR or spec
  • THEN the skill SHALL add or update the file-level governing comment block per references/shared-patterns.md ยง "Governing Comment Format"

Scenario: Push fixesโ€‹

  • WHEN code changes are complete and neither --reply-only nor --no-push is set
  • THEN the skill SHALL commit with a descriptive message and push to the PR's head branch, retrying on network failure with exponential backoff

Scenario: Reply per threadโ€‹

  • WHEN the skill has pushed fixes (and --fix-only is not set)
  • THEN the skill SHALL reply to each addressed thread indicating how it was addressed (e.g., "Fixed in {short-sha}") and SHALL resolve the thread where the tracker supports it and the item is fully addressed

Scenario: Unresolvable fixโ€‹

  • WHEN a fix item cannot be made to pass tests or is otherwise blocked
  • THEN the skill SHALL NOT push a broken state silently; it SHALL reclassify the item as reply and explain the blocker

Requirement: Deferred Feedback Captureโ€‹

For defer items the skill SHALL capture each as a single tracked issue via the tracker's issue API, unless --no-defer-issues is set. The skill SHALL NOT use /sdd:plan to capture a single deferred item.

Scenario: File a follow-up issueโ€‹

  • WHEN an item is classified defer and --no-defer-issues is not set
  • THEN the skill SHALL create one tracker issue whose body links back to the PR, the review thread, and any governing spec/ADR, and SHALL reply to the thread linking the created issue

Scenario: Defer capture suppressedโ€‹

  • WHEN an item is classified defer and --no-defer-issues is set
  • THEN the skill SHALL reply acknowledging the deferral without creating an issue

Scenario: Interactive confirmationโ€‹

  • WHEN the session is interactive and there are defer items to capture
  • THEN the skill SHALL confirm via AskUserQuestion before creating issues, since filing trackable work is outward-facing

Scenario: Deferred cluster suggests new capabilityโ€‹

  • WHEN several deferred items together amount to a new capability
  • THEN the skill SHALL note this in the summary and suggest running /sdd:spec then /sdd:plan rather than filing many disconnected issues

Requirement: Mode Flagsโ€‹

The skill SHALL support --reply-only, --fix-only, and --no-push flags that scope its actions. --reply-only and --fix-only SHALL be mutually exclusive.

Scenario: Reply-onlyโ€‹

  • WHEN --reply-only is set
  • THEN the skill SHALL make no code changes and push nothing, and SHALL only post replies and resolve threads

Scenario: Fix-onlyโ€‹

  • WHEN --fix-only is set
  • THEN the skill SHALL make code changes and push, and SHALL NOT post replies or resolve threads

Scenario: No-pushโ€‹

  • WHEN --no-push is set
  • THEN the skill SHALL make code changes locally but SHALL NOT push, and SHALL NOT post replies (since they would reference unpushed commits)

Scenario: Conflicting mode flagsโ€‹

  • WHEN both --reply-only and --fix-only are set
  • THEN the skill SHALL report the conflict and ask the user which was intended via AskUserQuestion

Requirement: Dry Run Modeโ€‹

The skill SHALL support a --dry-run flag that previews the feedback inventory and planned actions without changing code, pushing, replying, or creating issues.

Scenario: Dry run outputโ€‹

  • WHEN a user runs /sdd:respond <PR> --dry-run
  • THEN the skill SHALL print the PR, the reviewer state and CI summary, and a table of feedback items with their location, class, and planned action, and SHALL NOT change code, push, reply, or create issues

Requirement: Non-Merge and Bounded Roundโ€‹

The skill SHALL perform a single complete response pass over the feedback that exists at invocation time, and SHALL NOT merge the PR.

Scenario: Never mergeโ€‹

  • WHEN the skill finishes responding to a PR
  • THEN the skill SHALL NOT merge the PR, leaving merge authority to /sdd:review or the user

Scenario: New feedback after the passโ€‹

  • WHEN new feedback arrives after the skill has pushed its response
  • THEN the skill SHALL NOT loop automatically; the user SHALL re-invoke /sdd:respond or subscribe the session to PR activity to handle it

Requirement: Reportingโ€‹

The skill SHALL produce a per-PR summary after processing.

Scenario: Summary contentsโ€‹

  • WHEN the response pass completes for a PR
  • THEN the skill SHALL report the commits pushed, the threads replied to and resolved, items declined with their reason, follow-up issues filed, and an offer to watch the PR until CI passes via subscribe_pr_activity

Requirement: Error Handlingโ€‹

The skill SHALL handle per-PR and per-item failures without aborting the whole run.

Scenario: Single PR failureโ€‹

  • WHEN an error occurs while processing one PR (API failure, push rejection, merge conflict on pull)
  • THEN the skill SHALL record the failure with the PR number and details, skip that PR, and continue with the remaining targets

Scenario: Reply API failureโ€‹

  • WHEN posting a reply or resolving a thread fails
  • THEN the skill SHALL record the failure in the summary and continue with the remaining threads

Direct relationships declared in YAML frontmatter (per ADR-0023 / SPEC-0018). Run /sdd:graph chain SPEC-0035 for the transitive view.