Agent skill

graph-blast-radius

[Code Intelligence] Analyze the blast radius of current code changes using the structural knowledge graph. Shows impacted files, functions, test coverage gaps, and risk level. Requires graph to be built first via /graph-build.

Stars 6
Forks 1

Install this agent skill to your Project

npx add-skill https://github.com/duc01226/EasyPlatform/tree/main/.claude/skills/graph-blast-radius

SKILL.md

Blast Radius

Analyze the structural impact of current code changes using the knowledge graph.

Prerequisites

  • Graph must be built first: run /graph-build if .code-graph/graph.db doesn't exist
  • Requires Python 3.10+ with tree-sitter, tree-sitter-language-pack, networkx

Steps

  1. Check graph exists — Verify .code-graph/graph.db exists. If not, suggest /graph-build.

  2. Run blast-radius analysis via Bash:

    bash
    python .claude/scripts/code_graph blast-radius --json
    
  3. Parse JSON output and present:

    • Changed files: List of modified files (auto-detected from git)
    • Changed nodes: Functions/classes directly modified
    • Impacted nodes: Functions/classes affected within 2 hops (callers, dependents, tests)
    • Impacted files: Additional files that may need attention
    • Truncation: If results were truncated, note total vs shown
  4. Risk assessment based on blast radius size:

    • Low risk: <5 impacted nodes, changes well-contained
    • Medium risk: 5-20 impacted nodes, review callers carefully
    • High risk: >20 impacted nodes, consider splitting PR
  5. Recommendations:

    • Flag untested changed functions
    • Suggest files to prioritize in review
    • Warn about inheritance/implementation relationship changes

Trace for Deep Impact Analysis

For impact beyond direct callers/importers, use the trace command to follow the full chain through implicit connections:

bash
python .claude/scripts/code_graph trace <changed-file> --direction downstream --depth 3 --json

# File-level overview first (10-30x less noise), then drill into functions:
python .claude/scripts/code_graph trace <changed-file> --direction downstream --node-mode file --json

This reveals downstream impact through MESSAGE_BUS edges (cross-service event consumers), TRIGGERS_EVENT (entity event handlers), and other implicit relationships that blast-radius may not surface directly.

Additional Queries

For deeper investigation, run via Bash:

  • python ... query callers_of <function> --json — who calls this function?
  • python ... query tests_for <function> --json — what tests cover this?
  • python ... query inheritors_of <class> --json — what inherits from this?
  • python ... query importers_of <file> --json — who imports this file?

Closing Reminders

  • MUST break work into small todo tasks using TaskCreate BEFORE starting
  • MUST search codebase for 3+ similar patterns before creating new code
  • MUST cite file:line evidence for every claim (confidence >80% to act)
  • MUST add a final review todo task to verify work quality

Expand your agent's capabilities with these related and highly-rated skills.

Didn't find tool you were looking for?

Be as detailed as possible for better results