Post review

From gittower/git-flow-next · View interactive version

Post review is an AI agent skill from the GitHub repository gittower/git-flow-next. Post a written review file to GitHub as a proper PR review

How to use this skill

Skill file

Post Review

Post a previously written review file to GitHub as a proper PR review with inline comments. Supports both /pr-review and /code-review output formats.

Arguments

/post-review <target> [additional instructions]

Instructions

1. Parse Arguments

Extract the target from $ARGUMENTS:

2. Find the Review File

If target is a PR number:

1. .ai/pr-<number>/pr-review-*.md (pr-review format with frontmatter)

2. .ai/pr-<number>/review-pr<number>-*.md (code-review format)

3. .ai/issue-*-*/pr-review-*.md matching the PR number in frontmatter

4. .ai/issue-*-*/review-pr<number>-*.md

If target is a file path:

3. Detect Review Format and Parse

The skill handles two review file formats:

Format A: /pr-review output (has YAML frontmatter)

---
pr: <number>
event: <APPROVE|COMMENT|REQUEST_CHANGES>
---

<summary text>

**Must Fix**
- ...

**Should Fix**
- ...

**Nit**
- ...

## Inline Comments

### `<file>:<line>`
<comment body>

Parse:

Format B: /code-review output (no frontmatter)

# Code Review: PR #<number> - <title>

## Summary
- PR: #<number> - <title>
...

## Checklist Results

### Passed
- ...

### Must Fix
- [ ] **<title>** - `<file>:<line>` - <description>

### Should Fix
- [ ] **<title>** - `<file>:<line>` - <description>

### Nits
- ...

## Recommendations
1. ...

Parse:

4. Get PR Diff for Line Mapping

Fetch the PR diff to map file:line references to actual diff positions:

gh pr diff <number>

Also fetch the PR metadata:

gh pr view <number> --json headRefOid,number,baseRefName --jq '{headRefOid: .headRefOid, number: .number, baseRefName: .baseRefName}'

For each inline comment, verify the referenced line is visible in the diff. If a line is not in the diff, move that finding into the review body summary instead.

5. Apply Additional Instructions

If the user provided additional instructions, apply them now. Common patterns:

Use judgement to interpret the instructions. The goal is to give the user control over exactly what gets posted.

6. Compose the GitHub Review

Review body (the body parameter):

For Format A (pr-review): use the parsed review body text directly (between frontmatter and inline comments), after applying any filtering from step 5.

For Format B (code-review): compose the review body per GITHUB_GUIDELINES.md (concise, no emojis, no checkboxes — it's a public GitHub review, not the full local file):

Do not append any AI-attribution line to the review body (no "Generated with Claude" line, no emoji) — AI credit is via Co-Authored-By commit trailers only. Before posting, verify the review body and inline comments against the posting checklist. See GITHUB_GUIDELINES.md.

Inline comments (the comments array):

For each inline comment that maps to a valid diff line:

Important: Only include inline comments for lines that appear in the diff. The GitHub API will reject comments on lines not visible in the diff.

7. Preview Before Posting

Before posting, show the user a preview:

**PR #<number> — Review Preview**

Event: <APPROVE|COMMENT|REQUEST_CHANGES>

Body:
<first 5 lines of body>...

Inline comments: <count>
<list each as "- `file:line` — first 50 chars of comment...">

Then ask: "Post this review?"

Wait for the user's confirmation before proceeding. If they say no or want changes, adjust accordingly.

8. Post the Review

Determine repo owner and name:

gh repo view --json owner,name --jq '"\(.owner.login) \(.name)"'

Post using mcp__github__create_pull_request_review with:

9. Report Result

After posting:

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.