Communitygithub.com

GitHub CLI (gh) スキル

GitHub CLI (gh) を使用して、ターミナルから直接 Issue、プルリクエスト、ブランチ、コミット、コードレビューを管理するためのスキルです。

GitHub CLI (gh) スキル とは?

このスキルは、GitHub CLI (gh) を活用して、ブラウザに切り替えることなくターミナル上で GitHub の様々な操作を実行できるようにします。主な機能として、Issue の作成・一覧表示・編集・クローズ、プルリクエストの作成・レビュー・マージ、ブランチの作成とコミット、GitHub Actions ワークフローの管理などが含まれます。開発者は、gh コマンドを通じてこれらの操作を効率的に行うことができ、特に Claude Code のような AI エージェントが自動的にタスクを実行する際に有用です。このスキルは、gh CLI がインストールされ認証済みであることを前提としており、GitHub.com および GitHub Enterprise の両方で動作します。スキルには、各操作の具体的なコマンド例と、よく使うフラグのリファレンス、マルチライン記述を扱う際の実践的なヒントも含まれています。

対応✓Claude Code~Codex CLI~Cursor
npx skills add https://github.com/cdcoonce/Portfolio_Website/tree/HEAD/.claude/skills/github-cli

お気に入りのAIに質問する

このエージェントスキルを事前に読み込んだ状態で新しいチャットを開きます。

ドキュメント

GitHub CLI (gh) スキル は何をしますか?

gh CLI を使用して、ターミナルから GitHub リポジトリ、Issue、プルリクエスト、GitHub Actions ワークフローと対話します。

前提条件

g がインストールされ、認証されていることを確認します:

g --version
g auth status

認証されていない場合は、gh auth login を実行し、プロンプトに従ってください。

コアワークフロー

Issue 管理

# Issue の一覧表示
g issue list                             # 現在のリポジトリのオープン Issue
g  issue list --state all                # クローズされた Issue も含むすべて
g issue list --assignee @me              # 自分に割り当てられた Issue
g issue list --label "bug"               # ラベルでフィルタ

# Issue の作成
g issue create -t "タイトル" -b "説明"
g issue create -t "タイトル" --label "bug,priority:high" --milestone "milestone-1"
g issue create                           # インタラクティブモード

# Issue の表示/更新
g issue view 123                          # Issue の詳細を表示
g issue view 123 --web                    # ブラウザで開く
g issue edit 123 --add-label "in-progress"
g issue close 123
g issue reopen 123

# コメントの追加
g issue comment 123 -b "現在取り組んでいます"

ブランチとコミットのワークフロー

# 機能/修正ブランチを作成
git checkout -b feature/my-feature
git checkout -b fix/issue-123
git checkout -b draft/wip-experiment

# 変更をステージしてコミット
git add .
git commit -m "feat: 新機能を追加"
git commit -m "fix: Issue #123 を修正"

# ブランチをリモートにプッシュ
git push -u origin feature/my-feature

プルリクエスト管理

# PR を作成 (複数の方法)
g pr create                              # インタラクティブモード
g pr create --fill                       # コミットから自動入力
g pr create --draft                      # ドラフトとして作成
g pr create --draft --fill               # ドラフト + 自動入力
g pr create -t "タイトル" -b "説明" -B main
g pr create --label "review-needed" --assignee @me

# PR の一覧表示
g pr list                                # オープン PR
g pr list --assignee @me                 # 自分の PR
g pr list --search "review-requested:@me"  # レビュー依頼中の PR
g pr list --draft                        # ドラフト PR のみ

# PR の詳細表示
g pr view 45                              # ターミナルで PR を表示
g pr view 45 --web                        # ブラウザで開く

コードレビューワークフロー

# PR をローカルでチェックアウト
g pr checkout 45                          # PR ブランチをローカルにチェックアウト

# 変更をレビュー
g pr diff 45                              # PR の差分を表示
g pr diff                                 # カレントブランチの PR の差分を表示

# レビューコメントを追加
g pr comment 45 -b "LGTM、42行目に小さな提案があります"
g pr comment -b "テストを追加してください"        # カレントブランチの PR にコメント

# 正式なレビューを送信
g pr review 45 --approve
g pr review 45 --request-changes -b "エラーハンドリングを修正してください"
g pr review 45 --comment -b "全体的には良いですが、いくつか提案があります"

# マージ
g pr merge 45                            # インタラクティブマージ
g pr merge 45 --squash                   # スクワッシュマージ
g pr merge 45 --rebase                   # リベースマージ
g pr merge 45 --merge                    # 標準マージコミット
g pr merge 45 --auto                     # チェックが通過したら自動マージ

既存 PR の更新

g pr edit 45 --title "新しいタイトル"
g pr edit 45 --body "更新された説明"
g pr edit 45 --base develop
g pr edit 45 --add-label "ready-for-review"
g pr ready 45                            # 準備完了 (ドラフト解除)

GitHub Actions ワークフロー管理

# ワークフロー実行の一覧表示
g run list                               # 最近のワークフロー実行
g run list --workflow=ci.yml             # 特定のワークフロー
g run list --status=failure              # 失敗した実行のみ

# ワークフロー実行の詳細表示
g run view                               # インタラクティブな実行選択
g run view 12345                         # 特定の実行
g run view 12345 --web                   # ブラウザで開く

# ワークフローのトリガー
g workflow run ci.yml                    # デフォルトブランチで実行
g workflow run ci.yml --ref feature/x    # 特定のブランチで実行
g workflow run ci.yml -f key=value       # 入力パラメータ付き

# 失敗したジョブの再実行
g run rerun 12345                        # すべてのジョブを再実行
g run rerun 12345 --failed               # 失敗したジョブのみ再実行

# ジョブログの表示
g run view 12345 --log                   # すべてのログ出力
g run view 12345 --log-failed            # 失敗したジョブのログのみ

# 実行中のワークフローを監視
g run watch                              # 現在の実行を監視
g run watch 12345                        # 特定の実行を監視

よく使うフラグ一覧

フラグ説明
-R, --repo OWNER/REPO異なるリポジトリを対象にする
-B, --basePR のベースブランチ
-H, --headPR のヘッドブランチ
-t, --titleIssue/PR のタイトル
-b, --bodyIssue/PR の本文/説明
-l, --labelラベル (カンマ区切り)
-a, --assigneeアサインするユーザー名
-m, --milestoneマイルストーン名
--draftドラフト PR として作成
--fillコミットメッセージから自動入力
--webブラウザで開く
-y, --yes確認プロンプトをスキップ

環境変数

export GH_TOKEN="ghp_xxxx"               # 個人アクセストークン
export GH_HOST="github.example.com"      # GitHub Enterprise インスタンス
export GH_REPO="owner/repo"              # デフォルトリポジトリ

ヒントと注意点

マークダウンを含む複数行の説明文

コードブロックやバッククォートを含む長い説明文で Issue や PR を作成する場合、ヒアドキュメントはシェルの解釈により失敗する可能性があるため避けてください。代わりに以下のようにします:

# ステップ 1: 説明文を一時ファイルに書き込む (bash の外で)
# ステップ 2: 一時ファイルから作成
g issue create -t "タイトル" -b "$(cat temp_description.txt)"
# ステップ 3: クリーンアップ
rm temp_description.txt

これにより、以下の問題を回避できます:

  • コードブロック内のバッククォートがコマンド置換と競合する
  • 特殊文字がシェルによって解釈される
  • ヒアドキュメントのデリミタ競合

既存ファイルからの説明文の読み込み

マークダウンの計画ファイルから Issue や PR を作成する場合:

# ファイルベースの説明には body-file フラグを使用
g issue create -t "タイトル" --body-file docs/plans/my-plan.md
g pr create -t "タイトル" --body-file docs/plans/my-plan.md

詳細リファレンス

包括的なコマンドオプションと例については、references/commands.md を参照してください。

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

cdcoonce/Portfolio_Website

Git commit workflow with enforced conventional commit style. Use when Claude needs to stage and commit changes, craft commit messages, or the user asks to commit, make a commit, or save their work. Ensures consistent commit message format, proper scoping, and atomic commits across the project.

cdcoonce/Portfolio_Website

AI-powered code quality analysis for Python, Markdown, and Mermaid diagrams. Use this skill when: (1) reviewing code for quality issues, (2) checking Python files for PEP8 violations, unused code, missing type hints, docstring problems, complexity issues, or potential runtime errors, (3) validating Markdown documentation for broken links, heading structure, or formatting issues, (4) validating Mermaid diagram syntax, (5) the user asks for a "code review" or "quality check", (6) analyzing code snippets pasted in conversation, or (7) suggesting and applying fixes for code quality issues.

cdcoonce/Portfolio_Website

Deploy the portfolio chat agent Lambda function to AWS. Use when the user asks to deploy, redeploy, push to Lambda, update the chat agent, or after updating context files or lambda_function.py. Rebuilds the knowledge base, packages dependencies, and deploys to AWS Lambda.

cdcoonce/Portfolio_Website

Generate multiple radically different interface designs for a module using parallel sub-agents. Use when user wants to design an API, explore interface options, compare module shapes, or mentions "design it twice".

cdcoonce/Portfolio_Website

Orchestrate the full GitHub-issues-driven development lifecycle. 7-phase pipeline from brainstorm through PR with state tracking and cross-conversation resume. Use when user says "dev cycle", "development workflow", "full development pipeline", or invokes /dev-cycle.

cdcoonce/Portfolio_Website

Production Python coding standards with automatic version detection (3.10-3.13). Use when writing, reviewing, or refactoring Python to ensure adherence to modern type syntax, LBYL exception handling, pathlib operations, ABC-based interfaces, and production-tested patterns. Not Dagster-specific - applies to any Python project.

cdcoonce/Portfolio_Website

Set up Claude Code hooks to block dangerous git commands (push, reset --hard, clean, branch -D, etc.) before they execute. Use when user wants to prevent destructive git operations, add git safety hooks, or block git push/reset in Claude Code.

cdcoonce/Portfolio_Website

Interview the user relentlessly about a plan or design until reaching shared understanding, resolving each branch of the decision tree. Use when user wants to stress-test a plan, get grilled on their design, or mentions "grill me".

cdcoonce/Portfolio_Website

Explore a codebase to find opportunities for architectural improvement, focusing on making the codebase more testable by deepening shallow modules. Use when user wants to improve architecture, find refactoring opportunities, consolidate tightly-coupled modules, or make a codebase more AI-navigable.

cdcoonce/Portfolio_Website

CEO/founder-mode plan review. Rethink the problem, find the 10-star product, challenge premises, expand scope when it creates a better product. Three modes: SCOPE EXPANSION (dream big), HOLD SCOPE (maximum rigor), SCOPE REDUCTION (strip to essentials). Use when the user asks for a plan review, CEO review, mega review, or wants a plan challenged/stress-tested before implementation.

cdcoonce/Portfolio_Website

Break a PRD into independently-grabbable GitHub issues using tracer-bullet vertical slices. Use when user wants to convert a PRD to issues, create implementation tickets, or break down a PRD into work items.

cdcoonce/Portfolio_Website

Turn a PRD into a multi-phase implementation plan using tracer-bullet vertical slices, saved as a local Markdown file in docs/plans/. Use when user wants to break down a PRD, create an implementation plan, plan phases from a PRD, or mentions "tracer bullets".

cdcoonce/Portfolio_Website

Generate or update the `.claude/docs/project.md` file that gives Claude project-specific context. Use this skill when the user asks to create, update, regenerate, or refresh project context, or says things like "update project.md", "generate project context", "this repo needs a project.md", or "Claude doesn't know about this project". Also trigger when onboarding Claude to a new repository for the first time.

cdcoonce/Portfolio_Website

Generate comprehensive, high-quality README.md files for code repositories. Use this skill whenever the user asks to create, write, generate, update, or improve a README for any project or repository. Also trigger when the user says things like "document this project", "write docs for this repo", "this repo needs a README", "help me onboard developers to this codebase", or asks for project documentation in markdown. Even if the user just says "README" or "readme" in the context of a codebase, use this skill.

cdcoonce/Portfolio_Website

Create a detailed refactor plan with tiny commits via user interview, then file it as a GitHub issue. Use when user wants to plan a refactor, create a refactoring RFC, or break a refactor into safe incremental steps.

cdcoonce/Portfolio_Website

Set up pre-commit hooks for the current repo. Use when user wants to add pre-commit hooks, configure commit-time linting, formatting, type checking, or testing. Triggers on "pre-commit", "git hooks", "linting hooks", or /setup-pre-commit.

cdcoonce/Portfolio_Website

Test-driven development with red-green-refactor loop. Use when user wants to build features or fix bugs using TDD, mentions "red-green-refactor", wants integration tests, or asks for test-first development.

cdcoonce/Portfolio_Website

Triage a bug or issue by exploring the codebase to find root cause, then create a GitHub issue with a TDD-based fix plan. Use when user reports a bug, wants to file an issue, mentions "triage", or wants to investigate and plan a fix for a problem.

cdcoonce/Portfolio_Website

Rewrites the prose sections of wiki pages in-place. Reads source files to understand current context, then updates only the content inside <!-- claude:prose --> ... <!-- claude:prose:end --> markers. Never touches <!-- generated:start --> ... <!-- generated:end --> blocks. Supports targeting a single page with /update-wiki {PageName}.

cdcoonce/Portfolio_Website

Create a PRD through user interview, codebase exploration, and module design, then submit as a GitHub issue. Use when user wants to write a PRD, create a product requirements document, or plan a new feature.

関連スキル