Configures claude-code using the home-manager programs.claude-code module: - Settings: model, gopls plugin, auto-update disabled, permissions - Agents: docs-verifier, security-reviewer - Skills: pr summary generator Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
3.8 KiB
name, description, argument-hint, user-invocable-only
| name | description | argument-hint | user-invocable-only | |||
|---|---|---|---|---|---|---|
| pr | Generate a PR summary from the current feature branch and copy it to the clipboard. |
|
true |
PR Summary Generator
Generate a concise PR summary comparing the current branch to the main branch (master), and copy it to the clipboard.
Input
Optional user context: $ARGUMENTS
Process
-
Get branch info: Use git to determine:
- Current branch name
- Main branch (master)
- Verify we're not on master (warn if we are)
-
Gather commit information: Use the git-explorer MCP tools:
commits_betweento get all commits from master to HEADget_commit_infofor each commit to see the full message and changes
-
Evaluate commit hygiene (CRITICAL - do this before generating summary):
Review all commits and check for issues that suggest squashing:
- Fixup commits: Messages like "fix", "fixup", "oops", "typo", "forgot", "WIP"
- Iterative fixes: Multiple commits touching the same file for the same logical change
- Broken intermediate states: Commits that introduce then immediately fix issues
- Noise commits: Very small changes that don't warrant their own commit
- Related changes split unnecessarily: Commits that logically belong together
If squashing is recommended: STOP here. Do NOT generate PR summary or copy to clipboard. Instead, respond with a short report:
- List which commits should be squashed together
- Explain briefly why (e.g., "fixup commit", "same logical change", "WIP")
- Suggest the resulting commit message(s)
If commits look clean: Continue to step 4.
-
Analyze the changes:
- Group commits by topic/area if there are multiple
- Note the key files changed
- Understand the overall purpose of the branch
-
Generate the summary: Create a markdown summary with:
- A "Summary" section with 2-4 bullet points describing what changed and why
- A "Changes" section listing key files/areas modified
-
Copy to clipboard: Pipe the summary to
wl-copy
Squash Recommendation Format
When recommending squashing, respond like this:
Before creating a PR, I recommend squashing some commits:
**Squash together:**
- `abc123` "Add new feature"
- `def456` "Fix typo in new feature"
- `ghi789` "Forgot to add import"
→ Suggested message: "Add new feature for X"
**Reason:** These are iterative fixes to the same change.
Run `git rebase -i master` to clean up, then invoke `/pr` again.
Output Format
## Summary
- First key change or feature
- Second key change
- Additional context if needed
## Changes
- `path/to/file.nix` - Brief description of change
- `path/to/other.nix` - Brief description
Style Guidelines
- Concise: Each bullet point should be one sentence
- Focus on "why": Explain the purpose, not just what files changed
- Group related changes: Don't list every commit, summarize by area
- Technical accuracy: Use correct terminology for the codebase
- No fluff: Skip obvious statements like "this PR adds..."
Example
For a branch with commits adding a new monitoring exporter:
## Summary
- Add systemd-exporter to all hosts for tracking service health metrics
- Configure Prometheus scrape targets for the new exporter
- Add Grafana dashboard for visualizing systemd unit status
## Changes
- `system/systemd-exporter.nix` - New module enabling systemd-exporter on all hosts
- `services/monitoring/prometheus.nix` - Add scrape config for systemd-exporter job
- `services/monitoring/grafana/dashboards/` - New systemd dashboard
After Generating
- Confirm the summary was copied to clipboard
- Display the summary to the user so they can review it
- Mention they can paste it directly into a PR description