create-pr

JIRAチケットブランチからPRを自動作成するスキル。親ブランチ自動検出、JIRAリンク自動挿入、テンプレートに沿ったPR本文生成を行う。「PR作成」「PRを作って」「/create-pr」などのリクエストで使用。

16 stars

Best use case

create-pr is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

JIRAチケットブランチからPRを自動作成するスキル。親ブランチ自動検出、JIRAリンク自動挿入、テンプレートに沿ったPR本文生成を行う。「PR作成」「PRを作って」「/create-pr」などのリクエストで使用。

Teams using create-pr should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/create-pr-octkp/SKILL.md --create-dirs "https://raw.githubusercontent.com/diegosouzapw/awesome-omni-skill/main/skills/tools/create-pr-octkp/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/create-pr-octkp/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How create-pr Compares

Feature / Agentcreate-prStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

JIRAチケットブランチからPRを自動作成するスキル。親ブランチ自動検出、JIRAリンク自動挿入、テンプレートに沿ったPR本文生成を行う。「PR作成」「PRを作って」「/create-pr」などのリクエストで使用。

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# Create PR Skill

JIRAチケット番号のブランチからPull Requestを自動作成する。親ブランチの自動検出、JIRAリンクの自動挿入、テンプレートに沿った本文生成を行う。

## 使用方法

```
/create-pr
```

引数なしで実行。現在のブランチ名とgit履歴から全て自動判定する。

## 実行手順

### Step 1: 事前チェック

1. `git branch --show-current` でブランチ名を取得
2. ブランチ名が `main` または `develop` の場合はエラー終了:
   - 「main/developブランチ上ではPRを作成できません。フィーチャーブランチに切り替えてください。」
3. `gh auth status` で認証状態を確認。未認証ならエラー:
   - 「gh CLIが未認証です。`gh auth login` を実行してください。」
4. `gh pr list --head {ブランチ名} --json url --jq '.[0].url'` で既存PRを確認。存在する場合:
   - 「既存のPRが見つかりました: {URL}」と表示して終了
5. `git status --porcelain` で未コミット変更を確認。ある場合:
   - 「未コミットの変更があります。先にコミットすることを推奨します。」と警告(続行は可能)

### Step 2: 親ブランチ検出

以下の優先順で親ブランチを特定する:

#### 方法A: merge-base距離比較(推奨)

```bash
git fetch origin
CURRENT=$(git branch --show-current)
git branch -r --list 'origin/*' | grep -v "origin/$CURRENT" | grep -v 'origin/HEAD' | while read branch; do
  echo "$(git rev-list --count $(git merge-base HEAD $branch)..HEAD) $branch"
done | sort -n | head -1 | awk '{print $2}' | sed 's|origin/||'
```

最もmerge-baseが近い(= 分岐元に近い)リモートブランチを親とする。

#### 方法B: 直前のブランチ

方法Aで結果が得られない場合:

```bash
git rev-parse --abbrev-ref @{-1}
```

#### フォールバック

いずれも失敗した場合、AskUserQuestionでユーザーに確認する:
- 「親ブランチ(PRのマージ先)を指定してください」
- 選択肢: `main`, `develop`, その他

### Step 3: 差分収集

```bash
git diff origin/{parent}...HEAD --stat
git log origin/{parent}..HEAD --oneline
```

差分の内容とコミットメッセージを確認し、変更の概要を把握する。

### Step 4: PR本文生成

テンプレート(`templates/pr-template.md`)の構造に従い、PR本文を構築する:

- **概要**: 差分とコミットログから日本語で要約を自動生成
- **関連リンク**: `https://kokopelli-inc.atlassian.net/browse/{ブランチ名}` を自動挿入
- **動作確認**: 空欄のまま
- **特に見て欲しいところ**: 空欄のまま

### Step 5: プッシュ

リモートにブランチが存在しない場合:

```bash
git push -u origin {ブランチ名}
```

### Step 6: PR作成

```bash
gh pr create --base {parent} --title "{ブランチ名}: {変更の要約}" --body "$(cat <<'EOF'
# 📝 概要

{自動生成した要約}

# 🔗 関連リンク

- https://kokopelli-inc.atlassian.net/browse/{ブランチ名}

# 🧪 動作確認



# 👀 特に見て欲しいところ

EOF
)"
```

### Step 7: 結果表示

作成されたPRのURLを表示する。

## PRタイトル

- フォーマット: `{ブランチ名}: {変更の要約}`
- 例: `BAX-12345: チャットメンバー表示の不整合を修正`
- 要約は日本語で簡潔に(70文字以内)

## エラーハンドリング

| 状況 | 対応 |
|------|------|
| `main`/`develop`上で実行 | エラーメッセージを表示して終了 |
| 未コミット変更あり | 警告を表示(続行可能) |
| 既存PRが存在 | 既存PRのURLを表示して終了 |
| `gh` CLI未認証 | エラーメッセージを表示して終了 |
| 親ブランチ検出失敗 | ユーザーに確認 |

Related Skills

create-target

16
from diegosouzapw/awesome-omni-skill

Scaffold a new target type (e.g., Zed, Windsurf) for universal-ai-config

create-project

16
from diegosouzapw/awesome-omni-skill

Initialize new projects with CAMI capabilities and recommended agent teams. Triggers on "create a new project", "start a new project", "initialize project", "set up project with agents", "what agents do I need for this project", "help me set up my project roster". Guides through project requirements, tech stack detection, agent team recommendations, and full CAMI initialization.

create-plugin-scaffold

16
from diegosouzapw/awesome-omni-skill

Create a new Cursor plugin scaffold with a valid manifest, component directories, and marketplace wiring. Use when starting a new plugin or adding a plugin to a multi-plugin repository.

create-my-tools-profile

16
from diegosouzapw/awesome-omni-skill

Generate a personalized AI skill based on your configured Zapier MCP tools. Scans your enabled actions and creates instructions that help your AI assistant know when and how to use each tool. Use after setting up tools, or when you want to "create my tools profile", "personalize my assistant", or "make a skill from my tools".

create-mcp-json

16
from diegosouzapw/awesome-omni-skill

Create an mcp.json client configuration from a server.json. Use when the user wants to generate a ready-to-use MCP client config for connecting to an MCP server.

create-issues

16
from diegosouzapw/awesome-omni-skill

Systematic GitHub issue creation from requirements. Analyzes codebase, breaks down requirements into multiple issues with dependencies, proposes detailed issues for review, and creates them after user approval. Triggers: /create-issues, create issues, batch issue creation, requirement breakdown.

create-command

16
from diegosouzapw/awesome-omni-skill

Guide for creating custom Claude Code slash commands with proper structure, argument handling, frontmatter configuration, and best practices. Use when the user wants to create slash commands, custom commands, reusable prompts, or mentions creating/designing/building commands.

--- name: create-book

16
from diegosouzapw/awesome-omni-skill

description: Does a dev editor pass on files created from the create-story-bible skill

ccn:create-topic

16
from diegosouzapw/awesome-omni-skill

Create a new topic file in .notes/ with frontmatter template

acc-create-test-builder

16
from diegosouzapw/awesome-omni-skill

Generates Test Data Builder and Object Mother patterns for PHP 8.5. Creates fluent builders with sensible defaults and factory methods for test data creation.

acc-create-query

16
from diegosouzapw/awesome-omni-skill

Generates CQRS Queries and Handlers for PHP 8.5. Creates read-only query DTOs with handlers that return data without side effects. Includes unit tests.

acc-create-psr18-http-client

16
from diegosouzapw/awesome-omni-skill

Generates PSR-18 HTTP Client implementation for PHP 8.5. Creates ClientInterface with request sending and exception handling. Includes unit tests.