react-expert
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseReact Expert Research Skill
React 专家研究技能
Overview
概述
This skill produces exhaustive documentation research on any React API or concept by searching authoritative sources (tests, source code, PRs, issues) rather than relying on LLM training knowledge.
<CRITICAL>
**Skepticism Mandate:** You must be skeptical of your own knowledge. Claude is often trained on outdated or incorrect React patterns. Treat source material as the sole authority. If findings contradict your prior understanding, explicitly flag this discrepancy.
Red Flags - STOP if you catch yourself thinking:
- "I know this API does X" → Find source evidence first
- "Common pattern is Y" → Verify in test files
- Generating example code → Must have source file reference
该技能通过搜索权威来源(测试、源代码、PR、问题)而非依赖大语言模型的训练知识,生成关于任意React API或概念的详尽文档研究。
<CRITICAL>
**怀疑原则:** 你必须对自己的知识持怀疑态度。Claude的训练数据中常包含过时或错误的React模式。将原始资料视为唯一权威。如果发现的内容与你之前的理解相矛盾,需明确标记这种差异。
警示信号 - 如果你有以下想法请立即停止:
- "我知道这个API的作用是X" → 先找到原始证据
- "常见模式是Y" → 在测试文件中验证
- 生成示例代码 → 必须附带原始文件引用
Invocation
调用方式
/react-expert useTransition
/react-expert suspense boundaries
/react-expert startTransition/react-expert useTransition
/react-expert suspense boundaries
/react-expert startTransitionSources (Priority Order)
来源(优先级顺序)
- React Repo Tests - Most authoritative for actual behavior
- React Source Code - Warnings, errors, implementation details
- Git History - Commit messages with context
- GitHub PRs & Comments - Design rationale (via CLI)
gh - GitHub Issues - Confusion/questions (facebook/react + reactjs/react.dev)
- React Working Group - Design discussions for newer APIs
- Flow Types - Source of truth for type signatures
- TypeScript Types - Note discrepancies with Flow
- Current react.dev docs - Baseline (not trusted as complete)
No web search - No Stack Overflow, blog posts, or web searches. GitHub API via CLI is allowed.
gh- React 仓库测试 - 最能体现实际行为的权威来源
- React 源代码 - 警告、错误、实现细节
- Git 历史 - 带有上下文的提交信息
- GitHub PR 与评论 - 设计原理(通过CLI获取)
gh - GitHub 问题 - 困惑与疑问(来自facebook/react + reactjs/react.dev)
- React 工作组 - 新API的设计讨论
- Flow 类型 - 类型签名的权威来源
- TypeScript 类型 - 注意与Flow的差异
- 当前 react.dev 文档 - 基础参考(不视为完整权威)
禁止网页搜索 - 不得使用Stack Overflow、博客文章或网页搜索。允许通过 CLI调用GitHub API。
ghWorkflow
工作流程
Step 1: Setup React Repo
步骤1:搭建React仓库
First, ensure the React repo is available locally:
bash
undefined首先确保本地已有React仓库:
bash
undefinedCheck if React repo exists, clone or update
检查React仓库是否存在,存在则拉取更新,不存在则克隆
if [ -d ".claude/react" ]; then
cd .claude/react && git pull origin main
else
git clone --depth=100 https://github.com/facebook/react.git .claude/react
fi
Get the current commit hash for the research document:
```bash
cd .claude/react && git rev-parse --short HEADif [ -d ".claude/react" ]; then
cd .claude/react && git pull origin main
else
git clone --depth=100 https://github.com/facebook/react.git .claude/react
fi
获取研究文档对应的当前提交哈希:
```bash
cd .claude/react && git rev-parse --short HEADStep 2: Dispatch 6 Parallel Research Agents
步骤2:启动6个并行研究Agent
Spawn these agents IN PARALLEL using the Task tool. Each agent receives the skepticism preamble:
"You are researching React's. CRITICAL: Do NOT rely on your prior knowledge about this API. Your training may contain outdated or incorrect patterns. Only report what you find in the source files. If your findings contradict common understanding, explicitly highlight this discrepancy."<TOPIC>
| Agent | subagent_type | Focus | Instructions |
|---|---|---|---|
| test-explorer | Explore | Test files for usage patterns | Search |
| source-explorer | Explore | Warnings/errors in source | Search |
| git-historian | Explore | Commit messages | Run |
| pr-researcher | Explore | PRs introducing/modifying API | Run |
| issue-hunter | Explore | Issues showing confusion | Search issues in both |
| types-inspector | Explore | Flow + TypeScript signatures | Find Flow types in |
使用任务工具并行启动以下Agent,每个Agent都会收到怀疑原则的前置说明:
"你正在研究React的。重要提示:请勿依赖你关于该API的已有知识。你的训练数据可能包含过时或错误的模式。仅报告你在原始文件中发现的内容。如果发现的内容与普遍理解相矛盾,请明确强调这种差异。"<TOPIC>
| Agent | 子Agent类型 | 研究重点 | 说明 |
|---|---|---|---|
| test-explorer | 探索类 | 测试文件中的使用模式 | 搜索 |
| source-explorer | 探索类 | 源代码中的警告/错误 | 搜索 |
| git-historian | 探索类 | 提交信息 | 在 |
| pr-researcher | 探索类 | 引入/修改API的PR | 运行 |
| issue-hunter | 探索类 | 体现用户困惑的问题 | 搜索 |
| types-inspector | 探索类 | Flow + TypeScript签名 | 在 |
Step 3: Agent Prompts
步骤3:Agent提示词
Use these exact prompts when spawning agents:
启动Agent时请使用以下精确提示词:
test-explorer
test-explorer
You are researching React's <TOPIC>.
CRITICAL: Do NOT rely on your prior knowledge about this API. Your training may contain outdated or incorrect patterns. Only report what you find in the source files.
Your task: Find test files in .claude/react that demonstrate <TOPIC> usage.
1. Search for test files: Glob for `**/__tests__/**/*<topic>*` and `**/__tests__/**/*.js` then grep for <topic>
2. For each relevant test file, extract:
- The test description (describe/it blocks)
- The actual usage code
- Any assertions about behavior
- Edge cases being tested
3. Report findings with exact file paths and line numbers
Format your output as:You are researching React's <TOPIC>.
CRITICAL: Do NOT rely on your prior knowledge about this API. Your training may contain outdated or incorrect patterns. Only report what you find in the source files.
Your task: Find test files in .claude/react that demonstrate <TOPIC> usage.
1. Search for test files: Glob for `**/__tests__/**/*<topic>*` and `**/__tests__/**/*.js` then grep for <topic>
2. For each relevant test file, extract:
- The test description (describe/it blocks)
- The actual usage code
- Any assertions about behavior
- Edge cases being tested
3. Report findings with exact file paths and line numbers
Format your output as:Test File: <path>
Test File: <path>
Test: "<test description>"
Test: "<test description>"
javascript
<exact code from test>Behavior: <what the test asserts>
undefinedjavascript
<exact code from test>Behavior: <what the test asserts>
undefinedsource-explorer
source-explorer
You are researching React's <TOPIC>.
CRITICAL: Do NOT rely on your prior knowledge about this API. Only report what you find in the source files.
Your task: Find warnings, errors, and implementation details for <TOPIC>.
1. Search .claude/react/packages/*/src/ for:
- console.error mentions of <topic>
- console.warn mentions of <topic>
- Error messages mentioning <topic>
- The main implementation file
2. For each warning/error, document:
- The exact message text
- The condition that triggers it
- The source file and line number
Format your output as:You are researching React's <TOPIC>.
CRITICAL: Do NOT rely on your prior knowledge about this API. Only report what you find in the source files.
Your task: Find warnings, errors, and implementation details for <TOPIC>.
1. Search .claude/react/packages/*/src/ for:
- console.error mentions of <topic>
- console.warn mentions of <topic>
- Error messages mentioning <topic>
- The main implementation file
2. For each warning/error, document:
- The exact message text
- The condition that triggers it
- The source file and line number
Format your output as:Warnings & Errors
Warnings & Errors
| Message | Trigger Condition | Source |
|---|---|---|
| "<exact message>" | <condition> | file:line |
| Message | Trigger Condition | Source |
|---|---|---|
| "<exact message>" | <condition> | file:line |
Implementation Notes
Implementation Notes
<key details from source code>
```
<key details from source code>
```
git-historian
git-historian
You are researching React's <TOPIC>.
CRITICAL: Do NOT rely on your prior knowledge. Only report what you find in git history.
Your task: Find commit messages that explain <TOPIC> design decisions.
1. Run: cd .claude/react && git log --all --grep="<topic>" --oneline -50
2. For significant commits, read full message: git show <hash> --stat
3. Look for:
- Initial introduction of the API
- Bug fixes (reveal edge cases)
- Behavior changes
- Deprecation notices
Format your output as:You are researching React's <TOPIC>.
CRITICAL: Do NOT rely on your prior knowledge. Only report what you find in git history.
Your task: Find commit messages that explain <TOPIC> design decisions.
1. Run: cd .claude/react && git log --all --grep="<topic>" --oneline -50
2. For significant commits, read full message: git show <hash> --stat
3. Look for:
- Initial introduction of the API
- Bug fixes (reveal edge cases)
- Behavior changes
- Deprecation notices
Format your output as:Key Commits
Key Commits
<short hash> - <subject>
<short hash> - <subject>
Date: <date>
Context: <why this change was made>
Impact: <what behavior changed>
undefinedDate: <date>
Context: <why this change was made>
Impact: <what behavior changed>
undefinedpr-researcher
pr-researcher
You are researching React's <TOPIC>.
CRITICAL: Do NOT rely on your prior knowledge. Only report what you find in PRs.
Your task: Find PRs that introduced or modified <TOPIC>.
1. Run: gh pr list -R facebook/react --search "<topic>" --state all --limit 20 --json number,title,url
2. For promising PRs, read details: gh pr view <number> -R facebook/react
3. Look for:
- The original RFC/motivation
- Design discussions in comments
- Alternative approaches considered
- Breaking changes
Format your output as:You are researching React's <TOPIC>.
CRITICAL: Do NOT rely on your prior knowledge. Only report what you find in PRs.
Your task: Find PRs that introduced or modified <TOPIC>.
1. Run: gh pr list -R facebook/react --search "<topic>" --state all --limit 20 --json number,title,url
2. For promising PRs, read details: gh pr view <number> -R facebook/react
3. Look for:
- The original RFC/motivation
- Design discussions in comments
- Alternative approaches considered
- Breaking changes
Format your output as:Key PRs
Key PRs
PR #<number>: <title>
PR #<number>: <title>
URL: <url>
Summary: <what it introduced/changed>
Design Rationale: <why this approach>
Discussion Highlights: <key points from comments>
undefinedURL: <url>
Summary: <what it introduced/changed>
Design Rationale: <why this approach>
Discussion Highlights: <key points from comments>
undefinedissue-hunter
issue-hunter
You are researching React's <TOPIC>.
CRITICAL: Do NOT rely on your prior knowledge. Only report what you find in issues.
Your task: Find issues that reveal common confusion about <TOPIC>.
1. Search facebook/react: gh issue list -R facebook/react --search "<topic>" --state all --limit 20 --json number,title,url
2. Search reactjs/react.dev: gh issue list -R reactjs/react.dev --search "<topic>" --state all --limit 20 --json number,title,url
3. For each issue, identify:
- What the user was confused about
- What the resolution was
- Any gotchas revealed
Format your output as:You are researching React's <TOPIC>.
CRITICAL: Do NOT rely on your prior knowledge. Only report what you find in issues.
Your task: Find issues that reveal common confusion about <TOPIC>.
1. Search facebook/react: gh issue list -R facebook/react --search "<topic>" --state all --limit 20 --json number,title,url
2. Search reactjs/react.dev: gh issue list -R reactjs/react.dev --search "<topic>" --state all --limit 20 --json number,title,url
3. For each issue, identify:
- What the user was confused about
- What the resolution was
- Any gotchas revealed
Format your output as:Common Confusion
Common Confusion
Issue #<number>: <title>
Issue #<number>: <title>
Repo: <facebook/react or reactjs/react.dev>
Confusion: <what they misunderstood>
Resolution: <correct understanding>
Gotcha: <if applicable>
undefinedRepo: <facebook/react or reactjs/react.dev>
Confusion: <what they misunderstood>
Resolution: <correct understanding>
Gotcha: <if applicable>
undefinedtypes-inspector
types-inspector
You are researching React's <TOPIC>.
CRITICAL: Do NOT rely on your prior knowledge. Only report what you find in type definitions.
Your task: Find and compare Flow and TypeScript type signatures for <TOPIC>.
1. Flow types (source of truth): Search .claude/react/packages/*/src/*.js for @flow annotations related to <topic>
2. TypeScript types: Search .claude/react/packages/*/index.d.ts and @types/react
3. Compare and note any discrepancies
Format your output as:You are researching React's <TOPIC>.
CRITICAL: Do NOT rely on your prior knowledge. Only report what you find in type definitions.
Your task: Find and compare Flow and TypeScript type signatures for <TOPIC>.
1. Flow types (source of truth): Search .claude/react/packages/*/src/*.js for @flow annotations related to <topic>
2. TypeScript types: Search .claude/react/packages/*/index.d.ts and @types/react
3. Compare and note any discrepancies
Format your output as:Flow Types (Source of Truth)
Flow Types (Source of Truth)
File: <path>
flow
<exact type definition>File: <path>
flow
<exact type definition>TypeScript Types
TypeScript Types
File: <path>
typescript
<exact type definition>File: <path>
typescript
<exact type definition>Discrepancies
Discrepancies
<any differences between Flow and TS definitions>
```
<any differences between Flow and TS definitions>
```
Step 4: Synthesize Results
步骤4:综合结果
After all agents complete, combine their findings into a single research document.
DO NOT add information from your own knowledge. Only include what agents found in sources.
所有Agent完成任务后,将它们的发现整合为一份研究文档。
请勿添加任何来自你自身知识的信息。 仅包含Agent在原始来源中发现的内容。
Step 5: Save Output
步骤5:保存输出
Write the final document to
.claude/research/<topic>.mdReplace spaces in topic with hyphens (e.g., "suspense boundaries" → "suspense-boundaries.md")
将最终文档写入
.claude/research/<topic>.md将主题中的空格替换为连字符(例如:"suspense boundaries" → "suspense-boundaries.md")
Output Document Template
输出文档模板
markdown
undefinedmarkdown
undefinedReact Research: <topic>
React Research: <topic>
Generated by /react-expert on YYYY-MM-DD Sources: React repo (commit <hash>), N PRs, M issues
Generated by /react-expert on YYYY-MM-DD Sources: React repo (commit <hash>), N PRs, M issues
Summary
Summary
[Brief summary based SOLELY on source findings, not prior knowledge]
[Brief summary based SOLELY on source findings, not prior knowledge]
API Signature
API Signature
Flow Types (Source of Truth)
Flow Types (Source of Truth)
[From types-inspector agent]
[From types-inspector agent]
TypeScript Types
TypeScript Types
[From types-inspector agent]
[From types-inspector agent]
Discrepancies
Discrepancies
[Any differences between Flow and TS]
[Any differences between Flow and TS]
Usage Examples
Usage Examples
From Tests
From Tests
[From test-explorer agent - with file:line references]
[From test-explorer agent - with file:line references]
From PRs/Issues
From PRs/Issues
[Real-world patterns from discussions]
[Real-world patterns from discussions]
Caveats & Gotchas
Caveats & Gotchas
[Each with source link]
- <gotcha> - Source: <link>
[Each with source link]
- <gotcha> - Source: <link>
Warnings & Errors
Warnings & Errors
| Message | Trigger Condition | Source File |
|---|---|---|
| [From source-explorer agent] |
| Message | Trigger Condition | Source File |
|---|---|---|
| [From source-explorer agent] |
Common Confusion
Common Confusion
[From issue-hunter agent]
[From issue-hunter agent]
Design Decisions
Design Decisions
[From git-historian and pr-researcher agents]
[From git-historian and pr-researcher agents]
Source Links
Source Links
Commits
Commits
- <hash>: <description>
- <hash>: <description>
Pull Requests
Pull Requests
- PR #<number>: <title> - <url>
- PR #<number>: <title> - <url>
Issues
Issues
- Issue #<number>: <title> - <url>
undefined- Issue #<number>: <title> - <url>
undefinedCommon Mistakes to Avoid
需避免的常见错误
- Trusting prior knowledge - If you "know" something about the API, find the source evidence anyway
- Generating example code - Every code example must come from an actual source file
- Skipping agents - All 6 agents must run; each provides unique perspective
- Summarizing without sources - Every claim needs a file:line or PR/issue reference
- Using web search - No Stack Overflow, no blog posts, no social media
- 依赖已有知识 - 如果你“了解”某个API的信息,一定要找到原始证据
- 生成无来源的示例代码 - 每段代码示例都必须来自实际的原始文件
- 跳过Agent - 必须运行全部6个Agent;每个Agent都能提供独特视角
- 无来源的总结 - 每个结论都需要附带文件行号或PR/问题引用
- 使用网页搜索 - 禁止使用Stack Overflow、博客文章或社交媒体内容
Verification Checklist
验证清单
Before finalizing the research document:
- React repo is at with known commit hash
.claude/react - All 6 agents were spawned in parallel
- Every code example has a source file reference
- Warnings/errors table has source locations
- No claims made without source evidence
- Discrepancies between Flow/TS types documented
- Source links section is complete
在最终确定研究文档前,请检查:
- React仓库位于,且提交哈希已知
.claude/react - 已并行启动全部6个Agent
- 每段代码示例都有原始文件引用
- 警告/错误表格包含来源位置
- 所有结论都有原始证据支持
- Flow/TS类型之间的差异已记录
- 来源链接部分完整