Generate PR Description
Generate PR description for: $ARGUMENTS
System Prompt
⚠️ EXECUTION DIRECTIVE: When the user invokes this command, you MUST:
- IMMEDIATELY execute - no questions, no explanations first
- ALWAYS show full output from script/tool execution
- ALWAYS provide summary after execution completes
DO NOT:
- Say "I don't need to take action" - you ALWAYS execute when invoked
- Ask for confirmation unless
requires_confirmation: truein frontmatter - Skip execution even if it seems redundant - run it anyway
The user invoking the command IS the confirmation.
Arguments
$ARGUMENTS - PR Context (optional)
Specify PR to describe:
- Auto-detect: No arguments - uses current branch's PR or lists open PRs
- PR number: "PR #123" or "123"
- Current branch: "Describe current branch PR"
- Specific PR: "Describe PR for feature/auth-improvements"
Default Behavior
If no arguments:
- Checks current branch for associated PR
- Lists open PRs if none on current branch
- Asks user to select PR to describe
- Generates comprehensive description from template
Usage
# Auto-detect PR for current branch
/describe-pr
# Describe specific PR by number
/describe-pr 123
# Describe PR for a specific branch
/describe-pr feature/auth-improvements
Generate PR Description
You are tasked with generating a comprehensive pull request description following the repository's standard template.
Steps to follow:
-
Read the PR description template:
- First, check if
thoughts/shared/pr_description.mdexists - If it doesn't exist, inform the user that their
humanlayer thoughtssetup is incomplete and they need to create a PR description template atthoughts/shared/pr_description.md - Read the template carefully to understand all sections and requirements
- First, check if
-
Identify the PR to describe:
- Check if the current branch has an associated PR:
gh pr view --json url,number,title,state 2>/dev/null - If no PR exists for the current branch, or if on main/master, list open PRs:
gh pr list --limit 10 --json number,title,headRefName,author - Ask the user which PR they want to describe
- Check if the current branch has an associated PR:
-
Check for existing description:
- Check if
thoughts/shared/prs/{number}_description.mdalready exists - If it exists, read it and inform the user you'll be updating it
- Consider what has changed since the last description was written
- Check if
-
Gather comprehensive PR information:
- Get the full PR diff:
gh pr diff {number} - If you get an error about no default remote repository, instruct the user to run
gh repo set-defaultand select the appropriate repository - Get commit history:
gh pr view {number} --json commits - Review the base branch:
gh pr view {number} --json baseRefName - Get PR metadata:
gh pr view {number} --json url,title,number,state
- Get the full PR diff:
-
Analyze the changes thoroughly: (ultrathink about the code changes, their architectural implications, and potential impacts)
- Read through the entire diff carefully
- For context, read any files that are referenced but not shown in the diff
- Understand the purpose and impact of each change
- Identify user-facing changes vs internal implementation details
- Look for breaking changes or migration requirements
-
Handle verification requirements:
- Look for any checklist items in the "How to verify it" section of the template
- For each verification step:
- If it's a command you can run (like
make check test,npm test, etc.), run it - If it passes, mark the checkbox as checked:
- [x] - If it fails, keep it unchecked and note what failed:
- [ ]with explanation - If it requires manual testing (UI interactions, external services), leave unchecked and note for user
- If it's a command you can run (like
- Document any verification steps you couldn't complete
-
Generate the description:
- Fill out each section from the template thoroughly:
- Answer each question/section based on your analysis
- Be specific about problems solved and changes made
- Focus on user impact where relevant
- Include technical details in appropriate sections
- Write a concise changelog entry
- Ensure all checklist items are addressed (checked or explained)
- Fill out each section from the template thoroughly:
-
Save and sync the description:
- Write the completed description to
thoughts/shared/prs/{number}_description.md - Run
humanlayer thoughts syncto sync the thoughts directory - Show the user the generated description
- Write the completed description to
-
Update the PR:
- Update the PR description directly:
gh pr edit {number} --body-file thoughts/shared/prs/{number}_description.md - Confirm the update was successful
- If any verification steps remain unchecked, remind the user to complete them before merging
- Update the PR description directly:
Important notes:
- This command works across different repositories - always read the local template
- Be thorough but concise - descriptions should be scannable
- Focus on the "why" as much as the "what"
- Include any breaking changes or migration notes prominently
- If the PR touches multiple components, organize the description accordingly
- Always attempt to run verification commands when possible
- Clearly communicate which verification steps need manual testing
Action Policy
<default_behavior> This command implements changes by default when user intent is clear. Proceeds with:
- Code generation/modification
- File creation/updates
- Configuration changes
- Git operations (if applicable)
Provides concise progress updates during execution. </default_behavior>
Success Output
When PR description generation completes:
✅ COMMAND COMPLETE: /describe-pr
PR: #<number>
Title: <pr-title>
Description: thoughts/shared/prs/<number>_description.md
PR Updated: Yes
Verification: N/M checks passed
Completion Checklist
Before marking complete:
- PR identified
- Diff analyzed
- Description generated
- Verification run
- PR updated
- Synced to thoughts
Failure Indicators
This command has FAILED if:
- ❌ No PR found
- ❌ Template missing
- ❌ Description not generated
- ❌ PR update failed
When NOT to Use
Do NOT use when:
- No PR exists for branch
- PR already has description
- Draft PR not ready
Anti-Patterns (Avoid)
| Anti-Pattern | Problem | Solution |
|---|---|---|
| Skip verification | Broken build in PR | Run checks |
| Generic description | Unclear PR | Be specific |
| Ignore failures | Missed issues | Document failures |
Principles
This command embodies:
- #3 Complete Execution - Full PR workflow
- #9 Based on Facts - Analyze actual diff
- #6 Clear, Understandable - Clear descriptions
Full Standard: CODITECT-STANDARD-AUTOMATION.md