Skip to content
Back to skills

Explain Why

ASecurity

Use when someone asks why code or a design is the way it is — "why is this like this", "почему тут так", "who decided this", "what did we try before", "history of this symbol/file", "this looks wrong/legacy, can we clean it up" — or when you are about to conclude that existing code is a mistake. Also reachable directly as /sidegraph:explain-why. Routes the question to the decision store before grep or git archaeology: resolve the entity, walk its history newest-first including superseded reco...

  • 2 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added November 21, 2026
ai-agentsgogitapi

Works with

  • api
  • mcp

Security analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned November 21, 2026

npx -y skills add SantyagoSeaman/sidegraph --skill explain-why --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Explain Why?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Explain Why
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/santyagoseaman-explain-why/badge)](https://www.skillsdirectory.com/skills/santyagoseaman-explain-why)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: explain-why
description: >-
  Use when someone asks why code or a design is the way it is — "why is this like this", "почему тут так", "who decided this", "what did we try before", "history of this symbol/file", "this looks wrong/legacy, can we clean it up" — or when you are about to conclude that existing code is a mistake. Also reachable directly as /sidegraph:explain-why. Routes the question to the decision store before grep or git archaeology: resolve the entity, walk its history newest-first including superseded records (the "tried and abandoned" chain IS the answer), and report current truth separately from how it got that way.
---

# Explain why

The store's third line of the north star — *decisions are how it got that way* — as a
read path. Someone is looking at code and asking a why-question; the answer, if captured,
is a chain of records, not a diff. Grep and `git log` reconstruct *what* changed;
this skill retrieves *why*, including the alternatives that were tried and thrown away —
the part no amount of reading the current code can derive.

**Run this before concluding existing code is wrong.** The single most expensive failure
mode this store exists to prevent is confidently re-proposing the design the team already
rejected. If the answer to "why is this so strange?" is a recorded constraint or a paid-for
lesson, finding it costs one tool call; not finding it costs re-living it.

## Resolve the question to a seed

Three shapes of why-question, three entry points:

- **A file or a few files** ("why is this module structured like this") →
  `get_task_context(files=["src/..."])` — decisions, mistakes and facts. Call
  `query_structure` with the same seeds for the code map. `get_task_context` reads a
  loosely spelled path (`./src/x.py`, a basename, a directory) and, when a file has no record
  of its own, says where the nearest memory is.
  `query_decisions(files=[...])` returns the same memory, but it matches the
  path exactly as written and answers `No context found.` for one it cannot place.
- **A named symbol, class, or doc heading** ("why does `X` do Y") →
  `find_entity(name, file_path=...)` first. A single match returns `entity_id`; then
  `get_entity_history(entity_id)` — every decision **and** fact ever bound to that
  entity, newest first, *regardless of status* (a proposal the surfacing policy withholds is
  left out). Ambiguity comes back as `candidates`,
  never a guess — re-call with `file_path`.
- **An area or theme** ("why do we do payments this way") →
  `retrieve_decisions(query="<the area's words>")`.

A record tagged `[drifted]` needs content review: code changed or a prior check no longer
applies — verify it against the current code before presenting it as current truth (and if it no longer
holds, that's `sidegraph:triage-drift`'s job). `[unratified]` means a human hasn't
accepted it yet — present it as a proposal, not settled memory.

## Walk the chain, don't stop at the newest record

`get_entity_history` returns superseded records too — that's the point. On a long-lived
entity the newest records come in full and the rest as short rows (`omitted_records`) or bare
ids (`omitted_ids`). Explicit-id `retrieve_decisions` / `list_facts` calls obey the
proposal-surfacing policy and can omit old or regulated-mode proposals. For complete local
records use `Store.get_decision(id)` / `Store.get_fact(id)` on the configured store, or
narrow history with `status=["superseded"]`. The answer to a
why-question has two layers, and the reader deserves both, clearly separated:

1. **Current truth** — the live (`accepted`) records: the standing decision, its
   constraints, its evidence facts.
2. **How it got that way** — the `supersedes` chain walked backwards: each superseded
   record is one "tried before, abandoned because…" step. A record's `rejected` field is
   the alternatives that were considered *within* one decision; the supersession chain is
   the alternatives that were *shipped and then reversed*. Both belong in the answer.

When history for an entity comes back empty but the question smells area-level, widen
once: `retrieve_decisions(query="<one or two topic words>", include_superseded=True)`
lists the records on that topic (mistakes ranked first, superseded/rejected/retired included, cut
at a budget) — read its `hint`, and scan the titles, before declaring the store silent.

## Answer shape

Lead with the current answer, cite record ids, keep the layers separate:

- *Why it is this way now:* the live decision(s) — choice + the constraint/lesson that
  forced it. Quote `rejected` when it directly answers "why not the obvious way?".
- *What was tried before:* the superseded chain, oldest to newest, one line each — what
  was abandoned and why. This is the part that stops the re-proposal.
- *Caveats:* `[drifted]` / `[unratified]` flags, and any gap between the record and the
  code you just read.

## When the store is silent

Say so plainly — never pad a thin answer into a confident one. Then:

- Fall back to real archaeology: `git log -L`/`git blame` on the file, PR descriptions,
  linked issues. Report it as reconstruction, not memory — it tells you *what* and
  *when*, and only sometimes *why*.
- **A why-question the store couldn't answer is capture material.** Once the human
  reconstructs the actual reason ("oh, that's because the vendor API double-fires"),
  that's a decision or fact worth writing — hand off to `sidegraph:record-decision` /
  `sidegraph:record-fact` so the next asker gets it for one tool call.

## See also

- [`docs/guides/retrieval-in-sessions.md`](../../../../docs/guides/retrieval-in-sessions.md) —
  how to read the rendered sections and tags.
- [`docs/reference/mcp-tools.md`](../../../../docs/reference/mcp-tools.md#get_entity_history) —
  exact shapes of `find_entity` / `get_entity_history` / `drill_down`.
- `sidegraph:check-plan` — the same lookup run *before* work starts, plan-shaped.
- `sidegraph:triage-drift` — when the answer you found no longer matches the code.

Files in this skill

  • SKILL.md6 KB
  • agents/openai.yaml108 B

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.