Fluig Optimize Performance logo

Fluig Optimize Performance

Organization
totvs
fluig-optimize-performance

Otimiza a performance de código frontend Fluig (manipulação de DOM, eventos, requisições e carga de dados) preservando o comportamento, a internacionalização e a compatibilidade com a plataforma. Use quando o desenvolvedor relatar lentidão, travamentos, reflows excessivos ou muitas requisições em um widget/Custom Element e pedir para otimizar um trecho ou arquivo.

Overview

Publishertotvs
Repositoryfluig-agent-skills
Skill namefluig-optimize-performance
Stars
37
Forks
14
Bundled files
Instructions only
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by totvs on GitHub. Read the source before you install it.

Installation

Install the Fluig Optimize Performance AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/totvs/fluig-agent-skills/tree/main/skills/fluig-optimize-performance
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/totvs/fluig-agent-skills.git /tmp/fluig-agent-skills
mkdir -p .claude/skills
cp -r /tmp/fluig-agent-skills/skills/fluig-optimize-performance .claude/skills/fluig-optimize-performance
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Fluig Optimize Performance in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Fluig Optimize Performance on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Fluig Optimize Performance is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Otimização de Performance de Frontend Fluig

Esta skill otimiza a performance de código frontend Fluig; ela não duplica convenções — os arquivos de context/ são a fonte de verdade, referenciada abaixo.

Passo 0 — Persona

Antes de otimizar, classifique a persona do desenvolvedor seguindo a cascata em persona-routing.md: conversa > marcador de arquivo > marcador técnico de Store (component.xml ou API de slot) > estrutura do projeto > pergunta. Se restar ambígua, pare e pergunte antes de continuar. Emita Persona: <Parceiro|Consultor> (motivo) — esta skill aplica as mesmas regras técnicas independentemente da persona (não há camada da Store envolvida na otimização de performance).

Objetivo

Otimizar, com responsabilidade única, a performance de código frontend Fluig — DOM, eventos, requisições e carga de dados — aplicando boas práticas públicas sem alterar o comportamento observável, a i18n nem a compatibilidade com a plataforma.

Quando Usar

  • Quando um widget ou Custom Element está lento, travando ou com reflows/repaints excessivos.
  • Quando há muitos listeners de evento ou eventos de alta frequência (scroll, resize, input) sem controle.
  • Quando o código faz muitas requisições ou carrega dados desnecessários de uma só vez.
  • Antes de evoluir um artefato existente, para eliminar gargalos de renderização e de rede.

Entradas Esperadas

EntradaDescriçãoObrigatória
Código alvoTrecho ou arquivo frontend a otimizar (widget ou Custom Element)sim
Sintoma de performance observadoO que foi notado (ex.: lentidão ao renderizar lista, travamento no scroll, muitas chamadas REST)não
Contexto do artefatoTipo do artefato em que o código roda e onde o gargalo aparecenão

Contexto de Referência (Fonte de Verdade)

Leia antes de executar — não reproduza o conteúdo aqui:

  • conventions.md — manipulação de DOM, ES6+ e async/await, REST via fetch() ao domínio do próprio Fluig (API pública, WCMAPI.getServerURL()) ou a terceiro, bindings de widget, i18n, segurança e CSS responsivo e funções CSS modernas (calc/var/rgba/hsla/min/max/clamp/minmax, media e container queries).
  • style-guide.md — reutilização de componentes/helpers/grid do Fluig Style Guide em vez de soluções próprias mais custosas.
  • platform-constitution.md — regras invioláveis de i18n ([=i18n.getTranslation(...)] em .js, ${i18n.getTranslation(...)} em .ftl) e HTTP (fetch).

Regras Aplicáveis (Resumo Executivo)

Somente o mínimo para orientar a otimização; o detalhe está no contexto. Boas práticas públicas e genéricas:

  • Agrupar alterações de DOM em uma única operação; montar nós em um DocumentFragment e inserir de uma vez → ver conventions.md.
  • Minimizar reflow/repaint: evitar ler e escrever layout de forma intercalada dentro de laços.
  • Evitar seletores repetidos: cachear a referência do elemento em uma variável em vez de reconsultar o DOM.
  • Event delegation: um listener no container em vez de muitos listeners individuais → ver conventions.md (bindings de widget).
  • Debounce/throttle em eventos de alta frequência (scroll, resize, input/keyup).
  • Carregar dados sob demanda (paginação/lazy load) e tratar o assíncrono com async/await em try/catch → ver conventions.md.
  • REST via fetch() + async/await; domínio do próprio Fluig só com API pública, URL via WCMAPI.getServerURL() → ver platform-constitution.md.
  • Reutilizar componentes do Style Guide em vez de recriar comportamentos custosos → ver style-guide.md.
  • Reutilizar jQuery UI/Mustache (já embutidos) em vez de reimplementar interações de UI ou templating manual — evita listeners redundantes e concatenação de string custosa → ver style-guide.md, seção "Plugins embutidos (jQuery, jQuery UI, Mustache)".
  • CSS responsivo e funções CSS modernas: preferir funções nativas (calc/var/rgba/hsla/min/max/clamp/minmax) e media/container queries para layouts fluidos e eficientes em vez de valores fixos repetidos → ver conventions.md (CSS responsivo e moderno).
  • Liberar recursos: remover listeners/timers ao destruir o widget para evitar vazamentos.
  • Preservar a sintaxe de widget ao otimizar (regra 3 da constituição): ao refatorar o JS de um widget SuperWidget.extend({}), não converta os métodos para arrow/method shorthand, e remova (nunca introduza) var ctx = this; — métodos continuam nome: function() {} (arrow como método não vincula this), com this direto e callbacks internos em Arrow Functions — nunca var ctx = this;. Otimizações de performance não justificam violar a regra 3 → ver platform-constitution.md (regra 3) e conventions.md.

Procedimento

  1. Medir/identificar o gargalo a partir do sintoma e da leitura do código (DOM em laço, seletores repetidos, excesso de listeners, requisições redundantes, evento de alta frequência sem controle).
  2. Selecionar a otimização adequada do catálogo acima para cada gargalo encontrado.
  3. Aplicar a otimização preservando o comportamento observável e a i18n com a sintaxe já usada no arquivo ([=i18n.getTranslation('chave')] em .js novo; ${i18n.getTranslation('chave')} em .ftl ou .js legado).
  4. Garantir que chamadas REST continuem via fetch(), com o domínio do próprio Fluig pela API pública (WCMAPI.getServerURL()), e que o assíncrono seja tratado com try/catch.
  5. Validar o resultado com o checklist abaixo antes de entregar, anotando as otimizações aplicadas.

Saída Esperada

Código otimizado, com o comportamento original preservado e uma nota curta das otimizações aplicadas (qual gargalo foi tratado e como), mantendo i18n e compatibilidade com a plataforma.

Exemplo de Uso

Trecho ilustrativo: agrupar escritas de DOM com DocumentFragment em vez de inserir item a item.

javascript
// Antes — insere no DOM dentro do laço (reflow a cada iteração)
const list = document.querySelector(`#MyWidget_${this.instanceId} .items`);
items.forEach((item) => {
  list.insertAdjacentHTML('beforeend', `<li>${item.name}</li>`);
});
javascript
// Depois — monta em DocumentFragment e insere uma única vez
const list = document.querySelector(`#MyWidget_${this.instanceId} .items`);
const fragment = document.createDocumentFragment();
items.forEach((item) => {
  const li = document.createElement('li');
  li.textContent = item.name;
  fragment.appendChild(li);
});
list.appendChild(fragment);

Checklist de Validação

  • Alterações de DOM agrupadas (ex.: DocumentFragment); sem inserções repetidas em laço.
  • Sem seletores redundantes — referências de elementos cacheadas.
  • Eventos de alta frequência com debounce/throttle e/ou delegação de eventos.
  • Assíncrono tratado com async/await em try/catch; dados carregados sob demanda.
  • Chamadas REST via fetch(); domínio do próprio Fluig só com API pública via WCMAPI.getServerURL().
  • Comportamento original e i18n preservados.

Frequently asked questions

What does the Fluig Optimize Performance AI skill do?

Otimiza a performance de código frontend Fluig (manipulação de DOM, eventos, requisições e carga de dados) preservando o comportamento, a internacionalização e a compatibilidade com a plataforma. Use quando o desenvolvedor relatar lentidão, travamentos, reflows excessivos ou muitas requisições em um widget/Custom Element e pedir para otimizar um trecho ou arquivo.

Why use Fluig Optimize Performance on TypingMind?

Because you install it once and use it with any model. Fluig Optimize Performance is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Fluig Optimize Performance in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/totvs/fluig-agent-skills/tree/main/skills/fluig-optimize-performance. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Fluig Optimize Performance?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Fluig Optimize Performance?

As many as you like. As long as a model supports skills, you can use Fluig Optimize Performance with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Fluig Optimize Performance AI skill free?

Yes. It is published on GitHub by totvs under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇