skills/doc-n-fix/SKILL.md
Processes PR review feedback into a prioritized checklist, documents it to a user-chosen destination, then fixes issues one by one with progress tracking. Use when user says "doc-n-fix", "fix review comments", "address feedback", "work through PR review", or "fix PR comments".
npx skillsauth add nathan13888/nice-skills doc-n-fixInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Gather PR review feedback, document it as a prioritized checklist, then fix issues one by one -- checking them off as you go.
Follow all 7 steps sequentially.
Parse the invocation from everything after /doc-n-fix:
/doc-n-fix (bare) -- auto-detect from current branch/doc-n-fix 42 or /doc-n-fix #42 -- specific PR number/doc-n-fix https://github.com/owner/repo/pull/42 -- PR URL/doc-n-fix --manual -- user will paste feedback directly (skip GitHub gathering)Auto-detect (bare invocation or PR number):
gh pr view --json number,title,url,body,headRefName,state
For a specific PR number, append the number: gh pr view {number} --json ...
PR state gate -- if state is MERGED or CLOSED, report "PR #{number} is {state} -- nothing to fix." and STOP.
Edge cases:
gh not installed or not authenticated -- suggest gh auth login and stop.AskUserQuestion to ask for a PR number, URL, or --manual.Store PR metadata: number, title, url, headRefName, state.
Run a single Bash call to get repo info:
gh repo view --json owner,name
Then run 3 parallel Bash calls to collect all review types:
gh pr view {number} --json reviews
gh api --paginate repos/{owner}/{repo}/pulls/{number}/comments
gh pr view {number} --json comments
Error handling -- if any gh command fails, route by error:
| Error | Action |
| -------------------------- | -------------------------------------------------------- |
| 404 Not Found | PR number is wrong or repo mismatch -- report and STOP |
| Authentication / 401 / 403 | Suggest gh auth login and STOP |
| Rate limit / 429 | Report "GitHub rate limit hit -- wait and retry" and STOP |
| Other errors | Print the raw error message and STOP |
Combine all feedback into a single list. Deduplicate using these explicit criteria:
id -- exact duplicate, keep one copypath + line + author -- merge into one item, keep the newest bodyin_reply_to_id collapse to a single itemDO NOT deduplicate based on similar body text alone -- reviewers may intentionally leave similar comments on different locations.
Empty feedback gate -- if all 3 sources return zero comments/reviews, use AskUserQuestion: "No review feedback found. Options: (1) Switch to --manual mode and paste feedback, (2) Stop."
--manual)Use AskUserQuestion to ask the user to paste their review feedback. Parse using these rules:
1., 2.), bullet points (-, *), or blank-line-separated paragraphsfile.ts:42, line 42, in foo.ts, at line NParse all feedback into fix items. For each item, extract:
| Field | Description |
| ----------- | ----------------------------------- |
| # | Sequential number |
| Description | What needs to change |
| Source | @author who left the comment |
| Location | file:line when available |
| Priority | P1, P2, or P3 |
| Effort | S (small), M (medium), or L (large) |
Group related comments into single items:
Present the list as a markdown table with columns: #, Description, Source, Location, Priority, Effort. Then use AskUserQuestion with these options:
After each user edit, re-number items sequentially (no gaps). Repeat until the user confirms "Looks good."
Use AskUserQuestion to ask where to write the checklist:
## Review Checklist section (Recommended)REVIEW-{PR#}.mdAskUserQuestion to get the path, use Write to create the file, treat subsequent updates like a local file via EditUse AskUserQuestion to ask what order to fix items:
Format the checklist using - [ ] items (renders as interactive checkboxes on GitHub):
## Review Checklist
**PR:** #{number} -- {title} | **Progress:** 0/{total}
### P1 -- Must Fix
- [ ] **#1** `src/auth.ts:42` -- Fix null check in auth middleware (@reviewer1, S)
### P2 -- Should Fix
- [ ] **#2** `src/api/users.ts:88` -- Extract validation to shared util (@reviewer2, M)
### P3 -- Nice to Have
- [ ] **#3** `src/api/users.ts:12` -- Rename variable for clarity (@reviewer1, S)
Write to the chosen destination:
gh pr view {number} --json body --jq '.body'. If ## Review Checklist already exists, find it and replace everything from ## Review Checklist to the next ## heading or EOF. Otherwise append. Use Write to create /tmp/pr-body-{number}.md, then run gh pr edit {number} --body-file /tmp/pr-body-{number}.md.Write to create /tmp/pr-comment-{number}.md, then run gh pr comment {number} --body-file /tmp/pr-comment-{number}.md. Parse the comment URL from the command output, extract the numeric comment ID (last segment of the URL), and store it for Step 6 updates.Write to create the file.Important: Use Write tool for all temp files -- DO NOT use echo, cat <<EOF, or shell redirects. Always use --body-file or -F body=@file (capital F) for gh write commands.
Work through items in the chosen order, one at a time. For each item:
Read context -- Read the file(s) referenced in the comment. Use Grep to find related usages. Understand the surrounding code.
Apply fix:
Read and Edit directly.Task agent (subagent_type: general-purpose) with the fix description, relevant file paths, and reviewer comment as context.Ambiguity gate -- if the reviewer's intent is unclear, use AskUserQuestion with options:
{ item_number, description, reason } -- used in Step 7)Ask reviewer option: Use Write to create /tmp/reply-{number}.md with the clarifying question, then post a reply:
gh api repos/{owner}/{repo}/pulls/{number}/comments/{comment_id}/replies -F body=@/tmp/reply-{number}.md
If this returns 404 (the comment_id may be a top-level PR comment, not a review comment), fall back to:
gh pr comment {number} --body-file /tmp/reply-{number}.md
Error recovery -- if a fix fails (edit produces errors, tests break, etc.): revert the affected files with git checkout -- {files}, record the item as skipped with reason "fix failed", and proceed to the next item.
After each fix, immediately update the checklist:
**#{item_number}** and change - [ ] to - [x].**Progress:** line and increment the first number.Destination-specific update method:
gh pr view {number} --json body --jq '.body', find and toggle the item, update the progress counter, use Write to create /tmp/pr-body-{number}.md, write back via gh pr edit {number} --body-file /tmp/pr-body-{number}.md.gh api repos/{owner}/{repo}/issues/comments/{comment_id} --jq '.body', update, use Write to create /tmp/pr-comment-{number}.md, write back via gh api repos/{owner}/{repo}/issues/comments/{comment_id} -X PATCH -F body=@/tmp/pr-comment-{number}.md.Edit to toggle the checkbox and update the counter directly.Update-failure recovery -- if the write fails (conflict, stale content), re-read the latest content and retry once. If it still fails, log the error and continue fixing remaining items -- bulk-update the checklist at the end.
Print brief progress after each update:
Fix #1 complete: Fix null check in auth middleware -- Progress: 1/5
Proceed to the next item automatically -- do NOT ask "continue?" between items.
After all items are processed, output:
## Doc-n-Fix Complete: PR #{number}
**Fixed:** {completed}/{total} | **Skipped:** {skipped}
### Completed
- [x] #1 {description} (P1, S)
- [x] #2 {description} (P2, M)
### Skipped (if any)
- [ ] #3 {description} -- {reason}
## What's Next?
1. **Push changes** -- commit and push all fixes
2. **Re-request review** -- notify reviewer that feedback is addressed
3. **Fix skipped items** -- revisit items that were skipped
4. **Run /check** -- verify the fixes are complete
5. **View diff** -- see all changes made
/commit after.Write tool for all temp files -- use the Write tool to create temp files, include the PR number in the filename (e.g., /tmp/pr-body-{number}.md). DO NOT use echo, cat <<EOF, or shell redirects. Pass temp files via --body-file or -F body=@file (capital F).## Review Checklist already exists in the PR description, replace it. Don't append a second copy.Task agents only for complex individual fixes (3+ files or ambiguous scope) -- keep most fixes fast and direct with Read/Edit./tmp/pr-body-{number}.md, /tmp/pr-comment-{number}.md, /tmp/reply-{number}.md, and similar temp files after use.gh pr comment output and store it for Step 6 updates. If the stored comment ID becomes invalid, re-fetch via gh api repos/{owner}/{repo}/issues/{number}/comments --jq '.[] | select(.body | contains("## Review Checklist")) | .id'.gh command fails. Always report the error and either STOP or route to a recovery action.data-ai
Ingest arbitrary feedback (GitHub/GitLab URL, pasted review, image, file path, free text) about the current repo, decompose it into a prioritized action plan with per-item owners (human / main-agent / subagent), confirm with the user, then dispatch execution. Use when user says "/tackle", "address this feedback", "act on this review", "work through this feedback", or "what should I do about this".
development
Capture a problem or change request, verify it lightly against the codebase, draft a structured issue report, then route to one of: upload to GitHub/GitLab, document in code, hand off for implementation, or a free-text next step. Use when user says "/issue", "report a problem", "file a bug", "raise an issue", "track this", or "open a ticket".
testing
Create a new git branch off trunk using the project's existing naming convention. Detects trunk (main/master/etc.) and the dominant prefix pattern (feat/, <username>/, etc.) from existing branches, slugifies the feature description, and runs git checkout -b. Use when user says "feature branch", "new branch", "create branch", "git branch", or "/feature-branch".
development
Quick situational awareness for the current git branch. Summarizes what a feature branch is about by analyzing commits and changes against trunk. On trunk, highlights recent interesting activity. Use when user says "wtf", "what's going on", "what is this branch", "what changed", or "catch me up".