本文へ移動
cccskills
無料GitHub で公開

pr

Create or update a pull request from current branch to origin main with auto-generated title and description

インストール方法を見る

含まれるファイル(1)

  • SKILL.md6.1 KB

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

/pr - Smart Pull Request Creator & Updater

Usage

/pr              # Create or update PR to origin/main (default)
/pr develop      # Create or update PR to specified base branch

Workflow

Step 1: Check for Uncommitted Changes

git status

If there are uncommitted changes:

  • Invoke the /commit skill first to commit all pending changes
  • Wait for commit to complete before proceeding

Step 2: Detect Remote and Branch Info

# This is a direct repo (not a fork) — remote is always origin
git remote -v
BRANCH=$(git branch --show-current)
BASE_BRANCH=${1:-main}  # Default base is main

# Get repo from origin
REPO=$(git remote get-url origin | sed 's/.*github.com[:/]\(.*\)\.git/\1/' | sed 's/.*github.com[:/]\(.*\)/\1/')

# Fetch latest
git fetch origin

Step 3: Check if PR Already Exists

# Check for existing PR from current branch
gh pr list --repo $REPO --head $BRANCH --json number,url,title,body

If PR exists: Go to UPDATE MODE (Step 4a) If no PR: Go to CREATE MODE (Step 4b)


UPDATE MODE (PR Already Exists)

Step 4a: Push New Commits

git push origin $BRANCH

Step 5a: Analyze New Commits Since PR Creation

gh pr view $PR_NUMBER --repo $REPO --json commits
git log origin/$BASE_BRANCH..HEAD --oneline

Step 6a: Update PR Description

Update the PR body to:

  1. Add new changes to Summary section
  2. Mark completed TODOs with [x]
  3. Add any new test plan items
gh pr edit $PR_NUMBER --repo $REPO --body "$(cat <<'EOF'
<updated-description>
EOF
)"

Step 7a: Report Update

✅ PR #123 updated successfully!

**URL:** https://github.com/owner/user-agent-parser/pull/123
**New commits pushed:** 2
**Description updated:** Yes

Step 8a: Review Updated PR

Invoke the /pr-review skill on the PR number.


CREATE MODE (No Existing PR)

Step 4b: Push Current Branch to Origin

git push -u origin $BRANCH

Step 5b: Analyze Commits for PR Content

  • Review all commits between origin/main and HEAD
  • Group changes by type (feat, fix, refactor, etc.)
  • Identify the primary/dominant change type for PR title
  • Extract key changes for summary bullets

Step 6b: Generate PR Title

Format: <emoji> <type>(<scope>): <subject> (max 70 chars)

Same format as commit messages. If multiple types, use the dominant one. If equal, prioritize: fix > feat > refactor > test > docs > style.

Step 7b: Generate PR Description

gh pr create --repo $REPO --base $BASE_BRANCH --head $BRANCH \
  --title "<emoji> <type>(<scope>): <subject>" \
  --body "$(cat <<'EOF'
## Summary
- <emoji> <change 1>
- <emoji> <change 2>
- <emoji> <change 3>

## Changes

### <Category 1>
- **Component**: Description of change

## Testing
- [ ] `poetry run pytest` — all tests pass
- [ ] `poetry run pytest -q --cov=user_agent_parser --cov-report=xml` — coverage not decreased
- [ ] `poetry run ruff check && poetry run ruff format --check` — no lint issues

## Compatibility
- [ ] Python 3.8+ syntax only (no match/case, no X|Y unions)
- [ ] `parse()` returns 7-tuple — backward compatible
- [ ] Public API signatures unchanged (or documented as breaking)
- [ ] `@lru_cache` functions return immutable types
- [ ] CI matrix passes (Python 3.8–3.15)

## Test plan
- [ ] Test item 1
- [ ] Test item 2

🤖 Generated with [Claude Code](https://claude.com/claude-code)
EOF
)"

Step 8b: Review the Created PR

Invoke the /pr-review skill on the new PR number.


Type Reference (same as commits)

TypeEmojiUse Case
feat✨New feature
fix🐛Bug fix
docs📝Documentation
style💄Formatting only
refactor♻️Code restructure
perf⚡Performance
test✅Tests
build📦Dependencies
ci🌐CI/CD
chore🔧Maintenance/mixed changes
revert⏪Revert commit
remove🔥Remove code/files

Scope Priority (same as commits)

PriorityScopeFile Paths
1parseruser_agent_parser/parser.py
2engineuser_agent_parser/advanced_engine.py
3analyticsuser_agent_parser/analytics.py
4devicesuser_agent_parser/modern_devices.py, constants device entries
5constantsuser_agent_parser/constants.py
6apiuser_agent_parser/__init__.py
7teststests/*
8ci.github/workflows/*
9depspyproject.toml, poetry.lock

Rules

RuleDetails
Uncommitted ChangesRun /commit skill first
Existing PRDetect and switch to UPDATE mode
RemoteAlways origin (direct repo, not a fork)
Base BranchDefault main
PushPush to origin before creating/updating PR
Title Format<emoji> <type>(<scope>): <subject>
Title LengthMax 70 chars
TODO UpdatesMark completed items with [x] in update mode
ReviewInvoke /pr-review skill after create/update

Error Handling

ErrorAction
Uncommitted changesRun /commit skill first
On main branchAsk user to create a feature branch first
No commits ahead of origin/mainReport "Nothing to create PR for"
Push failsReport error and stop
gh CLI not authenticatedRun gh auth login

Output to User

CREATE MODE:

✅ PR created successfully!

**Title:** ✨ feat(parser): add Brave browser detection
**URL:** https://github.com/owner/user-agent-parser/pull/42
**Base:** origin/main
**Head:** feature-branch
**Commits:** 3 commits
**Files changed:** 4 files

Running /pr-review to check PR...

UPDATE MODE:

✅ PR #42 updated successfully!

**URL:** https://github.com/owner/user-agent-parser/pull/42
**New commits pushed:** 2
**Description updated:** Yes

Updates made:
- ✨ Added: "Add parametrized test cases for Brave"
- ✅ Completed: "poetry run pytest passes"

Running /pr-review to check PR...

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

同じリポジトリのスキル

概要と使いどころ

commit

無料

Create well-formatted git commits following project conventions with emoji, type, and scope

日本語の概要は準備中です。原文の説明を表示しています。

Purushot14/user-agent-parser62026年3月18日 更新

pr-review

無料

Review PR changes against project standards and post feedback

日本語の概要は準備中です。原文の説明を表示しています。

Purushot14/user-agent-parser62026年3月18日 更新

review

無料

Review working changes - code quality, security, library correctness, and standards auto-fix

日本語の概要は準備中です。原文の説明を表示しています。

Purushot14/user-agent-parser62026年3月18日 更新

Purushot14 のスキルをすべて見る

このスキルの問題を報告する