python-typing
Apply Python type annotations effectively — mypy/pyright configuration, common patterns, generic types, and stub guidance
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Apply Python type annotations effectively — mypy/pyright configuration, common patterns, generic types, and stub guidance
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
Set up and manage GitHub Actions workflows that use Copilot coding agents for automated PR handling and issue resolution
Inspect active GitHub Actions workflows before commit or push, run matching local checks for staged or unpushed files, ask which missing tools to install via askQuestions, and fix in-scope issues so the Commit agent can proceed.
Write a commit message following the Conventional Commits specification with scope and body
Create an Architectural Decision Record (ADR) to document a significant design or technology choice
Audit VS Code extensions against the current project stack and recommend keep/add/remove actions
Diagnose and fix a failing CI pipeline or GitHub Actions workflow
| name | python-typing |
| description | Apply Python type annotations effectively — mypy/pyright configuration, common patterns, generic types, and stub guidance |
| compatibility | >=1.4 |
Skill metadata: version "1.0"; license MIT; tags [python, typing, mypy, pyright, type-checking]; recommended tools [codebase, runCommands, editFiles].
from __future__ import annotations for forward references (Python 3.7+).list[str], dict[str, int]) over typing.List, typing.Dict (Python 3.9+).X | None instead of Optional[X] (Python 3.10+).def process_items(items: list[str], limit: int = 10) -> dict[str, int]:
...
# Python 3.10+
def find_user(user_id: int) -> User | None:
...
# Python 3.7–3.9
from __future__ import annotations
def find_user(user_id: int) -> User | None:
...
from typing import TypedDict
class UserProfile(TypedDict):
name: str
email: str
age: int | None
from typing import Protocol
class Serializable(Protocol):
def to_json(self) -> str: ...
from typing import TypeVar
T = TypeVar("T")
def first(items: list[T]) -> T | None:
return items[0] if items else None
[tool.mypy]
python_version = "3.12"
strict = true
warn_return_any = true
warn_unused_configs = true
disallow_untyped_defs = true
[[tool.mypy.overrides]]
module = "tests.*"
disallow_untyped_defs = false
[tool.pyright]
pythonVersion = "3.12"
typeCheckingMode = "standard"
reportMissingTypeStubs = "warning"
types-* packages on PyPI (e.g., types-requests).py.typed marker file to mark a package as typed..pyi files alongside source files.self and cls — not needed (mypy and pyright infer them).Any — minimize its use; it defeats the purpose of type checking.None as default and assign in the body.TYPE_CHECKING guard:from __future__ import annotations
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from .models import User
Any usage is intentional and justifiedtypes-*, .pyi, py.typed) matches dependency reality