gograph_coupling
Quantify package coupling by reporting fan-in, fan-out, and instability ratio. Identify overly coupled packages and assess architectural isolation.
Instructions
Report fan-in (Ca), fan-out (Ce), and instability ratio (I = Ce/(Ca+Ce)) per package. Instability range [0,1]: 0 = maximally stable, 1 = maximally unstable. Requires .gograph/graph.json — run gograph build . first. Read-only; no side effects. package filters by name substring; include_stdlib adds stdlib (default false); internal_only restricts to this module's packages only. WHEN TO USE: When evaluating package isolation, planning architectural layering, or identifying packages that are too tightly coupled. NOT TO USE: For single-function complexity (use gograph_complexity or gograph_hotspot); for reverse package dependency lookup (use gograph_dependents). RETURNS: Array of package coupling records with Ca, Ce, and instability score; empty when no packages match the filter.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| include_stdlib | No | Include standard-library packages in the report. Default false — users asking 'how coupled is my code?' rarely care about stdlib coupling. | |
| internal_only | No | Restrict the report to the project's own packages (anything starting with the module path from go.mod). Strictly stronger than excluding stdlib — also excludes third-party deps. | |
| package | No | Optional package name substring to filter results |