c3
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseC3
C3
Single skill for all C3 architecture operations.
一款可处理所有C3架构操作的工具。
CLI
CLI
Binary: (relative to this skill's directory)
bin/c3x.shAll CLI calls:
bash
bash <skill-dir>/bin/c3x.sh <command> [args]| Command | Purpose |
|---|---|
| Scaffold |
| Topology: entities, relationships, frontmatter ( |
| Structural validation: broken links, orphans, duplicates ( |
| Create entity with auto-numbering + wiring ( |
Types for : , , ,
addcontainercomponentrefadr二进制文件:(相对于本工具的目录)
bin/c3x.sh所有CLI调用方式:
bash
bash <skill-dir>/bin/c3x.sh <command> [args]| 命令 | 用途 |
|---|---|
| 使用模板快速搭建 |
| 查看拓扑结构:实体、关系、前置信息(支持 |
| 结构验证:检查断链、孤立项、重复内容(支持 |
| 创建带自动编号和关联配置的实体(支持 |
addcontainercomponentrefadrIntent Classification
意图分类
| Keywords | Op | Reference |
|---|---|---|
| adopt, init, scaffold, bootstrap, onboard, "create .c3", "set up architecture" | onboard | |
| where, explain, how, diagram, trace, "show me", "what is", "list components" | query | |
| audit, validate, "check docs", drift, "docs up to date", "verify docs" | audit | |
| add, change, fix, implement, refactor, remove, migrate, provision, design | change | |
| pattern, convention, "create ref", "update ref", "list refs", standardize | ref | |
| impact, "what breaks", assess, sweep, "is this safe" | sweep | |
| 关键词 | 操作 | 参考文档 |
|---|---|---|
| adopt, init, scaffold, bootstrap, onboard, "create .c3", "set up architecture" | onboard(接入) | |
| where, explain, how, diagram, trace, "show me", "what is", "list components" | query(查询) | |
| audit, validate, "check docs", drift, "docs up to date", "verify docs" | audit(审计) | |
| add, change, fix, implement, refactor, remove, migrate, provision, design | change(变更) | |
| pattern, convention, "create ref", "update ref", "list refs", standardize | ref(规范管理) | |
| impact, "what breaks", assess, sweep, "is this safe" | sweep(影响评估) | |
Dispatch
调度流程
- Analyze request -> classify op from table above
- Ambiguous -> with 6 ops as options
AskUserQuestion - Load (Read file relative to this skill's dir)
references/<op>.md - Execute per reference instructions
- Use Task tool for parallelism when reasoning suggests it helps (anonymous subagents)
- 分析请求 -> 根据上表分类操作类型
- 意图模糊时 -> 调用,提供6种操作选项供选择
AskUserQuestion - 加载(相对于本工具目录读取文件)
references/<op>.md - 根据参考文档的说明执行操作
- 当推理认为有帮助时,使用Task工具实现并行处理(匿名子代理)
Precondition
前置条件
Run before every operation (except onboard):
bash
bash <skill-dir>/bin/c3x.sh list --json- Fails or empty -> route to onboard
- Exception: onboard does NOT need existing
.c3/
每次操作前执行(onboard操作除外):
bash
bash <skill-dir>/bin/c3x.sh list --json- 执行失败或结果为空 -> 引导至onboard操作
- 例外情况:onboard操作不需要已存在的目录
.c3/
ASSUMPTION_MODE
ASSUMPTION_MODE(假设模式)
If is denied even once -> set for the rest of this session.
AskUserQuestionASSUMPTION_MODE = trueWhen is true:
ASSUMPTION_MODE- NEVER call again
AskUserQuestion - High-impact decisions: state assumption clearly, mark
[ASSUMED] - Low-impact decisions: auto-proceed silently
- Every instruction that says "Use AskUserQuestion" becomes "make your best assumption and mark [ASSUMED]"
如果被拒绝一次 -> 本次会话剩余时间内设置
AskUserQuestionASSUMPTION_MODE = true当为true时:
ASSUMPTION_MODE- 不再调用
AskUserQuestion - 高影响决策:明确说明假设内容,并标记
[ASSUMED] - 低影响决策:自动静默执行
- 所有要求"使用AskUserQuestion"的指令变为"做出最佳假设并标记[ASSUMED]"
Shared Rules
通用规则
Complexity-First Documentation:
| Level | Signals | Doc Depth |
|---|---|---|
| trivial | Single purpose, stateless | Purpose + deps only |
| simple | Few concerns, basic state | + key components |
| moderate | Multiple concerns, caching | + discovered aspects |
| complex | Orchestration, security-critical | Full aspect discovery |
| critical | Distributed txns, compliance | Comprehensive + rationale |
Red Flags — STOP Immediately:
- Editing code without ADR -> create ADR first
- Guessing user intent -> (skip if ASSUMPTION_MODE)
AskUserQuestion - Jumping to component -> start from Context down
- Updating docs without code check -> verify code first
Component Categories:
- Foundation (01-09): infrastructure, required
## Code References - Feature (10+): business logic, required
## Code References - Ref: conventions only, NO
## Code References
Layer Navigation: Always top-down: Context -> Container -> Component
File Structure:
.c3/
├── README.md # Context (c3-0)
├── adr/ # Architecture Decision Records
│ └── adr-YYYYMMDD-slug.md
├── refs/ # Cross-cutting patterns
│ └── ref-slug.md
└── c3-N-name/ # Container
├── README.md # Container overview
└── c3-NNN-component.md # Component doc复杂度优先文档规范:
| 级别 | 特征 | 文档深度 |
|---|---|---|
| trivial(trivial级) | 单一用途、无状态 | 仅记录用途和依赖 |
| simple(simple级) | 少量关注点、基础状态 | + 关键组件说明 |
| moderate(moderate级) | 多个关注点、带缓存 | + 已发现的细节 |
| complex(complex级) | 编排逻辑、安全关键 | 完整的细节挖掘 |
| critical(critical级) | 分布式事务、合规要求 | 全面文档+决策依据 |
红色警报 — 立即停止:
- 未创建ADR就编辑代码 -> 先创建ADR
- 猜测用户意图 -> 调用(假设模式下跳过)
AskUserQuestion - 直接跳到组件层面 -> 从上下文逐层向下分析
- 未检查代码就更新文档 -> 先验证代码
组件分类:
- Foundation(01-09):基础设施,必须包含章节
## Code References - Feature(10+):业务逻辑,必须包含章节
## Code References - Ref:仅规范说明,不需要章节
## Code References
层级导航:始终自上而下:Context -> Container -> Component
文件结构:
.c3/
├── README.md # Context(c3-0)
├── adr/ # 架构决策记录(Architecture Decision Records)
│ └── adr-YYYYMMDD-slug.md
├── refs/ # 跨领域模式
│ └── ref-slug.md
└── c3-N-name/ # Container
├── README.md # Container概述
└── c3-NNN-component.md # 组件文档Operations
操作详情
onboard
onboard(接入)
- Pre: No or user wants re-onboard
.c3/ - Flow: -> Socratic discovery (3 stages: Inventory -> Details -> Finalize) -> gate each stage
c3x init - Post: Inject CLAUDE.md routing, show capabilities overview
- Details: Load
references/onboard.md
- 前置条件: 无目录或用户需要重新接入
.c3/ - 流程: -> 苏格拉底式发现(3个阶段:盘点 -> 细节完善 -> 最终确认) -> 每个阶段都需确认
c3x init - 后置操作: 向项目CLAUDE.md中注入路由信息,展示功能概览
- 详细说明: 加载
references/onboard.md
query
query(查询)
- Pre: exists (precondition check)
.c3/ - Flow: -> match entity -> Read doc -> explore code
c3x list --json - Subagents: parallel container exploration when multi-scope
- Details: Load
references/query.md
- 前置条件: 目录存在(已通过前置条件检查)
.c3/ - 流程: -> 匹配实体 -> 读取文档 -> 探索代码
c3x list --json - 子代理: 多范围查询时并行探索容器
- 详细说明: 加载
references/query.md
audit
audit(审计)
- Pre: exists (precondition check)
.c3/ - Flow: (structural) ->
c3x check(inventory) -> Phases 2-10 (semantic via Read+Grep+reasoning)c3x list --json - Output: Table of phases with PASS/WARN/FAIL + action items
- Details: Load
references/audit.md
- 前置条件: 目录存在(已通过前置条件检查)
.c3/ - 流程: (结构检查) ->
c3x check(盘点) -> 第2-10阶段(通过读取+匹配+推理进行语义检查)c3x list --json - 输出: 各阶段结果表格,包含PASS/WARN/FAIL + 行动项
- 详细说明: 加载
references/audit.md
change
change(变更)
- Pre: exists (precondition check)
.c3/ - Flow: -> impact analysis -> ADR (
c3x list --json) -> user approves -> execute (c3x add adr <slug>for scaffolding) -> audit (c3x add component/ref+ verify)c3x check - Provision gate: after ADR approval, ask implement now or design only
- Details: Load
references/change.md
- 前置条件: 目录存在(已通过前置条件检查)
.c3/ - 流程: -> 影响分析 -> 创建ADR(
c3x list --json) -> 用户确认 -> 执行(c3x add adr <slug>生成脚手架) -> 审计(c3x add component/ref+ 验证)c3x check - 实施 gate: ADR批准后,询问用户是立即实施还是仅完成设计
- 详细说明: 加载
references/change.md
ref
ref(规范管理)
- Pre: exists (precondition check)
.c3/ - Modes: Add (-> fill -> discover usage -> update citings), Update (find citings -> check compliance -> surface impact), List (
c3x add ref <slug>-> filter type=ref), Usage (find citings from JSON)c3x list --json - Details: Load
references/ref.md
- 前置条件: 目录存在(已通过前置条件检查)
.c3/ - 模式: 添加(-> 填充内容 -> 发现用法 -> 更新引用处)、更新(查找引用处 -> 检查合规性 -> 展示影响)、列出(
c3x add ref <slug>-> 过滤type=ref)、使用情况(从JSON结果中查找引用处)c3x list --json - 详细说明: 加载
references/ref.md
sweep
sweep(影响评估)
- Pre: exists (precondition check)
.c3/ - Flow: -> identify affected entities -> parallel per-entity assessment via subagents -> synthesize constraints, risks, recommendations
c3x list --json - Advisory only — route to change for implementation
- Details: Load
references/sweep.md
- 前置条件: 目录存在(已通过前置条件检查)
.c3/ - 流程: -> 识别受影响的实体 -> 通过子代理并行评估每个实体 -> 综合约束条件、风险和建议
c3x list --json - 仅提供建议 — 如需实施,引导至change操作
- 详细说明: 加载
references/sweep.md
CLAUDE.md Injection (onboard)
CLAUDE.md注入(onboard操作后)
After onboard completes, inject into project CLAUDE.md:
markdown
undefinedonboard完成后,向项目CLAUDE.md中注入以下内容:
markdown
undefinedArchitecture
架构
This project uses C3 docs in .
For architecture questions, changes, audits -> .
Operations: query, audit, change, ref, sweep.
.c3//c3undefined本项目使用.c3/目录下的C3文档。
如需架构相关问题、变更、审计等操作,请输入。
支持的操作:query、audit、change、ref、sweep。
/c3undefinedCapabilities Reveal (onboard)
功能展示(onboard操作后)
Show after onboard:
undefinedonboard完成后展示以下内容:
undefinedYour C3 toolkit is ready
您的C3工具包已就绪
| Command | What it does |
|---|---|
| Ask about architecture |
| Validate docs |
| Modify architecture |
| Manage patterns |
| Impact assessment |
Just say + what you want.
/c3undefined| 命令 | 功能 |
|---|---|
| 咨询架构相关问题 |
| 验证文档有效性 |
| 修改架构 |
| 管理架构模式 |
| 评估变更影响 |
只需输入 + 您的需求即可。
/c3undefined