用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/imbue-ai/code-guardian --skill verify-architecture命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
基于 SOC 职业分类
正在显示 SKILL.md
| name | verify-architecture |
| description | Assess whether the approach taken on a branch is the right way to solve the problem. |
| allowed-tools | Bash(git rev-parse *), Bash(git diff *), Bash(git log *), Bash(git show *), Bash(git ls-tree *), Bash(git -C * rev-parse *), Bash(git -C * diff *), Bash(git -C * log *), Bash(git -C * show *), Bash(git -C * ls-tree *), Bash(ls *), Bash(find *), Bash(grep *), Bash(echo "${GIT_BASE_BRANCH:-main}"), Bash(echo "${CODE_GUARDIAN_STOP_HOOK__BASE_BRANCH:-}"), Bash(date -u +%Y-%m-%dT%H:%M:%SZ), Read, Write, Agent, AskUserQuestion |
Assess whether the approach taken on this branch is the right way to solve its problem. Specifically: does it fit existing codebase patterns and information flow, does it introduce unnecessary coupling or implicit dependencies, and is there a better alternative?
This command runs once per stop cycle and covers every reviewed directory -- the root repo plus any stop_hook.additional_git_directories. Do not run it separately per directory. Each reviewed repo is self-contained (its own git repo, base branch, and .reviewer/ markers), but the analysis agent evaluates them together, in a single pass, so it can reason about how the repos fit as one change (including any surface they share).
Read .reviewer/settings.json (and .reviewer/settings.local.json if present). Collect stop_hook.additional_git_directories (may be empty), dropping any entry that does not exist on disk -- the list is shared config, and a nested repo is only present in the checkouts working on it. The target directories are . (root) followed by each remaining additional dir.
For each target dir {dir}, read its base branch (stop_hook.base_branch) using the hook's own precedence: ${CODE_GUARDIAN_STOP_HOOK__BASE_BRANCH} for the root dir only, then {dir}/.reviewer/settings.local.json, then {dir}/.reviewer/settings.json, then main. The env var is an agent-scoped override for the agent's own repo, so the hook blanks it for every other dir -- honoring it there would let the root's base leak into a secondary repo. Every dir's settings resolve through the .local.json sibling, not just the root's: that file is gitignored and wins, so reading only the committed one gives you the wrong answer whenever a worktree overrides something. Determine whether it has reviewable changes: git -C {dir} diff --name-only {base}...HEAD shows at least one non-.md file.
Do not read any dir's gate toggles (autofix.is_enabled, verify_architecture.is_enabled, ci.is_enabled). Which gates apply to which dir is the stop hook's decision, made in stop_hook_gates.sh; a dir is in the review set here purely because it has changes.
Keep only the target dirs with reviewable changes -- the review set.
If the review set is a single dir (the root), the flow below is exactly the classic single-repo flow with {dir} = ..
If you do not already know what a target dir's branch is supposed to accomplish, STOP and ask the user before continuing.
For each dir in the review set, write a CONCISE description of the problem that dir's branch is trying to solve, based on your knowledge of the work so far. This description must contain ONLY the problem -- not any part of the solution. Describe what should work differently afterward, what is currently broken, or what structural problem exists. Do not mention any mechanism, technique, data structure, or approach used to fix it. The analysis agent evaluates the approach independently, so any hint about the implementation will bias its judgment.
echo "${GIT_BASE_BRANCH:-main}" (root default; each dir uses its own configured base)git rev-parse HEADSpawn ONE validate-diff Agent, giving it the whole review set: for each dir, its path, base branch, and problem description.
Based on its response:
Resolve each dir's base commit hash (git -C {dir} rev-parse {base_branch}) and tip hash (git -C {dir} rev-parse HEAD).
Spawn a single analyze-architecture Agent, providing it with the whole review set: for each dir, its path, problem description, base commit hash, and tip commit hash.
Relay the agent's findings to the user, grouped by directory, plus its cross-repo observations when more than one dir was analyzed. Report every point from the fit, unexpected choices, and verdict sections. Don't reproduce the structural footprint section on its own -- the user already knows what they built -- but reference specific details from it where needed to make the other points clear.
Architecture verification is per-branch. For EACH dir in the review set, after reporting, create its verification marker so the stop hook knows architecture has been verified for that dir's branch. Get the branch name and timestamp:
git -C {dir} rev-parse --abbrev-ref HEAD
date -u +%Y-%m-%dT%H:%M:%SZ
Replace any / in the branch name with _ (e.g., mngr/my-feature becomes mngr_my-feature). Then use the Write tool (without checking if the directory exists) to create {dir}/.reviewer/outputs/architecture/{sanitized_branch_name}.md with the content Verified at {timestamp}.
Architecture verification is per-branch, not per-commit. You do NOT need to re-run it after every commit. However, if you later make changes that fundamentally alter the approach (new abstractions, changed data flow, different module boundaries) in any reviewed dir, you should run /verify-architecture again to confirm the new direction is sound.
For this particular run of the verify-architecture command, follow these adjustments from the user to the normal process:
$ARGUMENTS