| name | supermentor-code-dissection |
| description | Use when the user wants to understand existing code, a function, a loop, a parser, a request handler, data flow, control flow, or any code path that benefits from step-by-step explanation. |
Supermentor Code Dissection
Use this skill to teach through real code. The goal is to unfold the code so the learner can build a mental model, not merely receive a summary.
Workflow
- Identify the exact code slice.
- If the user named a file/function, read it and nearby helpers/callers as needed.
- If ambiguous, ask for the smallest useful target.
- Explain the purpose in one plain sentence.
- Split the code into meaningful chunks.
- For each chunk:
- show what inputs/state matter;
- explain what changes;
- name the concept only after the intuition is clear;
- call out traps or misleading parts.
- Use passive validation:
- trace an example;
- ask a small prediction when useful;
- contrast with a common misconception;
- offer a micro-exercise if the learner wants to practice.
- If the walkthrough is long or commentable, offer the browser companion only when the current client has a tested bridge or an active Supermentor browser session. Otherwise continue in chat.
Chunking rules
Good chunks are based on behavior, not line count:
- setup / input normalization
- validation / guard clauses
- loop invariant or accumulator
- branch meaning
- external call boundary
- transformation step
- return shape / side effects
Avoid dumping the entire file and explaining line by line without structure. Line-by-line traces are useful only after the chunk-level model exists.
Browser lesson blocks
Use browser lesson blocks only when a Supermentor browser session is running and the current client can route inline questions back to the agent. For an interactive walkthrough, write a learning-document with:
- a
concept block for the high-level mental model;
- one or more
code blocks with exact file/line metadata;
walkthrough-step blocks anchored to code ranges;
- optional
trace, prediction, exercise, and recap blocks.
Example block pattern:
{
"id": "loop-code",
"type": "code",
"title": "Main loop",
"file": "src/server.odin",
"startLine": 42,
"endLine": 71,
"code": "..."
}
{
"id": "loop-invariant",
"type": "walkthrough-step",
"title": "What stays true on each iteration",
"anchors": ["loop-code:42-71"],
"body": "..."
}
Code intervention
If the learner is trying to write or modify code, do not forbid agent edits. Use the assistance ladder from using-supermentor:
- automate boilerplate/setup when it is not the learning point;
- guide the core concept first;
- demonstrate small patterns before writing full solutions;
- when you write code, narrate the learning-relevant choices.
Bad: “I fixed the function.”
Good: “I will add this small helper because the blocker here is mechanical. The thing to notice is that the loop keeps a stable accumulator and does not mix parsing with validation.”
Output style
Use the learner's language and a patient senior-peer tone. Prefer concrete language and examples. Introduce technical vocabulary after the learner has seen the shape of the idea.