Explain Code Slice
Use this skill when the user wants one bounded walkthrough of how part of a system works from start to finish. The canonical term is slice.
Purpose
- Explain one slice end to end without dropping meaningful steps.
- When the user wants the slice recorded durably, preserve an existing repository-owned slice record or ask where it belongs.
- Start with the incoming data shape, what it represents, who sends it, and why it enters the flow.
- Walk the execution path in order, including boundaries, branch points, shared versus specialized steps, and data transformations.
- End with the final output shape, who receives it, and what purpose it serves.
- Let the user control explanation density with a detail level, not by silently skipping steps.
Canonical vocabulary
slice: one bounded end-to-end walkthrough of a request, event, feature action, job, or data item.
data shape: the meaningful structure of the data at a point in the slice, what it represents, and why it has that shape.
boundary: a meaningful crossing such as caller/callee, module, package, process, service, client/server, queue, storage, or external API.
branch point: any step that can route execution down different paths.
Treat pipeline, execution flow, request lifecycle, data flow, trace, and walkthrough as compatibility language for the same underlying workflow unless the user clearly means something else.
Inputs
- The slice subject:
- a feature
- a request or event
- a job or workflow
- a specific datum moving through code
- a code entrypoint or path to follow
- Optional detail level:
- Optional focus:
- branch-heavy
- data-shape-heavy
- boundary-heavy
- debugging-oriented
- Optional comparison target for
compare slices
Use standard when no detail level is specified.
Primary workflow: explain a slice
- Identify the slice trigger or entrypoint.
- Explain the incoming data first:
- what shape it has
- what it represents
- who is sending or constructing it
- why it is entering the slice
- Walk the slice in strict execution order from start to finish.
- For each meaningful step, explain:
- where it happens
- what responsibility it has
- whether it is shared or specialized
- whether it crosses a boundary
- whether it branches
- whether the data shape changes
- why any transformation exists
- End with the output or return path:
- final shape
- final destination
- why that result is consumed there
- Include a simple step diagram with markers for branch points and data-shape changes.
- Add short notes for those markers so the diagram stays readable.
Variant workflow: compare slices
Use this when the user wants to compare:
- two related slices
- two implementations of the same slice
- old versus new behavior
- two branches within one slice
First explain each slice clearly enough to stand on its own. Then compare:
- trigger differences
- data-shape differences
- execution-order differences
- boundary differences
- branch differences
- output differences
- why the two paths diverge
Treat comparison requests as first-class trigger cases, not as an advanced follow-up.
Codex subagent fit
When delegation is explicitly requested or authorized, follow agent-engineering-skills:orchestrate-agent-work. This skill is a good fit for code-slice-tracer, parallel code tracing, and bounded read-heavy discovery: mapping call sites, reading tests, checking docs, finding data-shape changes, or tracing one branch of a comparison, with each worker returning concise file references and findings.
Do not spawn subagents just because a slice is large. Keep the final explanation in the main thread so the user gets one coherent walkthrough, and keep any persistent-record write or refactor follow-up outside the tracer role unless the user asks for that next step.
Detail levels
quick: keep each step brief, but still include every meaningful step in order.
standard: default density for most walkthroughs.
thorough: add fuller commentary for branch behavior, boundaries, contracts, and why each transformation exists.
The detail level changes explanation density only. It must not remove meaningful steps from the slice.
Output contract
Return a structured narrative in this order:
Slice summary
Walkthrough
Diagram
Notes
The writing should stay conversational and narrative-first. Avoid sterile dumps, but do not skip steps for brevity.
Persistent Slice Records
Use this when the user asks to save, record, maintain, update, or add a slice to repository architecture docs.
- Explain the slice normally first.
- If the repository already owns a slice-record document, preserve its existing structure; otherwise ask where the user wants the record stored before creating a new documentation surface.
- Add or refresh one
## Slice: <Name> section.
- Include:
### Trigger
### Data Shapes
### Step Trace
### Boundaries
### Outputs
### Evidence
- Every recorded step must include a file path and symbol when known. Include line numbers when available.
- Do not record a slice that cannot be proven from code. Say what evidence is missing instead.
- Do not use Mermaid or generic graph diagrams as the persistent slice format.
Guardrails
- Never silently collapse or omit meaningful steps in the requested slice.
- Do not replace the end-to-end walkthrough with only a component map or only a high-level summary.
- If the path is ambiguous, say where the ambiguity starts and explain the most likely path plus the alternate branch.
- If a step cannot be proven from the code, say that plainly instead of guessing.
- Do not persist unproven slice claims into a repository-owned slice record.
- Prefer concrete file/function references when available.
- Keep branch and data-shape notes short and move clutter out of the main narrative when a marker note will do.
Validation
- Validate the skill with
uv run --group dev python /Users/galew/.codex/skills/.system/skill-creator/scripts/quick_validate.py skills/explain-code-slice.
- Keep
agents/openai.yaml aligned with the final trigger wording in this skill.
- Use
references/trigger-eval.md to audit whether the description is broad enough to catch natural phrasing and comparison requests.
References
- Output contract:
references/output-contract.md
- Detail levels:
references/detail-levels.md
- Diagram rules:
references/diagram-format.md
- Comparison workflow:
references/comparison-workflow.md
- Example prompts:
references/example-prompts.md
- Trigger evaluation prompts:
references/trigger-eval.md
1---2name: explain-code-slice3description: Use this skill when the user wants a code path, flow, pipeline, request lifecycle, trace, walkthrough, or part of a system explained step by step from start to finish. Explain where data comes from, what shape it has, who sends it, why it enters the flow, what calls what next, where branches and boundaries happen, how data transforms, and what comes out at the end. Also use this when the user asks things like “walk me through this,” “follow this through the code,” “show me the path,” “what calls this,” “where does this data come from,” “where does it go next,” “why is this shaped like this,” “how does this part work,” or when they want two flows compared.4---56# Explain Code Slice78Use this skill when the user wants one bounded walkthrough of how part of a system works from start to finish. The canonical term is `slice`.910## Purpose1112- Explain one slice end to end without dropping meaningful steps.13- When the user wants the slice recorded durably, preserve an existing repository-owned slice record or ask where it belongs.14- Start with the incoming data shape, what it represents, who sends it, and why it enters the flow.15- Walk the execution path in order, including boundaries, branch points, shared versus specialized steps, and data transformations.16- End with the final output shape, who receives it, and what purpose it serves.17- Let the user control explanation density with a detail level, not by silently skipping steps.1819## Canonical vocabulary2021- `slice`: one bounded end-to-end walkthrough of a request, event, feature action, job, or data item.22- `data shape`: the meaningful structure of the data at a point in the slice, what it represents, and why it has that shape.23- `boundary`: a meaningful crossing such as caller/callee, module, package, process, service, client/server, queue, storage, or external API.24- `branch point`: any step that can route execution down different paths.2526Treat `pipeline`, `execution flow`, `request lifecycle`, `data flow`, `trace`, and `walkthrough` as compatibility language for the same underlying workflow unless the user clearly means something else.2728## Inputs2930- The slice subject:31 - a feature32 - a request or event33 - a job or workflow34 - a specific datum moving through code35 - a code entrypoint or path to follow36- Optional detail level:37 - `quick`38 - `standard`39 - `thorough`40- Optional focus:41 - branch-heavy42 - data-shape-heavy43 - boundary-heavy44 - debugging-oriented45- Optional comparison target for `compare slices`4647Use `standard` when no detail level is specified.4849## Primary workflow: explain a slice50511. Identify the slice trigger or entrypoint.522. Explain the incoming data first:53 - what shape it has54 - what it represents55 - who is sending or constructing it56 - why it is entering the slice573. Walk the slice in strict execution order from start to finish.584. For each meaningful step, explain:59 - where it happens60 - what responsibility it has61 - whether it is shared or specialized62 - whether it crosses a boundary63 - whether it branches64 - whether the data shape changes65 - why any transformation exists665. End with the output or return path:67 - final shape68 - final destination69 - why that result is consumed there706. Include a simple step diagram with markers for branch points and data-shape changes.717. Add short notes for those markers so the diagram stays readable.7273## Variant workflow: compare slices7475Use this when the user wants to compare:7677- two related slices78- two implementations of the same slice79- old versus new behavior80- two branches within one slice8182First explain each slice clearly enough to stand on its own. Then compare:8384- trigger differences85- data-shape differences86- execution-order differences87- boundary differences88- branch differences89- output differences90- why the two paths diverge9192Treat comparison requests as first-class trigger cases, not as an advanced follow-up.9394## Codex subagent fit9596When delegation is explicitly requested or authorized, follow `agent-engineering-skills:orchestrate-agent-work`. This skill is a good fit for `code-slice-tracer`, parallel code tracing, and bounded read-heavy discovery: mapping call sites, reading tests, checking docs, finding data-shape changes, or tracing one branch of a comparison, with each worker returning concise file references and findings.9798Do not spawn subagents just because a slice is large. Keep the final explanation in the main thread so the user gets one coherent walkthrough, and keep any persistent-record write or refactor follow-up outside the tracer role unless the user asks for that next step.99100## Detail levels101102- `quick`: keep each step brief, but still include every meaningful step in order.103- `standard`: default density for most walkthroughs.104- `thorough`: add fuller commentary for branch behavior, boundaries, contracts, and why each transformation exists.105106The detail level changes explanation density only. It must not remove meaningful steps from the slice.107108## Output contract109110Return a structured narrative in this order:1111121. `Slice summary`1132. `Walkthrough`1143. `Diagram`1154. `Notes`116117The writing should stay conversational and narrative-first. Avoid sterile dumps, but do not skip steps for brevity.118119## Persistent Slice Records120121Use this when the user asks to save, record, maintain, update, or add a slice to repository architecture docs.1221231. Explain the slice normally first.1242. If the repository already owns a slice-record document, preserve its existing structure; otherwise ask where the user wants the record stored before creating a new documentation surface.1253. Add or refresh one `## Slice: <Name>` section.1264. Include:127 - `### Trigger`128 - `### Data Shapes`129 - `### Step Trace`130 - `### Boundaries`131 - `### Outputs`132 - `### Evidence`1335. Every recorded step must include a file path and symbol when known. Include line numbers when available.1346. Do not record a slice that cannot be proven from code. Say what evidence is missing instead.1357. Do not use Mermaid or generic graph diagrams as the persistent slice format.136137## Guardrails138139- Never silently collapse or omit meaningful steps in the requested slice.140- Do not replace the end-to-end walkthrough with only a component map or only a high-level summary.141- If the path is ambiguous, say where the ambiguity starts and explain the most likely path plus the alternate branch.142- If a step cannot be proven from the code, say that plainly instead of guessing.143- Do not persist unproven slice claims into a repository-owned slice record.144- Prefer concrete file/function references when available.145- Keep branch and data-shape notes short and move clutter out of the main narrative when a marker note will do.146147## Validation148149- Validate the skill with `uv run --group dev python /Users/galew/.codex/skills/.system/skill-creator/scripts/quick_validate.py skills/explain-code-slice`.150- Keep `agents/openai.yaml` aligned with the final trigger wording in this skill.151- Use `references/trigger-eval.md` to audit whether the description is broad enough to catch natural phrasing and comparison requests.152153## References154155- Output contract: `references/output-contract.md`156- Detail levels: `references/detail-levels.md`157- Diagram rules: `references/diagram-format.md`158- Comparison workflow: `references/comparison-workflow.md`159- Example prompts: `references/example-prompts.md`160- Trigger evaluation prompts: `references/trigger-eval.md`