Skill python-notebooks-async
✓ VerifiedMembantu agent menulis dan meninjau kode asyncio di dalam Jupyter notebook atau workflow berbasis cell untuk menghindari konflik event loop.
- Bintang GitHub
- 6
- File
- 2
- Commit terakhir
- 29 Okt 2026
- Lisensi
- CC0-1.0
- Tool yang diizinkan
- —
Apa fungsi skill python-notebooks-async?
python-notebooks-async adalah agent skill. Membantu agent menulis dan meninjau kode asyncio di dalam Jupyter notebook atau workflow berbasis cell untuk menghindari konflik event loop.
Ringkasan dibuat dari SKILL.md skill ini.
Tentang skill python-notebooks-async
Developer yang bekerja di Jupyter notebook atau workflow berbasis cell dapat menggunakan skill ini untuk mengelola kode Python asynchronous tanpa memicu konflik event loop. Skill ini memberikan panduan bagi agent yang bertugas menulis, meninjau, atau memindahkan script async ke lingkungan di mana kernel notebook sudah menguasai event loop. Dengan mengikuti pola ini, agent dapat menghindari error umum seperti RuntimeError saat menggunakan asyncio.run() atau task yang gagal selesai secara diam-diam.
Seorang agent harus memuat skill ini ketika menemui masalah kegagalan asyncio.run() di dalam cell atau saat mengorkestrasi task konkuren menggunakan gather atau TaskGroup di dalam kernel IPython. Skill ini berfokus pada implementasi top-level await, mengelola logika yang dapat digunakan kembali dalam modul .py, dan memilih antara library seperti aiohttp atau httpx alih-alih menggunakan panggilan yang bersifat blocking. Skill ini memperlakukan nest_asyncio sebagai fallback dan bukan solusi utama untuk memastikan kode tetap andal dan tidak menyembunyikan masalah desain yang mendasar.
Apa yang bisa dilakukan agent dengannya
- 1Memperbaiki error event loopMenyelesaikan error RuntimeError yang disebabkan oleh pemanggilan asyncio.run() di dalam cell notebook.
- 2Refactoring kode async notebookMemindahkan fungsi helper asynchronous inline dari cell notebook ke dalam modul Python eksternal agar pengujian menjadi lebih baik.
- 3Mencegah masalah blocking I/OMengidentifikasi dan mengganti panggilan synchronous yang menghambat event loop dengan alternatif non-blocking.
Ditulis dari SKILL.md milik skill tersebut. Setiap use case diverifikasi dengan kutipan darinya.
Cara install skill python-notebooks-async
Setiap perintah menyalin folder skill ke direktori skills client. Restart client atau mulai sesi baru untuk memuatnya.Install skill python-notebooks-async di Claude Code
~/.claude/skills/python-notebooks-async/SKILL.md
$ npx degit ahgraber/skills/skills/python-notebooks-async ~/.claude/skills/python-notebooks-asyncInstall skill python-notebooks-async di Claude Code (project)
.claude/skills/python-notebooks-async/SKILL.md
$ npx degit ahgraber/skills/skills/python-notebooks-async .claude/skills/python-notebooks-asyncInstall skill python-notebooks-async di Codex
~/.agents/skills/python-notebooks-async/SKILL.md
$ npx degit ahgraber/skills/skills/python-notebooks-async ~/.agents/skills/python-notebooks-asyncInstall skill python-notebooks-async di Gemini CLI
~/.gemini/skills/python-notebooks-async/SKILL.md
$ npx degit ahgraber/skills/skills/python-notebooks-async ~/.gemini/skills/python-notebooks-asyncInstall skill python-notebooks-async di Claude.ai
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
Pengecekan otomatis
Berjalan 16 Nov 2026Laporan lengkap →Lolos cek otomatis kami. Ini bukan audit keamanan: baca skripnya sebelum membiarkan agent menjalankannya. Cara kerja checks
- Source repository terhubung dan dapat dijangkauahgraber/skills/skills/python-notebooks-async is public and reachablegithub.com/ahgraber/skills/tree/HEAD/skills/python-notebooks ↗Lolos
- Lisensi open source (OSI)CC0-1.0spdx.org/licenses/CC0-1.0.html ↗Lolos
- Ada commit atau release dalam satu tahun terakhirLast commit 2026-10-29github.com/ahgraber/skills/commits ↗Lolos
- Skrip tanpa unduh-lalu-jalankan atau pencurian kredensialNo scripts in the skill folderLolos
- Tidak ada instruksi tersembunyi di SKILL.mdNo override phrases, safeguard switches, credential requests or hidden charactersgithub.com/ahgraber/skills/blob/HEAD/skills/python-notebooks ↗Lolos
- Tool yang diizinkan otomatis dibatasiNo pre-approved tools; the agent asks before using onegithub.com/ahgraber/skills/blob/HEAD/skills/python-notebooks ↗Lolos
- SKILL.md mengikuti format Agent SkillsValid name and description; says when to use it; 66 linesgithub.com/ahgraber/skills/blob/HEAD/skills/python-notebooks ↗Lolos
SKILL.md
Lihat di GitHubPython 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
Berkas dalam skill ini
2Pertanyaan seputar skill python-notebooks-async
Bagaimana cara install skill python-notebooks-async di Claude Code?
Jalankan npx degit ahgraber/skills/skills/python-notebooks-async ~/.claude/skills/python-notebooks-async. Claude Code memuat skill dari ~/.claude/skills (semua proyek) atau .claude/skills (satu proyek) dan menggunakan skill saat deskripsinya cocok dengan tugas.
Client mana saja yang bisa menggunakan skill python-notebooks-async?
Client apa pun yang membaca format Agent Skills: Claude Code, Codex, Gemini CLI, dan claude.ai (unggah sebagai ZIP). Script dalam skill hanya berjalan di client yang mengizinkan eksekusi kode.
Mengapa asyncio.run() memunculkan RuntimeError di notebook saya?
Kernel notebook sudah memiliki dan menjalankan event loop; memanggil asyncio.run() mencoba menjalankan loop kedua, yang menyebabkan konflik. Gunakan top-level await sebagai gantinya.
Haruskah saya menggunakan nest_asyncio dalam workflow notebook saya?
Anda sebaiknya hanya menggunakan nest_asyncio sebagai fallback kompatibilitas terbatas karena alasan legacy, bukan sebagai pilihan utama, karena hal ini dapat menyembunyikan masalah desain dan bug konkurensi.
Bagaimana cara mencegah pemblokiran event loop di dalam cell notebook?
Hindari penggunaan synchronous blocking I/O seperti requests.get(); sebagai gantinya, gunakan library asynchronous seperti aiohttp, httpx, atau bungkus panggilan synchronous dalam asyncio.to_thread().