关于 writing-plans
writing-plans 是为编码 Agent 设计的实现计划编写技能,将工作拆分为小步骤,并规定文件、代码、测试和提交要求。
主要功能
- 01按 2–5 分钟动作拆分任务
- 02列出需修改和测试的文件
- 03包含代码与测试命令
- 04采用 TDD 并频繁提交
- 05提供计划执行交接选项
适用场景
- 01为低代码库经验的工程师制定实现计划
- 02将功能开发拆成可逐项执行的任务
- 03规划测试、文档检查与 Git 提交
安装
复制下面的命令,在终端中运行。
$
npx skills add https:/ / github.com/ jd-opensource/ joysafeter --skill writing-plans安装后在 Claude Code 中输入/writing-plans确认已加载。
详细介绍
编写计划
概述
编写完整的实现计划,假设工程师对我们的代码库毫无背景知识,且品味存疑。记录他们需要知道的一切:每个任务要改哪些文件、代码、测试、他们可能需要查阅的文档、如何测试。把整个计划拆解成小任务。DRY。YAGNI。TDD。频繁提交。
假设他们是熟练的开发者,但对我们的工具链或问题领域几乎一无所知。假设他们不太懂好的测试设计。
开始时宣布:“我正在使用 writing-plans 技能来创建实现计划。”
上下文: 应在专用 worktree 中运行(由 brainstorming 技能创建)。
将计划保存到:docs/plans/YYYY-MM-DD-<feature-name>.md
小任务粒度
每一步是一个操作(2-5 分钟):
- “编写失败的测试” - 步骤
- “运行它以确保失败” - 步骤
- “实现最小代码使测试通过” - 步骤
- “运行测试并确保通过” - 步骤
- “提交” - 步骤
计划文档头部
每个计划必须以这个头部开头:
# [Feature Name] Implementation Plan
> **For Claude:** REQUIRED SUB-SKILL: Use superpowers:executing-plans 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:**
- **REQUIRED SUB-SKILL:** Use superpowers: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
- **REQUIRED SUB-SKILL:** New session uses superpowers:executing-plans
评论
支持 Markdown