跳到正文
cccskills
免费在 GitHub 公开

perf

Audit component performance and identify optimization opportunities with actionable fixes

中文简介正在准备中。当前显示原文说明。

查看安装方法

包含的文件(1)

  • SKILL.md2.6 KB

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

Performance Audit Skill

Audit Terrae components for performance issues. Identifies problems, explains their impact, and provides actionable fixes.

If $ARGUMENTS is provided, audit only that component. Otherwise, audit all components in src/registry/map/.

Performance patterns and best practices are defined in .claude/rules/react/performance.md.

Instructions

Step 1: Identify Target

If a component name is provided, locate it in src/registry/map/. Otherwise, scan all component files.

Step 2: Run the Audit

For each component, read the full file and check every rule in .claude/rules/react/performance.md:

  1. Resource cleanup (RAF, timers, listeners, markers, layers, sources, images, observers, canvas)
  2. Recursive requestAnimationFrame polling
  3. Untracked timers in renderers
  4. Mapbox objects in state vs refs
  5. useEffect dependency arrays (oversized, unstable references, callbacks)
  6. Layer and source management (setPaintProperty vs remove/re-add, existence checks)
  7. GeoJSON data handling (recomputation, update frequency)
  8. Canvas performance (pixel ratio, size, getImageData, off-screen canvas)
  9. DOM manipulation (innerHTML, style injection)
  10. Memory leaks (event listeners, growing collections, stale closures)

Also check for:

  • Component re-render cost (expensive computations in render path, large JSX trees)
  • Duplicate utility functions across files (DRY violations that bloat bundle size)

Step 3: Report

Structure the report as:

## Performance Audit: [Component Name]

### Score: [X/10]

### Critical Issues
Issues that cause measurable performance degradation or memory leaks.

### Warnings
Patterns that could degrade performance under load or over time.

### Best Practices
Recommendations for following optimal patterns.

### Passed Checks
Checks that the component already handles correctly.

For each issue found, include:

  • What: Description of the problem
  • Where: File path and line number
  • Impact: What happens if not fixed (memory leak, jank, unnecessary re-renders, etc.)
  • Fix: Concrete code example showing the solution

Scoring Guide

  • 10/10: No issues found, follows all best practices
  • 8-9/10: Minor warnings only, no performance impact
  • 6-7/10: Some warnings that could cause issues under load
  • 4-5/10: Has performance issues that affect user experience
  • 2-3/10: Critical issues causing memory leaks or severe jank
  • 0-1/10: Fundamentally broken performance patterns

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

check

免费

Verify all outputs exist after creating a new component and fix any issues

中文简介正在准备中。当前显示原文说明。

alamenai/terrae2492026年4月7日 更新

commit

免费

Create standardized git commits following Terrae's conventions

中文简介正在准备中。当前显示原文说明。

alamenai/terrae2492026年4月7日 更新

docs

免费

Generate or update documentation for Terrae components

中文简介正在准备中。当前显示原文说明。

alamenai/terrae2492026年4月7日 更新

fix

免费

Systematically fix issues found by /review or reported by the user

中文简介正在准备中。当前显示原文说明。

alamenai/terrae2492026年4月7日 更新

issue

免费

Read a GitHub issue, summarize it, and create a branch for it

中文简介正在准备中。当前显示原文说明。

alamenai/terrae2492026年4月7日 更新

lint

免费

Run linting and type checking across the Terrae codebase

中文简介正在准备中。当前显示原文说明。

alamenai/terrae2492026年4月7日 更新

查看 alamenai 的全部技能

报告此技能的问题