# Blame Why

> This skill should be used when the user types /blame-why, or asks why a specific line of code exists, who wrote it, or what a line was for.

- Skill: `utsabpanta/blame-why` (Agent Skill)
- Install (CLI): `npx skillmds@latest add utsabpanta/blame-why`
- Raw SKILL.md: https://api.skillmd.com/api/skills/utsabpanta/blame-why/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: utsabpanta (https://skillmd.com/u/utsabpanta)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/utsabpanta/blame-why

---


Explain why the code at $ARGUMENTS exists.

Steps:

1. Parse the argument as `<file>:<line>`. If it's not in that form, ask the user for a file and line.
2. Run `git blame -L <line>,<line> <file>` to find the commit that last touched that line.
3. Run `git show <sha>` to get the commit message and the surrounding change.
4. Read the code around the line (at least 20 lines of context) to understand what it does.
5. If the commit message is vague ("fix bug", "update"), look at other files changed in the same commit — they often reveal the real intent.

Output in this shape:

```
## Line
<file>:<line> — quote the line

## Last changed
<short sha> by <author> on <date>

## Why
1–3 sentences explaining what this line accomplishes AND the motivation
(from the commit + surrounding code). Be honest if the commit message
is uninformative and you're inferring.

## Related context
Other notable things the same commit touched (if any).
```

If the line has never meaningfully changed (blame points to the initial commit with a generic message), say so — sometimes the truthful answer is "this has always been here and no one documented why."

