home / skills / duc01226 / easyplatform / performance

This skill analyzes performance bottlenecks across database, frontend, API, and cross-service layers and routes to targeted optimization guidance.

npx playbooks add skill duc01226/easyplatform --skill performance

Review the files below or copy the command above to add this skill to your agents.

Files (2)
SKILL.md
2.6 KB
---
name: performance
description: "[Review & Quality] Use when analyzing and improving performance for database queries, API endpoints, frontend rendering, or cross-service communication. Triage skill that routes to database-optimization, frontend-patterns, or provides API/job/cross-service profiling guidance."
allowed-tools: Read, Write, Edit, Grep, Glob, Bash, Task
infer: true
---

# Performance Optimization

Triage skill for performance issues. Routes to the correct sub-tool or reference based on bottleneck type.

## Decision Tree

```
Performance Issue?
├── Database (slow queries, N+1, indexes, pagination)
│   → Invoke database-optimization skill (covers all DB patterns)
├── Frontend (rendering, bundle size, change detection)
│   → ⚠️ MUST READ docs/claude/frontend-patterns.md
│   → Key: OnPush, trackBy, lazy loading, virtual scroll, tree-shaking
├── API/Endpoint (response time, payload, serialization)
│   → ⚠️ MUST READ references/performance-patterns.md (parallel queries, caching, DTOs)
├── Background Jobs (throughput, batch processing)
│   → ⚠️ MUST READ references/performance-patterns.md (bounded parallelism, batch ops)
└── Cross-Service (message bus, eventual consistency)
    → ⚠️ MUST READ references/performance-patterns.md (payload size, idempotency)
```

## Quick Assessment Checklist

1. **Identify** bottleneck type using decision tree above
2. **Measure** baseline (response time, query count, bundle size)
3. **Route** to correct sub-tool or reference
4. **Apply** patterns from the routed resource
5. **Verify** improvement against baseline
6. **Monitor** for regressions

## EP-Specific Quick Wins

- **Parallel tuple queries**: `var (a, b) = await (queryA, queryB);`
- **Eager loading**: `repo.GetAllAsync(filter, ct, e => e.Related)`
- **Projections**: `.Select(e => new { e.Id, e.Name })` instead of full entity
- **Full-text search**: `searchService.Search(q, text, Entity.SearchColumns())`
- **Batch updates**: `repo.UpdateManyAsync(items, dismissSendEvent: true, checkDiff: false)`
- **Paged processing**: `PageBy(skip, take)` at database level

For detailed patterns, profiling commands, and anti-patterns:
**⚠️ MUST READ:** `.claude/skills/performance/references/performance-patterns.md`

## Approval Gate

Present findings and optimization plan. Wait for explicit user approval before making changes -- performance optimizations can have wide-reaching side effects.


## IMPORTANT Task Planning Notes

- Always plan and break many small todo tasks
- Always add a final review todo task to review the works done at the end to find any fix or enhancement needed

Overview

This skill triages and guides performance investigations across databases, APIs, frontends, background jobs, and cross-service communication. It identifies the bottleneck type, measures a baseline, routes you to focused optimization patterns or sub-tools, and enforces verification and monitoring. Use it to get a practical, low-risk plan before applying changes.

How this skill works

The skill runs a quick assessment: identify the bottleneck, measure key metrics, and map the problem to the appropriate optimization category (database, frontend, API, jobs, cross-service). It then recommends concrete patterns and next steps — or routes to a specialized sub-tool or reference document — and requires explicit approval before changes. Finally, it verifies improvements against the baseline and adds monitoring to catch regressions.

When to use it

  • You see slow page loads or high frontend render cost
  • Database queries are slow, causing high latency or N+1 issues
  • API endpoints have long response times or heavy payloads
  • Background jobs have low throughput or high contention
  • Cross-service calls or message flows show increased delays or failures

Best practices

  • Start with measurement: capture response time, query count, and bundle size as a baseline
  • Map the bottleneck to the correct domain before changing code
  • Apply focused patterns (e.g., projections, eager loading, DTOs, caching) and run A/B or canary verification
  • Break work into small tasks and include a final review task to validate side effects
  • Require explicit approval for changes that can affect consistency or behavior

Example use cases

  • Detecting an N+1 query in a list endpoint and routing to database-optimization for eager loading or projections
  • Reducing frontend render time by recommending OnPush, trackBy, lazy loading, or virtual scroll patterns
  • Identifying a slow API endpoint and applying parallel queries, caching, or DTO serialization adjustments
  • Optimizing a batch job with bounded parallelism, paging at the DB level, and batch updates
  • Trimming cross-service payloads and adding idempotency for message bus consumers

FAQ

How do I decide which domain to route to?

Use the decision tree: if slowness originates from DB queries or query counts, route to database optimization; if rendering or bundle size is the issue, route to frontend patterns; if endpoints or payloads are the bottleneck, route to API guidance; use job or cross-service guidance for background processing or inter-service delays.

Can I apply optimizations directly?

No — present findings and an optimization plan and wait for explicit approval. Performance changes can have wide-reaching side effects, so verify improvements against the baseline and monitor for regressions.