Files
2025-11-30 08:39:22 +08:00

75 lines
2.4 KiB
Markdown

---
description: "Create a pull request following the strict workflow"
allowed-tools: ["Bash", "Glob", "Grep", "Read", "Task"]
---
You are helping the user create a pull request following their strict workflow.
## MANDATORY STEPS (DO NOT SKIP):
1. **Branch Analysis** (run in parallel)
- `git status` - See untracked files
- `git diff` - See staged and unstaged changes
- `git branch --show-current` - Get current branch name
- `git log origin/main..HEAD --oneline` - See all commits in this branch
- `git diff origin/main...HEAD` - See full diff from main
2. **PR Content Analysis**
- Review ALL commits (not just the latest) to understand full scope
- Analyze all code changes from when branch diverged from main
- Draft comprehensive PR summary covering all changes
3. **Push to Remote**
- Check if branch tracks remote: `git rev-parse --abbrev-ref --symbolic-full-name @{u}`
- If no remote tracking or not up to date: `git push -u origin <branch-name>`
4. **Create PR with gh**
- Use semantic prefix in title: `feat:`, `fix:`, `docs:`, `chore:`
- Use HEREDOC for body to ensure proper formatting
- Follow this template:
```bash
gh pr create --title "type: brief description" --body "$(cat <<'EOF'
#### Description
[1-3 bullet points summarizing ALL changes]
[It can be a 3-5 sentences description explaining why the changes are needed]
#### Ticket(s)
[ticket/issue url or "N/A"]
#### Action points
[bullets of actions needed, or "None"]
EOF
)"
```
5. **Return PR URL**
- Show the created PR URL to the user
## IMPORTANT RULES:
- NEVER use TodoWrite tool
- DO NOT run additional code exploration beyond git commands
- Focus on ALL commits in the branch, not just the latest one
- Be thorough in analyzing the full diff from main
- Ask about ticket association if not obvious from commits
- Keep title under 50 characters
- Use present tense in description ("Add" not "Added")
## Example:
```bash
gh pr create --title "feat: add user authentication" --body "$(cat <<'EOF'
#### Description
- Implement JWT-based authentication service
- Add login/logout endpoints with validation
- Create user session management with secure tokens
#### Ticket(s)
https://github.com/org/repo/issues/123
#### Action points
- Update environment variables with JWT_SECRET
- Run database migrations for user tables
EOF
)"
```
Now proceed with the PR creation workflow.