Skip to content

Commit 9faec2b

Browse files
committed
feat: add GitHub workflow skills for PR enrichment and collaboration
Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
1 parent 849e613 commit 9faec2b

File tree

2 files changed

+134
-0
lines changed

2 files changed

+134
-0
lines changed

.claude-plugin/marketplace.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,14 @@
1717
"./skills/diataxis-gen-readme",
1818
"./skills/diataxis-organize-docs"
1919
]
20+
},
21+
{
22+
"name": "gh",
23+
"description": "GitHub workflow skills for enriching PR descriptions, automating code review context, and streamlining collaboration through the gh CLI",
24+
"source": "./",
25+
"skills": [
26+
"./skills/gh-enrich-pr-description"
27+
]
2028
}
2129
]
2230
}
Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
---
2+
name: gh-enrich-pr-description
3+
description: Enrich GitHub PR descriptions with root-cause context, related issues/PRs, and CC mentions. Use when creating or editing a PR, when a PR has an empty or sparse description, or when the user asks to improve a PR description.
4+
---
5+
6+
# Enrich PR Description
7+
8+
Analyze branch changes and git history to build a rich PR description with three sections: a contextual summary, related issues/PRs, and people to CC.
9+
10+
## When to Use
11+
12+
- User asks to create a PR (before `gh pr create`)
13+
- User asks to improve/fix a PR description
14+
- A PR has an empty or sparse body
15+
- User asks who to CC or what to reference
16+
17+
## Workflow
18+
19+
### 1. Gather Context
20+
21+
Run these in parallel to understand the full picture:
22+
23+
```bash
24+
# Current branch and diff against base
25+
git log --oneline main..HEAD
26+
git diff main...HEAD
27+
28+
# PR if it already exists
29+
gh pr view --json number,title,body,url,baseRefName,headRefName 2>/dev/null
30+
```
31+
32+
### 2. Investigate the "Why"
33+
34+
For each changed file, dig into the history to understand the origin of the problem:
35+
36+
```bash
37+
# Blame the changed lines on the base branch to find who introduced them
38+
git blame main -- <file> | sed -n '<start>,<end>p'
39+
40+
# Show the originating commit
41+
git log -1 --format='%H %an <%ae> %s' <commit-sha>
42+
43+
# Find the PR that introduced the commit
44+
gh pr list --search "<commit-sha-prefix> OR <ticket-id>" --state merged --json number,title,author,url
45+
```
46+
47+
Key questions to answer:
48+
- What is the root cause of the problem?
49+
- Is this a permanent vs transient condition being mishandled?
50+
- What contract or convention was violated?
51+
- Is there a sibling/similar function that handles the same case correctly?
52+
53+
### 3. Find Related Issues and PRs
54+
55+
Search for related work using ticket IDs, keywords, and function names:
56+
57+
```bash
58+
# By ticket ID from branch name or commit messages
59+
gh pr list --search "<TICKET-ID>" --state all --json number,title,author,url,state
60+
61+
# By keywords from the change
62+
gh pr list --search "<keyword>" --state all --limit 10 --json number,title,author,url,state
63+
```
64+
65+
Classify each related PR/issue:
66+
- **Origin** -- introduced the code being fixed
67+
- **Related** -- touches the same area or feature
68+
- **Alternate** -- different approach to the same problem
69+
- **Blocked by / Blocks** -- dependency relationship
70+
71+
### 4. Identify People to CC
72+
73+
From git blame and related PRs, collect GitHub usernames of people who:
74+
- Authored the code being changed (from `git blame`)
75+
- Authored related open PRs in the same area
76+
- Are reviewers on related PRs
77+
78+
Extract GitHub usernames from PR data:
79+
80+
```bash
81+
gh pr view <number> --json author --jq '.author.login'
82+
```
83+
84+
### 5. Compose the Description
85+
86+
Use this structure:
87+
88+
```markdown
89+
## Summary
90+
91+
[2-4 sentences explaining WHAT changed and WHY. Focus on the root cause
92+
and why the previous behavior was wrong. Include the mechanism of failure.]
93+
94+
> [!NOTE]
95+
> [Optional callout for additional context, such as a sibling function
96+
> that handles the same case correctly, or a related convention.]
97+
98+
## Related
99+
100+
- #<number> -- <relationship>: <brief description>
101+
- #<number> -- <relationship>: <brief description>
102+
103+
CC @<username> @<username>
104+
```
105+
106+
### 6. Apply the Description
107+
108+
For an existing PR:
109+
110+
```bash
111+
gh pr edit <number> --body "$(cat <<'EOF'
112+
<composed description>
113+
EOF
114+
)"
115+
```
116+
117+
For a new PR, pass it to `gh pr create --body`.
118+
119+
## Quality Checks
120+
121+
- [ ] Summary explains the root cause, not just the symptom
122+
- [ ] Summary describes the mechanism (how the bug manifests)
123+
- [ ] Related PRs include the one that introduced the issue
124+
- [ ] Each related PR has a relationship label (origin, related, alternate)
125+
- [ ] CC list includes the author of the originating code
126+
- [ ] No speculative CC -- only people with direct involvement

0 commit comments

Comments
 (0)