/bnsql:typesfrom bnsql
Binary Ninja type system via SQL: writable structs, unions, enums, typedefs, and read-only function signatures; remember SELECT save().
Ships in bnsql. 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.
| Table | Description |
|---|---|
types | All defined types (structs, unions, enums, typedefs, function prototypes) |
type_members | Struct/union member fields |
type_enum_values | Enum member values |
func_signatures | Per-function parameter and return type info |
types_v_structs | Convenience view: structs only |
types_v_enums | Convenience view: enums only |
types, type_members, and type_enum_values are writable (INSERT/UPDATE/DELETE)
and follow the explicit-save model — call SELECT save(); to persist.
func_signatures is read-only (edit a function prototype via funcs.prototype).
Gate writes by checking the mutation.types.* / mutation.type_members.* /
mutation.type_enum_values.* keys in the capabilities table first.
Use PRAGMA table_xinfo(<table>) to confirm the live column shape before
authoring complex queries.
SELECT
SUM(is_struct) AS structs,
SUM(is_enum) AS enums,
SUM(is_typedef) AS typedefs,
SUM(is_func) AS func_protos
FROM types;
PRAGMA table_xinfo(type_members);
SELECT offset, member_name, member_type, size
FROM type_members
WHERE type_name = 'PACKET_HEADER'
ORDER BY offset;
SELECT value_name, value
FROM type_enum_values
WHERE type_name = 'IRP_MJ'
ORDER BY value;
SELECT arg_index, arg_name, arg_type
FROM func_signatures
WHERE func_addr = 0x401000
ORDER BY arg_index;
Create a struct — INSERT INTO types makes an empty type by kind, then add its
fields with INSERT INTO type_members (columns type_name, member_name,
member_type, optional offset — omit offset to append):
INSERT INTO types(name, kind) VALUES ('MY_HEADER', 'struct');
INSERT INTO type_members(type_name, member_name, member_type)
VALUES
('MY_HEADER', 'magic', 'uint32_t'),
('MY_HEADER', 'length', 'uint32_t'),
('MY_HEADER', 'data', 'char[1]');
SELECT save();
Create an enum (type_enum_values columns are type_name, value_name, value;
omit value to auto-assign previous+1):
INSERT INTO types(name, kind) VALUES ('ERROR_CODE', 'enum');
INSERT INTO type_enum_values(type_name, value_name, value) VALUES
('ERROR_CODE', 'SUCCESS', 0),
('ERROR_CODE', 'INVALID', 1),
('ERROR_CODE', 'NOT_FOUND', 2);
SELECT save();
Rename or retype in place, or drop a member/type:
UPDATE types SET name = 'PACKET_HEADER' WHERE name = 'MY_HEADER';
UPDATE type_members SET member_type = 'uint64_t' WHERE type_name = 'PACKET_HEADER' AND member_name = 'magic';
UPDATE type_members SET member_name = 'len' WHERE type_name = 'PACKET_HEADER' AND member_name = 'length';
DELETE FROM type_members WHERE type_name = 'PACKET_HEADER' AND member_name = 'data';
DELETE FROM types WHERE name = 'ERROR_CODE';
SELECT save();
Retyping to a WIDER type overlaps the following members and Binary Ninja drops
the overlapped ones (native engine semantics, identical to the GUI): widening a
uint32_t at offset 0 to uint64_t consumes the member at offset 4. Re-add
consumed members afterwards (with explicit offset) if they should survive.
UPDATE hlil_vars
SET type = 'MY_HEADER *'
WHERE func_addr = 0x401000 AND name = 'packet';
SELECT save();
-- Functions whose first parameter is a specific struct
SELECT func_addr, hex(func_addr) AS addr
FROM func_signatures
WHERE arg_index = 0
AND arg_type LIKE '%PIRP%';
annotations for applying types to variables and renamingdecompiler for inspecting variables before retypingWhat SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
11 skills in this plugin
/analysisBNSQL analysis workflows: triage, security audit, crypto/network detection, multi-table queries./annotationsEdit Binary Ninja databases: comments, renames, types, patches. Mutations require SELECT save() to persist (explicit-save model, v0.0.9+)./connectConnect to Binary Ninja databases and bootstrap sessions. Use when starting analysis, routing to other skills, or setting up CLI/HTTP/MCP connections./dataQuery Binary Ninja strings, bytes, and binary patterns. Use the byte_search table for fast byte-pattern search./decompilerDecompile Binary Ninja functions via HLIL: pseudocode text, local variables, call sites. Always filter by func_addr./disassemblyQuery Binary Ninja disassembly: functions, segments, instructions, blocks. Use for code-level analysis and instruction inspection.npx claudepluginhub 0xeb/bnsql-skills --plugin bnsql