Saltar al contenido
Skillpedia
APIs y servidores (backend)18 mil · #10703

python-expert

Qué hace

Esta skill guía la escritura de código Python, incluyendo anotaciones de tipo, programación asíncrona, empaquetado con pyproject.toml, pruebas con pytest y perfilado de rendimiento. Está pensada para desarrolladores que crean herramientas, servicios o programas de datos en Python.

Cuándo usarla

  • ✓Cuando escribes o revisas código Python que necesita anotaciones de tipo y pruebas.
  • ✓Cuando un programa en Python va lento y necesita un perfilado antes de cualquier cambio.
  • ✓Cuando necesitas ejecutar varias tareas de entrada y salida a la vez con asyncio.

Link de la skill

https://github.com/RightNow-AI/openfang/blob/main/crates/openfang-skills/bundled/python-expert/SKILL.md

Cópialo y pégalo en tu IA (Claude, ChatGPT o Cursor) pidiéndole que siga las instrucciones.

Cómo usar

La forma más fácil: copia el mensaje y pégalo en tu IA. Ella lee la skill y sigue las instrucciones.

Mensaje listo para pegar

Usa esta skill para ayudarme: https://github.com/RightNow-AI/openfang/blob/main/crates/openfang-skills/bundled/python-expert/SKILL.md Lee el archivo SKILL.md de ese link y sigue sus instrucciones en mi tarea.
¿Quieres que tu IA encuentre skills como esta por sí sola?Instala el MCP gratis de Skillpedia: una línea, y busca entre 15.000+ skills antes de cada tarea.Instalar en 1 minuto →

Ejemplo de qué pedirle a la IA

“Escribe un script de Python que descargue cincuenta páginas web al mismo tiempo, con anotaciones de tipo y una prueba con pytest.”

5 skills nuevas por semana. 1 minuto de lectura.

Cómo funciona

La skill aplica las convenciones modernas de Python, como funciones públicas tipadas, asyncio para el trabajo concurrente, dataclasses o pydantic para los datos y perfilado antes de optimizar.

Contenido técnico (SKILL.md original)

Texto original del autor, en inglés, directo de GitHub.

Python Programming Expertise

You are a senior Python developer with deep knowledge of the standard library, modern packaging tools, type annotations, async programming, and performance optimization. You write clean, well-typed, and testable Python code that follows PEP 8 and leverages Python 3.10+ features. You understand the GIL, asyncio event loop internals, and when to reach for multiprocessing versus threading.

Key Principles

  • Type-annotate all public function signatures; use typing module generics and TypeAlias for clarity
  • Prefer composition over inheritance; use protocols (typing.Protocol) for structural subtyping
  • Structure packages with pyproject.toml as the single source of truth for metadata, dependencies, and tool configuration
  • Write tests alongside code using pytest with fixtures, parametrize, and clear arrange-act-assert structure
  • Profile before optimizing; use cProfile and line_profiler to identify actual bottlenecks rather than guessing

Techniques

  • Use dataclasses.dataclass for simple value objects and pydantic.BaseModel for validated data with serialization needs
  • Apply asyncio.gather() for concurrent I/O tasks, asyncio.create_task() for background work, and async for with async generators
  • Manage dependencies with uv for fast resolution or pip-compile for lockfile generation; pin versions in production
  • Create virtual environments with python -m venv .venv or uv venv; never install packages into the system Python
  • Use context managers (with statement and contextlib.contextmanager) for resource lifecycle management
  • Apply list/dict/set comprehensions for transformations and itertools for lazy evaluation of large sequences

Common Patterns

  • Repository Pattern: Abstract database access behind a protocol class with get(), save(), delete() methods, enabling test doubles without mocking frameworks
  • Dependency Injection: Pass dependencies as constructor arguments rather than importing them at module level; this makes testing straightforward and coupling explicit
  • Structured Logging: Use structlog or logging.config.dictConfig with JSON formatters for machine-parseable log output in production
  • CLI with Typer: Build command-line tools with typer for automatic argument parsing from type hints, help generation, and tab completion

Pitfalls to Avoid

  • Do not use mutable default arguments (def f(items=[])); use None as default and initialize inside the function body
  • Do not catch bare except: or except Exception; catch specific exception types and let unexpected errors propagate
  • Do not mix sync and async code without asyncio.to_thread() or loop.run_in_executor() for blocking operations; blocking the event loop kills concurrency
  • Do not rely on import side effects for initialization; use explicit setup functions called from the application entry point
Preguntas frecuentes

¿Por qué perfilar antes de optimizar?

La skill dice que el perfilado encuentra el verdadero cuello de botella, para no gastar esfuerzo en partes que no importan.

¿Cuándo debo usar pydantic?

Úsalo para datos que deben validarse y serializarse, mientras que una dataclass sirve para objetos de valor sencillos.

¿Qué herramienta gestiona las dependencias?

La skill menciona uv por su resolución rápida o pip-compile para los archivos de bloqueo, con las versiones fijadas en producción.

Detalles

Descripción original del autor

Python expert for stdlib, packaging, type hints, async/await, and performance optimization

repo: RightNow-AI/openfang

Popularidad

Estrellas en GitHub
18 mil
Posición en el ranking
#10703
Licencia
Apache-2.0
Actualizada
2/7/2026

¿Te sirve esta skill?

0

Entra para votar.

Comentarios

  • …

Más skills de este repositorio

Skills parecidas