Skip to main content

Codex 根据实时文档审查你的代码

· 阅读需 7 分钟
Felo Search Tips Buddy
Committed to answers at your fingertips

分步教程:将 Codex 连接到 Felo OpenAPI,观看它如何根据最新的框架文档审查代码并生成带有引用的报告。

你的代码库使用了 React。但它是否采用了最新的模式?是否有被弃用的 API 藏在其中?Codex 可以审查你的代码——但前提是它能访问到最新的文档。

下面是赋予它这种能力的方法。

3 分钟连接 Felo OpenAPI

第 1 步:前往 openapi.felo.ai 并创建一个免费的 API 密钥。

第 2 步:将以下内容复制粘贴到你的 Codex、Claude Code 或 OpenClaw 中:

Connect to Felo OpenAPI:
- Models: Claude Opus 4.8, Claude Sonnet 4.6, Claude Haiku 4.5, GPT-5.6 Sol, GPT-5.6 Terra, Grok 4.5
- Search: POST /v2/chat (AI Search), POST /v2/web/extract (Web Fetch)
- Memory: LiveDocs (semantic retrieval, file upload, URL resources)
Base URL: https://openapi.felo.ai
API Key: [YOUR_API_KEY]

When I ask you to review code:
1. Search for the latest framework documentation
2. Read the official docs via Web Fetch
3. Compare my code against current best practices
4. Flag deprecated patterns, security issues, and performance concerns
5. Save the review to LiveDocs with documentation citations

第 3 步:连接完成。你的智能体现在会基于实时文档审查代码,而不是过时的训练数据。

用户故事

你有一个六个月前写的 React 组件。你想知道:

  • 是否使用了被弃用的 API?
  • 是否存在安全隐患?
  • 是否有最新 React 版本带来的性能提升?
  • 官方文档对这种模式有何建议?

你无需手动查阅文档,只需粘贴代码并让 Codex 审查即可。

你只需要这样说

Review this React component against the latest React 19 documentation. Flag any deprecated patterns, security issues, and performance improvements. Cite the specific docs where you found the guidance.

[Your code here]

Codex 自动完成的工作

第 1 步:搜索最新文档

POST /v2/chat
{
"query": "React 19 latest features deprecated APIs best practices 2026"
}

Codex 会找到官方 React 文档、发布说明和迁移指南。

第 2 步:阅读官方文档

POST /v2/web/extract
{
"url": "https://react.dev/blog/react-19"
}

Codex 阅读 React 19 的发布博客,提取出:

  • 新特性和新模式
  • 被弃用的 API
  • 迁移指导
  • 性能建议

Codex 会对主文档、API 参考和相关 RFC 讨论重复此操作。

第 3 步:分析你的代码

Codex 会将你的代码与刚刚阅读的文档进行对比:

  • 被弃用的 API:检查你的代码是否使用了 React 19 已弃用的模式
  • 安全问题:识别潜在的 XSS、注入或数据泄露风险
  • 性能:标记可以利用 React 19 新优化的地方
  • 最佳实践:将你的实现与当前官方建议进行对比

第 4 步:生成审查报告

Codex 会生成结构化报告:

## Code Review: [Component Name]

### 🟢 Good
- Component structure follows current patterns
- Proper error boundary usage

### 🟡 Warnings
- Uses `findDOMNode` — deprecated in React 18, removed in React 19
Source: https://react.dev/blog/react-19#removed-deprecated-apis
Fix: Use refs instead

### 🔴 Issues
- `componentWillMount` lifecycle — deprecated, replaced by constructor or useEffect
Source: https://react.dev/reference/react/Component#componentwillmount
Fix: Move initialization logic to constructor

### 💡 Performance Suggestions
- Consider React 19's `useActionState` for form state management
Source: https://react.dev/reference/react/useActionState

第 5 步:保存到 LiveDocs

Codex 会将审查结果保存到 LiveDocs,包括:

  • 原始代码
  • 审查发现及文档链接
  • 组件类型、框架版本和问题严重程度的标签

未来的审查可以参考这些历史记录。

最终效果

你将获得这样一份代码审查:

  • 引用具体的文档页面,而非泛泛建议
  • 精确指出被弃用模式及其所在行号
  • 提供带有官方文档引用的具体修复建议
  • 基于最新版本提出性能优化建议

总耗时:2-3 分钟。

完整提示模板(可复制复用)

Review this [FRAMEWORK/LANGUAGE] code against the latest [VERSION] documentation.

[Your code here]

Check for:
1. Deprecated APIs or patterns
2. Security issues
3. Performance improvements
4. Best practice violations

Cite the specific documentation URLs where you found each issue.
Save the review to LiveDocs with tags for [PROJECT] and [COMPONENT_TYPE].

将方括号内内容替换为你的实际需求即可用于任何代码审查。

进阶用法:批量审查

一次性审查多个文件:

Review all React components in this directory against React 19 documentation. Produce a summary report ranked by severity, with individual findings for each component.

[File list or code blocks]

Save the summary to LiveDocs.

Codex 会分别审查每个文件,生成独立发现,并输出按严重程度排序的总结报告。

进阶用法:Pre-Commit 钩子

在提交前自动审查:

Before I commit this code, review it against the latest documentation for [FRAMEWORK]. Flag anything that would fail a senior engineer's code review. If nothing critical, say "Looks good to commit."

快速开始

  1. 创建你的免费 API 密钥
  2. 将初始化提示粘贴到你的智能体中
  3. 尝试上面的代码审查提示

你的代码审查员现在会自动阅读最新文档,让你省心省力。

获取你的免费 API 密钥 →


本文还提供以下语言版本:English日本語한국어繁體中文हिन्दीFrançaisالعربيةРусскийاردوBahasa IndonesiaDeutschTiếng ViệtTürkçeItalianoไทยEspañolবাংলাPortuguês