ai-agents python.instructions.md

ai-agents python.instructions.md is an instructions file for GitHub Copilot from rjmurillo/ai-agents. It costs 1,593 tokens per session, scanned A, original, MIT.

Python coding rules covering supported syntax, type annotations, tooling, and common packaging mistakes.

In plain words
What is it for?
Use them when editing Python source, tests, scripts, or package configuration.
Why use it?
They help keep Python code compatible with both the project's development version and older interpreters that run its hooks.

Instructions file for GitHub Copilot

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 instructions/rjmurillo/ai-agents/python
Clone the repo
git clone --depth 1 https://github.com/rjmurillo/ai-agents

Made for: GitHub Copilot.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for ai-agents python.instructions.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/rjmurillo/ai-agents/python.svg)](https://agentmods.dev/instructions/rjmurillo/ai-agents/python)
Your own site
<a href="https://agentmods.dev/instructions/rjmurillo/ai-agents/python"><img src="https://agentmods.dev/badge/instructions/rjmurillo/ai-agents/python.svg" alt="Measured on agentmods" height="20"></a>
Per session 1,593 This file is loaded in full into every session.
When invoked 1,593 The same file — it is already loaded in full.
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.01593 $0.01593
Opus 5 $0.00796 $0.00796
Sonnet 5 $0.00319 $0.00319
Haiku 4.5 $0.00159 $0.00159

Measured yesterday against content hash 6d2a140a839d, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

ai-agents python.instructions.md 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 yesterday.

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/instructions/python.instructions.md · 118 lines

How it starts

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

Python Rules

These rules apply when you write or review Python. The dev and install target is 3.14 (.python-version, CI, requires-python = ">=3.14"). But plugin hooks and skill scripts run under the host's ambient interpreter, which may be older, so a blocking gate (scripts/validation/validate_python_syntax.py, issue #2655) requires every tracked file to parse at the hook-portability syntax floor, currently 3.10. Write to that floor: avoid syntax newer than 3.10, such as PEP 695 generics (def f[T](), 3.12+) and PEP 758 unparenthesized except A, B: (3.14). Defer to pyproject.toml, ruff config, and mypy settings over personal preference.

Typing

  • Type every public function signature: parameters and return. Internal helpers with obvious types may omit annotations, but a boundary without types is a bug.
  • Use built-in generics (list[str], dict[str, int], tuple[int, ...]) and X | None instead of Optional[X].
  • Prefer precise types: Sequence/Mapping for read-only parameters, Protocol for structural interfaces, Literal for fixed string sets, TypedDict for structured dict payloads at a boundary.
  • Run mypy in CI and treat type errors as failures. A passing type checker is part of the contract, not optional.

Idioms

  • Use @dataclass(frozen=True, slots=True) for immutable value objects. Reach for Pydantic only when you need validation or serialization at a boundary; do not pay its cost for internal data.
  • Prefer comprehensions and generator expressions over map/filter with lambdas. Use a generator when the result is consumed once and may be large; materialize a list only when you need to index or reuse it.
  • Manage every resource with a context manager (with). Write your own with contextlib.contextmanager rather than paired open/close calls.
  • Use pathlib.Path for filesystem paths, not string concatenation or os.path.
  • Use structural pattern matching (match/case) for dispatch over shapes, not as a glorified if chain over equal values; a dict lookup is clearer there.

Read the full file on GitHub · 118 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. yesterday First seen · 118 lines · 1,593 tokens per session scan A 6d2a140a839d

Subscribe to this mod's changes

ai-agents python.instructions.md is an instructions file published in the GitHub repository rjmurillo/ai-agents (45 stars, last pushed today), licensed MIT. It adds 1,593 tokens to every session, about $0.0080 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-09-03.