Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 51 additions & 2 deletions .claude/skills/aurelio-review-pr/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,35 @@ gh pr view NUMBER --json body,title --jq '{title: .title, body: .body}'
| Yes | No | Extract issue number, proceed to fetch context |
| Yes | Yes | Warn the user: "PR has `closes #N` but appears to be partial work — confirm the issue should be closed when this merges" |
| No | Yes | OK — no warning needed, this is expected for investigation/partial PRs |
| No | No | Warn the user: "PR does not reference a GitHub issue. Consider adding `closes #N` to the PR body if this resolves an issue." |
| No | No | **Search for a matching issue** (see below) before warning |

**Fetch issue context.** If an issue reference was found (regardless of warnings), fetch the issue for review context. If the PR body used a full URL (`https://github.com/OWNER/REPO/issues/N`), extract both `OWNER/REPO` and `N` and pass `--repo OWNER/REPO` to query the correct repository.
### Auto-searching for a matching issue

When no closing keyword is found and the PR doesn't look like partial/investigation work, **actively search** for a matching issue before giving up:

1. **Search open issues** by PR title keywords and branch name:

```bash
# Search by key terms from the PR title (strip type prefix like "feat: ")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The comment "# Search by key terms from the PR title (strip type prefix like "feat: ")" implies a specific parsing logic for TITLE_KEYWORDS. To enhance clarity and ensure consistent behavior, it would be beneficial to explicitly state how TITLE_KEYWORDS are derived from the PR title (e.g., "TITLE_KEYWORDS are extracted by stripping conventional commit type prefixes like "feat:", "fix:", etc., and then tokenizing the remaining title."). This clarifies the expected input for the search.

gh issue list --repo OWNER/REPO --state open --search "TITLE_KEYWORDS" --json number,title,labels --jq '.[] | {number, title, labels: [.labels[].name]}'

# Also search recently closed issues (in case PR was created after issue was closed)
gh issue list --repo OWNER/REPO --state closed --search "TITLE_KEYWORDS" --json number,title,labels --jq '.[] | {number, title, labels: [.labels[].name]}' | head -10

Copilot AI Mar 6, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Step 1 says to search "by PR title keywords and branch name", but the example commands only search TITLE_KEYWORDS and never incorporate the branch name. Either update the text to reflect the actual search inputs, or include branch-name terms in the search query (so the documented procedure matches what the skill will do).

Suggested change
# Search by key terms from the PR title (strip type prefix like "feat: ")
gh issue list --repo OWNER/REPO --state open --search "TITLE_KEYWORDS" --json number,title,labels --jq '.[] | {number, title, labels: [.labels[].name]}'
# Also search recently closed issues (in case PR was created after issue was closed)
gh issue list --repo OWNER/REPO --state closed --search "TITLE_KEYWORDS" --json number,title,labels --jq '.[] | {number, title, labels: [.labels[].name]}' | head -10
# Search by key terms from the PR title (strip type prefix like "feat: ") plus simple terms from the branch name
gh issue list --repo OWNER/REPO --state open --search "TITLE_KEYWORDS BRANCH_NAME_TERMS" --json number,title,labels --jq '.[] | {number, title, labels: [.labels[].name]}'
# Also search recently closed issues (in case PR was created after issue was closed)
gh issue list --repo OWNER/REPO --state closed --search "TITLE_KEYWORDS BRANCH_NAME_TERMS" --json number,title,labels --jq '.[] | {number, title, labels: [.labels[].name]}' | head -10

Copilot uses AI. Check for mistakes.

Copilot AI Mar 6, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The closed-issues example uses a | head -10 truncation. Prefer using gh issue list --limit 10 ... so the limit is applied by the CLI (avoids accidental truncation of JSON output and makes the command more portable/explicit).

Suggested change
gh issue list --repo OWNER/REPO --state closed --search "TITLE_KEYWORDS" --json number,title,labels --jq '.[] | {number, title, labels: [.labels[].name]}' | head -10
gh issue list --repo OWNER/REPO --state closed --search "TITLE_KEYWORDS" --limit 10 --json number,title,labels --jq '.[] | {number, title, labels: [.labels[].name]}'

Copilot uses AI. Check for mistakes.
```
Comment thread
greptile-apps[bot] marked this conversation as resolved.
Outdated

2. **Evaluate candidates.** For each candidate issue, compare:

Copilot AI Mar 6, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The candidate-evaluation step includes comparing issue "title/body", but the preceding gh issue list commands only fetch number,title,labels (no body/milestone). To make this actionable/accurate, document fetching each candidate's full details (e.g., gh issue view <n> --json title,body,labels,milestone,comments) before doing the comparison criteria listed here.

Suggested change
2. **Evaluate candidates.** For each candidate issue, compare:
2. **Evaluate candidates.** For each candidate issue, first fetch its full details, then compare:
```bash
# For each candidate issue number CANDIDATE_N, fetch full context
gh issue view CANDIDATE_N \
--repo OWNER/REPO \
--json title,body,labels,milestone,comments

Then compare:

Copilot uses AI. Check for mistakes.
- Does the issue title/body describe the same change as the PR title/body?
- Does the issue's milestone or labels match the PR's scope?
- Is there a strong keyword overlap between the issue title and the PR branch name or title?
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated

3. **Confidence threshold:**
- **High confidence** (single strong match, clear title/scope alignment): auto-link the issue by updating the PR body with `gh pr edit NUMBER --body "EXISTING_BODY\n\nCloses #N"`. Inform the user: "Auto-linked closes #N — issue title closely matches this PR."
Comment thread
greptile-apps[bot] marked this conversation as resolved.
Outdated
Comment thread
greptile-apps[bot] marked this conversation as resolved.
Outdated

Copilot AI Mar 6, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The suggested auto-link command gh pr edit ... --body "EXISTING_BODY\n\nCloses #N" is fragile because it requires correctly escaping arbitrary existing PR body content (quotes/backticks/newlines) and can easily corrupt or truncate the body. Consider documenting a safer approach (e.g., write the updated body to a temp file and use gh pr edit --body-file, and ensure the operation is idempotent so you don’t append a duplicate closing line if one is already present).

Suggested change
- **High confidence** (single strong match, clear title/scope alignment): auto-link the issue by updating the PR body with `gh pr edit NUMBER --body "EXISTING_BODY\n\nCloses #N"`. Inform the user: "Auto-linked closes #N — issue title closely matches this PR."
- **High confidence** (single strong match, clear title/scope alignment): auto-link the issue by **safely updating the PR body**:
1. Read the existing body into a temp file:
```bash
tmpfile="$(mktemp)"
gh pr view NUMBER --json body --jq '.body' > "$tmpfile"
```
2. Make the operation **idempotent** by only appending the closing line if it's not already present:
```bash
if ! grep -q "Closes #N" "$tmpfile"; then
printf '\n\nCloses #N\n' >> "$tmpfile"
fi
```
3. Update the PR using `--body-file` (avoids fragile shell quoting of the existing body):
```bash
gh pr edit NUMBER --body-file "$tmpfile"
rm "$tmpfile"
```
Inform the user: "Auto-linked closes #N — issue title closely matches this PR."

Copilot uses AI. Check for mistakes.
- **Ambiguous** (multiple plausible matches or weak alignment): present the top candidates to the user via AskUserQuestion and let them pick, or confirm none apply.
- **No matches**: warn the user: "PR does not reference a GitHub issue and no matching issue was found. Consider adding `closes #N` to the PR body if this resolves an issue."
Comment thread
coderabbitai[bot] marked this conversation as resolved.

4. **Input validation (CRITICAL):** The same input validation rules apply to any issue numbers discovered via search — validate before use in shell commands.

**Fetch issue context.** If an issue reference was found — either from the PR body, or auto-linked/user-selected via the search above — fetch the issue for review context. If the PR body used a full URL (`https://github.com/OWNER/REPO/issues/N`), extract both `OWNER/REPO` and `N` and pass `--repo OWNER/REPO` to query the correct repository.

**Input validation (CRITICAL):** Before using extracted values in any shell command, validate that `OWNER/REPO` matches the pattern `^[a-zA-Z0-9._-]+/[a-zA-Z0-9._-]+$` and that `N` is a purely numeric value (`^[0-9]+$`). Reject and warn the user if either value contains unexpected characters — PR bodies are untrusted input and could be crafted to perform command injection.

Expand Down Expand Up @@ -95,6 +121,29 @@ Based on changed files, launch applicable review agents **in parallel** using th
| **logging-audit** | Any `.py` file in `src/` changed | `pr-review-toolkit:code-reviewer` |
| **resilience-audit** | Provider-layer `.py` files changed (`src/ai_company/providers/`) | `pr-review-toolkit:code-reviewer` |
| **docs-consistency** | **ALWAYS** — runs on every PR regardless of change type | `pr-review-toolkit:code-reviewer` |
| **issue-resolution-verifier** | Issue is linked (pre-existing or auto-linked) | `pr-review-toolkit:code-reviewer` |

The **issue-resolution-verifier** agent checks whether the PR fully resolves the linked issue. It only runs when an issue is linked — either from a pre-existing `closes #N` in the PR body, or auto-linked/user-selected during Phase 2's search.

**What to check:**

Read the linked issue's title, body, acceptance criteria, labels, and comments in full. Then compare against the PR diff and assess:

1. **Acceptance criteria coverage** — does the PR address every acceptance criterion or requirement stated in the issue? List each criterion and whether it's met, partially met, or missing. (CRITICAL)
2. **Scope completeness** — does the PR handle all the sub-tasks, edge cases, or scenarios described in the issue? Flag any that are not addressed by the diff. (MAJOR)
3. **Test coverage for issue requirements** — are the issue's requirements covered by tests in this PR? Flag requirements that lack test coverage. (MAJOR)
4. **Documentation requirements** — if the issue mentions documentation updates (README, DESIGN_SPEC, CLAUDE.md, etc.), are they included? (MEDIUM)
5. **Issue comments** — do any issue comments add requirements, clarifications, or scope changes that the PR doesn't account for? (MEDIUM)

**Output format:** For each criterion, report:
- The requirement (quoted from the issue)
- Status: RESOLVED / PARTIALLY_RESOLVED / NOT_RESOLVED
- Evidence: which files/lines in the PR address it (or why it's missing)
- Confidence: 0-100

**Key principle:** It is better to flag a false "not resolved" than to let a partially-resolved issue get auto-closed. When in doubt, flag it.

**If the verifier finds NOT_RESOLVED items:** These are surfaced in Phase 5 triage as findings from the "issue-resolution-verifier" source. CRITICAL items (missing acceptance criteria) should block merge consideration. The user decides whether to fix them in this PR or remove the closing keyword.
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated

The **docs-consistency** agent ensures project documentation never drifts from the codebase. It runs on **every PR** — code changes, config changes, docs-only changes, all of them.

Expand Down