implement
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseImplement a feature by reading all prepared context, then propose to commit, push, and create a PR.
通过阅读所有准备好的上下文信息实现功能,然后提议进行提交、推送代码并创建PR。
Steps
步骤
-
Resolve the issue — the argument can be:
- A GitHub issue number or URL → fetch with
gh issue view - A description → search with to find the matching issue
gh issue list --search "<description>" - Nothing → ask the user what to implement
- A GitHub issue number or URL → fetch with
-
Read all available context:
- Specs in related to the feature
doc/spec/ - ADRs in related to the feature
doc/adr/ - Docs in related to the feature
doc/ - Existing code and tests in the affected areas
- Specs in
-
Implement the feature based on the gathered context:
- Follow specs as acceptance criteria
- Respect architectural decisions from ADRs
- Match existing code style and patterns
-
When implementation is complete, propose to the user:
- Stage and commit the changes
- Push the branch
- Create a PR linking the issue
-
If the user agrees:
- Stage relevant files — prefer over
git add <file>...git add -A - Do NOT stage files that look like secrets (, credentials, tokens)
.env - Extract the issue number from the current branch name (e.g. →
42-add-export)#42 - Commit with message:
#<number> <imperative summary> - Push with
git push -u origin <branch> - Create PR with :
gh pr create- Title: imperative, under 70 chars
- Body includes "Closes #<number>" to auto-link the issue
- Show the PR URL when done
- Stage relevant files — prefer
-
处理需求工单——参数可以是:
- GitHub issue编号或URL → 使用获取详情
gh issue view - 描述内容 → 使用查找匹配的工单
gh issue list --search "<description>" - 无参数 → 询问用户需要实现什么功能
- GitHub issue编号或URL → 使用
-
阅读所有可用的上下文信息:
- 与该功能相关的目录下的规格文档
doc/spec/ - 与该功能相关的目录下的架构决策记录(ADRs)
doc/adr/ - 与该功能相关的目录下的说明文档
doc/ - 受影响区域的现有代码和测试用例
- 与该功能相关的
-
根据收集到的上下文实现功能:
- 将规格文档作为验收标准
- 遵循ADRs中的架构决策
- 匹配现有代码的风格和模式
-
功能实现完成后,向用户提议:
- 暂存并提交更改
- 推送分支代码
- 创建关联该工单的PR
-
如果用户同意:
- 暂存相关文件——优先使用而非
git add <file>...git add -A - 不要暂存看起来像敏感信息的文件(如、凭证、令牌)
.env - 从当前分支名称中提取工单编号(例如→
42-add-export)#42 - 提交信息格式:
#<number> <祈使语气的摘要> - 使用推送代码
git push -u origin <branch> - 使用创建PR:
gh pr create- 标题:祈使语气,长度不超过70个字符
- 正文包含“Closes #<number>”以自动关联工单
- 完成后展示PR的URL
- 暂存相关文件——优先使用
Rules
规则
- Always ask before committing, pushing, or creating a PR
- Do NOT push or create a PR without explicit user approval
- Follow commit message convention:
#<number> <imperative summary> - If there are no changes to commit, tell the user
- 在提交、推送或创建PR前务必询问用户
- 未经用户明确批准,不得推送代码或创建PR
- 遵循提交信息规范:
#<number> <祈使语气的摘要> - 如果没有需要提交的更改,告知用户