/r2sql:xrefsfrom r2sql
Analyze radare2 cross-references via r2sql — callers, callees, data references, jump targets. Use when asked who calls a function, what a function calls, or what code touches a string/import.
Ships in r2sql. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Pick this skill when the question involves edges in the code graph:
For inspecting a function's own code, use disassembly. For finding
string/import name patterns, use data.
| table | source | columns |
|---|---|---|
xrefs | per-func afxj @ <fn> | from_addr, to_addr, type, from_func |
Unfiltered scans walk aflj and issue afxj @ <fn> per function (the
global axj only reports refs at the current seek, so it returns nothing
on a fresh session). Point lookups push down: WHERE to_addr = X issues
axtj @ X, and WHERE from_addr = X issues axfj @ X. type values
include: CALL, CODE (jump), DATA (read/write), STRING.
from_func is the owning function name when radare2 reports it.
-- callers of a function
SELECT from_addr, from_func, type
FROM xrefs WHERE to_addr = 0x401000;
-- everything a function calls (CALL edges out of it)
SELECT DISTINCT x.to_addr, f.name AS callee
FROM xrefs x
LEFT JOIN funcs f ON f.addr = x.to_addr
WHERE x.from_addr IN (
SELECT addr FROM instructions WHERE func_addr = 0x401000
)
AND x.type = 'CALL';
-- callers of every CryptDecrypt-ish import
SELECT DISTINCT x.from_func, i.name AS import
FROM imports i
JOIN xrefs x ON x.to_addr = i.addr
WHERE i.name LIKE 'Crypt%';
-- code that references a known string
WITH s AS (SELECT addr FROM strings WHERE text = 'license check failed')
SELECT x.from_addr, x.from_func, x.type
FROM xrefs x JOIN s ON x.to_addr = s.addr;
-- "who reaches X" — 2-hop reverse call graph
WITH direct AS (
SELECT DISTINCT from_func FROM xrefs
WHERE to_addr = 0x401000 AND type = 'CALL'
)
SELECT DISTINCT x.from_func AS caller_of_caller
FROM xrefs x JOIN funcs f ON f.addr = x.to_addr
JOIN direct d ON d.from_func = f.name
WHERE x.type = 'CALL';
xrefs.to_addr ⨝ funcs.addr resolves CALL targets to function
rows (name, size, complexity).xrefs.to_addr ⨝ imports.addr resolves IAT references to import
names.xrefs.to_addr ⨝ strings.addr finds the string for a DATA ref.Prefer to_addr = ... and from_addr = ... predicates for interactive
drilling; they use scoped radare2 commands instead of enumerating every
function. Unfiltered scans still enumerate afxj across every function
once per query. For repeated broad analysis, cache the result into a temp
table:
CREATE TEMP TABLE callers_of_x AS
SELECT * FROM xrefs WHERE to_addr = 0x401000;
call qword [rip+...]) resolve through r2's emul
flag — sometimes the to_addr is the slot, not the resolved
target. Re-run aaaa (or aae for emulation) to harvest more.from_func is the function the refs were enumerated from; refs that
live outside any analyzed function aren't surfaced (the table only walks
aflj functions). Run aaaa to analyze more before querying.What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub 0xeb/r2sql-skills --plugin r2sql11 skills in this plugin
/analysisTriage and audit radare2 binaries via r2sql — find suspicious behavior, surface crypto/network/persistence APIs, hunt high-complexity functions, and run multi-table queries that combine code, data, and xrefs./annotationsEdit radare2 annotations — comments, flag/function names, local variables, bookmarks — via r2sql. Use when asked to add comments, rename functions/flags, rename or retype locals, or persist analysis state./connectConnect to radare2 sessions via r2sql and bootstrap analysis. Use when starting a new SQL session, routing to other skills, or setting up CLI/HTTP/MCP connections.Other plugins' skills for the same job