What problem does it solve? Slow pytest suites delay developer feedback, but blind optimization often breaks test isolation or hides failures. This Skill diagnoses where time actually goes—startup, collection, fixture setup, test calls, and teardown—and applies only evidence-backed changes that preserve test selection and outcomes. ## Core Features & Use Cases - Phase-Based Measurement: Separates startup, collection, setup, call, and teardown costs using safe baseline commands, repeated sampling, and median/spread reporting. - Cumulative Cost Ranking: Ranks contributors by per-invocation cost multiplied by invocation count, so a 50ms fixture used by 5,000 tests is prioritized over one slow test. - Evidence-Gated Escalation: Treats pytest-xdist parallelism, pytest-testmon affected-test selection, CI sharding, coverage changes, and Pants adoption as escalations requiring measured justification. - Use Case: A developer whose CI test job takes 25 minutes uses this Skill to profile the suite, discovers an autouse database fixture rebuilding schema per test, switches to transaction rollback, and proves a like-for-like speedup with identical outcome counts. ## Quick Start Ask the agent to measure why your pytest suite is slow and recommend safe optimizations, for example: "Use $optimize-pytest to diagnose why the tests in my project take so long and suggest fixes."