Skip to content

code-review: Use inline review comments with suggested changes instead of regular PR comments #423

Description

@projectdelta6

Summary

The code-review skill currently posts its findings as a regular PR comment using gh pr comment. It would be much more useful if it posted inline review comments with GitHub's suggestion syntax instead, so that reviewers get an "Apply suggestion" button directly in the GitHub UI.

Current behavior

Step 8 of the skill posts a single PR comment with links to the relevant code. This works, but the reviewer has to manually navigate to each file and make the changes themselves.

Proposed behavior

Use the GitHub Reviews API to post inline comments with suggested changes:

gh api repos/{owner}/{repo}/pulls/{number}/reviews \
  --method POST \
  --input - <<'JSON'
{
  "commit_id": "<full_sha>",
  "event": "COMMENT",
  "comments": [
    {
      "path": "path/to/file.kt",
      "start_line": 10,
      "line": 12,
      "side": "RIGHT",
      "start_side": "RIGHT",
      "body": "Description of the issue.\n\n```suggestion\nfixed code here\n```"
    }
  ]
}
JSON

This gives the PR author a clickable "Apply suggestion" / "Commit suggestion" button in the GitHub UI, making it much faster to act on review feedback.

Additional context

  • The allowed-tools in the skill frontmatter would need to include Bash(gh api:*) in addition to the existing gh pr permissions.
  • For issues where a concrete fix can be suggested, use inline comments with suggestion blocks. For more general observations without a clear single-line fix, a regular review body comment is still fine.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions