关于 writing-plans
帮助工程师为代码库编写可直接执行的实现计划。内容强调精确文件路径、完整代码、测试优先和可独立验证的小步骤。
主要功能
- 01逐项梳理需求与代码库
- 02为操作标注精确文件路径
- 03提供完整代码与验证命令
- 04按测试优先拆分短步骤
- 05检查计划完整性并交接执行
适用场景
- 01为新功能制定实施步骤
- 02把需求转成可验证的测试任务
- 03为缺少代码库背景的工程师编写计划
- 04准备交由子 Agent 或新会话执行的计划
安装
复制下面的命令,在终端中运行。
$
npx skills add https:/ / github.com/ izyanrajwani/ agent-skills-library --skill writing-plans安装后在 Claude Code 中输入/writing-plans确认已加载。
详细介绍
编写计划
概述
为不了解代码库的工程师创建实施计划。
每个计划都包含:
- 每项操作对应的确切文件路径
- 完整代码(不要写“在此添加验证”)
- 测试优先的方法及验证命令
- 颗粒度小的步骤(每步 2–5 分钟)
原则:DRY、YAGNI、TDD、频繁提交。
开始时宣布:“我将使用 writing-plans 技能来创建实施计划。”
**上下文:**在专用工作树中运行。如果没有工作树,请先使用 using-git-worktrees 技能。
计划保存到:docs/plans/YYYY-MM-DD-<feature-name>.md
编写前
- 完整阅读规格说明/需求
- 探索项目结构(
view .) - 确认技术栈(
package.json、pyproject.toml等) - 记录类似文件中的现有模式
- 检查
docs/中的现有约定
小步任务的粒度
每个步骤只做一项操作(2–5 分钟),并且可以独立验证:
- “编写失败的测试”——一个步骤
- “运行测试以确认失败”——一个步骤
- “编写最精简的代码使测试通过”——一个步骤
- “运行测试以确认通过”——一个步骤
- “提交”——一个步骤
计划文档头部
每个计划都必须以此头部开头:
# [Feature Name] Implementation Plan
**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
```
**Step 2: Run test to verify it fails**
Run: `pytest tests/path/test.py::test_name -v`
Expected: FAIL with "function not defined"
**Step 3: Write minimal implementation**
```python
def function(input):
return expected
```
**Step 4: Run test to verify it passes**
Run: `pytest tests/path/test.py::test_name -v`
Expected: PASS
**Step 5: Commit**
```bash
git add tests/path/test.py src/path/file.py
git commit -m "feat: add specific feature"
```
交接前
验证计划是否完整:
- 每个文件路径都已存在或将会创建
- 每条命令都能按原样准确运行
- 没有遗留 TODO/占位文本
- 测试覆盖规格说明中的所有验收标准
- 包含确切的测试代码,而非描述
执行交接
保存计划后,提供:
“计划已保存到 docs/plans/<filename>.md。请选择执行模式:
- 子 Agent 驱动——在同一会话中,每项任务使用一个全新的子 Agent,快速迭代
- 并行会话——开启新会话,分批执行并设置检查点
你选择哪种方式?”
如果选择子 Agent 驱动
- 留在当前会话
- 必需的子技能:
subagent-driven-development - 每项任务使用全新的子 Agent + 两阶段审查
如果选择并行会话
- 引导用户在工作树中开启新会话
- **必需的子技能:**新会话使用
executing-plans
评论
支持 Markdown