Clone a GitHub repository to a temporary directory for efficient local code exploration. ALWAYS prefer this over WebFetch or `gh api` for reading repository code — local clone is faster and more complete. Use when a GitHub repository URL appears and the task involves code access: investigation, analysis, comparison, reference, learning, or review. Triggers: GitHub repo URL + any code exploration intent ("調査して", "コードを見て", "investigate", "analyze", "explore", "compare", "refer to").
Clone a GitHub repository locally for efficient code exploration using Claude's native file tools.
/repo-dive https://github.com/owner/repo
/repo-dive https://github.com/owner/repo feature-branch
/repo-dive https://github.com/owner/repo/pull/123
Parse $ARGUMENTS to extract:
https://github.com/owner/repo or owner/repomain, feature/xyzhttps://github.com/owner/repo/pull/123#123If $ARGUMENTS is empty, ask the user for the repository URL.
Clone to /tmp/repo-dive/<owner>-<repo>:
# Default (shallow clone of default branch)
git clone --depth 1 https://github.com/owner/repo /tmp/repo-dive/owner-repo
# Specific branch
git clone --depth 1 --branch <branch> https://github.com/owner/repo /tmp/repo-dive/owner-repo
# PR — clone then checkout PR ref
git clone --depth 1 https://github.com/owner/repo /tmp/repo-dive/owner-repo
cd /tmp/repo-dive/owner-repo && gh pr checkout <number>
If the directory already exists, ask the user:
rm -rf then clone fresh)Use Claude's native file tools on the cloned directory:
/tmp/repo-dive/owner-repo/**/*.ts)For large-scale analysis, use the gemini-research skill targeting the cloned directory.
Do NOT use gh api for file contents — everything is local now.
Summarize findings to the user. Structure depends on the request but typically includes:
Do NOT automatically delete the cloned repository after exploration. The user may want to continue investigating in follow-up messages. The /tmp directory is cleaned up on system restart.
If the user explicitly asks to clean up:
rm -rf /tmp/repo-dive/owner-repo
git clone uses the gh CLI's auth context (credential helper). If clone fails, suggest gh auth status to verify authentication.--depth 1) is the default. If the user needs git history (blame, log), re-clone without --depth 1.