crypto-protocol-diagram

Extracts protocol message flow from code or specs and generates annotated Mermaid sequence diagrams.

Updated May 17, 2026
One-click install
npx skills add https://github.com/irrit-us/agent_misc --skill crypto-protocol-diagram-irrit-us
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: crypto-protocol-diagram
Source: https://github.com/irrit-us/agent_misc/tree/main/skills/trailmark-crypto-protocol-diagram
Command: npx skills add https://github.com/irrit-us/agent_misc --skill crypto-protocol-diagram-irrit-us

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Understanding a cryptographic protocol's message flow from source code, RFCs, or formal models is slow and error-prone, and hand-drawn diagrams often miss steps, invert arrows, or omit abort paths that matter for security review. ## Core Features & Use Cases - Dual input paths: Extracts protocol structure from source code (Python, Rust, Go, TypeScript, C/C++) or from specifications including RFCs, academic papers, informal prose, ProVerif (.pv), and Tamarin (.spthy) models. - Cryptographically annotated output: Produces a Mermaid sequenceDiagram written to a Markdown file plus an inline ASCII sequence diagram, with notes for DH, HKDF, signing, encryption, commitments, and phase grouping. - Spec divergence detection: When both code and spec exist, compares them and annotates divergences and underspecified crypto with warning markers. - Use Case: Given a Noise XX handshake implementation, generate a sequence diagram showing ephemeral key exchange, DH operations, and encrypted static key transmission, then verify it against the canonical Noise pattern. ## Quick Start Diagram the TLS 1.3 handshake from this RFC document and write the Mermaid sequence diagram to a file.

Frequently Asked Questions about crypto-protocol-diagram

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I generate a sequence diagram from a cryptographic protocol implementation?▼

Point the skill at the source directory; it greps for handshake, round, send, and recv entry points, identifies parties from struct and class names, traces message flow, and writes a Mermaid sequenceDiagram file plus an inline ASCII diagram with a protocol summary.

Can I diagram a protocol from an RFC or academic paper instead of code?▼

Yes. The spec workflow handles RFCs, pseudocode, informal prose, ProVerif (.pv), and Tamarin (.spthy) files. It extracts parties, message ordering, and crypto operations using format-specific parsing rules, then flags ambiguities with warning annotations.

Does it support ProVerif and Tamarin formal models?▼

Yes. ProVerif out/in channel pairs are matched to message arrows, and Tamarin rules are ordered via state facts. Because Tamarin uses a Dolev-Yao attacker model, diagrams are annotated to note that all messages transit the adversary network.

What is the difference between crypto-protocol-diagram and diagramming-code?▼

crypto-protocol-diagram extracts protocol semantics: who sends what to whom and which cryptographic operations occur at each step. diagramming-code visualizes code structure such as call graphs, class hierarchies, and module dependencies.

Why does my Mermaid sequence diagram fail to render?▼

Common causes are colons inside message labels, special characters in participant IDs, unclosed rect/loop/alt blocks, and labels containing the word end. The mermaid-sequence-syntax reference lists fixes for each pitfall.

When should I not use this skill for protocol analysis?▼

Do not use it for call graphs or module dependency maps, for formally verifying a protocol, or when the input has no protocol semantics such as parties exchanging messages. Formal verification is a separate downstream step.