功能规格说明
Feature specification
Summary
Demonstrates the feature specification step — planning the first feature (Hello Hono) through agent conversation. Covers creating a feature branch, clearing agent context, defining requirements and validation scorecards, and iterating on the spec before committing.
Key Takeaways
- Start with a clean slate: clear agent context and work in a separate feature branch for each feature
- Feature spec = plan + requirements + validation: three key documents that guide implementation
- Iterate on the spec before coding: corrections to the spec are cheap; corrections to code are expensive
English Script
We now have a roadmap with features. But how do we build them? With specs of course, starting with the first roadmap feature. Let’s take a look at the AgentClinic roadmap. Here’s our phase one feature, Hello Hono. But it’s too early to start coding. We need to discuss the spec and clarify all the details. A good plan outlines the approach, the sequence of work, and how to validate success. Let’s start with fresh agent context. The agent can get what it needs from the official source, the constitution. We will work on this feature in a separate branch, which we will indicate to the agent. Our prompt will help start a conversation with the agent about the feature spec, a plan for tasks, collect requirements, and a scorecard for validation. The agent will ask you to make key decisions. Pay attention to potential conflicts or problems. You don’t have to agree with the solutions proposed by the agent. Make sure to clarify anything that bothers you.
First, regarding phase one scope, we’ll keep it exactly as written. For the requirements, let’s pin the Hono version and enforce strict TypeScript. For the confirmation, manual curl looks good. Then, let’s submit. That was fast. Must have been a nano. Work is done and the ball is back on our side for reviewing the feature spec created by the agent. Let’s review the feature plan first. It’s important to get these docs right in the beginning to keep the agent on track. If you find something wrong, ask the agent to fix it, to make sure it keeps the requirements and validation in sync. For example, we would like a nice looking placeholder home page in this first feature spec. We make the change via the agent. Next, the requirements. These were also updated to reflect the homepage update. This is the right place to indicate any important technical needs or constraints. Don’t speed through this, but don’t state minor technical details like variable names here. We want to control the process but not oversteer the agent. Last, the validation. Make sure the agent can check that it got it right. Again, these were updated for the homepage. We’re done with the feature spec. Let’s create a commit in the IDE.
Nice. We formulated a feature spec strategy. Made a feature branch, interviewed with the agent about what the feature should do. Put the results in markdown documents, reviewed these spec files, committed. The changes you make here in the specs will expand downstream into hundreds of lines of code. So time spent here is well spent. It’s time for implementation.
功能规格说明
摘要
演示功能规格说明步骤——通过与智能体对话规划第一个功能(Hello Hono)。涵盖创建功能分支、清理智能体上下文、定义需求和验证记分卡,以及在提交前迭代优化规格说明。
关键要点
- 从干净的状态开始:清理智能体上下文,每个功能在独立分支上开发
- 功能规格 = 计划 + 需求 + 验证:三个关键文档指导后续实现
- 编码前先迭代规格:修改规格说明成本很低;修改代码成本很高
视频信息:功能规格说明
视频脚本(中文翻译)
我们现在有了一个包含各项功能的路线图。但是我们要怎么构建它们呢?当然是通过规格说明(Specs),从路线图上的第一个功能开始。让我们看看 AgentClinic 的路线图。这是我们第一阶段的功能:Hello Hono。但现在开始写代码还为时过早。我们需要讨论规格说明并理清所有细节。一个好的计划应该概述实现的方法、工作顺序以及如何验证是否成功。让我们以全新的智能体上下文重新开始。智能体可以从官方来源——也就是项目章程中,获取它需要的信息。我们将在一个独立的分支上开发这个功能,我们会向智能体指明这一点。我们的提示词将帮助开启与智能体关于功能规格说明的对话,包括任务计划、收集需求以及一个用于验证的记分卡。智能体会要求你做出一些关键决策。注意潜在的冲突或问题。你不必同意智能体提出的所有解决方案。确保澄清任何让你觉得不妥的地方。
首先,关于第一阶段的范围,我们将完全保留其原有的设定。对于需求方面,让我们锁定 Hono 的版本并强制使用严格的 TypeScript。对于确认测试方式,手动 curl 看起来不错。然后,让我们提交。这真快。这肯定是一个极小(nano)的更新。工作完成了,现在球又回到了我们这边,需要审查智能体生成的功能规格说明。让我们先复习一下功能计划。一开始就把这些文档弄对是非常重要的,这样才能让智能体保持在正确的轨道上。如果你发现有错,要求智能体去修复它,以确保需求和验证保持同步。例如,我们希望在这个第一个功能规范中包含一个好看的占位主页。我们通过智能体进行了这项修改。接下来是需求部分。这些内容也已更新以反映主页的变动。这是指出任何重要技术需求或限制条件的绝佳位置。不要草草略过这里,但也不要在这里陈述像变量名这样琐碎的技术细节。我们希望控制过程,但不要对智能体过度干预。最后是验证部分。确保智能体能够自己检查它是否做对了。同样,这些为了主页功能也进行了更新。我们完成了功能规格说明。让我们在 IDE 中创建一个代码提交(commit)。
太棒了。我们制定了功能规格说明的策略。创建了一个功能分支,就该功能应该做什么与智能体进行了对话式访谈。将结果放入 Markdown 文档中,审查了这些规格文件,并提交。你在这里对规格说明所做的修改,将在下游扩展成几百行代码。所以花在这里的时间是非常值得的。现在是进入实现(代码编写)阶段的时候了。