/pr-auto-update
Auto-update PR description and labels from changes. Trigger with "update PR description", "refresh PR", "update labels".
$ npx -y skills add wasabeef/claude-code-cookbook --skill pr-auto-update --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
- Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
- You can call itInvoke it directly when you want it.
- Slash command
/pr-auto-update
Context preview
The summary Claude sees to decide when to auto-load this skill.
Auto-update PR description and labels from changes. Trigger with "update PR description", "refresh PR", "update labels".
SKILL.md
pr-auto-update.SKILL.mddescription: 'Auto-update PR description and labels from changes. Trigger with "update PR description", "refresh PR", "update labels".'
allowed-tools:
- Bash(gh *)
- Bash(git *)
- Read
- Grep
- Glob
Auto-update PR description and labels from changes
Overview
A command that automatically updates Pull Request descriptions and labels. Analyzes Git changes to generate and set appropriate descriptions and labels.
Usage
/pr-auto-update [options] [PR number]
Options
- `--pr <number>`: Specify target PR number (automatically detected from current branch if omitted)
- `--description-only`: Update only the description (keep labels unchanged)
- `--labels-only`: Update only labels (keep description unchanged)
- `--dry-run`: Show generated content without making actual updates
- `--lang <language>`: Specify language (en)
Basic Examples
# Auto-update PR for current branch
/pr-auto-update
# Update specific PR
/pr-auto-update --pr 1234
# Update description only
/pr-auto-update --description-only
# Check with dry-run
/pr-auto-update --dry-run
Feature Details
1. PR Auto Detection
Automatically detects the corresponding PR from the current branch:
# Search PR from branch
gh pr list --head $(git branch --show-current) --json number,title,url
2. Change Analysis
Collects and analyzes the following information:
- **File changes**: Added, deleted, or modified files
- **Code analysis**: Changes to imports, function definitions, class definitions
- **Tests**: Presence and content of test files
- **Documentation**: Updates to README, docs
- **Configuration**: Changes to package.json, pubspec.yaml, configuration files
- **CI/CD**: Changes to GitHub Actions, workflows
3. Automatic Description Generation
Template Processing Priority
1. **Existing PR description**: Completely follows already written content 2. **Project template**: Gets structure from `.github/PULL_REQUEST_TEMPLATE.md` 3. **Default template**: Fallback when above don't exist
Rules for Preserving Existing Content
**Important**: Do not modify existing content
- Keep existing sections
- Only complete empty sections
- Keep functional comments (like Copilot review rules)
Using Project Templates
# Parse structure of .github/PULL_REQUEST_TEMPLATE.md
parse_template_structure() {
local template_file="$1"
if [ -f "$template_file" ]; then
# Extract section structure
grep -E '^##|^###' "$template_file"
# Identify comment placeholders
grep -E '<!--.*-->' "$template_file"
# Completely follow existing template structure
cat "$template_file"
fi
}4. Automatic Label Setting
Label Retrieval Mechanism
**Priority**:
1. **`.github/labels.yml`**: Get from project-specific label definitions 2. **GitHub API**: Get existing labels with `gh api repos/{OWNER}/{REPO}/labels --jq '.[].name'`
Automatic Determination Rules
**File Pattern Based**:
- Documentation: `*.md`, `README`, `docs/` → labels containing `documentation|docs|doc`
- Tests: `test`, `spec` → labels containing `test|testing`
- CI/CD: `.github/`, `*.yml`, `Dockerfile` → labels containing `ci|build|infra|ops`
- Dependencies: `package.json`, `pubspec.yaml`, `requirements.txt` → labels containing `dependencies|deps`
**Change Content Based**:
- Bug fixes: `fix|bug|error|crash|correction` → labels containing `bug|fix`
- New features: `feat|feature|add|implement|new-feature|implementation` → labels containing `feature|enhancement|feat`
- Refactoring: `refactor|clean|restructure` → labels containing `refactor|cleanup|clean`
- Performance: `performance|perf|optimize|optimization` → labels containing `performance|perf`
- Security: `security|secure|vulnerability` → labels containing `security`
Constraints
- **Maximum 3**: Upper limit on automatically selected labels
- **Existing labels only**: Creating new labels is prohibited
- **Partial match**: Determined by whether keywords are contained in label names
Actual Usage Examples
**When `.github/labels.yml` exists**:
# Auto-retrieve from label definitions
grep "^- name:" .github/labels.yml | sed "s/^- name: '\?\([^']*\)'\?/\1/"
# Example: Use project-specific label system
**When retrieving from GitHub API**:
# Get list of existing labels
gh api repos/{OWNER}/{REPO}/labels --jq '.[].name'
# Example: Use standard labels like bug, enhancement, documentation5. Execution Flow
#!/bin/bash
# 1. PR Detection & Retrieval
detect_pr() {
if [ -n "$PR_NUMBER" ]; then
echo $PR_NUMBER
else
gh pr list --head $(git branch --show-current) --json number --jq '.[0].number'
fi
}
# 2. Change Analysis
analyze_changes() {
local pr_number=$1
# Get file changes
gh pr diff $pr_number --name-only
# Content analysis
gh pr diff $pr_number | head -1000
}
# 3. Description Generation
generate_description() {
local pr_number=$1
local changes=$2
# Get current PR description
local current_body=$(gh pr view $pr_number --json body --jq -r .body)
# Use existing content if available
if [ -n "$current_body" ]; then
echo "$current_body"
else
# Generate new from template
local template_file=".github/PULL_REQUEST_TEMPLATE.md"
if [ -f "$template_file" ]; then
generate_from_template "$(cat "$template_file")" "$changes"
else
generate_from_template "" "$changes"
fi
fi
}
# Generate from template
generate_from_template() {
local template="$1"
local changes="$2"
if [ -n "$template" ]; then
# Use template as-is (preserve HTML comments)
echo "$template"
else
# Generate in default format
echo "## What does this change?"
echo ""
echo "$changes"
fi
}
# 4. Label Determination
determine_labels() {
local changes=$1
local file_list=$2
local pr_number=$3
# Get available labels
local available_labels=()
if [ -f ".github/labels.yml" ]; then
# Extract label names from labeRead more
description: 'Auto-update PR description and labels from changes. Trigger with "update PR description", "refresh PR", "update labels".' allowed-tools: - Bash(gh *) - Bash(git *) - Read - Grep - Glob
Auto-update PR description and labels from changes
Overview
A command that automatically updates Pull Request descriptions and labels. Analyzes Git changes to generate and set appropriate descriptions and labels.
Usage
/pr-auto-update [options] [PR number]
Options
- `--pr <number>`: Specify target PR number (automatically detected from current branch if omitted)
- `--description-only`: Update only the description (keep labels unchanged)
- `--labels-only`: Update only labels (keep description unchanged)
- `--dry-run`: Show generated content without making actual updates
- `--lang <language>`: Specify language (en)
Basic Examples
# Auto-update PR for current branch /pr-auto-update # Update specific PR /pr-auto-update --pr 1234 # Update description only /pr-auto-update --description-only # Check with dry-run /pr-auto-update --dry-run
Feature Details
1. PR Auto Detection
Automatically detects the corresponding PR from the current branch:
# Search PR from branch gh pr list --head $(git branch --show-current) --json number,title,url
2. Change Analysis
Collects and analyzes the following information:
- **File changes**: Added, deleted, or modified files
- **Code analysis**: Changes to imports, function definitions, class definitions
- **Tests**: Presence and content of test files
- **Documentation**: Updates to README, docs
- **Configuration**: Changes to package.json, pubspec.yaml, configuration files
- **CI/CD**: Changes to GitHub Actions, workflows
3. Automatic Description Generation
Template Processing Priority
1. **Existing PR description**: Completely follows already written content 2. **Project template**: Gets structure from `.github/PULL_REQUEST_TEMPLATE.md` 3. **Default template**: Fallback when above don't exist
Rules for Preserving Existing Content
**Important**: Do not modify existing content
- Keep existing sections
- Only complete empty sections
- Keep functional comments (like Copilot review rules)
Using Project Templates
# Parse structure of .github/PULL_REQUEST_TEMPLATE.md
parse_template_structure() {
local template_file="$1"
if [ -f "$template_file" ]; then
# Extract section structure
grep -E '^##|^###' "$template_file"
# Identify comment placeholders
grep -E '<!--.*-->' "$template_file"
# Completely follow existing template structure
cat "$template_file"
fi
}4. Automatic Label Setting
Label Retrieval Mechanism
**Priority**:
1. **`.github/labels.yml`**: Get from project-specific label definitions 2. **GitHub API**: Get existing labels with `gh api repos/{OWNER}/{REPO}/labels --jq '.[].name'`
Automatic Determination Rules
**File Pattern Based**:
- Documentation: `*.md`, `README`, `docs/` → labels containing `documentation|docs|doc`
- Tests: `test`, `spec` → labels containing `test|testing`
- CI/CD: `.github/`, `*.yml`, `Dockerfile` → labels containing `ci|build|infra|ops`
- Dependencies: `package.json`, `pubspec.yaml`, `requirements.txt` → labels containing `dependencies|deps`
**Change Content Based**:
- Bug fixes: `fix|bug|error|crash|correction` → labels containing `bug|fix`
- New features: `feat|feature|add|implement|new-feature|implementation` → labels containing `feature|enhancement|feat`
- Refactoring: `refactor|clean|restructure` → labels containing `refactor|cleanup|clean`
- Performance: `performance|perf|optimize|optimization` → labels containing `performance|perf`
- Security: `security|secure|vulnerability` → labels containing `security`
Constraints
- **Maximum 3**: Upper limit on automatically selected labels
- **Existing labels only**: Creating new labels is prohibited
- **Partial match**: Determined by whether keywords are contained in label names
Actual Usage Examples
**When `.github/labels.yml` exists**:
# Auto-retrieve from label definitions grep "^- name:" .github/labels.yml | sed "s/^- name: '\?\([^']*\)'\?/\1/" # Example: Use project-specific label system
**When retrieving from GitHub API**:
# Get list of existing labels
gh api repos/{OWNER}/{REPO}/labels --jq '.[].name'
# Example: Use standard labels like bug, enhancement, documentation5. Execution Flow
#!/bin/bash
# 1. PR Detection & Retrieval
detect_pr() {
if [ -n "$PR_NUMBER" ]; then
echo $PR_NUMBER
else
gh pr list --head $(git branch --show-current) --json number --jq '.[0].number'
fi
}
# 2. Change Analysis
analyze_changes() {
local pr_number=$1
# Get file changes
gh pr diff $pr_number --name-only
# Content analysis
gh pr diff $pr_number | head -1000
}
# 3. Description Generation
generate_description() {
local pr_number=$1
local changes=$2
# Get current PR description
local current_body=$(gh pr view $pr_number --json body --jq -r .body)
# Use existing content if available
if [ -n "$current_body" ]; then
echo "$current_body"
else
# Generate new from template
local template_file=".github/PULL_REQUEST_TEMPLATE.md"
if [ -f "$template_file" ]; then
generate_from_template "$(cat "$template_file")" "$changes"
else
generate_from_template "" "$changes"
fi
fi
}
# Generate from template
generate_from_template() {
local template="$1"
local changes="$2"
if [ -n "$template" ]; then
# Use template as-is (preserve HTML comments)
echo "$template"
else
# Generate in default format
echo "## What does this change?"
echo ""
echo "$changes"
fi
}
# 4. Label Determination
determine_labels() {
local changes=$1
local file_list=$2
local pr_number=$3
# Get available labels
local available_labels=()
if [ -f ".github/labels.yml" ]; then
# Extract label names from labeA collection of commands, roles, and automation scripts for Claude Code. Automate your workflow without unnecessary confirmations, allowing you to focus on what matters.
Repo: wasabeef/claude-code-cookbook
Other skills on claude-code-cookbook.
- /analyze-dependencies
Analyze project dependencies and evaluate architectural health. Trigger with "analyze dependencies", "detect circular dependencies", "architecture issues?", "check module coupling", "find layer violations". Generates dependency matrix, fan-in/fan-out analysis, and prioritized
Open skill - /analyze-performance
Performance analysis based on Core Web Vitals with UX scoring. Trigger with "analyze performance", "improve speed", "check Core Web Vitals", "page speed", "improve LCP", "identify performance issues".
Open skill - /check-fact
Verify information accuracy against codebase and documentation. Trigger with "is this correct?", "fact check", "verify this", "is this accurate?".
Open skill - /check-prompt
Evaluate and improve AI prompt quality. Trigger with "check this prompt", "evaluate prompt quality", "improve this prompt".
Open skill - /commit-message
Generate commit messages from staged changes. Trigger with "suggest commit message", "generate commit message", "what should the commit say?", "write commit message".
Open skill - /context7
Search technical documentation via Context7 MCP. Trigger with "check the docs", "look up documentation", "how to use this library?", "API reference".
Open skill

