docker-python-lab
БесплатноЗапускает вложенные скриптыНе проверенGenerates an interactive Docker Python lab block for MkDocs textbook pages, where students write and run real Python code inside an isolated Docker container…
от dmccreary★ 115 звёзд на GitHubОб этом скилле
Docker Python Lab Generator
What This Skill Does
Generates interactive Python lab blocks for MkDocs pages in the learning-python
textbook (or any MkDocs project following the same pattern). Each lab shows a
code editor, Run and Reset buttons, and an output area. Code runs inside a fresh,
isolated Docker container via a local HTTP service on port 5001.
This is the Docker counterpart to the Skulpt lab pattern — same look and feel, but students run real Python (not browser-emulated Python) with access to the full standard library and third-party packages.
Prerequisites: Shared Infrastructure
Before generating any lab block, make sure the shared files exist. Check once per session; skip if already in place.
1. Check / create docs/css/docker-lab.css
If the file is missing, copy from the skill's assets:
cp ~/.claude/skills/docker-python-lab/assets/docker-lab.css \
docs/css/docker-lab.css
2. Check / create docs/js/docker-lab.js
cp ~/.claude/skills/docker-python-lab/assets/docker-lab.js \
docs/js/docker-lab.js
3. Add to mkdocs.yml (if not already present)
Check extra_css and extra_javascript in mkdocs.yml. If the entries are
missing, add them:
extra_css:
- css/docker-lab.css # ← add this line
extra_javascript:
- js/docker-lab.js # ← add this line
Do not duplicate entries that are already there.
4. Verify the service script exists
The runtime service lives at scripts/run-python-docker.sh. If it is missing
from the project, tell the user — the labs won't work without it.
Lab HTML Template
Each lab needs a unique suffix — a short string that distinguishes it from
other labs on the same page. Use "1" for the first lab, "2" for the second,
and so on. The suffix appears in every element ID so the JS can find the right
elements.
Standard lab (text output only)
<div id="docker-lab-SUFFIX">
<div id="docker-editor-SUFFIX">
<textarea id="docker-code-SUFFIX" spellcheck="false">PYTHON_CODE_HERE
</textarea>
<div id="docker-buttons-SUFFIX">
<button id="docker-run-SUFFIX" onclick="runDocker('SUFFIX')">▶ Run</button>
<button id="docker-reset-SUFFIX" onclick="resetDocker('SUFFIX')">↻ Reset</button>
</div>
<pre id="docker-output-SUFFIX" class="docker-output">Output will appear here after you click Run.</pre>
</div>
</div>
Rules:
- Replace every
SUFFIXwith the same string (e.g.,1,2,hello-world). - Put the Python code directly inside the
<textarea>tag — no extra indentation relative to column 0, because leading spaces become part of the code. - The
</textarea>closing tag must be on its own line with no trailing spaces before it; any blank line between the code and</textarea>adds an empty line in the editor. - Do not add
rows="N"— the JS auto-sizes the textarea to fit the code. - Do not add
id="main"to any element — that conflicts with the p5.js canvas parent convention used elsewhere in this project.
Timed lab (shows phase-by-phase timing breakdown)
Only add this variant when the lesson is specifically about how Docker execution
works. It requires suffix "4" by convention and adds a timing table below the
buttons.
<div id="docker-lab-4">
<div id="docker-editor-4">
<textarea id="docker-code-4" spellcheck="false">PYTHON_CODE_HERE
</textarea>
<div id="docker-buttons-4">
<button id="docker-run-4" onclick="runDockerTimed()">▶ Run + Time</button>
<button id="docker-reset-4" onclick="resetDockerTimed()">↻ Reset</button>
</div>
</div>
<div id="docker-timing-display" style="display:none; margin-top:12px;">
<table id="docker-timing-table">
<thead>
<tr><th>#</th><th>Phase</th><th style="text-align:right">Time (ms)</th><th>Bar</th></tr>
</thead>
<tbody>
<tr><td>1</td><td>Send to service (network)</td>
<td id="td-network-send" style="text-align:right">—</td>
<td><div class="timing-bar" id="bar-network-send"></div></td></tr>
<tr><td>2</td><td>Container startup</td>
<td id="td-startup" style="text-align:right">—</td>
<td><div class="timing-bar" id="bar-startup"></div></td></tr>
<tr><td>3</td><td>Python execution</td>
<td id="td-exec" style="text-align:right">—</td>
<td><div class="timing-bar" id="bar-exec"></div></td></tr>
<tr><td>4</td><td>Return to browser (network)</td>
<td id="td-network-return" style="text-align:right">—</td>
<td><div class="timing-bar" id="bar-network-return"></div></td></tr>
<tr style="font-weight:bold; border-top: 2px solid #642580;">
<td colspan="2">Total round-trip</td>
<td id="td-total" style="text-align:right">—</td>
<td></td></tr>
</tbody>
</table>
<p id="docker-timing-note" style="font-size:0.85em; color:#666; margin-top:6px;"></p>
</div>
<pre id="docker-output-4" class="docker-output" style="m
Установить docker-python-lab в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл docker-python-lab?
Generates an interactive Docker Python lab block for MkDocs textbook pages, where students write and run real Python code inside an isolated Docker container. Use this skill whenever someone asks to add a Python lab, code runner, interactive Python exercise, or runnable code block to a textbook page that uses Docker (not Skulpt). Also use it when adding multiple labs to a single page, setting up the shared CSS/JS infrastructure, or creating a timing/benchmark lab that shows students how long each phase takes. Always invoke this skill instead of writing docker lab HTML by hand.
Как установить скилл docker-python-lab?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл docker-python-lab запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
doc-coauthoring
Guide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision…
от Anthropicacademy-guide
Stop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials…
от Anthropicinternal-comms
A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill…
от Anthropicskill-development
This skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill…
от Anthropic