task
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseTask — Systematic Implementation Workflow
任务 — 系统化实现工作流
Standard 5-phase workflow for all implementation tasks with built-in quality gates.
<essential_principles>
内置质量门的所有实现任务标准5阶段工作流。
<essential_principles>
Serena Think Checkpoints (Mandatory)
Serena思考检查点(强制要求)
These three tools MUST be called at the specified points. Never skip them.
| Checkpoint | Tool | When | Purpose |
|---|---|---|---|
| Information Gate | | After Phase 1 (Investigate) and Phase 2 (Plan) | Verify sufficient information before proceeding |
| Adherence Gate | | Before each code edit in Phase 3 | Confirm still aligned with original task |
| Completion Gate | | Before exiting Phase 4 (Verify) | Confirm all work is truly complete |
必须在指定节点调用这三个工具,绝不能跳过。
| 检查点 | 工具 | 时机 | 目的 |
|---|---|---|---|
| 信息门 | | 阶段1(调查)和阶段2(计划)之后 | 继续前验证信息是否充分 |
| 合规门 | | 阶段3中每次代码编辑前 | 确认仍与原始任务对齐 |
| 完成门 | | 退出阶段4(验证)前 | 确认所有工作已真正完成 |
Introspection Markers (Always Active)
自省标记(始终启用)
Use these markers throughout all phases to make reasoning visible:
- 🤔 Reasoning — "🤔 The error suggests a missing dependency"
- 🎯 Decision — "🎯 Choosing approach A over B because..."
- ⚡ Performance — "⚡ This query may cause N+1"
- 📊 Quality — "📊 Checking consistency with existing patterns"
- 💡 Insight — "💡 This pattern can be reused for..."
在所有阶段中使用这些标记,使推理过程可见:
- 🤔 推理 — "🤔 该错误表明缺少依赖项"
- 🎯 决策 — "🎯 选择方案A而非B,原因是..."
- ⚡ 性能 — "⚡ 该查询可能导致N+1问题"
- 📊 质量 — "📊 检查与现有模式的一致性"
- 💡 洞察 — "💡 该模式可复用至..."
Safety Rules
安全规则
- Before destructive operations (delete, overwrite, reset): Always confirm with user
- Before code edits: Call
think_about_task_adherence - Never auto-commit: Phase 5 waits for user instruction to commit/push
- Quality gate required: Phase 4 must pass before Phase 5
</essential_principles>
- 执行破坏性操作前(删除、覆盖、重置):务必与用户确认
- 代码编辑前:调用
think_about_task_adherence - 禁止自动提交:阶段5需等待用户指令再执行提交/推送
- 必须通过质量门:阶段4通过后才能进入阶段5
</essential_principles>
Phase 1: Investigate
阶段1:调查
Understand the task and gather context.
- Parse task requirements from user input
- Read relevant code files (Grep, Read, Serena symbolic tools)
- Check external libraries with Context7 if needed
- Identify existing patterns and conventions
- 🔶 — Is the information sufficient?
think_about_collected_information
Tools: Grep, Read, Glob, , ,
mcp__serena__find_symbolmcp__serena__get_symbols_overviewmcp__context7__query-docs理解任务并收集上下文信息。
- 从用户输入中解析任务需求
- 阅读相关代码文件(Grep、Read、Serena符号工具)
- 必要时使用Context7检查外部库
- 识别现有模式与规范
- 🔶 — 信息是否充分?
think_about_collected_information
工具:Grep、Read、Glob、、、
mcp__serena__find_symbolmcp__serena__get_symbols_overviewmcp__context7__query-docsPhase 2: Plan
阶段2:计划
Break down the task and design the approach.
- Create task breakdown with
TodoWrite - Identify parallelizable steps:
Plan: 1) Parallel [Read A, B] → 2) Edit → 3) Parallel [Test, Lint] - Save plan to Serena Memory:
mcp__serena__write_memory("plan_<topic>", content) - 🔶 — Any gaps in the plan?
think_about_collected_information
Output: TodoWrite entries with clear acceptance criteria per step.
拆分任务并设计实现方案。
- 使用创建任务拆分清单
TodoWrite - 识别可并行的步骤:
计划:1) 并行 [读取A、B] → 2) 编辑 → 3) 并行 [测试、代码检查] - 将计划保存至Serena内存:
mcp__serena__write_memory("plan_<topic>", content) - 🔶 — 计划中是否存在遗漏?
think_about_collected_information
输出:带有清晰分步验收标准的TodoWrite条目。
Phase 3: Implement
阶段3:实现
Execute the plan with continuous adherence checks.
For each implementation step:
- Mark TodoWrite item as in-progress
- 🔶 — Still on track?
think_about_task_adherence - Edit code (Edit, Write)
- Use introspection markers (🤔🎯⚡📊💡) to explain reasoning
- Mark TodoWrite item as complete
Rules:
- No — write working code
// TODO: implement later - No mock objects outside tests
- Follow existing code patterns and conventions
- Confirm with user before destructive operations
执行计划并持续检查合规性。
对于每个实现步骤:
- 将TodoWrite项标记为进行中
- 🔶 — 是否仍在正轨?
think_about_task_adherence - 编辑代码(Edit、Write)
- 使用自省标记(🤔🎯⚡📊💡)解释推理过程
- 将TodoWrite项标记为已完成
规则:
- 禁止使用— 编写可运行的代码
// TODO: implement later - 测试外禁止使用模拟对象
- 遵循现有代码模式与规范
- 执行破坏性操作前需与用户确认
Phase 4: Verify
阶段4:验证
Run quality checks and validate correctness.
运行质量检查并验证正确性。
Standard Verification (always)
标准验证(始终执行)
Run in parallel where possible:
bash
undefined尽可能并行运行:
bash
undefinedParallel execution
并行执行
pnpm lint &
pnpm typecheck &
pnpm test &
pnpm build &
wait
If any check fails → investigate root cause → fix in Phase 3 → re-verify.pnpm lint &
pnpm typecheck &
pnpm test &
pnpm build &
wait
若任何检查失败 → 调查根本原因 → 返回阶段3修复 → 重新验证。--frontend-verify
(when flag is provided)
--frontend-verify--frontend-verify
(提供该标志时执行)
--frontend-verifyVisual verification across platforms. Auto-detect platform from :
package.json| Dependency | Platform | Preflight | Verification Tool |
|---|---|---|---|
| (default) | Web | | Claude Chrome MCP ( |
| Electron | | Electron MCP ( |
| Mobile | | iOS Simulator MCP ( |
| CLI | shell session | Shellwright MCP (TUI/CLI operation and output verification) |
Frontend Verify Workflow:
- Preflight: Start dev server / app, confirm MCP connection
- Scenario creation: Design test scenarios based on changes, save to Serena Memory
- Execute: Run each scenario, take screenshot after each step
- Judge: All pass → continue. Any fail → return to Phase 3
跨平台视觉验证。从自动检测平台:
package.json| 依赖项 | 平台 | 预检查 | 验证工具 |
|---|---|---|---|
| (默认) | Web | | Claude Chrome MCP ( |
| Electron | | Electron MCP ( |
| 移动端 | | iOS模拟器MCP ( |
| CLI | Shell会话 | Shellwright MCP(TUI/CLI操作与输出验证) |
前端验证工作流:
- 预检查:启动开发服务器/应用,确认MCP连接正常
- 场景创建:基于变更设计测试场景,保存至Serena内存
- 执行:运行每个场景,每步后截取屏幕截图
- 判定:全部通过 → 继续。任何失败 → 返回阶段3
Completion Gate
完成门
🔶 — Is everything truly complete?
think_about_whether_you_are_done🔶 — 所有工作是否真的完成?
think_about_whether_you_are_donePhase 5: Complete
阶段5:收尾
Report results and wait for user instruction.
- Present verification summary to user:
- What was changed (files, functions)
- Test results
- Screenshots (if --frontend-verify)
- Update TodoWrite — mark all items complete
- ⏸️ Wait for user instruction to commit/push
- On user confirmation:
git commit && git push
汇报结果并等待用户指令。
- 向用户展示验证总结:
- 变更内容(文件、函数)
- 测试结果
- 屏幕截图(若使用--frontend-verify)
- 更新TodoWrite — 将所有项标记为已完成
- ⏸️ 等待用户指令再执行提交/推送
- 收到用户确认后:
git commit && git push
Quick Reference
快速参考
/task fix the login button styling
/task add dark mode support --frontend-verify
/task refactor the API error handling/task fix the login button styling
/task add dark mode support --frontend-verify
/task refactor the API error handlingPhase Flow Diagram
阶段流程图
[Investigate] → 🔶 info gate
↓
[Plan] → 🔶 info gate
↓
[Implement] → 🔶 adherence gate (per edit)
↓
[Verify] → 🔶 completion gate
↓
[Complete] → ⏸️ wait for user → commit/push[调查] → 🔶 信息门
↓
[计划] → 🔶 信息门
↓
[实现] → 🔶 合规门(每次编辑前)
↓
[验证] → 🔶 完成门
↓
[收尾] → ⏸️ 等待用户 → 提交/推送