performance-expert
БесплатноБез исполняемых скриптовНе проверенExpert-level performance optimization, profiling, benchmarking, and tuning. Use when the user mentions optimization, profiling, benchmarking, or scalability…
от personamanagmentlayer★ 46 звёзд на GitHubОб этом скилле
Performance Expert
Expert guidance for performance optimization, profiling, benchmarking, and system tuning.
Core Concepts
Performance Fundamentals
- Response time vs throughput
- Latency vs bandwidth
- CPU, memory, I/O bottlenecks
- Concurrency vs parallelism
- Caching strategies
- Load balancing
Optimization Areas
- Algorithm optimization
- Database optimization
- Network optimization
- Frontend performance
- Backend performance
- Infrastructure tuning
Profiling Tools
- CPU profilers
- Memory profilers
- Network profilers
- Application Performance Monitoring (APM)
- Load testing tools
Python Performance
import cProfile
import pstats
import timeit
import memory_profiler
from functools import lru_cache
from typing import List
import numpy as np
# Performance Profiling
def profile_function(func):
"""Decorator for profiling function execution"""
def wrapper(*args, **kwargs):
profiler = cProfile.Profile()
profiler.enable()
result = func(*args, **kwargs)
profiler.disable()
stats = pstats.Stats(profiler)
stats.sort_stats('cumulative')
stats.print_stats(10) # Top 10 functions
return result
return wrapper
@profile_function
def slow_function():
total = 0
for i in range(1000000):
total += i
return total
# Memoization for expensive computations
@lru_cache(maxsize=128)
def fibonacci(n: int) -> int:
"""Cached Fibonacci calculation"""
if n < 2:
return n
return fibonacci(n-1) + fibonacci(n-2)
# Vectorization with NumPy
def slow_loop(data: List[float]) -> List[float]:
"""Slow: Using Python loops"""
return [x ** 2 + 2 * x + 1 for x in data]
def fast_vectorized(data: np.ndarray) -> np.ndarray:
"""Fast: Using NumPy vectorization"""
return data ** 2 + 2 * data + 1
# Benchmarking
def benchmark_function(func, *args, iterations=1000):
"""Benchmark function execution time"""
total_time = timeit.timeit(
lambda: func(*args),
number=iterations
)
avg_time = total_time / iterations
return {
'total_time': total_time,
'avg_time': avg_time,
'iterations': iterations
}
# Memory profiling
@memory_profiler.profile
def memory_intensive_function():
"""Function that uses significant memory"""
data = [i for i in range(1000000)]
return sum(data)
# Efficient string concatenation
def slow_string_concat(items: List[str]) -> str:
"""Slow: String concatenation in loop"""
result = ""
for item in items:
result += item # Creates new string each time
return result
def fast_string_concat(items: List[str]) -> str:
"""Fast: Using join"""
return "".join(items)
# Generator for memory efficiency
def slow_list_comprehension(n: int) -> List[int]:
"""Returns all squares at once"""
return [i ** 2 for i in range(n)]
def fast_generator(n: int):
"""Yields squares one at a time"""
for i in range(n):
yield i ** 2
Database Optimization
from sqlalchemy import create_engine, Index, text
from sqlalchemy.orm import sessionmaker
import redis
# Connection pooling
engine = create_engine(
'postgresql://user:pass@localhost/db',
pool_size=20,
max_overflow=0,
pool_pre_ping=True,
pool_recycle=3600
)
# Query optimization
class DatabaseOptimizer:
def __init__(self, session):
self.session = session
def bad_n_plus_one(self):
"""N+1 query problem"""
users = self.session.query(User).all()
for user in users:
posts = user.posts # Triggers additional query per user
print(f"{user.name}: {len(posts)} posts")
def good_eager_loading(self):
"""Eager loading to avoid N+1"""
from sqlalchemy.orm import joinedload
users = self.session.query(User)\
.options(joinedload(User.posts))\
.all()
for user in users:
posts = user.posts # No additional query
print(f"{user.name}: {len(posts)} posts")
def use_indexes(self):
"""Create indexes for frequent queries"""
# Index on frequently queried columns
Index('idx_user_email', User.email)
Index('idx_post_created_at', Post.created_at)
# Composite index
Index('idx_post_user_status', Post.user_id, Post.status)
def batch_operations(self, items: List[dict]):
"""Batch insert instead of individual inserts"""
# Bad: Individual inserts
# for item in items:
# self.session.add(User(**item))
# self.session.commit()
# Good: Batch insert
self.session.bulk_insert_mappings(User, items)
self.session.commit()
def use_pagination(self, page: int = 1, page_size: int = 20):
"""Paginate large result sets"""
offset = (page - 1) * page_size
return self.session.query(User)\
.order_by(User.created_at.desc())\
Установить performance-expert в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
ReadWriteEditBash(python:*, python3:*, pip:*, pytest:*)FAQ
Что делает скилл performance-expert?
Expert-level performance optimization, profiling, benchmarking, and tuning. Use when the user mentions optimization, profiling, benchmarking, or scalability, or when the task involves Performance Fundamentals, Optimization Areas, Profiling Tools, or General.
Как установить скилл performance-expert?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл performance-expert запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
ci-review
The scan that the plugin's GitHub Action runs.
от Anthropicazure-static-web-apps
Helps create, configure, and deploy Azure Static Web Apps using the SWA CLI. Use when deploying static sites to Azure, setting up SWA local development…
от GitHubai-ready
Make any repo AI-ready — analyzes your codebase and generates AGENTS.md, copilot-instructions.md, CI workflows, issue templates, and more. Mines your PR…
от GitHubaws-cdk-python-setup
Setup and initialization guide for developing AWS CDK (Cloud Development Kit) applications in Python. This skill enables users to configure environment…
от GitHub