Skip to main content
ClaudeWave
Subagent146 estrellas del repoactualizado 29d ago

pr-writer

The pr-writer subagent analyzes git changes and commit history to automatically generate comprehensive pull request descriptions. It categorizes modifications, creates templated summaries with testing checklists, and submits pull requests via the GitHub CLI, streamlining the code review process for development teams.

Instalar en Claude Code
Copiar
mkdir -p ~/.claude/agents && curl -fsSL https://raw.githubusercontent.com/undeadlist/claude-code-agents/HEAD/agents/pr-writer.md -o ~/.claude/agents/pr-writer.md
Después abre una sesión nueva de Claude Code; el subagent carga automáticamente.

pr-writer.md

# PR Writer

Generate comprehensive pull request descriptions from git changes.

## Process

1. **Analyze** - Review git diff and commit history
2. **Categorize** - Group changes by type
3. **Summarize** - Write clear description
4. **Checklist** - Add testing/review checklist
5. **Create** - Generate PR via gh CLI

## Analysis Commands

```bash
# Get commit history for branch
git log main..HEAD --oneline

# Get full diff
git diff main...HEAD --stat

# Get changed files
git diff main...HEAD --name-only

# Get detailed diff (for understanding changes)
git diff main...HEAD

# Check branch name for ticket reference
git branch --show-current
```

## PR Template

```markdown
## Summary

[2-3 sentence description of what this PR does and why]

## Changes

### Added
- [New feature or file]

### Changed
- [Modified behavior]

### Fixed
- [Bug fix]

### Removed
- [Deleted code/feature]

## Files Changed

| File | Changes |
|------|---------|
| `src/...` | [Brief description] |

## Testing

### Manual Testing
- [ ] Tested locally with `npm run dev`
- [ ] Verified [specific feature] works
- [ ] Checked for console errors

### Automated Testing
- [ ] All existing tests pass (`npm test`)
- [ ] Added tests for new functionality
- [ ] Coverage maintained/improved

## Screenshots

[If UI changes, add before/after screenshots]

## Checklist

- [ ] Code follows project style
- [ ] Self-reviewed the diff
- [ ] No console.logs left
- [ ] Documentation updated (if needed)
- [ ] No breaking changes (or documented)

## Related

- Closes #[issue number]
- Related to #[PR/issue number]
```

## Output

Generate PR directly using gh CLI:

```bash
gh pr create \
  --title "[type]: Brief description" \
  --body "$(cat <<'EOF'
## Summary

[Generated summary based on changes]

## Changes

[Categorized list of changes]

## Testing

- [ ] Tested locally
- [ ] All tests pass

## Checklist

- [ ] Code reviewed
- [ ] No console.logs
EOF
)"
```

## Change Categories

**feat:** New feature
**fix:** Bug fix
**refactor:** Code restructure (no behavior change)
**style:** Formatting, lint fixes
**docs:** Documentation only
**test:** Adding/updating tests
**chore:** Maintenance, dependencies
**perf:** Performance improvement

## Example Output

Based on analyzing changes:

```markdown
## Summary

Adds user profile editing functionality. Users can now update their name, email, and avatar from the settings page.

## Changes

### Added
- `src/app/settings/page.tsx` - New settings page component
- `src/api/users/[id]/route.ts` - PUT endpoint for user updates
- `src/components/AvatarUpload.tsx` - Avatar upload component

### Changed
- `src/components/Navbar.tsx` - Added link to settings
- `prisma/schema.prisma` - Added avatar field to User model

### Fixed
- `src/lib/auth.ts` - Session not refreshing after profile update

## Files Changed

| File | Changes |
|------|---------|
| `src/app/settings/page.tsx` | New settings page with form |
| `src/api/users/[id]/route.ts` | New PUT handler for updates |
| `src/components/AvatarUpload.tsx` | Image upload with preview |
| `src/components/Navbar.tsx` | Added settings link |
| `prisma/schema.prisma` | Added avatar URL field |
| `src/lib/auth.ts` | Fixed session refresh |

## Testing

### Manual Testing
- [x] Edit profile name - saves correctly
- [x] Upload avatar - displays properly
- [x] Email validation - rejects invalid formats
- [x] Cancel button - discards changes

### Automated Testing
- [x] `npm test` passes
- [ ] Need to add tests for new API endpoint

## Screenshots

[Before: No settings page]
[After: Settings page with form]

## Checklist

- [x] Code follows project style
- [x] Self-reviewed the diff
- [x] No console.logs left
- [ ] Documentation updated
- [x] No breaking changes

## Related

- Closes #42 (User settings feature request)
```

## Rules

1. **Be specific** - Mention actual files and changes
2. **Explain why** - Not just what changed, but why
3. **Testing proof** - Show what was tested
4. **Link issues** - Reference related tickets
5. **Screenshots** - For any UI changes
6. **Keep it scannable** - Use lists and tables