Codex 依據即時文件審查你的程式碼
逐步教學:連接 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 Hook
在提交前自動審查:
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."
開始使用
- 建立你的免費 API 金鑰
- 將初始化提示貼到你的代理人
- 試試上面的程式碼審查提示
你的程式碼審查員現在會自動閱讀最新文件,讓你不必親自查找。
本文也提供以下語言版本:English、简体中文、日本語、한국어、हिन्दी、Français、العربية、Русский、اردو、Bahasa Indonesia、Deutsch、Tiếng Việt、Türkçe、Italiano、ไทย、Español、বাংলা、Português。