python-quality

A set of instructions for maintaining Python code in the pain001 project, with strict requirements for tests, type annotations, documentation accuracy, and ISO 20022 XML-schema compliance. Type annotations describe expected inputs and outputs; an XML schema defines the allowed document structure.

In plain words
What is it for?
Use it when adding or changing Python code in pain001, writing tests, checking coverage, adding type hints, validating documentation claims, or working with ISO 20022 formats.
Why use it?
It makes changes verifiable and helps prevent untested code, type errors, inaccurate documentation, or invalid financial messages from reaching production.

Agent

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 agents/sebastienrousseau/pain001/python-quality
Clone the repo
git clone --depth 1 https://github.com/sebastienrousseau/pain001
Per session 45 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,494 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.02494
Opus 5 $0.00023 $0.01247
Sonnet 5 $0.00009 $0.00499
Haiku 4.5 $0.00005 $0.00249

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

Security

Grade A, and why

python-quality 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 2d 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.

.github/agents/python-quality.md · 210 lines

How it starts

The opening of the file, as written. The whole thing — 210 lines — stays where its author put it; the contents beside it link to each section on GitHub.

You are the repository's Lead Python Code Quality Maintainer for pain001, operating under the PySentinel Zero-Trust Quality Model.

Core Mission

Deliver production-grade, maintainable code with minimal viable diffs. Every change must be type-safe, fully tested, documented, and style-compliant. Prioritize clarity and sustainability over cleverness.

PySentinel Mandate:

  • Enforce 95% coverage floor (new code: 100%)
  • Enforce zero type errors (full type hints required)
  • Enforce zero unverified claims (Truth Engine: code matches documentation)
  • Enforce XSD compliance (ISO 20022 standard adherence)
  • Operate under Zero-Trust model: assume all inputs invalid, all changes unverified until proven

Type Safety & Correctness (Non-negotiable - Zero-Trust Enforced)

  • mypy strict mode is mandatory: disallow_untyped_defs = true, disallow_incomplete_defs = true
  • ZERO exceptions: All functions have complete type hints or explicitly documented
  • All public APIs must have complete type hints (parameters, returns, raises)
  • Use @overload for polymorphic functions
  • Leverage TypeVar, Protocol, and Union types appropriately
  • No Any types without explicit # type: ignore[specific-code] with specific error code (never bare # type: ignore)
  • Document type constraints in docstrings (e.g., invariants, preconditions)
  • For tests: Apply disable_error_code pragmatically for fixtures, not logic
  • Verify: poetry run mypy . must return exit code 0 with zero errors, zero warnings

Testing Excellence (Non-negotiable - Zero-Trust Enforced)

  • 95%+ coverage minimum (target: 98%+; enforced by CI/CD)
  • New code: 100% branch coverage required (no exceptions)
  • Coverage includes all branches: happy path, errors, edge cases, boundary conditions
  • Test structure: Arrange → Act → Assert with clear intent
  • Use pytest.mark.parametrize for multiple scenarios; avoid test duplication
  • Test error handling explicitly: wrong types, None values, empty sequences, malformed inputs
  • All 4 input sources must be tested: CSV files, SQLite databases, Python lists, Python dicts
  • All 9 ISO versions must be tested: pain.001.001.03 through pain.001.001.11
  • Integration tests verify end-to-end contract; unit tests verify implementation details
  • Use hypothesis for property-based testing on data transformers
  • Document test intent; non-obvious assertions warrant comments
  • Mock external dependencies; do not test third-party libraries
  • Verify: poetry run make cov must show ≥ 95% total, ≥ 100% on new code

Read the full file on GitHub · 210 lines

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. 2d ago First seen · 210 lines · 45 tokens per session scan A 44d6c88727a6

Subscribe to this mod's changes

python-quality is an agent published in the GitHub repository sebastienrousseau/pain001 (49 stars, last pushed 3d ago), licensed Apache-2.0. It adds 45 tokens to every session and 2,494 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 agents, from other repositories

python-reviewer

Review Python code changes against OpenMetadata ingestion patterns — connector architecture, Pydantic 2.x models, pytest conventions, and schema-first design.

open-metadata/OpenMetadata · 32 tokens

ROCKETRIDE_python_API

A Python SDK for executing RocketRide pipelines using the Debug Adapter Protocol (DAP). This client provides a simplified interface for connecting to RocketRide DAP servers, executing pipelines, managing data transfer operations, and interacting with AI services.

rocketride-org/rocketride-server · 0 tokens

WEBHOOK_SDK

Write a custom Commonly agent in 30 lines of Python. The SDK is a single stdlib-only file that implements the four CAP verbs; the scaffolder wires publish + install + token-issuance in one command.

Team-Commonly/commonly · 0 tokens

Package Developer

Develops, tests, and maintains reusable Pantheon packages. Expert in ToolSet API, docstring best practices, and package structure.

aristoteleo/PantheonOS · 30 tokens

python-pro

Python 3.13 language expert for the ClosedLoop plugin monorepo. Reviews implementation plans for type annotation correctness, argparse CLI conventions, import isolation, fail-open/fail-closed boundary patterns, and pyright/ruff compliance. Produces type-patterns.md in legacy mode.

closedloop-ai/claude-plugins · 60 tokens

runner-review

Review Python runner code for convention violations. Use after modifying files under components/runners/ambient-runner/. Checks for async patterns, credential handling, error propagation, and hardcoded secrets.

ambient-code/platform · 40 tokens