python-notebooks-async Skill
✓ VerifiziertHilft Agenten dabei, asyncio-Code in Jupyter Notebooks oder zellbasierten Workflows zu schreiben und zu reviewen, um Konflikte mit dem Event Loop zu vermeiden.
- GitHub Stars
- 6
- Dateien
- 2
- Letzter Commit
- 29. Okt. 2026
- Lizenz
- CC0-1.0
- Erlaubte Tools
- —
Was macht der python-notebooks-async Skill?
python-notebooks-async ist ein Agent Skill. Hilft Agenten dabei, asyncio-Code in Jupyter Notebooks oder zellbasierten Workflows zu schreiben und zu reviewen, um Konflikte mit dem Event Loop zu vermeiden.
Zusammenfassung erzeugt aus der SKILL.md des Skills.
Über den python-notebooks-async skill
Entwickler, die in Jupyter Notebooks oder zellbasierten Workflows arbeiten, nutzen diesen Skill, um asynchronen Python-Code zu verwalten, ohne Event-Loop-Konflikte auszulösen. Er bietet Anleitung für Agenten, die damit beauftragt sind, Async-Skripte zu schreiben, zu reviewen oder in Umgebungen zu portieren, in denen der Notebook-Kernel bereits den Event Loop kontrolliert. Durch das Befolgen dieser Patterns können Agenten häufige Fehler wie RuntimeError bei der Verwendung von asyncio.run() oder Tasks, die stillschweigend nicht fertiggestellt werden, vermeiden.
Ein Agent sollte diesen Skill laden, wenn er auf Probleme mit asyncio.run() Fehlern in Zellen stößt oder wenn er concurrent Tasks mittels gather oder TaskGroup innerhalb von IPython-Kerneln orchestriert. Der Skill konzentriert sich auf die Implementierung von top-level await, die Verwaltung wiederverwendbarer Logik in .py Modulen und die Wahl zwischen Libraries wie aiohttp oder httpx anstelle von blockierenden Aufrufen. Er behandelt nest_asyncio als Fallback statt als primäre Lösung, um sicherzustellen, dass der Code zuverlässig bleibt und zugrunde liegende Designprobleme nicht verschleiert werden.
Was ein agent damit machen kann
- 1Beheben von Event-Loop-FehlernLöse RuntimeError-Fehler, die durch den Aufruf von asyncio.run() innerhalb einer Notebook-Zelle verursacht werden.
- 2Refactoring von Async-Notebook-CodeVerschiebe Inline-asynchrone Helper-Funktionen aus Notebook-Zellen in externe Python-Module für besseres Testing.
- 3Verhindern von blockierenden I/O-ProblemenIdentifiziere und ersetze synchrone Aufrufe, die den Event Loop blockieren, durch non-blocking Alternativen.
Geschrieben basierend auf dem SKILL.md des skills. Jeder use case wurde gegen ein zitat daraus geprüft.
So installierst du den python-notebooks-async Skill
Jeder Befehl kopiert den Skill-Ordner in das Skills-Verzeichnis des Clients. Starte den Client neu oder beginne eine neue Session, um ihn zu laden.Den python-notebooks-async Skill in Claude Code installieren
~/.claude/skills/python-notebooks-async/SKILL.md
$ npx degit ahgraber/skills/skills/python-notebooks-async ~/.claude/skills/python-notebooks-asyncDen python-notebooks-async Skill in Claude Code (project) installieren
.claude/skills/python-notebooks-async/SKILL.md
$ npx degit ahgraber/skills/skills/python-notebooks-async .claude/skills/python-notebooks-asyncDen python-notebooks-async Skill in Codex installieren
~/.agents/skills/python-notebooks-async/SKILL.md
$ npx degit ahgraber/skills/skills/python-notebooks-async ~/.agents/skills/python-notebooks-asyncDen python-notebooks-async Skill in Gemini CLI installieren
~/.gemini/skills/python-notebooks-async/SKILL.md
$ npx degit ahgraber/skills/skills/python-notebooks-async ~/.gemini/skills/python-notebooks-asyncDen python-notebooks-async Skill in Claude.ai installieren
npx degit ahgraber/skills/skills/python-notebooks-async python-notebooks-async && zip -r python-notebooks-async.zip python-notebooks-async # claude.ai → Customize → Skills → + → Create skill → Upload a skill → python-notebooks-async.zip
Automatisierte Checks
Geluften am 16. Nov. 2026Vollständiger Bericht →Hat unsere automatischen Prüfungen bestanden. Das ist kein Sicherheitsaudit: Lesen Sie die Skripte, bevor ein Agent sie ausführt. Wie die Checks funktionieren
- Source Repository verknüpft und erreichbarahgraber/skills/skills/python-notebooks-async is public and reachablegithub.com/ahgraber/skills/tree/HEAD/skills/python-notebooks ↗Bestanden
- Open Source Lizenz (OSI)CC0-1.0spdx.org/licenses/CC0-1.0.html ↗Bestanden
- Commit oder Release im letzten JahrLast commit 2026-10-29github.com/ahgraber/skills/commits ↗Bestanden
- Keine Download-und-Ausführen-Muster oder Zugangsdatendiebstahl in SkriptenNo scripts in the skill folderBestanden
- Keine versteckten Anweisungen in SKILL.mdNo override phrases, safeguard switches, credential requests or hidden charactersgithub.com/ahgraber/skills/blob/HEAD/skills/python-notebooks ↗Bestanden
- Vorab erlaubte Tools sind eingeschränktNo pre-approved tools; the agent asks before using onegithub.com/ahgraber/skills/blob/HEAD/skills/python-notebooks ↗Bestanden
- SKILL.md folgt dem Agent-Skills-FormatValid name and description; says when to use it; 66 linesgithub.com/ahgraber/skills/blob/HEAD/skills/python-notebooks ↗Bestanden
SKILL.md
Auf GitHub ansehenPython Notebooks Async
Overview
Notebook kernels own the event loop; async code must cooperate with that ownership rather than fight it.
This skill covers orchestration patterns, top-level await, and compatibility constraints for .ipynb and #%% workflows.
Treat these recommendations as preferred defaults. When project constraints require deviation, call out tradeoffs and compensating controls.
When to Use
asyncio.run()raisesRuntimeErrorinside a notebook cell.- Event-loop conflicts when mixing async libraries in Jupyter.
- Porting async scripts into notebook workflows.
- Orchestrating concurrent tasks (
gather,TaskGroup) in IPython kernels. - Deciding where to place reusable async logic across notebook/module boundaries.
When NOT to Use
- Pure script or service code with no notebook involvement.
- Synchronous notebook workflows with no async needs.
- General asyncio API design outside notebook contexts — the
pythonskill covers concurrency audit defaults.
Invocation Notice
- Tell the user when this skill is running:
python-notebooks-async. Skip the notice when the user asked for the skill by name or slash command; spelling and spacing need not match. A phrase from this skill's own trigger list is not a name — naming the work is not naming the skill.
Quick Reference
- Treat notebook kernels as loop-owned environments; never create a competing loop.
- Use top-level
awaitinstead ofasyncio.run()in notebook cells. - Orchestrate concurrent work with
asyncio.gather()orasyncio.TaskGroup. - Keep reusable async logic in regular
.pymodules, imported into notebooks. - Use
nest_asyncioonly as a constrained compatibility fallback, not a default. - Avoid fire-and-forget tasks — always
awaitor collect results explicitly.
Common Mistakes
- Calling
asyncio.run()in a notebook cell. The kernel already runs a loop;asyncio.run()tries to start a second one and raisesRuntimeError. Useawaitdirectly instead. - Applying
nest_asyncioglobally by default. It patches the loop to allow reentrant calls but masks design problems and can hide subtle concurrency bugs. Reserve it for legacy compatibility. - Defining async helpers inline in cells instead of modules.
Inline definitions are lost on kernel restart and cannot be tested outside the notebook.
Extract to
.pyfiles. - Ignoring returned tasks or coroutines.
Calling an async function without
awaitsilently produces a never-executed coroutine object, with no error until results are missing downstream. - Mixing blocking I/O with async in the same cell.
Synchronous calls like
requests.get()block the event loop, starving concurrent tasks. Useaiohttp,httpx, orasyncio.to_thread().
References
references/notebooks-async.md— event-loop ownership, background-work and fire-and-forget patterns, script/notebook compatibility, blocking-library interop,nest_asynciopolicy
Dateien in diesem Skill
2python-notebooks-async Skill-Fragen
Wie installiere ich den python-notebooks-async Skill in Claude Code?
Führe npx degit ahgraber/skills/skills/python-notebooks-async ~/.claude/skills/python-notebooks-async aus. Claude Code lädt Skills aus ~/.claude/skills (alle Projekte) oder .claude/skills (ein Projekt) und nutzt einen Skill, wenn seine Beschreibung zur Aufgabe passt.
Welche Clients können den python-notebooks-async Skill nutzen?
Jeder Client, der das Agent Skills-Format liest: Claude Code, Codex, Gemini CLI und claude.ai (als ZIP hochladen). Skripte im Skill laufen nur dort, wo der Client Codeausführung erlaubt.
Warum verursacht asyncio.run() in meinem Notebook einen RuntimeError?
Der Notebook-Kernel besitzt und führt bereits einen Event Loop; der Aufruf von asyncio.run() versucht, einen zweiten Loop zu starten, was zu einem Konflikt führt. Nutze stattdessen top-level await.
Sollte ich nest_asyncio in meinen Notebook-Workflows verwenden?
Du solltest nest_asyncio nur als eingeschränkten Kompatibilitäts-Fallback aus Legacy-Gründen nutzen, nicht als Standard, da es Designfehler und Concurrency-Bugs maskieren kann.
Wie kann ich verhindern, dass der Event Loop in einer Notebook-Zelle blockiert wird?
Vermeide synchrones blockierendes I/O wie requests.get(); nutze stattdessen asynchrone Libraries wie aiohttp, httpx oder kapsle synchrone Aufrufe in asyncio.to_thread().