Applies persistent annotations (names, comments, signatures, local-variable edits) to Ghidra databases via GhidraSQL. Useful for reverse engineering and binary analysis cleanup.
Ships in ghidrasql. 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.
Read when SKILL.md points to them.
Use this skill when the user asks to:
apply_type_* viewsRoute to:
decompiler to inspect locals and pseudocode before editingtypes when a mutation depends on declarations or type importsre-source when the campaign expands beyond a single functionfunc_addr, local_id, ordinal, addr).SELECT save_database(); as a periodic checkpoint.
GhidraSQL does not checkpoint automatically after writes; normal managed
shutdown saves once by default.curl -X POST http://127.0.0.1:8081/shutdown (managed mode applies the launch-time --shutdown save policy; proxy mode leaves the upstream host running).There is no SQL shutdown(...) function.
--no-analyze, and re-query the affected rows. If a successful
mutation or checkpoint reverted, preserve the project/logs and stop writing
until the persistence path is fixed; do not silently re-apply as routine.pseudocode/decomp_lvars/decomp_comments on the same host can deadlock on a fair ReentrantReadWriteLock. Serialise decompiler-backed work — do not run two parallel annotation pipelines against one host.| Table | UPDATE columns | INSERT | DELETE |
|---|---|---|---|
funcs | name, prototype | – | – |
names | name (not external) | yes | yes (not external) |
comments | comment, repeatable, source | yes | yes |
data_items | name, data_type | yes | yes |
bookmarks | type, category, comment | yes | yes |
decomp_lvars | name, type | – | – |
decomp_comments | comment, source | yes | yes |
function_params | param_name, param_type | – | – |
function_tags | comment | yes | yes |
function_tag_mappings | – | yes | yes |
signatures | name (function rows only), prototype | – | – |
breakpoints | enabled, type, size, condition, group | yes | yes |
bytes | value (single-byte patch) | – | – |
segments | start_addr (rebase/move block) | yes | yes |
memory_blocks | start_addr (rebase/move block) | yes | yes |
segments/memory_blocks are the writable memory map (#42): INSERT a region
(start_addr, end_addr [, name, perm]), UPDATE start_addr to rebase/move
it, DELETE to remove it. Both expose the same map — see the data skill.
Type tables (types, type_members, type_enums, type_enum_members, type_unions, type_aliases) support INSERT and DELETE; UPDATE is mostly limited to name (full per-table matrix in the types skill).
INSERT-only views: apply_type_data, apply_type_param, apply_type_local — INSTEAD OF INSERT triggers that wrap the underlying type write.
Direct type/name edits of implicit C++ this parameters convert the function
to custom variable storage and refetch the parameter before editing it. The
conversion and edit share one transaction; a failed edit rolls back both.
Review the storage consequences in the types skill and verify the entire
signature afterward. Explicit-parameter edits retain dynamic storage.
Function rename and signature:
UPDATE funcs
SET name = 'parseConfig',
prototype = 'bool parseConfig(const char *path, void *out)'
WHERE addr = 0x4011F0;
Type qualifiers (const, volatile, __restrict) are accepted and dropped, as Ghidra's C parser drops them: Ghidra data types carry no qualifiers, so the prototype above reads back as bool parseConfig(char * path, void * out). A bare restrict is a parse error. Replace void * with the recovered output type after importing its declaration.
Parameter rename or type:
UPDATE function_params
SET param_name = 'path',
param_type = 'const char *'
WHERE func_addr = 0x4011F0 AND ordinal = 0;
Decompiler local rename or type — prefer the SQL helpers (direct RPC, no re-decompilation between statements):
SELECT rename_local(0x4011F0, '<local_id>', 'configFile');
SELECT set_local_type(0x4011F0, '<local_id>', 'FILE *');
Alternative via UPDATE (works for the name; type rewrites can fail on array locals — see Gotchas):
UPDATE decomp_lvars
SET name = 'configFile'
WHERE func_addr = 0x4011F0 AND local_id = '<local_id>';
Apply a type via the dedicated view (compositional — works even when the agent only knows the type name):
INSERT INTO apply_type_data (addr, type_name) VALUES (0x404000, 'IMAGE_DOS_HEADER');
INSERT INTO apply_type_param (func_addr, ordinal, type_name) VALUES (0x4011F0, 0, 'const char *');
INSERT INTO apply_type_local (func_addr, local_id, type_name) VALUES (0x4011F0, '<local_id>', 'FILE *');
Comment insertion (the source column controls the comment kind: 'plate', 'pre', 'post', 'eol', 'repeatable'):
INSERT INTO comments (addr, comment, source)
VALUES (0x4011F0, 'Reads and parses the configuration file.', 'plate');
Decompiler-attached comments (anchored at decompiler tokens, not raw addresses):
INSERT INTO decomp_comments (func_addr, addr, comment, source)
VALUES (0x4011F0, 0x4012A0, 'fail path: invalid magic', 'pre');
Bookmark (defaults to type='Analysis' if not specified):
INSERT INTO bookmarks (addr, type, category, comment)
VALUES (0x4011F0, 'Note', 'review', 'check overflow handling');
Function tags (catalog first, then map):
INSERT INTO function_tags (name, comment) VALUES ('reviewed', 'manually reviewed');
INSERT INTO function_tag_mappings (func_addr, tag_name) VALUES (0x4011F0, 'reviewed');
Tag deletion cascades through both tables: DELETE FROM function_tags WHERE name = 'reviewed'; removes every mapping.
INSERT INTO names adds a label. It never renames: the address keeps its symbols, and the new label is primary only when the address had none. The same name already at that address fails with duplicate_name. Ghidra's one exception: on a function that still has its default FUN_... name, the label becomes the function's name. To rename an existing symbol, UPDATE names.rename_local() errors carry their code. A failed rename_local() is a SQL error reading rename_local: RenameFunctionLocal failed [<code>]: <reason> (not_found for an unknown local_id), not a 0.names renames name one symbol. UPDATE names SET name = ... renames exactly the row's symbol (its addr and current name), so a secondary label (is_primary = 0) is renamed without touching the primary symbol at that address. An external symbol (is_external = 1) cannot be renamed or deleted through names; its addr is an offset in Ghidra's EXTERNAL space, not a memory address.signatures is read-mostly. Only name and prototype are writable — UPDATE signatures SET name = ... renames the owning function (function rows only; rejected for other owners), equivalent to UPDATE funcs SET name = .... To change the calling convention, write a full prototype string into either funcs.prototype or signatures.prototype.__cdecl in a prototype string can fail to parse. If UPDATE funcs SET prototype = ... fails with [parse_error] on a prototype that carries a calling-convention prefix, drop the prefix and retry — the signature without __cdecl typically applies cleanly.UPDATE decomp_lvars SET name = ... works. The writable-type resolver handles array declarators, so re-applying an array type (e.g. wchar_t[128]) while the rename commits no longer fails with "unable to resolve writable data type". SELECT rename_local(0x4011F0, '<local_id>', 'configFile'); remains available as a direct, type-agnostic RPC alternative.parse_decls(). Direct type writes resolve names such as uint8_t and uint32_t on demand, but the C parser requires those typedefs to exist in the program or in the input text. Declare the intended widths before using them and verify the resulting member types and sizes.-f scripts and multi-statement REPL input. No cache invalidation step is required after a write.<type> *fn(...) as a name *fn rather than a return type. Use <type>* fn(...) form when authoring prototypes — char* foo, void** bar, int* baz. Same trap applies to multi-statement parameter lists. Verify the apply landed by re-reading funcs.prototype or function_params.apply_type_local (or a direct UPDATE on decomp_lvars) at one site can change unrelated variables. Mitigation: keep the recovered type on prototypes/parameters, back the local out to a neutral type (char *, int) at the questionable site, and verify each step in pseudocode before continuing.SELECT text FROM pseudocode WHERE func_addr = 0x4011F0;
SELECT local_id, name, type FROM decomp_lvars WHERE func_addr = 0x4011F0;
SELECT func_addr, local_id, name, type FROM decomp_lvars WHERE func_name = 'main';
SELECT ordinal, param_name, param_type FROM function_params WHERE func_addr = 0x4011F0;
SELECT save_database(); -- optional explicit checkpoint
Name-scoped decomp_lvars reads are useful for discovery, but writes should still use the resolved func_addr plus the exact local_id returned by the read.
<statement> failed at <addr>: <Operation> failed [<code>]: <reason>. Act on the code: not_found — re-read the target table and use the exact addr / func_addr / local_id / ordinal / type_id it returns; unmapped_address — the address is outside every memory block (check segments); duplicate_name — pick another name; unknown_type — create or parse_decls() the named type first; parse_error — fix the prototype or declaration (nothing was applied); invalid_argument — the value or target kind is wrong for this write; not_loaded — open a program first; not_supported — the connected backend lacks this write.pseudocode, and verify you used the canonical local_id / ordinal / addr. Because rows never persist past a statement, continued stale output points to the underlying source/decompiler or an unapplied mutation—not a SQL cache.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
ghidra, annotations, reverse-engineering, binary-analysis, ghidrasql
12 skills in this plugin
/debuggerManage breakpoints and patch bytes through ghidrasql — the breakpoints table and bytes single-byte UPDATE./ghidrasql:annotationsfrom ghidrasql
npx claudepluginhub 0xeb/ghidrasql-skills --plugin ghidrasqlOther plugins' skills for the same job