Perf logo

Perf

Organization
lightpointventures
perf

当用户觉得页面慢、接口响应慢、打包慢、想优化性能时使用 — 分析瓶颈并给出具体改进方案

Overview

Publisherlightpointventures
Repositoryclaude-code-starter
Skill nameperf
Stars
36
Forks
6
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 lightpointventures on GitHub. Read the source before you install it.

Installation

Install the Perf 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/lightpointventures/claude-code-starter/tree/main/skills/perf
  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/lightpointventures/claude-code-starter.git /tmp/claude-code-starter
mkdir -p .claude/skills
cp -r /tmp/claude-code-starter/skills/perf .claude/skills/perf
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Perf 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 Perf 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 Perf 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.

性能优化

帮用户找到性能瓶颈并给出具体的改进方案。核心原则:先测量,再优化,再验证。

步骤

1. 确定优化目标

你想优化什么?

  • 网页加载速度(首屏渲染慢、页面太大)
  • 后端响应时间(API 慢、数据库查询慢)
  • 构建速度(打包太慢)
  • 内存或 CPU 占用

2. 测量当前基线(必做,优化前必须有数字)

在做任何改动之前,用合适的工具记录当前性能数据作为基线:

前端性能测量:

  • Chrome DevTools Performance 面板 — 录制页面加载,查看瀑布图和主线程阻塞
  • Lighthouse CLI (npx lighthouse URL --output=json) — 获取 FCP、LCP、TBT、CLS 评分
  • WebPageTest (webpagetest.org) — 真实网络条件下的加载瀑布图

Python 后端:

  • cProfile — 内置分析器,快速定位耗时函数:python -m cProfile -s cumtime app.py
  • py-spy — 采样式分析器,可附加到运行中的进程,无需改代码:py-spy top --pid PID
  • line_profiler — 逐行分析特定函数耗时,适合定位热点代码

Node.js 后端:

  • --inspect 标志 + Chrome DevTools — node --inspect app.js,然后在 Chrome 打开 chrome://inspect
  • clinic.js — 自动诊断工具:npx clinic doctor -- node app.js

数据库:

  • EXPLAIN ANALYZE — 在慢查询前加上,查看执行计划和实际耗时。重点关注全表扫描(Seq Scan)和嵌套循环

记录基线数据:具体的数字(如"首页 LCP 3.2s"、"API 响应 P95 800ms"、"查询耗时 1.4s")。

3. 分析瓶颈

根据测量结果,检查常见问题:

网页加载:

  • 图片是否压缩、是否使用现代格式(WebP/AVIF)
  • CSS/JS 是否合并压缩,是否有未使用的代码(Coverage 面板检查)
  • 是否有阻塞渲染的第三方脚本(加 async/defer)
  • 是否使用了懒加载(图片、路由、组件)

后端响应:

  • 数据库查询是否有 N+1 问题(ORM 日志看查询次数)
  • 是否缺少索引(EXPLAIN ANALYZE 显示 Seq Scan)
  • 是否有不必要的重复计算(可加缓存)
  • 序列化是否是瓶颈(大 JSON 响应考虑分页或字段筛选)

构建速度:

  • 是否有不必要的依赖拖慢构建
  • 是否可以用 esbuild/swc 替代 babel/terser

4. 输出优化方案

按投入产出比排序,给出具体建议:

性能分析报告
基线数据:[填入步骤 2 的测量结果]

高影响(优先做):
- [问题] 具体描述 -> [方案] 怎么改 -> [预期提升] 具体数字

中影响:
- ...

低影响(可选):
- ...

5. 执行优化并验证

用户选择后,逐个执行优化。每个优化完成后,用步骤 2 相同的工具和条件重新测量,对比基线数据:

  • 记录优化前后的具体数字变化
  • 如果某项优化效果不明显(提升不到 5%),考虑是否值得保留(增加了代码复杂度但收益小)
  • 如果某项优化导致性能下降,立即回滚

优化完成。主要改动:xxx。性能对比:[优化前数字] -> [优化后数字]。

遇到问题

  • 优化后反而更慢了 — 最常见的原因:缓存策略不当(缓存了不该缓存的动态数据)、过度拆分导致请求数增加、压缩算法的 CPU 开销超过了节省的传输时间。回滚改动,重新分析基线数据
  • 测量结果不稳定,每次跑差异很大 — 排除干扰因素:关闭其他占用资源的程序,多次测量取中位数(至少 3 次),前端测试用无痕窗口避免插件影响,后端测试先预热(丢弃前几次请求的结果)
  • 数据库加了索引但查询没变快 — 用 EXPLAIN ANALYZE 确认索引是否真的被使用。常见原因:查询条件中对列做了函数运算导致索引失效、数据量太小优化器选择全表扫描、索引已创建但统计信息未更新(运行 ANALYZE 命令)
  • Lighthouse 分数提升了但用户体感没改善 — Lighthouse 是模拟环境,可能与真实用户条件不同。用 Chrome DevTools 的 Network throttling 模拟慢网络(Slow 3G),或查看 Web Vitals 的真实用户数据(RUM)

Frequently asked questions

What does the Perf AI skill do?

当用户觉得页面慢、接口响应慢、打包慢、想优化性能时使用 — 分析瓶颈并给出具体改进方案

Why use Perf on TypingMind?

Because you install it once and use it with any model. Perf 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 Perf in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/lightpointventures/claude-code-starter/tree/main/skills/perf. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Perf?

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 Perf?

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

Is the Perf AI skill free?

Yes. It is published on GitHub by lightpointventures 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 👇