with one click
su-init
初始化项目级 CCB plugin 工作区,使 plugin 可脱离 Console 独立运行。
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Menu
初始化项目级 CCB plugin 工作区,使 plugin 可脱离 Console 独立运行。
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Based on SOC occupation classification
Fix bugs by reproducing the failure first, making the smallest correction, and proving the regression is covered. Use for bug reports, failing tests, and regressions.
Fix failing tests or CI by reading logs, identifying the smallest failing surface, making a minimal change, and rerunning targeted verification. Use when given CI logs, failing commands, or broken checks.
Scan relevant source, tests, commands, and existing project patterns before editing code. Use before non-trivial implementation, bug fixing, or refactoring when the right local pattern is unclear.
Control error handling, defaults, retries, compatibility paths, and fallback behavior. Use before adding catch blocks, defaults, shims, optional values, retries, or graceful degradation.
Prevent large-file growth and mixed-responsibility edits. Use when adding significant logic to a large file, mixed-purpose module, or file with repeated conditionals.
Implement the smallest safe repo-native code change for the requested behavior. Use for feature work, small refactors, and multi-file implementation tasks.
| name | su-init |
| description | 初始化项目级 CCB plugin 工作区,使 plugin 可脱离 Console 独立运行。 |
| metadata | {"short-description":"CCB 项目初始化"} |
/ccb:su-init 用于把一个普通项目初始化为 CCB plugin 可工作的项目。它创建项目内工作记录、索引入口、agent 协作说明和必要目录,让后续 /ccb:su-flow 不依赖 Console 也能运行。
su-init 不直接进入业务节点,但必须安装或校验节点 manifest:
| 节点 | Manifest |
|---|---|
| 需求分析 | references/kernel/nodes/requirement_analysis.node.md |
| 技术设计 | references/kernel/nodes/technical_design.node.md |
| 任务拆分 | references/kernel/nodes/task_breakdown.node.md |
| 派工 | references/kernel/nodes/dispatch.node.md |
| 实施 | references/kernel/nodes/implementation.node.md |
| 审查 | references/kernel/nodes/review.node.md |
| 归档 | references/kernel/nodes/archive.node.md |
初始化完成后,用户可直接调用 /ccb:su-flow 进入业务节点。
/ccb:su-init
/ccb:su-init project=<name>
运行时先扫描当前目录,确认是否已有 docs/.ccb/ 和 agent 说明文件。已有文件不得静默覆盖;命中覆盖用户文件时跳过并在摘要中报告。
收到本指令后必须调用 plugin lib 或同等 CLI,不得手写一套脚手架流程:
import { initProjectScaffold } from "../../lib/su-init/index.mjs";
const result = await initProjectScaffold({ projectRoot });
CLI 形式:
node <plugin>/skills/su-init/scripts/init.mjs --project-root <projectRoot>
initProjectScaffold() 返回的 summary.architectureCandidates 是旧项目架构生成的唯一入口判定。不得在 skill 内复制候选发现算法;需要复核时直接从 lib 导入 detectArchitectureCandidates。
返回字段按 lib 实际接口消费:
mode、reason、candidates、overviewTargetPath、overviewExisting、excluded、scopeConflicts、existingArchitectureDocs、capLimit。id、path、kind、disposition、confidence、evidence、targetPath、existing。处理流程:
summary.architectureCandidates。mode === "skip":不生成架构文档;回执说明 reason:
no_source:未检测到源码候选。architecture_exists:docs/01_架构设计/ 下存在无 architecture_scope 的非模板 .md,保守跳过。
同时带上 existingArchitectureDocs、excluded、scopeConflicts(非空时)。mode === "single":只处理 candidates 中 disposition === "generate" 的候选。若候选 existing === true,终态记 existing,不写文件;否则进入候选证据门槛,通过后按候选 targetPath 生成一份子架构文档。mode === "layered":按候选 id 字典序逐个处理。每个 disposition === "generate" 且未 existing 的候选独立走证据门槛;不足则终态记 evidence_insufficient 并继续其余候选;全部子架构处理完后再生成总架构。mode === "overview_only":不生成子架构;仅按 overviewTargetPath 生成总架构,内容包含全部候选清单、excluded、scopeConflicts 和点名补生成提示。若 overviewExisting === true,总架构终态记 existing,不得覆盖。kind === "submodule" 的候选终态记 submodule,只进入总架构清单,不生成子架构;disposition === "list_only" 的非 submodule 候选终态记 list_only。excluded 单独进入回执:framework_shell_merged 映射为 shell_merged,root_aggregator 映射为 aggregator_excluded;其它 excluded reason 原样列在 excluded 摘要里。候选证据门槛:
path 为源码根收集证据,不把其它候选目录的证据混入本候选。evidence 指向的运行/部署/入口证据、或 SC 结构分析结果。evidence_insufficient,回执列缺少哪类证据并建议用户手写或点名补充。/sc:analyze + /sc:index-repo 获取结构证据;SC 不可用时,直接读取 README、入口文件、依赖 manifest、候选 evidence 和目录树兜底。子架构渲染:
templates/docs/01_架构设计/_模板_架构.md 的章节结构渲染,只填有据章节。path,并在 layered 模式下指向总架构。scope frontmatter 必须写单行 inline list:
---
doc_type: architecture
updated: YYYY-MM-DD
generated_by: su-init-ai
human_verified: false
architecture_scope: <子系统 slug>
scope_source_roots: ["apps/web", "src-tauri"]
---
总架构固定使用:
---
doc_type: architecture
updated: YYYY-MM-DD
generated_by: su-init-ai
human_verified: false
architecture_scope: overview
scope_source_roots: ["."]
---
architecture_scope: 子系统 slug;系统总架构固定为 overview。
scope_source_roots: 仓库相对路径数组,必须写单行 inline list,如 ["apps/web", "src-tauri"]。
不要写多行 YAML 数组,行级 parser 会 partial。
不得写 status 字段,不得生成 02_需求、04_模块规格等其它文档。
总架构固定渲染 profile:
_模板_架构.md 的固定章节:一、二、五、六、十一。写盘纪律:
import { detectArchitectureCandidates } from "../../lib/su-init/index.mjs";
const latest = await detectArchitectureCandidates({ projectRoot });
architecture_scope 的非模板架构 md」中止;本轮已写入的 scoped 文档会在后续检测中表现为 existing,不算形状变化。id 字典序逐个 final-path 写入;总架构最后写。targetPath 或 overviewTargetPath。目标路径是项目内相对路径,写盘时拼到 projectRoot 下。await writeFile(targetPath, content, { encoding: "utf8", flag: "wx" });
或等价的 open(targetPath, "wx")。禁止使用 safeWriteFile 或任何 temp + rename helper,因为 final rename 可能覆盖竞态文件。
6. 如果单文件写盘返回 EEXIST 或失败,该文件终态记 skipped 并说明原因,继续其余候选;不得覆盖、不得重试改名。
7. 若补写了新子架构但 overviewExisting === true,不得改旧总架构;回执必须提示总架构可能缺少新链接,建议用户对话补改。
回执契约:
generated、existing、evidence_insufficient、list_only、submodule、shell_merged、aggregator_excluded。generated、existing;未尝试生成时说明原因。mode、reason、existingArchitectureDocs、scopeConflicts、excluded(非空时)。overview_only 必须列全部候选和点名补生成指引;超出 capLimit 时说明本轮只生成总架构。初始化的目标是让项目没有 Console 也能工作。至少创建或校验:
docs/00_项目总览.mddocs/01_架构设计/ ~ docs/06_决策记录/、docs/99_归档/_模板_*.mddocs/.ccb/docs-structure-contract.yamldocs/.ccb/index/docs/.ccb/events/journal.jsonldocs/.ccb/locks/docs/.ccb/drafts/breakdown/docs/.ccb/schemas/docs/.ccb/config/CLAUDE.md / AGENTS.md / .claude/settings.json 协作说明,按项目实际存在情况处理docs/00_文档地图.md 由 indexer 自动生成,su-init 不手填。
不得调用 Console 业务写入接口初始化业务状态。
su-init 是管理指令,不强制进入业务节点协商。但如果初始化过程中需要决定项目结构、覆盖文件、引入外部服务或改变用户已有配置,必须按必问清单问用户。
建议使用:
/sc:analyze --focus project-structure ./sc:research <项目技术栈>(需要判断技术栈时)sc 不可用时,说明替代扫描方式。
输出初始化摘要、创建/保留/跳过的文件、未覆盖原因、下一步建议和可直接运行的 /ccb:su-flow 示例。
若触发旧项目架构生成流程,回执还必须包含:
architectureCandidates.mode / reason,并带上 existingArchitectureDocs、scopeConflicts、excluded(非空时)。id、path、kind、disposition、confidence、终态和文档路径;证据不足使用 evidence_insufficient 并列缺少哪类证据;目标文件竞态存在时说明 EEXIST / 已存在且未覆盖。overview_only 时:列全部候选、总架构状态、超限或全 list-only 原因,以及可点名补生成的候选 id。