pr-assistant
PR Assistant
Assists with creating well-structured pull requests by analyzing changes and generating comprehensive PR descriptions.
Core Philosophy
Human-in-the-loop: This skill generates PR drafts that MUST be reviewed and approved by the user before submission. Never auto-create PRs without explicit confirmation.
Workflow
1. Analyze Changes
First, gather context about the current branch:
# Get current branch and target branch
CURRENT_BRANCH=$(git branch --show-current)
TARGET_BRANCH=${TARGET_BRANCH:-main}
# Get diff summary
git diff $TARGET_BRANCH...$CURRENT_BRANCH --stat
# Get commit messages
git log $TARGET_BRANCH...$CURRENT_BRANCH --oneline
# Get detailed changes by category
git diff $TARGET_BRANCH...$CURRENT_BRANCH --name-status
Use scripts/analyze_changes.py to categorize changes into:
- Backend changes (apis/, requirements.txt)
- Frontend changes (ui/)
- Database changes (supabase/)
- DevOps changes (docker-compose.yml, Dockerfile, etc.)
- Documentation (doc/, *.md)
2. Determine PR Type
Based on the analysis, select the appropriate template:
- Feature: New functionality or enhancements
- Bugfix: Bug fixes or corrections
- Docs: Documentation updates
- Refactor: Code restructuring without behavior change
- Chore: Dependencies, config, tooling updates
3. Generate PR Draft
Use scripts/generate_pr_body.py with the appropriate template from assets/templates/.
Auto-fill sections:
- Summary: Generated from commit messages and file changes
- Changes breakdown: Categorized list of modified files
- Related issues: Parse commit messages for
#123,fixes #456patterns - Checklist: Auto-populate based on change types
4. Quality Checks
Run scripts/quality_checks.sh to check for:
- Uncommitted changes
- Merge conflicts
- TODO/FIXME comments in changed files
- Missing test files (for significant code changes)
- Large file additions (>1MB)
Present warnings to user but don't block PR creation.
5. Present Draft for Review
CRITICAL: Present the generated PR body in a clear, editable format and explicitly ask the user to review and approve it.
Example presentation:
I've prepared a PR draft. Please review the content below and let me know if you'd like any changes:
---
[Generated PR body here]
---
Would you like me to:
1. Create the PR with this content
2. Make edits to the description
3. Change the target branch (currently: main)
4. Add/remove reviewers
6. Create PR Only After Approval
Once the user approves, use gh CLI:
gh pr create \
--title "PR Title" \
--body-file /tmp/pr-body.md \
--base main \
--head current-branch \
[--reviewer user1,user2] \
[--label label1,label2]
Project-Specific Configuration
For this repository (tomodachi/srms):
Categories:
- Backend:
apis/,requirements.txt - Frontend:
ui/src/,ui/package.json - Database:
supabase/ - DevOps:
docker-compose.yml,Dockerfile,nginx.conf,supervisord.conf - Docs:
doc/,README.md,CLAUDE.md
Default reviewers (suggest based on changes):
- Backend changes → Backend team
- Frontend changes → Frontend team
- Database changes → DBA/Backend team
Branch naming conventions:
feature/*→ Feature templatebugfix/*orfix/*→ Bugfix templatedocs/*→ Docs template- Other → Feature template (default)
Best Practices
See references/pr-best-practices.md for detailed guidelines.
Key points:
- Keep PRs focused (single concern)
- Write clear, descriptive titles
- Explain the "why" not just "what"
- Include testing evidence
- Link to related issues
- Self-review before requesting review
Interactive Editing
If the user wants to edit the draft:
- Ask which section to modify
- Update the specific section
- Re-present the full draft
- Repeat until approved
Common Commands
User might say:
- "Create a PR" → Full workflow
- "What changed?" → Just analysis (step 1)
- "Draft PR description" → Steps 1-3, present draft
- "Update PR description" → Edit existing draft
- "Check if ready for PR" → Run quality checks
Error Handling
If issues arise:
- No commits ahead of target → Inform user, suggest checking branch
- Merge conflicts → Show conflicts, suggest resolving first
- No GitHub CLI → Inform user, offer to create PR body for manual submission
- API rate limits → Suggest waiting or manual creation
Output Format
Always save the generated PR body to a temporary file for easy editing:
PR_BODY_FILE=".tmp/outputs/pr-body-$(date +%s).md"
This allows the user to edit it manually if needed before submission.
More from atman-33/skills
dnd-kit-implementation
Guide for implementing sortable and droppable components using dnd-kit library. Use this skill when building React applications that require drag-and-drop functionality with both container reordering (useSortable) and item dropping (useDroppable) capabilities, such as Kanban boards, file management systems, or playlist editors.
37tech-article-humanizer
Transform technical article drafts or source materials into human-like, high-quality Japanese technical articles. Use this skill when the user wants to generate, rewrite, or humanize technical articles (especially about TypeScript, JavaScript, React, or frontend topics) following specific human-writing patterns and style guidelines. Triggers include requests like "記事を人間風に", "tech article を生成", "humanize this article", or providing article source materials.
4agent-memory
Use this skill when the user asks to save, remember, recall, or organize memories. Triggers on phrases like 'remember this', 'save this', 'note this', 'what did we discuss about...', 'check your notes', 'clean up memories'. Also use proactively when discovering valuable findings worth preserving.
2react-router-v7-app
Implements React Router v7 app structure, routing patterns, and component templates. Use when creating or modifying React Router v7 applications to ensure consistent folder structure, data loading patterns, and component architecture.
2openspec-bulk-archive-change
Archive multiple completed changes at once. Use when archiving several parallel changes.
1serena-skills
Standalone Serena MCP tools for code intelligence - symbol search, file ops, memory, editing, config, workflow helpers, and shell execution without MCP server
1