OriginAI — Product specs for Claude Code, Cursor, and Codex

从代码仓库生成规格

安装 Origin skill,再用 Claude Code 或 Codex 阅读现有仓库,把产品规格写进 OriginAI。

当产品已具备现有代码时,用 编码 Agent——优先 Claude Code 或 Codex,并配前沿模型——阅读仓库,在 OriginAI 中写成产品规格。随后由你在工作台中确认并发布。

你完全无需预先在 OriginAI Web 界面中创建项目。 Agent 会从仓库执行 create-project 完成创建与绑定。

这一模式适合:代码已经成型,但团队还没有一份大家都能指向的产品说明。弱 Agent 或弱模型写出来的规格会很薄。

开始之前

在开始前,请确认具备以下条件:

  • 一个已注册的 OriginAI 账户。
  • 本地可运行的 originai CLI(npx originai)。
  • 本地现有的产品代码仓库。
  • 你日常使用的 SOTA 编码 Agent。优先 Claude Code 或 Codex,并配前沿模型。

操作流程

以下为标准执行流程;你可以从对应步骤切入。

1. 安装 Origin skill

在产品仓库里运行:

npx skills add 21stware/originai-context

Claude Code 也可以从 marketplace 21stware/originai-context 安装插件。详见 Agent skills。

2. 本地机器授权登录

每台设备只需一次:

npx originai login

该命令将在浏览器中打开授权页面。凭据留在本机——切勿提交至 Git。

如果你使用私有化或自定义环境,请先配置 CLI 端点:

npx originai config
npx originai config set api_url <API URL>
npx originai config set web_url <web URL>

3. 把这段提示词贴给 Agent

在仓库根目录,把下面的提示词贴进 Claude Code 或 Codex。Agent 会执行 create-project、写入 .origin.json、必要时安装 skill,并一次性写成规格。

同一段提示词也在 OriginAI 创建页 的 从仓库写成规格 入口。

This git repository is existing product code. Create OriginAI product specs from it (repo → Origin). Do not invent UX the code does not clearly show.

Auth (human, once per machine): run `npx originai login` in this repo if you have not. Never commit `~/.origin/settings.json`. Prefer Origin MCP tools when connected; otherwise `npx originai` / `bunx originai`. Never raw curl.

1. If `.origin.json` has no `project_id`, run `npx originai create-project --name "<product name from the repo>"` (it writes `.origin.json` when unbound). Then `npx originai link --project <id> --skill` if the skill files are missing. Commit `.origin.json` (no secrets).
2. If a project is already bound, skip create-project. Do not create a second project.
3. Browse the tree and main entry points. Treat what you find as facts (who the code serves, roles, flows). Do not ask the human what the repo already answers.
4. If scope, device, or primary job is still ambiguous, **light grill** first: one round, at most 3 questions, each with a recommended answer. Infer the rest; close with "Reply go or adjust." Skip the grill when the brief/code already answers those. Do not write any `.rpml` until they say go or give the adjustment.
5. After alignment, initialize **fully** in one pass. Write `README.rpml` first (`mode="doc"` product design doc: overview, modules, page/route planning, flows, permissions). `validate --content` then `write-document --name "README.rpml" --content "<rpml>"`. No local `.rpml` files.
6. Immediately author one `.rpml` per page/route in that planning — do not stop after the README. Validate + write each.
7. Read back with `list-documents --read-type workspace` (default release reads are empty until publish). Confirm every planned page has a `.rpml`.
8. Tell the human: open OriginAI, review the specs, then **publish a release**. Until they publish, agents cannot read this content by default.

If a release already exists on the bound project, do not write the workspace directly — stage one Change Request for the whole pass (README + screens), then `describe-proposal` + `submit-proposal`. Never apply, dismiss, or record Ready / Not ready.

若已在 OriginAI 中建有对应项目,先运行 npx originai link --project <id> 绑定,跳过新建项目即可。

关联会在仓库根目录生成 .origin.json,其中仅包含项目 ID,不含密钥。请提交 Git,以免队友绑到别的项目。

4. 在 Web 工作台中审核规格

登录 OriginAI 打开对应项目,在概览和画布上查看规格,修正偏差。高质量规格应当读起来像产品设计文档,而不是代码注释的拼接。

5. 发布首个 Release

规格核验无误后,发布首个 Release。自发布起,后续编码 Agent 对规格的补充将以变更请求提交,由你审核应用后再发布新版。

项目完成关联后,也可以反过来:在工作台维护规格、发布新版本,再让 Agent 对齐最新规格写代码。见将规格共享给团队或编码 Agent。本页只讲从代码先写成规格。

常见问题排查

现象排查建议
规格很薄,或读起来像代码注释改用 Claude Code 或 Codex,并配前沿模型。重跑提示词,强调用户与场景;先校准 README,再对齐各页。
读取到的规格为空项目可能尚未发布 Release——请指定 --read-type workspace 读取工作区草稿,或先发布首个版本。
Agent 无法直接写入工作区检查登录与项目绑定。若已发布过 Release,直接写入会转为暂存变更请求。
Agent 提示写入成功但网页未展示核对项目 ID,刷新页面,或让 Agent 回读校验规格列表。

相关内容

On this page