Skip to content
Back to skills

Python Performance

ASecurity

Use when profiling, benchmarking, or optimizing Python CPU, memory, I/O, database, concurrency, startup, or numerical workloads; investigating leaks and performance regressions; reviewing optimization proposals; or validating before/after performance without changing behavior.

  • 2 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added November 9, 2026
ai-agentspythongorailsdatabaseperformancedocumentation

Security analysis

A100/100

Pro scans all 14 files and shows the line behind each finding

Scanned November 9, 2026

npx -y skills add Lu1sDV/skillsmd --skill python-performance --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Python Performance?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Python Performance
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/lu1sdv-python-performance/badge)](https://www.skillsdirectory.com/skills/lu1sdv-python-performance)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: python-performance
description: >
  Use when profiling, benchmarking, or optimizing Python CPU, memory, I/O,
  database, concurrency, startup, or numerical workloads; investigating leaks
  and performance regressions; reviewing optimization proposals; or validating
  before/after performance without changing behavior.
---

# Python Performance

Target **CPython 3.15**; latest stable patch verified **3.15.2 on 2026-11-03**.
Use version-matched documentation and compatible tools. Treat a consuming project's
older declared support as a compatibility constraint; do not silently upgrade it.

## Workflow

1. **Define the contract.** Inspect the project, tests and telemetry. Set a primary
   metric, acceptance threshold, representative inputs and guardrails. Record
   runtime/dependencies, deployment limits, cold/warm state and measurement
   boundaries. Infer routine details; ask only for missing experiment-changing facts.
2. **Find the limiting resource.** Establish a baseline, then collect bounded
   evidence for CPU, waiting, allocation, queries or startup. Follow the relevant
   reference below; investigate observations before choosing an optimization.
3. **Rank mechanisms.** Compare benefit, implementation cost, correctness risk and
   maintenance; state cause, affected fraction, tradeoff and falsifying measurement.
   Prefer removing work, better algorithms
   and representations, then bounded streaming/batching/reuse, justified caching,
   concurrency or compilation. Reserve syntax tuning for measured hot paths.
4. **Change one mechanism.** Preserve values, types, ordering, duplicates,
   mutation/aliasing, exceptions, precision, transactions and cancellation.
   Use existing dependencies and supported versions; add complexity only for a
   demonstrated need. Run existing tests plus focused checks for changed semantics.
5. **Compare equivalent work.** Read the benchmarking reference before claiming
   improvement. Use repeated, matched, unprofiled runs; include required setup,
   conversion, transfers and result consumption. Report variability, cold versus
   steady state, and relevant memory/latency/error/cost guardrails. Retain raw results.
6. **Decide.** Re-profile material improvements. Accept only useful gains that
   justify maintenance and resource costs; otherwise retain the simpler version.
   Broaden verification only for a concrete remaining risk. If execution or inputs
   are unavailable, give a reproducible plan and label changes as hypotheses.

## Load by task

Load only the relevant reference or section; do not read the whole bundle by default.

| Task | Reference |
|---|---|
| Locate CPU, wall-time, native, allocation or slow-test-suite hotspots | [Profiling](references/profiling.md) |
| Establish a speedup, service-load result or regression gate | [Benchmarking](references/benchmarking.md) |
| Reduce repeated work; choose containers, iteration or representations | [Algorithms and Python](references/algorithms-and-python.md) |
| Diagnose peaks, retention, caches or GC | [Memory and caching](references/memory-and-caching.md) |
| Choose workers/async; inspect GIL, quotas, imports or runtimes | [Concurrency and runtime](references/concurrency-and-runtime.md) |
| Improve queries, transactions, HTTP, files or serialization | [I/O and databases](references/io-and-databases.md) |
| Optimize arrays/dataframes, compilation or existing GPU work | [Numerical and data](references/numerical-and-data.md) |
| Review a proposed optimization for common failure modes | [Antipatterns](references/antipatterns.md) |
| Record the contract, reproduction and results | [Report template](references/report-template.md) |
| Check provenance, version gates or maintain this skill | [Sources and scope](references/sources-and-scope.md) |

Capture baseline metadata with the workload's interpreter:

```sh
python /path/to/python-performance/scripts/capture_environment.py --package numpy > environment.json
```

The helper describes its own process without importing target packages. Record
deployment limits separately; recheck GIL state after application extension imports.

## Handoff

Report objective/environment, bottleneck evidence, change/rationale, correctness
checks, before/after metrics with units and variability, tradeoffs and reproduction
commands. Keep unknowns explicit; distinguish measurements from estimates and cite
version-sensitive or library-specific claims. Never improve a benchmark by dropping
results, validation, precision, failed requests or required work.

Files in this skill

  • README.md2.3 KB
  • SKILL.md4.4 KB
  • agents/openai.yaml263 B
  • references/algorithms-and-python.md6.1 KB
  • references/antipatterns.md8.2 KB
  • references/benchmarking.md9.6 KB
  • references/concurrency-and-runtime.md10.3 KB
  • references/io-and-databases.md9 KB
  • references/memory-and-caching.md6.9 KB
  • references/numerical-and-data.md8.9 KB
  • references/profiling.md11.2 KB
  • references/report-template.md2.6 KB
  • references/sources-and-scope.md10 KB
  • scripts/capture_environment.py3.8 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.