claude-code-architect-designer
判断哪种 Claude Code 扩展能解决某个场景(skill、子智能体、规则、hook、MCP 服务器、权限或 mod),并在你批准之后才写文件。
claude-code-architect-designer,逐节说明
skill 自己的 SKILL.md 的各个章节,节选。悬停或点击一个章节,查看它引用的项目规则、模板和 references/ 文件。章节也是标签:点击即可跳转。
## Current inventory
Skills: !ls "${CLAUDE_PROJECT_DIR:-.}/.claude/skills"
Agents: !ls "${CLAUDE_PROJECT_DIR:-.}/.claude/agents"
Rules: !ls "${CLAUDE_PROJECT_DIR:-.}/.claude/rules"
Decision records (the latest is the most recent): !ls "${CLAUDE_PROJECT_DIR:-.}/.claude/decisions"
## Scenario
$ARGUMENTS
# Claude Code Architect Designer
Decides which of the nine forms of extension resolves the scenario, and writes it. The nine:
| # | Form | File |
|---|---|---|
| 1 | Auto-invocable skill | .claude/skills/<name>/SKILL.md |
| 2 | Manually-invoked skill (/name) | same, with disable-model-invocation: true |
| 3 | Subagent | .claude/agents/<name>.md |
| 4 | Rule | .claude/rules/<name>.md |
| 5 | CLAUDE.md section | root CLAUDE.md |
| 6a | MCP server, shared | .mcp.json |
| 6b | MCP server, one agent only | mcpServers: in that agent's frontmatter |
| 7a | Hook for the whole session | hooks block of .claude/settings.json |
| 7b | Hook only while one skill or agent runs | hooks: in that file's frontmatter |
| 7c | The executable behind 7a/7b | new mode in .claude/hooks/ArchHook.java |
| 8 | Hard prohibition or standing permission | permissions.deny / permissions.allow |
| 9 | Mod — draws in the interface what 7 and 8 already decide | .claude/mods/<name>/ |
6b isn't a fourth reason to write an agent — it's reason 2 of § 5 of the decision matrix (restrict tools) applied to an external connection instead of a built-in one. An agent only exists in the first place per the three reasons already in references/decision-matrix.md § 5; 6b just answers which tools it gets once that's settled.
… 此处截断,其余见文件
## Why this is a skill and not a rule
This is a multi-step procedure — interview, classify, propose, write — hence a skill. As a rule it would break invariant 1 of @CLAUDE.md: a rule about when to create skills and agents would have to mention skills and agents, and rules/ is a leaf.
Pinned to opus: what it designs is enforced in every later session (@.claude/decisions/0081-skill-model-required-per-class.md).
### Phase 1 · Interview
Read references/decision-matrix.md and @docs/pt-br/11-pitfalls.md before asking — the matrix decides the form, the pitfalls page says which silent traps (the runtime's and this repository's: territories, frozen folders, ownership splits) the design must not walk into. Use AskUserQuestion — at most 4 questions per call, so 2 to 3 calls. Don't proceed with a missing answer: each axis below eliminates candidate forms, and an unanswered axis leaves the decision guessing.
… 此处截断,其余见文件
### Phase 2 · Classify
Apply the decision table in references/decision-matrix.md (§ 2; § 2.1 whenever axis 2 named an external system; § 2.2 whenever axis 7 answered that the rule cannot fail; § 2.3 whenever axes 18-20 applied). Then run the eleven invariants of @CLAUDE.md as a veto — the most commonly violated are 1 (a rule that mentions a skill), 5 (an agent without one of the three reasons), 6 (prose where a guarantee was available, and its mirror: a hook for something the model gets right on its own — and, for Form 9, a mod standing in for the guarantee), 2 for Form 9 (a rule restated in TypeScript instead of read from ArchHook.jar), and, for MCP, 11 (a literal secret in .mcp.json). A proposal that fails an invariant is not presented as viable: it appears with the score it deserves and the reason for rejection.
### Phase 3 · Propose — write nothing
Two to four options, ordered by score, always including the "create nothing" hypothesis when it is defensible. Each in this form, in this order:
- Title — proposed filename, in kebab-case
- Motivator — the interview axis that justifies it
- Pros
- Cons — includes the invariant it strains, if any
- Score 0-10 — rubric in
references/decision-matrix.md, § Rubric - Visual — file tree or ASCII graph of who calls whom
- CI — axis 17's answer for this option, one of three: the existing job and step that
And at the end, a references table: for each decision, the concrete source (@claude-help.md § N, @CLAUDE.md invariant N, or the repo file that serves as precedent). A claim about the runtime without a source is decoration — cut it.
### Phase 3.5 · Save the decision draft
What Phase 3 produced — options, scores, rejected alternatives, the references table — evaporates at the end of the session. Six months from now nobody knows why the piece is a skill and not an agent, and the twenty-axis interview starts over from scratch.
When to save a file. Only if at least one of these is true:
- Two or more options scored ≥ 5 — there was a real choice.
- The top-scoring option strains an invariant of
@CLAUDE.md. - Axis 8 answered "both" — the piece also goes to the generated project.
- Axis 13 answered "both" — the MCP server is declared in
.mcp.jsonand in - The approved option is Form 7c or Form 8 — always, with no exception. A new mode in
- The approved option is Form 9 — always, too. A mod adds a second language, a
… 此处截断,其余见文件
### Phase 4 · Write — only after approval
- Generate from the
templates/exemplar matching the approved form. For Form 6a, the - Frontmatter: native fields only, list in
references/frontmatter-fields.md. An - No
metadata:in frontmatter. Ownership,reads, and handoff go in the## Contract - Code boilerplate goes to
templates/<name>.exampleinside the skill that emits it, - No literal secret, ever, in a
.mcp.jsonthis skill writes or edits — invariant ${VAR}/${VAR:-default},oauth, orheadersHelperonly. If the interview's- Forms 7 and 8 — five rules, none of them optional. They execute; a mistake here
… 此处截断,其余见文件
### Phase 5 · Report
Files created, files changed, the decision record path (or the sentence explaining why there wasn't one), the validate and schema output, the CI line — the job and step that cover the piece, the test step 9 wrote with its green and red runs, or the reason nothing is testable — and — whenever a hook or a permissions rule was written — the restart warning, in its own line: .claude/settings.json is read only at session startup, so nothing written in Forms 7a or 8 takes effect until claude is restarted. Say it even if the user already knows; a hook believed to be active and silently absent is worse than no hook. For Form 9 the same line, plus two: the marketplace registers only once the folder's workspace trust was accepted, and a mod edited in a git worktree does not load from there — the relative marketplace path resolves against the main checkout.
## Out of scope
~/.claude/settings.json and .claude/settings.local.json. Personal and machine-local configuration, same exclusion as local-scope MCP below: not versioned, not shared, not this skill's concern. A hook the team doesn't get isn't enforcement, it's one person's habit. settings.local.json in particular is where a permission granted mid-session lands — moving one of those into the versioned file is a decision the user makes, and this skill only writes it when asked outright.
A second hook file. Form 7c is a mode inside ArchHook.java, never .claude/hooks/<Other>.java. Enforcement stays in one executable that the generated project receives whole from the export mode; a second file would have to be copied, registered, and kept in sync separately, and the first one to fall out of sync fails silently. A Form 9 mod is not one: it enforces nothing, calls ArchHook.jar for every answer it shows, and nothing breaks when it does not load.
A mod as the guarantee, or a mod in the generated project. A mod does not load in claude -p, VS Code, a cloud session or under --safe-mode, so a rule that must always hold stays Form 7 or 8 (invariant 6). And nothing under .claude/mods/ travels: a project would inherit a second language, a version floor and an unsandboxed process its owner never reviewed (0131). Changing that is a new decision, not a propagation row.
The built-in plugin-authoring skill and ~/.claude/dev-mods/. Same reason as the skill-creator plugin below: it writes a generic mod into a personal directory the next cleanup deletes, with no knowledge of the mods block, the marketplace or the guarantee a mod must sit on.
… 此处截断,其余见文件
它读什么、写什么、拒绝什么
skill 自己的契约,取自 SKILL.md,保留原文。
Class
meta — the territory is skill_classes.meta in @.claude/schemas/extensions.json: the .claude/ tree, the root CLAUDE.md, .mcp.json, the MCP setup doc, and the three derived places a new piece propagates into — docs/ (the reference pages that describe a hook or a class), .github/ (the workflow step that runs a new check) and the root README.md (its piece counts and lists, 0163). ArchHook.java guard enforces it, which is the reason the guard is registered in this meta-repository at all. A new skill is incomplete until a class in skill_classes lists it — schema fails by name otherwise (Phase 4, step 8).
Reads
@claude-help.md, @CLAUDE.md (the eleven invariants), @docs/pt-br/11-pitfalls.md (every silent trap, runtime and repository), @.claude/rules/00-index.md, @.claude/blueprints/_schema.md when the decision touches blueprints, and the inventory injected at the top. Reads this skill's references/ before classifying — the matrix is deliberately not in the body — and .github/workflows/*.yml for axis 17, since references/ci-coverage.md quotes them and they win where the two disagree.
Writes
.claude/skills/, .claude/agents/, .claude/rules/, the root CLAUDE.md and README.md of this repository, .mcp.json at this repo's root (Form 6a), the hooks and permissions blocks of .claude/settings.json (Forms 7a and 8), and .claude/hooks/ArchHook.java plus the lists it reads in .claude/schemas/extensions.json (Form 7c), .claude/mods/ and the extraKnownMarketplaces and enabledPlugins keys of .claude/settings.json (Form 9), .claude/blueprints/ when the approved option changes a convention a blueprint owns, and — for the CI item of whichever form was approved (Phase 4 step 9) — the tests in .claude/.ci/, the jobs of .github/workflows/**, the matching rows of docs/*/07-ci-validate.md, and, when axis 8 = "both", project-bootstrap/templates/ci.yml.example and ci-gradle.yml.example. Only after explicit approval.
Also writes
.claude/decisions/NNNN-<slug>.md — and this is the only path it touches *before* approval, as the Phase 3.5 draft. It is the exclusive owner of the directory: no other piece writes there, and nothing inside it is a rule.
Does not write
.claude/settings.local.json, ~/.claude/settings.json, ~/.claude.json, a hook file other than ArchHook.java, nor project Java code. Does not create .claude/commands/. Never writes a literal secret into .mcp.json — invariant 11; a static credential from axis 12 becomes a ${VAR} placeholder plus a line in the companion setup doc, never a value.
Does not
reproduce rules. A new rule is a file in rules/ with a single owner — never prose inside a SKILL.md. Nor does it hardcode a list into ArchHook.java: every name, path, and pattern a Form 7c mode reads lives in .claude/schemas/extensions.json, invariant 10.
Delegates
at most step 8 of Phase 4 (propagation), and only when axis 8 or axis 13 is "both", a decision record has been saved, and the approved form is not 7 or 8. Classifying, proposing, writing the body, and writing the CI check (step 9) always stay in this thread — the subagent doesn't receive the conversation, and the interview is the heart of the task.
Stays out of the generated project
It's a creation skill, like project-bootstrap and init-project: whoever clones an already-generated project has no extensions to design. The same applies to .claude/decisions/ — it records decisions about this meta-repository.
来源:SKILL.md § Contract(nerviz e4cae27)。
guard 如何处理它
meta 是这个 skill 的类别,左侧的列表就是它的领地。skill 在自己的提示上运行时阶段打开,ArchHook 对照这份列表判断每一次写入。右侧的文字是 hook 自己输出的。
claude-code-architect-designer 的 write_allow
- ✓
.claude/** - ✓
CLAUDE.md - ✓
README.md - ✓
.mcp.json - ✓
MCP-SETUP.md - ✓
docs/** - ✓
.github/** 当 skill 自己打开阶段时,此列表之外的任何路径
拒绝以退出码 2 结束,消息回到模型。
> /claude-code-architect-designer … UserPromptSubmit guard prompt exit 0 # phase opened: claude-code-architect-designer (class meta) # write_allow: .claude/**, CLAUDE.md, README.md, .mcp.json, MCP-SETUP.md, docs/**, .github/**
PreToolUse Write(CLAUDE.md) guard write exit 0
PreToolUse Write(pom.xml) guard write exit 2 ❌ `claude-code-architect-designer` is class `meta` — pom.xml is outside its territory. write_allow: .claude/**, CLAUDE.md, README.md, .mcp.json, MCP-SETUP.md, docs/**, .github/** Put the content in the spec as a code block, or finish the run and invoke the skill that owns this path. If the path is legitimately this skill's, widen skill_classes.meta in .claude/schemas/extensions.json — retrying will not help.
由谁调用
它不是某条链上的步骤。它由自己的提示 /claude-code-architect-designer 启动,guard 像对待其他 skill 一样对待它:阶段打开,其类别的领地生效。