关于 Writing Plans
Writing Plans 是一项技能,用于为缺少项目背景的工程师编写逐步实施计划。它强调明确文件与命令、测试步骤和频繁提交。
主要功能
- 01将工作拆分为 2–5 分钟步骤
- 02注明文件、测试和命令
- 03提供代码及预期结果
- 04将计划保存到 docs/plans
适用场景
- 01为陌生代码库规划功能
- 02准备测试驱动的实施步骤
- 03整理计划以便后续执行
安装
复制下面的命令,在终端中运行。
$
npx skills add https:/ / github.com/ obra/ superpowers-skills --skill writing-plans安装后在 Claude Code 中输入/writing-plans确认已加载。
详细介绍
编写计划
概述
编写全面的实施计划,假设工程师对我们的代码库一无所知,而且品味不尽如人意。记录他们需要了解的一切:每项任务要修改哪些文件、代码、测试、可能需要查阅的文档,以及如何测试。将完整计划拆分为易于完成的小任务。DRY。YAGNI。TDD。频繁提交。
假设他们是熟练的开发者,但对我们的工具集或问题领域几乎一无所知。假设他们不太了解如何设计好的测试。
开始时宣布:“我正在使用 Writing Plans 技能来创建实施计划。”
上下文: 应在专用工作树中执行(由 brainstorming 技能创建)。
将计划保存到: docs/plans/YYYY-MM-DD-<feature-name>.md
易于完成的任务粒度
每个步骤只做一件事(2-5 分钟):
- “编写失败的测试”——一个步骤
- “运行测试,确认它失败”——一个步骤
- “编写最精简的代码,让测试通过”——一个步骤
- “运行测试并确认它们通过”——一个步骤
- “提交”——一个步骤
计划文档标题
每份计划都必须以此标题开头:
# [Feature Name] Implementation Plan
> **For Claude:** Use `${SUPERPOWERS_SKILLS_ROOT}/skills/collaboration/executing-plans/SKILL.md` to implement this plan task-by-task.
**Goal:** [One sentence describing what this builds]
**Architecture:** [2-3 sentences about approach]
**Tech Stack:** [Key technologies/libraries]
---
任务结构
### Task N: [Component Name]
**Files:**
- Create: `exact/path/to/file.py`
- Modify: `exact/path/to/existing.py:123-145`
- Test: `tests/exact/path/to/test.py`
**Step 1: Write the failing test**
```python
def test_specific_behavior():
result = function(input)
assert result == expected
步骤 2:运行测试,确认它失败
运行:pytest tests/path/test.py::test_name -v
预期:失败,提示“function not defined”
步骤 3:编写最精简的实现
def function(input):
return expected
步骤 4:运行测试,确认它通过
运行:pytest tests/path/test.py::test_name -v
预期:通过
步骤 5:提交
git add tests/path/test.py src/path/file.py
git commit -m "feat: add specific feature"
## Remember
- Exact file paths always
- Complete code in plan (not "add validation")
- Exact commands with expected output
- Reference relevant skills with @ syntax
- DRY, YAGNI, TDD, frequent commits
## Execution Handoff
After saving the plan, offer execution choice:
**"Plan complete and saved to `docs/plans/<filename>.md`. Two execution options:**
**1. Subagent-Driven (this session)** - I dispatch fresh subagent per task, review between tasks, fast iteration
**2. Parallel Session (separate)** - Open new session with executing-plans, batch execution with checkpoints
**Which approach?"**
**If Subagent-Driven chosen:**
- Use skills/collaboration/subagent-driven-development
- Stay in this session
- Fresh subagent per task + code review
**If Parallel Session chosen:**
- Guide them to open new session in worktree
- New session uses skills/collaboration/executing-plans
评论
支持 Markdown