re-swift

re-swift is a skill for Claude Code from dslsdzc/rev-skills. It costs 62 tokens per session (3,047 once invoked), scanned A, original, Apache-2.0.

A guide to examining compiled Swift programs, including their symbols, protocol data, closures, and links to Objective-C code. It covers Swift binaries on macOS and Linux with tools such as swift-demangle.

In plain words
What is it for?
Use it to identify Swift parts of a binary, decode and rename Swift symbols, understand protocol and closure behaviour, and compare a binary with code compiled using a matching Swift toolchain.
Why use it?
Compiled Swift code often hides function names and program structure behind encoded symbols and generated data. This guide helps make those parts readable during reverse engineering.

Skill for Claude Code

Written for Claude Code: installed under .claude/. Also seen: positional $N argument.

Good fit Use it to identify Swift parts of a binary, decode and rename Swift symbols, understand protocol and closure behaviour, and compare a binary with code compiled using a matching Swift toolchain.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/dslsdzc/rev-skills/re-swift
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add dslsdzc/rev-skills --skill re-swift
Clone the repo
git clone --depth 1 https://github.com/dslsdzc/rev-skills

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for re-swift

README.md
[![agentmods](https://agentmods.dev/badge/skills/dslsdzc/rev-skills/re-swift/github.svg)](https://agentmods.dev/skills/dslsdzc/rev-skills/re-swift)
Your own site
<a href="https://agentmods.dev/skills/dslsdzc/rev-skills/re-swift"><img src="https://agentmods.dev/badge/skills/dslsdzc/rev-skills/re-swift/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for re-swift

Your own site · 80×15
<a href="https://agentmods.dev/skills/dslsdzc/rev-skills/re-swift"><img src="https://agentmods.dev/badge/skills/dslsdzc/rev-skills/re-swift.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 62 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,047 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00062 $0.03047
Opus 5 $0.00031 $0.01523
Sonnet 5 $0.00012 $0.00609
Haiku 4.5 $0.00006 $0.00305

Measured 9d ago against content hash 4502377ba137, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-12, from the pricing page.

Security

Grade A, and why

re-swift scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 9d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/skills/re-swift/SKILL.md · 119 lines

How it starts

The opening of the file, as written. The whole thing — 119 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Swift 逆向

何时使用 / 何时不用

  • 用:Swift 产物(Mach-O/ELF 含 Swift mangling 特征 $s 前缀,或 __swift5_* 反射段),需要还原符号/协议一致性/闭包结构
  • 用:混合产物中区分 Swift 层与 ObjC/C 层(先走 ObjC 路径再进 Swift 层)
  • 不用:纯 ObjC(走 [[re-ios]] / [[re-macos]] 的 ObjC 路径);纯 C/C++(走 [[re-cpp-abi]])
  • 不用:只需普通反编译([[re-ghidra]] / [[re-ida]] 直接上)

工具准备

swift-demangle(Swift 工具链,mangling 解码)

  • macOS: Xcode 自带(xcrun swift-demangle);Linux: Swift 官方工具链(swift.org 下载 tar 包解压即用,含 swift-demangle);Windows: Swift 官方工具链
  • 验证: echo '$s4main6myFuncyyF' | swift-demangle(macOS 用 xcrun swift-demangle;无参数时读 stdin,输出 $s... ---> main.myFunc() -> ()
  • 批量: llvm-nm sample | swift-demangle-simplified 出精简名;-expand 出解码树

swiftc / swift(可选,对照编译)

  • macOS: Xcode 自带;Linux/Windows: 同上官方工具链(含编译器,可本地编译同版本样本对照符号形态)
  • 验证: swift --version

llvm-nm / llvm-objdump(符号与段)

  • 安装与验证见 [[re-cpp-abi]] 工具准备;Mach-O 侧额外需要 otool(见 [[re-format-macho]] 工具准备)
  • 用途: llvm-nm -m sample 看符号与段归属;otool -l sample | grep swift5 定位反射段

Ghidra / IDA(反编译底座)

  • 安装与验证见 [[re-ghidra]] / [[re-ida]];Swift 符号解码结果用于批量重命名(Ghidra 可脚本化:demangle 输出写回 symbol 表,反编译视图即恢复可读函数名)

操作步骤

按顺序执行,每步产物存档(路径 + sha256,见 [[re-triage]])。

  1. 产物识别

    strings -a sample | grep -E '^\$s|^_T0|^_\$S' | head
    llvm-nm sample 2>/dev/null | grep -E 'swift_|^\$s' | head   # ELF 用 readelf -s 同效果
    otool -l sample 2>/dev/null | grep -c swift5               # Mach-O 反射段存在性
    
    • $s(Swift 5+)、$S(Swift 4.2)、_T0(Swift 4.0)是三代 mangling 前缀;swift_* 运行时导入(swift_retain / swift_release / swift_allocObject)确认运行时
    • 纯 ObjC 无上述特征 → 转 [[re-ios]] / [[re-macos]];带 __swift5_* 段但 strip 了符号名 → 仍是 Swift(反射元数据不随 strip 消失,见坑 5)
  2. mangling 解码(批量)

    llvm-nm -m sample | awk '$3 ~ /^\$s/ {print $3}' | swift-demangle | head -20
    # ELF: readelf -s sample | awk '$8 ~ /^\$s/ {print $8}' | swift-demangle
    

    解码内容:模块名/类型/函数签名/泛型参数展开;结果写入符号表供 [[re-ghidra]] / [[re-ida]] 重命名。mangling 结构速览见步骤 3 与 [[layout]]。

  3. mangling 结构速览(手读符号)

    $s 前缀 + 长度前缀标识符 + 类型字母 + 签名
    $s 13ExampleModule 3Foo C 3bar Si y F
       └模块(13字符)   └类型 └类 └方法 └结果 └参数 └函数
    C=类 O=枚举 V=结构体 P=协议;Si=Int SS=String Sq=Optional;y=空元组 ()
    

    编码规则:标识符=十进制长度+ASCII;签名顺序是结果类型在前、参数在后F 结尾表示函数;签名可带修饰位(async/throws,解码输出中显式出现);_To 后缀=@objc 桥接 thunk;TE 后缀=distributed thunk。详细规则与官方示例见 [[layout]]/[[examples]]。

Read the full file on GitHub · 119 lines

Files

What ships with it

2 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 9d ago First seen · 119 lines · 62 tokens per session scan A 4502377ba137

Subscribe to this mod's changes

re-swift is a skill published in the GitHub repository dslsdzc/rev-skills (54 stars, last pushed 14d ago), licensed Apache-2.0. It adds 62 tokens to every session and 3,047 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.

Related

Other skills, from other repositories

analyzing-golang-malware-with-ghidra

Reverse engineer Go-compiled malware in Ghidra by parsing Go buildinfo and pclntab structures, recovering stripped/obfuscated function names (e.g. via GoResolver), and extracting embedded module/dependency strings and types from Go binaries. Use when analyzing a Go-language malware sample, deobfuscating a…

Youngmaidainon/Agent-Level-Up · 95 tokens

analyzing-golang-malware-with-ghidra

Reverse engineer Go-compiled malware using Ghidra with specialized scripts for function recovery, string extraction, and type reconstruction in stripped Go binaries.

plurigrid/asi · 40 tokens

analyzing-golang-malware-with-ghidra

Reverse engineer Go-compiled malware using Ghidra with specialized scripts for function recovery, string extraction, and type reconstruction in stripped Go binaries.

26zl/cybersec-toolkit · 40 tokens

analyzing-golang-malware-with-ghidra

Use when reverse engineer Go-compiled malware using Ghidra with specialized scripts for function recovery, string extraction, and type reconstruction in stripped Go binaries. Use when reverseing engineer go-compiled malware using ghidra with specialized scripts for.

oyi77/1ai-skills · 60 tokens

analyzing-windows-prefetch-with-python

Parse Windows Prefetch (.pf) files with the windowsprefetch Python library to reconstruct application execution history, run counts, and accessed file/volume lists. Use when investigating renamed or masquerading binaries, verifying program execution timelines, or hunting for suspicious execution patterns in incident…

Youngmaidainon/Agent-Level-Up · 66 tokens

analyzing-golang-malware-with-ghidra

Reverse engineer Go-compiled malware using Ghidra with specialized scripts for function recovery, string extraction, and type reconstruction in stripped Go binaries.

autohandai/community-skills · 40 tokens