Skip to content

Commit a25edb1

Browse files
docs(skills): update github-cli skill from chat analysis (#116)
## Summary - Add pre-flight/PATH discovery section (agents wasted 2-3 turns per session hunting for `gh`) - Add draft PR, diff, check-before-create, issue edit commands - Document HEREDOC body pattern and conciseness guidance (users asked to "cut it down" in 4+ sessions) - Add inline review comments via `gh api` (not accessible through `gh pr view --json`) - Add issue-to-PR lifecycle, review comment addressing, and retroactive signoff workflows - Add common mistakes section (WebFetch on private repos, missing signoff, verbose bodies) ## Test plan - [ ] Spot-check rendered markdown in PR diff --------- Signed-off-by: aagonzales <aagonzales@nvidia.com> Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 27877c6 commit a25edb1

3 files changed

Lines changed: 165 additions & 4 deletions

File tree

.agent/skills/github-cli/SKILL.md

Lines changed: 48 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,17 @@ Note: The commands below are quick references. For comprehensive detail and mult
1818

1919
Always use `required_permissions: ["all"]` when running `gh` commands. Sandboxed environments fail with TLS certificate errors (`x509: OSStatus -26276`).
2020

21-
## Setup
21+
## Pre-flight
22+
23+
Before any `gh` operation, verify the binary is available and authenticated:
2224

2325
```bash
24-
brew install gh
25-
gh auth login
26-
gh auth status # verify
26+
# Verify gh is available (check PATH, then common install location)
27+
which gh 2>/dev/null || ls ~/.local/bin/gh 2>/dev/null
28+
# If found at ~/.local/bin/gh but not on PATH:
29+
export PATH="$HOME/.local/bin:$PATH"
30+
# Verify authentication
31+
gh auth status
2732
```
2833

2934
## Pull Requests
@@ -42,6 +47,18 @@ gh pr create --title "Title" --body "Description"
4247

4348
# Check out a PR locally
4449
gh pr checkout <number>
50+
51+
# Create a draft PR (WIP)
52+
gh pr create --draft --title "Title" --body "Description"
53+
54+
# View PR diff
55+
gh pr diff <number>
56+
57+
# Check if a PR already exists for the current branch before creating
58+
gh pr view --json number,url 2>/dev/null && echo "PR exists" || echo "No PR yet"
59+
60+
# Edit an existing PR's title/body
61+
gh pr edit <number> --title "New title" --body "New body"
4562
```
4663

4764
## CI / Actions
@@ -66,6 +83,9 @@ gh run view <run-id> --log-failed
6683
gh issue list
6784
gh issue view <number>
6885
gh issue create --title "Title" --body "Description"
86+
87+
# Edit an existing issue
88+
gh issue edit <number> --body "Updated body"
6989
```
7090

7191
## Code Review
@@ -88,3 +108,27 @@ gh release list
88108
gh release view <tag>
89109
gh release create <tag> --generate-notes
90110
```
111+
112+
## Writing PR and Issue Bodies
113+
114+
Always use HEREDOC for multiline bodies:
115+
116+
```bash
117+
gh pr create --title "feat: short title" --body "$(cat <<'EOF'
118+
## Summary
119+
- 2-4 bullet points, not a full audit
120+
121+
## Test plan
122+
- [ ] Verify X
123+
- [ ] Check Y
124+
EOF
125+
)"
126+
```
127+
128+
Keep bodies concise -- 2-4 bullet summary for PRs, problem + options for issues. Don't generate long audit dumps or parameter inventories. When the user asks for "succinct" -- 1-3 sentences, no lists.
129+
130+
## Common Mistakes
131+
132+
- Don't WebFetch GitHub Actions URLs for private repos -- use `gh run view` instead (auth required)
133+
- Don't propose `gh pr create` without checking if a PR already exists first
134+
- Don't generate long PR/issue bodies -- users consistently ask agents to cut them down

.agent/skills/github-cli/references/full-reference.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,35 @@ gh pr view <number> --json number,title,state,url,headRefName,baseRefName,isDraf
2727
}'
2828
```
2929

30+
## Review Comments
31+
32+
`gh pr view --json comments` returns top-level PR conversation comments only. Inline code review comments (attached to specific diff lines) require the REST API:
33+
34+
```bash
35+
# Inline code review comments on a PR
36+
gh api repos/NVIDIA-NeMo/Safe-Synthesizer/pulls/<number>/comments
37+
38+
# Issue discussion thread
39+
gh api repos/NVIDIA-NeMo/Safe-Synthesizer/issues/<number>/comments
40+
```
41+
42+
## Useful Data Extraction
43+
44+
```bash
45+
# Get a PR's base commit SHA (useful for lockfile diff diagnosis)
46+
gh pr view <number> --json baseRefOid -q .baseRefOid
47+
```
48+
49+
## Repo Settings via API
50+
51+
```bash
52+
# Configure squash merge to use PR title + body as commit message
53+
gh api repos/NVIDIA-NeMo/Safe-Synthesizer \
54+
--method PATCH \
55+
-f squash_merge_commit_title=PR_TITLE \
56+
-f squash_merge_commit_message=PR_BODY
57+
```
58+
3059
## CODEOWNERS
3160

3261
Defined in `.github/CODEOWNERS`:

.agent/skills/github-cli/references/workflows.md

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,3 +259,91 @@ gh pr review <number> --request-changes --body "Format check fails locally, see
259259
git checkout -
260260
git stash pop
261261
```
262+
263+
## Issue-to-PR Lifecycle
264+
265+
End-to-end workflow: create an issue, branch, implement, and open a draft PR.
266+
267+
### Step 1: Create the Issue
268+
269+
```bash
270+
gh issue create \
271+
--title "fix: short description of the problem" \
272+
--body "$(cat <<'EOF'
273+
Problem statement in 1-2 sentences.
274+
275+
Proposed fix: brief description.
276+
EOF
277+
)"
278+
```
279+
280+
### Step 2: Create Branch and Implement
281+
282+
```bash
283+
ISSUE=<number-from-step-1>
284+
git checkout -b $USER/$ISSUE-short-name origin/main
285+
# ... make changes ...
286+
git add -A
287+
git commit -s -m "fix: description (closes #$ISSUE)"
288+
git push -u origin HEAD
289+
```
290+
291+
### Step 3: Open Draft PR
292+
293+
```bash
294+
gh pr create --draft \
295+
--title "fix: description" \
296+
--body "$(cat <<'EOF'
297+
Closes #<issue-number>
298+
299+
- Change 1
300+
- Change 2
301+
EOF
302+
)"
303+
```
304+
305+
## Fetch and Address Review Comments
306+
307+
### Step 1: Get Inline Comments
308+
309+
```bash
310+
# Inline code review comments (not available via gh pr view --json)
311+
gh api repos/NVIDIA-NeMo/Safe-Synthesizer/pulls/<number>/comments
312+
```
313+
314+
### Step 2: Address Comments in Code
315+
316+
Make fixes, commit with signoff:
317+
318+
```bash
319+
git add -A
320+
git commit -s -m "fix: address review feedback"
321+
git push
322+
```
323+
324+
### Step 3: Update PR Body for Squash Merge
325+
326+
```bash
327+
gh pr edit <number> --body "$(cat <<'EOF'
328+
## Summary
329+
- Updated summary reflecting all changes
330+
331+
## Test plan
332+
- [x] Tests pass
333+
EOF
334+
)"
335+
```
336+
337+
## Retroactive Signoff
338+
339+
If commits were pushed without `--signoff` (`-s`):
340+
341+
```bash
342+
# Amend the last commit to add signoff
343+
git commit --amend --signoff --no-edit
344+
git push --force-with-lease
345+
346+
# For multiple commits, interactive rebase (careful -- rewrites history)
347+
git rebase --signoff HEAD~<n>
348+
git push --force-with-lease
349+
```

0 commit comments

Comments
 (0)