Automated summary
Optimizes application performance by identifying bottlenecks and implementing caching, load balancing, database scaling, and monitoring strategies.
Strengths
- Provides concrete caching patterns (cache-aside, write-through) with code examples.
- Includes a decision tree for diagnosing performance issues.
- Offers practical nginx and Redis configurations.
- Covers multiple scaling strategies (horizontal, vertical).
Limitations
- Assumes a monolithic or microservice architecture.
- Does not cover front-end performance optimization.
- Requires access to production metrics and infrastructure.
Use when your application experiences high latency, low throughput, or scalability issues under load.
Avoid if the performance issue is solely due to inefficient front-end code or if the system is not yet deployed in a production-like environment.
Security analysis
SafeThe skill provides advisory content on performance optimization (caching, load balancing, database scaling) without any destructive or dangerous commands. No exfiltration, obfuscation, or execution risks.
No concerns found
How this analysis is madeExamples
My API is slow, help me optimize itSet up Redis caching for my applicationConfigure load balancing for high availabilityname: performance description: Optimize application performance through caching strategies, load balancing, database scaling, and monitoring. Build systems handling thousands of concurrent users. sasmp_version: "2.0.0" bonded_agent: 05-caching-performance bond_type: PRIMARY_BOND
=== PRODUCTION-GRADE SKILL CONFIG (SASMP v2.0.0) ===
atomic_operations:
- BOTTLENECK_ANALYSIS
- CACHE_IMPLEMENTATION
- LOAD_BALANCING_CONFIG
- SCALING_STRATEGY
parameter_validation: query: type: string required: true minLength: 5 maxLength: 2000 current_rps: type: integer required: false description: "Current requests per second" target_latency_ms: type: integer required: false description: "Target P99 latency in milliseconds"
retry_logic: max_attempts: 3 backoff: exponential initial_delay_ms: 1000
logging_hooks: on_invoke: "skill.performance.invoked" on_success: "skill.performance.completed" on_error: "skill.performance.failed"
exit_codes: SUCCESS: 0 INVALID_INPUT: 1 METRICS_UNAVAILABLE: 2 OPTIMIZATION_FAILED: 3
Performance Optimization Skill
Bonded to: caching-performance-agent
Quick Start
# Invoke performance skill
"My API is slow, help me optimize it"
"Set up Redis caching for my application"
"Configure load balancing for high availability"
Instructions
- Identify Bottlenecks: Profile application, analyze metrics
- Choose Strategy: Select caching, scaling, or optimization approach
- Implement Cache: Set up Redis/Memcached with appropriate pattern
- Configure Scaling: Horizontal or vertical based on needs
- Monitor Results: Set up APM and track improvements
Caching Patterns
| Pattern | Use Case | Consistency | Complexity | |---------|----------|-------------|------------| | Cache-Aside | Read-heavy, tolerates stale | Eventual | Low | | Write-Through | Write-heavy, needs consistency | Strong | Medium | | Write-Behind | High throughput writes | Eventual | High | | Refresh-Ahead | Predictable access | Strong | Medium |
Decision Tree
Performance Issue?
│
├─→ High latency → Check database queries
│ ├─→ Slow queries → Add indexes, optimize SQL
│ └─→ Network → Add caching, reduce round-trips
│
├─→ High CPU → Profile code
│ ├─→ Algorithmic → Optimize algorithms
│ └─→ Too much load → Scale horizontally
│
└─→ Memory issues → Analyze memory usage
├─→ Leaks → Find and fix leaks
└─→ Large data → Implement pagination, streaming
Examples
Example 1: Redis Cache-Aside
import redis
import json
from functools import wraps
r = redis.Redis(host='localhost', port=6379, decode_responses=True)
def cache(ttl_seconds=3600):
def decorator(func):
@wraps(func)
def wrapper(*args, **kwargs):
cache_key = f"{func.__name__}:{args}:{kwargs}"
cached = r.get(cache_key)
if cached:
return json.loads(cached)
result = func(*args, **kwargs)
r.setex(cache_key, ttl_seconds, json.dumps(result))
return result
return wrapper
return decorator
@cache(ttl_seconds=300)
def get_expensive_data(user_id: str) -> dict:
# Expensive database query or computation
return {"user_id": user_id, "data": "..."}
Example 2: Connection Pooling
from sqlalchemy import create_engine
engine = create_engine(
DATABASE_URL,
pool_size=20,
max_overflow=10,
pool_timeout=30,
pool_recycle=1800,
pool_pre_ping=True
)
Example 3: Load Balancing (nginx)
upstream backend {
least_conn; # Least connections algorithm
server backend1:8000 weight=3;
server backend2:8000 weight=2;
server backend3:8000 weight=1;
keepalive 32; # Connection pooling
}
server {
location /api {
proxy_pass http://backend;
proxy_http_version 1.1;
proxy_set_header Connection "";
}
}
Performance Metrics
Latency Targets:
├── P50: < 50ms (typical request)
├── P95: < 200ms (most requests)
├── P99: < 500ms (almost all)
└── P99.9: < 1s (worst case)
Cache Metrics:
├── Hit Ratio: > 90% (ideal)
├── Eviction Rate: Low (stable)
└── Memory Usage: < 80% (headroom)
Database Metrics:
├── Connection Pool: < 80% utilized
├── Query Time: P95 < 100ms
└── Slow Queries: < 1% of total
Troubleshooting
Common Issues
| Issue | Cause | Solution | |-------|-------|----------| | High cache miss | Poor key design | Review key patterns | | Cache stampede | Many misses at once | Use locks or jitter | | Memory pressure | Over-caching | Set TTL, eviction policy | | Connection timeout | Pool exhausted | Increase pool size |
Debug Commands
# Redis stats
redis-cli INFO stats | grep -E 'keyspace|hits|misses'
# Memory usage
redis-cli INFO memory | grep used_memory_human
# Slow queries
redis-cli SLOWLOG GET 10
# Load test
wrk -t12 -c400 -d30s http://localhost/api
Test Template
# tests/test_performance.py
import pytest
import time
class TestCachePerformance:
def test_cache_hit_is_fast(self, redis_client):
# First call - cache miss
start = time.time()
result1 = get_cached_data("key1")
cold_time = time.time() - start
# Second call - cache hit
start = time.time()
result2 = get_cached_data("key1")
warm_time = time.time() - start
assert warm_time < cold_time * 0.1 # 10x faster
assert result1 == result2
def test_cache_ttl_expires(self, redis_client):
set_cached_data("key", "value", ttl=1)
time.sleep(2)
assert get_cached_data("key") is None
Resources
From the file to a first result
The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.
View the source and supporting filesThis download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.
1. Download the file
Download SKILL.mdFrom the root of a test project, save the file as .skill-downloads/performance-optimization-mmio71d5/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.
Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.
mkdir -p '.skill-downloads/performance-optimization-mmio71d5' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/performance-optimization-mmio71d5/download' --output '.skill-downloads/performance-optimization-mmio71d5/SKILL.md.part' && mv '.skill-downloads/performance-optimization-mmio71d5/SKILL.md.part' '.skill-downloads/performance-optimization-mmio71d5/SKILL.md'2. Check prerequisites
Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.
No recognized prerequisites section in this file. This does not mean it is self-contained: libraries, tools and access requirements may be mentioned elsewhere in the content or source repository.
The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.
3. Load the skill
After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.
Claude Code
test -f '.skill-downloads/performance-optimization-mmio71d5/SKILL.md' && test -s '.skill-downloads/performance-optimization-mmio71d5/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/performance' && cp -R '.skill-downloads/performance-optimization-mmio71d5' '.claude/skills/performance'OpenSkills
OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.
Official OpenSkills installationopenskills install './.skill-downloads/performance-optimization-mmio71d5'openskills read 'performance-optimization-mmio71d5'Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.
For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.
openskills syncManual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.
4. Try a first task
Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:
Read .skill-downloads/performance-optimization-mmio71d5/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.
React Hook Form Best Practices
Development
Master React Hook Form: avoid anti-patterns, manage subscriptions, and handle reset, dirty state, and controlled inputs correctly.
Emotion to Mantine Migration
Development
Migrate Emotion styled-components to Mantine components with style props and CSS modules. Use when converting .styled.tsx files or removing @emotion imports.
Scope Creep Detector
Development
Analyzes git diffs against a stated intent to detect scope creep, unrelated files, broad PRs, and oversized changes, then suggests keep, split, or justify actions.