Automated summary
Provides a systematic approach to identify and resolve performance bottlenecks across database, API, and frontend layers.
Strengths
- Clear step-by-step workflow for bottleneck classification
- Covers database index optimization, API caching, and frontend lazy loading
- Includes baseline measurement and verification steps
Limitations
- Assumes familiarity with specific tools (curl, webpack-bundle-analyzer)
- May not cover deep language/framework-specific optimizations
- No guidelines for distributed system or microservices performance
When application response times are slow or you need to systematically improve performance across the stack.
When the performance issue is already isolated to a single component requiring deep expertise (e.g., complex SQL query rewriting beyond indexing).
Security analysis
SafeThe skill provides guidance on performance optimization techniques across layers, with no destructive, exfiltrating, or obfuscated actions. It uses Bash for measurement tools (curl, npm) and database scripts, which are standard and safe when used as directed for analysis purposes.
No concerns found
How this analysis is madeExamples
My /api/users endpoint is taking over 2 seconds. I suspect it's a database query. Help me profile and optimize it.The admin dashboard loads slowly due to large bundle size. How can I reduce it with code splitting and lazy loading?I'm seeing many repeated database queries when fetching orders with their items. How do I detect and fix N+1?name: arch-performance-optimization version: 1.1.0 description: '[Architecture] Use when analyzing and improving performance for database queries, API endpoints, or frontend rendering.' allowed-tools: Read, Write, Edit, Grep, Glob, Bash, Task
[IMPORTANT] Use
TaskCreateto break ALL work into small tasks BEFORE starting — including tasks for each file read. This prevents context loss from long files. For simple tasks, AI may ask user whether to skip.
Prerequisites: MUST READ .claude/skills/shared/evidence-based-reasoning-protocol.md before executing.
Quick Summary
Goal: Analyze and resolve performance bottlenecks across database, API, network, and frontend layers.
Workflow:
- Identify Bottleneck — Classify as database, API, network, or frontend issue
- Measure Baseline — Gather metrics before changes (response time, query time, bundle size)
- Optimize — Apply layer-specific fixes (indexes, caching, lazy loading, OnPush)
- Verify — Measure again and confirm improvement without regressions
Key Rules:
- Never use
SELECT *or unbounded result sets in production - Always use async I/O; never block threads with
.Result - Avoid N+1 queries — use eager loading or batch fetching
- Use bounded parallelism (
ParallelAsyncwithmaxConcurrent) for background jobs
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
# 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
⚠️ MUST READ: CLAUDE.md for N+1 detection, eager loading, projection, paging, and parallel query patterns. See database-optimization skill for advanced index and query optimization.
Index Recommendations
-- 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);
API Optimization
⚠️ MUST READ: CLAUDE.md for parallel tuple queries and response DTO patterns.
Caching
// 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
// :x: Import entire library
import _ from 'lodash';
// :white_check_mark: Import specific functions
import { debounce } from 'lodash-es/debounce';
Lazy Loading
// :white_check_mark: Lazy load routes
const routes: Routes = [
{
path: 'feature',
loadChildren: () => import('./feature/feature.module').then(m => m.FeatureModule)
}
];
Change Detection
// :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
// 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
⚠️ MUST READ: CLAUDE.md for bounded parallelism (ParallelAsync with maxConcurrent) and batch processing (UpdateManyAsync) patterns.
Performance Monitoring
Logging Slow Operations
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
// 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
var all = await context.Table.ToListAsync();
:x: Synchronous I/O
var result = asyncOperation.Result; // Blocks thread
:x: Unbounded result sets
await repo.GetAllAsync(); // Could be millions
:x: Repeated database calls in loops
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 place
Related
arch-security-reviewdatabase-optimization
IMPORTANT Task Planning Notes (MUST FOLLOW)
- Always plan and break work into many small todo tasks
- Always add a final review todo task to verify work quality and identify fixes/enhancements
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/architecture-performance-optimization-mm78nmmh/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/architecture-performance-optimization-mm78nmmh' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/architecture-performance-optimization-mm78nmmh/download' --output '.skill-downloads/architecture-performance-optimization-mm78nmmh/SKILL.md.part' && mv '.skill-downloads/architecture-performance-optimization-mm78nmmh/SKILL.md.part' '.skill-downloads/architecture-performance-optimization-mm78nmmh/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.
Tools declared by the author (check availability in your agent): Read, Write, Edit, Grep, Glob, Bash, Task
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/architecture-performance-optimization-mm78nmmh/SKILL.md' && test -s '.skill-downloads/architecture-performance-optimization-mm78nmmh/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/arch-performance-optimization' && cp -R '.skill-downloads/architecture-performance-optimization-mm78nmmh' '.claude/skills/arch-performance-optimization'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/architecture-performance-optimization-mm78nmmh'openskills read 'architecture-performance-optimization-mm78nmmh'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/architecture-performance-optimization-mm78nmmh/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.