crypto-protocol-diagram
Skill by trailofbits
Extracts protocol message flow from source code, RFCs, papers, pseudocode, prose, ProVerif and Tamarin models. It produces Mermaid sequence diagrams with cryptographic annotations for security reviewers and protocol engineers.
Install crypto-protocol-diagram
Built from the published package, never by AI.
git clone --depth 1 https://github.com/trailofbits/skills /tmp/skills && mkdir -p ~/.claude/skills && cp -r /tmp/skills/plugins/trailmark/skills/crypto-protocol-diagram ~/.claude/skills/crypto-protocol-diagramRun in your terminal. Claude Code loads skills from ~/.claude/skills automatically.
Step-by-step: install crypto-protocol-diagram in Claude Code
git clone --depth 1 https://github.com/trailofbits/skills /tmp/skills && mkdir -p ~/.gemini/antigravity-cli/skills && cp -r /tmp/skills/plugins/trailmark/skills/crypto-protocol-diagram ~/.gemini/antigravity-cli/skills/crypto-protocol-diagramAntigravity CLI loads skills from ~/.gemini/antigravity-cli/skills, or .agents/skills for one project.
Step-by-step: install crypto-protocol-diagram in Antigravity CLI
Skills can run scripts on your machine. Some need an API key: check the README.
About
This agent skill turns a cryptographic protocol into a Mermaid sequenceDiagram. It can read source code that implements a protocol, or a specification such as an RFC, academic paper, pseudocode, informal prose, a ProVerif (.pv) file or a Tamarin (.spthy) file. The diagram is written to a file, and an ASCII version is printed inline.
The skill identifies parties, traces message flow, and annotates each step with cryptographic operations such as key generation, DH, HKDF, signing, encryption and commitments. It groups steps into protocol phases and shows abort paths with alt blocks. When both code and a spec are provided, it runs the spec workflow first and marks divergences with a warning symbol. It is meant for reviewers who need to see who sends what and which cryptographic steps occur. It is not meant for call graphs or module maps, which the source sends to a different skill.
Written from the project's SKILL.md and checked against it.
What it can do
- Protocol diagram from codeExtracts message flow from source code that implements a handshake, key exchange or multi-party protocol.
- Specification extractionReads RFCs, academic papers, pseudocode and informal prose to build a sequence diagram.
- Formal model inputReads ProVerif (.pv) and Tamarin (.spthy) models and maps their channels and rules to message flow.
- Cryptographic annotationsLabels each step with operations such as DH, HKDF, Sign, Verify, Enc and Commit.
- Phase groupingGroups message steps into named phases such as setup, handshake, authentication and key derivation.
- Abort path displayShows error and abort paths with alt blocks so missing checks are visible.
- Mermaid outputWrites a Mermaid sequenceDiagram to file and prints an ASCII sequence diagram inline.
- Code versus spec divergence checkWhen both code and a spec exist, marks differences between them with a warning symbol.
Try asking
- Diagram the X3DH handshake from this spec document
- Create a Mermaid sequence diagram for this Tamarin model
- Extract the message flow from this TLS key exchange code
Good to know
- Not for call graphs, class hierarchies or module dependency maps; use the diagramming-code skill for those.
- Not for formal verification; the source points to mermaid-to-proverif for that step.
- Input without parties or message exchange has no protocol semantics to extract.
Security check
ANo download-and-run commands, hidden instructions or signs of sending keys out were found.
Checked automatically: plugins/trailmark/skills/crypto-protocol-diagram/SKILL.md, plugins/trailmark/skills/crypto-protocol-diagram/examples/simple-handshake/protocol.py. This looks for known risky patterns and is not a full audit. How grades work
Inside the skill
-
SKILL.md18 KB -
agents/openai.yaml244 B -
assets/trail-of-bits-mark.svg3 KB -
examples/simple-handshake/expected-output.md5 KB -
examples/simple-handshake/protocol.py6 KB
Show all 11 files
-
examples/simple-proverif/expected-output.md4 KB -
examples/simple-proverif/model.pv2 KB -
references/ascii-sequence-diagram.md2 KB -
references/mermaid-sequence-syntax.md8 KB -
references/protocol-patterns.md11 KB -
references/spec-parsing-patterns.md12 KB
Alternatives to crypto-protocol-diagram
All alternatives →Retrieves lab biomarker results and clinician notes from Function Health through its FHIR API. It is for people who want an AI assistant to review their own lab history and notes.
Gives an AI assistant a methodology for finding and exploiting privilege escalation weaknesses on Windows systems during authorized penetration tests. It is for security testers and defenders validating escalation paths.
Guides the assistant through designing, debugging and hardening GitHub Actions CI/CD workflows. It is aimed at teams that run production pipelines on GitHub.
Develops evidence-backed structural security hardening proposals from disclosures, findings, source code, or Codex Security scans. It is for teams that need systemic fixes and architectural tradeoffs.
Claude Security scans code for security issues with Claude Code. It covers whole repositories, branch or pull request diffs, single commits, and existing findings from SARIF files or earlier reports.
Turns vulnerability notes, disclosure reports, PoCs, source code, or Codex Security findings into self-contained vulnerability reports. Built for security researchers who need claims the evidence supports.
Compare with function_health, windows-privilege-escalation or github-actions-advanced
crypto-protocol-diagram: common questions
Can it diagram a ProVerif or Tamarin model?
Yes. The source says ProVerif (.pv) and Tamarin (.spthy) files are read with the spec workflow, using out/in pairs and rule premises to find message flow.
What output does it produce?
It writes a Mermaid sequenceDiagram to a file and prints an ASCII sequence diagram inline.
Does it check code against a specification?
When both code and a spec are given, it runs the spec workflow first, then checks the code and marks any divergences with a warning symbol.
How do I install crypto-protocol-diagram?
Run the command above to copy the skill into ~/.claude/skills/. Claude Code picks it up automatically.
Is crypto-protocol-diagram free?
The code is published under the CC-BY-SA-4.0 licence. The service it connects to may have its own pricing.
Is crypto-protocol-diagram safe to use?
It scores 92 of 100. Grades: maintenance A, licence C, quality A. Security check: grade A, no risky patterns found in the files checked. Review the code before you install. How grades work.
What are alternatives to crypto-protocol-diagram?
Similar skills: function_health, windows-privilege-escalation, github-actions-advanced, propose-security-hardening.
