Explains why code exists, grounded in real git history. /why <file>[:<line>|:<start>-<end>]
A small Claude Code plugin that answers the question every engineer asks at least once a week: "why is this here?"
Pick any file, function, or weird-looking line. Run /why. The plugin walks the git history of that exact span, pulls the PR descriptions and linked issues, and writes you a 2-paragraph narrative — the bug it fixed, the conversation that produced it, the engineer who wrote it and when.
It runs locally — no backend, no upload, your repo stays your repo. It refuses to invent: every claim is anchored to a real commit hash, PR number, or file path. If the history doesn't support a claim, the plugin doesn't make it.
Most code archaeology takes 30 minutes of git log -L and tab-switching between PRs. /why does it in 5 seconds and writes it as something you can paste into a code comment.
claude plugin install github:rahulchawla18/why
You'll also need:
git (≥ 2.20) — the plugin shells out to itgh CLI (optional, recommended) — for PR descriptions and linked issues. Install: https://cli.github.com. After install, run gh auth login. Without gh, the plugin still works using commit messages only.# Whole file
/why src/auth/session.ts
# A single line
/why src/auth/session.ts:42
# A line range
/why src/auth/session.ts:40-55
> /why src/auth/session.ts:42
This line was added in 2023 by Alice in commit a1b2c3d (PR #847,
"Fix stale session race"). The PR description mentions a customer
escalation: sessions were being reused across logins because the
cache key didn't include the auth provider. The unusual `await sleep(50)`
exists as a workaround for a known upstream race in the SSO provider —
see the linked ticket SUPPORT-1234.
Two follow-up commits (#891, #903) modified the surrounding code but
left this line untouched, suggesting the workaround is still load-bearing.
Every claim in that narrative is backed by a real commit hash, PR number, or ticket ID gathered from your local git data. If the plugin can't find supporting evidence, it says so plainly instead of guessing.
/why slash command runs a small Python script that gathers data from your local git repo (and from gh if installed).No separate API key. No separate billing. No upload of your code anywhere.
gh + a GitHub origin.<file>:<line> scope only. Symbol resolution (/why validateSession) is planned for v0.2.git clone https://github.com/rahulchawla18/why
cd why
python -m venv .venv && source .venv/bin/activate # on Windows: .venv\Scripts\activate
pip install -e ".[dev]"
pytest
To try the plugin locally against this repo:
python -m why.cli README.md
MIT.
Own this plugin?
Verify ownership to unlock analytics, metadata editing, and a verified badge. GitHub access is read-only (username + org membership).
Sign in to claimOwn this plugin?
Verify ownership to unlock analytics, metadata editing, and a verified badge. GitHub access is read-only (username + org membership).
Sign in to claimBased on adoption, maintenance, documentation, and repository signals. Not a security audit or endorsement.
npx claudepluginhub rahulchawla18/why --plugin whyComprehensive feature development workflow with specialized agents for codebase exploration, architecture design, and quality review
Reliable automation, in-depth debugging, and performance analysis in Chrome using Chrome DevTools and Puppeteer
Harness-native ECC operator layer - 67 agents, 271 skills, 92 legacy command shims, reusable hooks, rules, selective install profiles, and production-ready workflows for Claude Code, Codex, OpenCode, Cursor, and related agent harnesses
Real-time statusline HUD for Claude Code - context health, tool activity, agent tracking, and todo progress
Comprehensive skill pack with 66 specialized skills for full-stack developers: 12 language experts (Python, TypeScript, Go, Rust, C++, Swift, Kotlin, C#, PHP, Java, SQL, JavaScript), 10 backend frameworks, 6 frontend/mobile, plus infrastructure, DevOps, security, and testing. Features progressive disclosure architecture for 50% faster loading.
Tools to maintain and improve CLAUDE.md files - audit quality, capture session learnings, and keep project memory current.