/vibe:ghcopilot-instr-performance-optimizationfrom vibe
Enforces Core Web Vitals performance standards (LCP, INP, CLS) with 50+ anti-patterns, detection regex, and framework-specific fixes. Use when optimizing web app performance.
Ships in vibe. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Comprehensive performance rules for web application development. Every anti-pattern includes a severity classification, detection method, Core Web Vitals metric impacted, and corrective code examples.
Severity levels:
Good: < 2.5s | Needs Improvement: 2.5-4s | Poor: > 4s
Measures when the largest visible content element finishes rendering. Four sequential phases:
| Phase | Target | What It Measures |
|---|---|---|
| TTFB | ~40% of budget | Server response time |
| Resource Load Delay | < 10% | Time between TTFB and LCP resource fetch start |
| Resource Load Duration | ~40% | Download time for the LCP resource |
| Element Render Delay | < 10% | Time between download and paint |
Good: < 200ms | Needs Improvement: 200-500ms | Poor: > 500ms
Measures latency of all user interactions, reports the worst. Three phases:
| Phase | Optimization |
|---|---|
| Input Delay | Break long tasks, yield to browser |
| Processing Time | Keep handlers < 50ms |
| Presentation Delay | Minimize DOM size, avoid forced layout |
Diagnostic tool: Use the Long Animation Frames (LoAF) API (Chrome 123+) to debug INP issues. LoAF provides better attribution than the legacy Long Tasks API, including script source and rendering time.
Good: < 0.1 | Needs Improvement: 0.1-0.25 | Poor: > 0.25
Layout shift sources: images without dimensions, dynamically injected content, web font FOUT, late-loading ads. Shifts within 500ms of user interaction are exempt.
<link.*rel="stylesheet" in <head> loading large CSS<!-- BAD -->
<link rel="stylesheet" href="/styles/main.css" />
<!-- GOOD — inline critical CSS (extracted at build time), preload the rest -->
<style>/* critical above-fold CSS, inlined by a tool like Critters/Beasties */</style>
<link rel="preload" href="/styles/main.css" as="style" />
<link rel="stylesheet" href="/styles/main.css" />
Prefer build-time critical CSS extraction (e.g., Critters, Beasties, Next.js experimental.optimizeCss) plus a normal <link rel="stylesheet">. Avoid the older media="print" onload="this.media='all'" trick: inline event handlers are blocked under a strict CSP (no 'unsafe-inline' / no script-src-attr 'unsafe-inline'), which would prevent the stylesheet from ever activating and cause a styling regression. If non-critical CSS truly must be deferred, load it via an external script that swaps media, not an inline handler.
<script.*src= without async|defer|type="module"<!-- BAD -->
<script src="/vendor/analytics.js"></script>
<!-- GOOD -->
<script src="/vendor/analytics.js" defer></script>
<link rel="preconnect"><link rel="preconnect" href="https://api.example.com" />
<link rel="dns-prefetch" href="https://analytics.example.com" />
<link rel="preload" as="image" href="/hero.webp" fetchpriority="high" />
useEffect.*fetch|useEffect.*axios|ngOnInit.*subscribe// BAD — content appears after JS execution + API call
'use client';
function Page() {
const [data, setData] = useState(null);
useEffect(() => { fetch('/api/data').then(r => r.json()).then(setData); }, []);
return <div>{data?.title}</div>;
}
// GOOD — Server Component fetches data before HTML is sent
async function Page() {
const data = await fetch('https://api.example.com/data').then(r => r.json());
return <div>{data.title}</div>;
}
Each redirect adds 200-300ms. Maximum one redirect.
fetchpriority="high" or priority prop// Next.js
<Image src="/hero.webp" alt="Hero" width={1200} height={600} priority />
// Angular
<img ngSrc="/hero.webp" alt="Hero" width="1200" height="600" priority>
// Plain HTML
<img src="/hero.webp" alt="Hero" width="1200" height="600" fetchpriority="high" />
<script.*src="https:// without async|deferDefer non-essential scripts. Use facade pattern for chat widgets.
Reduce inline CSS/JS, remove whitespace, use streaming SSR with Suspense boundaries.
content-encoding: br or gzipEnable Brotli (15-25% better than gzip) at CDN/server level.
"use client" at top-level layout or page componentPush "use client" down to leaf components that need interactivity.
<Suspense>// GOOD — stream shell immediately, fill in data progressively
async function Page() {
const user = await getUser();
return (
<div>
<Header user={user} />
<Suspense fallback={<PostsSkeleton />}>
<Posts />
</Suspense>
</div>
);
}
Date.now()|Math.random()|window\.innerWidth in SSR componentsUse useEffect for client-only values, or suppressHydrationWarning for known differences.
Use streaming SSR with Suspense boundaries. Shell streams immediately; slow data fills in progressively.
style=\{\{|onClick=\{\(\) => inline in JSXReact 19+ with React Compiler enabled (separate babel/SWC build plugin): auto-memoized. Without Compiler: extract or memoize with useMemo/useCallback. Angular: OnPush. Vue: computed().
.map( rendering >100 items without virtual scrollingUse TanStack Virtual, react-window, Angular CDK Virtual Scroll, or vue-virtual-scroller.
display: none componentsUse client-side rendering for modals, drawers, dropdowns. Angular: @defer. React: React.lazy.
key Prop on List Items.map( without key= prop// GOOD — stable unique key
{items.map(item => <Row key={item.id} data={item} />)}
Never use array index as key if list can reorder.
// GOOD — yield to browser
async function handleClick() {
setLoading(true);
await (globalThis.scheduler?.yield?.() ?? new Promise(r => setTimeout(r, 0)));
const result = expensiveComputation(data);
setResult(result);
}
Move heavy work to Web Worker for best results.
Note:
scheduler.yield()is supported in Chrome 129+, Firefox 129+, but NOT Safari as of April 2026. Fallback:await (globalThis.scheduler?.yield?.() ?? new Promise(r => setTimeout(r, 0))).
offsetHeight|offsetWidth|getBoundingClientRect|clientHeight in loops// GOOD — batch reads then batch writes
const heights = elements.map(el => el.offsetHeight);
elements.forEach((el, i) => { el.style.height = `${heights[i] + 10}px`; });
setInterval|setTimeout without cleanupuseEffect(() => {
const id = setInterval(() => fetchData(), 5000);
return () => clearInterval(id);
}, []);
addEventListener without cleanupuseEffect(() => {
const controller = new AbortController();
window.addEventListener('resize', handleResize, { signal: controller.signal });
return () => controller.abort();
}, []);
Set references to null when elements are removed.
XMLHttpRequest with synchronous flagUse fetch() (always async).
Move to Web Worker or break into chunks with scheduler.yield().
useEffect without return cleanup; subscribe without unsubscribeReact: return cleanup from useEffect. Angular: takeUntilDestroyed(). Vue: onUnmounted.
animation:|transition: with top|left|width|height|margin|padding/* BAD — main thread, <60fps */
.card { transition: width 0.3s, height 0.3s; }
/* GOOD — GPU compositor, 60fps */
.card { transition: transform 0.3s, opacity 0.3s; }
.card:hover { transform: scale(1.05); }
content-visibility: auto.below-fold-section {
content-visibility: auto;
contain-intrinsic-size: auto 500px;
}
will-change: in base CSS (not :hover|:focus)Apply on interaction only or let browser optimize automatically.
Use PurgeCSS, Tailwind purge, or critters. Code-split CSS per route.
\* \{ in CSS/* GOOD — zero-specificity reset */
:where(*, *::before, *::after) { box-sizing: border-box; }
contain property.sidebar { contain: layout style paint; }
// Use View Transitions for smooth route changes (with feature check)
if (document.startViewTransition) {
document.startViewTransition(() => {
// update DOM / navigate
});
} else {
// fallback: update DOM directly
}
Same-document transitions supported in all major browsers. Cross-document supported in Chrome/Edge 126+, Safari 18.5+. Always feature-check before calling — unsupported browsers will throw without the guard.
<img without width= and height=Always set width and height on images, or use aspect-ratio in CSS.
loading="lazy" on hero/banner images<!-- GOOD — eager load with high priority -->
<img src="/hero.webp" alt="Hero" fetchpriority="high" />
<picture>
<source srcset="/hero.avif" type="image/avif" />
<source srcset="/hero.webp" type="image/webp" />
<img src="/hero.jpg" alt="Hero" width="1200" height="600" />
</picture>
<img without srcset<img src="/hero-800.jpg" alt="Hero"
srcset="/hero-400.jpg 400w, /hero-800.jpg 800w, /hero-1200.jpg 1200w"
sizes="(max-width: 600px) 400px, (max-width: 1024px) 800px, 1200px" />
@font-face without font-display@font-face {
font-family: 'CustomFont';
src: url('/fonts/custom.woff2') format('woff2');
font-display: swap; /* or "optional" for best CLS */
}
<link rel="preload"><link rel="preload" href="/fonts/main.woff2" as="font" type="font/woff2" crossorigin />
Use unicode-range, subset with glyphhanger, or next/font (auto-subsets Google Fonts).
npx svgo input.svg -o output.svg
from '\.\/(?:.*\/index|components)'// BAD
import { Button } from './components';
// GOOD — direct import
import { Button } from './components/Button';
require( in frontend codeUse ESM import/export. Replace require with import.
from "moment"|from "lodash" (full imports)// GOOD — tree-shakeable alternatives
import { format } from 'date-fns';
import { pick } from 'lodash-es';
// BEST — native JS
const formatted = new Intl.DateTimeFormat('en').format(date);
// Next.js: automatic with file-based routing
// React:
const Page = React.lazy(() => import('./pages/Page'));
// Angular:
{ path: 'settings', loadComponent: () => import('./pages/settings.component') }
// Vue:
const Page = defineAsyncComponent(() => import('./pages/Page.vue'));
"sideEffects" field{ "sideEffects": false }
npm dedupe
<img in .tsx instead of <Image>import Image from 'next/image';
<Image src="/hero.jpg" alt="Hero" width={1200} height={600} priority />
"use cache" directive in Next.js 16+ projects// BAD — entire page is dynamic
export default async function Page() {
const data = await fetchData(); // blocks full page render
return <div>{data.title}</div>;
}
// GOOD — enable Partial Prerendering with "use cache"
// next.config.ts: { cacheComponents: true }
"use cache";
export default async function Page() {
const data = await fetchData(); // static shell renders instantly, dynamic holes stream
return <div>{data.title}</div>;
}
Enable in next.config.ts with cacheComponents: true. Use "use cache" at file, component, or function level. Static shell loads instantly; dynamic content streams via Suspense boundaries.
"use client" on components without hooks or browser APIsRemove "use client" from components that only render static content.
useEffect + fetch in Next.js App Router pagesFetch data in Server Components directly (async function body).
fonts.googleapis|fonts.gstatic in CSS/HTMLimport { Inter } from 'next/font/google';
const inter = Inter({ subsets: ['latin'] });
"use cache" in Next.js 16+ with cacheComponents: true// BAD — data fetched on every request
async function getProducts() {
return await db.products.findMany();
}
// GOOD — cached with revalidation
"use cache";
import { cacheLife } from 'next/cache';
async function getProducts() {
cacheLife('hours');
return await db.products.findMany();
}
"use cache" replaces the old unstable_cache and fetch cache options. Use cacheLife() and cacheTag() for fine-grained control.
ChangeDetectionStrategy.OnPush (Angular <19) or without signals (Angular 19+)// Angular <19: Use OnPush
@Component({
changeDetection: ChangeDetectionStrategy.OnPush,
...
})
// Angular 19+: Prefer zoneless with signals
// app.config.ts: provideZonelessChangeDetection()
@Component({ ... })
export class ProductCard {
product = input.required<Product>(); // signal input
price = computed(() => this.product().price * 1.19); // derived signal
}
Angular 19+: prefer zoneless change detection with signals. OnPush is unnecessary when using signal-based reactivity. Angular 20+ has stable zoneless support.
<img without ngSrc in .component.html<img ngSrc="/hero.jpg" alt="Hero" width="1200" height="600" priority />
@defer (on viewport) {
<app-heavy-chart [data]="chartData" />
} @placeholder {
<div class="chart-skeleton"></div>
}
Use signal() for reactive state, computed() for derived values. Signal APIs (signal(), computed(), effect()) are stable since Angular 20.
withIncrementalHydration() in Angular 19+// BAD — full hydration blocks interactivity
provideClientHydration()
// GOOD — incremental hydration with triggers
provideClientHydration(withIncrementalHydration())
Use @defer triggers (on viewport, on interaction) to hydrate components on demand. Reduces TTI by deferring non-critical component hydration.
zone.js in polyfills array, no provideZonelessChangeDetection() in Angular 20+// app.config.ts
export const appConfig = {
providers: [
provideZonelessChangeDetection(), // removes ~15-30KB from bundle
// ...
]
};
Zoneless change detection with signals reduces bundle size and improves runtime performance. Stable since Angular 20.
useMemo|useCallback in React 19+ projectEnable React Compiler (v19+) for auto-memoization. Remove manual wrappers.
useTransitionconst [isPending, startTransition] = useTransition();
function handleFilter(value) {
startTransition(() => setFilter(value));
}
const deferredQuery = useDeferredValue(query);
const results = expensiveFilter(items, deferredQuery);
const Settings = React.lazy(() => import('./pages/Settings'));
reactive( on large arrays or deep objectsUse shallowRef() or shallowReactive() for large data.
v-memo<div v-for="item in items" :key="item.id" v-memo="[item.id, item.updatedAt]">
<ExpensiveItem :data="item" />
</div>
const HeavyChart = defineAsyncComponent(() => import('./HeavyChart.vue'));
Vue 3.6+ Vapor Mode compiles templates to direct DOM operations, bypassing the virtual DOM. Use for performance-critical subtrees. Can be mixed with standard components.
| Hint | Purpose | When to Use |
|---|---|---|
preconnect | DNS + TCP + TLS early | Critical third-party origins (API, CDN, fonts) |
preload | Fetch immediately, high priority | LCP image, critical font |
prefetch | Low priority for future navigation | Next-page assets |
dns-prefetch | DNS resolution only | Non-critical third-party origins |
modulepreload | Preload + parse ES module | Critical JS modules |
<script type="speculationrules"> | Prefetch/prerender next navigation | Likely next pages (Chrome 121+, progressive enhancement) |
| Aspect | Recommendation |
|---|---|
| Format | WebP (25-34% smaller), AVIF (50% smaller) |
| LCP image | fetchpriority="high" or framework priority prop |
| Below-fold | loading="lazy" |
| Dimensions | Always set width + height |
| Responsive | srcset + sizes or framework Image component |
| Compression | Quality 75-85 for photos |
| Strategy | Best For | CLS Impact |
|---|---|---|
font-display: swap | Body text | Slight FOUT, minimal CLS |
font-display: optional | All fonts (best CLS) | No FOUT, no CLS |
next/font | Next.js projects | Zero CLS |
| Variable fonts | Multiple weights | Single file for all weights |
Rules: preload 1-2 critical fonts only, use WOFF2, subset to needed characters, self-host when possible.
fetchpriority="high" or priority proploading="lazy" on above-fold imagesdefer or async)srcsetfont-display: swap or optionalrequire)"use client" only on components that need interactivitywidth and height attributesfont-display: swap or optionalcontent-visibility: auto has contain-intrinsic-sizeWhat SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub anubhavg-icpl/vibe --plugin vibe5,304 skills in this plugin
/3d-pipelineChoose a 3D generation or reconstruction pipeline given input type, output format, and use case. Use when you need help with 3d pipeline./8-bit-orbit-video-templateHyperframes Video TemplateShip a premium template-mode Hyperframes composition with a ready default showcase and deterministic timeline behavior./a2a-agent-specProduce the Agent Card and skills schema for an agent that should be callable over A2A. Use when you need help with a2a agent spec.Other plugins' skills for the same job