React Component Diagnosis 标志

React Component Diagnosis

社区
hylarucoder
react-component-diagnosis

针对单个 React 组件或组件目录,从使用方 API、数据流、可测试性、可扩展性、性能、心智模型以及边界/契约等方面进行诊断,并提供代码证据和按优先级排序的建议。适用于用户指出某个组件或 .tsx 文件,并询问 props/API 设计、effects、重复渲染、架构或是否需要重构时(组件诊断、props 设计、为什么 re-render)。非 React 文件请使用 code-review-and-quality;如果范围涉及多个系统模块,请使用 hai-architecture。

Add to TypingMind

概览

发布者hylarucoder
代码仓库hai-stack
技能名称react-component-diagnosis
星标数
284
复刻数
15
附带文件
2
链接
  • Markdown 格式的指令

    模型按需加载 SKILL.md 文件,因此只有在请求确实与该技能匹配时才会消耗 Token。

  • 兼容任何大语言模型

    AI 技能采用纯 Markdown,而非特定提供商的代码,因此可搭配 GPT、Claude、Gemini、Grok 或本地模型使用。

  • 2 个附带文件

    模型执行任务时可读取的脚本、模板和参考资料。这些文件为只读文件,绝不会被执行。

  • 开源

    由 hylarucoder 发布于 GitHub。请在安装前查看技能的源文件。

安装

在 TypingMind 中安装 React Component Diagnosis AI 技能,即可搭配任意大语言模型使用;也可以将其放入其他支持读取 SKILL.md 的智能体中。

1

安装到 TypingMind

TypingMind 可直接从 GitHub 文件夹安装技能:读取 SKILL.md,打包资源文件,并将结果保存在本地。

  1. 打开应用,前往“插件 → 技能”。
  2. 选择“从 GitHub 安装”。
  3. 粘贴下方的技能文件夹 URL 并确认。
    https://github.com/hylarucoder/hai-stack/tree/main/skills/react-component-diagnosis
  4. 请在每个需要使用该技能的聊天中启用它。
依次选择“插件 → 技能 → 添加技能 → 从 GitHub URL 导入”,然后粘贴文件夹 URL 并点击“继续”。
2

安装到其他智能体

任何支持 Agent Skills 格式的智能体都可以使用此技能,只需将文件夹复制到该智能体的技能目录中。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/hylarucoder/hai-stack.git /tmp/hai-stack
mkdir -p .claude/skills
cp -r /tmp/hai-stack/skills/react-component-diagnosis .claude/skills/react-component-diagnosis
复制后,请重启 Claude Code,以加载新技能。

在 TypingMind 中使用此技能

在任意 TypingMind 聊天中启用 React Component Diagnosis,后续即可交由模型处理。技能的名称和描述会放在系统提示词中,一旦请求匹配,模型就会自动加载完整指令,无需您手动调用,且在实际使用前不会消耗 Token。

一旦请求与技能匹配,模型就会自动加载 React Component Diagnosis。

兼容任何 AI 模型

AI 技能是纯 Markdown 指令,而非特定提供商的代码,因此 React Component Diagnosis 不局限于最初适配的模型。只需在 TypingMind 中安装一次,即可搭配 GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 或您自行运行的本地模型使用,全程使用您自己的 API 密钥。

  • 仅在需要时加载

    系统提示词中仅包含技能名称和描述。首次遇到匹配的请求时才会加载完整指令,因此技能未使用时,这些指令不会消耗 Token。

  • 在聊天中切换模型

    技能是指令而非代码,因此切换模型不会导致技能失效,新模型会读取同一个 SKILL.md。

技能指令

这是模型会加载的 SKILL.md 内容。请在安装前阅读,因为技能就是模型将遵循的指令。

React Component Diagnosis

Purpose

Diagnose one React component's design from code that was actually read. The report should explain the highest-leverage behavior, API, state, effect, rendering, or boundary problem—not reward a fashionable directory shape or fill seven categories with generic advice.

Evidence gate

  1. Read the component entry file and the direct hooks, utilities, context, types, tests, and callers needed to understand its critical paths. Do not claim the whole directory was reviewed if some files were skipped.
  2. Trace props and external data through derivation, state, effects, callbacks, and rendered output.
  3. Cite concrete file:line evidence for every score deduction and recommendation.
  4. Attribute one root problem to its most relevant dimension; do not double-count it.
  5. Mark anything inferred from missing runtime/profile evidence as unverified.

Dimensions

DimensionCore question
Consumer APICan callers express valid use cases without learning internal mechanics?
Data flowIs props/state/derived data/effect flow unidirectional and traceable?
TestabilityCan important behavior be verified through stable public seams?
ExtensibilityDoes a likely change have a proportionate blast radius without speculative abstraction?
PerformanceIs there evidenced unnecessary rendering, computation, allocation, or leaked work?
Mental modelCan a reader predict ownership and where behavior changes?
Boundaries & contractsAre external data, third parties, errors, and trust boundaries handled once by the right owner?

Read references/dimensions.md for detailed evidence prompts, React-specific failure modes, and score calibration. Use only the prompts relevant to the component.

Guardrails

  • Prop, file, or line counts are clues, never automatic deductions.
  • Do not reward a new type at every layer. A new shape earns its cost only when meaning, constraints, audience, or ownership changes; otherwise preserve one canonical shape.
  • Do not recommend useMemo, useCallback, context splitting, dynamic imports, adapters, slots, factories, or Error Boundaries by default. Name the observed rerender, computation, failure boundary, or change pressure that justifies them.
  • A component can be large and coherent; a small component can still hide tangled state and effects.
  • Praise only patterns supported by code, and award the top score only when the implementation is a useful local precedent.

Workflow

  1. Define the component boundary and summarize its responsibility in one sentence.
  2. Build a small map: caller inputs → derivation/state/effects → children/output → callbacks.
  3. Identify the one or two critical paths most likely to affect users or future changes.
  4. Inspect the seven dimensions against those paths and tests.
  5. Score each dimension from 1–5 using references/dimensions.md, citing evidence and avoiding double-counting.
  6. Rank recommendations by impact and effort; distinguish confirmed problems from profiling or product questions that still need evidence.
  7. Check the report against references/output-template.md before finalizing.

For animation, video, or other high-frequency rendering, explicitly trace what changes each frame, which computations and allocations rerun, DOM-node volume, dependency stability, and whether cleanup actually cancels work. Do not infer a performance defect from hook presence alone.

Output

Use references/output-template.md, trimmed to the component's scale: responsibility, seven-score card, evidence-backed analysis, strengths, and P0/P1/P2 recommendations with effort. Include a diagram only when the multi-step data/effect flow is otherwise hard to understand.

Use a different skill when

  • Non-React file/function code smells → code-review-and-quality.
  • Multiple modules, package boundaries, or system ownership → hai-architecture.
  • One identifier or prop name only → hai-naming.
  • Type-safety-only work → an available TypeScript type-safety skill.
  • Applying the refactor rather than diagnosing it → an implementation/refactoring workflow.

Decision boundary: one component and its direct support surface stays here; a cross-system design question moves to architecture.

附带文件

技能加载后,模型会按需读取这些文件。它们仅作为可读文件提供,绝不会被执行。

常见问题

React Component Diagnosis AI 技能有什么作用?

针对单个 React 组件或组件目录,从使用方 API、数据流、可测试性、可扩展性、性能、心智模型以及边界/契约等方面进行诊断,并提供代码证据和按优先级排序的建议。适用于用户指出某个组件或 .tsx 文件,并询问 props/API 设计、effects、重复渲染、架构或是否需要重构时(组件诊断、props 设计、为什么 re-render)。非 React 文件请使用 code-review-and-quality;如果范围涉及多个系统模块,请使用 hai-architecture。

为什么在 TypingMind 中使用 React Component Diagnosis?

因为您只需安装一次,就能搭配任何模型使用。React Component Diagnosis 采用纯 Markdown 格式,而非特定提供商专用的代码,因此同一技能可用于 GPT-5、Claude、Gemini、Grok 或本地模型。您甚至可以在聊天中途切换模型,而不会影响技能的正常使用。TypingMind 使用您自己的 API 密钥,因此您直接向提供商付费,而不是按席位订阅;您的技能和聊天记录也都保留在您自己的存储空间中。

如何在 TypingMind 中安装 React Component Diagnosis?

在 TypingMind 中打开“插件 → 技能 → 从 GitHub 安装”,然后粘贴 https://github.com/hylarucoder/hai-stack/tree/main/skills/react-component-diagnosis。TypingMind 会读取其中的 SKILL.md,打包相关文件,并将其安装为技能,供您在各个聊天中按需启用。

哪些 AI 模型可以使用 React Component Diagnosis?

您在 TypingMind 中连接的任何模型都可以。AI 技能采用纯 Markdown 指令,而非特定提供商专用的代码,因此 GPT、Claude、Gemini、Grok 和本地模型都能在请求匹配时加载此技能。

React Component Diagnosis 可以搭配多少个 AI 模型使用?

数量不限。只要模型支持技能,您就可以将它与 React Component Diagnosis 搭配使用。GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 等模型都可以通过您自己的 API 密钥接入 TypingMind。

React Component Diagnosis AI 技能免费吗?

hylarucoder 已在 GitHub 上发布了该技能。请查看代码仓库了解许可条款。您只需向自己的 AI 提供商支付所用 Token 的费用。

什么是 AI 技能?

AI 技能是一组可复用的指令,用于教会 AI 模型完成某项特定任务。它遵循开放的 Agent Skills 格式:包含名称和描述的 SKILL.md 文件,以及模型可能需要的脚本、模板或参考文件。模型仅在您的请求与技能匹配时才会读取这些指令,因此已安装的技能在使用前不会产生任何费用。

AI 技能与插件或 MCP 服务器有何不同?

插件或 MCP 服务器为模型提供可调用的新工具,也就是在某处运行并返回结果的代码。AI 技能则为模型提供知识和流程:如何处理任务、遵循哪些步骤,以及怎样的输出才算优质。技能采用纯 Markdown 格式,因此不需要服务器、API 密钥或运行时环境,并且适用于任何模型。

查看全部

立即创建您自己的 AI 工作区

订阅我们的电子简报,获取新功能和后续赠奖活动的通知 👇