Skill python-notebooks-async
✓ VerificadoAyuda a los agentes a escribir y revisar código asyncio dentro de Jupyter notebooks o flujos de trabajo basados en celdas para evitar conflictos con el event loop.
- Estrellas en GitHub
- 6
- Archivos
- 2
- Último commit
- 29 oct 2026
- Licencia
- CC0-1.0
- Herramientas permitidas
- —
¿Qué hace la skill python-notebooks-async?
python-notebooks-async es una agent skill. Ayuda a los agentes a escribir y revisar código asyncio dentro de Jupyter notebooks o flujos de trabajo basados en celdas para evitar conflictos con el event loop.
Resumen generado a partir del SKILL.md de la skill.
Sobre la skill python-notebooks-async
Los desarrolladores que trabajan en Jupyter notebooks o flujos de trabajo basados en celdas utilizan este SKILL para gestionar código Python asíncrono sin provocar conflictos con el event loop. Proporciona orientación para agentes encargados de escribir, revisar o portar scripts async a entornos donde el kernel del notebook ya controla el event loop. Al seguir estos patrones, los agentes pueden evitar errores comunes como RuntimeError al usar asyncio.run() o tareas que fallan sin completarse de forma silenciosa.
Un agente debe cargar este SKILL cuando encuentre problemas con fallos de asyncio.run() en celdas o al orquestar tareas concurrentes usando gather o TaskGroup dentro de kernels de IPython. El SKILL se enfoca en implementar top-level await, gestionar lógica reutilizable en módulos .py y elegir entre librerías como aiohttp o httpx en lugar de llamadas bloqueantes. Trata a nest_asyncio como un recurso de respaldo en lugar de una solución principal para asegurar que el código sea confiable y evitar que se oculten problemas de diseño subyacentes.
Lo que un agente puede hacer con ella
- 1Corregir errores de event loopResolver errores de RuntimeError causados por llamar a asyncio.run() dentro de una celda de notebook.
- 2Refactorizar código async en notebooksMover funciones auxiliares asíncronas integradas desde celdas de notebook hacia módulos de Python externos para mejorar las pruebas.
- 3Prevenir problemas de I/O bloqueanteIdentificar y reemplazar llamadas síncronas que agotan el event loop con alternativas no bloqueantes.
Escrito a partir del SKILL.md de la skill. Cada caso de uso se verifica con una cita del mismo.
Cómo instalar la skill python-notebooks-async
Cada comando copia la carpeta de la skill al directorio de skills del cliente. Reinicia el cliente o inicia una nueva sesión para cargarla.Instalar la skill python-notebooks-async en Claude Code
~/.claude/skills/python-notebooks-async/SKILL.md
$ npx degit ahgraber/skills/skills/python-notebooks-async ~/.claude/skills/python-notebooks-asyncInstalar la skill python-notebooks-async en Claude Code (project)
.claude/skills/python-notebooks-async/SKILL.md
$ npx degit ahgraber/skills/skills/python-notebooks-async .claude/skills/python-notebooks-asyncInstalar la skill python-notebooks-async en Codex
~/.agents/skills/python-notebooks-async/SKILL.md
$ npx degit ahgraber/skills/skills/python-notebooks-async ~/.agents/skills/python-notebooks-asyncInstalar la skill python-notebooks-async en Gemini CLI
~/.gemini/skills/python-notebooks-async/SKILL.md
$ npx degit ahgraber/skills/skills/python-notebooks-async ~/.gemini/skills/python-notebooks-asyncInstalar la skill python-notebooks-async en 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
Verificaciones automáticas
Ejecutado 16 nov 2026Informe completo →Superó nuestras comprobaciones automáticas. No es una auditoría de seguridad: lee los scripts antes de dejar que un agente los ejecute. Cómo funcionan las verificaciones
- Repositorio de origen vinculado y accesibleahgraber/skills/skills/python-notebooks-async is public and reachablegithub.com/ahgraber/skills/tree/HEAD/skills/python-notebooks ↗Aprobado
- Licencia de código abierto (OSI)CC0-1.0spdx.org/licenses/CC0-1.0.html ↗Aprobado
- Commit o lanzamiento en el último añoLast commit 2026-10-29github.com/ahgraber/skills/commits ↗Aprobado
- Sin descargar y ejecutar ni robo de credenciales en los scriptsNo scripts in the skill folderAprobado
- Sin instrucciones ocultas en SKILL.mdNo override phrases, safeguard switches, credential requests or hidden charactersgithub.com/ahgraber/skills/blob/HEAD/skills/python-notebooks ↗Aprobado
- Las herramientas preaprobadas están acotadasNo pre-approved tools; the agent asks before using onegithub.com/ahgraber/skills/blob/HEAD/skills/python-notebooks ↗Aprobado
- SKILL.md sigue el formato de Agent SkillsValid name and description; says when to use it; 66 linesgithub.com/ahgraber/skills/blob/HEAD/skills/python-notebooks ↗Aprobado
SKILL.md
Ver en 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
Archivos de esta skill
2Preguntas sobre la skill python-notebooks-async
¿Cómo instalo la skill python-notebooks-async en Claude Code?
Ejecuta npx degit ahgraber/skills/skills/python-notebooks-async ~/.claude/skills/python-notebooks-async. Claude Code carga las skills desde ~/.claude/skills (todos los proyectos) o .claude/skills (un proyecto) y usa una skill cuando su descripción coincide con la tarea.
¿Qué clientes pueden usar la skill python-notebooks-async?
Cualquier cliente que lea el formato Agent Skills: Claude Code, Codex, Gemini CLI y claude.ai (subir como ZIP). Los scripts de la skill se ejecutan solo donde el cliente permite la ejecución de código.
¿Por qué asyncio.run() lanza un RuntimeError en mi notebook?
El kernel del notebook ya posee y ejecuta un event loop; llamar a asyncio.run() intenta iniciar un segundo loop, lo que causa un conflicto. Usa top-level await en su lugar.
¿Debería usar nest_asyncio en mis flujos de trabajo de notebook?
Solo deberías usar nest_asyncio como un recurso de compatibilidad limitado por razones de legado, no como opción predeterminada, ya que puede ocultar problemas de diseño y errores de concurrencia.
¿Cómo puedo evitar bloquear el event loop en una celda de notebook?
Evita usar I/O síncrono bloqueante como requests.get(); en su lugar, usa librerías asíncronas como aiohttp, httpx, o envuelve las llamadas síncronas en asyncio.to_thread().