gitnexus-pdg-query

Query control-dependence and reaching-definition edges through the GitNexus pdg_query MCP tool.

1|Updated Jul 27, 2023
One-click install
npx skills add https://github.com/AlexTheGuitarGuy/.dotfiles --skill gitnexus-pdg-query-alextheguitarguy
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: gitnexus-pdg-query
Source: https://github.com/AlexTheGuitarGuy/.dotfiles/tree/main/claude/.claude/skills/gitnexus-pdg-query
Command: npx skills add https://github.com/AlexTheGuitarGuy/.dotfiles --skill gitnexus-pdg-query-alextheguitarguy

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Understanding what controls a statement or where a variable flows inside a function requires reading GitNexus's opt-in PDG layers (CFG, REACHING_DEF, CDG), whose graph schema and anchoring rules are easy to get wrong. This Skill explains the pdg_query MCP tool's two modes, the corrected Cypher for guard-clause discovery, and the gotchas behind empty or surprising results. ## Core Features & Use Cases - Control-dependence queries: Use pdg_query({ mode: 'controls', target }) to find which predicate blocks guard a statement, including early-return guard clauses flagged with guard: true. - Data-flow queries: Use pdg_query({ mode: 'flows', target, variable? }) to trace def-to-use REACHING_DEF edges for a variable within a function. - Corrected Cypher guidance: Query the single CodeRelation table by its type property with branch sense in reason, since the RFC #567 [:CDG {label:'F'}] form does not run as written. - Use Case: When a pdg_query result comes back empty, check whether the repo was indexed with --pdg; the tool returns a note instead of an error when no PDG layer exists. ## Quick Start Ask the AI to explain what guards a specific statement or trace where a variable flows within a function using the pdg_query tool.

Frequently Asked Questions about gitnexus-pdg-query

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I find what controls a statement in GitNexus?▼

Call pdg_query with mode 'controls' and a required target (file path or symbol name). It returns CDG edges from controlling predicate blocks to dependent blocks, with the branch sense in the reason field and early-return blocks flagged as guards.

How to trace where a variable flows within a function?▼

Use pdg_query with mode 'flows', a target, and an optional variable filter. It reads REACHING_DEF def-to-use edges computed by the GEN/KILL solver, showing intra-procedural data dependence for that binding.

Why is my pdg_query result empty?▼

An empty result usually means the repository was not indexed with the --pdg flag, since all PDG layers are opt-in. The tool returns a note instead of an error, detected via a cheap probe on RepoMeta PDG edge limits.

Why does the RFC 567 CDG Cypher query not work?▼

The [:CDG {label:'F'}] form fails because edges live in a single CodeRelation table keyed by the type property, and branch sense is stored in reason, not a label column. Match on type 'CDG' and read r.reason for 'T' or 'F'.

Does pdg_query support cross-function data flow?▼

No, pdg_query is intra-procedural only and operates on per-function basic blocks. Cross-function flow is handled by the taint analysis domain through the explain tool instead.

Can pdg_query run without a target anchor?▼

No, target is required because LadybugDB has no relationship-property index, making unanchored CDG or REACHING_DEF path scans unbounded. Raw cypher callers must anchor on a file id-prefix or symbol span themselves.