architect
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseOutput style (plain words, no dashes, no hyphens)
输出风格(直白表述,不使用破折号、连字符)
<!-- OUTPUT-STYLE:START -->
Write everything this skill produces, files and messages alike, in plain simple language. Talk to the reader as , warm and direct like a colleague, and present every step as a recommendation they may run or skip, never an order. Keep technical terms that carry real meaning; explain each in plain words. Never use a dash or a hyphen as punctuation: no em dash, no en dash, and no hyphenated compounds. Write , not . Say it in simple words, or reword the sentence. Code, file paths, command flags, and values other skills match on keep their hyphens. Use short sentences, commas, or parentheses. Clear beats clever.
<!-- OUTPUT-STYLE:END -->youread onlyread-only<!-- OUTPUT-STYLE:START -->
此技能生成的所有内容(包括文件和消息)都需使用简洁直白的语言撰写。以称呼读者,语气像同事一样亲切直接,将每一步都呈现为读者可选择执行或跳过的建议,而非命令。保留具有实际意义的技术术语,并以直白语言解释每个术语。绝不使用破折号或连字符作为标点:包括长破折号、短破折号和连字符复合词。写成,而非。用简单的语言表述,或改写句子。代码、文件路径、命令标志以及其他技能匹配的值保留其连字符。使用短句、逗号或括号表述。清晰胜过巧妙。
<!-- OUTPUT-STYLE:END -->youread onlyread-onlyWhat this skill does
此技能的功能
Runs structured discovery, weighs options, and writes or updates a build spec in . The main thread writes; it offloads only reading the codebase or fetching the web to a cheap subagent (see Subagents). Four modes:
docs/specs/| Mode | When | Design behaviour |
|---|---|---|
| Designing a new feature from scratch, with or without existing code | First principles design, best practices, minimal code reading |
| Choosing a tech stack or foundational architecture for a new project | Comprehensive stack evaluation, industry patterns, no code to read |
| Improving, replacing, or scaling something that already exists | Read existing code + specs, focused option comparison |
| Standardising a pattern across the whole codebase (error handling, logging, auth, naming) | Sample current state, define the standard precisely, recommend enforcement |
- Create: new decision → new spec with status
Proposed - Update: evolving an existing decision → edit existing spec in place
- Supersede: replacing a past decision → new spec + update old spec's status line
- Ratify: deliberating an spec that
Assumedrecorded when the engineer chose to build before deciding → see Ratify an assumed decision below/develop
Spec status behaves one of two ways, decided by whether a buildable scope feature links the spec (a row whose cell points to it):
docs/scope/spec- Feature linked spec (typical FEATURE/ENHANCEMENT, or an ARCHITECTURE foundation that has a scope row): status mirrors the feature lifecycle. /architect creates it as and owns its content but never advances the status; /develop advances it to
Proposedwhen the feature goes in-progress, thenIn Progresswhen built and verified (scopeAccepted). Engineer confirmation ratifies content only;donemeans shipped.Accepted - Standalone decision spec (foundational/stack or cross cutting standard, no scope row links it): decision status. when written,
Proposedonce the engineer ratifies it on confirmation (the decision is then in force). /develop does not advance it.Accepted
A spec documenting already shipped work (the "already built" path, or a linked feature already ) is born .
existingAcceptedThe status. may create a spec in status when the engineer chooses to build before a load bearing decision is deliberated. It records the assumption the build used, not a deliberated decision. The feature can still be marked ; the spec stays flagged as owing ratification and does not block it. Only clears the status, by ratifying (below). never creates an spec; it only deliberates one that already exists.
Assumed/developAssumeddoneAssumed/architectAssumed/architectAssumedWrites no code. Never updates / (/sync owns that).
AGENTS.mdCLAUDE.md执行结构化探索、权衡选项,并在目录下编写或更新构建规范。主线程负责编写,仅将读取代码库或获取网络信息的任务委托给轻量subagent(参见Subagents)。包含四种模式:
docs/specs/| 模式 | 适用场景 | 设计行为 |
|---|---|---|
| 从零开始设计新功能,无论是否已有相关代码 | 基于第一性原理设计、遵循最佳实践、最少化代码读取 |
| 为新项目选择技术栈或基础架构 | 全面评估技术栈、参考行业模式、无需读取代码 |
| 改进、替换或扩展已有功能 | 读取现有代码和规范、聚焦选项对比 |
| 在整个代码库中标准化模式(错误处理、日志、认证、命名) | 采样当前状态、精确定义标准、推荐实施方式 |
- 创建:新决策 → 创建状态为的新规范
Proposed - 更新:决策迭代 → 直接编辑现有规范
- 替代:替换过往决策 → 创建新规范并更新旧规范的状态行
- 批准:审议/develop记录的规范(工程师选择先构建再决策时生成)→ 参见下方批准假定决策
Assumed
规范状态的行为分为两种,取决于是否有可构建范围的功能关联该规范(即中单元格指向该规范的行):
docs/scope/spec- 关联功能的规范(典型的FEATURE/ENHANCEMENT模式,或有范围行关联的ARCHITECTURE基础规范):状态与功能生命周期同步。/architect创建时状态为,并负责其内容,但从不推进状态;当功能进入开发中时,/develop将其状态推进至
Proposed,当功能构建完成并验证通过(范围标记为In Progress)时,状态推进至done。工程师确认仅批准内容;Accepted表示已发布。Accepted - 独立决策规范(基础/技术栈或跨领域标准,无范围行关联):决策状态。编写时状态为,工程师确认批准后状态变为
Proposed(决策生效)。/develop不会推进其状态。Accepted
记录已发布工作的规范("已构建"路径,或关联的功能已标记为)初始状态为。
existingAcceptedAssumedAssumeddoneAssumedAssumedAssumed不编写代码。绝不更新/(该任务由/sync负责)。
AGENTS.mdCLAUDE.mdSubagents (main thread writes; subagents only read, fetch, or cross check)
Subagents(主线程负责编写;subagents仅负责读取、获取或交叉检查)
The main thread runs the conversation and writes the spec; it never hands the writing or any fix to a subagent. Every subagent it spawns is read only and never inherits the session model:
- Read the codebase (cheapest model, Claude Code ): a read only scan of existing code when the repo is large (ENHANCEMENT/CROSS-CUTTING). Claude Code: the
haikutype. Returns a compact map, never file dumps.scout - Fetch from the web (cheapest model, Claude Code ): the current tool landscape check and the Agent Skill / MCP discovery, both during the design conversation (Stage c), when a decision needs current facts. Claude Code: the
haikutype. Returns a compact summary, never raw pages.researcher - Cross check the drafted spec (its primary job is decision completeness: finding values an action must produce whose source the spec never names, and decisions the builder would otherwise invent): a read only pass that reads the finished spec and returns a critique, writing nothing. always asks whether to run it (never runs or skips it on the engineer's behalf), recommending
/architectstrongly atAnother model/GA(the tiers where these bugs live), offering it atBeta, and recommendingAlphaatSkip; any gap it finds is presented to the engineer with a recommended fix for them to decide, not auto resolved. See After the spec is written.Prototype
Web fetching happens once, when a decision needs it (the Stage (c) landscape and tool discovery checks). The links it returns go into the spec's References for a human to follow; the AI never fetches them again (not in the cross check, , or ).
/develop/audit主线程负责对话和编写规范;绝不将编写或任何修正任务委托给subagent。它生成的所有subagent均为只读,且从不继承会话模型:
- 读取代码库(最轻量化模型,Claude Code ):当代码库较大时(ENHANCEMENT/CROSS-CUTTING模式),对现有代码进行只读扫描。Claude Code类型:
haiku。返回简洁的代码映射,从不返回文件转储内容。scout - 获取网络信息(最轻量化模型,Claude Code ):在设计对话(Stage c)期间,当决策需要当前事实时,检查当前工具生态以及Agent Skill / MCP信息。Claude Code类型:
haiku。返回简洁摘要,从不返回原始页面。researcher - 交叉检查草拟规范(核心任务是确保决策完整性:找出操作必须生成但规范未指明来源的值,以及构建者可能自行决定的决策):只读检查,读取已完成的规范并返回评审意见,不进行任何编写。/architect总是询问是否运行此检查(绝不会自行决定运行或跳过),在/
GA阶段强烈推荐使用Beta(这些阶段易出现此类问题),在Another model阶段提供该选项,在Alpha阶段推荐Prototype;检查发现的任何漏洞都会呈现给工程师,并提供推荐修复方案供其决策,不会自动解决。参见规范编写完成后。Skip
网络信息获取仅在决策需要时执行一次(Stage (c)的生态和工具发现检查)。返回的链接会放入规范的参考部分供人类查看;AI不会再次获取这些链接(交叉检查、/develop或/audit阶段都不会)。
Asks vs acts
询问与执行
Ask targeted questions before you write the spec (and before spawning any read/fetch helper); spend the budget on substance. Sort every question:
- INFER: anything the prompt or codebase reveals (feature vs architecture, the stack, UI in scope, an already chosen provider). Derive, never ask.
- ASK: only what the engineer alone knows (requirements, preferences, business rules, compliance scope).
- RECOMMEND: anything expertise settles (which provider/library/pattern fits). State the pick, a one line why, and the runner up; they may override. Never a neutral menu, never a silent decision.
Never bundle a complete data model, full stack, or ready made acceptance criteria set into one accept or change panel, and never silently decide a tool, provider, or setup choice for them.
Recommendations align with the stack in use (on a BaaS, prefer its auth/storage over new external tools; reuse beats sprawl). Web or mobile alike: infer the platform, never assume web.
That is the intent, not the procedure. How to run the questioning lives in , which Execution below makes you read in full before you ask a single design question.
internal/design-conversation.md在编写规范之前(以及生成任何读取/获取助手之前)提出针对性问题;将预算用在核心内容上。对每个问题进行分类:
- 推断:提示或代码库中已揭示的任何信息(功能 vs 架构、技术栈、涉及的UI、已选择的供应商)。自行推导,绝不询问。
- 询问:仅询问只有工程师知晓的信息(需求、偏好、业务规则、合规范围)。
- 推荐:专业知识可确定的任何内容(哪个供应商/库/模式适用)。说明选择理由(一句话),并列出备选方案;工程师可覆盖推荐。绝不提供中立选项菜单,绝不静默做出决策。
绝不将完整的数据模型、全栈或现成的验收标准打包成一个"接受或修改"的面板,绝不静默为工程师决定工具、供应商或配置选项。
推荐内容需与当前使用的技术栈保持一致(在BaaS平台上,优先使用其自带的认证/存储服务,而非新的外部工具;复用优于扩展)。无论是Web还是移动平台:推断当前平台,绝不默认假设为Web。
以上是设计意图,而非具体流程。提问流程详见,在执行下方步骤之前,需完整阅读该文件,之后才能提出任何设计问题。
internal/design-conversation.mdArtifact ownership
工件所有权
Spec files in , created or updated by this skill only, plus any supporting evidence it produces (inventories, audits), which lives in the spec's (directory spec) or inline (single file spec), never in the scope folder ( is owned by , not a spec).
docs/specs/rationale.mddocs/scope//scopeTwo independent choices, location (repo shape) and shape (decision size):
-
Location = repo shape. Single repo →. Monorepo →
docs/specs/for a workspace decision,docs/specs/<workspace>/for a repo wide one (mirrors the scope). Numbering is per location (scan that dir for the nextdocs/specs/_root/). Call the resolved locationNNNN.$SPEC_DIR -
Shape = decision size, the same in any repo shape. Simple decision: one file(everything inline, written tight). An umbrella (related sub decisions), a heavy or foundational decision, or one that warrants a
$SPEC_DIR/NNNN-title.mduses the directory shape:verify.mdwith$SPEC_DIR/NNNN-title/as its top file plus aindex.mdbeside it (and child specsrationale.mdfor an umbrella). Never double the name (NNNN-<child>.md); the directory carries the number, the top file isNNNN-title/NNNN-title.md. Default to a single file.index.mdA directory spec always has exactly two core files (plus optionaland child specs):verify.md- : the build spec
index.mdreads:/develop,## Summary,## Requirements, the design/spec section,## Decision,## Build plan,## Consequences, and a one line## Follow-uppointer to## Rationale. For an umbrella it also opens with arationale.mdmanifest listing and linking every child spec (one line each: what it is plus which decision it supports), and holds any cross child contract.## Structure - : the decision record
rationale.mdskips:/develop,## Context,## Options considered, the## Rationalesection, and any bulky evidence (inventories, audits) under its own subheading. There is no## Referencesfolder; all evidence lives here.research/ - Child specs (umbrella only) are flat files, each complete enough to build from on its own with a short inline rationale (not its own
NNNN-<child>.md); promote a child to its own directory only when it grows heavy. Cross child contracts live in the umbrellarationale.md.index.md
-
One narrow exception into the scope: after the spec is confirmed, update the matching feature to the ready to build shape (exact edits in After the spec is written, step 3). Never dump the atomic task list into the scope. No matching feature: offer to enroll one (see the derive tasks step).
Artifact base. specs live under by default. If is a published docs site (, , , Astro Starlight, or Nextra detected), use instead (). Always follow whichever base already exists (paths here assume ).
docs/docs/docusaurus.config.*.vitepress/mkdocs.yml.workflow/.workflow/specs/docs/docs/specs/rationale.mddocs/scope/包含两个独立选项:位置(仓库结构)和形态(决策规模):
-
位置 = 仓库结构:单仓库 →。单体仓库 → 工作区决策存储在
docs/specs/,仓库级决策存储在docs/specs/<workspace>/(与范围结构镜像)。编号按位置分配(扫描对应目录获取下一个docs/specs/_root/编号)。将解析后的位置称为NNNN。$SPEC_DIR -
形态 = 决策规模,与仓库结构无关。简单决策:单个文件(所有内容内联,精简撰写)。总括性决策(相关子决策)、重大或基础决策,或需要
$SPEC_DIR/NNNN-title.md的决策使用目录形态:verify.md,包含$SPEC_DIR/NNNN-title/作为顶级文件,旁边有index.md(以及总括性决策的子规范rationale.md)。绝不重复命名(NNNN-<child>.md);目录包含编号,顶级文件为NNNN-title/NNNN-title.md。默认使用单文件形态。index.md目录型规范始终包含两个核心文件(可选和子规范):verify.md- :/develop读取的构建规范:
index.md、## 摘要、## 需求、设计/规范部分、## 决策、## 构建计划、## 影响,以及指向## 后续工作的单行rationale.md指针。对于总括性规范,还会以## 理由清单开头,列出并链接每个子规范(每行一句话:子规范内容及其支持的决策),并包含子规范间的交叉契约。## 结构 - :/develop会跳过的决策记录:
rationale.md、## 背景、## 考虑的选项、## 理由部分,以及任何 bulky 证据(清单、审计报告)放在独立子标题下。不存在## 参考文件夹;所有证据都存储在此处。research/ - 子规范(仅总括性规范有)为扁平的文件,每个文件足够完整,可独立基于其进行构建,并包含简短的内联理由(无独立
NNNN-<child>.md);仅当子规范内容变得复杂时,才将其升级为独立目录。子规范间的交叉契约存储在总括性规范的rationale.md中。index.md
-
针对范围的一个特殊例外:规范确认后,将匹配的功能更新为可构建形态(具体编辑操作见规范编写完成后第3步)。绝不要将原子任务列表转储到范围中。无匹配功能时:提供注册选项(参见派生任务步骤)。
工件基础目录:规范默认存储在下。如果是已发布的文档站点(检测到、、、Astro Starlight或Nextra),则使用替代()。始终遵循已存在的基础目录(此处路径假设为)。
docs/docs/docusaurus.config.*.vitepress/mkdocs.yml.workflow/.workflow/specs/docs/Portability (any OS, any agent)
可移植性(支持任意操作系统、任意Agent)
- Commands: is the only required CLI, same on every OS. Other shell snippets (
git,mkdir -p,date,find,ls,cat) are POSIX reference, not literal scripts; use your agent's cross platform file tools (read, search/glob, write, create dir) and your knowledge of today's date. Createwcwith your write tool, notdocs/specs/.mkdir - Bundled files: ,
agent-prompt.md, andagent-modes/*.mdlive at paths relative to this skill's folder. The main thread reads these itself right before it writes the spec (see Write the spec):spec-template.md(the persona, rules, and report format), the one matchingagent-prompt.md, andagent-modes/<mode>.md(the section structure). Read them only at write time, not during pre-flight, so they don't sit in context through the whole interview.spec-template.md - No interactive question support? Use whatever your agent provides (an options picker) and fall back only where missing: ask the question rounds as plain text with the same options.
- 命令:是唯一必需的CLI工具,所有操作系统通用。其他Shell代码片段(
git、mkdir -p、date、find、ls、cat)是POSIX参考,而非字面脚本;使用Agent的跨平台文件工具(读取、搜索/通配符、写入、创建目录)以及当前日期信息。使用写入工具创建wc,而非docs/specs/命令。mkdir - 捆绑文件:、
agent-prompt.md和agent-modes/*.md存储在此技能文件夹的相对路径下。主线程仅在编写规范之前读取这些文件(参见编写规范):spec-template.md(角色、规则和报告格式)、与当前模式匹配的agent-prompt.md文件,以及agent-modes/<mode>.md(章节结构)。仅在编写时读取,而非预检查阶段,避免整个访谈过程中占用上下文。spec-template.md - 不支持交互式提问? 使用Agent提供的任何功能(选项选择器),仅在缺失时回退:以纯文本形式提出多轮问题,并提供相同选项。
Execution
执行流程
Step 0: Topic check (before pre-flight)
步骤0:主题检查(预检查之前)
If no design topic was provided ( with no argument or an empty description), stop and ask before doing anything else:
/architect"What design decision do you want to work through? Describe the feature, system, or choice you need to design in one or two sentences."
Wait for the answer; use it as the design topic before pre-flight.
如果未提供设计主题(运行/architect时无参数或描述为空),停止操作并先询问:
"你想解决什么设计决策问题?用一两句话描述你需要设计的功能、系统或选择。"
等待回答;将回答作为设计主题,再进行预检查。
Pre-flight (main model)
预检查(主模型)
Run these steps (the commands are literal; everything else uses your agent's file tools):
git- Freshness (teams): quietly, pick the base branch (
git fetchifmainsucceeds, elsegit rev-parse --verify main), count commits behind withmaster. If >0, warn "pull first" before deciding (a teammate may have added specs or changed this feature).git rev-list --count HEAD..origin/<base> - Resolve the spec location () = the scope workspace mirrored into
SPEC_DIR: single repo →docs/specs/; monorepo workspace →docs/specs/; repo wide →docs/specs/<workspace>/. Determinedocs/specs/_root/as the scope does (topic/path/scope row). Create the directory if missing.<workspace> - Today's date: use today's date (inject it into the spec).
- List existing specs in this location: files named plus any
NNNN-*.mdinindex.md, for numbering (per location) and related decision detection.$SPEC_DIR - Count source files (e.g. ,
.ts,.tsx,.js,.py,.go,.rs), excluding.java,node_modules/,.git/. Informs how much code there is to read, and whether to offload that reading to adist/subagent.scout - Read project context, the source of truth for the stack and community skills: root (fall back to
AGENTS.md, else MISSING), plus the nestedCLAUDE.mdfor this feature's area if one exists (e.g.<area>/AGENTS.mdfor an auth feature).src/auth/AGENTS.md - Read the build approach for THIS feature: the delivery strategy that governs how the spec's is ordered and sliced. Precedence: this feature's scope row
## Build planoverride if declared, else the project default (rootApproachfirst, else the scope header inAGENTS.md). A feature with its own approach is built by ITS approach; others use the project default. The four imply materially differentdocs/scope/orderings, not the same order relabeled: Tracer Bullet stands up a thin end to end thread through every layer first, then thickens; Skateboard builds the thinnest usable whole first, then grows; Facade leads with the UI shell on placeholder data and defers the migration (a prototype path); Journey completes one user path's tasks fully before the next. A project specific variant is possible. If neither records one, note the assumption and set the default by Staff/Principal judgment (prefer end to end Tracer Bullet slices for production work). Let the recorded approach visibly shape the ordering.## Build plan - Locate the linked scope feature (if any): cheaply scan filenames/headings (including per workspace subdirs) for a feature matching this topic; open only the single scope file containing it (
docs/scope/, or the matchingscope.mdin a split). If found, read that row's intent plus any acceptance criteria seeds (they seed Stage (a)) and remember the file/row for the derive tasks and linking steps; this also settles feature linked vs standalone status. If no row matches, note the standalone decision path and don't create one now.<epic>.md - (Optional) list installed skills dirs for availability only (,
.claude/skills/,.agents/skills/). Relevance is decided by AGENTS.md plus the feature, not name matching.skills/
From the spec list (paths relative to ):
$SPEC_DIR- Next number: highest existing + 1, zero padded to 4 digits; if none (an umbrella directory counts as one number). Collision guard (teams): list again
0001immediately before you write; if the chosen$SPEC_DIRexists, bump to the next free number. Never overwrite an existing spec; after writing, confirm no concurrent run took the same number.NNNN - Filename / shape: slug from the topic, max 5 words, no articles, lowercase.
kebab-case- Simple decision → .
$SPEC_DIR/NNNN-kebab-title.md - Umbrella (splits into ≥2 related sub decisions) → directory with
$SPEC_DIR/NNNN-kebab-title/(the umbrella decision listing its children),index.md(the reasoning + any inventories/audits), and child specsrationale.mdinside it. Decide from the topic's breadth before you write, and hold the shape in mind as you write.NNNN-child.md
- Simple decision →
- Related specs: go in two passes so this stays cheap as specs accumulate. First read only the title line of each existing spec (cheap even at dozens of them); then read the first 20 lines (title, status, opening of Context) of just the few whose title plausibly overlaps this topic, to confirm. Flag matches.
- Child of umbrella detection: if the topic is a sub decision of an existing umbrella (), e.g. one that surfaced while building under it, place the new spec inside that directory as the next child (
$SPEC_DIR/NNNN-<umbrella>/) and add it to the umbrella'sNNNN-child.mdlist, not a new top level spec. Same path whenindex.mdhits a decision partway through a build. Tell the engineer where it's going./develop - Update/supersede detection: if an existing spec clearly overlaps the topic (same domain, system, decision), before the staged conversation present a decision panel (plain text options where the agent has no picker; the picker adds Other automatically): "I found an existing spec that may overlap: , [title]. How should I treat this?", options: New decision (create a new spec) · Update the existing spec in place · Supersede it (a new spec replaces it). Default to the "(recommended)" option by overlap strength (nearly identical → Update or Supersede; adjacent → New). On update/supersede: set OPERATION, read the existing spec in full, and skip the staged conversation for in place updates.
[path]- Assumed spec found: if the overlapping spec's is
**Status**:, this is a ratify, not the panel above. Follow Ratify an assumed decision (run the design conversation, then either fill in the real content and clearAssumed, or supersede if the assumption was wrong).Assumed
- Assumed spec found: if the overlapping spec's
Community skills come from the project's , never a hardcoded name table (names and stacks change). Project wide skills/conventions live in root , area specific ones in the nested (maintained by and ):
AGENTS.mdAGENTS.md<area>/AGENTS.md/audit/sync- Read root and the nested
AGENTS.mdfor this feature's area; theirAGENTS.mdsection lists each installed skill as a bullet with its location and a one line note on what it governs, so you can pick out the relevant ones and their paths directly.## Agent skills - Identify only the skills relevant to this feature. Take each relevant skill's path and note from that bullet, and open it on demand while writing, only if it materially shapes the decision (see Write the spec, item 12). Skip skills the feature doesn't touch.
## Agent skills - Available ≠ relevant. You may list the installed skills dirs to see what exists, but relevance comes from the feature plus . If a clearly relevant skill is installed but not yet referenced in
AGENTS.md, use it anyway and flag (spec Follow-up) that it belongs in the right context file: root if project wide, nestedAGENTS.mdif area specific.<area>/AGENTS.md - Whatever the context files show the project already uses (a BaaS, an ORM, a payment provider, an auth library) is what your library/provider recommendation must build on or prefer, not an unrelated external tool. If a genuinely better option isn't installed, note it as a spec Follow-up rather than silently assuming it.
Workflow skills (never treat as community skills): , , , , , , , , , plus new workflow skills as they're created.
auditarchitectscopedevelopchecktestdocumentdebugsync执行以下步骤(命令为字面命令;其他操作使用Agent的文件工具):
git- 新鲜度(团队场景):静默执行,选择基础分支(如果
git fetch成功则为git rev-parse --verify main,否则为main),使用master计算落后的提交数。如果大于0,在决策前提醒"先拉取最新代码"(队友可能已添加规范或修改此功能)。git rev-list --count HEAD..origin/<base> - 解析规范位置 () = 范围工作区映射到
SPEC_DIR:单仓库 →docs/specs/;单体仓库工作区 →docs/specs/;仓库级 →docs/specs/<workspace>/。根据范围(主题/路径/范围行)确定docs/specs/_root/。如果目录不存在则创建。<workspace> - 当前日期:使用当前日期(注入到规范中)。
- 列出此位置的现有规范:下名为
$SPEC_DIR的文件以及任何NNNN-*.md文件,用于编号(按位置)和检测相关决策。index.md - 统计源文件数量(例如、
.ts、.tsx、.js、.py、.go、.rs),排除.java、node_modules/、.git/。用于了解需要读取的代码量,以及是否将读取任务委托给dist/subagent。scout - 读取项目上下文,技术栈和社区技能的权威来源:根目录的(如果不存在则回退到
AGENTS.md,否则标记为MISSING),以及此功能所属区域的嵌套CLAUDE.md(例如,认证功能对应<area>/AGENTS.md)。src/auth/AGENTS.md - 读取此功能的构建方式:规范的的排序和拆分遵循的交付策略。优先级:此功能的范围行
## 构建计划覆盖值(如果已声明),否则为项目默认值(优先根目录Approach,否则为AGENTS.md中的范围标题)。有独立构建方式的功能按自身方式构建;其他功能使用项目默认值。四种方式意味着docs/scope/的排序有本质区别,而非相同顺序的重命名:Tracer Bullet先搭建贯穿所有层级的端到端基础框架,再逐步完善;Skateboard先构建最精简的可用完整版本,再逐步扩展;Facade先基于占位数据构建UI外壳,延迟迁移(原型路径);Journey先完整完成一个用户路径的所有任务,再进行下一个。可能存在项目特定变体。如果两者都未记录,注明假设并根据资深/首席工程师的判断设置默认值(生产环境优先选择端到端的Tracer Bullet拆分)。让记录的构建方式明显影响排序。## 构建计划 - 定位关联的范围功能(如果有):快速扫描的文件名/标题(包括工作区子目录),查找与当前主题匹配的功能;仅打开包含该功能的单个范围文件(
docs/scope/,或拆分后的匹配scope.md)。如果找到,读取该行的意图以及任何验收标准种子(用于Stage (a)),并记住文件/行以便后续派生任务和关联步骤;这也确定了是关联功能的规范还是独立规范。如果无匹配行,注明独立决策路径,暂不创建。<epic>.md - (可选) 仅列出已安装的技能目录(、
.claude/skills/、.agents/skills/)。相关性由AGENTS.md和功能决定,而非名称匹配。skills/
从规范列表(相对于的路径)中:
$SPEC_DIR- 下一个编号:现有最高编号+1,补零至4位;如果无现有规范则为(总括性目录算一个编号)。冲突防护(团队场景):在编写前立即再次列出
0001;如果选择的$SPEC_DIR已存在,递增到下一个可用编号。绝不覆盖现有规范;编写完成后,确认无并发运行占用相同编号。NNNN - 文件名 / 形态:从主题生成格式的短标题,最多5个词,无冠词,小写。
kebab-case- 简单决策 → 。
$SPEC_DIR/NNNN-kebab-title.md - 总括性决策(拆分为≥2个相关子决策) → 目录,包含
$SPEC_DIR/NNNN-kebab-title/(总括性决策,列出其子规范)、index.md(理由+任何清单/审计报告),以及目录内的子规范rationale.md。在编写前根据主题广度决定形态,并在编写时牢记该形态。NNNN-child.md
- 简单决策 →
- 相关规范:分两次扫描,确保规范积累时仍保持高效。首先仅读取每个现有规范的标题行(即使有几十个也很高效);然后仅读取标题看似与当前主题重叠的少数规范的前20行(标题、状态、背景开头),确认是否相关。标记匹配项。
- 总括性规范的子决策检测:如果当前主题是现有总括性规范()的子决策,例如在构建总括性规范过程中出现的决策,将新规范放在该目录下作为下一个子规范(
$SPEC_DIR/NNNN-<umbrella>/),并添加到总括性规范的NNNN-child.md列表中,而非作为新的顶级规范。当/develop在构建过程中遇到决策时,也遵循此路径。告知工程师规范的存储位置。index.md - 更新/替代检测:如果现有规范明显与当前主题重叠(相同领域、系统、决策),在分阶段对话前呈现决策面板(如果Agent无选择器则使用纯文本选项;选择器自动添加Other选项):"我发现一个可能重叠的现有规范:,[标题]。应如何处理?",选项:新决策(创建新规范) · 直接更新现有规范 · 替代现有规范(创建新规范替换它)。根据重叠程度设置默认的"(推荐)"选项(几乎完全相同 → 更新或替代;相关 → 新规范)。如果选择更新/替代:设置OPERATION,完整读取现有规范,直接更新时跳过分阶段对话。
[路径]- 发现Assumed规范:如果重叠规范的为
**Status**:,则执行批准流程,而非上述面板。遵循批准假定决策(运行设计对话,然后要么填充真实内容并清除Assumed状态,要么如果假设错误则替代)。Assumed
- 发现Assumed规范:如果重叠规范的
社区技能来自项目的,而非硬编码名称表(名称和技术栈会变化)。项目级技能/约定存储在根目录,区域特定技能存储在嵌套的(由/audit和/sync维护):
AGENTS.mdAGENTS.md<area>/AGENTS.md- 读取根目录和此功能所属区域的嵌套
AGENTS.md;它们的AGENTS.md部分以项目符号列出每个已安装的技能,包含其位置和功能说明,因此可直接挑选相关技能及其路径。## Agent skills - 仅识别与当前功能相关的技能。记录每个相关技能的路径和说明,在编写时按需打开,仅当它对决策有实质性影响时(参见编写规范第12项)。跳过与当前功能无关的技能。
- 可用≠相关。可列出已安装的技能目录查看现有技能,但相关性由功能和决定。如果明显相关的技能已安装但未在
AGENTS.md中引用,仍可使用,并在规范的后续工作部分标记它应添加到正确的上下文文件中:项目级添加到根目录,区域特定添加到嵌套AGENTS.md。<area>/AGENTS.md - 无论上下文文件显示项目已使用什么(BaaS、ORM、支付提供商、认证库),推荐的库/提供商都必须基于或优先使用这些现有工具,而非无关的外部工具。如果确实有更好的选项未安装,在规范的后续工作部分注明,而非静默假设使用该选项。
工作流技能(绝不视为社区技能):、、、、、、、、,以及新增的工作流技能。
auditarchitectscopedevelopchecktestdocumentdebugsyncScope validation, framing, and staged design conversation
范围验证、框架构建和分阶段设计对话
For create or supersede operations, this is a hard gate: read in full before you ask the engineer a single design question, and follow it. It holds Scope validation (including the already built documentation path), Framing, and the staged design conversation. Asks vs acts above is only the intent, not the protocol; do not open the interview, generate questions, or write the spec until you have read that file. (Skip only for in place spec updates.)
internal/design-conversation.md对于创建或替代操作,这是硬性要求:在向工程师提出任何设计问题之前,完整阅读并遵循其要求。该文件包含范围验证(包括已构建文档路径)、框架构建和分阶段设计对话。上述询问与执行仅为设计意图,而非协议;在未读取该文件之前,不得开启访谈、生成问题或编写规范。(直接更新规范时可跳过。)
internal/design-conversation.mdWrite the spec (main thread)
编写规范(主线程)
After the staged conversation, you write the spec yourself. Do not spawn anyone to draft, research, or critique it. Resolve this skill's folder to an absolute path (you already resolve these relative paths, so you know the folder) and Read three files now (only now, so they don't sit in context through the interview): , , and the one mode file matching the inferred MODE:
agent-prompt.mdspec-template.md- →
FEATUREagent-modes/feature.md - →
ARCHITECTUREagent-modes/architecture.md - →
ENHANCEMENTagent-modes/enhancement.md - →
CROSS-CUTTINGagent-modes/cross-cutting.md
Then write the spec, applying:
- From : adopt the persona ("Who you are / How you think / What you do NOT do") and follow the common instructions, Step 0, Step 0b,
agent-prompt.md, and## Expert rules that apply to all modes. At## Report format, follow the one mode file above as the only mode specific block; ignore the other mode files.## Instructions by modeis written as a subagent brief with ALL_CAPS placeholders; read those placeholders as the inputs you already gathered in the conversation (listed below), and apply the rules to yourself.agent-prompt.md - From : use only the part between
spec-template.mdand=== SPEC TEMPLATE START ===(the spec section structure and field guidance). The trailing reference/meta sections (=== SPEC TEMPLATE END ===, the## Filename conventionstable, the umbrella structure / child status notes,## Status values) are your own guidance: you resolved the filename, shape, and initial## Writing rulesin pre-flight; write the**Status**:line per the "On the initial**Status**:line" rule in**Status**:. Do not edit## Expert rules that apply to all modes.spec-template.md
References and links: reuse the Stage (c) ; do not fetch now. Write the section and citations at that level, per On sourcing & citations in . The Stage (c) checks ran once; reuse only the links they confirmed, and cite any unverified source by name with no URL. Only if Stage (c) never ran (e.g. the documentation path), present the References consent panel now (recommended pick ) and set to or ( is not offered, no fetch is available at write time).
REFERENCES_LEVEL## References(basis: ...)agent-prompt.mdNo references, keep it cleanREFERENCES_LEVELnonesourcessources+linksThe inferred MODE (from Framing) is already one of / / / .
FEATUREARCHITECTUREENHANCEMENTCROSS-CUTTINGThe inputs to apply (you already have them from the design conversation and pre-flight):
- Design topic (from the user's original message)
- The inferred framing: MODE, platform (web/mobile/API), stack & conventions (from ), and any constraints/compliance inferred or confirmed 2a. The feature's build approach (pre-flight precedence: scope row
AGENTS.mdoverride, else the project default fromApproach/scope header, else the noted default) →AGENTS.md; order and sliceBUILD_APPROACHby what the approach implies for this feature## Build plan - All staged conversation answers, stage by stage: the confirmed acceptance criteria (already IDed AC-1…, to seed ), the confirmed data model (entities/fields/relationships, the target that seeds the
## Requirementsmigration, sized to the feature), the confirmed stack/tool picks, API surface, authz model, and edge cases. On the documentation path (staged conversation skipped) treat it as## Build plan, not an error 3a. The RECOMMEND items →"Staged design skipped, documenting an already-made decision": the specific decisions you must make and justify (tool/provider aligned to the stack, session model, etc.); make each call, don't echo it back as an open question. If none, treat asRECOMMEND_ITEMS_OR_NONE3b. The References level →"none"(REFERENCES_LEVEL|none|sources, per the rule above). If Stage (c) never ran and you have not asked, default tosources+linksnone - Context file contents: (root + the feature area's nested), or
AGENTS.mdas fallback, or "MISSING"CLAUDE.md - Existing spec list (filenames + first line of each)
- Related spec paths (flagged in pre-flight)
- The resolved spec location (), next number, and shape: a single file
$SPEC_DIR, or a directory$SPEC_DIR/NNNN-title.md($SPEC_DIR/NNNN-title/+index.md, plus child specs for an umbrella). Umbrella: write the named child decisions; any inventory/audit goes inrationale.md, never inrationale.md, never loose in the code tree. Only thedocs/scope/carries aindex.mdline (it mirrors the feature); child specs omit the lifecycle Status (spec content governed by the umbrella)**Status**: - Source file count (whether there's code to read; for a large ENHANCEMENT/CROSS-CUTTING codebase, offload the reading to a subagent per Subagents and write from its map)
scout - Operation: |
create|updatesupersede - Today's date (from pre-flight)
- Documentation context (if the "already built" path ran: the engineer's free text answers about why this was chosen, alternatives, and tradeoffs)
- Community skills relevant to this feature (identified from , per pre-flight): open a skill file on demand, only if it materially shapes this decision; its conventions are authoritative when consulted. Name each in the
AGENTS.mdImplementation skills field.## Decision
分阶段对话完成后,自行编写规范。绝不生成任何subagent来草拟、研究或评审规范。将此技能的文件夹解析为绝对路径(已解析这些相对路径,因此已知文件夹位置),并立即读取三个文件(仅此时读取,避免整个访谈过程中占用上下文):、,以及与推断的MODE匹配的模式文件:
agent-prompt.mdspec-template.md- →
FEATUREagent-modes/feature.md - →
ARCHITECTUREagent-modes/architecture.md - →
ENHANCEMENTagent-modes/enhancement.md - →
CROSS-CUTTINGagent-modes/cross-cutting.md
然后编写规范,应用以下内容:
- 来自:采用角色设定("你的身份 / 你的思考方式 / 你绝不做的事")并遵循通用说明、Step 0、Step 0b、
agent-prompt.md和## 适用于所有模式的专家规则。在## 报告格式部分,仅遵循上述匹配的模式文件;忽略其他模式文件。## 按模式分类的说明以subagent brief形式编写,包含全大写占位符;将这些占位符视为对话中已收集的输入(如下所列),并将规则应用于自身。agent-prompt.md - 来自:仅使用
spec-template.md和=== SPEC TEMPLATE START ===之间的部分(规范章节结构和字段指南)。末尾的参考/元数据部分(=== SPEC TEMPLATE END ===、## 文件名约定表格、总括性结构/子规范状态说明、## 状态值)是供你参考的内容:已在预检查阶段解析了文件名、形态和初始## 编写规则;根据**Status**:中的"关于初始## 适用于所有模式的专家规则行"规则编写**Status**:行。不得编辑**Status**:。spec-template.md
参考和链接:复用Stage (c)的;此时不进行网络获取。根据中的关于来源与引用规则,编写部分和引用,遵循该级别要求。Stage (c)检查仅执行一次;仅复用已确认的链接,未验证的来源仅按名称引用,不提供URL。如果Stage (c)从未执行(例如文档路径),此时呈现参考同意面板(推荐选择)并将设置为或(不提供选项,编写时无法进行网络获取)。
REFERENCES_LEVELagent-prompt.md## 参考(basis: ...)无参考,保持简洁REFERENCES_LEVELnonesourcessources+links推断的MODE(来自框架构建)已为 / / / 之一。
FEATUREARCHITECTUREENHANCEMENTCROSS-CUTTING需应用的输入(已从设计对话和预检查阶段收集):
- 设计主题(来自用户原始消息)
- 推断的框架:MODE、平台(web/mobile/API)、技术栈与约定(来自),以及任何推断或确认的约束/合规要求 2a. 功能的构建方式(预检查优先级:范围行
AGENTS.md覆盖值,否则为Approach/范围标题中的项目默认值,否则为注明的默认值)→AGENTS.md;根据该方式对BUILD_APPROACH进行排序和拆分## 构建计划 - 分阶段对话的所有答案,按阶段整理:确认的验收标准(已标记为AC-1…,用于填充)、确认的数据模型(实体/字段/关系,用于填充
## 需求中的迁移目标,与功能规模匹配)、确认的技术栈/工具选择、API接口、授权模型和边缘情况。对于文档路径(跳过分阶段对话),视为## 构建计划,而非错误 3a. 推荐项 →"跳过分阶段设计,记录已做出的决策":必须做出并证明合理性的具体决策(与技术栈对齐的工具/提供商、会话模型等);做出每个决策,不要将其作为开放问题反馈。如果无推荐项,视为RECOMMEND_ITEMS_OR_NONE3b. 参考级别 →"none"(REFERENCES_LEVEL|none|sources,遵循上述规则)。如果Stage (c)从未执行且未询问,默认设置为sources+linksnone - 上下文文件内容:(根目录+功能区域的嵌套文件),或回退到
AGENTS.md,或"MISSING"CLAUDE.md - 现有规范列表(文件名+每个文件的第一行)
- 相关规范路径(预检查阶段标记)
- 解析后的规范位置()、下一个编号和形态:单文件
$SPEC_DIR,或目录$SPEC_DIR/NNNN-title.md($SPEC_DIR/NNNN-title/+index.md,总括性规范还有子规范)。总括性规范:编写指定的子决策;任何清单/审计报告存储在rationale.md中,绝不存储在rationale.md或代码树的其他位置。仅docs/scope/包含index.md行(与功能状态同步);子规范省略生命周期状态(规范内容由总括性规范管理)**Status**: - 源文件数量(是否有代码需要读取;对于大型ENHANCEMENT/CROSS-CUTTING代码库,根据Subagents将读取任务委托给subagent,并基于其返回的映射编写规范)
scout - 操作类型:|
create|updatesupersede - 当前日期(来自预检查阶段)
- 文档上下文(如果走"已构建"路径:工程师关于决策原因、替代方案和权衡的自由文本回答)
- 与当前功能相关的社区技能(来自预检查阶段的识别):仅当对决策有实质性影响时,按需打开技能文件;其约定在参考时具有权威性。在
AGENTS.md的实施技能字段中列出每个相关技能。## 决策
After the spec is written
规范编写完成后
Once the spec file exists, read and follow it for checking the spec yourself, reviewing it yourself, confirmation, status ratification, scope linking, and the final spoken summary. Do not read it before you write the spec.
internal/after-subagent.md规范文件生成后,读取并遵循其要求,自行检查规范、评审规范、确认、状态批准、范围关联和最终口头总结。编写规范前不得读取该文件。
internal/after-subagent.mdUpdate / Supersede path
更新 / 替代路径
If the task is to update or supersede an existing spec:
- Pre-flight: read the existing spec in full
- Skip the staged conversation if operation is in place update
- Set the operation: or
updatesupersede - If supersede: write the new spec AND update the old spec's status to
Superseded by [NNNN](NNNN-title.md)
如果任务是更新或替代现有规范:
- 预检查阶段:完整读取现有规范
- 如果是直接更新操作,跳过分阶段对话
- 设置操作类型:或
updatesupersede - 如果是替代:编写新规范,并将旧规范的状态更新为
Superseded by [NNNN](NNNN-title.md)
Ratify an assumed decision
批准假定决策
When the topic resolves to an existing spec (the engineer built first via 's escape hatch and is now ratifying, often phrased ), pre-flight will find that spec. Read it in full: its , , and tell you what was decided provisionally and where the code lives. Then run the normal design conversation, anchored to what was actually built, and deliberate the decision properly. Two outcomes:
Assumed/develop/architect <feature>: ratify …## Owed decision## Assumption built on## Code area- The assumption holds. Fill in the real decision content (Context, Options considered, Decision, Rationale, the design section, Consequences) so the spec becomes a genuine deliberated record, and clear : set the
Assumedline to the feature's lifecycle state (**Status**:if the feature is built but not yetIn Progress,doneif it is already verified and tested).Acceptedthen closes it to/developatAcceptedas usual. The decision is no longer ephemeral.done - The assumption was wrong. Write a corrected spec (or
create) with the real decision, mark the assumed specsupersede, and tell the engineer the build rests on a wrong assumption and should be redone against the corrected spec.Superseded by [NNNN](…)
Either way, ratification is why an spec can leave that state: records the assumption, confirms or corrects it and supplies the reasoning. Do not leave a spec after a ratify run.
Assumed/develop/architectAssumed当主题对应现有规范(工程师通过/develop的应急通道先构建,现在进行批准,通常表述为),预检查阶段会找到该规范。完整读取该规范:其、和会告知你临时做出的决策以及代码位置。然后运行正常的设计对话,基于实际构建内容进行锚定,正式审议决策。有两种结果:
Assumed/architect <feature>: ratify …## 待做决策## 构建基于的假设## 代码区域- 假设成立:填充真实的决策内容(背景、考虑的选项、决策、理由、设计部分、影响),使规范成为真正经过审议的记录,并清除状态:将
Assumed行设置为功能的生命周期状态(如果功能已构建但未标记为**Status**:则为done,如果已验证和测试则为In Progress)。/develop会在功能标记为Accepted时将其状态关闭为done。决策不再是临时的。Accepted - 假设错误:编写修正后的规范(或
create),记录真实决策,将假定规范标记为supersede,并告知工程师构建基于错误假设,应根据修正后的规范重新构建。Superseded by [NNNN](…)
无论哪种情况,批准流程都是规范脱离该状态的唯一方式:/develop记录假设,/architect确认或修正假设并提供理由。批准运行完成后,不得保留状态的规范。
AssumedAssumedReference files
参考文件
- Spec template: (the main thread reads it at write time)
spec-template.md - Spec writing rules & persona: (the main thread reads it at write time)
agent-prompt.md - Mode specific writing instructions: (read only the matching mode file, at write time)
agent-modes/*.md - Main thread design conversation: (read only for create/supersede)
internal/design-conversation.md - Agent Skill & MCP offer: (read only when the stack walk settles a new tool; it asks before it searches, and the registry fetch then runs in a
internal/tool-discovery.mdsubagent)researcher - Main thread completion flow: (read only after the spec is written)
internal/after-subagent.md - The staged design conversation is generated per feature (see Staged design conversation, stages a to f), not stored; there are no canned question lists. If a topic is too vague to generate from, narrow it first (scope validation, or one clarifying question), never fall back to generic MCQs
- 规范模板:(主线程在编写时读取)
spec-template.md - 规范编写规则与角色:(主线程在编写时读取)
agent-prompt.md - 模式特定编写说明:(仅读取匹配的模式文件,编写时读取)
agent-modes/*.md - 主线程设计对话:(仅创建/替代操作时读取)
internal/design-conversation.md - Agent Skill & MCP指南:(仅当技术栈分析确定需要新工具时读取;搜索前会询问,然后由
internal/tool-discovery.mdsubagent执行注册表获取)researcher - 主线程完成流程:(仅规范编写完成后读取)
internal/after-subagent.md - 分阶段设计对话根据功能生成(参见分阶段设计对话,阶段a至f),不存储;无固定问题列表。如果主题过于模糊无法生成问题,先缩小范围(范围验证,或一个澄清问题),绝不回退到通用多项选择题