Communitygithub.com

乐高计划

将一个已确定的变更分解为从简单原语到工作特性的分层有向无环图(DAG)。仅做规划,然后停止。

乐高计划 是什么?

乐高计划技能用于将一个已确定的变更转化为一个分层的有向无环图(DAG),该图从简单原语构建至完整功能。它仅负责规划,不涉及任何实现代码、测试或子代理调度。该技能适用于Cursor、Claude Code等AI编码代理,当用户已明确要构建什么,需要一个可供其他代理(驱动者)执行的实现地图时使用。其核心产出是:一个由节点(原语)和依赖关系构成的DAG、一个Mermaid流程图、以及一个与聊天界面同步的JSON文件(`.agent/scratch/lego-plan.json`)。该JSON文件作为驱动者跟踪进度的来源,后续驱动者可以并行运行同一层的节点,并更新其状态。该技能严格禁止编写生产代码、测试或文档;其输出仅为一个规划,之后必须停止。如果变更意图未确定、或任务涉及打字错误、注释、格式化、纯文档工作,则此技能不适用。

兼容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/AlemTuzlak/skills/tree/HEAD/skills/lego-plan

在你喜欢的 AI 中提问

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

文档

乐高计划 是做什么的?

将一个已确定的变更转化为一个从简单原语到工作特性的分层DAG。仅做规划。然后停止。

该图是一个金字塔结构:底层为独立模块,上层为组合模块,顶部为一个完成节点。后续驱动者可以并行运行同一层节点,翻转status,并重绘此图。本技能不调度子代理。也不加载其他技能。

何时使用

当任务是将一个已确定的变更转化为驱动者可遵循的实现地图时加载。

  • 需求: 要构建的内容已选定。如果本次对话中已有文件列表或路径选择,请使用它们。如果没有,则从已确定的意图和代码入手。不要发明第二个系统地图。
  • 跳过: 打字错误、注释、格式化、不包含代码的文档。
  • 如果意图仍不确定: 停止。询问直到变更确定。不要为未选定的功能堆叠模块。

一个节点仍然是一个DAG。输出完整的合同。

硬性门控

  1. 仅做规划。 不要编写生产代码。不要编写测试。在done when中命名检查。不要在此处实现它。
  2. 输出后停止。 在聊天中输出DAG并写入暂存文件。不要调度。不要加载下一个技能。
  3. 无循环。 如果一个模块依赖于后面的模块,则拆分错误。重新拆分。
  4. 不要等待批准。 展示DAG并停止。用户如果认为错误会中断。
  5. 不要为用户打开暂存文件。 不要将计划写入docs/目录下。

节点粒度

图节点(并行单元): 一个可以独立交付的原语,子代理可以拥有它而无需等待另一个正在处理中的节点。

示例:write fetchOrder、write OrderCard、wire fetchOrder into the loader。

太大:implement auth。拆分之。太小:rename a variable。将其合并到需要它的节点中。

部分(节点内部): 必须一起落地才能使该节点编译通过的函数。一个子代理按顺序执行部分。不要将部分分散出去。

示例节点 fetch-order:

  • files:src/fetchOrder.ts、src/fetchOrder.test.ts
  • parts:Order类型,然后fetchOrder,然后编写或扩展src/fetchOrder.test.ts
  • 这些部分不是单独的图节点

图形形状

  • 第0层: depends on: none的节点。驱动者可以并行运行所有节点。
  • 第N层: 其依赖项全部位于较早层级的节点。
  • 最后一层: 一个节点(或紧密的集合),表示该功能端到端运行正常。
  • 两个相互不依赖的节点必须共享同一层(或位于互不等待的层级中)。
  • depends on列出节点ID,绝不是文件名。

同一文件: 如果两个节点创建或编辑同一路径,它们不得共享同一层。合并它们,或者添加一条depends on边以便一个等待另一个。不要为了并行运行而拆分文件。两个仅读取路径的节点可以共享同一层。files仅列出创建或编辑的路径。同一文件规则包括测试文件。

节点字段

每个节点都有全部七个字段:

  1. id: kebab-case,在此计划中唯一,稳定(后续驱动者标记此id为完成)。
  2. name: 简短的英文名称。
  3. depends on: 其他id,或none。
  4. files: 创建或编辑(路径)。包括来自done when的测试路径。
  5. parts: 有序的C列表。最后一部分是编写或扩展该测试。如果done when是手动检查且没有测试文件,则最后一部分是该检查,并且files中没有测试路径。
  6. done when: 驱动者在启动依赖项之前可以运行的测试文件或命令。
  7. status: 本技能始终写入pending。后续驱动者可以设置为in-progress或done。本技能从不写入这两个值。

不要在计划中放入完整源代码。

实时看板

路径:<repo>/.agent/scratch/lego-plan.json

与聊天围栏相同的JSON。代理遵循此文件。用户面向的产品是聊天中的图示。

  • 如有需要,创建.agent/scratch/目录。
  • 始终覆盖。不要询问,即使现有节点是in-progress或done。
  • 如果仓库有git,确保.gitignore包含.agent/scratch/。如果.gitignore存在且缺少该行,则追加。如果缺少.gitignore,则创建它并包含该行。
  • 不要打开文件。不要将其作为第二个副本转储到聊天中。JSON围栏是用户看到的副本。

程序

程序1:确认已确定的变更

  1. 如果变更明确,继续。
  2. 如果用户仍在选择他们想要的内容,停止。询问。变更确定后返回此处。

程序2:收集会话中已有的输入

  1. 如果本次对话已有完成线文件列表、部分或路径选择,将其作为起始集合。
  2. 如果没有,则从已确定的意图和必须读取以命名文件的代码中推导模块。不要遍历整个仓库。

程序3:拆分为节点和部分

  1. 列出候选原语(B粒度)。
  2. 对于每个原语,列出必须一起编译的C部分。以编写或扩展测试(或手动检查)结束。
  3. 绘制depends on:一个节点仅在调用或嵌入该节点的结果时才依赖于另一个节点。
  4. 根据依赖项分配层级。独立节点→同一层。
  5. 如果两个节点创建或编辑同一路径且共享一层,合并它们或添加一条边。然后重新分层。
  6. 如果出现循环,拆分错误的节点并重复此程序。

程序4:填充每个节点

填充七个字段。每个节点的status为pending。

程序5:在聊天中展示DAG

按以下顺序展示:

  1. 层级: 第0层到最后一层。在每个层级下,该层中的节点。
  2. 节点: 每个id的七个字段。
  3. Mermaid: 始终使用。一个flowchart(或graph TD)。图中的节点id必须与计划id匹配。无classDef。无状态颜色。每个节点都是pending状态。
  4. JSON围栏: 一个包含实时看板对象的json块。id、依赖项、文件、部分、doneWhen和status的单一来源。层级从depends推导。不要存储layer字段。

然后执行程序6。

Mermaid格式:

flowchart TD
  fetch-order[fetch-order]
  order-card[order-card]
  wire-loader[wire-loader]
  fetch-order --> wire-loader
  order-card --> wire-loader

同一层的节点之间没有边。

JSON格式:

{
  "version": 1,
  "nodes": [
    {
      "id": "fetch-order",
      "name": "fetch order",
      "depends": [],
      "files": ["src/fetchOrder.ts", "src/fetchOrder.test.ts"],
      "parts": ["Order type", "fetchOrder", "write or extend src/fetchOrder.test.ts"],
      "doneWhen": "pnpm test src/fetchOrder.test.ts",
      "status": "pending"
    }
  ]
}

depends是一个id数组。空数组表示无依赖。

程序6:写入实时看板

  1. 将相同的JSON写入.agent/scratch/lego-plan.json(覆盖)。
  2. 确保.gitignore忽略.agent/scratch/,如实时看板中所述。
  3. 不要打开文件。

程序7:停止

在程序6之后,停止。不要编写代码。不要调度。不要加载其他技能。

决策树

  • 意图未确定 → 程序1。
  • 已确定的变更,需要实现地图 → 程序2 → 3 → 4 → 5 → 6 → 7。
  • 一个节点 → 仍然执行程序2 → 7(完整合同)。
  • 打字错误/格式/纯文档 → 本技能不适用。
  • 依赖项中出现循环 → 程序3步骤6。
  • 两个同层节点编辑同一路径 → 程序3步骤5。
  • 节点是“实现整个功能” → 拆分(程序3)。

红旗

信号含义改为执行
在本技能中编写fetch函数计划变成了实现程序7。停止。
一个线性列表,没有层级无法并行扩展将独立节点放在同一层。
从此处调度子代理叶子变成了驱动者程序7。停止。
Mermaid id与节点id不同驱动者无法标记完成在两个地方使用相同的kebab-case id。
JSON围栏与暂存文件不同两个来源写入一个对象。复制到两者。
循环(a → b → a)拆分错误拆分并重新分层。
两个同层节点编辑order.ts并行写入冲突合并或添加depends on边。
拆分文件以便两个节点并行运行未要求的设计保留文件。对节点进行排序。
files/最后部分缺少测试路径节点不可交付程序3步骤2。
计划Mermaid上有classDef或状态颜色本技能描绘进度无样式。全部pending。
一个节点的部分被拆分为无法单独编译的并行节点将C视为B将这些部分保留在一个节点内。
将“实现auth”作为单个节点太大拆分为原语。
等待“看起来不错?”门控是展示后停止输出并停止。
覆盖暂存文件前询问实时看板只有一个槽程序6。覆盖。
打开.agent/scratch/lego-plan.json面向用户的额外文件仅在聊天中。文件是给代理的。
写入docs/lego-plan.md额外产物聊天加暂存。没有docs计划文件。

错误处理

  • 会话中没有要触碰的文件: 从意图和针对性读取中推导。如果无法命名文件,停止并说明缺少什么。不要发明路径。
  • 循环: 按id报告循环。拆分。重新运行程序3。不要将循环的Mermaid展示为计划。
  • 最后一层不代表功能正常工作: 添加一个依赖于组合部分(接线)的完成节点,或者说明为什么当前最后一层已经是端到端路径。
  • 用户中断表示某个节点错误: 编辑该节点以及任何指向它的depends on。如果节点仍然存在,保持id稳定。如果删除了一个节点,同时从Mermaid和JSON中移除它。覆盖暂存文件。再次展示DAG。停止。
  • done when模糊(“它应该能工作”): 替换为命令或测试路径。如果项目尚无测试命令,用一行命名手动检查。最后一部分是该检查。
  • 不是git仓库: 如果工作区可写,仍然在其下写入.agent/scratch/lego-plan.json。跳过gitignore步骤。在聊天中用一行说明。
  • 暂存写入失败(权限、磁盘): 仍然显示聊天DAG和JSON围栏。说明实时看板未写入。不要假装文件存在。
  • 现有暂存JSON无效或正在运行中: 覆盖。不要合并。不要询问。

Individual skills in this repo

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

AlemTuzlak/skills

Use when the user wants to write a blog post about a feature, product change, PR, git diff, or any technical topic - accepts marketing briefs, PRs, git refs, codebase paths, or freeform descriptions as input

AlemTuzlak/skills

Use when the user wants to generate a changelog, release notes, or document what changed between versions, tags, or PRs

AlemTuzlak/skills

Use when writing, editing, or organizing documentation, when planning what docs a feature needs, and whenever planning or implementing a new feature or change in a repo (docs ship with the code). Also use when tempted to write docs without showing the discovered readers to the user, without asking for tone, or without loading simple-english and i-have-adhd. Triggers on "write docs for X", "document this feature", "add a guide", "update the docs", "reorganize the docs", "plan feature X", "implement X", or /docs.

AlemTuzlak/skills

Use when a bug is in play: a test fails, CI is red, an API returns the wrong result, a stack trace appears, or the user says it is broken or fix this. Don't use for a new feature with no failure, for types-only work, or for docs.

AlemTuzlak/skills

Use when the user invokes /i-have-adhd, says they have ADHD, or asks for ADHD-friendly output. Also used as a required writing filter by the docs skill. Don't use for marketing copy or after the user says "stop adhd mode" or "normal mode".

AlemTuzlak/skills

Use when the user wants to write a product update email, feature announcement newsletter, or digest email for users or subscribers

AlemTuzlak/skills

Use when the user wants to turn a raw talking-head / screen-share recording into a finished, edited, annotated video plus a full content package. Removes silences, flags mistakes for the user to cut, transcribes, adds transcript-synced overlays (code, on-screen code highlights, word highlights, lists, comparisons, diagrams, section labels, punch-in zooms), renders with original audio, then generates blog/socials/YouTube content. Triggers on "produce a video", "edit my video", "annotate my recording", "/produce-video".

AlemTuzlak/skills

Use when the user runs /prove-it or says prove it, prove the changes, show me in the browser, or asks to prove a UI or API change. Don't use only because the agent is about to say done, for types-only work, or for docs with no behavior to prove.

AlemTuzlak/skills

Use when the user wants to write, draft, or author an RFC (Request for Comments) / technical design doc for a feature, change, or architectural decision. Interactively interviews the user, grounds the proposal in the actual codebase, presents 2-3 concrete API/code-snippet approaches to choose from, then writes a review-ready RFC. Triggers on "write an RFC", "draft an RFC", "RFC for X", "design doc for X", or /rfc.

AlemTuzlak/skills

Use when the user wants to deeply learn a new topic from scratch. Runs a pre-interview (current knowledge, end-goal proficiency, depth, practice load, background, scope), researches online (articles, niche-influencer blogs, canonical docs, subtopic landscape), then produces a structured markdown course with mandatory visual diagrams, evidence-based learning-science features (retrieval practice, spaced callbacks, worked-example fading, concept ledger, jargon gate, analogy hygiene), and a self-contained interactive HTML mini-course. Triggers on /teach-me, "teach me about X", "I want to learn X", "deep dive on X", "create a course on X", "study X with me".

AlemTuzlak/skills

Use when the change intent is already settled and the agent must map what a behavior change touches before an implementation plan or any code. Use for new features, bug fixes, and refactors that move a boundary. Don't use for typos, comments, formatting, lockfile-only diffs, docs with no code, or while the user is still deciding what they want.

AlemTuzlak/skills

Use when the user wants to transcribe a video or audio file to text with word-level timestamps — spins up a self-contained local Whisper (whisper.cpp) Docker service bundled in this skill and returns transcript.txt, transcript.srt, and word-level transcript.words.json. Also used as a building block by /produce-video. Triggers on "transcribe this video", "get a transcript", "transcribe-video".

AlemTuzlak/skills

Use when the user wants to write a video script for a product demo, feature walkthrough, launch video, or social media video about a feature or product change

AlemTuzlak/skills

Use when the user wants YouTube metadata for a video — a click-worthy title, an SEO/above-the-fold description, tags, and timestamped chapters. Accepts a transcript (ideally timestamped SRT), a topic, a PR, or a freeform description. Used standalone and by /produce-video. Triggers on "youtube title", "youtube description", "youtube chapters", "youtube tags", "youtube metadata", "youtube-copy".

相关技能