agentleFS
BappozBappoz/My-Claude-Skills/skills/engineering/performance/SKILL.md

performance

Skill1 starsChanged 5 months agoMITView on GitHub

Otimização de performance web e de aplicações baseada em medição: Core Web Vitals (LCP/INP/CLS), profiling antes de otimizar, camadas de cache, lazy loading, bundle size e performance de query. Use quando o usuário mencionar: "performance", "otimizar", "está lento", "Core Web Vitals", "LCP", "tempo de carregamento", "bundle grande", "lazy load", "cache", "profiling", "lighthouse", "TTFB".

45 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use web-quality-audit, core-web-vitals and 5 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • RodrigoTomeESSkill

    web-quality-audit

    Comprehensive web quality audit covering performance, accessibility, SEO, and best practices. Use when asked to "audit my site", "review web quality", "run lighthouse audit", "check page quality", or "optimize my website".

    Also in 5 projects that use this

  • thisisAhsanIqbalSkill

    core-web-vitals

    Audits HTML patterns that affect Core Web Vitals (LCP, CLS, INP). Checks for layout shift causes, largest contentful paint blockers, and interaction responsiveness issues. Use when optimising page performance or fixing Google PageSpeed Insights warnings.

    Also in 6 projects that use this

  • kpbraySkill

    best-practices

    Applies Power BI best practices, BPA rules, and enterprise standards. Use for quality validation, naming conventions, and performance optimization.

    Also in 5 projects that use this

  • BlockSkill

    debugging

    Debugging guidelines and best practices

    Also in 10 projects that use this

  • ratacatSkill

    design-patterns

    Use when designing software architecture, refactoring code structure, solving recurring design problems, or when code exhibits symptoms like tight coupling, rigid hierarchies, scattered responsibilities, or difficult-to-test components. Also use when choosing between architectural approaches or reviewing code for structural improvements.

    Also in 3 projects that use this

  • ffsshhttiikkSkill

    i18n

    Internationalization and localization

    Also in 4 projects that use this

The file

Files
SKILL.md

Performance

Você atua como engenheiro de performance. Lei fundamental: meça antes de otimizar. A intuição sobre gargalos está quase sempre errada; profiling aponta os 20% do código que causam 80% da lentidão. Otimização sem medição é dívida disfarçada.

Processo (nunca pule)

  1. Meça — profiler/DevTools/APM para achar o gargalo real (ver [[observability]]).
  2. Priorize — ataque o maior gargalo; ganho marginal em código quente > reescrita de código frio.
  3. Otimize — a menor mudança que resolve.
  4. Meça de novo — confirme o ganho; performance regride sem guardrails.
  5. Previna regressão — orçamento de performance no CI (ver [[ci-cd]]).

Core Web Vitals (a régua do usuário na web)

MétricaMedeAlvo (bom)Alavancas
LCP (Largest Contentful Paint)Carregamento percebido< 2.5sOtimizar imagem do hero, servidor rápido (TTFB), preconnect, sem render-blocking
INP (Interaction to Next Paint)Responsividade< 200msQuebrar JS longo, web workers, evitar main-thread travada
CLS (Cumulative Layout Shift)Estabilidade visual< 0.1Dimensões em img/vídeo, reservar espaço p/ ads/embeds, fontes com fallback

Frontend — as maiores alavancas

  • Imagens (geralmente o maior peso): formatos modernos (AVIF/WebP), srcset/tamanho certo, loading="lazy" no que está abaixo da dobra, width/height para não causar CLS.
  • JavaScript: o recurso mais caro. Code splitting, tree shaking, import() dinâmico, remover libs pesadas. Meça o bundle.
  • Render: evite render-blocking (CSS/JS crítico inline, resto async/defer); content-visibility para off-screen.
  • Fontes: font-display: swap, preload da fonte crítica, subset.
  • Cache HTTP/CDN: assets com hash + Cache-Control: immutable; sirva estático da CDN próxima do usuário.

Backend & dados

  • N+1 query é o clássico: 1 query vira N ao iterar. Use eager loading/JOIN/batch (ver [[database-design]]).
  • Índices nas queries quentes; confirme com EXPLAIN ANALYZE.
  • Cache em camadas: request memo → Redis (dados quentes) → CDN (resposta). Invalide com cuidado (o problema difícil).
  • Async/filas para trabalho pesado fora do caminho da request (ver [[system-design]]).
  • Conexões: pool de DB; evite abrir/fechar por request.

Cache — mental model

Navegador → CDN → Cache de app (Redis) → Banco
   ↑ mais perto do usuário = mais rápido e barato

Cache resolve leitura repetida. Cuidados: staleness (TTL/invalidação), stampede (muitos miss simultâneos → lock/refresh), e nunca cachear dado por-usuário em camada compartilhada sem chave certa.

Armadilhas

  • Otimização prematura — complexidade por ganho que ninguém mede.
  • Média mente — use p95/p99; a cauda é onde o usuário sofre.
  • Micro-otimizar código frio — irrelevante se roda 1x/dia.
  • Cache sem invalidação — troca bug de lentidão por bug de dado velho.

Recursos externos

RecursoO que pegar
web.dev — PerformanceCore Web Vitals, receitas de otimização de carregamento.
web.dev — VitalsDefinição e como medir LCP/INP/CLS.
Chrome DevTools — PerformanceProfiling de main thread, flame charts.
LighthouseAuditoria automatizada de performance.
Use The Index, LukePerformance de query/índice.
Brendan Gregg — Systems PerformanceMetodologia de profiling (USE method).

Do / Don't

DoDon't
Medir/profile antesOtimizar por palpite
p95/p99Só a média
Otimizar o gargalo realMicro-otimizar código frio
Cache com invalidaçãoCache sem TTL/chave
Orçamento de perf no CIDeixar regredir

Checklist

  • Gargalo identificado por profiling (não intuição)
  • Core Web Vitals medidos (LCP<2.5s, INP<200ms, CLS<0.1)
  • Imagens otimizadas (formato/tamanho/lazy/dimensões)
  • JS reduzido (split/tree-shake/dynamic import), bundle medido
  • N+1 eliminado; índices nas queries quentes (EXPLAIN)
  • Cache em camadas com invalidação correta
  • Ganho remedido; orçamento de performance no CI

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.