This skill is used to organize scattered requirements into a requirements document for the DWF workflow. It is only responsible for requirements capture and requirements document generation; when run independently it does not start the full development workflow, and in workflow mode it follows .dwf/state.json to continue the current stage.
-
Only generate the requirements document. By default, this skill only creates or updates the target spec directory's
01-需求/需求文档.md. It does not create other stage documents or code. -
The target spec directory is determined by the run mode and is not invented by this skill.
- Workflow mode: read
.dwf/state.json, in thespecsarray find the spec wherestatus: "active"andcurrent_step: "requirements", and use.dwf/specs/{spec.name}as the target spec directory. - Standalone mode:
.dwf/state.jsondoes not exist or there is no active spec satisfying the conditions. Usequestionto ask the user for the target directory, and by default propose.dwf/specs/{今日日期}-{seq}-feat-{从用户输入提取的描述}, whereseqscans.dwf/specs/for the maximum sequence number among existing spec directory names + 1 (or 001 if none), to be confirmed or modified by the user.
- Workflow mode: read
-
In standalone mode, do not create or advance
.dwf/state.json。 Standalone mode only writes the requirements document in the target spec directory and that spec's_meta.json(if that spec directory was created by this skill). Do not advance the project to design, breakdown, plans, todos, or code. Only in workflow mode, after user confirmation, update that spec'scurrent_step。 -
Do not create a complete workflow directory. Except for the target spec directory's
01-需求/, do not proactively create02-设计稿/、03-需求分析/、04-技术方案/、05-实现清单/. The project code directory is decided by the user/dwf-coding, and this skill does not create it.
-
Do not overwrite existing documents before confirmation. If the target spec directory's
01-需求/需求文档.mdalready exists, first read it and inform the user of the existing document, then ask whether to keep, modify, or replace it. Do not overwrite before the user confirms. -
Use Chinese throughout. Unless the user explicitly requests another language, all interactions with the user, requirements clarification questions, generated documents, titles, tags, table contents, explanatory text, test records, and artifact descriptions must be in Chinese. Code, file paths, commands, API names, technical terms, third-party library names, and original content provided by the user may remain in English.
Process after triggering
1. Explore the context
- Check whether
.dwf/state.jsonexists, and determine the run mode (see step 2). - Determine the source of user input: long text, local file path, external link, brief idea, or verbal description.
- If the user provides a local file path, read the file contents and organize them as the basis for requirements.
- If the user provides an external document link, use the corresponding skill to read it according to the link type. For example, use
lark-docfor Feishu documents andweb-access。 - If the user only gives a brief idea, first clarify the minimum information that affects the requirements structure and acceptance criteria.
2. Determine the run mode and target spec directory
Read .dwf/state.json:
-
Workflow mode: in
specsFind in the arraystatus: "active"andcurrent_step: "requirements"spec. The target spec directory is.dwf/specs/{spec.name}/。- If under that directory
01-需求/需求文档.mdalready exists, read it first and execute according to "handling existing documents". - After the requirements document is completed and confirmed by the user, update that spec's
current_stepto"design", appendrequirementstoconfirmed_stages, and synchronize its_meta.jsonwith the top-levelupdated_at。 - Follow dwf-orchestrator's confirmation mechanism; do not skip user confirmation.
- If under that directory
-
Standalone mode:
.dwf/state.jsondoes not exist, or there is no active spec that meets the conditions.- Use
questionto ask the user for the target spec directory, proposing by default.dwf/specs/{今日日期}-{seq}-feat-{描述}(the description is extracted from user input,seqscans.dwf/specs/the maximum sequence number among existing spec directory names +1, or 001 if none), for the user to confirm or modify. If the user chooses another directory, the user's input takes precedence. - If the target spec directory does not exist, create it and the
01-需求/。 - under it. Write an initial
_meta.json(namein that spec directory with the directory name asstatus: "active"、current_step: "requirements"、is_shared_context: false、shared_ref: null, etc.). - Do not create
.dwf/state.json, and do not advance the full workflow. - After the requirements document is completed, request user confirmation, and stop after confirmation.
- Use
3. Determine the input source
Choose the handling method based on the information provided by the user:
- Complete requirements document or long text: Directly extract the project name, background, goals, user roles, scope, functional requirements, non-functional requirements, constraints, dependencies, risks, and acceptance criteria.
- Local file path: After reading the file contents, organize them into a requirements document.
- External document link: Use the corresponding skill to read it according to the link type. For example, use
lark-docfor Feishu documents andweb-access。 - Brief idea or verbal description: Clarify the requirements first; do not rush to generate a document.
4. Clarify missing information
If the information is insufficient, ask follow-up questions one at a time. Prioritize clarifying content that affects the document structure and acceptance criteria:
- Project name or one-sentence overview.
- Background and business value.
- Target users and roles.
- Target platform: PC, mobile, or both.
- In-scope and out-of-scope content.
- Core use cases and main flow.
- Functional requirements and priorities.
- Non-functional requirements.
- Constraints, assumptions, dependencies, and risks.
- Overall acceptance criteria.
Do not throw out a large number of questions at once. If reasonable assumptions can be made based on context, first write them explicitly into "Assumptions", and put uncertain items into "Items to be confirmed".
5. Generate the requirements document
Read references/requirements_template.md, and generate a Chinese requirements document according to the template. Save it to the target spec directory:
{目标 spec 目录}/01-需求/需求文档.md
Generation rules:
- Keep the YAML frontmatter, including
project、version、author、date、statusandrevision。 - The new document's
statusdefaults todraft。 dateUse the current date.versionInitially1.0.0。revisionRecord "initial version".- The document must include a business process diagram, using Mermaid to express the main flow; if information is insufficient, generate a reasonable high-level flow and mark the branches that need confirmation in "Items to Be Confirmed".
- Functional requirements use
FR-1、FR-2numbering. - Non-functional requirements use
NFR-1、NFR-2numbering. - Priorities use MoSCoW: Must, Should, Could, Won't.
- Acceptance criteria must be observable or testable.
6. Request user confirmation
After generating the document, show the user the save location and a brief summary, and request confirmation:
- If the user confirms, state that the requirements document is complete.
- If the user provides modification suggestions, directly update
01-需求/需求文档.mdunder the target spec directory, keepstatus: draft, and request confirmation again. - If the user explicitly requests that it be marked as confirmed, change
statusin the frontmatter toconfirmed, and append a confirmation record inrevision.
After confirmation is complete:
- Standalone mode: stop, and do not automatically proceed to the design draft, requirements analysis, technical proposal, implementation checklist, or coding.
- Workflow mode: update the spec's
current_stepto"design", appendrequirementstoconfirmed_stages, synchronize_meta.jsonandupdated_at, and let dwf-orchestrator advance.
Handling existing documents
If the target file already exists:
- Read
{目标 spec 目录}/01-需求/需求文档.md。 - Summarize the current document's project name, version, status, and main content.
- Ask the user how to handle it:
- Keep the existing document, and only view or summarize it.
- Modify based on the existing document.
- Replace it with a new requirements document.
- Only after the user explicitly chooses to modify or replace may the file be written.
When modifying an existing document:
- Preserve the original structure unless the user requests a rewrite.
- Update
date。 - If the user confirms that this is a new version, increment
versionand append arevisionentry. - Do not create
需求文档-v2.mdor similar new version files unless the user explicitly requests it.
Pre-completion check
Before finishing, confirm:
- Only
01-需求/需求文档.md。 - under the target spec directory was created or updated; in standalone mode,
.dwf/state.json。 - In standalone mode, no phase directories other than the target spec directory
01-需求/were created. - In standalone mode, no subsequent phases were advanced.
- In workflow mode, the spec's
current_stepwas updated todesign。 - The document content is in Chinese.
- The document includes frontmatter.
- The document includes background, goals, user roles, scope, use cases, functional requirements, non-functional requirements, constraints, dependencies, risks, acceptance criteria, and items to be confirmed.
- The save path and the matters requiring user confirmation for the next step have been explained.