To maximize efficiency, reduce latency, and guarantee safety when modifying codebases, we recommend following these standardized workflows. These steps can be programmed into AI system instructions or executed manually.
Workflow 1: Onboarding to a New Repo
When opening an unfamiliar Go repository, use this workflow to get oriented in seconds:
- Verify Index Status:
If stale or missing, run
gograph stats gograph stalegograph build .. - Find High-Risk Hotspots:
Identifies the most heavily referenced functions in the codebase.
gograph hotspot --top 10 - Map Package Coupling:
Gives a high-level table showing package stability and dependencies.
gograph coupling - Inspect the Global API Surface:
Exposes every package signature with bodies stripped.
gograph skeleton
Workflow 2: Safe-Edit Symbol Lifecycle
Before changing the signature or behavior of any function, method, or struct, follow this cycle:
[ plan <sym> ] ──► [ context <sym> ] ──► [ Edit Code ] ──► [ build . --precise ] ──► [ review --uncommitted ]
- Plan first:
This automatically checks for callers, associated tests, and risk profiles (e.g. database transactions or env reads).
gograph plan <symbol> - Extract Symbol Context:
Bundles raw AST info, the exact source block of the target, and immediate dependencies in one call.
gograph context <symbol> - Perform the Edit: Modify the code as needed.
- Type-checked build:
Verifies compilation and computes type-checked interface implementers.
gograph build . --precise - Post-edit review:
Validates complexity drift, test coverage, and security risk introductions before making a commit.
gograph review --uncommitted
Workflow 3: Package-Level Refactoring
Before splitting, merging, or moving a Go package, execute this check:
- Discover all external consumers:
Finds every other package that imports your target. A package with high fan-in (low instability) is difficult to change without sweeping breaking changes.
gograph dependents <package> - Review public API contracts:
Ensure you know exactly what symbols are exported and consumed externally.
gograph public <package>