본문으로 건너뛰기
Skillpedia
API 및 서버 (백엔드)18k · #10703

python-expert

하는 일

이 스킬은 타입 힌트, 비동기 프로그래밍, pyproject.toml을 쓴 패키징, pytest 테스트, 성능 프로파일링을 포함해 Python 코드를 작성하는 방법을 안내합니다. Python 도구, 서비스, 데이터 프로그램을 만드는 개발자를 위한 스킬입니다.

사용하는 경우

  • ✓타입 힌트와 테스트가 필요한 Python 코드를 작성하거나 검토할 때.
  • ✓Python 프로그램이 느려서 어떤 변경 전에 프로파일링이 필요할 때.
  • ✓asyncio로 여러 입출력 작업을 동시에 실행해야 할 때.

스킬 링크

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

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/RightNow-AI/openfang/blob/main/crates/openfang-skills/bundled/python-expert/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“50개의 웹 페이지를 동시에 가져오는 Python 스크립트를 작성해 주세요. 타입 힌트와 pytest 테스트를 포함해 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

스킬은 공개 함수에 타입을 붙이기, 동시 작업을 위한 asyncio, 데이터에 dataclass나 pydantic 쓰기, 최적화 전 프로파일링 같은 최신 Python 관례를 적용합니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 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
자주 묻는 질문

최적화 전에 왜 프로파일링하나요?

스킬은 프로파일링이 실제 병목을 찾아서, 중요하지 않은 부분에 노력을 쓰지 않게 해 준다고 말합니다.

pydantic은 언제 쓰나요?

검증하고 직렬화해야 하는 데이터에 쓰며, 단순한 값 객체에는 dataclass가 맞습니다.

어떤 도구로 의존성을 관리하나요?

빠른 해석을 위한 uv나 잠금 파일을 위한 pip-compile을 언급하며, 운영에서는 버전을 고정합니다.

상세 정보

작성자의 원본 설명

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

repo: RightNow-AI/openfang

인기도

GitHub 스타
18k
순위
#10703
라이선스
Apache-2.0
업데이트
2026. 7. 2.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬