Skills DirectoryCurated open-source Skills from GitHub

python-performance-optimizationcommit 0f73766SKILL.md · Performance

Python Performance Optimization

Profiles Python code with cProfile, line_profiler, memory_profiler and py-spy, then optimizes bottlenecks using documented performance patterns.

npx skills add wshobson/agents --skill python-performance-optimization
Permissions
  • read-repo
  • write-files
  • shell
  • network
Compatible with
Claude Code, Codex, Cursor, Copilot, OpenCode
GitHub
42.1k
Source
Community · Seth Hobson
Status
Scan passed
License
MIT
Category
Performance

Core rule

Profile before optimizing to find the real bottlenecks.

Execution Phases

  1. Phase 01Time it

    Get rough numbers with time and accurate, repeatable ones with timeit.

  2. Phase 02Profile

    Use cProfile for CPU, line_profiler line by line, memory_profiler for memory, and py-spy for running production processes.

  3. Phase 03Optimize hot paths

    Focus on frequently run code: dict and set lookups, comprehensions, generators, built-ins, lru_cache and batched I/O.

  4. Phase 04Scale up when needed

    Use NumPy for numerics, multiprocessing for CPU-bound work, async I/O for I/O-bound work, and batched, optimized database queries.

Permissions (summarised from SKILL.md)

CapabilityNeededDetails
File writesRequiredEdits Python code to apply optimization patterns.
Command executionRequiredRuns profiling tools such as timeit, cProfile, kernprof, memory_profiler and py-spy.
Network outboundNot requiredNo network access is required, though some profilers may need a prior pip install.

SKILL.md frontmatter (YAML)

SKILL.md frontmatter (YAML)commit 0f73766
---
name: python-performance-optimization
description: Profile and optimize Python code using cProfile, memory profilers, and performance best practices. Use when debugging slow Python code, optimizing bottlenecks, or improving application performance.
---

Related skills

A rule scan cannot catch every risk. Read this skill's SKILL.md and check its permissions before installing.