Skip to content

Commit 4948ade

Browse files
committed
feat: enhance PR context integration for changelog generation
Signed-off-by: Felipe Sayão Lobato Abreu <github@mentordosnerds.com>
1 parent b7f4099 commit 4948ade

1 file changed

Lines changed: 36 additions & 1 deletion

File tree

  • .agents/skills/changelog-generator

.agents/skills/changelog-generator/SKILL.md

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,33 @@ Generates and maintains CHANGELOG.md following the Keep a Changelog format with
1111

1212
- `phly/keep-a-changelog` - Installed in project
1313
- Git - For analyzing code changes
14+
- GitHub CLI (`gh`) - For reading PR context
1415
- Filesystem - For reading/writing CHANGELOG.md
1516

17+
## PR Context Integration
18+
19+
When generating changelog for changes that belong to a PR:
20+
21+
1. Detect PR reference: Check git branch name or recent PR comments
22+
2. Fetch PR description: Use `gh pr view <pr-number> --json body`
23+
3. Extract context: Read the PR Summary and Changes sections
24+
4. Enhance descriptions: Use PR context to write more accurate changelog entries
25+
26+
Example workflow:
27+
```bash
28+
# Detect current PR
29+
BRANCH=$(git branch --show-current)
30+
PR_NUM=$(echo "$BRANCH" | grep -oE '[0-9]+' | head -1)
31+
32+
# Fetch PR context if exists
33+
if [ -n "$PR_NUM" ]; then
34+
PR_BODY=$(gh pr view "$PR_NUM" --json body --jq '.body')
35+
# Use PR body as an extra context to define the changelog descriptions
36+
fi
37+
```
38+
39+
This ensures changelog descriptions align with the PR intent and provide better context.
40+
1641
## Key Commands
1742

1843
```bash
@@ -82,10 +107,20 @@ Analyze actual code changes, NOT commit messages:
82107
- **SPECIFIC**: Include class/method names
83108
- **SELF-SUFFICIENT**: Understand without reading code
84109
- **FUNCTIONAL**: Describe impact, not implementation
110+
- **PR-AWARE**: Use PR description to enhance accuracy when available
85111

86112
Good: "Added `Bootstrapper::bootstrap()` to create CHANGELOG.md when missing"
87113
Bad: "Add bootstrap command"
88114

115+
## PR Context Usage
116+
117+
When a PR number is available:
118+
119+
1. Read PR description for implementation intent
120+
2. Extract key capabilities mentioned in Summary
121+
3. Use specific feature names from the PR to write accurate descriptions
122+
4. Reference PR in changelog: "Added changelog automation (#40)"
123+
89124
## Integration with keep-a-changelog
90125

91126
Use CLI commands when possible:
@@ -115,4 +150,4 @@ Valid changelog MUST have:
115150

116151
- [references/keep-a-changelog-format.md](references/keep-a-changelog-format.md) - Format spec
117152
- [references/change-categories.md](references/change-categories.md) - Classification guide
118-
- [references/description-patterns.md](references/description-patterns.md) - Human-readable patterns
153+
- [references/description-patterns.md](references/description-patterns.md) - Human-readable patterns

0 commit comments

Comments
 (0)