返回提示词目录第 1325 页

为编程代理编写功能实现规格

基于仓库现有结构把功能需求整理为可测试要求、技术设计和分步任务,标明审查点与待确认问题。

完整提示词

<context>
Coding agents do their best work from a spec that removes guessing, and their worst from a paragraph. Spec-driven development splits the work into three documents: requirements (what must be true), design (how it fits this codebase) and tasks (small ordered steps, each verifiable). Requirements written in EARS form (Easy Approach to Requirements Syntax: "When <trigger>, the <system> shall <response>", "While <state>, ...", "If <unwanted condition>, then ...", "Where <feature is included>, ...") are short, testable and hard to misread, and they force unwanted-behaviour cases to be written. The design must come from reading the repository: the existing modules, patterns, data models, error handling and test style the agent should follow; a design that invents a new layer the codebase does not use is the most common reason agent output is rejected. Tasks should each touch a small area, reference the requirements they satisfy, include the tests to add, and end at checkpoints where the human reviews before the agent continues.
</context>

<task>
<feature_request>
{{feature_request}}
</feature_request>
{{#context}}
<context_from_user>
{{context}}
</context_from_user>
{{/context}}

1. Read the repository before writing: find the modules the feature touches, similar existing features to copy, the data model, API and UI conventions, error handling, configuration, and how tests are written and run. Note the files you read.
2. Write requirements: a one-paragraph goal, user stories where useful, and numbered acceptance requirements in EARS form (ubiquitous, event-driven, state-driven, unwanted behaviour, optional feature), including error, permission, empty and limit cases. Add explicit non-goals.
3. Write the design grounded in what you read: components and files to change or add, data model and migration changes, API or interface changes, how errors and edge cases are handled, security and performance notes, and the testing approach, each following an existing pattern you name. Note alternatives rejected in one line each.
4. Write tasks: an ordered checklist of small tasks, each with the files involved, the requirement ids it satisfies, the tests to add or update, and a done condition. Insert checkpoints for human review after risky steps (migrations, public API changes). Never include destructive commands without a confirmation step.
5. List open questions that block or change the design, each with a recommended default.
6. If the user gave a location for spec files, propose the three file names; otherwise return all three sections in one document.
</task>

<constraints>
- Do not write implementation code; this is the spec the agent will implement from.
- Ground every design decision in files you actually read; if you could not read the repository, say so and mark the design as provisional.
- Every requirement must be testable and every task must map to at least one requirement.
- Keep tasks small enough to review in one sitting; split anything that touches many unrelated areas.
- If the feature request is too vague to write testable requirements, ask focused questions first.
</constraints>

<output_format>
## Requirements
Goal paragraph, non-goals, then numbered EARS requirements (R1, R2, ...).
## Design
Subsections: files read, components and changes, data, interfaces, errors and edge cases, testing, rejected alternatives.
## Tasks
Checklist: - [ ] T1 description (files; satisfies R...; tests; done when), with CHECKPOINT lines.
## Open questions
Numbered: question, recommended default.
</output_format>

可替换内容

  • {{feature_request}}
  • {{#context}}
  • {{context}}
  • {{/context}}
  • [ ]

分类与标签

编程开发、功能规格、编程代理、验收标准、开发任务拆解

前往 AI 图片创作