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ファイルです。関連するリクエストがあったときだけトークンを消費します。

  • どのLLMでも利用可能

    AIスキルはプロバイダー固有のコードではなく、通常のMarkdownなので、GPT、Claude、Gemini、Grok、ローカルモデルで利用できます。

  • 19個の同梱ファイル

    モデルが作業中に読み取れるスクリプト、テンプレート、参考資料です。ファイルは読み取り専用で、実行されることはありません。

  • オープンソース

    mkaremm80がGitHubで公開しています。インストールする前にソースを確認してください。

インストール

AIスキル「Sim Code Explainer」をTypingMindにインストールすれば、どのLLMでも利用できます。SKILL.mdを読み取れる別のAIエージェントに追加することもできます。

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

別のAIエージェントにインストール

Agent Skills形式を読み取れるAIエージェントなら、このスキルを利用できます。フォルダをそのAIエージェントのスキルディレクトリにコピーしてください。

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を有効にするだけで、あとはモデルが対応します。名前と説明がシステムプロンプトに含まれ、関連するリクエストがあると、モデルが指示の全文を自動で読み込みます。手動で呼び出す必要はなく、実際に使用されるまでトークンを消費しません。

関連するリクエストがあるとすぐに、モデルが自動的にSim Code Explainerを読み込みます。

どのAIモデルでも利用可能

AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、Sim Code Explainerは作成時に想定されたモデルに縛られません。TypingMindに一度インストールすれば、ご自身のAPIキーを使って、GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama、またはご自身で実行するローカルモデルで利用できます。

  • 必要なときだけ読み込み

    システムプロンプトには名前と説明だけが含まれます。関連するリクエストが初めてあったときに指示を取得するため、スキルを使わない間は指示の読み込みにトークンを消費しません。

  • チャットの途中でモデルを切り替え

    スキルはコードではなく指示なので、モデルを切り替えてもそのまま使えます。次のモデルも同じ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.

同梱ファイル

スキルが読み込まれている間、モデルは必要に応じてこれらを読み取ります。読み取り可能なファイルとして提供され、実行されることはありません。

よくある質問

AIスキル「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...

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を読み込み、関連ファイルをまとめて、チャットごとに有効にできるスキルとしてインストールします。

Sim Code Explainerを使えるAIモデルはどれですか?

TypingMindに接続したどのモデルでも利用できます。AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、GPT、Claude、Gemini、Grok、ローカルモデルのいずれも、リクエストの内容がこのスキルの用途に合ったときに、このスキルを読み込めます。

Sim Code Explainerで使えるAIモデルの数に制限はありますか?

数に制限はありません。スキルに対応したモデルであれば、GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llamaなど、どのモデルでもSim Code Explainerを利用できます。すべてTypingMind上で、自分のAPIキーを使って利用できます。

AIスキル「Sim Code Explainer」は無料ですか?

はい。mkaremm80がMITライセンスのもとでGitHubに公開しています。ご利用のAIプロバイダーに支払うのは、使用したトークンの料金だけです。

AIスキルとは何ですか?

AIスキルは、特定のタスクの実行方法をAIモデルに教える、再利用可能な指示のセットです。オープンなAgent Skills形式に従い、名前と説明を含むSKILL.mdファイルに加え、モデルが必要とするスクリプト、テンプレート、参照ファイルで構成されます。モデルはリクエストがスキルに合致したときだけ指示を読み込むため、インストール済みのスキルも、使うまでは費用がかかりません。

AIスキルは、プラグインやMCPサーバーとどう違いますか?

プラグインやMCPサーバーは、モデルが呼び出せる新しいツールを提供します。ツールとは、どこかで実行され、結果を返すコードです。一方、AIスキルは、タスクへの取り組み方、従うべき手順、望ましい出力の例といった知識や進め方をモデルに伝えます。スキルは通常のMarkdownで記述されているため、サーバー、APIキー、実行環境は不要で、どのモデルでも利用できます。

すべて見る

今すぐ自分専用のAIワークスペースを作成

ニュースレターに登録すると、新機能や今後のプレゼント企画のお知らせが届きます👇