Flutter 需求设计文档生成。用户说"做 XX 模块"、"新需求"、"设计 XX 功能"或描述功能需求时触发。把自然语言需求拆解成结构化 spec.md(7 段:目标/页面/流转/接口/字段/异常/非功能),给 flutter-plan 拆任务用。
反例(不该触发):
flutter-plan (spec 的下游)flutter-reviewdocs/_context/tech-stack.mddocs/_context/conventions.md (字段命名 / 模块命名规则)docs/_context/glossary.md (项目术语,避免重名)docs/_context/decisions.md (检查是否有相关决策)_knowledge/artifact-templates/spec.template.md (输出格式标准)注意: 不要读 docs/api/ 或 lib/features/(那是后续阶段的事,spec 不该被代码影响)。
必填:
会被自动追问的(若用户没说):
用户 likely 模糊的地方,要问清:
读 docs/_context/ 4 个文件 + spec.template.md。
不要立刻开始问,先把用户说的拆成 5 类:
lib/features/ 是否已有同名(冲突则改名)docs/_context/glossary.md 是否有相关术语v2 类型智能推断规则:
| 用户描述 / 字段名特征 | 推断类型 |
|---|---|
| id / ID / 编号 | String |
| 名称 / name / title / 标题 | String |
| 内容 / content / 描述 / remark | String (nullable) |
| 状态 / status / type / 类型 | int (标注为可能枚举,留给 model-gen 处理) |
| 时间 / 日期 / xxxAt / xxxTime / createdAt / updatedAt | String (ISO 8601),标注"时间字段" |
| 数量 / count / 价格 / price / 金额 / amount | int 或 double (含"价格/金额"用 double) |
| 是否 / isXxx / hasXxx / 布尔 | bool |
| 图片 / 头像 / avatar / imageUrl / 链接 / url | String (URL) |
| 列表 / xxxList / tags / 标签 | List<String> 或 List<嵌套对象> |
| 作者 / 用户信息 / xxxInfo | 嵌套对象 (独立实体,标注需要拆) |
推断示例: 用户说"公告模块,有标题、内容、发布时间、是否已读、发布者"
自动推断:
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| id | String | 是 | 公告 ID |
| title | String | 是 | 标题 |
| content | String? | 否 | 内容(富文本) |
| publishAt | String (ISO) | 是 | 发布时间 ⏰ |
| isRead | bool | 是 | 是否已读 |
| author | String? | 否 | 发布者 |
不确定时 AskUser:
Reflector 会检查异常场景 ≥3 条。
⛔ 非功能需求 / 资源管理段铁律(违反 = reflector 拦截):
涉及图片/切图资源时,必须写:
"切图在 page-gen 阶段用 curl 下载到本地
assets/image/3.0x/{module}/, 代码中使用Image.asset('assets/image/3.0x/{module}/xxx.png'), 禁止硬编码figma.com/api/mcp/asset/...URL(MCP URL 7 天过期)"
❌ 禁止写这类后门话术:
这种话术会导致 page-gen 偷懒直接用 Figma URL,生产代码 7 天后集体 404。必须在 spec 阶段就堵死。
按 _knowledge/artifact-templates/spec.template.md 7 段格式写入。
文件命名规则: {YYYYMMDD}-{作者名}-{需求名}.md
{YYYYMMDD} = 当天日期,如 20260417{作者名} = Step 3 中用户输入的名字{需求名} = 模块中文名(允许中文),如 公告模块docs/specs/20260417-渡-公告模块.md建议下一步用 flutter-plan 拆任务。
docs/specs/{YYYYMMDD}-{作者名}-{需求名}.md
命名示例: docs/specs/20260417-渡-公告模块.md
文件 frontmatter:
---
artifact_type: spec