con un clic
python-development
Develop python server backend and cli tools
Instalar con Codex o Claude Copia este prompt, pégalo en Codex, Claude u otro asistente, y deja que revise la página de la skill y la instale por ti.
Menú
Develop python server backend and cli tools
Instalar con Codex o Claude Copia este prompt, pégalo en Codex, Claude u otro asistente, y deja que revise la página de la skill y la instale por ti.
Basado en la clasificación ocupacional SOC
Use when creating pages under src/app/(site)/(authorized)/admin/. Covers list/detail/edit/create page patterns with DataTable/DataView/DataForm, repositories under src/repositories/, request schemas under src/requests/admin/, and AdminPageHeader breadcrumbs.
Use when modifying Better Auth + Prisma authentication: src/libraries/auth.ts, src/libraries/auth-client.ts, src/proxy.ts, src/services/auth_service.ts, auth-related actions.ts, or prisma/schema.prisma auth models (User/Session/Account/Verification). Covers session helpers, URL/secret env resolution, DB TLS, and PUBLIC_PATHS.
Use when creating or modifying files under src/repositories/, src/models/, or src/requests/. Covers BaseRepository inheritance (Prisma/API/Local/Airtable/Dify), Zod schema placement, and separation between repository and schema files.
Use when changing this template's mail delivery backend, reviewing email env setup, switching between `ses` and `smtp`, or adding a new provider such as Resend, SendGrid, Postmark, or Mailgun. Covers EMAIL_PROVIDER routing, EMAIL_FROM priority, dynamic import for Node-only SDKs, and test coverage for both email.test.ts and Better Auth callback smoke.
Use when adding or changing translations in messages/ja.json or messages/en.json, using getTranslations/useTranslations, or updating next-intl configuration under src/i18n/. Covers message key hierarchy, Server/Client Component APIs, dynamic and rich-text patterns, and JSON duplicate-key pitfalls.
Use when adding or modifying pages under src/app, or components under src/components (atoms/molecules/organisms) in this Next.js App Router project. Covers Server/Client Component boundary, Atomic Design placement, Server Actions in actions.ts, URL-based state management, sidebar active-state, and shadcn-only atoms rule.
| name | python-development |
| description | Develop python server backend and cli tools |
目的
| 目的 | ツール | 運用ルール |
|---|---|---|
| 高速・再現性・シンプル | uv (https://github.com/astral-sh/uv) | - 依存管理は pyproject.toml + uv.lock をソース管理- 新規追加は uv pip install <pkg> -q- CI では uv pip sync -q でロックファイルに完全同期- pip / poetry / pipenv の混在禁止 - グローバルインストールは行わず venv or direnv に統一 |
| セキュリティ | uv + safety | uv pip audit を週次 CI に追加し脆弱パッケージを検出 |
Why uv?
uv.lock) ― Dev/CI 共通で完全一致| 目的 | 推奨ツール | 備考 |
|---|---|---|
| 自動整形 | Black | pyproject.toml で line-length 100 |
| インポート並び替え | isort | Black と互換モード |
| 静的解析 & Lint | Ruff or Flake8 | PEP 8 違反・潜在バグ検出 |
| 型チェック | mypy | strict = True を CI に必須 |
Type Hint は必須 — 関数・メソッド・クラス属性・変数すべてに付与する。
from collections.abc import Sequence
def calculate_mean(values: Sequence[float]) -> float:
total: float = sum(values)
return total / len(values)
from __future__ import annotations をモジュール先頭に追加py.typed を要求)| 対象 | 規則 | 例 |
|---|---|---|
| 変数 / 関数 / メソッド | snake_case | user_id, process_data() |
| クラス | PascalCase | DataLoader |
| モジュール / パッケージ | snake_case | data_utils.py |
| 定数 | UPPER_SNAKE_CASE | MAX_CONNECTIONS = 10 |
略語も小文字に崩して統一 ―
url_parser(NG:URLParser)
空行でブロック分けし isort で自動整列。
import datetime
import pathlib
import requests
from mypkg.core import settings
| ルール | 説明 |
|---|---|
| インデント | 4 スペース |
| 1 行長 | 100 文字 (docstring は 72) |
| f-strings | 文字列結合は f-string。一貫性優先 |
| 空行 | トップレベル定義間 2 行、メソッド間 1 行 |
def fetch_user(user_id: str) -> "User":
"""ユーザー情報を取得する。
Args:
user_id: 取得対象ユーザーの ID。
Returns:
取得したユーザーオブジェクト。
Raises:
UserNotFoundError: 指定 ID が存在しない場合。
"""
| ガイドライン | 理由 |
|---|---|
| 1 関数 = 1 責務 (SRP) | テスト容易・再利用性向上 |
| 引数 ≤ 5 | 複雑化抑止。多い場合は dataclass で束ねる |
| デフォルト引数に mutable 不可 | list, dict を直接使わない |
except Exception の多用禁止logger.exception でスタックトレースを保持def add_item(value: str, items: list[str] | None = None) -> list[str]:
items = items or []
items.append(value)
return items
| 原則 | 具体策 |
|---|---|
| 計測してから最適化 | cProfile, perf_counter |
| データ構造の選択 | dict, set で O(1) アクセス |
| I/O を非同期化 | asyncio, trio |
| CPU バウンド並列化 | multiprocessing |
| 項目 | 推奨 |
|---|---|
| フレームワーク | pytest |
| カバレッジ | pytest-cov で 90 % 以上 |
| モック | pytest-mocker / unittest.mock |
pre-commit: black → isort → ruff → mypy
GitHub Actions:
uv pip sync → Lint → 型チェック → テストRelease: セマンティックバージョニング & 自動リリースノート
uv pip audit + Dependabot