arch-performance-optimization
Use when analyzing and improving performance for database queries, API endpoints, or frontend rendering.
Best use case
arch-performance-optimization is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Use when analyzing and improving performance for database queries, API endpoints, or frontend rendering.
Teams using arch-performance-optimization should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/arch-performance-optimization/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How arch-performance-optimization Compares
| Feature / Agent | arch-performance-optimization | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Use when analyzing and improving performance for database queries, API endpoints, or frontend rendering.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# Performance Optimization Workflow
## When to Use This Skill
- Slow API response times
- Database query optimization
- Frontend rendering issues
- Memory usage concerns
- Scalability planning
## Pre-Flight Checklist
- [ ] Identify performance bottleneck
- [ ] Gather baseline metrics
- [ ] Determine acceptable thresholds
- [ ] Plan measurement approach
## Performance Analysis Framework
### Step 1: Identify Bottleneck Type
```
Performance Issue
├── Database (slow queries, N+1)
├── API (serialization, processing)
├── Network (payload size, latency)
└── Frontend (rendering, bundle size)
```
### Step 2: Measure Baseline
```bash
# API response time
curl -w "@curl-format.txt" -o /dev/null -s "http://api/endpoint"
# Database query time (SQL Server)
SET STATISTICS TIME ON;
SELECT * FROM Table WHERE ...;
# Frontend bundle analysis
npm run build -- --stats-json
npx webpack-bundle-analyzer stats.json
```
## Database Optimization
### N+1 Query Detection
```csharp
// :x: N+1 Problem
var employees = await repo.GetAllAsync();
foreach (var emp in employees)
{
// Each iteration queries database!
Console.WriteLine(emp.Department.Name);
}
// :white_check_mark: Eager Loading
var employees = await repo.GetAllAsync(
e => e.CompanyId == companyId,
ct,
e => e.Department, // Include Department
e => e.Manager // Include Manager
);
```
### Query Optimization
```csharp
// :x: Loading all columns
var employees = await repo.GetAllAsync();
var names = employees.Select(e => e.Name);
// :white_check_mark: Projection
var names = await repo.GetAllAsync(
q => q.Where(e => e.IsActive)
.Select(e => e.Name));
```
### Index Recommendations
```sql
-- Frequently filtered columns
CREATE INDEX IX_Employee_CompanyId ON Employees(CompanyId);
CREATE INDEX IX_Employee_Status ON Employees(Status);
-- Composite index for common queries
CREATE INDEX IX_Employee_Company_Status
ON Employees(CompanyId, Status)
INCLUDE (FullName, Email);
-- Full-text search index
CREATE FULLTEXT INDEX ON Employees(FullName, Email);
```
### Paging Patterns
```csharp
// :x: Loading all then paging in memory
var all = await repo.GetAllAsync();
var page = all.Skip(skip).Take(take);
// :white_check_mark: Database-level paging
var page = await repo.GetAllAsync(
(uow, q) => q
.Where(e => e.IsActive)
.OrderBy(e => e.Id)
.Skip(skip)
.Take(take));
```
## API Optimization
### Parallel Operations
```csharp
// :x: Sequential
var users = await userRepo.GetAllAsync();
var companies = await companyRepo.GetAllAsync();
var settings = await settingsRepo.GetAllAsync();
// :white_check_mark: Parallel (Tuple Await)
var (users, companies, settings) = await (
userRepo.GetAllAsync(),
companyRepo.GetAllAsync(),
settingsRepo.GetAllAsync()
);
```
### Response Size
```csharp
// :x: Returning entire entity
return new Result { Employee = employee };
// :white_check_mark: Return only needed fields
return new Result
{
Id = employee.Id,
Name = employee.FullName,
Status = employee.Status
};
```
### Caching
```csharp
// Static data caching
private static readonly ConcurrentDictionary<string, LookupData> _cache = new();
public async Task<LookupData> GetLookupAsync(string key)
{
if (_cache.TryGetValue(key, out var cached))
return cached;
var data = await LoadFromDbAsync(key);
_cache.TryAdd(key, data);
return data;
}
```
## Frontend Optimization
### Bundle Size
```typescript
// :x: Import entire library
import _ from 'lodash';
// :white_check_mark: Import specific functions
import { debounce } from 'lodash-es/debounce';
```
### Lazy Loading
```typescript
// :white_check_mark: Lazy load routes
const routes: Routes = [
{
path: 'feature',
loadChildren: () => import('./feature/feature.module')
.then(m => m.FeatureModule)
}
];
```
### Change Detection
```typescript
// :white_check_mark: OnPush for performance
@Component({
changeDetection: ChangeDetectionStrategy.OnPush
})
// :white_check_mark: Track-by for lists
trackByItem = this.ngForTrackByItemProp<Item>('id');
// Template
@for (item of items; track trackByItem)
```
### Virtual Scrolling
```typescript
// For large lists
import { CdkVirtualScrollViewport } from '@angular/cdk/scrolling';
<cdk-virtual-scroll-viewport itemSize="50">
@for (item of items; track item.id) {
<div class="item">{{ item.name }}</div>
}
</cdk-virtual-scroll-viewport>
```
## Background Job Optimization
### Bounded Parallelism
```csharp
// :x: Unbounded
await items.ParallelAsync(ProcessAsync);
// :white_check_mark: Bounded
await items.ParallelAsync(ProcessAsync, maxConcurrent: 5);
```
### Batch Processing
```csharp
// :x: One at a time
foreach (var item in items)
await repo.UpdateAsync(item);
// :white_check_mark: Batch update
await repo.UpdateManyAsync(items, dismissSendEvent: true);
```
## Performance Monitoring
### Logging Slow Operations
```csharp
var sw = Stopwatch.StartNew();
var result = await ExecuteOperation();
sw.Stop();
if (sw.ElapsedMilliseconds > 1000)
Logger.LogWarning("Slow operation: {Ms}ms", sw.ElapsedMilliseconds);
```
### Database Query Logging
```csharp
// In DbContext configuration
optionsBuilder.LogTo(
Console.WriteLine,
new[] { DbLoggerCategory.Database.Command.Name },
LogLevel.Information);
```
## Performance Checklist
### Database
- [ ] Indexes on filtered columns
- [ ] Eager loading for relations
- [ ] Projection for partial data
- [ ] Paging at database level
- [ ] No N+1 queries
### API
- [ ] Parallel operations where possible
- [ ] Response DTOs (not entities)
- [ ] Caching for static data
- [ ] Pagination for lists
### Frontend
- [ ] Lazy loading for routes
- [ ] OnPush change detection
- [ ] Track-by for lists
- [ ] Virtual scrolling for large lists
- [ ] Tree-shaking imports
### Background Jobs
- [ ] Bounded parallelism
- [ ] Batch operations
- [ ] Paged processing
- [ ] Appropriate scheduling
## Anti-Patterns to AVOID
:x: **SELECT * in production**
```csharp
var all = await context.Table.ToListAsync();
```
:x: **Synchronous I/O**
```csharp
var result = asyncOperation.Result; // Blocks thread
```
:x: **Unbounded result sets**
```csharp
await repo.GetAllAsync(); // Could be millions
```
:x: **Repeated database calls in loops**
```csharp
foreach (var id in ids)
await repo.GetByIdAsync(id); // N queries
```
## Verification Checklist
- [ ] Baseline metrics recorded
- [ ] Bottleneck identified and addressed
- [ ] Changes measured against baseline
- [ ] No new performance issues introduced
- [ ] Monitoring in placeRelated Skills
gpt-researcher
Run GPT-Researcher multi-agent deep research framework locally using OpenAI GPT-5.2. Replaces ChatGPT Deep Research with local control. Researches 100+ sources in parallel, provides comprehensive citations. Use for Phase 3 industry/technical research or comprehensive synthesis. Takes 6-20 min depending on report type. Supports multiple LLM providers.
generative-optimization
Expert guidance for solving optimization problems using generative models (GMM and Flow Matching). Use when users need to solve optimization, inverse problems, or find feasible solutions under constraints using probabilistic sampling approaches.
deep-research
Web research with Graph-of-Thoughts for fast-changing topics. Use when user requests research, analysis, investigation, or comparison requiring current information. Features hypothesis testing, source triangulation, claim verification, Red Team, self-critique, and gap analysis. Supports Quick/Standard/Deep/Exhaustive tiers. Creative Mode for cross-industry innovation.
database-architect
Database design and optimization specialist. Schema design, query optimization, indexing strategies, data modeling, and migration planning for relational and NoSQL databases.
brutal-deepresearch
Structured deep research pipeline with confirmation gates and resume support. Generates outline, launches parallel research agents, produces validated JSON results and markdown report.
architecture-paradigm-pipeline
Consult this skill when designing data pipelines or transformation workflows. Use when data flows through fixed sequence of transformations, stages can be independently developed and tested, parallel processing of stages is beneficial. Do not use when selecting from multiple paradigms - use architecture-paradigms first. DO NOT use when: data flow is not sequential or predictable. DO NOT use when: complex branching/merging logic dominates.
architecture-advisor
Helps solo developers with AI agents choose optimal architecture (monolithic/microservices/hybrid)
architecting-data
Strategic guidance for designing modern data platforms, covering storage paradigms (data lake, warehouse, lakehouse), modeling approaches (dimensional, normalized, data vault, wide tables), data mesh principles, and medallion architecture patterns. Use when architecting data platforms, choosing between centralized vs decentralized patterns, selecting table formats (Iceberg, Delta Lake), or designing data governance frameworks.
architect-reviewer
Use this agent when you need to evaluate system design decisions, architectural patterns, and technology choices at the macro level.
architect-agent
Coordinates planning, delegation, and evaluation across architect and code agent workspaces. Use when asked to "write instructions for code agent", "initialize architect workspace", "grade code agent work", "send instructions", or "verify code agent setup".
arch-review
Systematic review of existing architecture using ATAM-lite methodology. Evaluates architectural fitness against quality attribute scenarios, identifies risks, sensitivity points, tradeoffs, and anti-patterns. Produces structured review report with findings and recommendations.
arch-database
DB architecture: relational vs document vs graph vs vector, schema design, indexing, replication, sharding