| name | call-graph |
| description | Use this skill to build a call-dependency graph from source files, grouped by declarations (file/interface/class/object) with visibility-aware styling and a legend |
Call Graph Skill
Generate a function call dependency graph as Graphviz .dot for one or more source files.
When to use
- User asks for call dependencies, call paths, or function relationship visualization.
- User wants to understand call chains
- User wants architecture visibility by declaration scope (file/interface/class/object).
- User wants overload-aware and visibility-aware diagrams.
Output contract
- Output is a valid Graphviz
digraph.
- Every declared function gets its own node.
- Every overload gets a separate node (distinguish by full signature).
- Local/nested functions get their own nodes (qualified by parent function when useful).
- Constructor dependencies get their own container, with a node for each of their called functions
- Group containers should be declaration-based:
file <Name>
interface <Name>
class <Name> (or data class, inner class as applicable)
object <Name>
companion object
dependency <Name>
- Do not create an extra “top-level functions” box; top-level functions are implicitly in the file container.
- Visibility coloring is relative to the containing declaration:
- public/exposed member:
palegreen
- private/internal implementation:
mistyrose
- dependency functions:
lightgray
- Include a dedicated legend box with:
Edge conventions
- Solid edge: function
A directly calls function B.
- Dashed edge: declaration contract relation (e.g., interface method to implementation).
- Label legend arrows so readers can decode edge semantics quickly (but don't usually label call edges to avoid visual clutter).
Process
- Parse declarations in target file(s): interfaces, classes, objects, companion objects, top-level funcs, dependencies.
- Enumerate all function declarations, including overloads and local functions.
- Build nodes with full signatures to avoid overload ambiguity.
- Build edges from function bodies for intra-file direct calls.
- Add contract edges (interface -> implementation) when visible in scope.
- Organize nodes into nested clusters that mirror declaration nesting.
- Apply visibility coloring and add legend cluster.
- Sanity-check: no missing declarations, no merged overloads, no orphaned legend.
Naming and labeling rules
- Prefer concise but disambiguating signatures:
findExamsBy(key: EncounterKey)
findExamsBy(keys: List<EncounterKey>)
- Local functions can be parent-qualified:
checkExamsMatch::total(e: ByEncounter<Exam>)
- Avoid redundant wording like “nested” in labels when nesting is already visual.