pr-comment-fixer
Skill1 starsChanged 8 months agoMITView on GitHub
Validates statements in PR comments against official references, fixes any identified issues in the codebase, runs a full production-readiness audit (security, performance, concurrency, lint), and commits the result. Use when asked to 'fix pr comment', 'address review comment', 'validate PR feedback', 'act on a PR comment', or 'fix the issue raised in PR #N'.
- Reads credentials
We split this skill into the rules it gives an agent
33 rules. About 0 are common, 22 are distinctive, and 11 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈22
Distinctive · estimate
This author's own choices. Worth a look.
11
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 23
Never apply a fix you have not validated.
- Distinctive: line 24
Always show the user your verdict and the exact change you plan to make before editing any file.
- Distinctive: line 25
Prefer the smallest safe change.
- Very specific: line 26
When a claim involves Swift Concurrency, load the swift-concurrency skill for authoritative guidance before making changes.
- Very specific: line 27
When a claim involves SwiftLint / style, run the lint skill after fixing.
- Distinctive: line 28
Every fix must survive the full audit loop (Step 5) before committing.
- Distinctive: line 29
If a fix introduces an API-breaking change, flag it to the user before proceeding.
- Very specific: line 30
Do not use Write to create new source files as part of a fix.
- Distinctive: line 36
If the comment is a question or a suggestion with no actionable fix → answer the reviewer directly.
- Distinctive: line 37
If the fix requires a significant API redesign or multi-module changes → stop after the verdict and discuss the approach with the user.
- Distinctive: line 38
If you are not confident in the validation (no official reference found) → report what you found and ask the user to decide.
- Very specific: line 44
If $ARGUMENTS is a PR number (e.g.
- Very specific: line 51
If gh returns an authentication error, stop and tell the user: "gh is not authenticated — run gh auth login first."
- Very specific: line 53
If $ARGUMENTS is already the comment text, skip the fetch.
- Very specific: line 64
Read the target file and Package.swift in parallel before running any tool:
- Very specific: line 71
If the target file does not exist, stop and report: "File <path> not found — the comment may refer to a renamed or deleted file."
- Distinctive: line 73
After reading, reason through the claim explicitly before deciding.
- Distinctive: line 89
Check against OWASP, Apple Security docs, or Swift Foundation docs:
- Very specific: line 102
Look for: synchronous work on the main actor, unbounded Task.detached creation, O(n²) on unbounded collections.
- Distinctive: line 106
Run lint first — confirm the rule is actually violated before changing anything:
- Distinctive: line 124
Before editing any file, present:
- Distinctive: line 140
If the claim is incorrect: present the counter-evidence the author can use to respond to the reviewer.
- Distinctive: line 141
If the claim requires more context: ask the user for it before proceeding.
- Distinctive: line 142
Wait for explicit user approval before moving to Step 4.
- Distinctive: line 148
After user confirmation, apply only the change described in Step 3.
- Distinctive: line 150
For concurrency fixes: Follow the swift-concurrency skill's "Smallest Safe Fixes" and "Migration Validation Loop".
- Distinctive: line 160
Run the full audit loop in order.
- Distinctive: line 162
After each step, reflect on the output: distinguish errors your change introduced from pre-existing ones.
- Distinctive: line 179
Required: All tests pass.
- Very specific: line 213
Only if the change touches network or provider code, and ANTHROPIC_API_KEY is available:
- Distinctive: line 237
After completing all steps, report:
- Distinctive: line 259
If the claim was incorrect, include a ready-to-paste reply the author can post to the reviewer.
- Very specific: line 268
Read Sources/AIProviderTools/CurrentTimeTool.swift and Package.swift in parallel.
≈ “Common” is an estimate: at least 1 in 5 of the 308,232 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
PR Comment Fixer
You are a production-quality Swift engineer acting on PR review feedback. Your job is to:
- Parse the comment — understand exactly what the reviewer is claiming or requesting.
- Validate the claim — consult official references to confirm whether the reviewer is correct.
- Confirm with the user — show your verdict and proposed fix before touching any file.
- Fix the code — apply the minimal change that satisfies the validated concern.
- Audit the result — run the full loop; revise and re-audit if anything fails.
- Commit — delegate to the
commitskill.
Agent Rules
- Never apply a fix you have not validated. If the reviewer's claim is factually wrong, do not change the code — document the counter-evidence instead.
- Always show the user your verdict and the exact change you plan to make before editing any file. Wait for confirmation. (Exception: single-line typo or formatting fixes may proceed without confirmation.)
- Prefer the smallest safe change. Do not refactor unrelated code.
- When a claim involves Swift Concurrency, load the
swift-concurrencyskill for authoritative guidance before making changes. - When a claim involves SwiftLint / style, run the
lintskill after fixing. - Every fix must survive the full audit loop (Step 5) before committing. If audit fails, revise the fix and re-audit — do not skip steps.
- If a fix introduces an API-breaking change, flag it to the user before proceeding.
- Do not use
Writeto create new source files as part of a fix.Editexisting files only. (Writeis not in the allowed-tools list for this reason.)
When NOT to use this skill
- If the comment is a question or a suggestion with no actionable fix → answer the reviewer directly.
- If the fix requires a significant API redesign or multi-module changes → stop after the verdict and discuss the approach with the user.
- If you are not confident in the validation (no official reference found) → report what you found and ask the user to decide.
Step 1 — Fetch and Parse the Comment
If $ARGUMENTS is a PR number (e.g. 42 or #42), fetch inline review comments:
gh pr view $PR_NUMBER --json reviews,comments --jq '.reviews[].body, .comments[].body'
gh api repos/:owner/:repo/pulls/$PR_NUMBER/comments --jq '.[].body'If gh returns an authentication error, stop and tell the user: "gh is not authenticated — run gh auth login first."
If $ARGUMENTS is already the comment text, skip the fetch.
Extract:
- Claim: What the reviewer is asserting (e.g. "this has a data race", "missing
await", "insecure interpolation") - Location: File path + line range, if mentioned
- Category: One of
concurrency,security,performance,style,correctness,api-design,other
Step 2 — Validate the Claim
Read the target file and Package.swift in parallel before running any tool:
Read: <target file> (parallel)
Read: Package.swift (parallel)If the target file does not exist, stop and report: "File <path> not found — the comment may refer to a renamed or deleted file."
After reading, reason through the claim explicitly before deciding. Write out:
- What the code actually does
- Whether the reviewer's claim is supported by the code
- Which official source confirms or refutes it
Validation strategy by category:
Concurrency claims
Load the swift-concurrency skill. Cross-check:
- Current isolation boundary and language mode from
Package.swift - Exact compiler diagnostic, if reproducible:
swift build 2>&1 - Relevant reference file from the skill's decision tree
Security claims
Check against OWASP, Apple Security docs, or Swift Foundation docs:
WebSearch: site:developer.apple.com <topic>
WebSearch: site:owasp.org <topic>Performance claims
WebSearch: swift <topic> performance WWDC site:developer.apple.comLook for: synchronous work on the main actor, unbounded Task.detached creation, O(n²) on unbounded collections.
Style / correctness claims
Run lint first — confirm the rule is actually violated before changing anything:
swift package plugin --allow-writing-to-package-directory swiftlint lint --strict 2>&1API design claims
WebSearch: site:swift.org/documentation/api-design-guidelines <topic>Load references/swift-api.md for common misunderstandings.
Step 3 — Confirm with the User
Before editing any file, present:
**Verdict:** ✅ Correct | ⚠️ Partially correct | ❌ Incorrect
**Reference:** <URL or source>
**Reasoning:** <one short paragraph — what the code does, why the claim is or isn't valid>
**Proposed change:**
File: <path>
- Remove: <what is removed>
+ Add: <what is added>
Proceed? (yes / no / adjust)- If the claim is incorrect: present the counter-evidence the author can use to respond to the reviewer. Stop here unless the user says to proceed anyway.
- If the claim requires more context: ask the user for it before proceeding.
- Wait for explicit user approval before moving to Step 4.
Step 4 — Apply the Fix
After user confirmation, apply only the change described in Step 3.
For concurrency fixes: Follow the swift-concurrency skill's "Smallest Safe Fixes" and "Migration Validation Loop".
For security fixes: Sanitize at system boundaries; do not over-validate internal paths.
For style fixes: Apply only the violated rule; do not reformat surrounding code.
Step 5 — Production-Readiness Audit
Run the full audit loop in order. Do not skip steps even if earlier ones pass.
After each step, reflect on the output: distinguish errors your change introduced from pre-existing ones. Only fix errors your change caused.
5a — Build
swift build 2>&1Required: Zero new errors or warnings. If your change introduced warnings, fix them before continuing. If build fails due to your change: Revise the fix (return to Step 4) and re-run from 5a. Do not proceed to 5b with a broken build.
5b — Tests
swift test 2>&1Required: All tests pass. If a test fails due to your change: Fix the test or the code, then re-run from 5a. Do not skip.
5c — Lint
swift package plugin --allow-writing-to-package-directory swiftlint lint --strict 2>&1Required: Found 0 violations. If your fix introduced a violation, correct it and re-run from 5a.
5d — Security Review
For the changed file(s):
- No user-controlled input in shell commands, file paths, or SQL without sanitization
- No secrets, API keys, or tokens in source or logs
- No force-unwraps on externally-sourced data (network, user input, file I/O)
- Keychain used for sensitive credentials (not
UserDefaultsor in-memory globals) - No
@unchecked Sendableadded without a documented safety invariant - No
nonisolated(unsafe)added without a documented safety invariant - URL construction uses
URLComponents, not string interpolation - HTTP requests use HTTPS; no hardcoded
http://endpoints
5e — Performance Review
- No synchronous blocking calls (sleep, semaphore) inside
asyncfunctions - No unbounded task creation (loop calling
Task { }without a group or limit) - No
O(n²)or worse algorithms on unbounded collections - Main actor work is minimal — heavy computation off-actor
- No retain cycles introduced in closures
5f — Integration Tests (if applicable)
Only if the change touches network or provider code, and ANTHROPIC_API_KEY is available:
ANTHROPIC_API_KEY=<YOUR_ANTHROPIC_API_KEY> swift package integration-tests 2>&1Step 6 — Commit
Once the full audit passes, show the user the diff and ask for commit confirmation:
git diff HEADThen delegate to the commit skill — do not re-implement commit logic here:
Invoke:
/commit
Output Format
After completing all steps, report:
## PR Comment Fix Report
**Comment:** <quoted claim from reviewer>
**Verdict:** ✅ Correct | ⚠️ Partially correct | ❌ Incorrect
**Reference:** <URL or official source>
**Change applied:** <one-sentence summary, or "No change — claim is incorrect">
**Files changed:** <list>
**Audit results:**
- Build: ✅ 0 new errors/warnings
- Tests: ✅ N passed
- Lint: ✅ 0 violations
- Security: ✅ Checklist passed
- Perf: ✅ Checklist passed
**Commit:** <short hash> <subject>If the claim was incorrect, include a ready-to-paste reply the author can post to the reviewer.
Worked Example
Input: "The shared DateFormatter static property is not thread-safe and will cause data races under Swift 6 strict concurrency."
Step 2 — Validate:
- Read
Sources/AIProviderTools/CurrentTimeTool.swiftandPackage.swiftin parallel. Package.swiftshowsswift-tools-version: 6.2with.enableUpcomingFeature("StrictConcurrency").- The static
DateFormatteris notSendable. Under strict concurrency, accessing it from any isolation domain is flagged. - Apple docs confirm:
DateFormatteris not safe for concurrent reads duringstring(from:). ISO8601DateFormatteris thread-safe after init per Apple docs — the reviewer is wrong about that part.- Verdict: ⚠️ Partially correct.
DateFormatteris the real issue;ISO8601DateFormatteris not.
Step 3 — Confirm:
Present verdict + proposed change (remove both static formatters, use Date.FormatStyle / Date.ISO8601Format() value types). Wait for user confirmation.
Step 4 — Fix:
Replace static formatters with per-call now.formatted(date: .complete, time: .complete) and now.ISO8601Format().
Step 5 — Audit:
swift build → clean. swift test → 41 passed. swift package swiftlint lint --strict → 0 violations. Checklists passed.
Step 6 — Commit:
Delegate to /commit.
Reference Files — Load On-Demand
| Situation | Load |
| Concurrency / data-race claim | swift-concurrency skill |
| SwiftLint violation claim | lint skill |
| Swift API correctness question | references/swift-api.md |
| Security vulnerability patterns | references/security.md |
In this repository12 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
- add-providerSkill
- add-toolSkill
- commitSkill
- lintSkill
- swift-architecture-skillSkill
- swift-concurrency-proSkill
- swift-testing-proSkill
- swiftui-proSkill
- testSkill
- update-bannerSkill
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

