ai-governance
Generate and enforce policy gates for AI coding agents (Copilot, Claude Code) — real-time session hooks that deny protected-path edits and dangerous commands,…
Triages a PR comment — from a bot (Copilot, CI) or a human reviewer. Fetches the comment and diff via gh CLI, classifies it, applies the fix directly to the file if valid, posts a reply on the thread, and resolves it. Run from inside the repo.
> /plugin marketplace add nitinjain999/platform-skills > /plugin install platform-skills@platform-skills
How it fires
How this command gets triggered: by you, by Claude, or both.
/triageContext preview
What this command does when you run it.
Triages a PR comment — from a bot (Copilot, CI) or a human reviewer. Fetches the comment and diff via gh CLI, classifies it, applies the fix directly to the file if valid, posts a reply on the thread, and resolves it. Run from inside the repo.
name: triage description: Triages a PR comment — from a bot (Copilot, CI) or a human reviewer. Fetches the comment and diff via gh CLI, classifies it, applies the fix directly to the file if valid, posts a reply on the thread, and resolves it. Run from inside the repo. argument-hint: "<PR number> <comment ID> | --all <PR number>" title: "Triage Command" sidebar_label: "triage" custom_edit_url: null
You are a senior platform engineer triaging PR comments.
Input: `$ARGUMENTS`
Two modes:
Run all `gh` commands directly. You have full access to the shell.
---
For a single comment:
# Get the comment text
gh api repos/{owner}/{repo}/pulls/comments/<comment_id>
# or for a PR issue comment:
gh api repos/{owner}/{repo}/issues/comments/<comment_id>
# Get only the patch for the file the comment references (from .path field)
# --paginate handles PRs with >30 changed files
# If the comment has no .path (issue comment), fall back to the full diff:
# gh pr diff <pr_number>
gh api repos/{owner}/{repo}/pulls/<pr_number>/files --paginate \
--jq '.[] | select(.filename == "<comment.path>") | .patch // "binary or large diff — no patch available"'For `--all`:
# List all unresolved review threads
gh api graphql -f query='
query($owner:String!, $repo:String!, $pr:Int!) {
repository(owner:$owner, name:$repo) {
pullRequest(number:$pr) {
reviewThreads(first:100) {
nodes {
id isResolved
comments(first:1) {
nodes { databaseId body path line author { login } }
}
}
}
}
}
}' -f owner=<owner> -f repo=<repo> -F pr=<pr_number>---
**For file-scoped comments** (comment has a `.path` field): before classifying, check whether the flagged identifier still exists at HEAD:
# Get the HEAD SHA
gh pr view <pr_number> --json headRefOid --jq '.headRefOid'
# Check if the flagged identifier exists in the file at HEAD
gh api repos/{owner}/{repo}/contents/<comment.path>?ref=<head_sha> \
--jq '.content' | base64 -d | grep -n "<flagged identifier>"If the identifier is absent → classify **NOT_APPLICABLE** immediately (addressed in a later commit). Skip Steps 3–4 and go straight to the reply.
**Then choose exactly one classification:**
**ACTIONABLE_FIX** — a real problem in the changed files that must be fixed:
**INFORMATIONAL** — question, out-of-scope suggestion, or future improvement:
**NOT_APPLICABLE** — no action needed:
---
Read the file referenced in the comment:
cat <file_path>
Make the minimal correct change using the Edit tool. Do not touch unrelated lines.
Then commit:
git add <file_path> git commit -m "fix(<scope>): <what was wrong and what was corrected>" git push
---
For a review comment:
gh api --method POST \
repos/{owner}/{repo}/pulls/<pr_number>/comments/<comment_id>/replies \
--field body="<reply>"For a PR issue comment:
gh pr comment <pr_number> --body "<reply>"
Reply rules:
Example ACTIONABLE_FIX reply: > Added `resources.requests` (cpu: 100m, memory: 128Mi) and `resources.limits` (memory: 256Mi) to the `api` container in `apps/api/deployment.yaml`. ✅ Fixed
---
# Get the thread node ID (PRRT_ prefix)
gh api graphql -f query='
query($owner:String!, $repo:String!, $pr:Int!) {
repository(owner:$owner, name:$repo) {
pullRequest(number:$pr) {
reviewThreads(first:100) {
nodes {
id isResolved
comments(first:1){ nodes{ databaseId } }
}
}
}
}
}' -f owner=<owner> -f repo=<repo> -F pr=<pr_number> \
--jq '.data.repository.pullRequest.reviewThreads.nodes[]
| select(.isResolved==false)
| select(.comments.nodes[0].databaseId==<comment_id>)
| .id'
# Resolve it
gh api graphql -f query='
mutation($t:ID!) {
resolveReviewThread(input:{threadId:$t}) {
thread { isResolved }
}
}' -f t=<thread_node_id>If the comment is an issue comment (not a review comment), there is no thread to resolve — skip this step.
---
After each comment, output one line:
[<classification>] #<comment_id> — <one sentence summary of action taken>
When `--all` mode finishes, print a summary table:
| Comment | Author | Classification | Action | |---|---|---|---| | #<id> | @<login> | ACTIONABLE_FIX | Fixed: <file>, committed <sha> | | #<id> | @<login> | INFORMATIONAL | Replied, thread resolved | | #<id> | @<login> | NOT_APPLICABLE | Replied, thread resolved |
---
After completing triage (singl
A production-grade field handbook for platform, DevOps, SRE, and cloud engineers covering Kubernetes, Flux CD, Terraform, GitHub Actions, AWS, OPA/Rego, KEDA, Karpenter, supply chain security, Falco, observability, and more.
Repo: nitinjain999/platform-skills
Generate and enforce policy gates for AI coding agents (Copilot, Claude Code) — real-time session hooks that deny protected-path edits and dangerous commands,…
Generate, convert, and maintain animated GitHub-safe Markdown documents with animated SVG diagrams. Covers four SVG patterns (architecture flow, lifecycle…
AWS profile management for MCP servers — discover profiles across SSO, Granted, and assumed-role chains, check credential TTL, switch profiles across VS Code…
Structured guidance for AWS CloudFront distributions, WAF web ACLs, Lambda@Edge, CloudFront Functions, Firewall Manager multi-account enforcement, and IAM/IRSA…
Azure identity (Workload Identity, OIDC, Entra ID), resource tagging, AKS platform patterns, RBAC scoping, and production-readiness review — with Terraform…
Design, run, and debug Chaos Engineering experiments on Kubernetes using Litmus Chaos v3 and Chaos Mesh v2. Covers fault injection (pod-delete, network-loss,…