agent-cli-creator

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Agent 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
ResultAction
running: true
+
extension_connected: true
Proceed
Command not foundTell user to visit https://www.kimi.team/features/webbridge (中文: https://www.kimi.team/zh-cn/features/webbridge) to install
running: false
or
extension_connected: false
Invoke the
kimi-webbridge
skill → references/operations.md
bash
~/.kimi-webbridge/bin/kimi-webbridge status
结果操作
running: true
+
extension_connected: true
继续执行
命令未找到告知用户访问https://www.kimi.team/features/webbridge(中文: https://www.kimi.team/zh-cn/features/webbridge)进行安装
running: false
extension_connected: false
调用
kimi-webbridge
技能 → references/operations.md

Phase 2: Requirements Interview

第二阶段:需求沟通

Ask the user in one message, wait for reply:
  1. Target website URL (required)
  2. Programming language — Go (recommended if in this repo) / Python / Node.js / Other
  3. Login required? — Yes / No / Unknown (can skip for now)
  4. 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."
用一条消息询问用户,等待回复:
  1. 目标网站URL(必填)
  2. 编程语言 — Go(若在此仓库中推荐使用)/ Python / Node.js / 其他
  3. 是否需要登录? — 是 / 否 / 未知(可暂时跳过)
  4. 首批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.md
.
The protocol yields: API endpoint, required headers, response shape, and a verified
evaluate
call that proves the API works inside the browser session.
Only proceed to Phase 4 when you have a working
evaluate
call for every planned feature.
此阶段不可省略。在完成探查前请勿编写业务逻辑。
针对每个计划开发的功能,执行
references/site-exploration.md
中的完整流程。
该流程将产出:API端点、所需请求头、响应格式,以及经过验证的
evaluate
调用,用于证明该API在浏览器会话中可正常工作。
仅当所有计划功能都拥有可用的
evaluate
调用时,才可进入第四阶段。

Phase 4: Implement

第四阶段:开发实现

Order matters — do not skip ahead:
  1. Project scaffold — see
    references/go-layout.md
    for Go; adapt conventions for other languages
  2. login-status
    command
    — if the site requires login; see
    references/login-handling.md
  3. Read commands — no side effects; implement and test first
  4. 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
{"ok": false, ...}
with non-zero exit.
If verification fails, fix before implementing the next command.
Universal CLI contract (all languages):
  • --help
    /
    -h
    must work on every command
  • All output:
    {"ok": true, "data": ...}
    or
    {"ok": false, "error": {"code": "...", "message": "..."}}
  • Non-zero exit code on error
Go:
go mod init {platform}-cli
初始化独立 module,按
references/go-layout.md
的结构搭建,包含自己的轻量 browser client 和 output helper。
顺序至关重要,请勿跳过步骤:
  1. 项目脚手架 — Go语言可参考
    references/go-layout.md
    ;其他语言需适配相应规范
  2. login-status
    命令
    — 若网站需要登录,请参考
    references/login-handling.md
  3. 读取类命令 — 无副作用,优先实现并测试
  4. 写入类命令 — 有副作用(如发布帖子、点赞等),需在读取类命令正常工作后再实现
每个命令实现完成后,需立即验证通过再进行下一步:
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语言: 使用
go mod init {platform}-cli
初始化独立module,按照
references/go-layout.md
的结构搭建项目,包含自定义的轻量browser client和output helper。

Phase 5: Write Companion Skill

第五阶段:编写配套技能

After the CLI works, create
~/.claude/skills/{platform}-cli/SKILL.md
using the template in
references/companion-skill-template.md
.
Purpose: 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工具,而非如何构建它。这两个技能在不同时期服务于不同的使用场景。