Communitygithub.com

Anhvu1107/all-agent-skill

總是於請求符合「修復動畫效能」時使用:稽核並修復動畫效能問題,包括版面抖動、合成器屬性、卷軸驅動動畫以及模糊效果。

all-agent-skill 是什麼?

此技能專注於診斷和修復網頁 UI 動畫中的效能瓶頸。它提供了一套完整且分優先級的規則,涵蓋了關鍵的「絕不模式」(如避免在同一影格內交錯讀取與寫入版面)、選擇正確的動畫機制(預設使用 `transform` 和 `opacity`)、減少繪製與佈局成本、以及有效利用圖層和合成器。支援的平台涵蓋所有現代瀏覽器,無論使用 CSS 動畫、Web Animations API、requestAnimationFrame 還是 GSAP 等函式庫。此技能不僅會標記違規,還會提供具體的程式碼層級修復建議,例如使用 FLIP 技術取代直接操作寬高以消除版面抖動,並在可能的情況下優先使用 Scroll Timeline 而非 JavaScript 來驅動卷軸動畫。它還明確界定了工具邊界,除非明確要求,否則不會遷動動畫函式庫。

相容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/Anhvu1107/all-agent-skill/tree/HEAD/.agent/skills/fixing-motion-performance

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

修復動畫效能

選擇性閱讀規則

從以下文件開始:

  • references/senior-master-standard.md
  • references/usage-routing.md
  • references/quality-checklist.md

然後僅載入與使用者實際任務相符的繼承文件、腳本、資產或範例。

修復動畫效能問題。

使用方式

  • /fixing-motion-performance 將這些約束套用至本次對話中的任何 UI 動畫工作。

  • /fixing-motion-performance <file> 根據以下所有規則審查該檔案,並回報:

    • 違規(引用確切的程式碼行或片段)
    • 為何重要(一句簡短說明)
    • 具體修復方式(程式碼層級建議)

除非明確要求,否則請勿遷移動畫函式庫。請在現有技術堆疊內套用規則。

使用時機

在下列情況參考這些指南:

  • 新增或更改 UI 動畫(CSS、WAAPI、Motion、rAF、GSAP)
  • 重構卡頓的互動或轉場
  • 實作卷軸驅動動畫或捲動時顯示效果
  • 對版面、濾鏡、遮罩、漸層或 CSS 變數進行動畫
  • 審查使用了 will-change、transform 或尺寸測量的元件

渲染步驟詞彙表

  • composite:transform、opacity
  • paint:顏色、邊框、漸層、遮罩、圖片、濾鏡
  • layout:尺寸、位置、流向、網格、flex

規則分類(依優先級)

優先級分類影響
1絕不模式關鍵
2選擇機制關鍵
3測量高
4卷軸高
5繪製中高
6圖層中
7模糊與濾鏡中
8視圖轉場低
9工具邊界關鍵

快速參考

1. 絕不模式(關鍵)

  • 請勿在同一影格中交錯進行版面讀取與寫入
  • 請勿在大面積或有重大意義的表面上持續進行版面動畫
  • 請勿使用 scrollTop、scrollY 或 scroll 事件驅動動畫
  • 禁止無終止條件的 requestAnimationFrame 迴圈
  • 請勿混合使用多個各自會測量或變更版面的動畫系統

2. 選擇機制(關鍵)

  • 預設使用 transform 和 opacity 進行動畫
  • 僅在互動需要時才使用 JS 驅動的動畫
  • 僅能在小型、隔離的表面上接受繪製或版面動畫
  • 一次性效果比連續動畫更可接受
  • 優先降低技術層級,勝過完全移除動畫

3. 測量(高)

  • 測量一次,然後透過 transform 或 opacity 進行動畫
  • 在寫入之前批次處理所有 DOM 讀取
  • 動畫期間請勿重複讀取版面
  • 對於類似版面的效果,偏好 FLIP 風格的轉場
  • 偏好能批次處理測量和寫入的方法

4. 卷軸(高)

  • 在可用時,優先使用 Scroll 或 View Timelines 處理卷軸驅動動畫
  • 使用 IntersectionObserver 處理可見性及暫停
  • 請勿為了動畫而輪詢卷軸位置
  • 當元素離開螢幕時暫停或停止動畫
  • 卷軸驅動動畫不得在大面積表面上觸發持續的版面或繪製

5. 繪製(中高)

  • 僅能在小型、隔離的元素上允許觸發繪製的動畫
  • 請勿在大容器上對繪製密集型屬性進行動畫
  • 請勿對 transform、opacity 或位置使用 CSS 變數進行動畫
  • 請勿對繼承的 CSS 變數進行動畫
  • 將需要動畫的 CSS 變數限定在局部作用域,避免繼承

6. 圖層(中)

  • 合成器動畫需要提升圖層,切勿假設已經提升
  • 暫時且精準地使用 will-change
  • 避免大量或大型的提升圖層
  • 當效能重要時,使用工具驗證圖層行為

7. 模糊與濾鏡(中)

  • 保持模糊動畫範圍較小(<=8px)
  • 僅用於短暫、一次性效果
  • 請勿對模糊進行連續動畫
  • 請勿在大表面上對模糊進行動畫
  • 在模糊之前優先使用 opacity 和 translate

8. 視圖轉場(低)

  • 僅在導航層級的變更使用視圖轉場
  • 避免在互動密集的 UI 中使用視圖轉場
  • 當需要中斷或取消時,避免使用視圖轉場
  • 將尺寸變更視為可能觸發版面變更

9. 工具邊界(關鍵)

  • 除非明確要求,否則請勿遷動或重寫動畫函式庫
  • 在現有的動畫系統內套用這些規則
  • 請勿在同一元件內部分遷移 API 或混合風格

常見修復

/* 版面抖動:使用 transform 取代 width 進行動畫 */
/* 修改前 */ .panel { transition: width 0.3s; }
/* 修改後 */  .panel { transition: transform 0.3s; }

/* 卷軸驅動:使用 scroll-timeline 取代 JS */
/* 修改前 */ window.addEventListener('scroll', () => el.style.opacity = scrollY / 500)
/* 修改後 */  .reveal { animation: fade-in linear; animation-timeline: view(); }
// 測量:在寫入之前批次讀取(FLIP)
// 修改前 — 版面抖動
el.style.left = el.getBoundingClientRect().left + 10 + 'px';
// 修改後 — 測量一次,透過 transform 進行動畫
const first = el.getBoundingClientRect();
el.classList.add('moved');
const last = el.getBoundingClientRect();
el.style.transform = `translateX(${first.left - last.left}px)`;
requestAnimationFrame(() => { el.style.transition = 'transform 0.3s'; el.style.transform = ''; });

審查指引

  • 首先強制執行關鍵規則(絕不模式、工具邊界)
  • 選擇最符合意圖且成本最低的渲染工作
  • 對於任何非預設的選擇,說明證明其合理性的限制條件(表面大小、持續時間或互動需求)
  • 審查時,偏好可操作的備註和具體替代方案,而非理論

限制

  • 僅當任務明顯符合上述範圍時才使用此技能。
  • 請勿將此輸出視為環境特定驗證、測試或專家審查的替代品。
  • 如果缺少必要的輸入、權限、安全邊界或成功標準,請停止並要求釐清。

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches 007: Security audit, hardening, threat modeling (STRIDE/PASTA), Red/Blue Team, OWASP checks, code review, incident response, and infrastructure security for any project.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches Agentfolio: Skill for discovering and researching autonomous AI agents, tools, and ecosystems using the AgentFolio directory.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches Animejs Animation: Advanced JavaScript animation library skill for creating complex, high-performance web animations.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches Astropy: Astropy is the core Python package for astronomy, providing essential functionality for astronomical research and data analysis.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches Astro: Build content-focused websites with Astro — zero JS by default, islands architecture, multi-framework components, and Markdown/MDX support.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches Emotional ARC Designer: One sentence - what this skill does and when to invoke it

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches I18n Localization: Internationalization and localization patterns.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches Interactive Portfolio: Expert in building portfolios that actually land jobs and clients - not just showing work, but creating memorable experiences.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches JQ: Expert jq usage for JSON querying, filtering, transformation, and pipeline integration.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches Landing Page Generator: Generates high-converting Next.js/React landing pages with Tailwind CSS.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches LEX: Centralized ''Truth Engine'' for cross-jurisdictional legal context (US, EU, CA) and contract scaffolding.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches Magic Animator: AI-powered animation tool for creating motion in logos, UI, icons, and social media assets.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches Makepad Animation: CRITICAL: Use for Makepad animation system.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches Nextjs APP Router Patterns: Comprehensive patterns for Next.js 14+ App Router architecture, Server Components, and modern full-stack React development.

Anhvu1107/all-agent-skill

ALWAYS use this when the user mentions Nextjs Best Practices, asks to build, debug, review, document, automate, test, configure, migrate, or make decisions in this domain, or the task clearly depends on Nextjs Best Practices; scope: Next.js App Router principles. Apply the bundled workflow, references, scripts, Senior Master standard, and Codex strict review gate before final output.

Anhvu1107/all-agent-skill

description: ALWAYS use this when the work is specifically about modern Next.js or React architecture, data flow, rendering strategy, routing, or performance-sensitive frontend behavior.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches Nextjs Supabase Auth: Expert integration of Supabase Auth with Next.js App Router

Anhvu1107/all-agent-skill

ALWAYS use this when the task involves reading, extracting, splitting, merging, rotating, creating, validating, OCR-ing, form-filling, or otherwise producing or modifying PDF files.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches React Nextjs Development: React and Next.js 14+ application development with App Router, Server Components, TypeScript, Tailwind CSS, and modern frontend patterns.

Anhvu1107/all-agent-skill

ALWAYS use this when working with Remotion code, video compositions, rendering logic, timing, media assets, or React-based motion workflows.

相關技能