mcpField
C
catchup

catchup

github.com/niekcandaele開発650 回インストール3 日前に更新
リポジトリ

catchup について

catchupは、Gitリポジトリのコミット、変更ファイル、ブランチ間の差分を要約する開発スキルです。変更ファイルをすべて読まずに、セッションのクリア後に作業状況を把握できます。

主な機能

  1. 01現在のブランチと基準ブランチの比較
  2. 02コミットと変更ファイルの要約
  3. 03変更数と差分統計の表示
  4. 04ファイル内容の選択的な確認

活用シーン

  1. 01セッションをクリアした後の状況把握
  2. 02PR作成前のブランチ変更の確認
  3. 03作業引き継ぎ前のブランチ状態の確認

インストール

コマンドをコピーしてターミナルで実行します。

$npx skills add https://github.com/niekcandaele/skills --skill catchup

インストール後、Claude Code で/catchupを入力して読み込まれたか確認します。

詳細

キャッチアップ

目的

コミット、変更されたファイル、主な変更点をスマートに要約し、現在のブランチでの変更をすばやく把握します。「再開ワークフロー」に最適化されています。/clear を実行した後に /catchup を使えば、すべてのファイルを読むことなく、すぐに状況を把握できます。

入力

  • $ARGUMENTS(任意):比較対象のベースブランチ名
    • 指定されない場合:main、master、develop を自動検出します
    • 例:/catchup、/catchup main、/catchup develop

処理

1. Git リポジトリの確認

Git リポジトリ内にいることを確認します。

git rev-parse --git-dir

失敗した場合は、このコマンドには Git リポジトリが必要であることをユーザーに伝え、終了します。

2. 現在のブランチとベースブランチの検出
# Get current branch
CURRENT_BRANCH=$(git branch --show-current)

# If no argument provided, auto-detect base branch
if [ -z "$ARGUMENTS" ]; then
  # Try to find default branch from remote
  DEFAULT_BRANCH=$(git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null | sed 's@^refs/remotes/origin/@@')

  # Fallback: check if main or master exists
  if [ -z "$DEFAULT_BRANCH" ]; then
    if git show-ref --verify --quiet refs/heads/main; then
      DEFAULT_BRANCH="main"
    elif git show-ref --verify --quiet refs/heads/master; then
      DEFAULT_BRANCH="master"
    elif git show-ref --verify --quiet refs/heads/develop; then
      DEFAULT_BRANCH="develop"
    else
      echo "Could not auto-detect base branch. Please specify: /catchup <base-branch>"
      exit 1
    fi
  fi
  BASE_BRANCH="$DEFAULT_BRANCH"
else
  BASE_BRANCH="$ARGUMENTS"
fi

ベースブランチが存在することを確認します。

if ! git show-ref --verify --quiet refs/heads/$BASE_BRANCH; then
  echo "Error: Base branch '$BASE_BRANCH' does not exist"
  exit 1
fi
3. 変更の確認

変更があるかどうかを判定します。

# Get commit count ahead
COMMITS_AHEAD=$(git rev-list --count $BASE_BRANCH..HEAD)

# Get changed files count
CHANGED_FILES=$(git diff --name-only $BASE_BRANCH...HEAD | wc -l)

両方の値がゼロの場合:

No changes detected between $CURRENT_BRANCH and $BASE_BRANCH.
Branches are in sync.

正常終了します。

4. ブランチ情報の収集

ブランチに関する包括的な情報を収集します。

# Commit history (one-line format)
git log --oneline $BASE_BRANCH..HEAD

# Changed files with status
git diff --name-status $BASE_BRANCH...HEAD

# Diff stats (lines added/removed per file)
git diff --stat $BASE_BRANCH...HEAD

# Get uncommitted changes if any
git status --porcelain
5. 要約の整理と提示

次の構成で情報を提示します。

# Branch Catchup: {CURRENT_BRANCH}

## Overview
- **Current Branch**: {CURRENT_BRANCH}
- **Base Branch**: {BASE_BRANCH}
- **Commits Ahead**: {COMMITS_AHEAD}
- **Files Changed**: {total} ({added} added, {modified} modified, {deleted} deleted)
- **Uncommitted Changes**: {Yes/No} ({count} files)

## Commit History

{List commits with hash and message}

## Changed Files by Status

### Added Files
{List of added files}

### Modified Files
{List of modified files with diff stats}

### Deleted Files
{List of deleted files}

## Diff Statistics

{Output from git diff --stat showing lines changed per file}

## Uncommitted Changes
{If any exist, show git status output}

## File Organization

{Group files by directory/component for easier understanding}
Example:
- **Backend (src/)**: 5 files
- **Frontend (ui/)**: 3 files
- **Tests (tests/)**: 2 files
- **Docs (docs/)**: 1 file

## Key Insights

{Analyze commit messages and file changes to provide context}
- Main focus: {infer from commit messages}
- Components affected: {list major areas}
- Potential breaking changes: {flag if file names suggest}

## Next Steps

To see detailed changes in a specific file:
- Read the file directly
- Or git diff: `git diff {BASE_BRANCH}...HEAD -- path/to/file.py`

To resume work:
- Review uncommitted changes if any
- Review any outstanding task list
- Continue implementation
6. スマートなファイル読み込み(任意)

次の場合に限り、ファイルの内容を読み込みます。

  • 変更されたファイルがごく少ない(3 件以下)
  • ユーザーが明示的に詳細を求めている
  • 差分の統計情報から変更内容がわからない

それ以外の場合は、要約だけで十分な情報が得られると判断します。目的は効率化です。20 件以上のファイルを読むと、「すばやいキャッチアップ」という目的に反します。

エラー処理

Git リポジトリ内にいない場合
Error: This command requires a git repository.
Current directory is not a git repository.
無効なベースブランチ
Error: Base branch '{BASE_BRANCH}' does not exist.
Available branches: {list branches}

Usage: /catchup [base-branch-name]
デタッチド HEAD の状態
Warning: You are in a detached HEAD state.
Current commit: {hash}
Cannot determine current branch name.

You may want to create a branch first:
git checkout -b my-branch-name
コミットがまだない場合
This appears to be a new repository with no commits.
Cannot compare branches without commit history.

出力ガイドライン

  • 簡潔にする:最初に要約を表示し、詳細はリクエストに応じて提示します
  • 整理する:関連するファイルをグループ化します
  • 次の行動につなげる:状態に応じて次のステップを提案します
  • 正確にする:Git の出力を慎重に解析し、例外的な状況にも対処します

使用例

# Basic usage - auto-detect base branch
/catchup

# Compare to specific branch
/catchup develop

# Compare to main explicitly
/catchup main

# After /clear to understand current state
/clear
/catchup  # "What have I been working on?"

他のコマンドとの連携

このコマンドは次のコマンドと相性が良いです。

  • /clear - 状態をクリアした後、/catchup を使って状況を把握します
  • /handoff - /catchup の後に /handoff を使って作業を記録します
  • /create-pr - /catchup の後に変更を確認してから PR を作成します
  • /check-ci - /catchup の後にテストが通ることを確認します

最終指示

  1. 読みやすさを保つため、出力を 1000 行未満にします
  2. 差分が非常に大きい場合(50 ファイル超)は、要約の統計情報のみを表示します
  3. 行ごとの差分ではなく、コミットと大まかな変更点に重点を置きます
  4. 30 秒以内にブランチの状態をすばやく把握できるようにします
  5. ファイルを読み込む際にそのままコピーして使える形式でファイルパスを提示します

コメント