extract-and-run-samples

Extracts Python fenced blocks from Markdown and runs them in a sandboxed 3.12 environment.

1|Updated May 9, 2026
One-click install
npx skills add https://github.com/duwenji/generative-ai-oss-tutorials --skill extract-and-run-samples
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: extract-and-run-samples
Source: https://github.com/duwenji/generative-ai-oss-tutorials/tree/main/.github/skills/extract_and_run_samples
Command: npx skills add https://github.com/duwenji/generative-ai-oss-tutorials --skill extract-and-run-samples

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill removes the manual effort of extracting Python code blocks from教材 Markdown, running them in a controlled Python 3.12 environment, and keeping the documented output synchronized.

Core Features & Use Cases

  • Extracts Python code blocks: Pulls only Markdown fenced blocks starting with ```python from the target教材Markdown.
  • Executes in an isolated sandbox: Runs sample code inside sandbox/{教材ファイル名(拡張子除く)} to prevent cross-教材 interference.
  • Auto-updates教材 content: Writes captured stdout/stderr back into the corresponding locations and appends a review checklist at the end.
  • Supports repeatable operations: Allows reuse across multiple教材 by parameterizing the target file and output destinations.

Quick Start

Provide the target教材Markdown path to extract-and-run-samples to generate and run the extracted Python snippets in Python 3.12, then update the教材 with the captured execution output.

Frequently Asked Questions about extract-and-run-samples

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

FAQPage Schema
How do I automatically run Python code blocks from Markdown documentation and update the output?

To automatically run Python code blocks from Markdown documentation and update output, you can use a tutorial maintenance skill that extracts fenced ```python snippets, executes them in an isolated Python 3.12 sandbox, and writes the captured stdout/stderr back into the source document.

What is the best way to keep execution outputs synchronized with Python code snippets in Markdown?

The best way to keep execution outputs synchronized with Python code snippets in Markdown is to apply deterministic extraction of fenced blocks, run the code in a controlled environment, and auto-update the documentation with the captured stdout and stderr.

Does running Python sample code from Markdown require a specific sandbox environment setup?

Yes, running Python sample code from Markdown requires a specific sandbox environment setup that isolates execution inside a directory named after the Markdown file and utilizes a Python 3.12 venv with uv setup to install dependencies before capturing output.

Can I reuse a Markdown code execution workflow across multiple tutorial files?

Yes, you can reuse a Markdown code execution workflow across multiple tutorial files by parameterizing the target file path and output destinations, which prevents cross-tutorial interference by creating isolated sandbox directories for each document.

How do I extract only specific Python fenced blocks from Markdown files without running other code?

To extract only specific Python fenced blocks from Markdown files without running other code, the system applies deterministic extraction that identifies and pulls only blocks starting with ```python, ignoring other fenced code formats in the document.

What are the limitations of automatically generating runnable output examples for Markdown tutorials?

Limitations of automatically generating runnable output examples for Markdown tutorials include potential cross-tutorial interference if sandbox isolation fails, and the strict requirement for Python 3.12 venv and uv setup, which may not support legacy Python code snippets.