reverse-api-engineer
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseReverse API Engineer
Reverse API Engineer
reverse-api-engineerchrome-mcpautoThis skill only supplies instructions. It drives the CLI through its scripted, JSON-emitting commands.
reverse-api-engineerchrome-mcpauto此 skill 仅提供操作说明。它通过脚本化、可输出 JSON 的命令来驱动 CLI。
1. Check the install
1. 检查安装情况
bash
reverse-api-engineer --versionIf the command is missing, ask the user before installing anything, then:
bash
uv tool install reverse-api-engineer # or: pipx install reverse-api-engineerAgent mode also needs Node.js 20.19+ on (it launches browser tooling through ). See setup and configuration for model access and settings.
PATHnpxbash
reverse-api-engineer --version如果命令不存在,应先征得用户同意再安装任何内容,然后执行:
bash
uv tool install reverse-api-engineer # or: pipx install reverse-api-engineerAgent 模式还需要在 中提供 Node.js 20.19+(它会通过 启动浏览器工具)。有关模型访问权限和设置,请参阅安装与配置。
PATHnpx2. Reuse an earlier capture when one exists
2. 存在早期抓取结果时予以复用
bash
reverse-api-engineer list --search "<site or task>" --jsonlistbash
reverse-api-engineer show <run_id> --json- means a client was generated: verify it in step 5 and reuse it if it covers the task.
file_count > 0 - means the traffic was saved: you can improve the client with
har_entries > 0(step 6) instead of browsing again.engineerruns keep no HAR (chrome-mcp), so they cannot be re-engineered.mode: "chrome-mcp" - Otherwise, capture again from step 3.
bash
reverse-api-engineer list --search "<site or task>" --jsonlistbash
reverse-api-engineer show <run_id> --json- 表示已生成客户端:在步骤 5 中验证该客户端;如果它能够覆盖任务,则直接复用。
file_count > 0 - 表示流量已保存:可以使用
har_entries > 0改进客户端(步骤 6),无需再次浏览。engineer运行不会保留 HAR(chrome-mcp),因此无法重新生成客户端。mode: "chrome-mcp" - 否则,从步骤 3 重新开始抓取。
3. Preflight
3. 预检
bash
reverse-api-engineer agent -p "<goal>" -u "<start url>" --dry-runThis validates the prompt, URL, config and environment without opening a browser. Fix every check before running. A on the API key is fine when the SDK authenticates another way (for example a logged-in Claude Code).
errorwarnwould_run.agent_providerchrome-mcpautoagent-browserchrome-mcpFor , the check covers the connection to the user's Chrome:
chrome-mcpchrome-mcp:auto-connect- : Chrome is reachable. The user still has to accept Chrome's connection prompt when the run starts.
ok - : it is not. If the site needs the user's login, ask them to open Chrome 146+ and enable remote debugging at
error("Enable auto-connect"), then run the preflight again. For public data, addchrome://inspect/#remote-debugging: rae then starts its own headless Chrome, without the user's sessions, and skips the check.--headless - : this rae version cannot test the connection. Ask the user to confirm Chrome is open with auto-connect enabled before a headed run, or use
warnfor public data.--headless
Write the goal as the data the user wants, not the clicks: "fetch open roles with title, location and team from the careers page, including pagination" works better than "click the jobs tab".
bash
reverse-api-engineer agent -p "<goal>" -u "<start url>" --dry-run该命令在不打开浏览器的情况下验证提示词、URL、配置和环境。运行前应修复每个 检查项。当 SDK 通过其他方式进行身份验证时(例如使用已登录的 Claude Code),API key 出现 是可以接受的。
errorwarn输出中的 表示本次运行将使用的浏览器。 表示使用用户自己的 Chrome 及用户的登录状态; 和 会启动一个不带用户登录状态的新浏览器。当任务需要用户登录,而 provider 不是 时,切换 provider 前应先征得用户同意(参阅会话)。
would_run.agent_providerchrome-mcpautoagent-browserchrome-mcp对于 , 检查项用于测试与用户 Chrome 的连接:
chrome-mcpchrome-mcp:auto-connect- :Chrome 可以访问。运行开始时,用户仍需接受 Chrome 的连接提示。
ok - :无法访问。如果网站需要用户登录,请让用户打开 Chrome 146+,并在
error中启用远程调试(“Enable auto-connect”),然后重新运行预检。对于公开数据,可以添加chrome://inspect/#remote-debugging:rae 会启动自己的无头 Chrome,不使用用户会话,并跳过此检查。--headless - :当前 rae 版本无法测试连接。请让用户确认 Chrome 已打开并启用 auto-connect,然后再进行有界面运行;对于公开数据,也可以使用
warn。--headless
目标应描述用户想要的数据,而不是点击操作。例如,“从招聘页面获取包含标题、地点和团队的开放职位,并包含分页”比“点击 Jobs 标签页”效果更好。
4. Capture and generate
4. 抓取并生成客户端
A run takes several minutes, often longer than a shell tool's default timeout. Start it in the background from the outset, with your shell tool's background option when it has one, or with :
&bash
reverse-api-engineer agent -p "<goal>" -u "<start url>" --json-stream > rae-run.ndjson 2> rae-run.log &
echo $! > rae-run.pid--json-stream{"event":"result",...}rae-run.ndjsonrae-run.pidkill -0 "$(cat rae-run.pid)"tail rae-run.log- Without ,
--headlessopens its own tab in the user's Chrome and closes only that tab. Tell the user before starting, since it acts in their browser, and ask them to accept the connection prompt Chrome shows: if nobody accepts it, the run times out without a client.chrome-mcp - Add for public sites, or on machines without a display.
--headless - Add to write runs somewhere other than
-o <dir>.~/.reverse-api/runs - prints the same result as a single object at the end, with no progress. Use it only when the shell can wait for the whole run.
--json - See sessions and blocked sites for logged-in sites and providers.
The final result line has these fields:
| Field | Meaning |
|---|---|
| |
| Id for |
| The generated client, inside |
| The raw capture; |
| Model cost of the run; report it to the user |
| Set on failure; see troubleshooting |
Exit codes: success, capture or engineering failed, misuse.
012一次运行需要数分钟,通常会超过 shell 工具的默认超时时间。应从一开始就在后台运行;如果 shell 工具支持后台选项,应使用该选项,也可以使用 :
&bash
reverse-api-engineer agent -p "<goal>" -u "<start url>" --json-stream > rae-run.ndjson 2> rae-run.log &
echo $! > rae-run.pid--json-stream{"event":"result",...}rae-run.ndjsonrae-run.pidkill -0 "$(cat rae-run.pid)"tail rae-run.log- 不使用 时,
--headless会在用户的 Chrome 中打开一个新标签页,并且只关闭该标签页。由于它会在用户浏览器中执行操作,启动前应告知用户,并请用户接受 Chrome 显示的连接提示;如果无人接受提示,运行将超时且不会生成客户端。chrome-mcp - 对于公开网站或没有显示器的机器,应添加 。
--headless - 添加 可将运行结果写入
-o <dir>以外的目录。~/.reverse-api/runs - 会在结束时以单个对象输出相同结果,不显示进度。仅当 shell 可以等待整个运行完成时使用它。
--json - 有关登录网站和 provider,请参阅会话与受阻网站。
最终结果行包含以下字段:
| 字段 | 含义 |
|---|---|
| |
| 用于 |
| 生成的客户端,位于 |
| 原始抓取结果;对于不保留 HAR 的 |
| 本次运行的模型成本;应向用户报告 |
| 失败时设置;参阅故障排除 |
退出码: 表示成功, 表示抓取或客户端生成失败, 表示使用方式错误。
0125. Verify the client
5. 验证客户端
Read the generated client and its before running anything: it is model-written code. Then run it:
README.mdbash
reverse-api-engineer run <run_id> --ls # list generated files
reverse-api-engineer run <run_id> --file <client file> --json -- <script args>--auto-install运行任何代码前,先阅读生成的客户端及其 :这是模型编写的代码。然后执行:
README.mdbash
reverse-api-engineer run <run_id> --ls # list generated files
reverse-api-engineer run <run_id> --file <client file> --json -- <script args>--auto-install6. Iterate on the same capture
6. 基于同一次抓取结果进行迭代
bash
reverse-api-engineer engineer <run_id> -p "add pagination and a typed Job model" --json
reverse-api-engineer engineer <run_id> --fresh -p "only the search endpoint" --jsonWithout , the prompt is layered on top of the original goal and the existing client. With , the client is regenerated from the HAR. needs a HAR, so it only works on runs from the or providers and from manual mode; on a run it exits with . For those, or when the capture itself is missing an endpoint, run again with a more specific goal.
--fresh--freshengineerautoagent-browserchrome-mcp2error_kind: misuseagentbash
reverse-api-engineer engineer <run_id> -p "add pagination and a typed Job model" --json
reverse-api-engineer engineer <run_id> --fresh -p "only the search endpoint" --json不使用 时,新提示词会叠加到原始目标和现有客户端上。使用 时,客户端会根据 HAR 重新生成。 需要 HAR,因此只能用于来自 或 provider 的运行以及手动模式;对于 运行,它会退出并返回 ,同时设置 。对于这类运行,或抓取结果本身缺少 endpoint 的情况,应使用更具体的目标再次运行 。
--fresh--freshengineerautoagent-browserchrome-mcp2error_kind: misuseagent7. Hand it over
7. 交付客户端
The client lives at from the result. When is on (the default), rae also copies it to in the working directory; copy it from when that folder is missing. Adapt names and types to their codebase, and keep the generated as usage notes. Tell the user which endpoints it wraps and how auth is handled (cookies, bearer token, CSRF), since captured credentials expire.
script_pathreal_time_sync./scripts/<descriptive_name>/script_pathREADME.md客户端位于结果中的 。当 开启时(默认开启),rae 还会将其复制到工作目录中的 ;如果该文件夹不存在,则从 复制。根据用户代码库调整名称和类型,并保留生成的 作为使用说明。告知用户客户端封装了哪些 endpoint,以及身份验证如何处理(cookies、bearer token、CSRF),因为抓取到的凭据会过期。
script_pathreal_time_sync./scripts/<descriptive_name>/script_pathREADME.mdBoundaries
边界
- Only capture sites the user is allowed to access, and respect their terms and rate limits.
- Captures can contain cookies and tokens. Do not paste HAR contents into chats, issues or commits.
- When a site needs a human (captcha, 2FA, unusual login), ask the user to capture it in manual mode, then continue with . See sessions and blocked sites.
engineer
- 仅抓取用户有权访问的网站,并遵守其服务条款和速率限制。
- 抓取结果可能包含 cookies 和 token。不要将 HAR 内容粘贴到聊天、issue 或 commit 中。
- 当网站需要人工操作(验证码、2FA 或非常规登录)时,请让用户在手动模式下完成抓取,然后使用 继续处理。参阅会话与受阻网站。
engineer