pytest-optimizer

pytest-optimizer is a skill for Claude Code, Codex from tony/skills. It costs 30 tokens per session (2,131 once invoked), scanned A, original, MIT.

A measured process for making a slow pytest test suite faster. Pytest is a Python testing tool; this process profiles the suite, tests possible changes, and keeps only speedups that exceed normal timing variation.

In plain words
What is it for?
Use it to optimize slow pytest tests or fixtures, compare timing baselines, apply safe changes one at a time, and resume unfinished optimization work.
Why use it?
A change that looks faster may simply be within measurement noise or may weaken test safety. Measuring before and after each change helps distinguish real improvements from misleading results.

Skill for Claude CodeCodex

Written for Claude Code and Codex: allowed-tools in frontmatter, but also agents/openai.yaml present. Also seen: mentions CLAUDE.md; names the AskUserQuestion tool; mentions Claude Code.

Good fit Use it to optimize slow pytest tests or fixtures, compare timing baselines, apply safe changes one at a time, and resume unfinished optimization work.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/tony/skills/pytest-optimizer
View source ↗ tony/skills
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.

Any agent
npx skills add tony/skills --skill pytest-optimizer
Clone the repo
git clone --depth 1 https://github.com/tony/skills

Made for: Claude Code, Codex.

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 pytest-optimizer

README.md
[![agentmods](https://agentmods.dev/badge/skills/tony/skills/pytest-optimizer/github.svg)](https://agentmods.dev/skills/tony/skills/pytest-optimizer)
Your own site
<a href="https://agentmods.dev/skills/tony/skills/pytest-optimizer"><img src="https://agentmods.dev/badge/skills/tony/skills/pytest-optimizer/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for pytest-optimizer

Your own site · 80×15
<a href="https://agentmods.dev/skills/tony/skills/pytest-optimizer"><img src="https://agentmods.dev/badge/skills/tony/skills/pytest-optimizer.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 30 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,131 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00030 $0.02131
Opus 5.5 $0.00012 $0.00852
Sonnet 5.5 $0.00006 $0.00426
Haiku 4.5 $0.00003 $0.00213

Measured 2d ago against content hash 3fbb4e369ac7, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

pytest-optimizer 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.

The scan reads SKILL.md. This mod also ships 4 executable files (references/isolate.py, references/measure.py, templates/conftest_cache_snippet.py, …), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

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.

.agents/skills/pytest-optimizer/SKILL.md · 179 lines

How it starts

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

pytest-optimizer

Profile a pytest suite, find safe speedups, and apply each as its own verified commit on a new branch, through a resumable, idempotent four-phase loop.

Measure before you mutate, and prove a speedup against the project's own timing noise before you trust it. A change whose measured saving falls inside the noise band, whose run exits non-zero, or whose collected tests change is never committed, except a deselection the user approved with its test count, which is reported as a smaller default run, not a faster suite.

$ARGUMENTS may name a test path or marker to scope the run, a --phase to jump to, --force to ignore idempotency tokens and re-run, --hygiene to add the opt-in typing and parametrize detectors, and --memory-dir to override where durable state is written.

Paths under ../../scripts/ resolve from this skill's directory: print the absolute path once and write it literally in each command, since shell variables do not persist between Bash calls.

When python3 is missing or older than 3.14, follow references/python.md.

The loop

00-scan  ->  01-benchmark  ->  02-plan  ->  03-execute  ->  (re-scan)

Each phase reads and writes durable JSON under the resolved memory directory; re-running resumes at the first phase whose completed flag is false, which measure.py state resume reports. After 03-execute, re-scan and loop until no candidate clears the rubric.

The phase skills set disable-model-invocation, so this skill cannot invoke them. To run a phase, read its file and follow it:

  • the pytest-optimizer-00-scan skill reads AGENTS.md/CLAUDE.md and prior state.json; writes baseline.json, capabilities.json, collection.txt, hypotheses.json.
  • the pytest-optimizer-01-benchmark skill reads baseline.json, hypotheses.json; writes benchmarks.json, control.json and one hash-bound patch per candidate.
  • the pytest-optimizer-02-plan skill reads benchmarks.json, baseline.json; writes plan.json.
  • the pytest-optimizer-03-execute skill reads plan.json, baseline.json, control.json; writes execution-log.json and commits on a new branch in a scratch worktree, leaving the user's checkout, index and branches untouched.

Read the full file on GitHub · 179 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 Changed · +2 lines 3fbb4e369ac7
  2. 1mo ago Changed · -19 lines 1f762b082e93
  3. 1mo ago Changed · +2 lines · +3 tokens per session daeb57514b79
  4. 3mo ago First seen · 194 lines · 27 tokens per session scan A 99e2e280f64b

Subscribe to this mod's changes

pytest-optimizer is a skill published in the GitHub repository tony/skills (0 stars, last pushed today), licensed MIT. It adds 30 tokens to every session and 2,131 once invoked, about $0.0001 per session on Opus 5.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-31.

Related

pytest-optimizer compared with skills from other repositories

pytest-optimizer next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
pytest-optimizertony/skillsSkill0todayMITA30Claude Code, Codex
test-masterJeffallan/claude-skillsSkill13ktodayMITA104Claude Code
migrate-xunit-to-xunit-v3dotnet/skillsSkill6.4ktodayMITA149Claude Code
go-testingGentleman-Programming/gentle-aiSkill9.7kyesterdayMITA26Claude Code, Codex
dart-testdartsim/dartSkill1.2ktodayBSD-2-ClauseA18Claude Code, Codex
test-generatorrshankras/claude-code-apple-skillsSkill91521d agoMITA33Claude Code
nw-fp-clojurenWave-ai/nWaveSkill63611d agoMITA25Claude Code