python-performance-optimization Skill (wshobson) for Claude: What It Does and How to Install It
Makes Claude profile slow Python code first, then optimize the real bottleneck.
- Installs
- 36.9K
- on skills.sh
- Stars
- 42.1K
- on GitHub
- Files
- 2
- besides SKILL.md
- Updated
- Oct 2026
- last repo commit
python-performance-optimization tells Claude to measure before changing anything. It covers CPU profiling with cProfile, line-by-line and memory profiling, and live profiling with py-spy, then the fixes: better data structures, caching, generators, NumPy, multiprocessing, async I/O and batched database work.
It triggers on slow Python, bottlenecks and memory problems. SKILL.md holds the concepts and best practices, and the worked examples sit in two reference files. The examples show pip installs for line-profiler, memory-profiler and py-spy.
Good for
- Python developers with a slow function, endpoint or data pipeline
- Teams chasing a memory leak or high memory use
- Anyone who wants a measured approach instead of guesses
Install python-performance-optimization
Claude Code
- 1
Copy this prompt.
Install the python-performance-optimization skill in Claude Code. Run this command: npx skills add https://github.com/wshobson/agents --skill python-performance-optimization Then check that it loaded and tell me how to use it.
- 2
Paste it into Claude Code. It shows the change and asks before running it.
Requires Node.js.
From its listing on skills.sh. Source.
What's in the skill
When it loads
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.
Sections in SKILL.md
- When to Use This Skill
- Core Concepts
- 1. Profiling Types
- 2. Performance Metrics
- 3. Optimization Strategies
- Quick Start
- Basic Timing
- Detailed patterns and worked examples
- Best Practices
- Common Pitfalls
Key facts
- Repository
- wshobson/agents
- Installs on skills.sh
- 36,853 as of 2026-11-02
- License
- MIT
- Last commit to the repo
- 2026-10-30
- skills.sh audits
- Gen Agent Trust Hub pass, Socket pass, Snyk pass
What it includes
Profiling types, metrics and optimization strategies
CPU, memory, line and call-graph profiling; execution time, memory, CPU and I/O wait; and algorithmic, implementation, parallel, caching and native-extension strategies.
Read ·
Core conceptstime and timeit examples
A basic timing function and a timeit comparison to get a baseline before profiling.
Read ·
Quick start timingcProfile, line_profiler, memory_profiler, py-spy
Patterns 1 to 4. The reference shows pip installs for the three add-on tools and py-spy commands to watch a running process by PID.
Try: “Profile this script with cProfile and show me the slowest functions.”
Runs code ·
Profiling tools (details.md)Patterns 5 to 10
List comprehensions vs loops, generator expressions, string concatenation, dict vs list lookups, local variable access and function call overhead.
Write ·
Optimization patterns (details.md)Patterns 11 to 19
NumPy, lru_cache, __slots__, multiprocessing, async I/O, batched database operations, query optimization, memory leak detection and iterators vs lists.
Write ·
Advanced patterns (advanced-patterns.md)10 practices and 8 pitfalls
Profile before optimizing, focus on hot paths, avoid premature optimization, profile production with py-spy. Pitfalls include optimizing without profiling.
Read ·
Best practices and pitfalls
From the official docs
Permissions
Low risk
The skill itself bundles no scripts, but its examples have Claude install profiling packages and attach py-spy to running processes. Approve those commands one at a time and use a virtual environment.
What it can do
- Read your data
- Create and change things
- Delete things
- Read-only mode
Watch out for
It may pip install profiling tools
The reference shows pip install for three packages. Use a virtual environment so they stay out of your system Python. github.com
py-spy attaches to a running process
The reference shows py-spy top, record and dump with a process ID. Only point it at processes you own. github.com
Technical details
| Turning on read-only | No read-only switch is documented in SKILL.md. |
|---|---|
| Talks to | pip downloads when a profiler is installed |
| Scopes |
|
Questions
What does python-performance-optimization do?
It gives Claude a profile-first method for slow Python. Claude measures with cProfile or a memory profiler, finds the hot path, then applies a targeted fix.
How do I install it?
Use the install box at the top of this page. The repo README says the single-skill installers copy only the skill, without the plugin's agents, commands or hooks.
Does it install profilers for me?
The reference file shows pip installs for line-profiler, memory-profiler and py-spy as part of its examples, so a run that follows them would install those packages. Check each command before you approve it.
Is python-performance-optimization safe to use?
It bundles no scripts. Its examples include pip installs and attaching py-spy to a running process by PID, so only run those on processes and environments you own. Review code changes before you commit.
Will it work on production code?
The skill lists profiling production applications as a use and recommends py-spy for live systems. Attach profilers carefully, because they run against a live process.
Does it cover async or database code?
Yes, in advanced-patterns.md: async I/O for I/O-bound work (Pattern 15), batched database operations (Pattern 16) and query optimization (Pattern 17).
Information
updated Nov 2, 2026
- Repository
- wshobson/agents
- Folder
plugins/python-development/skills/python-performance-optimization
Sources
Docs, issue trackers and discussions this page is built from.
Show all 4Hide
- python-performance-optimization SKILL.md · github.com
- details.md · github.com
- advanced-patterns.md · github.com
- wshobson/agents README · github.com