allthingsida/idasql-skills/decompiler
Claude Code and agent skill by allthingsida/idasql-skills
- community
Checking that the SKILL.md file is still in the repository.
Decompile and analyze IDA functions. Use when asked for pseudocode, ctree AST analysis, local variables, labels, split expressions, or decompiler-driven cleanup.
Install
npx vskill@latest install allthingsida/idasql-skills/decompilerSKILL.md
Links: when an answer names functions, addresses, strings or types, make them clickable on IDA 9.4 builds:[name](uri)from thedeep_linkstable, outside code blocks (skilldeep-links).
Trigger Intents
Use this skill when user asks for:
- "decompile this function"
- pseudocode understanding or AST-level analysis
- local variable semantics in decompiled form
- decompiler-centric pattern mining (returns/calls/conditions)
- "split expression": a merged
*(_QWORD *)&x = 0x...LLstore printed field by field
Route to:
annotationsfor persistent comments/renames after interpretationtypesfor struct/enum/type construction and applicationdisassemblywhen decompiler is unavailable or insufficient
Do This First (Warm-Start Sequence)
Interpretation guidance:
decompile(addr)is primary display surface.pseudocode/ctree*are structured query/edit surfaces.
Global Constraint Reminder (Critical)
Always constrain decompiler tables by function:
Without this, decompiler tables may decompile every function and become extremely slow.
Failure and Recovery
- No Hex-Rays/decompiler tables unavailable:
- Fall back to
disassembly+xrefsworkflows. - Empty/partial rows:
- Confirm target
func_addrexists and refresh decompile cache (decompile(addr, 1)where supported). - Mutation did not appear:
- Run mandatory mutation loop (read -> edit -> refresh -> verify).
- A
decompiler_splitswrite failed: - "piece_size must be 1, 2, 4 or 8": give bytes, not IDA's internal size code.
- "is not the start of an instruction" / "is not in the function at": take
addrfrom the
merged assignment (ctree.addr of the cot_asg), and func_addr from funcs.
- "is already split":
UPDATE decompiler_splits SET piece_size = ...orDELETEit. - "unrecognised split state version" / "verified on IDA 9.0-9.4 only": this IDA stores split
data in a form idasql does not know; use the pseudocode window's Split expression instead.
- A split row exists but the pseudocode did not change: nothing at that
addrwas merged (or
it already prints in pieces that size); delete the row.
Handoff Patterns
decompiler->typesfor local type seeding and richer declarations.decompiler->annotationsfor persistent narrative and naming.decompiler->disassemblyfor opcode-level validation.
Decompiler Tables (Hex-Rays Required)
CRITICAL: Always filter by func_addr. Without constraint, these tables will decompile EVERY function - extremely slow!
func_addr is a function's entry address on every decompiler table: an address inside a function matches no row (as on the disassembly tables), and every row reports the entry. Rowids are stable per (function, item), so OR across functions and self-joins never drop or merge rows.
pseudocode
The pseudocode table is a structured line-by-line pseudocode with writable comments. Use `decompile(addr)` to view pseudocode; use this table only for surgical edits (comments) or structured queries.
| Column | Type | Writable | Description | |
|---|---|---|---|---|
func_addr | INT | No | Function address | |
line_num | INT | No | Line number | |
line | TEXT | No | Pseudocode text | |
addr | INT | No | Corresponding assembly address (from COLOR_ADDR anchor); NULL for a line with no address (signature, blank or comment-only line) | |
comment | TEXT | Yes | Decompiler comment at this addr | |
comment_placement | TEXT | Yes | Comment placement: semi (inline, default), block1 (above line) |
Filter behavior:
WHERE func_addr = X: best performance; iterates pseudocode for one function only.WHERE addr = X: decompiles only the containing function and returns matching lines for that EA (a line in a tail shared by several functions is listed under each owner).WHERE line_num = N: scans functions and returns rows at that line index; use only when you need cross-function line alignment.
Comment placements: semi (after ;), block1 (own line above), block2, curly1, curly2, brace1, brace2, colon, case, else, do, asm, try. An unrecognized placement string is silently coerced to semi.
True function comments are not part of pseudocode:
- use
UPDATE funcs SET comment = ... WHERE addr = ...for the regular function comment - use
UPDATE funcs SET rpt_comment = ... WHERE addr = ...for the repeatable function comment
pseudocode_orphan_comments
Persisted Hex-Rays comments that no longer attach to the current decompiled output of a live function. Use it to inspect or delete stale comments.
| Column | Type | Writable | Description | |
|---|---|---|---|---|
func_addr | INT | No | Function address | |
func_name | TEXT | No | Current function name for triage | |
addr | INT | No | Stored orphan comment EA | |
comment_placement | TEXT | No | Stored treeloc_t.itp placement | |
orphan_comment | TEXT | Delete-only | Stored orphan comment text |
Rules:
UPDATE ... SET orphan_comment = NULLor''deletes that orphan comment.- Any non-empty write is rejected.
pseudocode_v_orphan_comment_groups
Grouped, read-only orphan triage surface. One row per function with orphan comments.
Columns: func_addr, func_name, orphan_count, orphan_comments_json
Comment Anchor Resolution (Critical)
Use this recipe before writing heading-style decompiler notes.
Rules:
- Do not assume
addr == func_addr. - The first displayed pseudocode row (the signature) has
addrNULL and is not a write target. - One
addrcan map to multiple rows ({, statement,}); prefer a unique non-brace anchor. - For true function comments, update
funcs.comment/funcs.rpt_commentinstead ofpseudocode.
ctree
Full Abstract Syntax Tree of decompiled code.
| Column | Type | Description | |
|---|---|---|---|
func_addr | INT | Function address | |
item_id | INT | Unique node ID | |
is_expr | INT | 1=expression, 0=statement | |
op | INT | Raw numeric op code | |
op_name | TEXT | Node type (cot_call, cit_if, etc.) | |
addr | INT | Address in binary | |
parent_id | INT | Parent node ID | |
depth | INT | Tree depth | |
x_id, y_id, z_id | INT | Child node IDs | |
cond_id | INT | Condition child ID (if/while/for) | |
then_id | INT | Then-branch child ID (if) | |
else_id | INT | Else-branch child ID (if) | |
body_id | INT | Body child ID (loops) | |
init_id | INT | Init child ID (for) | |
step_id | INT | Step child ID (for) | |
var_idx | INT | Local variable index | |
obj_addr | INT | Target address | |
num_value | INT | Numeric literal | |
str_value | TEXT | String literal | |
helper_name | TEXT | Helper function name (cot_helper) | |
member_offset | INT | Member offset (cot_memptr/cot_memref) | |
var_name | TEXT | Variable name | |
var_is_stk | INT | 1=variable is a stack variable | |
var_is_reg | INT | 1=variable is a register variable | |
var_is_arg | INT | 1=variable is a function argument | |
obj_name | TEXT | Symbol name | |
label_num | INT | Label number when node defines a label | |
goto_label_num | INT | Target label number for cit_goto nodes |
ctree_lvars
Local variables from decompilation.
| Column | Type | Description | |
|---|---|---|---|
func_addr | INT | Function address | |
idx | INT | Variable index | |
name | TEXT | Variable name | |
type | TEXT | Type string | |
comment | TEXT | Local-variable comment shown next to declaration | |
size | INT | Size in bytes | |
is_arg | INT | 1=function argument | |
is_result | INT | 1=holds the function result | |
is_stk_var | INT | 1=stack variable | |
is_reg_var | INT | 1=register variable | |
stkoff | INT | Stack offset | |
mreg | INT | Microcode register number (register variables) |
Mutation guidance:
- Prefer
idx-based updates for deterministic writes. typeaccepts scalars, pointers, and array types — e.g.SET type = 'WCHAR[6]'or'_BYTE[392]'for wide stack strings / fixed buffers (the type must fit the local's stack slot).commentupdates map to Hex-Rays local-variable comments (lv.cmt) and appear indecompile(...)output.- A
typeUPDATE is read back: when Hex-Rays keeps the old type the UPDATE fails ("Hex-Rays kept ...") and nothing is left changed. The result variable (is_result = 1, often unnamed) usually follows the function prototype that way, so change the return type withUPDATE funcs SET prototype = .... Itscommentis writable. - A rename can re-order the function's locals (IDA 9.2 does this for register arguments), so the next edit should re-select its
idx(or address the variable bymreg/stkoff) rather than reuse anidxread before the rename.
ctree_labels
Decompiler control-flow labels. Supports UPDATE (name) and mirrors label facilities on cfunc_t.
| Column | Type | RW | Description | |
|---|---|---|---|---|
func_addr | INT | R | Function address | |
label_num | INT | R | Label number (LABEL_<n>) | |
name | TEXT | RW | Current label name | |
item_id | INT | R | Backing ctree item id for this label | |
item_addr | INT | R | Address of label-bearing ctree item (NULL when the item has none) | |
is_user_defined | INT | R | 1 if name differs from default LABEL_<n> |
decompiler_splits
Hex-Rays "Split expression" without a pseudocode window (the window's Split/Unsplit expression; vdui_t::split_item in hexrays.hpp). A row keeps the decompiler from merging narrower operations into one wider one at addr, so a struct initialised by one 8-byte store prints field by field.
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingplugins/idasql/skills/decompiler/SKILL.md
Popularity
- Repository stars
- 12
- Repository forks
- 4
- 7-day trend score
- 13
Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 22 Mar 2026, 7 months ago.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/allthingsida/idasql-skills/decompiler)