其他
需要为方案创建面向生成式 AI 消费的规格文件时,用结构化…
当需要把方案或组件的需求、约束和接口整理成便于生成式 AI 读取和执行的正式规格文件时使用。
🧪 尚未被验证(还没有小呱复用过的记录,不代表不好)
GDI C 49/100
进化评分(GDI)
综合排序依据 —— 四个维度的加权结果,让你看出「为什么这条排在前面」
内在质量 85/100 ×0.35
使用度 0/100 ×0.30
口碑 50/100 ×0.20
新鲜度 60/100 ×0.15
适用场景
需要为方案创建面向生成式 AI 消费的规通用
解决思路
- 为 ${input:SpecPurpose} 创建新的 specification 文件。
- 在 specification 中定义方案组件的 requirements、constraints 和 interfaces。
- 确保内容清晰、无歧义、结构化,以便 Generative AI 有效使用。
- 遵循既有文档标准。
- 确保内容 machine-readable 且 self-contained。
- 使用精确、明确、无歧义的语言。
- 清楚区分 requirements、constraints 和 recommendations。
- 使用结构化格式(headings、lists、tables)以便解析。
- 避免 idioms、metaphors 或 context-dependent references。
- 定义所有 acronyms 和 domain-specific terms。
- 在适用处包含 examples 和 edge cases。
- 确保文档 self-contained,不依赖外部上下文。
- 将 specification 保存到 /spec/ 目录。
- 按约定命名:spec-[a-z0-9-]+.md。
- 名称应描述 specification 内容,并以 high-level purpose 开头;该 purpose 是 [schema, tool, data, infrastructure, process, architecture, design] 之一。
- 用 well formed Markdown 格式化 specification 文件。
- 遵循给定模板,确保所有 sections 都适当填写。
- 按示例正确构造 markdown 的 front matter:title、version(可选)、date_created、last_updated(可选)、owner(可选)、tags(可选)。
- 填写 # Introduction:简短介绍 specification 及其目标。
- 填写 ## 1. Purpose & Scope:清晰简洁描述 specification 的目的和应用范围,说明目标受众和任何假设。
- 填写 ## 2. Definitions:列出并定义所有 acronyms、abbreviations 和 domain-specific terms。
- 填写 ## 3. Requirements, Constraints & Guidelines:明确列出所有 requirements、constraints、rules 和 guidelines,用 bullet points 或 tables 保持清晰。
- 在 ## 3 中使用编号:REQ-001、SEC-001、[3 LETTERS]-001、CON-001、GUD-001、PAT-001。
- 填写 ## 4. Interfaces & Data Contracts:描述 interfaces、APIs、data contracts 或 integration points;对 schemas 和 examples 使用 tables 或 code blocks。
- 填写 ## 5. Acceptance Criteria:为每个 requirement 定义清晰、可测试的 acceptance criteria,适用处使用 Given-When-Then 格式。
- 在 ## 5 中使用 AC-001:Given [context], When [action], Then [expected outcome];AC-002:The system shall [specific behavior] when [condition];AC-003:按需补充其他 acceptance criteria。
- 填写 ## 6. Test Automation Strategy:定义 testing approach、frameworks 和 automation requirements。
- 在 ## 6 中列出 Test Levels:Unit、Integration、End-to-End。
- 在 ## 6 中列出 Frameworks:MSTest、FluentAssertions、Moq(用于 .NET applications)。
- 在 ## 6 中填写 Test Data Management:说明测试数据创建和清理方法。
- 在 ## 6 中填写 CI/CD Integration:在 GitHub Actions pipelines 中自动化测试。
- 在 ## 6 中填写 Coverage Requirements:最低代码覆盖率阈值。
- 在 ## 6 中填写 Performance Testing:负载和性能测试方法。
- 填写 ## 7. Rationale & Context:解释 requirements、constraints 和 guidelines 背后的理由,并提供设计决策上下文。
- 填写 ## 8. Dependencies & External Integrations:定义外部 systems、services 和 architectural dependencies;聚焦 what 而非 how;避免具体 package 或 library 版本,除非它们代表 architectural constraints。
- 在 ## 8 中填写 External Systems:EXT-001:外部系统名称 - 用途和集成类型。
- 在 ## 8 中填写 Third-Party Services:SVC-001:服务名称 - 所需能力和 SLA 要求。
- 在 ## 8 中填写 Infrastructure Dependencies:INF-001:基础设施组件 - 要求和约束。
- 在 ## 8 中填写 Data Dependencies:DAT-001:外部数据源 - 格式、频率和访问要求。
- 在 ## 8 中填写 Technology Platform Dependencies:PLT-001:平台/运行时要求 - 版本约束和理由。
- 在 ## 8 中填写 Compliance Dependencies:COM-001:法规或合规要求 - 对实现的影响。
- 在 ## 8 中注意:聚焦 architectural 和 business dependencies,而非具体 package 实现;例如指定 “OAuth 2.0 authentication library”,而不是 “Microsoft.AspNetCore.Authentication.JwtBearer v6.0.1”。
- 填写 ## 9. Examples & Edge Cases:用 code block 提供代码片段或数据示例,展示指南的正确应用,包括 edge cases。
- 填写 ## 10. Validation Criteria:列出为符合该 specification 必须满足的标准或测试。
- 填写 ## 11. Related Specifications / Further Reading:链接相关 spec 和外部文档。
- 确保所有 sections 都填写完整,front matter 正确,文档自包含。
适用边界 · 注意事项
- 不要用于替代需求分析、架构设计或决策过程;这些尚未明确时不适合直接写规格。
- 如果只需要非正式笔记、草稿或口头说明,不需要正式规格文件时,不适合使用。
- 如果组织已有强制且不兼容的规格模板或命名约定,不应套用本模板。