prototype
它能做什么
它构建一次性的代码,用来回答关于某件事应当如何运作或呈现的一个问题。它适合希望在正式构建之前先测试想法的产品人员和开发者。
适用场景
- ✓你想确认某个逻辑或状态模型是否合理的时候。
- ✓你想比较某个界面的几个差异很大的版本的时候。
- ✓你不确定某件事应当如何运作,想先测试的时候。
技能链接
https://github.com/mattpocock/skills/blob/main/skills/engineering/prototype/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“我需要一个快速的一次性原型,这样我能看到结账页面的三种不同布局。”
每周 5 个新技能,1 分钟读完。
工作原理
智能体根据你的问题在两条路径中选择一条:一是用于测试逻辑的可分享页面,二是用于查看设计的几个可切换的界面版本。它会把代码清楚地标注为原型。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Prototype
A prototype is throwaway code that answers a question. The question decides the shape.
Pick a branch
Identify which question is being answered, using the user's prompt, the surrounding code, or by asking if the user is around:
- "Does this logic / state model feel right?" → LOGIC.md. Build a single shareable HTML file (free-play buttons plus tabbed guided walkthroughs) that pushes the state machine through cases that are hard to reason about on paper, and that a non-developer can drive.
- "What should this look like?" → UI.md. Generate several radically different UI variations on a single route, switchable via a URL search param and a floating bottom bar.
The two branches produce very different artifacts, so getting this wrong wastes the whole prototype. If the question is genuinely ambiguous and the user isn't reachable, default to whichever branch better matches the surrounding code (a backend module → logic; a page or component → UI) and state the assumption at the top of the prototype.
Rules that apply to both
- Throwaway from day one, and clearly marked as such. Locate the prototype code close to where it will actually be used (next to the module or page it's prototyping for) so context is obvious, but name it so a casual reader can see it's a prototype, not production. For throwaway UI routes, obey whatever routing convention the project already uses; don't invent a new top-level structure.
- Trivial to run. A UI prototype starts from one command in the project's task runner:
pnpm <name>,python <path>,bun <path>, etc. A logic demo is a single HTML file the user double-clicks. Either way, no thinking required to start it. - No persistence by default. State lives in memory. Persistence is the thing the prototype is checking, not something it should depend on. If the question explicitly involves a database, hit a scratch DB or a local file with a clear "PROTOTYPE, wipe me" name.
- Skip the polish. No tests, no error handling beyond what makes the prototype runnable, no abstractions. The point is to learn something fast.
- Surface the state. After every action (logic) or on every variant switch (UI), print or render the full relevant state so the user can see what changed.
- Capture it when done. Fold any validated decision into the real code, then capture the prototype itself as a primary source: commit it to a throwaway branch, out of main, and leave a context pointer to that branch on the implementation issue. Capture the answer too (the verdict and the question it settled) in the issue or a commit. The main branch keeps only the validated decision.
常见问题
原型是为了保留下来的吗?
不是。技能说明它是一次性代码,并做出清楚标记,以免有人把它误认为正式代码。
两条路径有什么区别?
一条帮助你在单个可分享的文件中测试逻辑的运行方式,另一条则在同一页面上展示几个界面版本。
如果我不确定选哪条路径怎么办?
智能体会根据周围的代码进行选择,并在原型顶部说明它的假设。
详情
作者的原始描述
Build a throwaway prototype to answer a design question. Use when the user wants to sanity-check whether a state model or logic feels right, or explore what a UI should look like.
repo: mattpocock/skills
热度
- GitHub 星标
- 310k
- 排名
- #105
- 许可证
- MIT
- 更新时间
- 2026/11/1
评论
- …