跳到正文
Skillpedia
网站与界面(前端)41k · #6816

react-doctor

它能做什么

本技能对 React 代码库进行健康扫描,列出每个问题及其文件名和行号。适合希望自己的 React 应用更安全、更快、更易维护的开发者。

适用场景

  • ✓当你想在发布前对 React 项目做一次健康检查时。
  • ✓当某个 React 界面感觉很慢,或重新渲染过于频繁,需要找出原因的时候。
  • ✓当你在审查 React 代码,并希望用评分来跟踪改进效果的时候。

技能链接

https://github.com/PostHog/posthog/blob/master/.agents/skills/react-doctor/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/PostHog/posthog/blob/master/.agents/skills/react-doctor/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“请扫描我的 React 应用,找出问题,并优先修复最严重的部分。”

每周 5 个新技能,1 分钟读完。

工作原理

它会在项目文件夹中运行扫描器,检查数十条规则,例如硬编码的密钥、不当的 effect 和过重的导入。AI 会先修复最严重的问题,然后重新扫描,确认评分有所提高。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

React Doctor

Scans your React codebase for security, performance, correctness, and architecture issues. Outputs a 0-100 score with actionable diagnostics.

Usage

npx -y react-doctor@latest . --verbose

Workflow

  1. Run the command above at the project root
  2. Read every diagnostic with file paths and line numbers
  3. Fix issues starting with errors (highest severity)
  4. Re-run to verify the score improved

Rules (47+)

  • Security: hardcoded secrets in client bundle, eval()
  • State & Effects: derived state in useEffect, missing cleanup, useState from props, cascading setState
  • Architecture: components inside components, giant components, inline render functions
  • Performance: layout property animations, transition-all, large blur values
  • Correctness: array index as key, conditional rendering bugs
  • Next.js: missing metadata, client-side fetching for server data, async client components
  • Bundle Size: barrel imports, full lodash, moment.js, missing code splitting
  • Server: missing auth in server actions, blocking without after()
  • Accessibility: missing prefers-reduced-motion
  • Dead Code: unused files, exports, types

Score

  • 75+: Great
  • 50-74: Needs work
  • 0-49: Critical
常见问题

我应该努力达到什么分数?

75 分或以上为优秀,50 到 74 分需要改进,低于 50 分则属于严重问题。

AI 会自行修复问题吗?

它会从最严重的问题开始逐一处理,进行修复,然后再次扫描以检查结果。

我需要先安装什么吗?

扫描器通过 npx 运行,因此你的电脑需要安装 Node.js。每次运行时,该命令都会获取最新的扫描器。

详情

作者的原始描述

Diagnose and fix React codebase health issues. Use when reviewing React code, fixing performance problems, auditing security, or improving code quality.

repo: PostHog/posthog

热度

GitHub 星标
41k
排名
#6816
许可证
—
更新时间
2026/11/2

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能