create-plan

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Create Spec

创建Spec

Overview

概述

Create a living specification (Spec) for a feature by analyzing requirements, reviewing the codebase, and generating a Blueprint + Contract document that evolves with the code.
通过分析需求、审查代码库,生成随代码演进的Blueprint + Contract文档,为功能创建动态规范(Spec)。

Definitions

定义

  • {TASK_KEY}: Story/Issue ID from the issue tracker (e.g.,
    FB-6
    ,
    PROJ-123
    ,
    KAN-42
    )
  • {FEATURE_DOMAIN}: Kebab-case feature name (e.g.,
    user-authentication
    ,
    payment-processing
    ,
    notifications
    )
  • Spec Document: Living specification saved at
    specs/{FEATURE_DOMAIN}/spec.md
    • Blueprint: Context, Architecture, Anti-Patterns (the "why" and "how")
    • Contract: Definition of Done, Regression Guardrails, Scenarios (the "what")
    • Lives permanently with code, updated in same commit as behavior changes
  • Plan Document (still exists for transient task planning): Task-level implementation plan at
    .plans/{TASK_KEY}-{description}.plan.md
    • Defines Delta (what changes) vs Spec which defines State (how it works)
    • Created per-task, discarded after merge
  • Story Details: Information from issue tracker (Jira, GitHub Issues, Azure DevOps, etc.)
    • Includes title, description, acceptance criteria, and related context
  • User Story Format: Typically follows "As a [user type], I want [goal], so that [benefit]"
  • Acceptance Criteria: Specific, testable conditions that must be met for the story to be considered complete
  • {TASK_KEY}:来自问题追踪工具的故事/问题ID(例如:
    FB-6
    PROJ-123
    KAN-42
  • {FEATURE_DOMAIN}:短横线分隔式(Kebab-case)的功能名称(例如:
    user-authentication
    payment-processing
    notifications
  • Spec文档:存储在
    specs/{FEATURE_DOMAIN}/spec.md
    的动态规范
    • Blueprint:背景、架构、反模式(解释“为什么”和“如何做”)
    • Contract:完成定义、回归防护规则、场景(明确“做什么”)
    • 与代码永久共存,行为变更时需在同一提交中更新
  • 计划文档(仅用于临时任务规划):任务级实现计划,存储在
    .plans/{TASK_KEY}-{description}.plan.md
    • 定义Delta(需要变更的内容),而Spec定义State(功能的工作方式)
    • 按任务创建,合并后可丢弃
  • 故事详情:来自问题追踪工具(Jira、GitHub Issues、Azure DevOps等)的信息
    • 包含标题、描述、验收标准及相关背景
  • 用户故事格式:通常遵循“作为[用户角色],我希望[目标],以便[收益]”的结构
  • 验收标准:功能完成必须满足的具体、可测试条件

Prerequisites

前置条件

Before proceeding, verify:
  1. MCP Status Validation: Perform MCP server status checks (see
    mcp-status.md
    for detailed steps)
    • Test each configured MCP server connection (Atlassian, GitHub, etc.)
    • Verify all required integrations are authorized and operational
    • If any MCP server fails validation, STOP and report the failure. Do not proceed.
    • MCP Tool Usage Standards: MCP tool usage should follow best practices (check schema files, validate parameters, handle errors gracefully). These standards are documented in AGENTS.md §3 Operational Boundaries if AGENTS.md exists, but apply universally regardless.
  2. Story Exists: Verify the story exists in the issue tracker
    • Use MCP tools to fetch story by
      {TASK_KEY}
    • If story doesn't exist, STOP and report error: "Story {TASK_KEY} not found"
  3. Story Has Sufficient Detail: Verify story has:
    • Clear description or user story format
    • At least 3-5 acceptance criteria
    • Context about the problem being solved
    • If story lacks sufficient detail, STOP and ask user for clarification before proceeding.
  4. Determine Document Type: Decide whether to create a Spec or Plan
    • Create Spec when: New feature domain, architectural patterns, API contracts, data models, cross-team dependencies
    • Create Plan when: Bug fix, task-level implementation details, transient work
    • Both when: Feature needs permanent spec AND task needs implementation plan
    • If unclear, ask user: "Should I create a Spec (permanent) or Plan (transient)?"
开始前,请完成以下验证:
  1. MCP状态验证:执行MCP服务器状态检查(详细步骤见
    mcp-status.md
    • 测试所有已配置的MCP服务器连接(Atlassian、GitHub等)
    • 验证所有必要集成已授权且可正常运行
    • 若任何MCP服务器验证失败,立即停止并报告问题,不得继续。
    • MCP工具使用规范:MCP工具使用需遵循最佳实践(检查 schema 文件、验证参数、优雅处理错误)。这些规范记录在AGENTS.md §3 操作边界(若AGENTS.md存在),但无论该文档是否存在,规范均通用。
  2. 故事存在性验证:验证故事在问题追踪工具中存在
    • 使用MCP工具通过
      {TASK_KEY}
      获取故事
    • 若故事不存在,立即停止并报告错误:“故事 {TASK_KEY} 未找到”
  3. 故事细节完整性验证:验证故事包含:
    • 清晰的描述或用户故事格式内容
    • 至少3-5条验收标准
    • 待解决问题的背景信息
    • 若故事细节不足,立即停止并向用户请求补充信息后再继续。
  4. 确定文档类型:决定创建Spec还是计划文档
    • 创建Spec的场景:新功能领域、架构模式、API契约、数据模型、跨团队依赖
    • 创建计划文档的场景:Bug修复、任务级实现细节、临时工作
    • 两者都创建的场景:功能需要永久规范,同时任务需要实现计划
    • 若无法确定,询问用户:“我应该创建Spec(永久)还是计划文档(临时)?”

Steps

步骤

  1. Analyze story
    • Fetch story from issue tracker using MCP:
      • Use
        mcp_atlassian_getJiraIssue
        for Jira issues
      • Use
        mcp_github_issue_read
        for GitHub Issues
      • Extract: title, description, acceptance criteria, labels, priority, related issues
    • Parse user story format:
      • Identify user persona ("As a...")
      • Extract goal ("I want...")
      • Understand benefit ("so that...")
      • If not in user story format, extract requirements from description
    • Extract acceptance criteria:
      • Look for numbered lists, checkboxes, or "Given/When/Then" format
      • Convert each criterion into a testable requirement
      • If no acceptance criteria found, STOP and ask user to provide them.
    • Identify technical requirements:
      • Parse technical constraints from description
      • Note any dependencies mentioned
      • Identify performance or security requirements
    • Check for missing information:
      • Is the problem clearly defined?
      • Are acceptance criteria specific and testable? (Minimum 3-5 criteria)
      • Is the scope clear?
      • Does it follow user story format or have clear requirements?
      • If critical information is missing, STOP and ask specific questions to fill gaps.
      • Reference: See
        create-task.md
        for detailed validation criteria
    • Extract keywords for ASDLC pattern queries:
      • Parse story title and description for domain terms (nouns, technical terms)
      • Identify keywords: authentication, security, testing, review, spec, plan, etc.
      • Map keywords to ASDLC pattern search terms:
        • "authentication", "security" → search for "security", "specs", "contracts"
        • "spec", "plan" → search for "the-spec", "the-pbi", "living-specs"
        • "review", "code review" → search for "adversarial-code-review", "constitutional-review"
        • "test", "testing" → search for "behavior-driven-development", "gherkin"
      • Use story labels if available (e.g., "asdlc-alignment" → search for ASDLC patterns)
      • Store keywords for use in Step 2.5
  2. Analyze codebase
    • Use codebase_search to find similar implementations:
      • Search for similar features or patterns
      • Example: "How is file watching implemented?" or "Where is user authentication handled?"
      • Review 3-5 similar implementations to understand patterns
    • Identify affected components:
      • Use
        codebase_search
        to find related modules/components
      • Use
        grep
        to find specific patterns, functions, or classes
      • Review directory structure to understand organization
    • Review existing patterns:
      • How are similar features structured?
      • What testing patterns are used?
      • What naming conventions are followed?
      • How are errors handled?
    • Identify files to examine:
      • Main implementation files
      • Test files (look for
        *.test.ts
        ,
        *_test.py
        ,
        *Test.java
        , etc.)
      • Configuration files
      • Documentation files
    • Review related test files:
      • Understand test structure and patterns
      • Note test utilities and helpers
      • Identify test coverage expectations
    • If codebase analysis reveals blockers or unclear patterns, note them in the plan for discussion.
2.5. Query ASDLC knowledge base for relevant patterns
  • Extract keywords from story:
    • Use keywords extracted in Step 1 (domain terms mapped to ASDLC pattern categories)
    • Combine keywords into search query (space-separated or single term)
  • Query ASDLC MCP:
    • Use
      mcp_asdlc_search_knowledge_base
      with extracted keywords
    • Example: For story about "authentication", query:
      mcp_asdlc_search_knowledge_base("authentication security specs")
    • If search fails, log warning and continue (ASDLC queries are optional; don't block plan creation)
  • Filter and rank results:
    • Select 3-5 most relevant patterns based on keyword matches in title/description
    • Prefer patterns that match multiple keywords
    • Include both "Concepts" and "Patterns" from ASDLC knowledge base
    • Store pattern results: slugs, titles, descriptions
  • Optional: Fetch detailed content:
    • Use
      mcp_asdlc_get_article
      for top 1-2 patterns if detailed summaries needed
    • Only if full article content is required for plan generation
  1. Design implementation
    • For Specs: Design Blueprint + Contract structure
      • Blueprint:
        • Context: Why does this feature exist? What problem does it solve?
        • Architecture: API contracts, data models, dependencies, dependency directions
        • Anti-Patterns: What agents must NOT do (with rationale)
      • Contract:
        • Definition of Done: Observable success criteria (checkboxes)
        • Regression Guardrails: Critical invariants that must never break
        • Scenarios: Gherkin-style (Given/When/Then) behavioral specifications
    • For Plans: Design task-level implementation steps
      • Break down into subtasks (3-7 logical units)
      • Identify files to create/modify
      • Plan test strategy
      • Document dependencies
    • Identify files to create/modify:
      • List new files to create (with paths)
      • List existing files to modify (with specific changes)
      • Group by component/module
    • Plan database changes (if applicable):
      • Schema changes
      • Migration scripts
      • Data model updates
    • Design API changes (if applicable):
      • New endpoints
      • Modified endpoints
      • Request/response formats
      • Error handling
    • Plan test strategy:
      • Unit tests for each component
      • Integration tests for workflows
      • Test data requirements
      • Mock/stub requirements
    • Document dependencies:
      • External libraries needed
      • Internal dependencies
      • Order of implementation
    • Plan error handling:
      • Error scenarios to handle
      • Error messages and codes
      • Logging requirements
  2. Generate document (Spec or Plan)

    Option A: Generate Spec Document

    • Check if spec already exists:
      • Ask user for
        {FEATURE_DOMAIN}
        (kebab-case feature name)
      • Check if
        specs/{FEATURE_DOMAIN}/spec.md
        exists
      • If exists, ask: "Spec exists. Update existing or create new?"
    • Create spec directory and file:
      • Create directory:
        specs/{FEATURE_DOMAIN}/
      • Create file:
        specs/{FEATURE_DOMAIN}/spec.md
    • Write spec using Blueprint + Contract structure:
      markdown
      # Feature: {Feature Name}
      
      > **ASDLC Pattern**: [The Spec](https://asdlc.io/patterns/the-spec/)
      > **Status**: Active | Deprecated | Superseded
      > **Last Updated**: YYYY-MM-DD
      
      ---
      
      ## Blueprint
      
      ### Context
      [Why does this feature exist? What business problem does it solve?]
      
      ### Architecture
      - **API Contracts**: Endpoints, request/response formats
      - **Data Models**: Schemas, validation rules, data structures
      - **Dependencies**: What this depends on, what depends on this
      - **Dependency Directions**: Inbound/outbound relationships
      
      ### Anti-Patterns
      - [What agents must NOT do, with rationale]
      - [Forbidden approaches that were considered and rejected]
      
      ---
      
      ## Contract
      
      ### Definition of Done
      - [ ] [Observable success criterion 1]
      - [ ] [Observable success criterion 2]
      - [ ] [Observable success criterion 3]
      - [ ] [Automated verification: tests pass, lint passes, builds successfully]
      
      ### Regression Guardrails
      - [Critical invariant that must never break]
      - [Performance targets that must be maintained]
      - [Security requirements that must hold]
      
      ### Scenarios
      **Scenario: {Scenario Name}**
      - **Given**: [Precondition]
      - **When**: [Action]
      - **Then**: [Expected outcome]
      
      [Additional scenarios as needed]
    • Post spec summary to issue tracker:
      • Comment should include:
        • Link to spec file:
          specs/{FEATURE_DOMAIN}/spec.md
        • Brief summary of Blueprint (Context, Architecture)
        • Brief summary of Contract (Definition of Done, key scenarios)
      • If posting fails, note it but don't stop - spec file creation is the primary goal.

    Option B: Generate Plan Document (for transient task-level work)

    • Create plan file at
      .plans/{TASK_KEY}-{kebab-case-description}.plan.md
      :
      • First, check if file already exists (optional - for information only):
        • Use
          glob_file_search
          with pattern:
          **/.plans/{TASK_KEY}-*.plan.md
        • If files found, note them but proceed with creation (overwriting is acceptable for plan updates)
      • Use kebab-case for description (e.g.,
        PROJ-123-user-authentication.plan.md
        )
    • Write plan using the following structure:
      markdown
      # {Story Title} ({TASK_KEY})
      
      ## Story
      [User story format or description]
      
      ## Context
      [Background information, why this is needed, related issues]
      
      ## Scope
      ### In Scope
      - [What is included]
      
      ### Out of Scope
      - [What is explicitly excluded]
      
      ## Acceptance Criteria
      1. [Criterion 1]
      2. [Criterion 2]
      3. [Criterion 3]
      ...
      
      ## Technical Design
      ### Architecture
      [High-level design approach]
      
      ### Components
      - Component 1: [Description]
      - Component 2: [Description]
      
      ### Data Model
      [If applicable: database schema, data structures]
      
      ### API Design
      [If applicable: endpoints, request/response formats]
      
      ## Implementation Steps
      1. **Subtask 1**: [Description]
         - Files to create: `path/to/file1.ts`
         - Files to modify: `path/to/file2.ts`
         - Tests: `path/to/file1.test.ts`
      
      2. **Subtask 2**: [Description]
         ...
      
      ## Testing
      ### Unit Tests
      - [Test cases for component 1]
      - [Test cases for component 2]
      
      ### Integration Tests
      - [Integration test scenarios]
      
      ### Test Data
      - [Test data requirements]
      
      ## Dependencies
      - [External libraries]
      - [Internal dependencies]
      
      ## Referenced ASDLC Patterns
      
      [If ASDLC patterns were discovered during analysis (Step 2.5), include them here]
      
      The following ASDLC patterns are relevant to this implementation:
      
      - **[{Pattern Title}](https://asdlc.io/patterns/{slug}/)** - {Brief description from search results}
      - **[{Pattern Title}](https://asdlc.io/practices/{slug}/)** - {Brief description}
      
      [If no patterns found or ASDLC MCP unavailable, omit this section or note: "No ASDLC patterns identified for this task."]
      
      ## Status
      - [ ] Story analyzed
      - [ ] Codebase reviewed
      - [ ] Technical design complete
      - [ ] Implementation steps defined
      - [ ] Testing strategy defined
      - [ ] Ready for implementation
    • Verify plan file was created successfully
    • Post plan summary to issue tracker:
      • Sequence:
        1. Fetch issue to verify it exists:
          mcp_atlassian_getJiraIssue
          or
          mcp_github_issue_read
        2. Create comment with plan summary:
          mcp_atlassian_addCommentToJiraIssue
          or
          mcp_github_add_issue_comment
        3. Verify comment was posted (optional - check issue comments)
      • Comment should include:
        • Link to plan file:
          .plans/{TASK_KEY}-*.plan.md
        • Brief summary of approach
        • Key implementation steps (3-5 bullets)
      • If posting fails, note it but don't stop - plan file creation is the primary goal.
  1. 分析故事
    • 使用MCP从问题追踪工具获取故事:
      • Jira问题使用
        mcp_atlassian_getJiraIssue
      • GitHub Issues使用
        mcp_github_issue_read
      • 提取内容:标题、描述、验收标准、标签、优先级、相关问题
    • 解析用户故事格式:
      • 识别用户角色(“作为...”部分)
      • 提取目标(“我希望...”部分)
      • 理解收益(“以便...”部分)
      • 若未采用用户故事格式,从描述中提取需求
    • 提取验收标准:
      • 查找编号列表、复选框或“给定/当/则”格式的内容
      • 将每条标准转换为可测试的需求
      • 若未找到验收标准,立即停止并请求用户提供。
    • 识别技术需求:
      • 从描述中解析技术约束
      • 记录提及的所有依赖
      • 识别性能或安全需求
    • 检查缺失信息:
      • 问题定义是否清晰?
      • 验收标准是否具体且可测试?(至少3-5条)
      • 范围是否明确?
      • 是否遵循用户故事格式或包含清晰需求?
      • 若存在关键信息缺失,立即停止并提出具体问题以填补空白。
      • 参考:详细验证标准见
        create-task.md
    • 提取用于ASDLC模式查询的关键词:
      • 从故事标题和描述中解析领域术语(名词、技术术语)
      • 识别关键词:authentication、security、testing、review、spec、plan等
      • 将关键词映射到ASDLC模式搜索词:
        • "authentication"、"security" → 搜索"security"、"specs"、"contracts"
        • "spec"、"plan" → 搜索"the-spec"、"the-pbi"、"living-specs"
        • "review"、"code review" → 搜索"adversarial-code-review"、"constitutional-review"
        • "test"、"testing" → 搜索"behavior-driven-development"、"gherkin"
      • 若有故事标签,可结合使用(例如:"asdlc-alignment" → 搜索ASDLC模式)
      • 存储关键词,用于步骤2.5
  2. 分析代码库
    • 使用codebase_search查找类似实现:
      • 搜索类似功能或模式
      • 示例查询:“文件监听功能是如何实现的?”或“用户认证逻辑在哪里处理?”
      • 查看3-5个类似实现以理解现有模式
    • 识别受影响的组件:
      • 使用
        codebase_search
        查找相关模块/组件
      • 使用
        grep
        查找特定模式、函数或类
      • 查看目录结构以理解代码组织方式
    • 审查现有模式:
      • 类似功能的结构是怎样的?
      • 使用了哪些测试模式?
      • 遵循什么命名规范?
      • 错误是如何处理的?
    • 确定需要检查的文件:
      • 核心实现文件
      • 测试文件(查找
        *.test.ts
        *_test.py
        *Test.java
        等)
      • 配置文件
      • 文档文件
    • 审查相关测试文件:
      • 理解测试结构与模式
      • 记录测试工具与辅助函数
      • 明确测试覆盖率要求
    • 若代码库分析发现阻塞点或不明确的模式,需在计划中记录以供讨论。
2.5. 查询ASDLC知识库获取相关模式
  • 从故事中提取关键词:
    • 使用步骤1中提取的、映射到ASDLC模式类别的领域术语
    • 将关键词组合为搜索查询(空格分隔或单个术语)
  • 查询ASDLC MCP:
    • 使用
      mcp_asdlc_search_knowledge_base
      并传入提取的关键词
    • 示例:针对“认证”相关故事,查询:
      mcp_asdlc_search_knowledge_base("authentication security specs")
    • 若搜索失败,记录警告并继续(ASDLC查询为可选操作,不得阻塞计划创建)
  • 过滤并排序结果:
    • 根据标题/描述中的关键词匹配度,选择3-5个最相关的模式
    • 优先选择匹配多个关键词的模式
    • 同时包含ASDLC知识库中的“概念”与“模式”
    • 存储模式结果:slug、标题、描述
  • 可选:获取详细内容:
    • 若需要详细摘要用于计划生成,对排名前1-2的模式使用
      mcp_asdlc_get_article
    • 仅在需要完整文章内容时执行此操作
  1. 设计实现方案
    • 针对Spec文档:设计Blueprint + Contract结构
      • Blueprint:
        • 背景:该功能为何存在?解决了什么问题?
        • 架构:API契约、数据模型、依赖关系、依赖方向
        • 反模式:Agent绝对不能执行的操作(附理由)
      • Contract:
        • 完成定义:可观测的成功标准(复选框形式)
        • 回归防护规则:绝对不能被破坏的关键不变量
        • 场景:Gherkin风格(给定/当/则)的行为规范
    • 针对计划文档:设计任务级实现步骤
      • 拆分为3-7个逻辑子任务
      • 确定需要创建/修改的文件
      • 规划测试策略
      • 记录依赖关系
    • 确定需要创建/修改的文件:
      • 列出需创建的新文件(含路径)
      • 列出需修改的现有文件(含具体变更内容)
      • 按组件/模块分组
    • 规划数据库变更(若适用):
      • Schema变更
      • 迁移脚本
      • 数据模型更新
    • 设计API变更(若适用):
      • 新增端点
      • 修改现有端点
      • 请求/响应格式
      • 错误处理
    • 规划测试策略:
      • 每个组件的单元测试
      • 工作流的集成测试
      • 测试数据需求
      • Mock/Stub需求
    • 记录依赖关系:
      • 所需的外部库
      • 内部依赖
      • 实现顺序
    • 规划错误处理:
      • 需要处理的错误场景
      • 错误消息与代码
      • 日志要求
  2. 生成文档(Spec或计划)

    选项A:生成Spec文档

    • 检查Spec是否已存在:
      • 向用户询问
        {FEATURE_DOMAIN}
        (短横线分隔式功能名称)
      • 检查
        specs/{FEATURE_DOMAIN}/spec.md
        是否存在
      • 若已存在,询问:“Spec已存在。更新现有文档还是创建新文档?”
    • 创建Spec目录与文件:
      • 创建目录:
        specs/{FEATURE_DOMAIN}/
      • 创建文件:
        specs/{FEATURE_DOMAIN}/spec.md
    • 使用Blueprint + Contract结构编写Spec:
      markdown
      # 功能:{功能名称}
      
      > **ASDLC模式**[The Spec](https://asdlc.io/patterns/the-spec/)
      > **状态**:Active | Deprecated | Superseded
      > **最后更新**:YYYY-MM-DD
      
      ---
      
      ## Blueprint
      
      ### 背景
      [该功能为何存在?解决了什么业务问题?]
      
      ### 架构
      - **API契约**:端点、请求/响应格式
      - **数据模型**:Schema、验证规则、数据结构
      - **依赖关系**:该功能依赖的内容、依赖该功能的内容
      - **依赖方向**:入站/出站关系
      
      ### 反模式
      - [Agent绝对不能执行的操作,附理由]
      - [曾考虑但被否决的禁用方案]
      
      ---
      
      ## Contract
      
      ### 完成定义
      - [ ] [可观测的成功标准1]
      - [ ] [可观测的成功标准2]
      - [ ] [可观测的成功标准3]
      - [ ] [自动化验证:测试通过、代码检查通过、构建成功]
      
      ### 回归防护规则
      - [绝对不能被破坏的关键不变量]
      - [必须维持的性能指标]
      - [必须满足的安全需求]
      
      ### 场景
      **场景:{场景名称}**
      - **给定**:[前置条件]
      - ****:[操作]
      - ****:[预期结果]
      
      [按需添加更多场景]
    • 将Spec摘要发布到问题追踪工具:
      • 评论应包含:
        • Spec文件链接:
          specs/{FEATURE_DOMAIN}/spec.md
        • Blueprint的简要摘要(背景、架构)
        • Contract的简要摘要(完成定义、关键场景)
      • 若发布失败,记录问题但无需停止 - Spec文件创建为首要目标。

    选项B:生成计划文档(用于临时任务级工作)

    • .plans/{TASK_KEY}-{短横线分隔描述}.plan.md
      路径创建计划文件:
      • 首先,检查文件是否已存在(可选 - 仅用于信息参考):
        • 使用
          glob_file_search
          ,匹配模式:
          **/.plans/{TASK_KEY}-*.plan.md
        • 若找到文件,记录后继续创建(更新计划时可覆盖)
      • 描述部分使用短横线分隔式(例如:
        PROJ-123-user-authentication.plan.md
    • 使用以下结构编写计划:
      markdown
      # {故事标题} ({TASK_KEY})
      
      ## 故事
      [用户故事格式或描述]
      
      ## 背景
      [背景信息、需求原因、相关问题]
      
      ## 范围
      ### 包含范围
      - [包含的内容]
      
      ### 排除范围
      - [明确排除的内容]
      
      ## 验收标准
      1. [标准1]
      2. [标准2]
      3. [标准3]
      ...
      
      ## 技术设计
      ### 架构
      [高层设计方案]
      
      ### 组件
      - 组件1:[描述]
      - 组件2:[描述]
      
      ### 数据模型
      [若适用:数据库Schema、数据结构]
      
      ### API设计
      [若适用:端点、请求/响应格式]
      
      ## 实现步骤
      1. **子任务1**:[描述]
         - 需创建的文件:`path/to/file1.ts`
         - 需修改的文件:`path/to/file2.ts`
         - 测试文件:`path/to/file1.test.ts`
      
      2. **子任务2**:[描述]
         ...
      
      ## 测试
      ### 单元测试
      - [组件1的测试用例]
      - [组件2的测试用例]
      
      ### 集成测试
      - [集成测试场景]
      
      ### 测试数据
      - [测试数据需求]
      
      ## 依赖关系
      - [外部库]
      - [内部依赖]
      
      ## 参考的ASDLC模式
      
      [若在步骤2.5中发现ASDLC模式,在此处列出]
      
      以下ASDLC模式与本次实现相关:
      
      - **[{模式标题}](https://asdlc.io/patterns/{slug}/)** - {搜索结果中的简要描述}
      - **[{模式标题}](https://asdlc.io/practices/{slug}/)** - {简要描述}
      
      [若未找到模式或ASDLC MCP不可用,可省略此部分或记录:“未识别到与该任务相关的ASDLC模式。”]
      
      ## 状态
      - [ ] 故事已分析
      - [ ] 代码库已审查
      - [ ] 技术设计已完成
      - [ ] 实现步骤已定义
      - [ ] 测试策略已定义
      - [ ] 准备就绪可开始实现
    • 验证计划文件创建成功
    • 将计划摘要发布到问题追踪工具:
      • 流程:
        1. 获取问题以验证其存在:
          mcp_atlassian_getJiraIssue
          mcp_github_issue_read
        2. 创建包含计划摘要的评论:
          mcp_atlassian_addCommentToJiraIssue
          mcp_github_add_issue_comment
        3. 验证评论已发布(可选 - 检查问题评论)
      • 评论应包含:
        • 计划文件链接:
          .plans/{TASK_KEY}-*.plan.md
        • 实现方案的简要摘要
        • 关键实现步骤(3-5个要点)
      • 若发布失败,记录问题但无需停止 - 计划文件创建为首要目标。

Tools

工具

MCP Tools (Atlassian)

MCP工具(Atlassian)

  • mcp_atlassian_atlassianUserInfo
    - Verify Atlassian MCP connection
  • Obtaining CloudId for Atlassian Tools:
    • Method 1 (Recommended): Use
      mcp_atlassian_getAccessibleAtlassianResources
      • Returns list of accessible resources with
        cloudId
        values
      • Use the first result or match by site name
      • Only call if cloudId is not already known or has expired
    • Method 2: Extract from Atlassian URLs
      • Jira URL format:
        https://{site}.atlassian.net/...
      • CloudId can be extracted from the URL or obtained via API
    • Error Handling: If cloudId cannot be determined, STOP and report: "Unable to determine Atlassian cloudId. Please verify MCP configuration."
  • mcp_atlassian_getJiraIssue
    - Fetch story details by {TASK_KEY}
    • Parameters:
      cloudId
      ,
      issueIdOrKey
      = {TASK_KEY}
    • Extract: title, description, acceptance criteria, labels, priority, status
  • mcp_atlassian_getJiraIssueRemoteIssueLinks
    - Get related issues/links
    • Parameters:
      cloudId
      ,
      issueIdOrKey
      = {TASK_KEY}
  • mcp_atlassian_addCommentToJiraIssue
    - Post plan summary comment to issue
    • Parameters:
      cloudId
      ,
      issueIdOrKey
      = {TASK_KEY},
      commentBody
      = markdown summary
  • mcp_atlassian_atlassianUserInfo
    - 验证Atlassian MCP连接
  • 获取Atlassian工具的CloudId:
    • 方法1(推荐):使用
      mcp_atlassian_getAccessibleAtlassianResources
      • 返回包含
        cloudId
        值的可访问资源列表
      • 使用第一个结果或按站点名称匹配
      • 仅在cloudId未知或过期时调用
    • 方法2:从Atlassian URL中提取
      • Jira URL格式:
        https://{site}.atlassian.net/...
      • CloudId可从URL中提取或通过API获取
    • 错误处理:若无法确定cloudId,立即停止并报告:“无法确定Atlassian cloudId。请验证MCP配置。”
  • mcp_atlassian_getJiraIssue
    - 通过
    {TASK_KEY}
    获取故事详情
    • 参数:
      cloudId
      issueIdOrKey
      = {TASK_KEY}
    • 提取内容:标题、描述、验收标准、标签、优先级、状态
  • mcp_atlassian_getJiraIssueRemoteIssueLinks
    - 获取相关问题/链接
    • 参数:
      cloudId
      issueIdOrKey
      = {TASK_KEY}
  • mcp_atlassian_addCommentToJiraIssue
    - 向Jira问题发布计划摘要评论
    • 参数:
      cloudId
      issueIdOrKey
      = {TASK_KEY},
      commentBody
      = markdown格式的摘要

MCP Tools (GitHub)

MCP工具(GitHub)

  • A lightweight read-only GitHub MCP tool to verify connection (see Cursor Settings → Tools & MCP for exact names)
  • mcp_github_issue_read
    - Fetch GitHub issue details
    • Parameters:
      owner
      ,
      repo
      ,
      issue_number
      = {TASK_KEY} (if numeric)
    • Extract: title, body, labels, state
  • mcp_github_add_issue_comment
    - Post plan summary comment to GitHub issue
    • Parameters:
      owner
      ,
      repo
      ,
      issue_number
      = {TASK_KEY},
      body
      = markdown summary
  • 轻量级只读GitHub MCP工具,用于验证连接(具体名称见Cursor设置 → 工具与MCP)
  • mcp_github_issue_read
    - 获取GitHub问题详情
    • 参数:
      owner
      repo
      issue_number
      = {TASK_KEY}(若为数字)
    • 提取内容:标题、正文、标签、状态
  • mcp_github_add_issue_comment
    - 向GitHub问题发布计划摘要评论
    • 参数:
      owner
      repo
      issue_number
      = {TASK_KEY},
      body
      = markdown格式的摘要

MCP Tools (ASDLC)

MCP工具(ASDLC)

  • mcp_asdlc_search_knowledge_base
    - Search ASDLC knowledge base for patterns
    • Parameters:
      query
      = keywords extracted from story (string, space-separated or single term)
    • Returns: Array of matching articles with slug, title, description
    • Error handling: If search fails, log warning and continue without patterns (optional feature; don't block plan creation)
    • Usage: Called in Step 2.5 to discover relevant ASDLC patterns based on task domain
  • mcp_asdlc_get_article
    - Get full article content for a pattern
    • Parameters:
      slug
      = pattern identifier from search results (string)
    • Returns: Full markdown content of pattern article
    • Usage: Optional, only for top 1-2 patterns if detailed content needed for plan generation
  • mcp_asdlc_search_knowledge_base
    - 搜索ASDLC知识库获取模式
    • 参数:
      query
      = 从故事中提取的关键词(字符串,空格分隔或单个术语)
    • 返回:匹配文章数组,包含slug、标题、描述
    • 错误处理:若搜索失败,记录警告并继续,无需使用模式(可选功能,不得阻塞计划创建)
    • 用途:在步骤2.5中调用,根据任务领域发现相关ASDLC模式
  • mcp_asdlc_get_article
    - 获取模式的完整文章内容
    • 参数:
      slug
      = 搜索结果中的模式标识符(字符串)
    • 返回:模式文章的完整markdown内容
    • 用途:可选操作,仅在计划生成需要详细内容时,对排名前1-2的模式使用

Filesystem Tools

文件系统工具

  • glob_file_search
    - Check if plan file already exists
    • Pattern:
      **/.plans/{TASK_KEY}-*.plan.md
  • write
    - Create new plan document file
    • Parameters:
      file_path
      =
      .plans/{TASK_KEY}-{description}.plan.md
      ,
      contents
      = markdown plan
  • read_file
    - Read existing code files for analysis
  • list_dir
    - Explore directory structure to understand codebase organization
  • glob_file_search
    - 检查计划文件是否已存在
    • 匹配模式:
      **/.plans/{TASK_KEY}-*.plan.md
  • write
    - 创建新的计划文档
    • 参数:
      file_path
      =
      .plans/{TASK_KEY}-{description}.plan.md
      contents
      = markdown格式的计划
  • read_file
    - 读取现有代码文件用于分析
  • list_dir
    - 浏览目录结构以理解代码库组织方式

Codebase Tools

代码库工具

  • codebase_search
    - Search for similar implementations and patterns
    • Query: "How is [similar feature] implemented?"
    • Query: "Where is [component/pattern] used?"
    • Query: "How does [existing functionality] work?"
    • Use to find: similar features, existing patterns, architectural decisions
  • grep
    - Find specific patterns, functions, classes, or imports
    • Pattern: function names, class names, imports, file extensions
    • Use to find: related files, test patterns, configuration files
  • glob_file_search
    - Find files by pattern
    • Pattern:
      **/*.test.ts
      ,
      **/*_test.py
      ,
      **/*Test.java
      (test files)
    • Pattern:
      **/config.*
      ,
      **/*.config.*
      (config files)
  • codebase_search
    - 搜索类似实现与模式
    • 查询示例:“[类似功能]是如何实现的?”
    • 查询示例:“[组件/模式]在哪里使用?”
    • 查询示例:“[现有功能]的工作原理是什么?”
    • 用途:查找类似功能、现有模式、架构决策
  • grep
    - 查找特定模式、函数、类或导入语句
    • 匹配模式:函数名、类名、导入语句、文件扩展名
    • 用途:查找相关文件、测试模式、配置文件
  • glob_file_search
    - 按模式查找文件
    • 匹配模式:
      **/*.test.ts
      **/*_test.py
      **/*Test.java
      (测试文件)
    • 匹配模式:
      **/config.*
      **/*.config.*
      (配置文件)

Terminal Tools

终端工具

  • run_terminal_cmd
    - Execute commands for codebase analysis
    • find . -name "*.test.*" -type f
      - Find test files
    • git log --oneline --grep="{keyword}"
      - Search commit history for related work
    • git ls-files | grep {pattern}
      - List files matching pattern
  • run_terminal_cmd
    - 执行命令用于代码库分析
    • find . -name "*.test.*" -type f
      - 查找测试文件
    • git log --oneline --grep="{keyword}"
      - 搜索提交历史中的相关工作
    • git ls-files | grep {pattern}
      - 列出匹配模式的文件

Planning Checklist

规划检查清单

  • MCP status validation performed
  • Story fetched from issue tracker
  • Story has sufficient detail (description, acceptance criteria)
  • Document type determined (Spec vs Plan)
  • User story format parsed (or requirements extracted)
  • Acceptance criteria extracted and validated
  • Codebase searched for similar implementations
  • Existing patterns reviewed
  • Affected components identified
  • Related test files reviewed
  • If creating Spec:
    • Feature domain identified
    • Blueprint designed (Context, Architecture, Anti-Patterns)
    • Contract designed (Definition of Done, Guardrails, Scenarios)
    • Spec document created at
      specs/{FEATURE_DOMAIN}/spec.md
    • Spec summary posted to issue
  • If creating Plan:
    • Implementation broken down into subtasks
    • Files to create/modify identified
    • Database/API changes planned (if applicable)
    • Test strategy defined
    • Dependencies documented
    • Error handling planned
    • Plan document created at
      .plans/{TASK_KEY}-*.plan.md
    • Plan summary posted to issue
  • 已执行MCP状态验证
  • 已从问题追踪工具获取故事
  • 故事包含足够细节(描述、验收标准)
  • 已确定文档类型(Spec或计划)
  • 已解析用户故事格式(或提取需求)
  • 已提取并验证验收标准
  • 已搜索代码库查找类似实现
  • 已审查现有模式
  • 已识别受影响的组件
  • 已审查相关测试文件
  • 若创建Spec:
    • 已确定功能领域
    • 已设计Blueprint(背景、架构、反模式)
    • 已设计Contract(完成定义、防护规则、场景)
    • 已在
      specs/{FEATURE_DOMAIN}/spec.md
      路径创建Spec文档
    • 已向问题发布Spec摘要
  • 若创建计划:
    • 已将实现拆分为子任务
    • 已确定需创建/修改的文件
    • 已规划数据库/API变更(若适用)
    • 已定义测试策略
    • 已记录依赖关系
    • 已规划错误处理
    • 已在
      .plans/{TASK_KEY}-*.plan.md
      路径创建计划文档
    • 已向问题发布计划摘要

Document Structures

文档结构

Spec Document Structure (Permanent)

Spec文档结构(永久)

The spec document must include the following sections:
  1. Feature Header: Feature name, ASDLC pattern link, status, last updated date
  2. Blueprint Section:
    • Context: Business problem and solution rationale
    • Architecture: API contracts, data models, dependencies, dependency directions
    • Anti-Patterns: Forbidden approaches with rationale
  3. Contract Section:
    • Definition of Done: Observable, testable success criteria (checkboxes)
    • Regression Guardrails: Critical invariants that must never break
    • Scenarios: Gherkin-style (Given/When/Then) behavioral specifications
Spec文档必须包含以下部分:
  1. 功能头部:功能名称、ASDLC模式链接、状态、最后更新日期
  2. Blueprint部分:
    • 背景:业务问题与解决方案 rationale
    • 架构:API契约、数据模型、依赖关系、依赖方向
    • 反模式:禁用方案及理由
  3. Contract部分:
    • 完成定义:可观测、可测试的成功标准(复选框形式)
    • 回归防护规则:绝对不能被破坏的关键不变量
    • 场景:Gherkin风格(给定/当/则)的行为规范

Plan Document Structure (Transient)

计划文档结构(临时)

The plan document must include the following sections:
  1. Story: User story format or clear description
  2. Context: Background, motivation, related issues
  3. Scope: What's included and explicitly excluded
  4. Acceptance Criteria: Numbered, testable criteria
  5. Technical Design: Architecture, components, data model, API design
  6. Implementation Steps: Ordered subtasks with file changes
  7. Testing: Unit tests, integration tests, test data
  8. Dependencies: External and internal dependencies
  9. Status: Checklist for tracking progress
计划文档必须包含以下部分:
  1. 故事:用户故事格式或清晰描述
  2. 背景:背景信息、动机、相关问题
  3. 范围:包含与明确排除的内容
  4. 验收标准:编号的可测试标准
  5. 技术设计:架构、组件、数据模型、API设计
  6. 实现步骤:有序的子任务及文件变更
  7. 测试:单元测试、集成测试、测试数据
  8. 依赖关系:外部与内部依赖
  9. 状态:跟踪进度的检查清单

Guidance

指导说明

Role

角色定位

Act as a software engineer responsible for creating either a permanent living specification (Spec) or a transient implementation plan (Plan). You are analytical, thorough, and understand the difference between State (Spec) and Delta (Plan).
软件工程师的身份,负责创建永久的动态规范(Spec)或临时的实现计划(Plan)。需具备分析能力、严谨细致,理解State(Spec)与Delta(Plan)的区别。

Instruction

指令要求

Execute the create-spec/create-plan workflow to generate either:
  • Spec (Blueprint + Contract): Permanent living specification for a feature domain
  • Plan (Implementation Steps): Transient task-level implementation guide
This includes:
  1. Performing prerequisite validation checks
  2. Analyzing the story and extracting requirements
  3. Determining whether to create Spec or Plan (or both)
  4. Reviewing the codebase to understand patterns
  5. Designing the appropriate document structure
  6. Generating the structured document with all required sections
执行create-spec/create-plan工作流,生成以下任一文档:
  • Spec(Blueprint + Contract):功能领域的永久动态规范
  • Plan(实现步骤):任务级的临时实现指南
工作流包含:
  1. 执行前置条件验证检查
  2. 分析故事并提取需求
  3. 确定创建Spec还是计划(或两者都创建)
  4. 审查代码库以理解现有模式
  5. 设计合适的文档结构
  6. 生成包含所有必要部分的结构化文档

Context

背景信息

  • The story is tracked in an issue management system (Jira, Azure DevOps, GitHub Issues, etc.)
  • The codebase has existing patterns, conventions, and architectural decisions that should be respected
  • MCP integrations provide access to issue trackers for fetching story details
  • Specs are stored in
    specs/{FEATURE_DOMAIN}/spec.md
    and live permanently with code
  • Plans are stored in
    .plans/{TASK_KEY}-{description}.plan.md
    and are discarded after merge
  • Specs define State (how the feature works), Plans define Delta (what changes for this task)
  • Specs follow Blueprint + Contract structure per ASDLC patterns
  • The document will be used by developers and agents to implement/maintain the feature
  • ASDLC patterns: The Spec, The PBI
  • ASDLC pillars: Standardized Parts (spec/plan as State vs Delta)
  • 故事在问题管理系统(Jira、Azure DevOps、GitHub Issues等)中追踪
  • 代码库存在现有模式、规范与架构决策,需遵循
  • MCP集成提供对问题追踪工具的访问权限,用于获取故事详情
  • Spec存储在
    specs/{FEATURE_DOMAIN}/spec.md
    ,与代码永久共存
  • Plan存储在
    .plans/{TASK_KEY}-{description}.plan.md
    ,合并后可丢弃
  • Spec定义State(功能的工作方式),Plan定义Delta(本次任务需变更的内容)
  • Spec遵循ASDLC模式定义的Blueprint + Contract结构
  • 文档将供开发人员与Agent用于实现/维护功能
  • ASDLC模式The SpecThe PBI
  • ASDLC支柱标准化组件(Spec/Plan分别对应State与Delta)

Examples

示例

ASDLC: The Spec and The PBI — Specs define State; plans define Delta for a task.
Example Story Input (from Jira):
Title: Add user authentication
Description: As a user, I want to log in with OAuth2, so that I can access my account securely.

Acceptance Criteria:
1. User can log in using Google OAuth2
2. User session is maintained for 24 hours
3. Failed login attempts are logged
4. User can log out
5. Session expires after inactivity
Example Plan Document Output:
markdown
undefined
ASDLCThe SpecThe PBI — Spec定义State;计划定义任务的Delta。
示例故事输入(来自Jira):
标题:添加用户认证功能
描述:作为用户,我希望通过OAuth2登录,以便安全访问我的账户。

验收标准:
1. 用户可通过Google OAuth2登录
2. 用户会话有效期为24小时
3. 登录失败尝试将被记录
4. 用户可退出登录
5. 会话在闲置后过期
示例计划文档输出:
markdown
undefined

Add user authentication (PROJ-123)

添加用户认证功能 (PROJ-123)

Story

故事

As a user, I want to log in with OAuth2, so that I can access my account securely.
作为用户,我希望通过OAuth2登录,以便安全访问我的账户。

Context

背景

Currently, users cannot access their accounts. We need to implement OAuth2 authentication to provide secure access. This is part of the user management epic.
当前用户无法访问个人账户。我们需要实现OAuth2认证以提供安全访问,这是用户管理史诗任务的一部分。

Scope

范围

In Scope

包含范围

  • OAuth2 login with Google
  • Session management
  • Logout functionality
  • Session expiration
  • Google OAuth2登录
  • 会话管理
  • 退出登录功能
  • 会话过期

Out of Scope

排除范围

  • Password-based authentication
  • Multi-factor authentication
  • Social login providers other than Google
  • 基于密码的认证
  • 多因素认证
  • Google以外的社交登录提供商

Acceptance Criteria

验收标准

  1. User can log in using Google OAuth2
  2. User session is maintained for 24 hours
  3. Failed login attempts are logged
  4. User can log out
  5. Session expires after inactivity
  1. 用户可通过Google OAuth2登录
  2. 用户会话有效期为24小时
  3. 登录失败尝试将被记录
  4. 用户可退出登录
  5. 会话在闲置后过期

Technical Design

技术设计

Architecture

架构

  • Use OAuth2 library for authentication flow
  • Store sessions in Redis
  • Middleware for session validation
  • 使用OAuth2库处理认证流程
  • 在Redis中存储会话
  • 会话验证中间件

Components

组件

  • AuthService: Handles OAuth2 flow
  • SessionManager: Manages user sessions
  • AuthMiddleware: Validates sessions on requests
  • AuthService:处理OAuth2流程
  • SessionManager:管理用户会话
  • AuthMiddleware:验证请求会话

Data Model

数据模型

  • User table: id, email, oauth_id, created_at
  • Session table: session_id, user_id, expires_at
  • 用户表:id、email、oauth_id、created_at
  • 会话表:session_id、user_id、expires_at

Implementation Steps

实现步骤

  1. Set up OAuth2 library: Install and configure OAuth2 client
    • Files to create:
      src/auth/config.ts
    • Tests:
      src/auth/config.test.ts
  2. Implement AuthService: Create service for OAuth2 flow
    • Files to create:
      src/auth/service.ts
    • Tests:
      src/auth/service.test.ts
  3. Implement SessionManager: Create session management
    • Files to create:
      src/auth/session.ts
    • Tests:
      src/auth/session.test.ts
  4. Create AuthMiddleware: Add middleware for session validation
    • Files to create:
      src/auth/middleware.ts
    • Tests:
      src/auth/middleware.test.ts
  5. Add login/logout endpoints: Create API endpoints
    • Files to modify:
      src/routes/auth.ts
    • Tests:
      src/routes/auth.test.ts
  1. 配置OAuth2库:安装并配置OAuth2客户端
    • 需创建的文件:
      src/auth/config.ts
    • 测试文件:
      src/auth/config.test.ts
  2. 实现AuthService:创建OAuth2流程处理服务
    • 需创建的文件:
      src/auth/service.ts
    • 测试文件:
      src/auth/service.test.ts
  3. 实现SessionManager:创建会话管理模块
    • 需创建的文件:
      src/auth/session.ts
    • 测试文件:
      src/auth/session.test.ts
  4. 创建AuthMiddleware:添加会话验证中间件
    • 需创建的文件:
      src/auth/middleware.ts
    • 测试文件:
      src/auth/middleware.test.ts
  5. 添加登录/退出端点:创建API端点
    • 需修改的文件:
      src/routes/auth.ts
    • 测试文件:
      src/routes/auth.test.ts

Testing

测试

Unit Tests

单元测试

  • AuthService: OAuth2 flow, token validation
  • SessionManager: Session creation, expiration, validation
  • AuthMiddleware: Session validation, error handling
  • AuthService:OAuth2流程、令牌验证
  • SessionManager:会话创建、过期、验证
  • AuthMiddleware:会话验证、错误处理

Integration Tests

集成测试

  • Complete login flow
  • Session persistence
  • Logout flow
  • Session expiration
  • 完整登录流程
  • 会话持久化
  • 退出登录流程
  • 会话过期

Test Data

测试数据

  • Mock OAuth2 provider responses
  • Test user accounts
  • Test session data
  • Mock OAuth2提供商响应
  • 测试用户账户
  • 测试会话数据

Dependencies

依赖关系

  • oauth2-client library
  • redis client library
  • express (for middleware)
  • oauth2-client库
  • redis客户端库
  • express(用于中间件)

Status

状态

  • Story analyzed
  • Codebase reviewed
  • Technical design complete
  • Implementation steps defined
  • Testing strategy defined
  • Ready for implementation

**Example Issue Comment (Plan Summary):**
  • 故事已分析
  • 代码库已审查
  • 技术设计已完成
  • 实现步骤已定义
  • 测试策略已定义
  • 准备就绪可开始实现

**示例问题评论(计划摘要):**

Implementation Plan Created

实现计划已创建

Plan document:
.plans/PROJ-123-user-authentication.plan.md
计划文档:
.plans/PROJ-123-user-authentication.plan.md

Approach

实现方案

  • OAuth2 authentication with Google
  • Redis-based session management
  • Middleware for session validation
  • 基于Google的OAuth2认证
  • Redis会话管理
  • 会话验证中间件

Key Implementation Steps

关键实现步骤

  1. Set up OAuth2 library and configuration
  2. Implement AuthService for OAuth2 flow
  3. Create SessionManager for session handling
  4. Add AuthMiddleware for request validation
  5. Create login/logout API endpoints
  1. 配置OAuth2库与参数
  2. 实现AuthService处理OAuth2流程
  3. 创建SessionManager管理会话
  4. 添加AuthMiddleware验证请求
  5. 创建登录/退出API端点

Testing Strategy

测试策略

  • Unit tests for each component
  • Integration tests for complete flows
  • Session expiration and error handling tests
Ready for implementation.
undefined
  • 各组件的单元测试
  • 完整流程的集成测试
  • 会话过期与错误处理测试
准备就绪可开始实现。
undefined

Constraints

约束条件

Rules (Must Follow):
  1. Operational Standards Compliance: This command follows operational standards (documented in AGENTS.md if present, but apply universally):
    • MCP Tool Usage: Check schema files, validate parameters, handle errors gracefully
    • Safety Limits: Never commit secrets, API keys, or sensitive data in documents
    • AGENTS.md Optional: Commands work without AGENTS.md. Standards apply regardless of whether AGENTS.md exists.
    • See AGENTS.md §3 Operational Boundaries (if present) for detailed standards
  2. Prerequisites Must Pass: Do not proceed if MCP validation fails or story doesn't exist. STOP and report the issue.
  3. Story Validation: Story must have sufficient detail (description, 3+ acceptance criteria). If missing, STOP and ask for clarification.
  4. Document Type Decision: Determine if Spec, Plan, or both are needed. If unclear, ask user.
  5. Spec File Naming: Use format
    specs/{FEATURE_DOMAIN}/spec.md
    where {FEATURE_DOMAIN} is kebab-case
    • Feature domains are conceptual groupings (e.g.,
      user-authentication
      ,
      payment-processing
      )
    • Ask user for feature domain name if unclear
  6. Plan File Naming: Use format
    .plans/{TASK_KEY}-{kebab-case-description}.plan.md
    • Example:
      PROJ-123-user-authentication.plan.md
  7. Required Sections:
    • Spec must include: Feature header, Blueprint (Context, Architecture, Anti-Patterns), Contract (DoD, Guardrails, Scenarios)
    • Plan must include: Story, Context, Scope, Acceptance Criteria, Technical Design, Implementation Steps, Testing, Dependencies, Status
  8. Codebase Analysis: Must search for similar implementations before designing. Don't reinvent patterns that already exist.
  9. Spec vs Plan Content:
    • Spec = State (how feature works permanently)
    • Plan = Delta (what changes for this task)
    • Don't duplicate content between them
  10. Same-Commit Rule: When updating existing spec, remind user to commit spec changes with code changes
  11. File Identification: Must specify exact file paths. Use relative paths from project root.
  12. Test Strategy: Must include unit tests, integration tests, test data. Follow existing patterns.
  13. Error Handling: If analysis reveals blockers or missing information, STOP and ask specific questions.
  14. Document Summary: Post summary to issue tracker after creation. If posting fails, note it but don't fail the command.
Existing Standards (Reference):
  • MCP status validation: See
    mcp-status.md
    for detailed MCP server connection checks
  • Spec guidance: See
    specs/README.md
    for template and when to create/update specs
  • Plan file location:
    .plans/{TASK_KEY}-*.plan.md
    (referenced in
    start-task.md
    and
    complete-task.md
    )
  • Plan File Selection: If multiple files match the pattern
    .plans/{TASK_KEY}-*.plan.md
    :
    • Use the most recently modified file (check file modification time)
    • If modification time cannot be determined, use the first file found alphabetically
    • Report which file was selected: "Using plan file: {filename}"
  • Story format: User story format ("As a... I want... So that...") as used in
    create-task.md
  • File naming: Kebab-case for all filenames
  • ASDLC patterns: The Spec, The PBI, Living Specs (available via ASDLC MCP server)
必须遵循的规则:
  1. 操作标准合规:本命令遵循操作标准(若AGENTS.md存在则记录在该文档中,否则通用):
    • MCP工具使用:检查schema文件、验证参数、优雅处理错误
    • 安全限制:不得在文档中提交密钥、API密钥或敏感数据
    • AGENTS.md可选:命令无需依赖AGENTS.md即可运行,标准始终适用
    • 详细标准见AGENTS.md §3 操作边界(若存在)
  2. 前置条件必须通过:若MCP验证失败或故事不存在,不得继续,立即停止并报告问题。
  3. 故事验证:故事必须包含足够细节(描述、3条以上验收标准)。若缺失,立即停止并请求补充信息。
  4. 文档类型决策:确定需要创建Spec、计划还是两者都要。若不确定,询问用户。
  5. Spec文件命名:使用格式
    specs/{FEATURE_DOMAIN}/spec.md
    ,其中{FEATURE_DOMAIN}为短横线分隔式名称
    • 功能领域为概念性分组(例如:
      user-authentication
      payment-processing
    • 若不确定,询问用户功能领域名称
  6. 计划文件命名:使用格式
    .plans/{TASK_KEY}-{短横线分隔描述}.plan.md
    • 示例:
      PROJ-123-user-authentication.plan.md
  7. 必填部分:
    • Spec必须包含:功能头部、Blueprint(背景、架构、反模式)、Contract(完成定义、防护规则、场景)
    • 计划必须包含:故事、背景、范围、验收标准、技术设计、实现步骤、测试、依赖关系、状态
  8. 代码库分析:设计前必须搜索类似实现,不得重复发明已存在的模式。
  9. Spec与计划内容区分:
    • Spec = State(功能永久的工作方式)
    • Plan = Delta(本次任务的变更内容)
    • 不得在两者间重复内容
  10. 同提交规则:更新现有Spec时,提醒用户需将Spec变更与代码变更提交到同一提交中
  11. 文件标识:必须指定确切文件路径,使用项目根目录的相对路径。
  12. 测试策略:必须包含单元测试、集成测试、测试数据,遵循现有模式。
  13. 错误处理:若分析发现阻塞点或缺失信息,立即停止并提出具体问题。
  14. 文档摘要发布:创建后需向问题追踪工具发布摘要。若发布失败,记录问题但无需终止命令。
现有标准(参考):
  • MCP状态验证:详细的MCP服务器连接检查见
    mcp-status.md
  • Spec指导:模板与创建/更新时机见
    specs/README.md
  • 计划文件位置:
    .plans/{TASK_KEY}-*.plan.md
    (在
    start-task.md
    complete-task.md
    中引用)
  • 计划文件选择:若多个文件匹配模式
    .plans/{TASK_KEY}-*.plan.md
    :
    • 使用最近修改的文件(检查文件修改时间)
    • 若无法确定修改时间,使用按字母顺序找到的第一个文件
    • 报告所选文件:“使用计划文件:{文件名}”
  • 故事格式:用户故事格式(“作为...我希望...以便...”),见
    create-task.md
  • 文件命名:所有文件名使用短横线分隔式
  • ASDLC模式:The Spec、The PBI、Living Specs(可通过ASDLC MCP服务器获取)

Output

输出

  1. Spec Document (if creating spec): Structured markdown file at
    specs/{FEATURE_DOMAIN}/spec.md
    containing:
    • Blueprint: Context, Architecture, Anti-Patterns
    • Contract: Definition of Done, Regression Guardrails, Scenarios
    • Permanent living specification that evolves with code
  2. Plan Document (if creating plan): Structured markdown file at
    .plans/{TASK_KEY}-{description}.plan.md
    containing:
    • Story details and context
    • Technical design and architecture
    • Step-by-step implementation guide
    • Testing strategy
    • Dependencies and status tracking
    • Transient document discarded after merge
  3. Issue Comment: Summary posted to the issue tracker with:
    • Link to spec/plan file
    • Brief approach summary
    • Key sections or implementation steps
The documents should provide clear guidance for implementation while maintaining appropriate granularity (Spec = permanent contracts, Plan = transient steps).
  1. Spec文档(若创建):结构化markdown文件,路径为
    specs/{FEATURE_DOMAIN}/spec.md
    ,包含:
    • Blueprint:背景、架构、反模式
    • Contract:完成定义、回归防护规则、场景
    • 随代码演进的永久动态规范
  2. 计划文档(若创建):结构化markdown文件,路径为
    .plans/{TASK_KEY}-{description}.plan.md
    ,包含:
    • 故事详情与背景
    • 技术设计与架构
    • 分步实现指南
    • 测试策略
    • 依赖关系与进度跟踪
    • 合并后可丢弃的临时文档
  3. 问题评论:发布到问题追踪工具的摘要,包含:
    • Spec/计划文件链接
    • 实现方案的简要摘要
    • 关键部分或实现步骤
文档需为实现提供清晰指导,同时保持合适的粒度(Spec = 永久契约,Plan = 临时步骤)。",