Sim Code Explainer 标志

Sim Code Explainer

社区
mkaremm80
sim-code-explainer

Turn any Python simulation or engineering program into a colourful, zero-to-hero PDF guide that explains every block and line, the theory and system model behind it, every variable and what changing it does, and the actual results of running it (plus a Google Colab notebook). Use this whenever the user uploads or points to Python code and wants it explained, documented, taught, turned into a report/tutorial/lecture notes, or "explained from zero for someone who doesn't know Python" - for any domain (communications/OFDM/5G, control/PID, power systems, signal processing, queueing, Monte-Carlo, physics, ML, finance models). Also use it when the user asks to first WRITE a simulator for a system (e.g. "simulate OFDM and measure BER vs SNR, then explain the code in a PDF") and then explain it.

概览

发布者mkaremm80
代码仓库My-Skills-on-Claude
技能名称sim-code-explainer
星标数
91
复刻数
20
附带文件
19
许可协议MIT
链接
  • Markdown 格式的指令

    模型按需加载 SKILL.md 文件,因此只有在请求确实与该技能匹配时才会消耗 Token。

  • 兼容任何大语言模型

    AI 技能采用纯 Markdown,而非特定提供商的代码,因此可搭配 GPT、Claude、Gemini、Grok 或本地模型使用。

  • 19 个附带文件

    模型执行任务时可读取的脚本、模板和参考资料。这些文件为只读文件,绝不会被执行。

  • 开源

    由 mkaremm80 发布于 GitHub。请在安装前查看技能的源文件。

安装

在 TypingMind 中安装 Sim Code Explainer AI 技能,即可搭配任意大语言模型使用;也可以将其放入其他支持读取 SKILL.md 的智能体中。

1

安装到 TypingMind

TypingMind 可直接从 GitHub 文件夹安装技能:读取 SKILL.md,打包资源文件,并将结果保存在本地。

  1. 打开应用,前往“插件 → 技能”。
  2. 选择“从 GitHub 安装”。
  3. 粘贴下方的技能文件夹 URL 并确认。
    https://github.com/mkaremm80/My-Skills-on-Claude/tree/main/skills/sim-code-explainer
  4. 请在每个需要使用该技能的聊天中启用它。
依次选择“插件 → 技能 → 添加技能 → 从 GitHub URL 导入”,然后粘贴文件夹 URL 并点击“继续”。
2

安装到其他智能体

任何支持 Agent Skills 格式的智能体都可以使用此技能,只需将文件夹复制到该智能体的技能目录中。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/mkaremm80/My-Skills-on-Claude.git /tmp/My-Skills-on-Claude
mkdir -p .claude/skills
cp -r /tmp/My-Skills-on-Claude/skills/sim-code-explainer .claude/skills/sim-code-explainer
复制后,请重启 Claude Code,以加载新技能。

在 TypingMind 中使用此技能

在任意 TypingMind 聊天中启用 Sim Code Explainer,后续即可交由模型处理。技能的名称和描述会放在系统提示词中,一旦请求匹配,模型就会自动加载完整指令,无需您手动调用,且在实际使用前不会消耗 Token。

一旦请求与技能匹配,模型就会自动加载 Sim Code Explainer。

兼容任何 AI 模型

AI 技能是纯 Markdown 指令,而非特定提供商的代码,因此 Sim Code Explainer 不局限于最初适配的模型。只需在 TypingMind 中安装一次,即可搭配 GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 或您自行运行的本地模型使用,全程使用您自己的 API 密钥。

  • 仅在需要时加载

    系统提示词中仅包含技能名称和描述。首次遇到匹配的请求时才会加载完整指令,因此技能未使用时,这些指令不会消耗 Token。

  • 在聊天中切换模型

    技能是指令而非代码,因此切换模型不会导致技能失效,新模型会读取同一个 SKILL.md。

技能指令

这是模型会加载的 SKILL.md 内容。请在安装前阅读,因为技能就是模型将遵循的指令。

Simulation Code Explainer

Produce a guide that lets a reader with zero Python knowledge understand a program completely: what problem it solves, the theory, how every group of lines works, why it is written that way, what each variable does to the results, and what the actual results mean.

Examples (look at them before writing your first guide):

  • examples/pid_motor/ - a complete worked case: original code, block-marked code, the full make_guide.py and the resulting 31-page PDF. Use its make_guide.py as the model for yours.
  • examples/mm1_queue/ - a shorter guide (24 pages) for an event-driven simulation.
  • examples/ofdm_reference_guide.pdf - a 65-page guide for a 5G MIMO-OFDM simulator: the depth to aim for when the code is large and the domain is rich.

Deliverables: <Name>_Guide.pdf, <name>.ipynb (Colab), the block-marked .py, and the figures.

Workflow

0. Agree on scope (one short message, then proceed)

Confirm in one message, with sensible defaults so the user can just say "go":

  • audience (default: zero Python, basic engineering maths),
  • language of the PDF (default English; the PDF engine is Latin/Greek only, so warn that Arabic or other right-to-left output is not supported),
  • scope: what the report covers and what it deliberately leaves out. Users care about this - they will present the report, so the scope must be stated explicitly in the PDF (a scope page is built in).
  • If the user has no code yet and wants you to write the simulator first, also agree on the system model, the parameters and the measurements, then write clean, block-marked code (see "Writing the simulator" below) before continuing.

Set up: SK=<this skill folder>; work in a fresh folder; pip install reportlab pygments matplotlib numpy if missing (pdftoppm from poppler-utils is used for QA if present).

1. Analyse the code

bash
python $SK/scripts/code_parser.py user_code.py --write-markers user_code_marked.py

This prints the blocks, functions/classes, tunable parameters and the Python features used, and writes user_code.analysis.json. If the file had no # ==== [BLOCK n] Title ==== markers it writes a copy with proposed markers. Then open the marked copy and refine it by hand:

  • give every block a meaningful title ("Motor model: one Euler step" rather than "motor_step()"),
  • split blocks longer than ~40-60 lines at natural boundaries (a marker may be indented inside a function; the block then ends at the next marker),
  • never change the program's logic; only add or edit marker comments (and, at most, explanatory comments). Re-run code_parser.py on the marked file afterwards.

Read the whole program carefully. You must understand every line before explaining it - trace the data flow (what each array/object holds, its shape/units) and identify the system model it implements.

2. Run it and capture the results

bash
python $SK/scripts/run_and_capture.py user_code_marked.py --out run_out --timeout 900

Figures land in run_out/figures/: those the program saves keep their own names, those it only shows become auto_01.png, auto_02.png, ... in display order. Printed output goes to run_out/stdout.txt, a summary to run_out/run_report.json (status, run time, work_dir). Look at every figure (open the PNGs) and read the output; these are the only numbers you may quote as results. To compute extra numbers (a value at another setting, a check against theory, exercise outcomes), import the marked program as a module in make_guide.py and call its functions, as examples/pid_motor/make_guide.py does - never type numbers by hand.

  • If the run is slow, look for a quick-mode flag in the code or ask the user before editing values; say in the guide which settings were used.
  • If it cannot run here (missing data files, GPU, licences, hours of runtime), still write the guide, but say clearly in the scope page and results chapter that results are not shown and why. Never invent numbers or draw "expected" plots as if they were results.
  • If the code has a bug, tell the user; explain the code as written and mention the issue in a warn box rather than silently fixing it.

3. Write the guide script

Copy templates/guide_template.py to make_guide.py in the work folder and fill it in (set SCE_SKILL_DIR or the SKILL path at its top). Read references/api.md for the helper functions and references/writing_guide.md for how to write each part - it describes the depth and tone that make these guides good. Key points:

  • Follow the chapter blueprint at the top of the template (scope, Python from zero, ideas, system model, code block by block, control panel, how the simulation works, results, summary, exercises, glossary).
  • Every block gets explain_block(...): one-sentence summary, the code with real line numbers, a line-by-line table covering every non-trivial line, and the boxes that apply (idea / model / what / py / warn).
  • Every tunable variable appears in the control-panel table with meaning, default, sensible range and the effect of increasing it on the results.
  • Every figure of the run appears in the results chapter with a res box that quotes the real numbers (parse them from stdout.txt or recompute them from saved data) and explains why the curve looks the way it does, linking back to equations (3.x) and to variables.
  • Draw 1-3 concept diagrams with scripts/diagram_kit.py (pipeline of the system with function names, a simulation-loop flowchart); add matplotlib explanatory plots where a picture teaches better.

4. Build and check visually

bash
python make_guide.py
python $SK/scripts/render_check.py <Name>_Guide.pdf --out qa

Open the contact sheets in qa/ and fix what you see: overlapping text, figures too small or split, empty half pages, red "figure not found" boxes, unreadable equations, tables overflowing. Zoom into a few pages with --pages 3 12 25 --dpi 80. Iterate until clean.

5. Notebook and delivery

bash
python $SK/scripts/make_notebook.py user_code_marked.py <name>.ipynb --title "..." [--pip "pkg1 pkg2"]

Execute it once if Jupyter is available (jupyter nbconvert --to notebook --execute) to be sure it runs top to bottom. Deliver the PDF, notebook, marked .py and figures (a zip is convenient), with a short summary of what the guide contains and any limitations (e.g. results not reproducible here).

Writing the simulator (only when the user asks you to create it)

Write code a beginner can follow: one make_config(**changes) (or a clear parameter section) with a comment on every parameter, small single-purpose functions, # ==== [BLOCK n] Title ==== markers from the start, vectorised NumPy where natural, a fixed random seed, plots saved to figures/ and also shown, a theory/validation check against a closed-form result whenever one exists (it is what makes the results trustworthy), and a FAST flag if the full run takes more than a few minutes.

Quality bar (why it matters)

  • The reader is a beginner who will present or reuse this work: a wrong number or an unexplained line breaks their trust and their presentation. Accuracy beats length.
  • Explanations should connect three levels every time: Python mechanics (what the line does) -> engineering meaning (what it represents in the system) -> consequence (what changes in the results if it changes).
  • Quote results only from the actual run, with units, and say how reliable they are (statistical noise, step size, number of runs).
  • Keep the scope honest: list what the model ignores; do not add features the user did not ask for.

附带文件

技能加载后,模型会按需读取这些文件。它们仅作为可读文件提供,绝不会被执行。

常见问题

Sim Code Explainer AI 技能有什么作用?

Turn any Python simulation or engineering program into a colourful, zero-to-hero PDF guide that explains every block and line, the theory and system model behind it, every variable and what changing it does, and the actual results of running it (plus a Google Colab notebook). Use this whenever the user uploads or points to Python code and wants it explained, documented, taught, turned into a report/tutorial/lecture notes, or "explained from zero for someone who doesn't know Python" - for any domain (communications/OFDM/5G, control/PID, power systems, signal processing, queueing, Monte-Carlo...

为什么在 TypingMind 中使用 Sim Code Explainer?

因为您只需安装一次,就能搭配任何模型使用。Sim Code Explainer 采用纯 Markdown 格式,而非特定提供商专用的代码,因此同一技能可用于 GPT-5、Claude、Gemini、Grok 或本地模型。您甚至可以在聊天中途切换模型,而不会影响技能的正常使用。TypingMind 使用您自己的 API 密钥,因此您直接向提供商付费,而不是按席位订阅;您的技能和聊天记录也都保留在您自己的存储空间中。

如何在 TypingMind 中安装 Sim Code Explainer?

在 TypingMind 中打开“插件 → 技能 → 从 GitHub 安装”,然后粘贴 https://github.com/mkaremm80/My-Skills-on-Claude/tree/main/skills/sim-code-explainer。TypingMind 会读取其中的 SKILL.md,打包相关文件,并将其安装为技能,供您在各个聊天中按需启用。

哪些 AI 模型可以使用 Sim Code Explainer?

您在 TypingMind 中连接的任何模型都可以。AI 技能采用纯 Markdown 指令,而非特定提供商专用的代码,因此 GPT、Claude、Gemini、Grok 和本地模型都能在请求匹配时加载此技能。

Sim Code Explainer 可以搭配多少个 AI 模型使用?

数量不限。只要模型支持技能,您就可以将它与 Sim Code Explainer 搭配使用。GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 等模型都可以通过您自己的 API 密钥接入 TypingMind。

Sim Code Explainer AI 技能免费吗?

是的。mkaremm80 已在 GitHub 上根据 MIT 许可证发布了该技能。您只需向自己的 AI 提供商支付所用 Token 的费用。

什么是 AI 技能?

AI 技能是一组可复用的指令,用于教会 AI 模型完成某项特定任务。它遵循开放的 Agent Skills 格式:包含名称和描述的 SKILL.md 文件,以及模型可能需要的脚本、模板或参考文件。模型仅在您的请求与技能匹配时才会读取这些指令,因此已安装的技能在使用前不会产生任何费用。

AI 技能与插件或 MCP 服务器有何不同?

插件或 MCP 服务器为模型提供可调用的新工具,也就是在某处运行并返回结果的代码。AI 技能则为模型提供知识和流程:如何处理任务、遵循哪些步骤,以及怎样的输出才算优质。技能采用纯 Markdown 格式,因此不需要服务器、API 密钥或运行时环境,并且适用于任何模型。

查看全部

立即创建您自己的 AI 工作区

订阅我们的电子简报,获取新功能和后续赠奖活动的通知 👇