python-conventions

A set of rules for writing, testing, packaging, and securing Python 3.10 or newer code.

In plain words
What is it for?
Use it when creating or reviewing Python applications and packages, including type checking, async input/output, tests, documentation, packaging, and security scans.
Why use it?
It reduces errors from missing type information, weak input handling, blocking asynchronous code, poor logging, and vulnerable dependencies.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/goldziher/ai-rulez/python-conventions
Any agent
npx skills add Goldziher/ai-rulez --skill python-conventions
Clone the repo
git clone --depth 1 https://github.com/Goldziher/ai-rulez

Made for: Claude Code, Codex.

Per session 45 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 382 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00045 $0.00382
Opus 5 $0.00023 $0.00191
Sonnet 5 $0.00009 $0.00076
Haiku 4.5 $0.00005 $0.00038

Measured 3d ago against content hash c5869959dbe9, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

python-conventions scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

internal/builtins/languages/python/skills/python-conventions/SKILL.md · 18 lines

What it actually says

  • Python 3.10+, type hints on all public APIs, avoid Any — use precise types, generics, or typing.Protocol.
  • Formatting/linting: a fast linter/formatter (e.g., Ruff), zero warnings; strict static type checking (e.g., mypy or pyright). Security: a SAST tool (e.g., Bandit).
  • Testing: pytest with function-based tests, pytest-cov (80%+), hypothesis for property-based.
  • Error handling: specific exceptions only, never bare except:, contextlib.suppress for intentional ignoring.
  • Dataclasses or Pydantic for structured data — avoid raw dicts for known schemas.
  • pathlib.Path over os.path for filesystem operations. Google-style docstrings on public APIs.
  • Async: async/await for I/O, never mix blocking and async, asyncio.gather() for concurrency.
  • Package management: a fast, lockfile-based package manager (e.g., uv) with the lockfile committed, build with a PEP 517 backend (e.g., maturin or hatchling).
  • Security: pip-audit for dependency CVE scanning. Zero tolerance for critical/high vulnerabilities.
  • Logging: structured logging (key=value / JSON) — never f-strings in log calls.
  • Pattern matching (match/case) for multi-branch type dispatch (3.10+).
  • Anti-patterns: mutable default args, import *, global state, time.sleep in async.
Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3d ago First seen · 18 lines · 45 tokens per session scan A c5869959dbe9

Subscribe to this mod's changes

python-conventions is a skill published in the GitHub repository Goldziher/ai-rulez (139 stars, last pushed 9d ago), licensed MIT. It adds 45 tokens to every session and 382 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories