一键导入
python-development
Modern Python development and production best practices. Use for Python projects, APIs, data processing, or automation scripts.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Modern Python development and production best practices. Use for Python projects, APIs, data processing, or automation scripts.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Find bugs, security vulnerabilities, and code quality issues in local branch changes. Use when asked to review changes, find bugs, security review, or audit code on the current branch.
Design robust, scalable database schemas for SQL and NoSQL databases. Provides normalization guidelines, indexing strategies, migration patterns, constraint design, and performance optimization. Ensures data integrity, query performance, and maintainable data models.
Four-phase debugging framework that ensures root cause investigation before attempting fixes. Never jump to solutions. Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes.
Design, organize, and manage Helm charts for templating and packaging Kubernetes applications with reusable configurations. Use when creating Helm charts, packaging Kubernetes applications, or implementing templated deployments.
Inspect pod logs, analyze resource quotas, trace network policies, check deployment rollout status, and run cluster health checks for Kubernetes. Use this skill when diagnosing Kubernetes cluster issues, debugging failing pods, investigating network connectivity problems, analyzing resource usage, troubleshooting deployments, or performing cluster health checks.
Create production-ready Kubernetes manifests for Deployments, Services, ConfigMaps, and Secrets following best practices and security standards. Use when generating Kubernetes YAML manifests, creating K8s resources, or implementing production-grade Kubernetes configurations.
| name | python-development |
| description | Modern Python development and production best practices. Use for Python projects, APIs, data processing, or automation scripts. |
my-project/
├── src/
│ └── my_project/
│ ├── __init__.py
│ ├── main.py
│ └── utils.py
├── tests/
│ ├── __init__.py
│ └── test_main.py
├── pyproject.toml
├── README.md
├── venv/
└── .gitignore
Tests and code should be ran from a venv, not from the global python install when working in projects. Most projects should have an existing venv at either /venv or .venv.
You may find it useful to create a venv for your work. You will need to remove the old one and create a new one based one the projects python version
uv venv # Creates .venv in current directory
uv venv --python 3.12 # Specify Python version
For existing projects with a pyproject.toml, you can ensure dependencies are there like so
uv sync
For projects without a pyproject.toml, refer to the requirements.txt file(s) in the repo:
uv pip install -r requirements.txt
To add dependencies
uv add pytest # Add pytest to project
uv add --with requests # Temporary dependency for one invocation
uv run python script.py # Run Python scripts
uv run pytest # Run pytest
uv run python -m pytest # Alternative
uv run example-cli # Run installed CLI tools
More traditional setups may require you to run things from inside the venv:
uv sync
source .venv/bin/activate
pytest # Run directly after activation
python script.py
For brand new projects, always initialize using uv, default to python3.12 unless user specified
uv init --python <version>
uv init --python 3.12
from typing import TypeVar, Generic
from collections.abc import Sequence
T = TypeVar('T')
def process_items(items: Sequence[str]) -> list[str]:
return [item.upper() for item in items]
class Repository(Generic[T]):
def get(self, id: int) -> T | None: ...
def save(self, item: T) -> T: ...
import asyncio
from collections.abc import AsyncIterator
async def fetch_all(urls: list[str]) -> list[dict]:
async with aiohttp.ClientSession() as session:
tasks = [fetch_one(session, url) for url in urls]
return await asyncio.gather(*tasks)
async def stream_data() -> AsyncIterator[bytes]:
async with aiofiles.open('large_file.txt', 'rb') as f:
async for chunk in f:
yield chunk
Imports should usually be on separate lines:
# Correct:
import os
import sys
# Correct:
from subprocess import Popen, PIPE
# Wrong:
import sys, os
# Wrong
from subprocess import Popen
from subprocess import PIPE
Imports are always put at the top of the file, just after any module comments and docstrings, and before module globals and constants.
Imports should be grouped in the following order, and there should be blank line between each group of imports:
Perfer absolute imports:
import mypkg.sibling
from mypkg import sibling
from mypkg.sibling import example
Explicit relative imports are situationally ok, where using absolute imports would be unnecessarily verbose:
from . import sibling
from .sibling import example
Code should be devloped in a modular way, such that writing unit tests and mocks for the code is quite easy. This means that testing should always be kept in mind when writing code, and avoid patterns that are difficult to test.
ruff for linting and formatting. Always follow pep8 style guidelines.pathlib.Path over os.pathasyncio for I/O-bound operationscontextlib.asynccontextmanager for async resourcespydantic