crypto-protocol-diagram — Claude Code skill: protocol diagrams
Reads protocol code or a spec and writes a Mermaid sequenceDiagram with crypto annotations, plus an ASCII diagram in the reply.
npx skills add trailofbits/skills --skill crypto-protocol-diagram -a claude-codeWhat crypto-protocol-diagram does
Point it at a crypto protocol and it maps the message flow: who sends what, which operation runs at each step, what phases the handshake has. The Mermaid sequenceDiagram is written to a file, and an ASCII version lands inline in the answer.
Input can be implementation code (.py, .rs, .go, .ts, .js, .cpp, .c) or a specification: an RFC, a paper, pseudocode, plain prose, a ProVerif .pv model, a Tamarin .spthy one. The work follows a checklist — classify the input, find protocol entry points with rg searches over names like handshake and keygen, list the parties, then annotate each cryptographic step and show error paths as alt blocks. Specs behind a URL arrive through WebFetch; Read, Write, Grep, Glob and Bash handle local files.
When both code and a spec exist, it starts from the spec and then checks the implementation against it, flagging divergences. That is why it does not sketch from memory. Call graphs and class hierarchies are the job of the neighbouring diagramming-code skill, since this one extracts protocol semantics rather than code structure.
What it helps with
- trace a TLS handshake through library source
- pull message flow out of an RFC and draw it
- see where the code drifted from the spec
- visualise a ProVerif model before checking it
- sketch the X3DH key exchange phases
Example prompts for the agent
- Diagram the handshake in
src/handshake.rsas a Mermaid sequenceDiagram - Extract the message flow from this RFC and annotate the crypto steps
- Compare
noise/against thenoise.spthymodel and mark the differences
How to install crypto-protocol-diagram
1Skills CLI (Vercel)
npx skills add trailofbits/skills --skill crypto-protocol-diagram -a claude-code2Manually: put the files in place
~/.claude/skills/crypto-protocol-diagram/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/crypto-protocol-diagram/
1Skills CLI (Vercel)
npx skills add trailofbits/skills --skill crypto-protocol-diagram -a codex2Manually: put the files in place
.agents/skills/crypto-protocol-diagram/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add trailofbits/skills --skill crypto-protocol-diagram -a cursor2Manually: put the files in place
.cursor/skills/crypto-protocol-diagram/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install trailofbits/skills crypto-protocol-diagram2Manually: put the files in place
.github/skills/crypto-protocol-diagram/SKILL.md1Skills CLI (Vercel)
npx skills add trailofbits/skills --skill crypto-protocol-diagram -a gemini-cli2Platform CLI
gemini skills install https://github.com/trailofbits/skills --path plugins/trailmark/skills/crypto-protocol-diagramManually: put the files in place
.devin/skills/crypto-protocol-diagram/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add trailofbits/skills --skill crypto-protocol-diagram -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about crypto-protocol-diagram
How do I install crypto-protocol-diagram in Claude Code?
Run npx skills add trailofbits/skills --skill crypto-protocol-diagram -a claude-code. The skill file ends up at ~/.claude/skills/crypto-protocol-diagram/SKILL.md.
What does crypto-protocol-diagram do?
It builds a sequence diagram of a crypto protocol from code or a specification. You get a Mermaid sequenceDiagram in a file and an ASCII diagram in the reply, with each cryptographic operation labelled.
How is it different from diagramming-code?
diagramming-code draws code structure: call graphs, classes, module dependencies. This skill pulls out protocol semantics — parties, messages, crypto transformations.