Labsco
microsoft logo

pr-review-comments

✓ Official542

by microsoft · part of microsoft/semantic-link-labs

Guide for submitting/posting inline PR review comments to GitHub. Use this when you need to post code review comments on specific lines of a Pull Request.

🔥🔥🔥✓ VerifiedFreeQuick setup
🧰 Not standalone. This skill ships with microsoft/semantic-link-labs and only works together with that tool — install the tool first, then add this skill.

This is the playbook your agent receives when the skill activates — you don't need to read it to use the skill, but it's here to audit before installing.

by microsoft

Guide for submitting/posting inline PR review comments to GitHub. Use this when you need to post code review comments on specific lines of a Pull Request. npx skills add https://github.com/microsoft/semantic-link-labs --skill pr-review-comments Download ZIPGitHub542

Posting Inline PR Review Comments to GitHub

This skill documents how to post inline review comments to GitHub Pull Requests using the GitHub CLI (gh) and GitHub API. Inline comments appear directly on specific lines of code in the PR diff, making it easier for PR authors to identify and address issues.

When to Use This Skill

Use this skill when you need to:

  • Post inline review comments on specific lines of a PR

  • Automate code review feedback with targeted comments

  • Submit batch review comments via the GitHub API

Method: Using GitHub API with JSON Payload

Step 1: Get the PR's Head Commit SHA

COMMIT_SHA=$(gh api repos/{OWNER}/{REPO}/pulls/{PR_NUMBER} --jq '.head.sha')
echo "Commit SHA: $COMMIT_SHA"

Step 2: Create the Review JSON Payload

Create a JSON file with the review comments. Each comment needs:

  • path: The file path relative to repository root

  • line: The line number in the new version of the file (right side of diff)

  • body: The comment content (supports Markdown)

cat > /tmp/review.json

## Important Notes

### Line Numbers

 

- The `line` field refers to the line number in the **new version** of the file (right side of the diff) 

- For deleted lines, use `side: "LEFT"` and the line number from the old version 

- Make sure the line number exists in the diff, otherwise the API will reject the comment 

### Event Types

 Event Description 
 `"COMMENT"` Just add comments without approving/requesting changes 
 `"APPROVE"` Approve the PR with comments 
 `"REQUEST_CHANGES"` Request changes with comments 
 

### Comment Body Formatting

 

- Supports full GitHub Markdown 

- Use `\n` for newlines in JSON 

- Escape special characters properly 

- Use emoji prefixes for severity: 🔴 Critical/High, 🟡 Medium/Minor, 🟢 Suggestion 

### Multi-line Comments

 For commenting on a range of lines:

{ "path": "src/file.py", "start_line": 10, "line": 15, "body": "This comment spans lines 10-15" }


## Alternative: Using `gh pr review` Command

For simpler reviews without inline comments:

gh pr review {PR_NUMBER} --repo {OWNER}/{REPO} --comment --body "Your review comment here"


 This posts a general review comment but does **not** support inline comments on specific lines.

## Repository-Specific Information

- **Repository**: `microsoft/semantic-link-labs` 

- **Common file paths**:
 

- `src/sempy_labs/{module}/_items.py` 

- `src/sempy_labs/{module}/__init__.py` 

 

- **Review comment conventions**:
 

- Use severity emojis: 🔴 Critical, 🟡 Medium, 🟢 Minor 

- Include "Suggested fix" with code blocks 

- Reference specific line numbers

## Examples

See the [examples/](https://github.com/microsoft/semantic-link-labs/blob/main/.claude/skills/pr-review-comments/examples/) folder for complete working scripts:

 

- [post_pr1059_review.sh](https://github.com/microsoft/semantic-link-labs/blob/main/.claude/skills/pr-review-comments/examples/post_pr1059_review.sh) - Example script posting inline review comments to PR #1059