Communitygithub.com

写作计划

当您有多步骤任务的规格或需求时使用,在接触代码之前。

写作计划 是什么?

该技能用于生成详细的实现计划,供不熟悉代码库或规格的工程师使用。它强调将任务分解为独立、可测试的步骤,并明确记录关键决策:哪些文件、哪些名称与签名、哪些规格值、哪些测试验证每个任务。技能要求每个步骤都是一项可检查的动作(如编写失败的测试、运行测试、实现代码、提交),并强制每个计划文档包含标准头部,包括目标、架构、技术栈、全局约束和审查重点。最终输出应保存为 `docs/superpowers/plans/YYYY-MM-DD-<feature-name>.md`,并在计划完成后提供执行方法的选择(子代理驱动或原生执行),附有具体的交接提示。

兼容平台~Claude Code~Codex CLI~Cursor✓Antigravity
npx skills add https://github.com/alfathafp/portofolio-web-design/tree/HEAD/.agents/skills/writing-plans

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

写作计划 是做什么的?

概览

为未接触过此代码库或此规格的工程师编写实现计划。假设他们一旦知道确切的接口和确切的测试,就会用项目语言编写惯用代码,并会在计划留白处做出合理选择。他们无法知道的是你的决定:哪些文件、哪些名称和签名、规格中的哪些值、哪些测试证明每个任务。记录这些。将整个计划作为可一口一口消化的任务提供给他们。DRY。YAGNI。TDD。频繁提交。

开始时宣布: “我正在使用写作计划技能来创建实现计划。”

上下文: 如果在隔离的工作树中工作,则应在执行时通过 superpowers:using-git-worktrees 技能创建它。

保存计划到: docs/superpowers/plans/YYYY-MM-DD-<feature-name>.md

  • (用户对计划位置的偏好会覆盖此默认值)

范围检查

如果规格涵盖多个独立的子系统,则在头脑风暴期间应已将其分解为子项目规格。如果没有,建议将其拆分为单独的计划——每个子系统一个。每个计划应能独立产出可工作、可测试的软件。

文件结构

在定义任务之前,规划哪些文件将被创建或修改,以及每个文件负责什么。这是分解决策被锁定的地方。

  • 设计具有清晰边界和良好定义接口的单元。每个文件应有一个明确的职责。
  • 你最擅长推理能一次性放在上下文中的代码,当文件专注时,你的编辑更可靠。优先选择更小、更专注的文件,而不是做太多事的大文件。
  • 一起变更的文件应放在一起。按职责拆分,而不是按技术层。
  • 在现有代码库中,遵循既定模式。如果代码库使用大文件,不要单方面重构——但如果你正在修改的文件变得臃肿,在计划中包含拆分是合理的。

此结构为任务分解提供依据。每个任务应产生独立的、有意义的变更。

任务合理大小

任务是最小的、拥有自己的测试周期并值得审阅者一到检查的单元。划定任务边界时:将设置、配置、脚手架和文档步骤折叠到需要它们的任务可交付成果中;仅在审阅者可以有意义地拒绝一个任务而批准其相邻任务时才拆分。每个任务以一个独立可测试的可交付成果结束。

步骤粒度

每个步骤是一个动作,带有可检查的结果:

  • “编写失败的测试” - 步骤
  • “运行测试以确保其失败” - 步骤
  • “实现使测试通过的最小代码” - 步骤
  • “运行测试并确保通过” - 步骤
  • “提交” - 步骤

计划文档头部

每个计划必须以这个头部开始:

# [功能名称] 实现计划

> **代理工作者注意:** 必选子技能:使用 superpowers:subagent-driven-development(推荐)或 superpowers:executing-plans 来逐任务实施此计划。步骤使用复选框 (`- [ ]`) 语法进行跟踪。

**目标:** [一句话描述本次构建的内容]

**架构:** [2-3 句话描述方法]

**技术栈:** [关键技术/库]

**规格:** [此计划实现的规格/设计文档的路径——计划依据规格推理论证,因此规格随计划一起提供;执行者需阅读两者]

## 全局约束

[规格中项目范围的要求——版本下限、依赖限制、命名和复制规则、平台要求——每行一个,附有从规格逐字复制到的确切值。每个任务的要求隐式包含此部分。]

## 审查重点

[规格暗示但没有任何任务的测试能够覆盖的五种输入类别或故障模式,且最有可能给使用此软件的人造成麻烦——每行一个,命名输入或条件以及理性人会期望的行为,最可能的最先列出。规格是一个愿景文档:它说明软件必须做什么,而非它将遇到的一切,它对某个输入的沉默并不意味着该输入可以破坏程序。在此处一次性列出,规格放在面前。然后,对于每一行,将固定它的测试添加到拥有该代码的任务中,以该任务自身的步骤风格。]

---

任务结构

### 任务 N: [组件名称]

**文件:**
- 创建:`确切/路径/到/文件.py`
- 修改:`确切/路径/到/现有文件.py:123-145`
- 测试:`tests/确切/路径/到/测试.py`

**接口:**
- 消费: [此任务使用自先前任务的内容——确切的签名]
- 产出: [后续任务依赖的内容——确切的函数名称、参数和返回类型。任务的执行者仅看到自己的任务;此块是他们了解相邻任务使用的名称和类型的方式。]

- [ ] **步骤 1: 编写失败的测试**

```python
def test_specific_behavior():
    result = function(input)
    assert result == expected
```

- [ ] **步骤 2: 运行测试以验证其失败**

运行:`pytest tests/path/test.py::test_name -v`
预期:FAIL,显示“function not defined”

- [ ] **步骤 3: 在 `确切/路径/到/文件.py` 中实现 `function(input: InputType) -> ResultType`**

当签名和测试留有选择时,一行说明方法(哪个库调用、哪个数据结构);仅当算法不确定时才提供代码块。

- [ ] **步骤 4: 运行测试以验证其通过**

运行:`pytest tests/path/test.py::test_name -v`
预期:PASS

- [ ] **步骤 5: 提交**

```bash
git add tests/path/test.py src/path/file.py
git commit -m "feat: add specific feature"
```

步骤包含什么

一个步骤完成时,执行者可以从中写出确切的一件合理的事情。这就是全部要求:无歧义,而非完整。每种步骤只包含使其无歧义所需的内容:

  • 测试步骤: 测试的名称及其断言,以代码形式出现,包含规格中的确切值。
  • 代码步骤: 确切的签名(名称、参数、返回类型)、其所在文件,以及规格固定的具体值。执行者编写主体。仅当签名和测试无法决定算法,或规格固定了确切副本时,才出现主体。
  • 验证步骤: 要运行的命令和表示通过的输出。
  • 对另一个任务的引用: 该任务的接口块说明要使用什么;计划不重复该任务的代码。

计划是执行者无法单独做出的一系列决策。一个比其描述的代码还长的计划已经是在编写代码。不决定任何事情的语句(“待定”、“处理边缘情况”、“添加适当的验证”、“为上述内容编写测试”、没有任务定义的类型或函数)是相反的错误,自我审查会发现两者。

自我审查

编写完完整计划后,用全新的眼光查看规格,并检查计划是否与规格一致。这是您自己运行的检查清单——不是子代理调度。

1. 规格覆盖范围: 快速浏览规格中的每个部分/需求。您能否指出实现了该需求的任务?列出任何差距。

2. 步骤扫描: 每个步骤必须让执行者写出确切的一件合理的事情,并且没有步骤可以承载更多内容:不决定任何事情的语句是差距,而签名和测试已确定的函数主体是转录。修复两者。

3. 类型一致性: 您在后续任务中使用的类型、方法签名和属性名称是否与先前任务中定义的匹配?在任务 3 中称为 clearLayers() 但在任务 7 中称为 clearFullLayers() 的函数是一个错误。

4. 审查重点: 对于规格暗示的每个输入类别或故障模式,是否有任务的测试涉及它?最有可能给用户造成麻烦的五个未覆盖项放在审查重点部分,并且那里的每一行都会将其测试添加到所属任务。空部分意味着您检查过并未发现,而不是您跳过了检查。

5. 比例: 将计划的长度与规格的长度进行比较。一个比其实现的规格长几倍的计划就是程序的转录,而不是计划。如果代码块占据了文档的大部分,请用签名、测试名称和断言替换主体,并检查每个步骤是否仍然无歧义。

如果您发现问题,请直接修复。无需重新审查——只需修复并继续。如果您发现规格需求没有对应的任务,请添加该任务。

执行交接

在保存并自我审查计划后,请将其链接给人类合作伙伴阅读。如果他们已明确提供执行方法,请他们审查计划并确认它捕捉到了他们想要的内容;等待审查后再实施,然后使用保留的方法。否则,请他们审查计划并在实施前选择执行方法。

当尚未提供执行方法时:

“计划已完成并保存到 docs/superpowers/plans/<文件名>.md。请审查计划。您更倾向于哪种执行方式?

  • 子代理驱动 - 每个任务由一个新的子代理实施,并且在新任务开始前由一个新的审查者检查,最后进行全分支审查。最彻底;每个任务和每个审查都需要一个新上下文。
  • 原生 - 我在此会话中亲自实施每个任务,按照此框架运行工作的方式,然后让最强大模型上的一个新审查者检查整个分支。最便宜和最快;直到最后都没有独立的审查。与中等规模的会话模型配合良好,因为计划承载了设计。

对于此计划,我推荐 <两者之一>,因为 <计划中的一句话:任务彼此之间接口的依赖程度、有多少个任务、一个已交付的错误会带来什么代价>。计划是否捕捉到了您想要的内容,我们应该使用哪种方法?”

当已提供执行方法时:

“计划已完成并保存到 docs/superpowers/plans/<文件名>.md。请审查计划。它是否捕捉到了您想要的内容?”

如果选择子代理驱动:

  • 必选子技能: 使用 superpowers:subagent-driven-development

如果选择原生:

  • 必选子技能: 使用 superpowers:executing-plans

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

alfathafp/portofolio-web-design

You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation).

alfathafp/portofolio-web-design

Tests in real browsers via Chrome DevTools MCP. Use when building or debugging anything that runs in a browser. Use when you need to inspect the DOM, capture console errors, analyze network requests, profile performance, or verify visual output with real runtime data. Requires the chrome-devtools MCP server to be configured.

alfathafp/portofolio-web-design

Automates CI/CD pipeline setup. Use when setting up or modifying build and deployment pipelines. Use when you need to automate quality gates, configure test runners in CI, or establish deployment strategies.

alfathafp/portofolio-web-design

Conducts multi-axis code review. Use before merging any change. Use when reviewing code written by yourself, another agent, or a human. Use when you need to assess code quality across multiple dimensions before it enters the main branch. Use when asked to review a diff or a pull request, even when the diff is pasted inline.

alfathafp/portofolio-web-design

Simplifies code for clarity. Use when refactoring code for clarity without changing behavior. Use when code works but is harder to read, maintain, or extend than it should be. Use when reviewing code that has accumulated unnecessary complexity.

alfathafp/portofolio-web-design

Establishes a project's quality bar as a written contract and stops agents quietly lowering it. Interviews the user on which dimensions matter, supplies sane default thresholds when they have no number in mind, records everything in CONSTRAINTS.md, and watches the diff for a weakened bar — new @ts-ignore or eslint-disable suppressions, skipped or deleted tests, assertions stripped out, unimplemented stubs, thresholds edited down. Use when no quality bar is written down, when the user says "set up constraints" or "define our standards", when the user wants dimensions they care about — accessibility, web performance, coverage — set up as enforced constraints, when an agent keeps silencing checks or skipping tests to get to green, when you need a coverage or performance threshold and don't know what number to pick, or when an agent writes more code than anyone will read.

alfathafp/portofolio-web-design

Optimizes agent context setup. Use when starting a new session, when agent output quality degrades, when switching between tasks, or when you need to configure rules files and context for a project.

alfathafp/portofolio-web-design

Guides systematic root-cause debugging. Use when tests fail, builds break, something that worked yesterday broke, behavior doesn't match expectations, or you encounter any unexpected error. Use when you need to figure out what broke and why — a systematic approach to finding and fixing the root cause rather than guessing.

alfathafp/portofolio-web-design

Deploy applications and websites to Vercel. Use when the user requests deployment actions like "deploy my app", "deploy and give me the link", "push this live", or "create a preview deployment".

alfathafp/portofolio-web-design

Manages deprecation and migration. Use when removing old systems, APIs, or features. Use when migrating users from one implementation to another. Use when migrating a database schema in production, such as renaming or dropping a column without downtime (expand/contract). Use when deciding whether to maintain or sunset existing code.

alfathafp/portofolio-web-design

Use when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.

alfathafp/portofolio-web-design

Use when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies

alfathafp/portofolio-web-design

Records decisions and documentation. Use when you need to document an architecture decision (ADR) or the reasoning behind a design choice, when changing public APIs, shipping features, or when you need to record context that future engineers and agents will need to understand the codebase.

alfathafp/portofolio-web-design

Subjects every non-trivial decision to a fresh-context adversarial review before it stands. Use when you want every assumption cross-examined before proceeding, when stress-testing a plan for hidden failure modes, when correctness matters more than speed, when working in unfamiliar code, when stakes are high (production auth, security-sensitive logic, a high-stakes migration, irreversible operations), or any time a confident output would be cheaper to verify now than to debug later.

alfathafp/portofolio-web-design

Use when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available

alfathafp/portofolio-web-design

Use when implementation is complete, all tests pass, and you need to decide how to integrate the work

alfathafp/portofolio-web-design

Builds production-quality, accessible, responsive user-facing UIs. Use when building or modifying interfaces and pages, creating components, implementing layouts, meeting WCAG accessibility requirements, managing state, or when the output needs to look and feel production-quality rather than AI-generated.

alfathafp/portofolio-web-design

Structures git workflow practices. Use when making any code change. Use when committing, branching, resolving conflicts, splitting uncommitted work in a messy working tree into clean atomic commits, opening or reviewing a pull request (PR), pushing to a remote, or when you need to organize work across multiple parallel streams. Use when cutting a release, choosing a semantic version bump, tagging, or writing a changelog.

alfathafp/portofolio-web-design

Refines raw ideas into sharp, actionable concepts through structured divergent and convergent thinking. Use when an idea is still vague, when you need to stress-test assumptions before committing to a plan, or when you want to expand options before converging on one. Triggers on "ideate", "refine this idea", or "stress-test my plan".

alfathafp/portofolio-web-design

Guides stable API and interface design. Use when designing APIs, module boundaries, or any public interface. Use when creating REST or GraphQL endpoints, defining type contracts between modules, or establishing boundaries between frontend and backend.

相关技能