NotesStable
[SKILL] - explain-reasoning
Runs AFTER a task/fix has been done. Retrospectively unpacks the engineering thought process behind the change - which clue, which chain of reasoning, which principle, how it would have been found without AI, how the user can catch it on their own next time. Use when the user says 'why did you do it this way', 'explain your chain of reasoning', 'how would I have found this', 'mentor me', 'reasoning', or when /explain-reasoning is invoked.
- Published
Explain Reasoning
Retrospectively explains, with evidence, the engineering decisions behind a completed piece of work. The goal is to teach not just what changed, but the clue that made the problem visible, the possibilities that were ruled out, and how to reach the same result next time without AI.
Use Cases
- When you want to answer “why did you choose this solution?” after a fix or feature
- When you want to narrate the debugging process for mentorship purposes, with real files and commands
- When you want to make the evidence behind decisions visible after a code review or PR
- When you want to record the concrete investigation path to follow when a similar problem recurs
What Gets Produced?
- A short explanation summarizing the problem the change solved
- The chain of reasoning made up of the concrete clue that triggered the decision and the hypotheses that were confirmed/ruled out
- The engineering principle applied, and its counterpart in this specific case
- An actionable investigation guide with files, commands, and decision points that can be followed without AI
- Observable signals and durable defense suggestions to help catch the same problem class earlier next time
---
name: explain-reasoning
description: Runs AFTER a task/fix has been done. Retrospectively unpacks the engineering thought process behind the change - which clue, which chain of reasoning, which principle, how it would have been found without AI, how the user can catch it on their own next time. Use when the user says "why did you do it this way", "explain your chain of reasoning", "how would I have found this", "mentor me", "reasoning", or when /explain-reasoning is invoked.
---
# Explain Reasoning — Engineering Mentorship Mode
This skill is a **retrospective diagnosis** of work just completed. The goal is to turn the
user from a consumer of the change that was made into an engineer who can solve a similar
problem next time without AI.
## Determining scope
The work to be analyzed = the change(s) just made in this conversation. If the conversation
context is insufficient, or the user gave a different target (`/explain-reasoning <target>`),
first derive the scope using:
- `git diff` / `git diff --staged` / `git log -1 -p` to read what actually changed
- Reading the code around the changed files to understand the decision points
If the scope is genuinely ambiguous, ask a single clarifying question, then proceed.
## Absolute rules
1. **No fabrication.** Only narrate the thought process that actually happened. If a step was
guesswork or luck, write "that was intuition" or "I looked in the wrong place first."
A clean but fake narrative undermines the user's learning.
2. **Wrong paths are included.** Hypotheses tried and ruled out are half the teaching value.
If there truly were no wrong paths, say so too — "the problem was clear on the first read, because...".
3. **Be concrete.** No talk of general principles; use file:line, real symbol names, real commands.
Use the `file_path:line` format (clickable in the terminal).
4. **Verifiability.** Not "I thought this," but "this line in this file led me to this."
Every claimed clue must be demonstrable in the code.
5. **No writing code.** This skill produces analysis, not changes. Don't edit any file
unless the user separately asks.
6. **Honest self-criticism.** If the solution applied is weak, temporary, or debatable, say so
plainly. The user is running this skill so as not to accept it blindly — show them where
they should be suspicious.
## Output format
Produce the following 6 headings in this order, exactly as titled. Write in Turkish per the
project's default, but for this content produce it in the language requested; keep technical
terms and code identifiers in their original form.
---
### 1. What I did (single paragraph)
The essence of the change and the problem it solves. Keep it short — this section just sets the ground.
### 2. The clue that led me to this result
What was the first real signal? A line in a stack trace, a naming inconsistency, a test's
failure message, an asymmetry between two files? **Point to a single trigger** and show it
in the code. "I looked at everything" is not an allowed answer — you started somewhere,
say where.
### 3. Chain of reasoning
Numbered steps. In each step:
- **Hypothesis:** what I thought was happening
- **Test:** how I checked this (file I read, command I ran, output I looked at)
- **Result:** confirmed / ruled out → how I moved to the next step
Don't skip ruled-out hypotheses. Mark where the chain broke and you backtracked.
### 4. The engineering principle I used
What is the transferable principle that solved this problem? Name it and show **how it was
applied in this case**. Focus on a single principle, don't list many. Examples:
bisection / binary search narrowing, searching for an invariant violation, tracing data flow
end-to-end, contract checking at a layer boundary, "what changed last" delta analysis,
looking for the first wrong state rather than the symptom, diffing against similar working code.
If there's an applicable architectural rule in this project (CLAUDE.md, layer flow, module
boundaries), connect which one was violated/applied.
### 5. How you'd have found this without AI
The **concrete, executable** path the user could walk on their own:
- Actual commands to run (grep/rg pattern, `git log -S`, `git bisect`, log line, breakpoint location)
- The order of files to open and what to look for in each
- What output to look at and what to decide from it
This section should be a recipe; it should be actionable when read again. Don't write abstract advice.
### 6. Signal to catch this next time
What is the **early warning sign** of the same problem class? What should the user see and
get alarmed by next time? 2-4 items, each an observable symptom
("when you see this pattern," "when these two files don't change together").
Suggest a durable defense where possible: a lint rule, a test, an assert, a type
narrowing — a mechanism that catches the problem without a human looking again.
---
## Confidence note (mandatory closing)
Finally, a single line: which part of this analysis was verified by the code, and which
part is your interpretation. What the user should trust and what they should check themselves.