agent-cli-creator
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseAgent CLI Creator
Agent CLI 创建器
Guide an AI Coding Agent to build a website-automating CLI tool backed by the kimi-webbridge browser daemon.
指导AI编码Agent构建基于kimi-webbridge浏览器守护进程的网站自动化CLI工具。
Phase 1: Prerequisites
第一阶段:前置条件
bash
~/.kimi-webbridge/bin/kimi-webbridge status| Result | Action |
|---|---|
| Proceed |
| Command not found | Tell user to visit https://www.kimi.team/features/webbridge (中文: https://www.kimi.team/zh-cn/features/webbridge) to install |
| Invoke the |
bash
~/.kimi-webbridge/bin/kimi-webbridge status| 结果 | 操作 |
|---|---|
| 继续执行 |
| 命令未找到 | 告知用户访问https://www.kimi.team/features/webbridge(中文: https://www.kimi.team/zh-cn/features/webbridge)进行安装 |
| 调用 |
Phase 2: Requirements Interview
第二阶段:需求沟通
Ask the user in one message, wait for reply:
- Target website URL (required)
- Programming language — Go (recommended if in this repo) / Python / Node.js / Other
- Login required? — Yes / No / Unknown (can skip for now)
- First 1–3 features — pick from common categories:
- Read: home feed, search, profile page, post/item detail
- Write: create post, like/unlike, comment, bookmark/save
- Account: login-status, user info
Explain iterative development to the user:
"We'll start with 1–3 features to validate the approach end-to-end before adding more. Site archaeology for features you don't need yet wastes time. You can always add features later by re-running from Phase 3."
用一条消息询问用户,等待回复:
- 目标网站URL(必填)
- 编程语言 — Go(若在此仓库中推荐使用)/ Python / Node.js / 其他
- 是否需要登录? — 是 / 否 / 未知(可暂时跳过)
- 首批1–3个功能 — 从常见类别中选择:
- 读取:首页信息流、搜索、个人主页、帖子/商品详情
- 写入:创建帖子、点赞/取消点赞、评论、收藏/保存
- 账户:登录状态、用户信息
向用户解释迭代开发理念:
“我们将从1-3个功能开始,先端到端验证方案后再添加更多功能。为目前不需要的功能进行网站探查会浪费时间。之后你可以通过重新执行第三阶段来添加新功能。”
Phase 3: Site Archaeology (mandatory before writing any code)
第三阶段:网站探查(编写代码前必须完成)
This phase is non-negotiable. Do not write business logic until archaeology is complete.
For each planned feature, run the full protocol in .
references/site-exploration.mdThe protocol yields: API endpoint, required headers, response shape, and a verified call that proves the API works inside the browser session.
evaluateOnly proceed to Phase 4 when you have a working call for every planned feature.
evaluate此阶段不可省略。在完成探查前请勿编写业务逻辑。
针对每个计划开发的功能,执行中的完整流程。
references/site-exploration.md该流程将产出:API端点、所需请求头、响应格式,以及经过验证的调用,用于证明该API在浏览器会话中可正常工作。
evaluate仅当所有计划功能都拥有可用的调用时,才可进入第四阶段。
evaluatePhase 4: Implement
第四阶段:开发实现
Order matters — do not skip ahead:
- Project scaffold — see for Go; adapt conventions for other languages
references/go-layout.md - command — if the site requires login; see
login-statusreferences/login-handling.md - Read commands — no side effects; implement and test first
- Write commands — side effects (post, like, etc.); implement after reads work
After each command is implemented, immediately verify before moving on:
bash
{platform}-cli {command} --help # --help must work
{platform}-cli {command} [args] # must return {"ok": true, "data": ...}For write commands, also verify the error path (e.g., wrong ID, missing flag) returns with non-zero exit.
{"ok": false, ...}If verification fails, fix before implementing the next command.
Universal CLI contract (all languages):
- /
--helpmust work on every command-h - All output: or
{"ok": true, "data": ...}{"ok": false, "error": {"code": "...", "message": "..."}} - Non-zero exit code on error
Go: 用 初始化独立 module,按 的结构搭建,包含自己的轻量 browser client 和 output helper。
go mod init {platform}-clireferences/go-layout.md顺序至关重要,请勿跳过步骤:
- 项目脚手架 — Go语言可参考;其他语言需适配相应规范
references/go-layout.md - 命令 — 若网站需要登录,请参考
login-statusreferences/login-handling.md - 读取类命令 — 无副作用,优先实现并测试
- 写入类命令 — 有副作用(如发布帖子、点赞等),需在读取类命令正常工作后再实现
每个命令实现完成后,需立即验证通过再进行下一步:
bash
{platform}-cli {command} --help # --help must work
{platform}-cli {command} [args] # must return {"ok": true, "data": ...}对于写入类命令,还需验证错误场景(如ID错误、缺少参数)会返回并以非零状态码退出。
{"ok": false, ...}若验证失败,需修复后再实现下一个命令。
通用CLI规范(所有语言):
- /
--help必须在每个命令中可用-h - 所有输出格式必须为:或
{"ok": true, "data": ...}{"ok": false, "error": {"code": "...", "message": "..."}} - 出错时返回非零状态码
Go语言: 使用初始化独立module,按照的结构搭建项目,包含自定义的轻量browser client和output helper。
go mod init {platform}-clireferences/go-layout.mdPhase 5: Write Companion Skill
第五阶段:编写配套技能
After the CLI works, create using the template in .
~/.claude/skills/{platform}-cli/SKILL.mdreferences/companion-skill-template.mdPurpose: tells a future AI agent how to use the CLI, not how to build it. The two skills serve different audiences at different times.
CLI工具正常工作后,使用中的模板创建文件。
references/companion-skill-template.md~/.claude/skills/{platform}-cli/SKILL.md目的: 告知未来的AI Agent如何使用该CLI工具,而非如何构建它。这两个技能在不同时期服务于不同的使用场景。