user-story-implementer
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseInstructions
说明
You are acting as an autonomous sub-agent to implement a user story or task managed via GitHub Issues, often as part of a single iteration of a task execution loop.
Your objective is to complete exactly one user story or task from the GitHub repository, verify its acceptance criteria, push the changes in a new branch, and create a Pull Request.
PREREQUISITE: The GitHub CLI () MUST be installed and fully authenticated () for this skill to function.
ghgh auth login你将作为一个自主子Agent,处理通过GitHub Issues管理的用户故事或任务,通常作为任务执行循环的单次迭代的一部分。
你的目标是完成GitHub仓库中恰好一个用户故事或任务,验证其验收标准,将更改推送到新分支,并创建一个Pull Request(PR)。
前提条件:此技能运行必须安装GitHub CLI()并完成完整身份验证()。
ghgh auth loginWorkflow
工作流程
- Identify the Next Task: Instead of reading a progress markdown file, run to grab the next available issue in creation order (lowest issue number first, matching PRD story order). Note the issue number, title, and body (which contains the Acceptance Criteria).
gh issue list --label "user-story" --limit 1 --search "sort:created-asc" - State Management: Before starting work, assign the issue to yourself (or the current user) using . This provides visibility and prevents conflicts.
gh issue edit <issue-number> --add-assignee "@me" - Branching: Follow standard Git flow. Create and checkout a new branch based on the issue number: .
git checkout -b feature/us-<issue-number> - Execute: Implement the code, configuration, or changes required to complete that single user story.
- Ensure you fulfill all of the listed Acceptance Criteria in the GitHub issue body.
- Write unit tests or perform browser verification if required.
- Update any relevant documentation.
- Important: If you cannot complete the entire story within ~2 hours of effort, or if you identify missing requirements or technical blockers during implementation, do NOT continue. Move to step 5 (Handling Blockers) instead.
- Handling Blockers: If you encounter missing requirements, ambiguity, or blockers that prevent completion, add a comment to the issue detailing the blocker using , add a
gh issue comment <issue-number> --body "<Details>"label usingblocked, and stop work on this issue.gh issue edit <issue-number> --add-label "blocked" - Self-Review: Before considering the task complete, perform this specific checklist:
- For each Acceptance Criterion listed in the issue, is there code implementing it? (Check each one individually.)
- Are there new tests? Run them locally to verify they pass.
- Do the tests exercise the core feature (not just superficial checks)?
- Do the tests cover the happy path AND relevant error cases?
- If all checkboxes pass, proceed to step 7. If any fail, return to step 4 to address gaps.
- Commit Code: Once your user story or chunk is complete, you must commit your changes to your feature branch.
- Do not use . Select files manually.
git commit -a
- Do not use
- Pull Request & Linking:
- Push the branch: .
git push -u origin HEAD - Create a Pull Request using a heredoc to ensure newlines render correctly:
Includebash
gh pr create --title "feat: <issue-title>" --body "$(cat <<'EOF' Closes #<issue-number> ### Summary <Summary of work done> EOF )"so merging the PR automatically closes the issue.Closes #<issue-number>
- Push the branch:
- 确定下一个任务:无需读取进度标记文件,运行来获取按创建顺序排列的下一个可用Issue(Issue编号最小的优先,与PRD故事顺序匹配)。记录Issue编号、标题和包含验收标准的正文内容。
gh issue list --label "user-story" --limit 1 --search "sort:created-asc" - 状态管理:开始工作前,使用将Issue分配给自己(或当前用户)。这能提升可见性并避免冲突。
gh issue edit <issue-number> --add-assignee "@me" - 分支管理:遵循标准Git流程。基于Issue编号创建并切换到新分支:。
git checkout -b feature/us-<issue-number> - 执行实现:完成该单个用户故事所需的代码、配置或更改。
- 确保满足GitHub Issue正文中列出的所有验收标准。
- 如有需要,编写单元测试或执行浏览器验证。
- 更新所有相关文档。
- 重要提示:如果你无法在约2小时内完成整个故事,或者在实现过程中发现缺失的需求或技术障碍,请不要继续。转而执行步骤5(处理障碍)。
- 处理障碍:如果遇到缺失的需求、歧义或阻碍完成的障碍,使用在Issue中添加评论说明障碍,使用
gh issue comment <issue-number> --body "<详情>"添加gh issue edit <issue-number> --add-label "blocked"标签,然后停止处理该Issue。blocked - 自我审查:在认为任务完成前,执行以下特定检查清单:
- 对于Issue中列出的每一条验收标准,是否有对应的实现代码?(逐一检查。)
- 是否编写了新的测试?在本地运行测试以验证是否通过。
- 测试是否覆盖了核心功能(而非仅表面检查)?
- 测试是否覆盖了正常流程以及相关错误场景?
- 如果所有检查项都通过,继续步骤7。如有任何未通过,返回步骤4解决问题。
- 提交代码:完成用户故事或任务块后,必须将更改提交到你的功能分支。
- 不要使用。手动选择文件。
git commit -a
- 不要使用
- Pull Request与关联:
- 推送分支:。
git push -u origin HEAD - 使用here-doc创建Pull Request以确保换行符正确显示:
包含bash
gh pr create --title "feat: <issue-title>" --body "$(cat <<'EOF' Closes #<issue-number> ### Summary <Summary of work done> EOF )",这样合并PR后会自动关闭该Issue。Closes #<issue-number>
- 推送分支:
Loop Completion Mechanism
循环完成机制
When you run and find no open issues, you must signal the end of the loop.
gh issue list --label "user-story" --limit 1 --search "sort:created-asc"If no specific marker string was provided to you by the user for this loop, print out:
[RALPH_LOOP_DONE_MARKER]CRITICAL WARNING:
- Complete exactly one user story or task per invocation. Do not attempt to complete multiple user stories.
- If all user stories are done, you MUST output the completion marker so the loop knows to stop.
当你运行且发现没有未处理的Issue时,必须发出循环结束的信号。
gh issue list --label "user-story" --limit 1 --search "sort:created-asc"如果用户未为此循环提供特定标记字符串,请输出:
[RALPH_LOOP_DONE_MARKER]重要警告:
- 每次调用仅完成恰好一个用户故事或任务。不要尝试完成多个用户故事。
- 如果所有用户故事均已完成,你必须输出完成标记,以便循环停止。
Examples
示例
Example 1:
Input: "Implement the next task"
Action:
- Run . Returns Issue #12: "Add priority selector".
gh issue list --label "user-story" --limit 1 --search "sort:created-asc" - Assign: .
gh issue edit 12 --add-assignee "@me" - Branch: .
git checkout -b feature/us-12 - Implement the feature and write tests.
- Review the code to ensure it meets Acceptance Criteria in Issue #12.
- Commit: and
git add src/components/TaskEdit.tsx.git commit -m "feat: add priority selector (US-002)" - Push: .
git push -u origin HEAD - Create PR:
bash
gh pr create --title "feat: Add priority selector" --body "$(cat <<'EOF' Closes #12 ### Summary Added priority selector to task edit. EOF )"
示例1:
输入: "实现下一个任务"
操作:
- 运行。返回Issue #12: "添加优先级选择器"。
gh issue list --label "user-story" --limit 1 --search "sort:created-asc" - 分配任务:。
gh issue edit 12 --add-assignee "@me" - 创建分支:。
git checkout -b feature/us-12 - 实现功能并编写测试。
- 审查代码以确保满足Issue #12中的验收标准。
- 提交:和
git add src/components/TaskEdit.tsx。git commit -m "feat: add priority selector (US-002)" - 推送:。
git push -u origin HEAD - 创建PR:
bash
gh pr create --title "feat: Add priority selector" --body "$(cat <<'EOF' Closes #12 ### Summary Added priority selector to task edit. EOF )"