A Claude Code Skill that automatically scans project directories and generates high-resolution bilingual (EN/CN) code logic diagrams — tailored for DL/ML model architectures and multi-language system design.
| Feature | Description |
|---|---|
| 🔍 Smart Scan | Auto-detect model definitions (PyTorch/TF/ONNX/Flax), training pipelines, and service code |
| 🏗️ DL Model Architecture | Paper-style model diagrams tracing forward()/create_model() execution path |
| 📊 Code Logic Diagrams | Call graphs, sequence diagrams, data-flow charts, class diagrams |
| 🌐 Bilingual Labels | All nodes/edges in English + 中文 for cross-team readability |
| 🔠 Large Font Rendering | Mermaid config-based 24px font sizing — text never overflows node boundaries |
| 🖼️ High-res Output | 4× scale, 3840×2880 canvas — sharp even at poster-size prints |
| 🎨 Professional Styling | Custom classDef color palette, grouped subgraphs, labeled edges |
| 🚀 Zero Config | Auto-installs mermaid-cli via npx if not present |
Code_Analysis/
├── README.md ← You are here
├── code-diagram-generator/ ← Claude Code Skill
│ └── SKILL.md ← Skill definition (install this)
└── diagrams/ ← Example outputs (faster-whisper project)
├── mermaid-config.json ← Font config (24px, spacing)
├── large-font.css ← CSS supplementary protection
├── model/
│ ├── whisper_architecture.mmd ← Whisper model E2E architecture
│ ├── whisper_architecture.svg
│ └── whisper_architecture.png (4× scale)
├── logic/
│ ├── transcription_call_graph.* ← Full module call graph
│ ├── transcription_sequence.* ← 7-phase transcription timeline
│ ├── batched_vs_sequential.* ← Two inference mode comparison
│ └── project_structure.* ← Package structure & deps
└── pipeline/
├── inference_pipeline.mmd ← End-to-end inference data flow
├── inference_pipeline.svg
└── inference_pipeline.png (4× scale)
The complete faster-whisper inference pipeline: Audio Input → PyAV Decode → Silero VAD → STFT/Mel Feature Extraction → CTranslate2 Encoder (Conv1D + Transformer) → Decoder (Token Embedding + Cross-Attention) → Beam Search with Temperature Fallback → Word-level Alignment via DTW.
Full call relationship across all modules: WhisperModel.transcribe() and BatchedInferencePipeline.transcribe() entry points, spanning audio.py, feature_extractor.py, tokenizer.py, vad.py, and the CTranslate2 backend.
Complete 7-phase lifecycle of a single transcribe() call: Audio Decode → VAD Filter → Feature Extraction → Language Detection → Sliding Window Generation (with fallback) → Word Timestamps → Timestamp Restoration.
Architecture comparison of the two inference modes: WhisperModel.transcribe() (sliding window, condition on previous text) vs BatchedInferencePipeline (VAD-chunked, parallel batch GPU inference).
End-to-end data flow from audio input (file/stream/array) through decode, VAD, Mel spectrogram, CTranslate2 encoder/decoder, to segment/word output.
Package layout and internal module dependencies of faster-whisper: transcribe.py (core, ~1900 lines) depending on feature_extractor.py, audio.py, tokenizer.py, vad.py, and utils.py.
- Copy
code-diagram-generator/SKILL.mdto~/.claude/skills/code-diagram-generator/SKILL.md - Or point Claude Code to this repo path
Just tell Claude:
帮我分析 D:\my-project 的代码结构,生成逻辑图
Or in English:
Generate architecture diagrams for ./my-ml-project
- Node.js ≥ 16 (for mermaid-cli)
- mermaid-cli auto-installs via
npx
If you want to render .mmd files yourself:
# All-in-one command
npx @mermaid-js/mermaid-cli \
-i input.mmd \
-o output.png \
-b white \
-c mermaid-config.json \
--width 3840 --height 2880 --scale 4 --pdfFitKey file: diagrams/mermaid-config.json — this sets fontSize: "24px" at the layout engine level, so node containers are sized correctly for large bilingual text.
| Decision | Reasoning |
|---|---|
| Mermaid (not Graphviz/D2) | Text-based, version-controllable, GitHub-native rendering |
| Config-based font sizing (not CSS) | CSS can't change baked-in foreignObject dimensions — config makes layout engine compute correct sizes |
--scale 4 |
4× oversampling produces print-quality PNGs (1-3 MB each) |
| Bilingual labels | Teams in China often mix EN/CN; single-language diagrams always leave someone out |
| classDef color palette | Mermaid defaults are pastel and hard to distinguish; professional colors improve scannability |
| Language | Frameworks Detected |
|---|---|
| Python | PyTorch, TensorFlow, Keras, JAX/Flax, PaddlePaddle, ONNX Runtime, Flask |
| Go | net/http, TF C API, ONNX Runtime Go, Redis |
| Rust | Actix-web, TF C FFI, ort crate, Redis |
| JavaScript/TypeScript | Node.js patterns, Express |
| General | Any project with function calls, classes, or data pipelines |
MIT