repo-explorer
Repo Explorer
Launch a separate Claude Code CLI process (claude -p --model haiku) with read-only
tools to explore a repository and answer questions about it. Supports both local
repositories and remote URLs.
Workflow
1. Determine repo source and question
From the user's message extract:
- source: one of:
- local path (
~/projects/foo,/opt/services/bar,.or omitted = cwd) - remote URL (
https://github.com/owner/repo,git@github.com:owner/repo.git) - shorthand (
owner/repo— treat ashttps://github.com/owner/repo)
- local path (
- question: what to find out about the repository.
2. For remote repos — clone to temp directory
If the source is a remote URL or shorthand, clone it first:
REPO_DIR=$(mktemp -d) && git clone --depth 1 <url> "$REPO_DIR" && echo "$REPO_DIR"
- Use
--depth 1for speed (shallow clone, only latest commit) - If the user asks about a specific branch/tag:
git clone --depth 1 --branch <ref> <url> "$REPO_DIR" - Store
$REPO_DIRto clean up later
3. Run the CLI command
Use the Bash tool with timeout: 600000 (10 min) since exploration of large repos can take several minutes.
cd <repo_path> && CLAUDECODE= claude -p "<question>" \
--model haiku \
--output-format text \
--max-turns 15 \
--allowedTools "Read" "Grep" "Glob" "Bash(find *)" "Bash(ls *)" "Bash(wc *)" "Bash(git log *)" "Bash(git show *)" "Bash(git diff *)" "Bash(git branch *)" "Bash(head *)" "Bash(tail *)" \
--append-system-prompt "You are a code exploration expert. Thoroughly explore the repository to answer the user's question. Strategy: 1) Glob to discover project structure. 2) Grep to find patterns, definitions, routes, classes. 3) Read to examine key files. Always cite file paths and line numbers. Give a structured answer based on code facts."
IMPORTANT: The CLAUDECODE= prefix (setting the env var to empty) is required to allow
launching Claude Code as a subprocess. Without it, the nested session will be blocked.
Rules:
- Always include
CLAUDECODE=directly beforeclaude -p(no&&, it's an inline env override) - Escape double quotes in the question with
\" - Wrap repo paths containing spaces in quotes
- For very large repos, increase
--max-turnsto 25 - If user explicitly requests sonnet or opus, replace
--model haiku
4. Clean up (remote repos only)
After presenting the result, remove the temp directory:
rm -rf "$REPO_DIR"
5. Present the result
Display the CLI output to the user. If empty or error, report the issue and suggest retrying with a more specific question.
Examples
Local repo:
cd ~/projects/my-api && CLAUDECODE= claude -p "What REST endpoints are defined? List each with HTTP method, path, and handler." --model haiku --output-format text --max-turns 15 --allowedTools "Read" "Grep" "Glob" "Bash(find *)" "Bash(ls *)" "Bash(wc *)" "Bash(git log *)" "Bash(git show *)" "Bash(git diff *)" "Bash(git branch *)" "Bash(head *)" "Bash(tail *)" --append-system-prompt "You are a code exploration expert. Thoroughly explore the repository to answer the user's question. Strategy: 1) Glob to discover project structure. 2) Grep to find patterns, definitions, routes, classes. 3) Read to examine key files. Always cite file paths and line numbers. Give a structured answer based on code facts."
Remote repo (GitHub URL):
REPO_DIR=$(mktemp -d) && git clone --depth 1 https://github.com/expressjs/express "$REPO_DIR"
Then:
cd "$REPO_DIR" && CLAUDECODE= claude -p "How is routing implemented? Describe the Router class and middleware chain." --model haiku --output-format text --max-turns 15 --allowedTools "Read" "Grep" "Glob" "Bash(find *)" "Bash(ls *)" "Bash(wc *)" "Bash(git log *)" "Bash(git show *)" "Bash(git diff *)" "Bash(git branch *)" "Bash(head *)" "Bash(tail *)" --append-system-prompt "You are a code exploration expert. Thoroughly explore the repository to answer the user's question. Strategy: 1) Glob to discover project structure. 2) Grep to find patterns, definitions, routes, classes. 3) Read to examine key files. Always cite file paths and line numbers. Give a structured answer based on code facts."
Then: rm -rf "$REPO_DIR"
Shorthand (owner/repo): treat vercel/next.js as https://github.com/vercel/next.js.
Current directory (no path): run claude -p without cd.
More from codealive-ai/ai-driven-development
fpf-problem-solving
First Principles Framework (FPF) — thinking amplifier. Use when user wants to think through a complex problem, architect a system, evaluate alternatives, decompose complexity, classify problems, define quality attributes, or plan rigorously. Also triggers on: FPF, bounded contexts, SoTA packs, assurance calculus, FPF Parts A-K. Not for simple task planning, general philosophy, or Agile unrelated to FPF.
5settings-management
View and configure settings for coding agents (Claude Code, Codex CLI, OpenCode, and others). Covers JSON settings for Claude Code, TOML for Codex CLI, and JSON/JSONC for OpenCode, including permissions, sandbox, model selection, profiles, feature flags, providers, hooks, subagents, and skills.
3optimizing-claude-code
Audits repositories for Claude Code readiness and suggests improvements. Use when asked to check CLAUDE.md quality, review settings, audit project organization, or optimize for agentic work.
2agents-consilium
Query external AI agents (Codex, Gemini, OpenCode, Claude Code headless) in parallel for independent second opinions, code review, bug investigation, and consensus on high-stakes decisions. Agents and models are configurable in config.json. Use for architecture choices, security review, or ambiguous problems where independent perspectives matter. Not for simple questions answerable from docs or the codebase — use web search or repo exploration instead.
1clipboard
Copy text to clipboard with optional rich formatting. Triggers on "copy to clipboard", "copy that", "pbcopy", "copy formatted", "copy rich text".
1hooks-management
Manage hooks and automation for coding agents (Claude Code, Codex CLI, OpenCode). Use when users want to add, list, remove, update, or validate hooks. Triggers on requests like "add a hook", "create a hook that...", "list my hooks", "remove the hook", "validate hooks", or any mention of automating agent behavior with shell commands or plugins.
1