skills/performance-optimizer/SKILL.md
Use when analyzing and optimizing system performance - provides systematic performance analysis, bottleneck identification, and improvement verification through iterative optimization cycles
npx skillsauth add toongri/oh-my-toong-playground performance-optimizerInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
As a performance optimization expert, systematically analyze, improve, and verify system performance through iterative optimization cycles. Never optimize without measurement, and compare Before/After using the same test.
</Role>Core Principles:
digraph perf_workflow {
rankdir=TB;
node [shape=box];
// Entry
start [label="Performance Issue\nIdentified" shape=ellipse];
// Step 1: Goals
goals [label="Step 1: Define Performance Goals\n(Set SLO)"];
// Step 2: Test Scenario
test_scenario [label="Step 2: Design Test Scenario\n(Load profile, Success criteria)"];
// Step 3: Baseline
baseline [label="Step 3: Measure Baseline\n(Record current performance)"];
// Step 4: Analysis
analysis [label="Step 4: System/Code Analysis\n(Request flow, Code, DB, Infra)"];
// Step 5: Bottleneck
bottleneck [label="Step 5: Identify Bottlenecks\n(Prioritize)"];
// Step 6: Design
design [label="Step 6: Design Improvements\n(Alternative analysis, Trade-offs)"];
// Step 7: Implementation
implementation [label="Step 7: Implementation Plan\n(Deployment order, Rollback criteria)"];
// Step 8: Verify
verify [label="Step 8: Verify Improvements\n(Measure with same test)"];
// Decision
slo_met [label="SLO Met?" shape=diamond];
// Step 9: Document
document [label="Step 9: Document Results\n(Record Before/After)"];
// More bottlenecks?
more_bottlenecks [label="More bottlenecks\nto improve?" shape=diamond];
// Step 10: Final Report
report [label="Step 10: Generate Final Report\n($OMT_DIR/performance-reports/*.md)"];
// End
complete [label="Optimization\nComplete" shape=ellipse];
// Flow
start -> goals;
goals -> test_scenario;
test_scenario -> baseline;
baseline -> analysis;
analysis -> bottleneck;
bottleneck -> design;
design -> implementation;
implementation -> verify;
verify -> slo_met;
slo_met -> document [label="yes"];
slo_met -> bottleneck [label="no\n(analyze next bottleneck)"];
document -> more_bottlenecks;
more_bottlenecks -> bottleneck [label="yes"];
more_bottlenecks -> report [label="no"];
report -> complete;
}
Utilize the following subagents appropriately at each step.
When to use:
Example requests:
Question for oracle: "If we resolve the current N+1 query problem with Fetch Join, what impact will it have on memory usage?"
Question for oracle: "Read replica introduction vs cache layer addition - which choice is more suitable for the current architecture?"
When to use:
Example requests:
Request to explore: "Find how the category-based product query logic is implemented in ProductService"
Request to explore: "Find code patterns where caching is applied in the current project"
Follow the Human-in-the-loop pattern at all steps.
AskUserQuestion tool to ask about user preferences, priorities, and decisionsDon't bother users with questions the codebase can answer.
| Question Type | Ask User? | Action | |---------------|-----------|--------| | "Which project has X?" | NO | Use explore first | | "What patterns exist in the codebase?" | NO | Use explore first | | "Where is X implemented?" | NO | Use explore first | | "What is the current architecture?" | NO | Use oracle | | "What's the tech stack?" | NO | Use explore first | | "What's the timeline?" | YES | Ask user (AskUserQuestion) | | "Speed vs quality priority?" | YES | Ask user (AskUserQuestion) | | "What are the scope boundaries?" | YES | Ask user (AskUserQuestion) |
Ask users only about PREFERENCES, not FACTS.
Bad example:
question: "How should we do it?"
options:
- label: "A"
- label: "B"
Good example:
question: "The current product list API returns 100 items per page.
From a performance perspective, fewer items reduce response time but users must navigate more pages.
From a UX perspective, more items are convenient for scrolling but slow down initial loading.
How should we approach pagination strategy?"
header: "Pagination Strategy"
multiSelect: false
options:
- label: "Performance First (Recommended)"
description: "Reduce to 20 items per page. Expected 80% response time improvement.
Users navigate pages more frequently but each load is fast."
- label: "UX First"
description: "Keep current 100 items. Longer loading time but users see
more products at once."
- label: "Hybrid Approach"
description: "Switch to infinite scroll. Load initial 20, then load more on scroll.
Increased implementation complexity but combines both advantages."
Question Structure:
Continue until there are no more questions. Not after 2-3 questions. Not when the user seems tired. Continue the interview until all ambiguity is resolved.
Example Output:
| Metric | Current (Est.) | Target |
|--------|----------------|--------|
| p50 latency | 500ms | 100ms |
| p95 latency | 2000ms | 300ms |
| p99 latency | 5000ms | 500ms |
| Throughput | 20 req/s | 100 req/s |
| Error rate | 2% | 0.1% |
Example Output:
| Rank | Bottleneck | Impact | Evidence | Resolution Difficulty |
|------|------------|--------|----------|----------------------|
| 1 | N+1 query problem | 200ms (28%) | Code analysis | Medium |
| 2 | product table full scan | 300ms (42%) | EXPLAIN | Low |
| 3 | review table full scan | 150ms (21%) | EXPLAIN | Low |
All performance optimization reports are stored in the $OMT_DIR/performance-reports/ directory.
Naming Convention: $OMT_DIR/performance-reports/{feature-name}-performance-report.md
Examples:
$OMT_DIR/performance-reports/product-list-api-performance-report.md$OMT_DIR/performance-reports/order-processing-performance-report.md$OMT_DIR/performance-reports/search-api-performance-report.mdThe final document is generated with the following structure.
# Performance Optimization Report
## 1. Overview
### 1.1 Background
[Problem situation and business impact]
### 1.2 Goals (SLO)
| Metric | Before | Target | Achieved |
|--------|--------|--------|----------|
| p50 latency | ... | ... | ... |
| p95 latency | ... | ... | ... |
| p99 latency | ... | ... | ... |
| Throughput | ... | ... | ... |
| Error rate | ... | ... | ... |
## 2. Test Scenario
### 2.1 Test Target
- API: [endpoint]
- Test Data: [data scale]
### 2.2 Load Profile
- Concurrent Users: [N users]
- Request Pattern: [pattern description]
- Test Duration: [N minutes]
### 2.3 Test Environment
- Test Tool: [k6, JMeter, etc.]
- Environment: [environment description]
## 3. Analysis
### 3.1 System Flow
[Request flow diagram]
### 3.2 Code Analysis
[Discovered code-level issues]
### 3.3 Database Analysis
[DDL, execution plan analysis results]
### 3.4 Bottleneck Identification
| Rank | Bottleneck | Impact | Evidence |
|------|------------|--------|----------|
| 1 | ... | ... | ... |
## 4. Improvements
### 4.1 Applied Improvements
#### [Improvement 1: Title]
- **Problem**: [Original problem]
- **Solution**: [Applied solution]
- **Code Changes**: [Change details]
### 4.2 Alternatives Reviewed but Not Applied
| Alternative | Reason Not Applied |
|-------------|-------------------|
| ... | ... |
## 5. Results
### 5.1 Before/After Comparison
| Metric | Before | After | Improvement |
|--------|--------|-------|-------------|
| p50 latency | ... | ... | ...% |
| p95 latency | ... | ... | ...% |
| p99 latency | ... | ... | ...% |
| Throughput | ... | ... | ...% |
| Error rate | ... | ... | ...% |
### 5.2 Resource Usage Changes
| Resource | Before | After | Change |
|----------|--------|-------|--------|
| ... | ... | ... | ... |
## 6. Future Plans
### 6.1 Additional Optimization Opportunities
[Identified additional improvement areas]
### 6.2 Monitoring Plan
[Plan for continuous monitoring]
## 7. References
- [Related document links]
tools
Use at the end of a work session to review the WHOLE session and record entities worth pinning. This is the manual, deliberate complete-sweep review — NOT an automated nudge. Triggers on "wrap up", "wrap-up", "session wrap", "end of session", "what should I pin".
documentation
Use when initializing the pins knowledge graph for the first time in a project. Guides the user through creating pins.yaml (the storage manifest). Triggers on "setup pins", "initialize pins", "create pins.yaml", "first-run pins".
testing
Use when you need to record a single pin entity to the knowledge graph. Invokes lib/pins record() to validate and write a canonical .md file. Triggers on "record pin", "pin this", "save this as a pin".
databases
Use when looking up pins by type, tags, or source. Drives lib/pins/query.ts to retrieve matching pin entries from the knowledge graph. Supersedes the legacy manual ls+frontmatter procedure.