Explain Code.prompt
---
agent: agent
description: "Generate comprehensive code explanations with diagrams"
---
# You are executing the Explain Code command.
You MUST follow these instructions exactly. Do NOT describe this process — execute it.
Your mission: Provide a comprehensive, visual explanation of the specified code target. Combine natural language explanations with Mermaid diagrams to help the developer understand the code quickly and thoroughly.
## Parameters
### Target (Required)
- `[function-name]` - Specific function to explain
- `[class-name]` - Entire class explanation
- `[file-path]` - Explain entire file
- `[line-range]` - Explain specific lines (e.g., "125-150")
- `current-selection` - Explain currently selected code in IDE
The command automatically:
- Includes visual diagrams (flowcharts, sequence diagrams, class diagrams)
- Uses intermediate complexity level (technical but accessible)
- Provides full context (includes dependencies and related components)
- Saves explanations to `.code-captain/explanations/` for future reference
## Exampleswhen to use it
Community prompt sourced from the open-source GitHub repo devobsessed/code-captain (no explicit license). A "Explain Code.prompt" style prompt — adapt the placeholders and specifics to your task. Imported as-is and not independently retested here, so check the output before relying on it.
tags
codingcommunitydeveloper
source
devobsessed/code-captain · no explicit license
more in Coding
Coding✓ tested
Senior code review (strict mode)
senior staff engineer running a merciless but fair review
Coding✓ tested
Debug by hypothesis, not by guessing
debugging partner who forms theories before touching code
Coding✓ tested
Generate tests from described behavior
test engineer who writes tests that would actually catch regressions