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。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 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
- Run the command above at the project root
- Read every diagnostic with file paths and line numbers
- Fix issues starting with errors (highest severity)
- 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
评论
- …
同一仓库的更多技能
depot-ci
41k帮你的智能体设置并运行 Depot CI 工作流(GitHub Actions 的替代方案),包括迁移现有工作流和读取运行日志。
depot-container-builds
41k帮你的智能体在 Depot 的远程构建器上构建 Docker 镜像,包括多平台镜像、推送到镜像仓库,以及修复构建失败。
depot-github-runners
41k帮你的智能体把 GitHub Actions 任务迁移到 Depot 托管的运行器上,选择运行器规格和标签,并排查运行器设置问题。
editing-agents-md
41k帮你的智能体判断某条规则应写入 AGENTS.md 还是 CLAUDE.md,并以不会让文件臃肿的方式写下,确保规则真正生效。