Skip to content

Commit f0703c2

Browse files
ci: enhance claude code review and clean up enhance-claude-docs skill (#366)
* ci: add resolved-thread dedupe + opt-out label to claude code review Two changes to the claude-code-review workflow: 1. Resolved-thread dedupe — fetch existing review threads via GraphQL before reviewing and apply a posting gate to every inline comment: - Skip if an unresolved thread already covers the same (path, line, topic) - Skip resolved threads where the fix was applied or author declined - Unresolve the original thread (no new comment) if a resolved actionable ask was not addressed in the current code 2. Opt-out label — `skip-claude-review` on a PR suppresses the workflow on subsequent commits. Removing the label re-enables it. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * chore(skill): forbid source PR refs and @-mentions inside doc file edits The enhance-claude-docs skill was baking provenance like (Source: PR #184) and reviewer @-mentions directly into the documentation files (e.g., agent_docs/conventions.md), creating permanent cross-link noise in source PRs and burning contributor handles into long-lived docs. Updates Step 6 with explicit content rules for doc edits: no #N refs, no @-mentions, no verbatim quoting. Provenance stays in the PR body and terminal output where it belongs. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * ci(review): suppress summary comment on no-op runs Previous prompt told the bot to "summarize" without saying when, which made it post a "No new issues" filler summary on runs where no action was taken. The current uipath-typescript workflow posts zero plugin summaries today; this prompt would have changed that behavior. Now: post a summary ONLY if the run posted a new inline comment or unresolved a thread. Otherwise stay silent. Preserves the audit-log value (notifying the author when their thread was unresolved) without adding noise on no-op pushes. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 4e998c2 commit f0703c2

2 files changed

Lines changed: 110 additions & 3 deletions

File tree

.claude/skills/enhance-claude-docs/SKILL.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,16 @@ If actionable insights exist:
175175
5. For `agent_docs/architecture.md`, update tables or sections as appropriate.
176176
6. For `Agents.md`, update the quick reference or add new sections.
177177

178+
### Content rules for doc edits
179+
180+
The text written into the doc files must be self-contained guidance, not a changelog.
181+
182+
- **Do not include source PR references** (`#327`, `Source: PR #184`, etc.) in the file content — they create permanent cross-link noise in the source PRs.
183+
- **Do not include @-mentions** (`@swati354`, `reviewer @maninder noted`) in the file content — handles don't belong in long-lived docs.
184+
- Rewrite each insight as a generalized rule/convention; don't quote the original comment verbatim.
185+
186+
Provenance belongs in the PR body (Step 7) and the terminal output (Step 8) — not inside the docs.
187+
178188
---
179189

180190
## Step 7: Create or Update PR

.github/workflows/claude-code-review.yml

Lines changed: 100 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ on:
1212

1313
jobs:
1414
claude-review:
15+
# Opt-out: PR authors can apply the `skip-claude-review` label to suppress
16+
# the bot on subsequent commits. Removing the label re-enables review on
17+
# the next push.
18+
if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip-claude-review') }}
19+
1520
# Optional: Filter by PR author
1621
# if: |
1722
# github.event.pull_request.user.login == 'external-contributor' ||
@@ -39,9 +44,101 @@ jobs:
3944
plugin_marketplaces: 'https://github.com/anthropics/claude-code.git'
4045
plugins: 'code-review@claude-code-plugins'
4146
prompt: |
42-
Read CLAUDE.md at the repo root first — it references Agents.md and agent_docs/ which contain all project conventions, architecture, and rules. Follow every convention defined there during your review.
47+
You are reviewing PR #${{ github.event.pull_request.number }} in ${{ github.repository }}.
48+
49+
STEP 1 — Fetch existing review threads and issue comments BEFORE reviewing.
50+
Run this GraphQL query and read the results carefully:
51+
52+
gh api graphql -f query='
53+
query($owner:String!,$repo:String!,$num:Int!){
54+
repository(owner:$owner,name:$repo){
55+
pullRequest(number:$num){
56+
reviewThreads(first:100){
57+
nodes{
58+
id
59+
isResolved
60+
path
61+
line
62+
comments(first:20){ nodes{ author{login} body }}
63+
}
64+
}
65+
comments(first:100){
66+
nodes{ author{login} body }
67+
}
68+
}
69+
}
70+
}' \
71+
-f owner=${{ github.repository_owner }} \
72+
-f repo=${{ github.event.repository.name }} \
73+
-F num=${{ github.event.pull_request.number }}
74+
75+
STEP 2 — Build a set of issues already covered by prior bot comments
76+
(threads whose first comment is authored by a bot or this workflow's
77+
identity). Treat each prior comment as "(path, line, topic)".
78+
79+
STEP 3 — Dedupe policy. For each issue you are about to raise, look for a
80+
prior thread covering the same (path, line, topic):
81+
82+
• If an UNRESOLVED thread exists for this (path, line, topic) → SKIP.
83+
Don't duplicate an open thread; the user will get to it.
84+
85+
• If a RESOLVED thread exists for this (path, line, topic), classify the
86+
ORIGINAL comment:
87+
(a) Actionable ask (it requested the author to change something —
88+
e.g. "rename X", "use Y instead", "extract this", "add null check"):
89+
→ Read the CURRENT code at that location.
90+
- If the requested change WAS made → SKIP (user fixed it).
91+
- If the requested change was NOT made → UNRESOLVE the
92+
original thread (do NOT post a new comment). Use:
93+
94+
gh api graphql -f query='
95+
mutation($id:ID!){
96+
unresolveReviewThread(input:{threadId:$id}){
97+
thread{ id isResolved }
98+
}
99+
}' -f id=<THREAD_ID>
100+
101+
where <THREAD_ID> is the thread.id from STEP 1.
102+
→ If thread replies show the author/maintainer explicitly
103+
disagreed or declined ("won't fix", "intentional", "ship it
104+
anyway") → SKIP regardless of code state. The decision was made.
105+
(b) Informational / nit / praise / question (not an ask for a change):
106+
→ SKIP. Resolution means acknowledged; don't re-post and don't
107+
unresolve.
108+
109+
• If a prior comment raised a DIFFERENT topic on the same line → OK to post.
110+
• New issues the prior review missed entirely → post normally.
111+
112+
STEP 4 — Read CLAUDE.md at the repo root first — it references Agents.md
113+
and agent_docs/ which contain all project conventions, architecture, and
114+
rules. Follow every convention defined there during your review.
115+
116+
STEP 5 — Run the review. The /code-review plugin below will analyze the PR
117+
and propose inline comments. You MUST apply STEP 3 as a POSTING GATE on
118+
every single comment the plugin wants to create — this includes comments
119+
the plugin would post via mcp__github_inline_comment__create_inline_comment
120+
or via `gh pr comment`. Concretely:
121+
122+
BEFORE every call to mcp__github_inline_comment__create_inline_comment:
123+
1. Compute (path, line, topic) of the comment you are about to post.
124+
2. Look it up in the dedupe set from STEP 1.
125+
3. Apply STEP 3. If STEP 3 says SKIP → do NOT call the tool at all.
126+
If STEP 3 says UNRESOLVE → call the unresolveReviewThread mutation
127+
INSTEAD of posting a new comment.
128+
4. Only post if STEP 3 says OK to post.
129+
130+
Top-level summary comment — POST ONLY IF the run produced an action.
131+
An action means: (a) you posted at least one new inline comment, OR
132+
(b) you unresolved at least one previously-resolved thread. If neither
133+
happened, post NO summary comment at all — stay completely silent.
134+
Do NOT post filler summaries like "No new issues" or "Nothing to report".
135+
136+
When you DO post a summary, list only: (a) the new findings you posted
137+
this run, and (b) any threads you unresolved this run. Do not list
138+
issues you skipped via the dedupe gate.
139+
140+
Now run the plugin:
43141
/code-review:code-review ${{ github.repository }}/pull/${{ github.event.pull_request.number }} --comment
44142
use_sticky_comment: true
45143
claude_args: |
46-
--allowedTools "mcp__github_inline_comment__create_inline_comment,Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*),Bash(gh pr list:*)"
47-
144+
--allowedTools "mcp__github_inline_comment__create_inline_comment,Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*),Bash(gh pr list:*),Bash(gh api graphql:*),Bash(gh api:*)"

0 commit comments

Comments
 (0)