explain-complex-codelisted
Install: claude install-skill broneq/bdk
# Explain Complex Code
> Relies on BDK foundation (STARTUP_INSTRUCTIONS.md) for project context and MCP tool preference.
Generate architecture docs for complex code with visual diagrams and examples.
## Workflow
### 1. Understand Scope
`path` arg specifies code to explain. Clarify:
- **Focus areas**: Architecture, algorithms, data flow, testing strategy
- **Audience level**: Team onboarding, external docs, debugging guide
### 2. Analyze Code Structure
**Step 2.1: Initial Discovery**
!`python3 ${CLAUDE_PLUGIN_ROOT}/scripts/inject.py --chain ${CLAUDE_PLUGIN_ROOT}/fragments/tool-tiers/explore.chain.json`
Using the exploration tools above: find all symbols, identify high-dependency symbols, use community grouping to determine subagent partitioning where available.
**Step 2.2: Map Dependencies**
For each key class/function: `query_graph(pattern="callers_of", node=<symbol>)` and `query_graph(pattern="callees_of", node=<symbol>)`. Fall back to Serena `find_referencing_symbols` if graph unavailable.
**Step 2.3: Decide Partitioning Strategy**
When graph communities are available, use community boundaries as partitioning units — one community per subagent. Otherwise fall back to file-count rules:
| Files Count | Strategy | Subagent Count |
|-------------|----------|----------------|
| 1-2 files | One subagent for entire module | 1 subagent |
| 3-5 files | Group into 1-2 logical blocks | 1-2 subagents |
| 6-10 files | Group into 2-3 logical blocks | 2-3 subagents |
| 10+ fi