amia-github-thread-management

Use when managing PR review threads. Reply does NOT auto-resolve threads. Trigger with /manage-threads.

16 stars

Best use case

amia-github-thread-management is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Use when managing PR review threads. Reply does NOT auto-resolve threads. Trigger with /manage-threads.

Teams using amia-github-thread-management should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/amia-github-thread-management/SKILL.md --create-dirs "https://raw.githubusercontent.com/diegosouzapw/awesome-omni-skill/main/skills/cli-automation/amia-github-thread-management/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/amia-github-thread-management/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How amia-github-thread-management Compares

Feature / Agentamia-github-thread-managementStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Use when managing PR review threads. Reply does NOT auto-resolve threads. Trigger with /manage-threads.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# GitHub Thread Management Skill

## Overview

This skill teaches you how to manage GitHub Pull Request review threads. Review threads are conversation containers attached to specific lines of code in a PR diff.

**CRITICAL UNDERSTANDING**: Replying to a review thread does NOT automatically resolve it. Resolution is a separate GraphQL mutation that must be explicitly called. Many developers assume replying resolves threads - this is incorrect.

## Prerequisites

- GitHub CLI (`gh`) installed and authenticated
- Python 3.8+ for running automation scripts
- Repository collaborator access (required for resolving threads)
- GraphQL API access

## Instructions

Follow these steps when managing GitHub PR review threads:

1. **Identify threads requiring attention**: Use `amia_get_review_threads.py --unresolved-only` to list all unresolved threads on the PR
2. **Determine the appropriate action**: Consult the Decision Tree section below to decide whether to reply, resolve, or both
3. **Execute the operation**: Run the corresponding script from the Available Scripts section with the required parameters
4. **Verify success**: Check the JSON output's `success` field and verify the thread state changed as expected
5. **Track progress**: Re-run listing commands to confirm all threads have been properly addressed

### Checklist

Copy this checklist and track your progress:

- [ ] Identify unresolved threads using `amia_get_review_threads.py --unresolved-only`
- [ ] Determine action for each thread (reply/resolve/both)
- [ ] For implemented changes: resolve thread (optionally with reply)
- [ ] For clarification needed: reply only (keep thread open)
- [ ] For batch operations: use `amia_resolve_threads_batch.py`
- [ ] Verify each operation succeeded via JSON output
- [ ] Re-run listing to confirm all threads addressed
- [ ] Check for any comments without replies using `amia_get_unaddressed_comments.py`

## Output

All scripts in this skill output JSON to stdout with the following standard structure:

| Field | Type | Description |
|-------|------|-------------|
| `success` | boolean | Whether the operation completed successfully |
| `threadId` | string | The GraphQL node ID of the affected thread (PRRT_xxx format) |
| `isResolved` | boolean | Current resolution state of the thread after operation |
| `commentId` | string | (Reply operations only) The GraphQL node ID of the created comment |
| `results` | array | (Batch operations only) Array of per-thread success/failure details |
| `error` | string | (On failure) Human-readable error message explaining what went wrong |

See the Script Usage Details section for script-specific output format variations.

## Decision Tree for Thread Operations

```
START: You need to handle a review thread
│
├─► Q: Has the requested change been implemented?
│   │
│   ├─► YES: Do you need to explain what was done?
│   │   │
│   │   ├─► YES: Reply THEN Resolve (two operations)
│   │   │       See: scripts/amia_reply_to_thread.py --and-resolve
│   │   │
│   │   └─► NO: Just Resolve (no reply needed)
│   │           See: scripts/amia_resolve_thread.py
│   │
│   └─► NO: Is clarification needed from the reviewer?
│       │
│       ├─► YES: Reply only (keep thread OPEN)
│       │       See: scripts/amia_reply_to_thread.py (without --and-resolve)
│       │
│       └─► NO: Leave thread untouched until you address it
│
├─► Q: Do you need to resolve MULTIPLE threads at once?
│   │
│   └─► YES: Use batch resolution (1 API call for N threads)
│           See: scripts/amia_resolve_threads_batch.py
│
└─► Q: Do you need to find threads that still need attention?
    │
    ├─► Find all unresolved threads:
    │   See: scripts/amia_get_review_threads.py --unresolved-only
    │
    └─► Find comments without any replies:
        See: scripts/amia_get_unaddressed_comments.py
```

## Key Concepts

### Thread vs Comment

- **Review Thread**: A container that holds one or more comments, anchored to a specific file/line
- **Review Comment**: An individual message within a thread
- **Thread ID**: The GraphQL node ID of the thread (needed for resolution)
- **Comment ID**: The GraphQL node ID of an individual comment

### Thread States

| State | Meaning | When to Use |
|-------|---------|-------------|
| **Unresolved** | Thread requires attention | Default state, indicates pending work |
| **Resolved** | Thread has been addressed | After implementing requested change |

### The Reply-Resolve Separation

GitHub's API separates these operations because:
1. Replying adds a comment to the conversation
2. Resolving changes the thread's status metadata

You might reply without resolving (asking for clarification), or resolve without replying (when the code change speaks for itself).

## Reference Documents

### Thread Resolution Protocol
See [references/thread-resolution-protocol.md](references/thread-resolution-protocol.md)

**Contents:**
- 1.1 Why thread resolution is separate from replying
- 1.2 Single thread resolution workflow
  - 1.2.1 Getting the thread's GraphQL node ID
  - 1.2.2 The resolveReviewThread mutation
  - 1.2.3 Verifying resolution succeeded
- 1.3 Batch thread resolution using GraphQL aliases
  - 1.3.1 Constructing aliased mutations
  - 1.3.2 Handling partial failures
  - 1.3.3 Performance considerations
- 1.4 When to resolve vs when to keep open
  - 1.4.1 Resolve immediately scenarios
  - 1.4.2 Keep open scenarios
- 1.5 Unresolving threads (reopening discussion)

### Thread Conversation Tracking
See [references/thread-conversation-tracking.md](references/thread-conversation-tracking.md)

**Contents:**
- 2.1 Getting thread history via GraphQL
  - 2.1.1 Query structure for review threads
  - 2.1.2 Pagination for threads with many comments
- 2.2 Tracking addressed vs unaddressed comments
  - 2.2.1 Definition of "addressed"
  - 2.2.2 Finding comments without replies
- 2.3 GitHub's comment threading model
  - 2.3.1 Root comments vs reply comments
  - 2.3.2 Outdated comments (when code changes)
- 2.4 Minimized comments handling
  - 2.4.1 What minimized means
  - 2.4.2 When to consider minimized comments

## Available Scripts

All scripts are located in the `scripts/` subdirectory and output JSON to stdout.

| Script | Purpose | Key Parameters |
|--------|---------|----------------|
| `amia_get_review_threads.py` | List all review threads on a PR | `--owner`, `--repo`, `--pr`, `--unresolved-only` |
| `amia_resolve_thread.py` | Resolve a single thread | `--thread-id` |
| `amia_resolve_threads_batch.py` | Resolve multiple threads (1 API call) | `--thread-ids` (comma-separated) |
| `amia_reply_to_thread.py` | Reply to a thread | `--thread-id`, `--body`, `--and-resolve` |
| `amia_get_unaddressed_comments.py` | Find comments without replies | `--owner`, `--repo`, `--pr` |

## Common Workflows

### Workflow 1: Address All Unresolved Threads

```bash
# Step 1: Get all unresolved threads
python3 scripts/amia_get_review_threads.py --owner OWNER --repo REPO --pr 123 --unresolved-only

# Step 2: For each thread, make the code change, then resolve
python3 scripts/amia_resolve_thread.py --thread-id PRRT_xxxxx
```

### Workflow 2: Reply and Resolve in One Command

```bash
# When you want to explain what you did AND resolve
python3 scripts/amia_reply_to_thread.py \
  --thread-id PRRT_xxxxx \
  --body "Fixed by using the recommended approach" \
  --and-resolve
```

### Workflow 3: Batch Resolve After Large Refactor

```bash
# When you've addressed multiple comments in one commit
python3 scripts/amia_resolve_threads_batch.py \
  --thread-ids "PRRT_aaa,PRRT_bbb,PRRT_ccc"
```

### Workflow 4: Find What Still Needs Attention

```bash
# Find comments that haven't received any reply yet
python3 scripts/amia_get_unaddressed_comments.py --owner OWNER --repo REPO --pr 123
```

## Examples

### Example 1: Resolve All Unresolved Threads

```bash
# Get all unresolved threads
python3 scripts/amia_get_review_threads.py --owner myorg --repo myrepo --pr 123 --unresolved-only
# Output: [{"id": "PRRT_abc", "path": "src/main.py", "line": 42, ...}]

# Resolve each thread
python3 scripts/amia_resolve_thread.py --thread-id PRRT_abc
# Output: {"success": true, "threadId": "PRRT_abc", "isResolved": true}
```

### Example 2: Reply and Resolve in One Command

```bash
python3 scripts/amia_reply_to_thread.py \
  --thread-id PRRT_xyz \
  --body "Fixed by refactoring the validation logic" \
  --and-resolve
# Output: {"success": true, "commentId": "...", "resolved": true}
```

## Error Handling

### "Thread not found" Error

**Cause**: The thread ID is incorrect or the thread was deleted.

**Solution**: Re-fetch thread IDs using `amia_get_review_threads.py`. Thread IDs start with `PRRT_` for review threads.

### Resolution Appears to Fail Silently

**Cause**: The mutation succeeded but the response wasn't checked properly.

**Solution**: The script verifies resolution by checking the `isResolved` field in the response. If it returns `false`, the resolution didn't take effect - check permissions.

### Cannot Resolve Thread - Permission Denied

**Cause**: Only the PR author and repository collaborators can resolve threads.

**Solution**: Ensure you're authenticated as a user with write access to the repository.

### Reply Added But Thread Still Unresolved

**Cause**: This is expected behavior! Replying does not resolve.

**Solution**: Use `--and-resolve` flag with `amia_reply_to_thread.py`, or call `amia_resolve_thread.py` separately.

### GraphQL Rate Limiting

**Cause**: Too many API calls in short succession.

**Solution**: Use batch operations (`amia_resolve_threads_batch.py`) to resolve multiple threads in a single API call instead of individual calls.

## Script Usage Details

### amia_get_review_threads.py

```bash
python3 scripts/amia_get_review_threads.py \
  --owner <repository_owner> \
  --repo <repository_name> \
  --pr <pull_request_number> \
  [--unresolved-only]
```

**Output**: JSON array of thread objects with `id`, `isResolved`, `path`, `line`, `body` (first comment).

### amia_resolve_thread.py

```bash
python3 scripts/amia_resolve_thread.py --thread-id <PRRT_xxx>
```

**Output**: JSON object with `success`, `threadId`, `isResolved`.

### amia_resolve_threads_batch.py

```bash
python3 scripts/amia_resolve_threads_batch.py \
  --thread-ids "PRRT_aaa,PRRT_bbb,PRRT_ccc"
```

**Output**: JSON object with `results` array containing per-thread success/failure.

### amia_reply_to_thread.py

```bash
python3 scripts/amia_reply_to_thread.py \
  --thread-id <PRRT_xxx> \
  --body "Your reply message" \
  [--and-resolve]
```

**Output**: JSON object with `success`, `commentId`, `resolved` (if --and-resolve used).

### amia_get_unaddressed_comments.py

```bash
python3 scripts/amia_get_unaddressed_comments.py \
  --owner <repository_owner> \
  --repo <repository_name> \
  --pr <pull_request_number>
```

**Output**: JSON array of comments that have no replies, with `threadId`, `commentId`, `author`, `body`, `path`, `line`.

## Exit Codes (Standardized)

All scripts use standardized exit codes for consistent error handling:

| Code | Meaning | Description |
|------|---------|-------------|
| 0 | Success | Operation completed successfully |
| 1 | Invalid parameters | Bad thread ID format, missing required args |
| 2 | Resource not found | Thread or PR does not exist |
| 3 | API error | Network, rate limit, timeout |
| 4 | Not authenticated | gh CLI not logged in |
| 5 | Idempotency skip | Thread already resolved (for resolve scripts) |
| 6 | Not mergeable | N/A for these scripts |

**Note:** `amia_resolve_threads_batch.py` returns exit code 0 for partial success. Check the JSON output's `summary.failed` field for individual failures.

## Resources

- [references/thread-resolution-protocol.md](references/thread-resolution-protocol.md) - Thread resolution workflow
- [references/thread-conversation-tracking.md](references/thread-conversation-tracking.md) - Conversation tracking patterns

Related Skills

Ground Truth Management

16
from diegosouzapw/awesome-omni-skill

Comprehensive guide to creating, managing, and maintaining ground truth datasets for AI evaluation including annotation, quality control, and versioning

data-management

16
from diegosouzapw/awesome-omni-skill

Comprehensive DataFrame loading, filtering, transformation, and data pipeline management from Excel, CSV, and multiple sources with YAML-driven configuration.

composer-dependency-management

16
from diegosouzapw/awesome-omni-skill

Rules pertaining to Composer dependency management, promoting best practices for declaring and updating dependencies.

claude-config-management

16
from diegosouzapw/awesome-omni-skill

Claude Code設定(リポジトリルート)の構成管理ガイド。ファイルレベルsymlinkによる設定管理、管理対象の追加・削除、Taskfileタスクの実行方法を提供する。「設定ファイルを追加して」「新しいスキルを追加して」「symlinkの状態を確認して」「Claude設定を変更して」のようにClaude Code設定の構成変更を行うときに使用する。

ck:project-management

16
from diegosouzapw/awesome-omni-skill

Track progress, update plan statuses, manage Claude Tasks, generate reports, coordinate docs updates. Use for project oversight, status checks, plan completion, task hydration, cross-session continuity.

agentpmt-tool-file-management-d789ed

16
from diegosouzapw/awesome-omni-skill

Use AgentPMT external API to run the File Management tool with wallet signatures, credits purchase, or credits earned from jobs.

advanced-file-management

16
from diegosouzapw/awesome-omni-skill

Advanced file management tools. Includes batch folder creation, batch file moving, file listing, and HTML author extraction.

1k-state-management

16
from diegosouzapw/awesome-omni-skill

Jotai state management patterns for OneKey. Use when working with atoms, global state, feature state, or context atoms. Triggers on jotai, atom, state, globalAtom, contextAtom, store, persistence, settings.

ads-management

16
from diegosouzapw/awesome-omni-skill

Activate for paid advertising campaigns on Google Ads, Meta Ads, LinkedIn Ads, TikTok Ads. Includes ad copywriting, audience targeting, budget optimization, A/B testing, and ROAS tracking. Used by ads-specialist and campaign-manager agents.

python-github-actions

16
from diegosouzapw/awesome-omni-skill

Complete Python GitHub Actions system. PROACTIVELY activate for: (1) uv-based CI workflows (10-100x faster), (2) Matrix testing across Python versions, (3) Dependency caching with setup-uv, (4) Parallel test execution, (5) Reusable workflows, (6) Publishing to PyPI with trusted publishing, (7) Code coverage with codecov, (8) Security scanning. Provides: Workflow templates, caching config, matrix strategies, composite actions. Ensures fast, reliable CI/CD pipelines.

phoenix-github

16
from diegosouzapw/awesome-omni-skill

Manage GitHub issues, labels, and project boards for the Arize-ai/phoenix repository. Use when filing roadmap issues, triaging bugs, applying labels, managing the Phoenix roadmap project board, or querying issue/project state via the GitHub CLI.

kanban-management

16
from diegosouzapw/awesome-omni-skill

Manages the Anubis Issue Tracker GitHub project board. Use when you need to organize issues by difficulty/status, move issues through workflow stages, or generate board status reports.