Skip to content

JPeetz/agent-skills / skills/devops-infrastructure/performance-optimization

performance-optimization

Verified

Use this skill when optimizing application performance across frontend (Core Web Vitals, bundles), backend (N+1 queries, connection pools, caching), and database (indexes, query plans). Profiles before fixing, pinpoints actual bottlenecks rather than assumed ones, verifies improvements by re-measuring the same way as baseline.

references/image-optimization-guidelines.md

View on GitHub
# Image Optimization Guidelines

## Format Selection

| Format | Best For | Notes |
|--------|----------|-------|
| WebP | Photos, illustrations | 25–35% smaller than JPEG; widely supported |
| AVIF | Photos with fine detail | 50% smaller than JPEG; limited but growing support |
| JPEG | Photographs | Universal fallback |
| PNG | Graphics with transparency, screenshots | Lossless, avoid for photos |
| SVG | Icons, logos, illustrations | Scalable, tiny file sizes |

## Responsive Images with `<picture>`

```html
<picture>
  <source type="image/avif" srcset="photo-800.avif 800w, photo-1200.avif 1200w" sizes="(max-width: 600px) 100vw, 50vw">
  <source type="image/webp" srcset="photo-800.webp 800w, photo-1200.webp 1200w" sizes="(max-width: 600px) 100vw, 50vw">
  <img src="photo-800.jpg" width="800" height="600" alt="Description" loading="lazy" decoding="async">
</picture>
```

## Critical Attributes

| Attribute | Purpose |
|-----------|---------|
| `width` + `height` | Reserve layout space (prevents CLS) |
| `loading="lazy"` | Defer offscreen images (standard for below-fold) |
| `loading="eager"` | Ensure LCP image loads immediately |
| `decoding="async"` | Decode off the main thread |
| `fetchpriority="high"` | Hint for LCP image prioritization |

## Lazy Loading Strategy

- **Above-fold:** Eager load with `loading="eager"`, `fetchpriority="high"`, `width`/`height` set
- **Below-fold:** `loading="lazy"` with a 200px threshold (browser default)
- **Avoid:** Over-lazy-loading the hero image or LCP candidate — it delays LCP

## Tooling

- `squoosh` (CLI / web) — manual compression
- `sharp` (Node.js) — programmatic resize + format conversion
- `imagemagick` — batch resizing
- Cloudinary / imgix — CDN-based image transformation
deprecation-and-migrationaddyosmani/agent-skillsManages deprecation and migration. Use when removing old systems, APIs, or features. Use when migrating users from one implementation to another. Use when migrating a database schema in production, such as renaming or dropping a column without downtime (expand/contract). Use when deciding whether to maintain or sunset existing code.Stars: 119kUpdated Claude CodeCodexVerifiedInstall
performance-optimizationaddyosmani/agent-skillsOptimizes application performance across frontend, backend, queries, and databases. Use when performance requirements exist, when you suspect performance regressions, when Core Web Vitals or load times need improvement, when N+1 query patterns need fixing, or when profiling reveals bottlenecks.Stars: 119kUpdated Claude CodeCodexVerifiedInstall
Agent Cost Reportthedotmack/claude-memBelievable agent cost report for any period, default the last 7 full days PT, not counting today. Measured tokens from Claude Code transcripts priced at OpenRouter list prices (ESTIMATED), measured provider spend when a sanctioned source exists, note-taker cost separate, Timing-style HTML/PDF plus report.json, line-items.csv, evidence.json.Stars: 118kUpdated Claude CodeCodexVerifiedInstall
Agent Cost Reportthedotmack/claude-memBelievable agent cost report for any period, default the last 7 full days PT, not counting today. Measured tokens from Claude Code transcripts priced at OpenRouter list prices (ESTIMATED), measured provider spend when a sanctioned source exists, note-taker cost separate, Timing-style HTML/PDF plus report.json, line-items.csv, evidence.json.Stars: 118kUpdated Claude CodeCodexVerifiedInstall