python-services skill
✓ 인증됨Python 기반의 CLI 도구, 비동기 병렬 워크로드, FastAPI 백엔드 서비스 및 백그라운드 작업 시스템 구축을 위한 패턴을 제공합니다.
- GitHub 스타
- 36
- 파일
- 2
- 마지막 커밋
- 2026년 11월 11일
- 라이선스
- MIT
- 허용된 도구
- —
python-services skill은 무엇을 하나요?
Python 기반의 CLI 도구, 비동기 병렬 워크로드, FastAPI 백엔드 서비스 및 백그라운드 작업 시스템 구축을 위한 패턴을 제공합니다.
skill의 SKILL.md에서 생성된 요약입니다.
python-services skill 정보
Python 기반 인프라를 구축하는 개발자는 이 SKILL을 사용하여 CLI 도구, 백엔드 서비스 및 비동기 워크로드를 위한 표준화된 패턴을 구현할 수 있습니다. 의존성 관리를 위한 uv, 린팅을 위한 ruff, 타입 체크를 위한 ty와 같은 최신 도구에 대한 구체적인 가이드를 제공합니다. 에이전트가 이 SKILL을 로드하면 repository 패턴, SQLAlchemy AsyncSession, 설정을 위한 Pydantic settings를 사용하는 FastAPI 애플리케이션용 구조화된 코드를 생성할 수 있습니다.
또한 I/O 바운드 작업을 위한 asyncio와 CPU 바운드 연산을 위한 multiprocessing을 포함한 복잡한 실행 모델을 다룹니다. Celery 또는 Dramatiq를 사용하는 백그라운드 작업 시스템 템플릿을 제공하며, tenacity를 활용한 멱등성 및 재시도 로직을 강조합니다. 프로덕션 환경에 적합한 시스템을 위해 structlog와 Prometheus를 통한 관측성 지침을 포함하여, 에이전트가 분산 트레이싱 및 구조화된 로깅이 가능한 코드를 생성하도록 지원합니다.
agent가 수행할 수 있는 작업
- 1비동기 I/O 동시성 구현요청 속도를 제한하면서 여러 개의 동시 네트워크 호출을 처리하는 코드를 작성합니다.
skill의 SKILL.md를 기반으로 작성되었습니다. 모든 사용 사례는 해당 문서의 인용구와 대조 확인되었습니다.
python-services skill 설치 방법
각 명령은 skill 폴더를 클라이언트의 skills 디렉터리에 복사합니다. 클라이언트를 재시작하거나 새 세션을 시작하여 로드하세요.Claude Code에 python-services skill 설치
~/.claude/skills/python-services/SKILL.md
$ npx degit iliaal/whetstone/distillery/generated-skills/python-services ~/.claude/skills/python-servicesClaude Code (project)에 python-services skill 설치
.claude/skills/python-services/SKILL.md
$ npx degit iliaal/whetstone/distillery/generated-skills/python-services .claude/skills/python-servicesCodex에 python-services skill 설치
~/.agents/skills/python-services/SKILL.md
$ npx degit iliaal/whetstone/distillery/generated-skills/python-services ~/.agents/skills/python-servicesGemini CLI에 python-services skill 설치
~/.gemini/skills/python-services/SKILL.md
$ npx degit iliaal/whetstone/distillery/generated-skills/python-services ~/.gemini/skills/python-servicesClaude.ai에 python-services skill 설치
npx degit iliaal/whetstone/distillery/generated-skills/python-services python-services && zip -r python-services.zip python-services # claude.ai → Customize → Skills → + → Create skill → Upload a skill → python-services.zip
자동 검사
2026년 11월 14일에 실행됨전체 보고서 →자동 검사를 통과했습니다. 보안 감사는 아닙니다. 에이전트가 실행하기 전에 스크립트를 읽어 보세요. 검사 방식
- 소스 저장소 연결 및 접근 가능iliaal/whetstone/distillery/generated-skills/python-services is public and reachablegithub.com/iliaal/whetstone/tree/HEAD/distillery/generated-s ↗통과
- 오픈 소스 라이선스 (OSI)MITspdx.org/licenses/MIT.html ↗통과
- 최근 1년 내 커밋 또는 릴리스Last commit 2026-11-11github.com/iliaal/whetstone/commits ↗통과
- 스크립트에 다운로드 후 실행이나 자격 증명 탈취가 없음No scripts in the skill folder통과
- SKILL.md에 숨겨진 지침 없음No override phrases, safeguard switches, credential requests or hidden charactersgithub.com/iliaal/whetstone/blob/HEAD/distillery/generated-s ↗통과
- 사전 허용 도구가 제한됨No pre-approved tools; the agent asks before using onegithub.com/iliaal/whetstone/blob/HEAD/distillery/generated-s ↗통과
- SKILL.md가 Agent Skills 형식을 따름Valid name and description; says when to use it; 159 linesgithub.com/iliaal/whetstone/blob/HEAD/distillery/generated-s ↗통과
SKILL.md
GitHub에서 보기Python Services & CLI
Modern Tooling
| Tool | Replaces | Purpose |
|---|---|---|
| uv | pip, virtualenv, pyenv, pipx | Package/dependency management |
| ruff | flake8, black, isort | Linting + formatting |
| ty | mypy, pyright | Type checking (Astral, faster) |
uv init --package myprojectfor distributable packages,uv initfor appsuv add <pkg>,uv add --group dev <pkg>, never edit pyproject.toml deps manuallyuv run <cmd>instead of activating venvsuv.lockgoes in version control- Use
[dependency-groups](PEP 735) for dev/test/docs, not[project.optional-dependencies] - PEP 723 inline metadata for standalone scripts with deps
ruff check --fix . && ruff format .for lint+format in one pass
CLI Tools
Entry points in pyproject.toml:
[project.scripts]
my-tool = "my_package.cli:main"
Click (recommended for complex CLIs):
import click
@click.group()
@click.version_option()
def cli(): ...
@cli.command()
@click.argument("name")
@click.option("--count", default=1, type=int)
def greet(name: str, count: int):
for _ in range(count):
click.echo(f"Hello, {name}!")
def main():
cli()
argparse for simple CLIs — subparsers for subcommands, parser.add_argument("--output", "-o").
Use src/ layout. Include py.typed for type hints. importlib.resources.files() for package data access.
Parallelism
| Workload | Approach |
|---|---|
| Many concurrent I/O calls | asyncio (gather, create_task) |
| CPU-bound computation | multiprocessing.Pool or concurrent.futures.ProcessPoolExecutor |
| Mixed I/O + CPU | asyncio.to_thread() to offload blocking work |
| Simple scripts, few connections | Stay synchronous |
Key rule: Stay fully sync or fully async within a call path.
asyncio patterns:
asyncio.gather(*tasks)for concurrent I/O — usereturn_exceptions=Truefor partial failure toleranceasyncio.Semaphore(n)to limit concurrency (rate limiting external APIs)asyncio.wait_for(coro, timeout=N)for timeoutsasyncio.Queuefor producer-consumerasyncio.Lockwhen coroutines share mutable state- Never block the event loop:
asyncio.to_thread(sync_fn)for sync libs,aiohttp/httpx.AsyncClientfor HTTP - Handle
CancelledError— always re-raise after cleanup - Async generators (
async for) for streaming/pagination
multiprocessing for CPU-bound:
from concurrent.futures import ProcessPoolExecutor
with ProcessPoolExecutor(max_workers=4) as pool:
results = list(pool.map(cpu_task, items))
FastAPI Services
Project structure:
app/
├── api/v1/endpoints/ # Route handlers
├── core/ # config.py, security.py, database.py
├── models/ # SQLAlchemy models
├── schemas/ # Pydantic request/response
├── services/ # Business logic
├── repositories/ # Data access (generic CRUD base)
└── main.py # Lifespan, middleware, router includes
Lifespan for startup/shutdown: @asynccontextmanager async def lifespan(app):
Configuration — pydantic_settings.BaseSettings with model_config = {"env_file": ".env"}. Required fields = no default (fails fast at boot). env_nested_delimiter = "__" for grouped config. secrets_dir for Docker/K8s mounted secrets.
Dependency injection — Depends(get_db) for sessions, Depends(get_current_user) for auth. Override in tests: app.dependency_overrides[get_db] = mock_db.
Async DB — SQLAlchemy AsyncSession with asyncpg. Session-per-request via async with AsyncSessionLocal() as session: yield session.
Repository pattern — Generic BaseRepository[ModelType, CreateSchema, UpdateSchema] with get/get_multi/create/update/delete. Service layer holds business logic, routes stay thin.
Background Jobs
- Return job ID immediately, process async. Client polls
/jobs/{id}for status - Celery:
@app.task(bind=True, max_retries=3, autoretry_for=(ConnectionError,))— exponential backoff:raise self.retry(countdown=2**self.request.retries * 60) - Alternatives: Dramatiq (modern Celery), RQ (simple Redis), cloud-native (SQS+Lambda, Cloud Tasks)
- Idempotency is mandatory — tasks may retry. Use idempotency keys for external calls, check-before-write, upsert patterns
- Dead letter queue for permanently failed tasks after max retries
- Task workflows:
chain(a.s(), b.s())for sequential,group(...)for parallel,chord(group, callback)for fan-out/fan-in
Resilience
Retries with tenacity:
from tenacity import retry, stop_after_attempt, wait_exponential_jitter, retry_if_exception_type
@retry(
retry=retry_if_exception_type((ConnectionError, TimeoutError)),
stop=stop_after_attempt(5) | stop_after_delay(60),
wait=wait_exponential_jitter(initial=1, max=30),
before_sleep=log_retry_attempt,
)
def call_api(url: str) -> dict: ...
- Retry only transient errors: network, 429/502/503/504. Never retry 4xx (except 429), auth errors, validation errors
- Every network call needs a timeout
@fail_safe(default=[])decorator for non-critical paths — return cached/default on failure- Stack decorators:
@traced @with_timeout(30) @retry(...)— separate infra from business logic
Observability
- structlog for JSON structured logging. Configure once at startup with
JSONRenderer,TimeStamper,merge_contextvars - Correlation IDs — generate at ingress (
X-Correlation-IDheader), bind tocontextvars, propagate to downstream calls - Log levels: DEBUG=diagnostics, INFO=operations, WARNING=anomalies handled, ERROR=failures needing attention. Never log expected behavior at ERROR
- Prometheus metrics — track latency (Histogram), traffic (Counter), errors (Counter), saturation (Gauge). Keep label cardinality bounded (no user IDs)
- OpenTelemetry for distributed tracing across services
Discipline
- For non-trivial changes, pause and ask: "is there a more elegant way?" Skip for obvious fixes.
- Simplicity first — every change as simple as possible, impact minimal code
- Only touch what's necessary — avoid introducing unrelated changes
- No hacky workarounds — if a fix feels wrong, step back and implement the clean solution
Error Handling
- Validate inputs at boundaries before expensive ops. Report all errors at once when possible
- Use specific exceptions:
ValueError,TypeError,KeyError, not bareException raise ServiceError("upload failed") from e— always chain to preserve debug trail- Convert external data to domain types (enums, Pydantic models) at system boundaries
- Batch processing:
BatchResult(succeeded={}, failed={})— don't let one item abort the batch - Pydantic
BaseModelwithfield_validatorfor complex input validation
이 스킬의 파일
2python-services skill 질문
Claude Code에 python-services skill을 어떻게 설치하나요?
npx degit iliaal/whetstone/distillery/generated-skills/python-services ~/.claude/skills/python-services를 실행합니다. Claude Code는 ~/.claude/skills(모든 프로젝트) 또는 .claude/skills(한 프로젝트)에서 skills를 로드하며, 설명이 작업과 일치할 때 skill을 사용합니다.
python-services skill을 사용할 수 있는 클라이언트는 무엇인가요?
Agent Skills 형식을 읽는 모든 클라이언트(Claude Code, Codex, Gemini CLI, claude.ai(ZIP으로 업로드))가 사용할 수 있습니다. skill 내 스크립트는 클라이언트가 코드 실행을 허용하는 경우에만 실행됩니다.