<< All versions

Skill v1.0.0

currentAutomated scan100/100
darknecrocities/skillbuilder/performance
──Details
PublishedNovember 24, 2026 at 05:26 PM
Content Hashsha256:41f6f3542be3837c...
Git SHA170d96d79d4e
──Files
Files (1 file, 4.6 KB)
SKILL.md4.6 KBactive
SKILL.md · 116 lines · 4.6 KB

name: performance description: Performance profiling and optimization skill. Audits Core Web Vitals (LCP, CLS, INP), N+1 queries, bundle budgets, and memory leaks. metadata: version: "1.0.0"


Performance Profiling & Optimization (/performance)

Philosophy: Measure with evidence, not intuition. Eliminate N+1 query cascades, bound memory allocations, and enforce strict Core Web Vitals budgets. If it is not measured, it will degrade.

This skill establishes performance optimization standards across frontend client bundles, Core Web Vitals, API latency budgets, memory leaks, and database query executions.


1. Quick Navigation & Progressive Disclosure

Resource TypeDocumentDescription
Referencereferences/core-web-vitals-audit.mdLCP, INP, and CLS metric targets, hero image preloading, layout shift prevention.
Referencereferences/memory-leak-profiling.mdFront-end leak sources, detached DOM nodes, Chrome DevTools heap profiling.
Utilityscripts/audit_performance_budgets.pyAudits bundle sizes, unoptimized images, inline fetch waterfalls, and N+1 query loops.

2. Performance Guardrails & Budgets

mermaid
flowchart TD
subgraph FrontendBudgets["1. Frontend & Client Budgets"]
A["Core Web Vitals: LCP < 2.5s, CLS < 0.1, INP < 200ms"]
B["Initial JS Bundle Budget: < 150KB Gzip"]
C["Aspect-Ratio Reservation on All Media"]
end
subgraph NetworkBudgets["2. Network & Caching"]
D["API p95 Latency < 200ms"]
E["Bounded LRU Caches with TTL & Eviction"]
F["Immutable Cache Headers on Static Assets"]
end
subgraph DataBudgets["3. Datastore & Execution"]
G["Zero N+1 Query Cascades (Batch / Join Fetch)"]
H["Connection Pool Sizing <= 2 * CPU Cores"]
I["Zero Unbounded Loops in Event Handlers"]
end
FrontendBudgets --> NetworkBudgets --> DataBudgets

2. Core Web Vitals (CWV) Optimization Guide

MetricTarget BudgetOptimization StrategiesFailure Anti-Pattern
LCP (Largest Contentful Paint)< 2.5sPreload hero image (fetchpriority="high"), inline critical CSS, server-side render text contentLazy-loading the hero image (loading="lazy" on above-the-fold content)
CLS (Cumulative Layout Shift)< 0.1Explicit width and height or aspect-ratio: 16/9, reserved skeleton blocks for ads/bannersDynamic insertion of content above existing content without reserved space
INP (Interaction to Next Paint)< 200msDebounce inputs (200-300ms), break long tasks via scheduler.yield(), move heavy compute to Web WorkersSynchronous regex or sorting of 10,000 items on main thread

3. JavaScript Memory Safety & Leak Prevention

Avoid the 3 most common Node.js / React memory leaks:

  1. Unbounded Global Maps / Caches:

```typescript // ❌ LEAK: Map grows indefinitely until OOM crash const cache = new Map();

// ✅ PRODUCTION: LRU cache with strict entry cap import { LRUCache } from "lru-cache"; const cache = new LRUCache({ max: 500, ttl: 1000 60 5 }); // 5 minutes TTL ```

  1. Dangling Event Listeners:

``typescript // Always remove listeners in cleanup function useEffect(() => { const handler = () => handleResize(); window.addEventListener("resize", handler); return () => window.removeEventListener("resize", handler); }, []); ``

  1. Uncleared Timers / Intervals:

Store timer references and clear them in component unmount or error handlers.


4. Input Debouncing & Rate Limiting

Never trigger network requests on every raw keystroke. Debounce input changes:

typescript
export function useDebounce<T>(value: T, delayMs: number = 300): T {
const [debounced, setDebounced] = useState<T>(value);
useEffect(() => {
const timer = setTimeout(() => setDebounced(value), delayMs);
return () => clearTimeout(timer);
}, [value, delayMs]);
return debounced;
}

5. Performance Budget Auditor CLI

Scan your repository for bundle size violations, missing media dimensions, and N+1 query patterns:

bash
python3 skills/performance/scripts/audit_performance_budgets.py --path .

Audits:

  • Presence of explicit dimensions or aspect ratios on image/video tags.
  • Nested loop database queries in backend controllers.
  • Unbounded in-memory collections without eviction policies.
  • Client bundles exceeding size budgets.
All versions