Agent skill

Performance Guide

by mobazha in mobazha/mobazha-unified

Guide for performance optimization in Mobazha including React rendering optimization, code splitting, Web Vitals monitoring, and utility functions for debounce/throttle/memoize.

MPL-2.0Auto-check passedFrontend & Design

Install Performance Guide

skills CLI
$ npx skills add mobazha/mobazha-unified --skill performance-guide -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install mobazha/mobazha-unified performance-guide --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/mobazha/mobazha-unified.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.cursor/skills/performance-guide .claude/skills/performance-guide && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
performance-guide
GitHub stars
165
Token cost
~1.3k tokens
SKILL.md length
110 words
Files
1
Skills in repo
29
Repo updated
First seen
Licence
MPL-2.0

At a glance

Guide for performance optimization in Mobazha including React rendering optimization, code splitting, Web Vitals monitoring, and utility functions for debounce/throttle/memoize.

  • Optimizing performance
  • SKILL.md covers 已有基础设施, 一、React 渲染优化, 二、代码分割 and 三、列表性能, plus 3 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md
  • Fixing slow renders

What it does

Performance Guide is an agent skill from mobazha/mobazha-unified. Guide for performance optimization in Mobazha including React rendering optimization, code splitting, Web Vitals monitoring, and utility functions for debounce/throttle/memoize. Use when optimizing performance, fixing slow renders, or working with large lists, "性能优化", "渲染优化", "代码分割", "Web Vitals", "虚拟列表", "懒加载".

Its SKILL.md is about 1.3k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Frontend & Design, covering Web performance, Performance optimization and State management. It works with React. The repository describes itself as: Open-source commerce frontend for storefronts, marketplaces, checkout, and seller management. The licence is MPL-2.0.

When your agent uses it

  • Optimizing performance
  • Fixing slow renders
  • Working with large lists

Example prompts

  • “Web Vitals”
  • “/performance-guide”

What it can do on your machine

Read from SKILL.md and the folder at commit 156c699. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are typescript).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Performance Guide loads about 1.3k tokens when it runs. Until then it costs about 83 tokens; SKILL.md has 110 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~83
When it runs · the whole SKILL.md, loaded when a task matches
~1.3k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from mobazha/mobazha-unified at commit 156c699, republished under its MPL-2.0 licence (© mobazha). 110 words, ~1,323 tokens.

Download SKILL.mdSave it as .claude/skills/performance-guide/SKILL.md (or your agent's skills folder).
name
performance-guide
description
Guide for performance optimization in Mobazha including React rendering optimization, code splitting, Web Vitals monitoring, and utility functions for debounce/throttle/memoize. Use when optimizing performance, fixing slow renders, or working with large lists, "性能优化", "渲染优化", "代码分割", "Web Vitals", "虚拟列表", "懒加载".

性能优化指南

Mobazha 项目的性能优化模式和已有工具。

已有基础设施

工具文件用途
PerformanceMonitorpackages/core/services/monitoring/performanceMonitor.tsWeb Vitals + 自定义指标
工具函数packages/core/utils/performance.tsdebounce, throttle, memoize 等
ErrorTrackerpackages/core/services/monitoring/errorTracker.ts性能 Transaction 追踪

一、React 渲染优化

1.1 memo 使用时机
typescript
// ✅ 适合 memo:接收复杂 props 的列表项
const OrderCard = memo(function OrderCard({ order }: OrderCardProps) {
  return <div>...</div>;
});

// ❌ 不需要 memo:props 简单或组件很轻
function LoadingSpinner({ size }: { size: number }) {
  return <div style={{ width: size }} />;
}

原则:

  • 列表项组件 → 始终 memo
  • 接收回调 props 的子组件 → memo + useCallback
  • 纯展示组件 → 仅在父组件频繁重渲染时使用
1.2 useMemo 和 useCallback
typescript
// ✅ useMemo:计算开销大或引用需要稳定
const filteredOrders = useMemo(
  () => orders.filter(o => o.status === selectedStatus),
  [orders, selectedStatus]
);

// ✅ useCallback:传递给 memo 子组件的回调
const handleSelect = useCallback((id: string) => {
  setSelectedId(id);
}, []);

// ❌ 过度使用:简单值不需要 memo
const label = useMemo(() => `共 ${count} 件`, [count]); // 不必要
1.3 Zustand 选择器(参见 state-management Skill)
typescript
// ✅ 精确订阅,避免整个 store 订阅
const items = useCartStore(state => state.items);

// ❌ 订阅整个 store
const store = useCartStore();

二、代码分割

2.1 路由级别(Next.js 自动处理)

Next.js App Router 自动按路由分割。

2.2 组件级别懒加载
typescript
import { lazy, Suspense } from 'react';

// 大型组件懒加载
const HeavyChart = lazy(() => import('@/components/charts/HeavyChart'));

function Dashboard() {
  return (
    <Suspense fallback={<ChartSkeleton />}>
      <HeavyChart data={data} />
    </Suspense>
  );
}
2.3 适合懒加载的组件
  • 图表(Recharts)
  • 富文本编辑器
  • 地图组件
  • 设置页面的高级面板
  • 模态框/抽屉的复杂内容

三、列表性能

3.1 大列表优化

商品列表、订单列表等可能有大量数据:

typescript
// 分页加载(推荐)
function ProductList() {
  const { products, hasMore, loadMore, isLoading } = useProducts();

  return (
    <div>
      {products.map(p => <ProductCard key={p.slug} product={p} />)}
      {hasMore && (
        <button onClick={loadMore} disabled={isLoading}>
          加载更多
        </button>
      )}
    </div>
  );
}
3.2 图片优化
typescript
// 使用 next/image(自动优化 + lazy loading)
import Image from 'next/image';

<Image
  src={product.thumbnail}
  alt={product.title}
  width={300}
  height={300}
  loading="lazy"        // 默认,视口外延迟加载
  placeholder="blur"    // 模糊占位
/>

四、已有工具函数

packages/core/utils/performance.ts 提供:

debounce / throttle
typescript
import { debounce, throttle } from '@mobazha/core';

// 搜索输入防抖(300ms)
const debouncedSearch = debounce((query: string) => {
  searchProducts(query);
}, 300);

// 滚动事件节流
const throttledScroll = throttle(() => {
  checkLoadMore();
}, 200);
memoize
typescript
import { memoize } from '@mobazha/core';

// 缓存计算结果
const getExpensiveResult = memoize((input: string) => {
  return heavyComputation(input);
});
batchProcess
typescript
import { batchProcess } from '@mobazha/core';

// 大批量操作分块处理,避免阻塞 UI
await batchProcess(
  largeArray,
  async item => processItem(item),
  50, // 每批 50 个
  10 // 批次间延迟 10ms
);
retry / withTimeout
typescript
import { retry, withTimeout } from '@mobazha/core';

// 带重试的 API 调用
const data = await retry(
  () => fetchData(),
  3, // 最多重试 3 次
  1000, // 初始延迟 1s
  2 // 指数退避因子
);

// 带超时的 Promise
const result = await withTimeout(longOperation(), 10000); // 10s 超时
scheduleIdleTask
typescript
import { scheduleIdleTask } from '@mobazha/core';

// 在浏览器空闲时执行非紧急任务
scheduleIdleTask(() => {
  preloadNextPageData();
}, 5000); // 5s 超时(确保最终执行)

五、Web Vitals 监控

项目已集成 Web Vitals 收集:

typescript
// performanceMonitor.ts 自动收集:
// - LCP (Largest Contentful Paint) — 目标 < 2.5s
// - FID (First Input Delay) — 目标 < 100ms
// - CLS (Cumulative Layout Shift) — 目标 < 0.1
// - FCP (First Contentful Paint)
// - TTFB (Time to First Byte)
// - INP (Interaction to Next Paint)
自定义性能测量
typescript
import { performanceMonitor } from '@mobazha/core';

// 同步测量
const result = performanceMonitor.measure('orderTransform', () => {
  return transformCoreOrder(data);
});

// 异步测量
const data = await performanceMonitor.measureAsync('fetchOrders', async () => {
  return await ordersApi.getOrders();
});

// 手动计时
const stopTimer = performanceMonitor.startTimer('chatInit');
await initializeChat();
stopTimer(); // 记录耗时

快速检查清单

  • 列表项组件是否使用 memo ?
  • 传递给子组件的回调是否用 useCallback 包裹?
  • Zustand 选择器是否精确订阅?
  • 大型组件是否做了懒加载(lazy + Suspense)?
  • 图片是否使用 next/image 或添加 loading="lazy"?
  • 搜索/输入是否做了 debounce?
  • 大批量操作是否使用 batchProcess 避免 UI 阻塞?

© mobazha, MPL-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .cursor/skills/performance-guide of mobazha/mobazha-unified.

Open the folder on GitHubat commit 156c699

Compare with similar skills

Performance Guide next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Performance Guide compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Performance Guide this skillmobazha/mobazha-unified165—~1.3kAutomated safety check: PassMPL-2.0
Frontend Patternskurealnum/dotfiles29019 repos~3.7kAutomated safety check: PassNone
React Best Practicesryokun6/ryos1.3k—~2kAutomated safety check: PassMIT
React Best Practicespoteto/noodle437—~1.4kAutomated safety check: PassMIT
React ExpertJeffallan/claude-skills12k—~1.4kAutomated safety check: PassMIT
Reactblencorp/claude-code-kit106—~2.5kAutomated safety check: PassMIT

Similar skills

  • Frontend Patterns

    kurealnum/dotfiles

    Frontend development patterns for React, Next.js, state management, performance optimization, and UI best practices.

    290 GitHub starsUsed in 19 repos~3.7k tokens
    Frontend & DesignAuto-check passed
  • React performance optimization guidelines from Vercel Engineering (vercel-labs/agent-skills).

    1.3k GitHub stars~2k tokensUpdated today
    Frontend & DesignAuto-check passed
  • React performance optimization guidelines. An agent skill from poteto/noodle.

    437 GitHub stars~1.4k tokensUpdated 6 mo ago
    Frontend & DesignAuto-check passed
  • React Expert

    Jeffallan/claude-skills

    Builds React 19 components in TypeScript with Server Components, useActionState forms, custom hooks and state libraries, checked with tsc and React Testing Library.

    12k GitHub stars~1.4k tokensUpdated 4 days ago
    Frontend & DesignAuto-check passed
  • React

    blencorp/claude-code-kit

    Core React 19 patterns including hooks, Suspense, lazy loading, component structure, TypeScript best practices, and performance optimization.

    106 GitHub stars~2.5k tokensUpdated 10 mo ago
    Frontend & DesignAuto-check passed
  • React

    MatrixAges/polywise

    Guides React component implementation, performance optimization, and state management thresholds.

    662 GitHub stars~1.4k tokensUpdated 3 mo ago
    Frontend & DesignAuto-check passed

More from mobazha/mobazha-unified

All 29 skills in this repo
  • A11y Guide

    mobazha/mobazha-unified

    Accessibility guide for Mobazha following WCAG 2.1 AA standards including color contrast, reduced motion, ARIA patterns, keyboard navigation, focus management, and screen reader testing.

    165 GitHub stars~1.4k tokensUpdated 4 days ago
    Auto-check passed
  • API Reference

    mobazha/mobazha-unified

    Look up Mobazha backend API endpoints, request/response formats, and field mappings.

    165 GitHub stars~1.7k tokensUpdated 4 days ago
    Auto-check passed
  • Code Review

    mobazha/mobazha-unified

    Review code for quality, architecture consistency, and adherence to Mobazha project standards using confidence-based filtering.

    165 GitHub stars~464 tokensUpdated 4 days ago
    Auto-check passed
  • Code Simplifier

    mobazha/mobazha-unified

    Simplify and refine recently written code for clarity, consistency, and maintainability while preserving all functionality.

    165 GitHub stars~601 tokensUpdated 4 days ago
    Auto-check passed
  • Commit Helper

    mobazha/mobazha-unified

    Generate commit messages and run pre-commit validation following Mobazha conventions.

    165 GitHub stars~735 tokensUpdated 4 days ago
    Auto-check passed
  • Component Dev

    mobazha/mobazha-unified

    Create and modify UI components following Mobazha conventions including directory structure, spacing standards, accessibility, and testing.

    165 GitHub stars~638 tokensUpdated 4 days ago
    Auto-check passed

Works with

Questions about Performance Guide

What does Performance Guide do?

Guide for performance optimization in Mobazha including React rendering optimization, code splitting, Web Vitals monitoring, and utility functions for debounce/throttle/memoize. Performance Guide is an agent skill from mobazha/mobazha-unified. Guide for performance optimization in Mobazha including React rendering optimization, code splitting, Web Vitals monitoring, and utility functions for debounce/throttle/memoize.

When should I use Performance Guide?

Performance Guide fits situations like: optimizing performance; fixing slow renders; working with large lists.

How do I install Performance Guide in Claude Code?

Run `npx skills add mobazha/mobazha-unified --skill performance-guide -a claude-code`. Or copy the skill folder (.cursor/skills/performance-guide in mobazha/mobazha-unified) into .claude/skills/performance-guide in your project. Claude Code loads it when a task matches its description.

How do I install Performance Guide in Codex?

Run `npx skills add mobazha/mobazha-unified --skill performance-guide -a codex`. Or copy the skill folder (.cursor/skills/performance-guide in mobazha/mobazha-unified) into .agents/skills/performance-guide in your project. Codex loads it when a task matches its description.

Can I use Performance Guide in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add mobazha/mobazha-unified --skill performance-guide -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/performance-guide, .gemini/skills/performance-guide, .github/skills/performance-guide and .opencode/skills/performance-guide in your project.

What does Performance Guide need to run?

SKILL.md names no scripts, command-line tools or credentials: Performance Guide is instructions for the agent only.

Does Performance Guide access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Performance Guide safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Performance Guide use?

Performance Guide is published under the MPL-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Performance Guide use?

About 1.3k tokens (SKILL.md is roughly 5.3k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Performance Guide?

Skills that share tags, products or a category with Performance Guide: Frontend Patterns (kurealnum/dotfiles, 290 stars), React Best Practices (ryokun6/ryos, 1.3k stars), React Best Practices (poteto/noodle, 437 stars) and React Expert (Jeffallan/claude-skills, 12k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Performance Guide?

mobazha (a GitHub organization) maintains it in mobazha/mobazha-unified, which has 165 GitHub stars. The repository holds 29 skills in this directory. The repository was last updated on October 3, 2026.

Source: mobazha/mobazha-unified on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.