From codeant
Find the pull request for the current branch, fetch all unresolved CodeAnt AI review comments, validate each code suggestion against surrounding context, and apply only safe, minimal fixes
How this skill is triggered — by the user, by Claude, or both
Slash command
/codeant:codeant-resolve-pr-commentsThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Find the pull request for the current branch, fetch all unresolved CodeAnt AI review comments, validate each code suggestion against the surrounding code context, and apply only safe, minimal fixes that do not break existing logic.
Find the pull request for the current branch, fetch all unresolved CodeAnt AI review comments, validate each code suggestion against the surrounding code context, and apply only safe, minimal fixes that do not break existing logic.
The goal is to identify the correct PR. Use the following logic in order:
If the user provides a PR number (e.g., /codeant-resolve-pr-comments 42):
Use it directly. Skip to Step 2.
If no PR number is given, detect it from the current branch:
git rev-parse --abbrev-ref HEAD
If the branch is main, master, or develop, stop and tell the user: "You are on the default branch. Please switch to a feature branch or provide a PR number."
List open PRs filtered by the current branch:
codeant pr list --source-branch "<current-branch>" --state open --limit 5
The output is a JSON array of PR objects, each with these fields:
number — PR numbertitle — PR titlestate — open/closedauthor — who created itsourceBranch — the source branch nametargetBranch — the target branch nameurl — link to the PRMatch the correct PR:
sourceBranch exactly matches the current branch name, use it.<branch>. Please provide a PR number." and stop.Report that this skill was invoked:
codeant track --event "skill_invoked" --props '{"skill_name": "codeant-resolve-pr-comments", "source": "claude-code", "pr_number": <N>, "pr_url": "<PR_URL>"}'
Where <PR_URL> is the url field from the PR object found in Step 1.
Retrieve all review comments that CodeAnt AI posted on the PR:
codeant pr comments --pr-number <N> --codeant-generated true
The output is a JSON array of comment objects with these fields:
| Field | Description |
|---|---|
id | Unique comment identifier |
type | "review" (inline on code) or "issue" (general PR comment) |
author | Comment author (e.g., codeant-bot) |
body | The full review comment text in markdown |
path | File path where the comment was left (null for general comments) |
line | Line number the comment refers to (null for general comments) |
createdAt | When the comment was posted |
isCodeantComment | Boolean — true if posted by CodeAnt |
resolved | Boolean — true if the comment has been marked resolved |
Filter comments: From the returned array:
resolved is false.type is "issue" or path is null) — these are purely informational (status updates, sequence diagrams, quality gate results) and require no action. Do NOT include them in the summary or flag them for manual review.Go through each remaining unresolved comment and categorize it:
Inline code comments (type is "review" and path is not null):
body field contains the reviewer's feedback. It may include:
suggestion block (GitHub-style suggested change)For each inline comment (grouped by file to minimize re-reading), do the following:
line number, with 30 lines above and 30 lines below for full context.body carefully. Identify:
```suggestion, ```python, ```js, etc.) or inline code that represents a replacement.For each comment, run through these checks:
Check that the code the comment references still exists. The file may have changed since the review. If the code at the referenced line no longer matches what the comment describes, mark as STALE.
Detect if this is an Architect / Logical Review comment. Architect reviews are identified by a title like "Architect Review", "Logical Review", or similar phrasing in the comment body, and typically include a **Prompt for AI Agent** section at the bottom. These are first-class, important reviews — not optional suggestions. Do NOT dismiss them as "big architectural changes" just because the title says architect. Many architect reviews require only a small, localized fix once you understand the intent. Treat them with the same seriousness as any other review.
When handling an architect/logical review:
**Prompt for AI Agent** section. The prompt under that section is the authoritative instruction for what to change — follow it.**Prompt for AI Agent** section and the comment's intent. Do not punt to the user with "no suggestion provided, review manually" — implement the fix yourself, keeping it minimal and localized. Then validate your drafted fix with the same checks in step 3/4.If a code suggestion is present in the body:
If no code suggestion is present:
**Prompt for AI Agent** section as the primary instruction.Based on the validation, assign one of these verdicts to every comment:
ACCEPT — Safe to apply, you should accept this. Assign this when ALL of these are true:
LIKELY ACCEPT — Looks correct, but verify the callers. Assign this when:
DO NOT ACCEPT — This could break things. Assign this when ANY of these are true:
Important: Do NOT mark a comment DO NOT ACCEPT just because it is labeled "Architect Review" or "Logical Review" or because no code snippet is provided. Architect reviews are important and actionable — you are expected to implement the fix yourself based on the **Prompt for AI Agent** section. Only use DO NOT ACCEPT for architect reviews when the change genuinely requires a broad, multi-file restructuring that cannot be done as a minimal localized patch.
STALE — Code has changed since the review. Assign this when:
Before making any changes, present a clear summary to the user:
Then list every comment grouped by verdict:
ACCEPT — Safe to apply (N): For each, show:
LIKELY ACCEPT — Verify callers (N): For each, show:
DO NOT ACCEPT — Could break logic (N): For each, show:
STALE — Code changed since review (N): For each, show:
Then ask the user: "I will apply the N ACCEPT fixes now. For the LIKELY ACCEPT fixes, I recommend you review the callers first — want me to apply those too, or skip them for now?"
After the user confirms:
After applying fixes, report the outcome:
codeant track --event "suggestions_applied" --props '{"skill_name": "codeant-resolve-pr-comments", "source": "claude-code", "pr_number": <N>, "pr_url": "<PR_URL>", "accept_count": <N>, "likely_accept_count": <N>, "do_not_accept_count": <N>, "stale_count": <N>, "total_comments": <N>}'
Use the actual counts from the verdicts assigned in Step 4. For likely_accept_count, only count ones the user chose to apply.
Present a final report:
Applied (N comments):
Not applied — DO NOT ACCEPT (N comments):
Not applied — STALE (N comments):
After applying fixes, resolve the corresponding review conversations on the PR so they no longer show as unresolved. For each comment that was successfully applied (ACCEPT and user-approved LIKELY ACCEPT), run:
codeant pr resolve --pr-number <N> --comment-id <COMMENT_ID>
The --comment-id flag takes the comment's id field from Step 2. The CLI will auto-detect the remote and repo, but you can also pass --remote and --name explicitly.
Platform-specific notes:
--comment-id (the numeric comment ID). The CLI resolves the review thread containing that comment via the GraphQL API. If you already have the GraphQL thread node ID, you can pass --thread-id instead.--discussion-id (the discussion ID from the comment's discussionId field).--comment-id (the numeric comment ID).--thread-id (the numeric thread ID from the comment's threadId field).Run these in sequence (one per applied comment). If a resolve call fails (e.g., insufficient permissions), log a warning but do not stop — continue resolving the remaining comments and report any failures in the final summary.
Do NOT resolve:
type is "issue")After presenting the final report, check which files were modified:
git status --short
List the changed files to the user and ask:
"These are the files that were changed:
<file1><file2>Would you like me to commit and push these changes to the current branch? You can also tell me to commit only specific files."
Before doing anything else, check that the codeant CLI is on the latest version:
npm view codeant-cli version
Compare this with the installed version:
codeant --version
If the installed version is older than the latest published version, update it:
npm install -g codeant-cli@latest
If the update fails (e.g., permission error), warn the user and continue — a slightly outdated CLI is better than blocking the entire workflow.
Provides CDSS development patterns for drug interaction checking, dose validation, clinical scoring (NEWS2, qSOFA), and alert classification integrated into EMR workflows.
npx claudepluginhub codeant-ai/skills --plugin codeant