linear-issue-workflow
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseLinear Issue Workflow
Linear 需求单工作流
Use this skill when implementing features or fixes tracked in Linear.
当你需要实现Linear中跟踪的功能或修复问题时,可以使用本技能。
Phase 1: Understand the Issue
阶段1:理解需求单
Fetch the Linear issue using the subagent:
linearTask(subagent_type="linear", prompt="Fetch issue <ISSUE-ID> including title, description, status, and acceptance criteria")Ask the user clarifying questions if the scope is unclear before proceeding.
使用子代理获取Linear需求单:
linearTask(subagent_type="linear", prompt="Fetch issue <ISSUE-ID> including title, description, status, and acceptance criteria")在开始前,如果需求范围不明确,请向用户询问澄清问题。
Phase 2: Explore and Plan
阶段2:探索与规划
-
Use thesubagent to understand the codebase:
explore- Where changes need to be made
- Existing patterns to follow
- Related code that might be affected
-
Create an implementation plan covering:
- Files to modify
- New functions/types to add
- Tests to write
-
Present the plan to the user and ask if they would like any changes before proceeding. Do not start implementation until the user approves the plan.
-
Optionally attach the plan to the Linear issue:
Task(subagent_type="linear", prompt="Attach this implementation plan as a document to <ISSUE-ID>: <plan>") -
Mark the issue as "In Progress":
Task(subagent_type="linear", prompt="Update issue <ISSUE-ID> status to In Progress")
-
使用子代理了解代码库:
explore- 需要修改的位置
- 需遵循的现有代码模式
- 可能受影响的相关代码
-
创建实现计划,涵盖:
- 要修改的文件
- 要新增的函数/类型
- 要编写的测试用例
-
将计划提交给用户,询问是否需要修改。在用户批准计划前,不要开始实现。
-
(可选)将计划附加到Linear需求单中:
Task(subagent_type="linear", prompt="Attach this implementation plan as a document to <ISSUE-ID>: <plan>") -
将需求单状态标记为"进行中":
Task(subagent_type="linear", prompt="Update issue <ISSUE-ID> status to In Progress")
Phase 3: Set Up Worktree
阶段3:设置工作树
Get the branch name from Linear:
Task(subagent_type="linear", prompt="Get the git branch name for issue <ISSUE-ID>")Determine the repository's default branch:
bash
git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remotes/origin/@@'Fetch the latest changes and create a worktree based on the remote default branch:
bash
git fetch origin
git worktree add ../worktree/<branch-name> -b <branch-name> origin/<default-branch>Important: Always base new branches on (where is , , or whatever the repository uses). This ensures your branch starts from the latest remote state, even if your local default branch is out of date.
origin/<default-branch><default-branch>mainmasterAfter creating the worktree:
bash
cd ../worktree/<branch-name>Then install local dependencies (look at developer documentation for how to do this).
Worktrees share the directory but have their own working directory. The directory is NOT shared, so each worktree needs its own dependency installation.
.gitnode_modulesAll subsequent work happens in the worktree directory.
从Linear获取分支名称:
Task(subagent_type="linear", prompt="Get the git branch name for issue <ISSUE-ID>")确定仓库的默认分支:
bash
git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remotes/origin/@@'获取最新变更并基于远程默认分支创建工作树:
bash
git fetch origin
git worktree add ../worktree/<branch-name> -b <branch-name> origin/<default-branch>重要提示:始终基于创建新分支(可以是、或仓库使用的其他默认分支)。这样可以确保你的分支从最新的远程状态开始,即使本地默认分支已过时。
origin/<default-branch><default-branch>mainmaster创建工作树后:
bash
cd ../worktree/<branch-name>然后安装本地依赖(请参考开发者文档了解具体安装方式)。
工作树共享目录,但有自己的工作目录。目录不会共享,因此每个工作树都需要单独安装依赖。
.gitnode_modules所有后续工作都在工作树目录中进行。
Phase 4: Implement
阶段4:实现
- Use to track implementation tasks
TodoWrite - Implement changes, marking todos as complete as you go
- Write tests for new functionality
- Run the project's build/verification command
- 使用跟踪实现任务
TodoWrite - 进行代码变更,完成任务后标记为已完成
- 为新功能编写测试用例
- 运行项目的构建/验证命令
Phase 5: Verify
阶段5:验证
If the changes affect critical paths or integration points, run the project's test suite or integration tests as appropriate for the changes made.
如果变更影响关键路径或集成点,请根据变更内容运行项目的测试套件或集成测试。
Phase 6: Commit and PR
阶段6:提交与创建PR
Squash commits if needed
(可选)压缩提交
If you made multiple commits that should be one:
bash
git reset --soft HEAD~<n> && git commit -m "<message>"如果你进行了多个可合并为一个的提交:
bash
git reset --soft HEAD~<n> && git commit -m "<message>"Self-review
自审
Before pushing, load the skill and perform a self-review of your changes. If serious issues are found that would prohibit merging, fix them before proceeding. Do not push until the review passes.
code-reviewAfter the review passes, ask the user for confirmation before pushing and creating the PR.
推送前,加载技能并对自己的变更进行自审。如果发现会阻止合并的严重问题,先修复再继续。在审核通过前不要推送。
code-review审核通过后,在推送和创建PR前请向用户确认。
Post review to PR
将审核结果发布到PR
After creating the PR, post a summary of the code review as a comment:
bash
gh pr comment <PR-NUMBER> --body "$(cat <<'EOF'创建PR后,将代码审核摘要作为评论发布:
bash
gh pr comment <PR-NUMBER> --body "$(cat <<'EOF'Self-Review Summary
自审摘要
<summary of what was reviewed and any issues found/fixed>
<审核内容总结及发现/修复的问题>
Files Reviewed
已审核文件
- : <brief assessment>
path/to/file.ts
- : <简要评估>
path/to/file.ts
Issues Found and Resolved
发现并解决的问题
<list any issues found during self-review and how they were fixed, or "None">
EOF
)"
undefined<列出自审中发现的问题及解决方式,若无则写"无">
EOF
)"
undefinedPush and create PR
推送并创建PR
Fetch the latest changes and rebase before pushing:
bash
git fetch origin
git rebase origin/<default-branch>Verify the build still passes after rebasing, then push:
bash
git push -u origin <branch-name>Create the PR:
bash
gh pr create \
--title "<title>" \
--reviewer <REVIEWER> \
--body "$(cat <<'EOF'获取最新变更并在推送前变基:
bash
git fetch origin
git rebase origin/<default-branch>变基后验证构建是否仍能通过,然后推送:
bash
git push -u origin <branch-name>创建PR:
bash
gh pr create \
--title "<title>" \
--reviewer <REVIEWER> \
--body "$(cat <<'EOF'Summary
摘要
<1-3 bullet points>
<1-3个要点>
Changes
变更内容
- : <what changed>
path/to/file.ts
- : <变更说明>
path/to/file.ts
Testing
测试情况
<how it was tested>
Closes <ISSUE-ID>
EOF
)"
undefined<测试方式>
Closes <ISSUE-ID>
EOF
)"
undefinedPhase 7: Cleanup After Merge
阶段7:合并后的清理
After the PR has been merged, clean up the worktree and local branch:
bash
undefinedPR合并后,清理工作树和本地分支:
bash
undefinedFrom the main repository directory (not the worktree)
从主仓库目录(非工作树目录)执行
git fetch origin
git worktree remove ../worktree/<branch-name>
git branch -d <branch-name>
If the worktree directory was already manually deleted, prune stale worktree references:
```bash
git worktree prunegit fetch origin
git worktree remove ../worktree/<branch-name>
git branch -d <branch-name>
如果工作树目录已被手动删除,请清理过期的工作树引用:
```bash
git worktree pruneLinear Subagent Patterns
Linear子代理使用模式
Common operations:
| Action | Prompt |
|---|---|
| Fetch issue | |
| Get branch name | |
| Update status | |
| Attach document | |
| Add comment | |
Always use when calling the Task tool for Linear operations.
subagent_type="linear"常见操作:
| 操作 | 提示语 |
|---|---|
| 获取需求单 | |
| 获取分支名称 | |
| 更新状态 | |
| 附加文档 | |
| 添加评论 | |
使用Task工具执行Linear操作时,始终指定。
subagent_type="linear"