ai-infrastructure-hugg…
Hugging Face Inference SDK patterns for TypeScript/Node.js — InferenceClient setup, chat completion, text generation, streaming, embeddings, image generation,…
Bundle optimization, render performance, Core Web Vitals
$ npx -y skills add agents-inc/skills --skill web-performance-web-performance --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/web-performance-web-performanceContext preview
The summary Claude sees to decide when to auto-load this skill.
Bundle optimization, render performance, Core Web Vitals
name: web-performance-web-performance description: Bundle optimization, render performance, Core Web Vitals
> **Quick Guide:** Three numbers decide whether a page is fast: LCP under 2.5s, INP under 200ms, CLS under 0.1. Bundle size is the lever that moves the first two, so budget it — around 200 KB gzipped for the main bundle — and split by route. Measure before optimising and measure again in production, because a lab score and a real user's session disagree. With the React Compiler enabled, memoisation is automatic; a hand-written `useMemo` needs a profile behind it.
**Detailed Resources:**
---
[examples/code-splitting.md](examples/code-splitting.md).
[examples/core.md](examples/core.md).
guessing picks the wrong one; go to [examples/web-vitals.md](examples/web-vitals.md).
---
<critical_requirements>
**Profile first, and name the bottleneck before changing anything.** Every optimisation costs readability, and one applied to code that was never slow buys nothing back — a profiler, a bundle analysis, or a field measurement is what turns a guess into a target.
**Write the budgets down before the features.** A bundle limit and Core Web Vitals targets that exist in CI are a decision every future dependency is measured against; added afterwards, they only describe how far past the line you already are.
**Measure real sessions, not just a lab run.** Lab conditions have one device, one network and a cold cache; field data has the distribution of devices your users actually hold, and the two disagree most on exactly the pages that matter.
**Load route code when the route is reached.** Splitting on route boundaries is the single largest reduction available to most applications, because it stops every user paying for the pages they never open.
</critical_requirements>
---
**Auto-detection:** Core Web Vitals, LCP, INP, CLS, TTFB, bundle size, bundle budget, code splitting, lazy loading, tree shaking, memoization, React Compiler, virtualization, virtual scrolling, debounce, throttle, performance budget, field measurement, RUM
**Applies to:**
**Handled elsewhere:**
---
<philosophy>
Performance work goes wrong in one of two ways: optimising what was never slow, or shipping features against no budget until the page is slow everywhere at once. Both are failures of measurement rather than of technique.
So the order is fixed — budget, then build, then measure, then optimise what the measurement named.
</philosophy>
---
<decision_framework>
Is the problem measured?
├─ NO → Measure it. A profiler for runtime, a bundle report for size,
│ field data for what users actually experience.
└─ YES → Is it load or interaction?
├─ Load (LCP, first paint) → How big is the initial download?
│ ├─ Over budget → Split by route, defer heavy dependencies,
│ │ drop or replace the largest one
│ └─ Within budget → It is the critical path: preload the LCP image,
│ remove render-blocking resources, cut TTFB
└─ Interaction (INP, jank) → What is holding the main thread?
├─ A long task → Break it up, or move it to a worker
├─ Re-rendering → Profile the tree, then memoise what the profile named
└─ Too many DOM nodes → Virtualise the list**Memoise or not:** with the React Compiler the answer is usually "the compiler already did". Without it, memoise a component that re-renders often with unchanged props and costs real time to render — and nothing else, because the comparison itself is not free.
**Virtualise or not:** past roughly a hundred rows the DOM is the cost and virtualisation wins. Below that it loses, and it costs you find-in-page and native scroll anchoring either way.
</decision_framework>
---
<patterns>
Budgets are per artifact and enforced in CI, so a dependency that doubles a chunk fails the pull request rather than being discovered in production.
export const BUNDLE_SIZE_BUDGETS_KB = {
MAIN_BUNDLE_GZIPPED: 200,
VENDOR_BUNDLE_GZIPPED: 150,
ROUTE_BUNDLE_GZIPPED: 100,
TOTAL_INITIAL_LOAD_GZIPPED: 500,
CRITICAL_CSS_INLINE: 14, // fits in the first TCP round trip
} as const;The numbers
The official skills marketplace for Agents Inc. 150+ skills covering everything from React and Prisma to Redis, ElevenLabs, and infrastructure tooling. Pick the skills that match your stack and install them via Claude Code. Need more control?
Repo: agents-inc/skills
Hugging Face Inference SDK patterns for TypeScript/Node.js — InferenceClient setup, chat completion, text generation, streaming, embeddings, image generation,…
LiteLLM proxy server setup, TypeScript client patterns via OpenAI SDK, model routing, fallbacks, load balancing, spend tracking, virtual keys, and production…
Serverless GPU compute platform for AI model deployment — web endpoints, GPU functions, model serving, and TypeScript client patterns
Local LLM inference with the Ollama JavaScript client -- chat, streaming, tool calling, vision, embeddings, structured output, model management, and…
Replicate SDK patterns for TypeScript/Node.js -- client setup, predictions, streaming, webhooks, file handling, model versioning, deployments, and training
Together AI SDK patterns for TypeScript — client setup, chat completions, streaming, structured output, function calling, embeddings, image generation,…