create-pr-from-spec
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseCreate Pull Request from Specification
从规格文档创建Pull Request
Create a GitHub Pull Request for a specification using the pull_request_template.md template located at .
${workspaceFolder}/.github/pull_request_template.md使用位于的pull_request_template.md模板,为规格文档创建GitHub Pull Request。
${workspaceFolder}/.github/pull_request_template.mdOverview
概述
This skill automates the creation of GitHub Pull Requests directly from specifications. It follows a structured process:
- Analyzes the specification template requirements
- Creates a draft PR with the target branch
- Verifies no duplicate PRs exist
- Updates PR body and title with template-compliant content
- Marks PR as ready for review
- Automatically assigns to the creator
- Returns PR URL to user
Key Benefits:
- ✅ Automated PR creation from specifications
- ✅ Template-compliant PR body and title
- ✅ Duplicate PR prevention
- ✅ Auto-assignment to creator
- ✅ Streamlined spec-to-PR workflow
本技能可直接从规格文档自动创建GitHub Pull Request,遵循以下结构化流程:
- 分析规格模板要求
- 创建指向目标分支的草稿PR
- 验证不存在重复PR
- 使用符合模板要求的内容更新PR正文和标题
- 将PR标记为待审核状态
- 自动分配给创建者
- 向用户返回PR URL
核心优势:
- ✅ 从规格文档自动创建PR
- ✅ 符合模板要求的PR正文和标题
- ✅ 防止重复PR
- ✅ 自动分配给创建者
- ✅ 简化规格文档转PR的工作流
When to Use
适用场景
Use this skill when:
- Specification is ready to merge - Convert finalized spec to PR
- Need automated PR creation - Avoid manual PR drafting
- Template compliance required - Ensure PR follows pull_request_template.md
- Multiple PRs from specs - Batch process specifications into PRs
- Team collaboration - Share specs as PRs for review
Trigger phrases:
- "Create pull request from spec"
- "Convert spec to PR"
- "Open PR for specification"
- "Submit spec as pull request"
- "Automate PR creation"
在以下场景使用本技能:
- 规格文档已准备好合并 - 将定稿的规格文档转换为PR
- 需要自动创建PR - 避免手动起草PR
- 要求符合模板规范 - 确保PR遵循pull_request_template.md
- 从多个规格文档创建PR - 批量将规格文档处理为PR
- 团队协作 - 将规格文档以PR形式分享以便审核
触发短语:
- "从规格文档创建Pull Request"
- "将规格文档转换为PR"
- "为规格文档开启PR"
- "提交规格文档作为Pull Request"
- "自动创建PR"
Instructions
操作说明
Prerequisites
前提条件
Before using this skill, ensure:
- Specification file is finalized and ready for review
- Target branch is specified (e.g., ,
main)develop - exists in the repository
.github/pull_request_template.md - You have write access to create PRs
使用本技能前,请确保:
- 规格文档已定稿并准备好审核
- 指定了目标分支(例如:、
main)develop - 仓库中存在文件
.github/pull_request_template.md - 您拥有创建PR的写入权限
Step-by-Step Process
分步流程
1. Analyze specification template
- Extract requirements from
${workspaceFolder}/.github/pull_request_template.md - Use search tool to parse template sections and placeholders
2. Create pull request draft
- Use tool to create draft PR to target branch
create_pull_request - First verify no existing PR exists using to prevent duplicates
get_pull_request - If PR already exists, stop and report to user
3. Get pull request changes
- Use tool to analyze differences
get_pull_request_diff - Verify code changes are correct before updating
4. Update pull request
- Use tool to populate PR body and title
update_pull_request - Incorporate template sections from step 1
- Ensure all required fields are filled
5. Mark ready for review
- Use tool to change state from draft to ready for review
update_pull_request - Verify PR is no longer in draft mode
6. Assign pull request
- Use to retrieve current user information
get_me - Use tool to assign PR to creator
update_issue
7. Return pull request URL
- Provide user with clickable PR URL
- Include summary of PR contents
1. 分析规格模板
- 从提取要求
${workspaceFolder}/.github/pull_request_template.md - 使用搜索工具解析模板章节和占位符
2. 创建Pull Request草稿
- 使用工具创建指向目标分支的草稿PR
create_pull_request - 首先使用工具检查是否存在现有PR,以防止重复
get_pull_request - 如果PR已存在,则停止操作并向用户报告
3. 获取Pull Request变更内容
- 使用工具分析差异
get_pull_request_diff - 在更新前验证代码变更是否正确
4. 更新Pull Request
- 使用工具填充PR正文和标题
update_pull_request - 整合步骤1中的模板章节
- 确保所有必填字段已填写
5. 标记为待审核
- 使用工具将状态从草稿改为待审核
update_pull_request - 验证PR不再处于草稿模式
6. 分配Pull Request
- 使用工具获取当前用户信息
get_me - 使用工具将PR分配给创建者
update_issue
7. 返回Pull Request URL
- 向用户提供可点击的PR URL
- 包含PR内容摘要
Examples
示例
Example 1: Basic PR Creation
示例1:基础PR创建
bash
Input: Create PR from spec to main branch
Process:
1. Analyze pull_request_template.md
2. Create draft PR to main
3. Check for existing PRs
4. Update PR title: "feat: [Feature Name from Spec]"
5. Update PR body with template sections
6. Mark as ready for review
7. Assign to creator
Output: https://github.com/user/repo/pull/123bash
输入:从规格文档创建指向main分支的PR
流程:
1. 分析pull_request_template.md
2. 创建指向main的草稿PR
3. 检查是否存在现有PR
4. 更新PR标题:"feat: [来自规格文档的功能名称]"
5. 使用模板章节更新PR正文
6. 标记为待审核
7. 分配给创建者
输出:https://github.com/user/repo/pull/123Example 2: Template-Compliant PR
示例2:符合模板规范的PR
markdown
PR Title: feat: Implement user authentication system
PR Body:markdown
PR标题:feat: 实现用户认证系统
PR正文:Description
描述
Implements JWT-based authentication with token refresh mechanism
实现基于JWT的认证机制,包含令牌刷新功能
Related Issue
相关问题
Closes #456
关闭 #456
Changes
变更内容
- Added JWT middleware
- Implemented token validation
- Added refresh token endpoint
- 添加JWT中间件
- 实现令牌验证
- 添加刷新令牌端点
Testing
测试
- Unit tests for auth middleware
- Integration tests for token endpoints
- 认证中间件的单元测试
- 令牌端点的集成测试
Checklist
检查清单
- Tests pass
- Documentation updated
- No breaking changes
undefined- 测试通过
- 文档已更新
- 无破坏性变更
undefinedExample 3: Duplicate Prevention
示例3:重复PR预防
bash
Input: Create PR from spec
Check: PR for current branch already exists?
→ Yes: Report error, don't create duplicate
→ No: Proceed with PR creation
Output: "PR already exists at https://github.com/user/repo/pull/789"bash
输入:从规格文档创建PR
检查:当前分支是否已存在PR?
→ 是:报告错误,不创建重复PR
→ 否:继续创建PR
输出:"PR已存在,链接为https://github.com/user/repo/pull/789"Requirements
要求
- Single pull request for the complete specification
- Clear title and body identifying the specification/feature
- Pull request body follows pull_request_template.md structure
- Verification that no duplicate pull requests exist
- PR automatically assigned to creator
- No draft PRs left behind
- 为完整的规格文档创建单个Pull Request
- 清晰的标题和正文,明确标识规格文档/功能
- Pull Request正文遵循pull_request_template.md结构
- 验证不存在重复的Pull Request
- PR自动分配给创建者
- 不遗留草稿PR
Success Criteria
成功标准
- ✅ PR created without errors
- ✅ PR body follows pull_request_template.md structure
- ✅ PR title clearly identifies the specification/feature
- ✅ No duplicate PRs exist for the branch
- ✅ PR assigned to creator
- ✅ PR URL returned to user
- ✅ PR is ready for review (not in draft)
- ✅ PR创建无错误
- ✅ PR正文遵循pull_request_template.md结构
- ✅ PR标题清晰标识规格文档/功能
- ✅ 该分支不存在重复PR
- ✅ PR已分配给创建者
- ✅ 向用户返回PR URL
- ✅ PR处于待审核状态(非草稿)
Constraints and Warnings
约束与警告
⚠️ Important:
- PR creation requires write access to repository
- Target branch must exist before PR creation
- Template file must exist at
.github/pull_request_template.md - Cannot create PR without valid branch target
- Duplicate PRs will be detected and rejected
- PR assignment requires valid GitHub user
🚫 Limitations:
- Does not perform code review automatically
- Does not trigger CI/CD pipelines
- Does not merge PRs automatically
- Cannot modify existing code, only PR metadata
⚠️ 重要提示:
- 创建PR需要仓库的写入权限
- 创建PR前目标分支必须存在
- 模板文件必须位于
.github/pull_request_template.md - 无有效目标分支则无法创建PR
- 会检测并拒绝重复PR
- PR分配需要有效的GitHub用户
🚫 限制:
- 不会自动执行代码审核
- 不会触发CI/CD流水线
- 不会自动合并PR
- 仅能修改PR元数据,无法修改现有代码
Best Practices
最佳实践
- Verify before creating - Always review specification before converting to PR
- Use descriptive titles - PR titles should clearly indicate feature/fix purpose
- Complete template - Ensure all required template sections are filled
- Link related issues - Include issue references in PR body
- Test first - Ensure all tests pass before creating PR
- Team review - Get team approval before marking ready for review
- Clean git history - Ensure commits are clean and well-documented
- 创建前验证 - 转换为PR前务必审核规格文档
- 使用描述性标题 - PR标题应清晰说明功能/修复的用途
- 完成模板 - 确保填写所有必填模板章节
- 关联相关问题 - 在PR正文中包含问题引用
- 先测试 - 创建PR前确保所有测试通过
- 团队审核 - 标记为待审核前获得团队批准
- 清理Git历史 - 确保提交记录清晰且文档完善
Tools Used
使用的工具
- - Analyze specification template requirements
search - - Create new PR in draft mode
create_pull_request - - Check for existing PRs before creation
get_pull_request - - Analyze PR changes
get_pull_request_diff - - Update PR title, body, and state
update_pull_request - - Assign PR to creator
update_issue - - Retrieve current user information
get_me
- - 分析规格模板要求
search - - 创建草稿模式的新PR
create_pull_request - - 创建前检查是否存在现有PR
get_pull_request - - 分析PR变更内容
get_pull_request_diff - - 更新PR标题、正文和状态
update_pull_request - - 将PR分配给创建者
update_issue - - 获取当前用户信息
get_me