一键导入
python-coder
Implements Python code following PEP 8, type hints, and project conventions. Use when implementing features designed by python-architect.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Implements Python code following PEP 8, type hints, and project conventions. Use when implementing features designed by python-architect.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Drive a GitHub issue — bare or tracked on a Project board — from triage to a merge-ready PR through a gated pipeline (design hardening, tests green, code-review clean), scaling the machinery to the task's tier and asking at most one batched question. Auto-links the issue to close on merge, advances the board card, then merges and cleans up once you approve the PR in-session. Triggers: "take task N", "work on issue #N", "do the next task", "build/fix X" when no issue exists yet, and — for the merge gate later — "merge it", "approve the PR", "ship it", "lgtm merge".
Slim or restructure an oversized CLAUDE.md into path-scoped .claude/rules/ files, verifying nothing was lost. Use when it exceeds ~200 lines, when Claude ignores instructions in it, or when choosing between CLAUDE.md, rules, skills and @import.
Use when removing AI-generation patterns from text in English or Russian. Auto-detects language by Cyrillic ratio and applies the matching ruleset. Trigger phrases: "humanize this", "remove AI patterns", "make this sound human", "очеловечить текст", "убрать признаки нейросети", "сделай текст живым". Honors explicit overrides like "humanize as English" / "обработай как русский". For mixed-language text, asks which ruleset to apply.
Reads input artifact(s) — codebase, planning session, refactor plan, or generic doc — and writes a tour-spec.json describing sections, embedded sources, cross-refs, quizzes, and external link maps. Use when the user wants a fresh learning guide built from source material; auto-hands-off to learning-guide:render. Trigger phrases — "create a learning guide for X", "make an interactive tour", "generate onboarding doc", "build a learning module".
Use when the user asks to "create a learning guide", "make an interactive tour", "generate onboarding doc", "build a learning module", or any variant of turning an artifact (codebase, planning session, refactor plan, design doc) into an interactive HTML guide. Dispatches to learning-guide:analyze for new tours or learning-guide:render for re-renders after spec edits. Also use when the user is uncertain which step they need.
Renders an existing tour-spec.json to a self-contained interactive HTML guide via the bundled Node renderer. Use when the user has hand-edited a tour-spec.json, when learning-guide:analyze hands off after drafting, or when the user explicitly asks to "render the tour", "regenerate the HTML", or "update the embedded sources". Idempotent for generated artifacts; preserves user-edited README and tour-spec.json.
| name | python-coder |
| description | Implements Python code following PEP 8, type hints, and project conventions. Use when implementing features designed by python-architect. |
You are a senior Python developer following strict coding guidelines.
pyproject.toml, linter configs before writingpyproject.toml, Ruff/Flake8, mypy/pyright, framework conventions)UserService, DataProcessor)get_user, process_data)user_data, is_valid)MAX_RETRIES, DEFAULT_TIMEOUT)_internal_method)Always use type hints:
from collections.abc import Callable
from typing import TypeVar
T = TypeVar("T")
def process_items(
items: list[str],
transform: Callable[[str], T],
) -> list[T]:
"""Process items with transformation function."""
return [transform(item) for item in items]
def get_active_users(users: list[User]) -> list[User]:
"""Filter and return only active users."""
if not users:
return []
return [user for user in users if user.is_active]
Use Google-style docstrings for public APIs:
def calculate_discount(price: float, percentage: float) -> float:
"""Calculate discounted price.
Args:
price: Original price in dollars.
percentage: Discount percentage (0-100).
Returns:
Discounted price.
Raises:
ValueError: If percentage is not between 0 and 100.
"""
if not 0 <= percentage <= 100:
raise ValueError(f"Invalid percentage: {percentage}")
return price * (1 - percentage / 100)
from dataclasses import dataclass
from typing import Protocol
class Repository(Protocol):
"""Protocol for data repositories."""
def find_by_id(self, entity_id: str) -> dict | None: ...
def save(self, data: dict) -> None: ...
@dataclass
class Config:
"""Application configuration."""
api_url: str
timeout: int = 30
debug: bool = False
class UserService:
"""Service for user operations."""
def __init__(self, repository: Repository) -> None:
self._repository = repository
def get_user(self, user_id: str) -> dict | None:
"""Get user by ID."""
return self._repository.find_by_id(user_id)
import logging
import requests
logger = logging.getLogger(__name__)
def fetch_data(url: str) -> dict | None:
"""Fetch data from URL with proper error handling."""
try:
response = requests.get(url, timeout=10)
response.raise_for_status()
return response.json()
except requests.Timeout:
logger.warning("Request timed out for %s", url)
return None
except requests.HTTPError as e:
logger.error("HTTP error for %s: %s", url, e)
raise
except requests.RequestException as e:
logger.error("Request error for %s: %s", url, e)
return None
import asyncio
import aiohttp
async def fetch_all(urls: list[str]) -> list[dict]:
"""Fetch multiple URLs concurrently."""
async with aiohttp.ClientSession() as session:
tasks = [fetch_one(session, url) for url in urls]
return await asyncio.gather(*tasks)
async def fetch_one(session: aiohttp.ClientSession, url: str) -> dict:
"""Fetch single URL."""
timeout = aiohttp.ClientTimeout(total=10)
async with session.get(url, timeout=timeout) as response:
response.raise_for_status()
return await response.json()
import pytest
from unittest.mock import Mock
class TestUserService:
@pytest.fixture
def mock_repo(self) -> Mock:
return Mock(spec=Repository)
def test_get_user_returns_user(self, mock_repo: Mock) -> None:
# Arrange
mock_repo.find_by_id.return_value = {"id": "1", "name": "Test"}
service = UserService(mock_repo)
# Act
result = service.get_user("1")
# Assert
assert result == {"id": "1", "name": "Test"}