Agent skill · software engineering · abhigyanpatwari

gitnexus-pdg-query

Use when querying or extending GitNexus's PDG control/data-dependence surface (the `pdg_query` MCP tool, CDG/REACHING_DEF edges), or reasoning about \"what controls X\" / \"where does Y flow\" / guard clauses. Examples: \"what guards this statement?\", \"trace this variable within the function\", \"why is the pdg_query result empty?\", \"add a CDG query\".

Why this skill is useful

Adds specialized knowledge for using the `pdg_query` MCP tool, including executable queries and debugging techniques that are not widely documented.

What it needs

About 3k tokens when loaded. Last updated 2026-08-06. 45,147 stars on the source repository.

What this skill does

PDG query surface with GitNexus Expert knowledge for the pdgquery MCP tool and the control/data-dependence edges it reads — the opt-in --pdg program-dependence layers. Read this before touching gitnexus/src/mcp/local/local-backend.ts (pdgQueryImpl) or the pdgquery tool def, or when explaining a pdgquery result. When to Use "Under what condition does this statement run?" (guarding predicates). "Where does this variable flow inside the function?" (def→use). Guard-clause discovery (early-return guards — subsumes the #559 heuristic). Extending or reviewing pdgquery / the CDG / REACHINGDEF read path. Debugging an empty or surprising pdgquery result. The layered substrate (build order) pdgquery runs on the same graph taint runs on. Each layer is opt-in behind --pdg; a default analyze run records none of them (byte-identical). All three are BasicBlock → BasicBlock edges in the single CodeRelation table (keyed by the type property). There is no Function → BasicBlock edge. The two modes pdgquery({ mode: 'controls', target }) — CDG. For the anchored function, each edge: controlling predicate block → dependent block + branch sense in reason ('T' = predicate's true/taken arm, 'F' = false/fall-through). An edge into an early-return/throw block is flagged guard: true. pdgquery({ mode: 'flows', target, variable? }) — REACHINGDEF def→use edges; variable filters to one binding. target is required — a file path or a symbol/function name (resolved like context()). There is no anchorless mode (see below). The corrected guard-clause Cypher The RFC #567 §2 form ([:CDG {label:'F'}]) does not run as written. Edges are values of the single CodeRelation table's type property, and the branch sense is in reason, NOT a label column: r.reason is the sense the predicate took to reach the early exit. For if (!ok) return; the return rides the predicate's true arm ('T') and the protected body rides the false arm ('F') — polarity depends on the guard, so don't hard-code one sense. …

How to use it

Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:

@skills abhigyanpatwari/gitnexus-pdg-query--ae24c3

View the source on GitHub

Browse the @skills marketplace