project-audit

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

project-audit

project-audit

Deep diagnostic of Claude/SDD configuration. Read-only. Produces a structured report that /project-fix consumes as its spec.
Triggers:
/project-audit
, audit project, review claude config, sdd diagnostic, project health check

对Claude/SDD配置进行深度诊断。只读模式。生成结构化报告,作为/project-fix的执行依据。
触发方式
/project-audit
、audit project、review claude config、sdd diagnostic、project health check

Role in SDD meta-config flow

在SDD元配置流程中的角色

This skill is the equivalent of the SPEC phase of the SDD cycle, applied to the project configuration:
/project-audit  →  audit-report.md  →  /project-fix  →  /project-audit (verify)
     (spec)           (artifact)          (apply)           (verify)
The generated report IS the specification that
/project-fix
implements. Without audit, there is no fix.
Absolute rule: This skill NEVER modifies files. It only reads and reports.

该技能相当于SDD周期中的SPEC阶段,应用于项目配置:
/project-audit  →  audit-report.md  →  /project-fix  →  /project-audit (验证)
     (规范)           (产物)          (执行)           (验证)
生成的报告是
/project-fix
执行的规范依据。没有审计就无法进行修复。
绝对规则:该技能绝不会修改文件,仅读取并报告信息。

Output artifact

输出产物

When finished, save the report at:
[project_root]/.claude/audit-report.md
This file persists between sessions and is the input for
/project-fix
.

完成后,将报告保存至:
[项目根目录]/.claude/audit-report.md
该文件会在会话间持久化,作为
/project-fix
的输入。

Audit Kernel

审计内核

project-audit
operates as a stable read-only kernel with three stages:
StageResponsibilityOutput
DiscoveryGather structural facts from the project and runtime environmentPresence/absence facts, path resolution, baseline metadata
EvaluationApply the dimension rules to the discovered facts and file contentsFindings, score, violations, required actions
Report generationRender the audit state into a persistent artifact
.claude/audit-report.md
The kernel is intentionally stable. Detailed dimension rules can evolve, but the command remains: discover, evaluate, report.

project-audit
以稳定的只读内核运行,包含三个阶段:
阶段职责输出
发现(Discovery)从项目和运行环境中收集结构事实存在/缺失事实、路径解析、基线元数据
评估(Evaluation)将维度规则应用于发现的事实和文件内容检查结果、评分、违规项、必要操作
报告生成将审计状态渲染为持久化产物
.claude/audit-report.md
内核设计为稳定不变。具体的维度规则可以迭代,但核心命令始终是:发现、评估、报告。

Dimension Classes

维度类别

project-audit
uses two dimension classes.
ClassDimensionsScore impactRole
Scored dimensionsD1, D2, D3, D4, D6, D7, D8Contribute to the 100-point scoreDetermine operational health and SDD readiness
Informational dimensionsD9, D10, D11, D12, D13, D14No base-score impactSurface quality debt, coverage gaps, and internal inconsistencies
Notes:
  • D5 was intentionally removed in an earlier change and is not part of the current model.
  • Informational dimensions may still emit actionable findings, but they do not change the base 100-point score unless a dimension explicitly states otherwise.

project-audit
使用两类维度。
类别维度对评分的影响角色
计分维度D1、D2、D3、D4、D6、D7、D8影响100分总分决定项目运行健康度和SDD就绪状态
信息维度D9、D10、D11、D12、D13、D14不影响基础评分暴露质量债务、覆盖缺口和内部不一致性
注意:
  • D5在早期版本中已被移除,不属于当前模型。
  • 信息维度仍会输出可操作的检查结果,但除非维度明确说明,否则不会改变100分的基础评分。

Compatibility Policy

兼容性策略

Compatibility behavior is a separate policy layer of
project-audit
, not an implicit side effect of individual dimensions.
Compatibility rules currently include:
  • Repo-shape compatibility: global-config repos may use root
    CLAUDE.md
    , and local skill discovery may resolve to
    skills/
    instead of
    .claude/skills/
    .
  • Historical terminology compatibility: archived materials may still mention older section labels, but active skill validation uses the canonical
    ## Process
    and
    ## Rules
    headings.
  • Non-scored extension compatibility: informational dimensions may evolve without changing the base scoring model.
This policy MUST be explicit whenever compatibility behavior affects how a finding is evaluated.

兼容性行为是
project-audit
的独立策略层,并非各个维度的隐式副作用。
当前兼容性规则包括:
  • 仓库结构兼容性:全局配置仓库可在根目录使用
    CLAUDE.md
    ,本地技能发现可解析至
    skills/
    而非
    .claude/skills/
  • 历史术语兼容性:归档材料可能仍提及旧版章节标签,但活跃技能验证使用标准的
    ## Process
    ## Rules
    标题。
  • 非计分扩展兼容性:信息维度可迭代,无需修改基础评分模型。
当兼容性行为影响检查结果的评估时,必须明确说明。

Process

流程

I run all dimensions systematically, reading real files. Never assume.

我会系统地运行所有维度,读取真实文件内容,绝不假设。

Dimension 1 — CLAUDE.md

维度1 — CLAUDE.md

Objective: Verify that the project's CLAUDE.md is complete, accurate, and enables SDD.
Project type detection (run before checks):
Check if the project is a
global-config
repo:
  • Condition A:
    install.sh
    +
    sync.sh
    exist at project root, OR
  • Condition B: project root contains
    skills/
    directory with SDD phase skills
If detected as global-config:
  • Accept
    CLAUDE.md
    at root as equivalent to
    .claude/CLAUDE.md
  • Note in report header:
    Project Type: global-config
  • The CLAUDE.md path check passes without penalty
Checks to run:
CheckHow I verifySeverity if fails
Exists
.claude/CLAUDE.md
(or root
CLAUDE.md
for global-config repos)
Attempt to read it❌ CRITICAL
Not empty (>50 lines)Count lines❌ CRITICAL
Has Stack sectionSearch for
## Tech Stack
or
## Stack
⚠️ HIGH
Stack matches package.json/pyproject.tomlRead both, compare key versions⚠️ HIGH
Has Architecture sectionSearch for
## Architecture
⚠️ HIGH
Has Skills registrySearch for skills table⚠️ HIGH
Has Unbreakable RulesSearch for
## Unbreakable Rules
or similar
⚠️ MEDIUM
Has Plan Mode RulesSearch for
## Plan Mode
ℹ️ LOW
Mentions SDD (any
/sdd-*
command)
Search for text
/sdd-
⚠️ HIGH
References to ai-context/ are correctVerify that mentioned paths exist⚠️ MEDIUM
For the stack: I read
package.json
(or equivalent), extract the 5-10 most important dependencies, and compare with what is declared in CLAUDE.md. I report specific discrepancies with declared version vs real version.
Template path verification (D1 additive check):
  1. Read CLAUDE.md and locate the
    ## Documentation Conventions
    section (or equivalent section referencing
    docs/templates/
    ).
  2. Extract all paths matching the pattern
    docs/templates/*.md
    from that section.
  3. For each extracted path, check whether the file exists on disk at
    [project_root]/[path]
    .
  4. Skip this check entirely if no
    docs/templates/*.md
    pattern is found in CLAUDE.md — no finding is emitted.
Scoring rule:
  • For each missing template path: emit a MEDIUM finding — "Template path referenced in CLAUDE.md does not exist on disk: [path]"
  • Add each missing path to
    required_actions.medium
    in the FIX_MANIFEST with
    type: create_file
    ,
    target: [path]
    ,
    reason: "Template path referenced in CLAUDE.md does not exist on disk"
  • One finding per missing path (multiple missing paths produce multiple separate findings)

目标:验证项目的CLAUDE.md是否完整、准确,并支持SDD。
项目类型检测(检查前运行)
检查项目是否为
global-config
仓库:
  • 条件A:项目根目录存在
    install.sh
    +
    sync.sh
    ,或者
  • 条件B:项目根目录包含
    skills/
    目录,且其中有SDD阶段技能
如果检测为global-config:
  • 接受根目录的
    CLAUDE.md
    作为
    .claude/CLAUDE.md
    的等效文件
  • 在报告头部标注:
    Project Type: global-config
  • CLAUDE.md路径检查自动通过,无惩罚
需执行的检查
检查内容验证方式失败时严重程度
存在
.claude/CLAUDE.md
(全局配置仓库可使用根目录
CLAUDE.md
尝试读取该文件❌ 严重
文件非空(超过50行)统计行数❌ 严重
包含技术栈章节搜索
## Tech Stack
## Stack
⚠️ 高
技术栈与package.json/pyproject.toml匹配读取两者内容,对比关键版本⚠️ 高
包含架构章节搜索
## Architecture
⚠️ 高
包含技能注册表搜索技能表⚠️ 高
包含不可破规则搜索
## Unbreakable Rules
或类似内容
⚠️ 中
包含计划模式规则搜索
## Plan Mode
ℹ️ 低
提及SDD(任何
/sdd-*
命令)
搜索文本
/sdd-
⚠️ 高
对ai-context/的引用正确验证提及的路径是否存在⚠️ 中
技术栈检查细节:我会读取
package.json
(或等效文件),提取最重要的5-10个依赖项,与CLAUDE.md中声明的内容对比,报告具体的版本差异。
模板路径验证(D1附加检查)
  1. 读取CLAUDE.md,定位
    ## Documentation Conventions
    章节(或引用
    docs/templates/
    的等效章节)。
  2. 提取所有匹配
    docs/templates/*.md
    模式的路径。
  3. 对每个提取的路径,检查
    [项目根目录]/[路径]
    是否存在。
  4. 如果CLAUDE.md中未找到
    docs/templates/*.md
    模式,则跳过此检查,不输出任何结果。
评分规则
  • 对于每个缺失的模板路径:输出中等严重程度的检查结果 — "Template path referenced in CLAUDE.md does not exist on disk: [path]"
  • 将每个缺失路径添加到FIX_MANIFEST的
    required_actions.medium
    中,类型为
    create_file
    ,目标为
    [path]
    ,原因:"Template path referenced in CLAUDE.md does not exist on disk"
  • 每个缺失路径对应一个检查结果(多个缺失路径会生成多个独立结果)

Dimension 2 — Memory (ai-context/)

维度2 — 内存层(ai-context/)

Objective: Verify that the memory layer exists, has substantial content, and is coherent with the real code.
Existence checks:
FileMinimum acceptable lines
ai-context/stack.md
> 30 lines
ai-context/architecture.md
> 40 lines
ai-context/conventions.md
> 30 lines
ai-context/known-issues.md
> 10 lines (can be brief if the project is new)
ai-context/changelog-ai.md
> 5 lines (at least one entry)
Content checks (for each file that exists):
  • stack.md: Does it mention the same versions as package.json? I look for the top-5 project dependencies and verify they are documented.
  • architecture.md: Does it mention directories that actually exist in the project? I read the folder tree and cross-check.
  • conventions.md: Do the documented conventions mention patterns used in the real code? I take 2-3 sample files and verify.
  • known-issues.md: Does it have real content or is it an empty template? I search for phrases like "[To confirm]" or "[Empty]".
  • changelog-ai.md: Does it have at least one entry with a date? I verify the format
    ## YYYY-MM-DD
    .
Note on location: The path can be
ai-context/
(without docs/) or
docs/ai-context/
. I check both.
Placeholder phrase detection (D2 additive check):
While reading each
ai-context/*.md
file (already read for line-count and content checks), scan the full file content for the following placeholder phrases:
  • [To be filled]
    ,
    [empty]
    ,
    [TBD]
    ,
    [placeholder]
    ,
    [To confirm]
    ,
    [Empty]
    — case-insensitive match on bracket-enclosed variants (e.g.,
    [todo]
    and
    [TODO]
    both match)
  • TODO
    — plain text, case-sensitive (exact uppercase match)
Scoring rule — placeholder detection:
  • For each
    ai-context/*.md
    file whose content contains one or more of the above phrases: emit a HIGH finding — "[filename] appears to contain unfilled placeholder content"
  • Treat such a file as functionally empty even if it passes the line-count check (do not award content/coherence points for that file)
  • Add the finding to
    required_actions.high
    in the FIX_MANIFEST with
    type: update_file
    ,
    target: [ai-context/filename]
    ,
    reason: "File contains placeholder content and has not been filled in"
stack.md technology version count (D2 additive check):
After reading
ai-context/stack.md
(already read for content checks), count the number of lines that contain a version-like string matching any of these patterns:
  • x.y
    (e.g.,
    3.4
    ,
    19.0
    )
  • x.y.z
    (e.g.,
    19.0.0
    ,
    5.4.2
    )
  • vX
    where X is a digit (e.g.,
    v3
    ,
    v21
    )
Scoring rule — version count:
  • If the count is fewer than 3: emit a MEDIUM finding — "stack.md lists fewer than 3 technologies with concrete versions — minimum is 3"
  • Add to
    required_actions.medium
    in the FIX_MANIFEST with
    type: update_file
    ,
    target: ai-context/stack.md
    ,
    reason: "stack.md lists fewer than 3 technologies with concrete versions — minimum is 3"
  • Skip this check if
    stack.md
    does not exist or contains placeholder content (already caught by the placeholder check above)
Additional sub-checks — User documentation freshness:
For each of the following files, apply identical logic:
  • ai-context/scenarios.md
  • ai-context/quick-reference.md
Logic per file:
  1. If the file does NOT exist → emit LOW finding:
    "[filename] missing — create via /project-onboard or manually following the template in ai-context/"
  2. If the file exists → read first 10 lines and search for
    ^> Last verified: (\d{4}-\d{2}-\d{2})$
    • Field absent or malformed → emit LOW:
      "Last verified field not found or malformed in [filename]"
    • Field present and date ≤ 90 days from today → no finding
    • Field present and date > 90 days from today → emit LOW:
      "[filename] stale ([N] days since last verification) — run /project-update to refresh"
Severity note: All findings for these sub-checks are LOW (informational). They do NOT deduct from the D2 numeric score.

目标:验证内存层是否存在、内容充实,且与真实代码一致。
存在性检查
文件最小可接受行数
ai-context/stack.md
> 30行
ai-context/architecture.md
> 40行
ai-context/conventions.md
> 30行
ai-context/known-issues.md
> 10行(新项目可简短)
ai-context/changelog-ai.md
> 5行(至少有一个条目)
内容检查(对每个存在的文件):
  • stack.md:是否提及与package.json相同的版本?我会查找前5个项目依赖项,验证是否已记录。
  • architecture.md:是否提及项目中实际存在的目录?我会读取目录结构并交叉验证。
  • conventions.md:记录的约定是否与真实代码中使用的模式一致?我会抽取2-3个示例文件进行验证。
  • known-issues.md:是否有真实内容,还是空模板?我会搜索
    [To confirm]
    [Empty]
    等短语。
  • changelog-ai.md:是否至少有一个带日期的条目?我会验证
    ## YYYY-MM-DD
    格式。
位置说明:路径可以是
ai-context/
(不带docs/)或
docs/ai-context/
,我会检查这两个位置。
占位符短语检测(D2附加检查)
在读取每个
ai-context/*.md
文件(已用于行数统计和内容检查)时,扫描整个文件内容,查找以下占位符短语:
  • [To be filled]
    [empty]
    [TBD]
    [placeholder]
    [To confirm]
    [Empty]
    — 括号包裹的变体不区分大小写(例如
    [todo]
    [TODO]
    均匹配)
  • TODO
    — 纯文本,区分大小写(完全匹配大写)
评分规则 — 占位符检测
  • 对于每个包含上述短语的
    ai-context/*.md
    文件:输出高严重程度的检查结果 — "[filename] appears to contain unfilled placeholder content"
  • 即使文件通过行数检查,也将其视为功能上的空文件(不为该文件授予内容/一致性分数)
  • 将该结果添加到FIX_MANIFEST的
    required_actions.high
    中,类型为
    update_file
    ,目标为
    [ai-context/filename]
    ,原因:"File contains placeholder content and has not been filled in"
stack.md技术版本计数(D2附加检查)
读取
ai-context/stack.md
(已用于内容检查)后,统计包含以下模式的版本类字符串的行数:
  • x.y
    (例如
    3.4
    19.0
  • x.y.z
    (例如
    19.0.0
    5.4.2
  • vX
    (X为数字,例如
    v3
    v21
评分规则 — 版本计数
  • 如果计数少于3:输出中等严重程度的检查结果 — "stack.md lists fewer than 3 technologies with concrete versions — minimum is 3"
  • 将该结果添加到FIX_MANIFEST的
    required_actions.medium
    中,类型为
    update_file
    ,目标为
    ai-context/stack.md
    ,原因:"stack.md lists fewer than 3 technologies with concrete versions — minimum is 3"
  • 如果
    stack.md
    不存在或包含占位符内容(已被占位符检查捕获),则跳过此检查
附加子检查 — 用户文档新鲜度
对以下每个文件应用相同逻辑:
  • ai-context/scenarios.md
  • ai-context/quick-reference.md
每个文件的检查逻辑:
  1. 如果文件不存在 → 输出低严重程度结果:
    "[filename] missing — create via /project-onboard or manually following the template in ai-context/"
  2. 如果文件存在 → 读取前10行,搜索
    ^> Last verified: (\d{4}-\d{2}-\d{2})$
    • 字段缺失或格式错误 → 输出低严重程度结果:
      "Last verified field not found or malformed in [filename]"
    • 字段存在且日期距今天≤90天 → 无结果
    • 字段存在且日期距今天>90天 → 输出低严重程度结果:
      "[filename] stale ([N] days since last verification) — run /project-update to refresh"
严重程度说明:这些子检查的所有结果均为低严重程度(信息性),不会扣除D2的数值分数。

Dimension 3 — SDD Orchestrator

维度3 — SDD编排器

Objective: Verify that the SDD cycle is fully operational in this project.
Sub-checks:
目标:验证SDD周期在项目中是否完全可用。
子检查

3a. Global SDD skills (prerequisite for everything else)

3a. 全局SDD技能(所有检查的前提)

I read whether the 8 files exist in
~/.claude/skills/
:
  • sdd-explore/SKILL.md
  • sdd-propose/SKILL.md
  • sdd-spec/SKILL.md
  • sdd-design/SKILL.md
  • sdd-tasks/SKILL.md
  • sdd-apply/SKILL.md
  • sdd-verify/SKILL.md
  • sdd-archive/SKILL.md
If any is missing → ❌ CRITICAL (SDD cannot function without the phases).
我会检查
~/.claude/skills/
中是否存在以下8个文件:
  • sdd-explore/SKILL.md
  • sdd-propose/SKILL.md
  • sdd-spec/SKILL.md
  • sdd-design/SKILL.md
  • sdd-tasks/SKILL.md
  • sdd-apply/SKILL.md
  • sdd-verify/SKILL.md
  • sdd-archive/SKILL.md
如果任何一个缺失 → ❌ 严重(没有这些阶段,SDD无法运行)。

3b. Engram availability

3b. Engram可用性

Check if Engram MCP is reachable (call
mem_context
):
  • If reachable: active mode =
    engram
    . Log
    INFO: project uses engram mode
    .
  • If not reachable: active mode =
    none
    . Log
    WARNING: Engram not reachable — SDD artifacts will not persist
    .
CheckSeverity
Engram MCP is reachable⚠️ HIGH (SDD artifacts won't persist without it)
检查Engram MCP是否可达(调用
mem_context
):
  • 如果可达:活跃模式 =
    engram
    ,记录
    INFO: project uses engram mode
  • 如果不可达:活跃模式 =
    none
    ,记录
    WARNING: Engram not reachable — SDD artifacts will not persist
检查内容严重程度
Engram MCP可达⚠️ 高(没有它,SDD产物无法持久化)

3c. CLAUDE.md mentions SDD

3c. CLAUDE.md提及SDD

CheckSeverity
Contains any
/sdd-*
command
⚠️ HIGH
Has section explaining the SDD flowℹ️ LOW
检查内容严重程度
包含任何
/sdd-*
命令
⚠️ 高
有解释SDD流程的章节ℹ️ 低

3d. Orphaned changes

3d. 孤立变更

I search engram for active SDD changes that appear stale (no activity in >14 days):
mem_search(query: "sdd/", project: "{project}")
Filter for changes with state artifacts whose
last_updated
is >14 days ago and that have no
archive-report
.
I list:
Orphaned changes detected:
  - change-name: last completed phase "tasks" (X days inactive)
我会在Engram中搜索看似已过期的活跃SDD变更(超过14天无活动):
mem_search(query: "sdd/", project: "{project}")
过滤出
last_updated
超过14天且无
archive-report
的状态产物。
我会列出:
Orphaned changes detected:
  - change-name: last completed phase "tasks" (X days inactive)

3e. Hook script existence (D3 additive check)

3e. 钩子脚本存在性(D3附加检查)

  1. If
    ROOT_SETTINGS_JSON_EXISTS=1
    , read
    settings.json
    at project root.
  2. If
    DOTCLAUDE_SETTINGS_JSON_EXISTS=1
    , read
    .claude/settings.json
    .
  3. If
    SETTINGS_LOCAL_JSON_EXISTS=1
    , read
    settings.local.json
    at project root.
  4. For each file read above, locate the
    hooks
    key in the JSON content and extract all script path values (strings inside hook event arrays or as direct values within the
    hooks
    object).
  5. For each extracted script path, check whether the file exists on disk at
    [project_root]/[path]
    .
  6. Skip this entire check (emit no finding) when no file that was read contains a
    hooks
    key.
Scoring rule — hook script existence:
  • For each script path that does NOT exist on disk: emit a HIGH finding — "Hook script referenced in [filename] not found on disk: [path]"
  • Add each missing script to
    required_actions.high
    in the FIX_MANIFEST with
    type: create_file
    ,
    target: [path]
    ,
    reason: "Hook script referenced in [filename] not found on disk"
  • Emit no finding when no
    hooks
    key is present in any settings file
  1. 如果
    ROOT_SETTINGS_JSON_EXISTS=1
    ,读取项目根目录的
    settings.json
  2. 如果
    DOTCLAUDE_SETTINGS_JSON_EXISTS=1
    ,读取
    .claude/settings.json
  3. 如果
    SETTINGS_LOCAL_JSON_EXISTS=1
    ,读取项目根目录的
    settings.local.json
  4. 对每个读取的文件,定位JSON内容中的
    hooks
    键,提取所有脚本路径值(钩子事件数组中的字符串,或
    hooks
    对象内的直接值)。
  5. 对每个提取的脚本路径,检查
    [项目根目录]/[路径]
    是否存在。
  6. 如果读取的文件中没有
    hooks
    键,则跳过整个检查(不输出结果)。
评分规则 — 钩子脚本存在性
  • 对于每个不存在的脚本路径:输出高严重程度的检查结果 — "Hook script referenced in [filename] not found on disk: [path]"
  • 将每个缺失的脚本添加到FIX_MANIFEST的
    required_actions.high
    中,类型为
    create_file
    ,目标为
    [path]
    ,原因:"Hook script referenced in [filename] not found on disk"
  • 如果任何设置文件中都没有
    hooks
    键,则不输出结果

3f. Active changes conflict detection (D3 additive check)

3f. 活跃变更冲突检测(D3附加检查)

  1. Search engram for all active SDD changes (those without an
    archive-report
    topic_key). List their design artifacts.
  2. For each active change that has a design artifact: retrieve the design via
    mem_get_observation
    and locate the
    ## File Change Matrix
    section (or equivalent table with a
    File
    column).
  3. Extract all file paths from the
    File
    column of that table.
  4. Normalize each extracted path: convert to lowercase and strip any leading
    ./
    prefix.
  5. Skip this entire step (emit no finding) if fewer than two active changes have a
    design.md
    .
Scoring rule — conflict detection:
  • Compute the set intersection of normalized file paths across all active changes that have a
    design.md
    .
  • For each file path that appears in two or more active changes: emit a MEDIUM finding — "Concurrent file modification conflict detected: [path] is targeted by both [change-A] and [change-B]"
  • Add each conflicting path to
    violations[]
    in the FIX_MANIFEST (NOT to
    required_actions
    ) with
    rule: "D3-active-changes-conflict"
    ,
    severity: "medium"
    , and
    file: [path]
  • If no overlapping paths exist after intersection, emit no finding
Limitation note: path normalization only handles
lowercase + strip leading ./
. Other format inconsistencies (e.g., absolute vs relative paths, different separators) are not caught.

  1. 在Engram中搜索所有活跃的SDD变更(无
    archive-report
    的变更),列出它们的设计产物。
  2. 对每个有设计产物的活跃变更:通过
    mem_get_observation
    获取设计内容,定位
    ## File Change Matrix
    章节(或带有
    File
    列的等效表格)。
  3. 提取
    File
    列中的所有文件路径。
  4. 标准化每个提取的路径:转换为小写并去除开头的
    ./
    前缀。
  5. 如果少于两个活跃变更有
    design.md
    ,则跳过整个步骤(不输出结果)。
评分规则 — 冲突检测
  • 计算所有有
    design.md
    的活跃变更中标准化路径的交集。
  • 对于每个出现在两个或更多活跃变更中的文件路径:输出中等严重程度的检查结果 — "Concurrent file modification conflict detected: [path] is targeted by both [change-A] and [change-B]"
  • 将每个冲突路径添加到FIX_MANIFEST的
    violations[]
    中(不添加到
    required_actions
    ),规则为
    D3-active-changes-conflict
    ,严重程度为
    medium
    ,文件为
    [path]
  • 如果交集后没有重叠路径,则不输出结果
限制说明:路径标准化仅处理
小写 + 去除开头./
,其他格式不一致(如绝对路径vs相对路径、不同分隔符)无法检测。

Dimension 4 — Skills Quality

维度4 — 技能质量

Objective: Verify that skills are substantial and that the registry in CLAUDE.md is accurate.
Checks:
目标:验证技能内容充实,且CLAUDE.md中的注册表准确。
检查内容

4a. Registry vs disk (bidirectional)

4a. 注册表与磁盘双向验证

  • For each skill listed in CLAUDE.md → I verify that the file/directory exists in
    .claude/skills/
  • For each file in
    .claude/skills/
    → I verify that it is listed in CLAUDE.md
  • I report: skills in registry but not on disk / skills on disk but not in registry
  • 对CLAUDE.md中列出的每个技能 → 验证
    .claude/skills/
    中是否存在对应的文件/目录
  • .claude/skills/
    中的每个文件 → 验证是否在CLAUDE.md中列出
  • 我会报告:注册表中有但磁盘上没有的技能 / 磁盘上有但注册表中没有的技能

4b. Minimum content

4b. 最小内容要求

For each skill file (
.md
or directory with
SKILL.md
):
  • Does it have more than 30 lines? → If not, it is probably a stub
  • Format-aware structural check (see
    docs/format-types.md
    for the authoritative contract):
    1. Parse YAML frontmatter block (content between the first
      ---
      pair at the start of the file). Extract
      format:
      value. If no frontmatter or no
      format:
      key → treat as
      procedural
      .
    2. If
      format:
      value is not one of
      procedural
      ,
      reference
      ,
      anti-pattern
      → emit INFO finding:
      "Unknown format value '[value]' in [skill-name] — defaulting to procedural check"
      and treat as
      procedural
      .
    3. Apply the check for the resolved format:
Resolved formatRequired sectionAccepted headings (any one satisfies)Finding if absent
procedural
(or absent/unknown)
Process section
## Process
MEDIUM: "procedural skill [name] missing ## Process section"
reference
Patterns section (one of)
## Patterns
OR
## Critical Patterns
MEDIUM: "reference skill [name] missing (## Patterns or ## Critical Patterns) or (## Examples or ## Code Examples) section"
reference
Examples section (one of)
## Examples
OR
## Code Examples
(same finding — emitted when skill lacks both a pattern section AND an examples section, or has one but not the other)
anti-pattern
Anti-patterns section (one of)
## Anti-patterns
OR
## Critical Patterns
MEDIUM: "anti-pattern skill [name] missing ## Anti-patterns or ## Critical Patterns section"
Validation logic for
reference
format
: A reference skill passes D4b if it has at least one of
## Patterns
/
## Critical Patterns
AND at least one of
## Examples
/
## Code Examples
. Use regex alternation:
^## (Patterns|Critical Patterns)
and
^## (Examples|Code Examples)
(case-sensitive). Emit the MEDIUM finding only when either condition is unsatisfied.
  1. Missing
    **Triggers**
    and missing
    ## Rules
    remain MEDIUM findings for all format types (unchanged).
  2. For a
    reference
    or
    anti-pattern
    skill: missing
    ## Process
    is not a finding.
Add each missing-section finding to
required_actions.medium
in the FIX_MANIFEST with:
type: skill_quality_action
action_type: add_missing_section
target: [skill path]
missing_sections: ["[section heading]"]
对每个技能文件(
.md
或包含
SKILL.md
的目录):
  • 是否超过30行?→ 如果没有,可能是占位文件
  • 格式感知结构检查(权威定义见
    docs/format-types.md
    ):
    1. 解析YAML前置块(文件开头第一个
      ---
      对之间的内容),提取
      format:
      值。如果没有前置块或
      format:
      键 → 视为
      procedural
    2. 如果
      format:
      值不是
      procedural
      reference
      anti-pattern
      之一 → 输出信息级结果:
      "Unknown format value '[value]' in [skill-name] — defaulting to procedural check"
      ,并视为
      procedural
    3. 根据解析后的格式应用检查:
解析后的格式必填章节可接受标题(满足其一即可)缺失时的检查结果
procedural
(或缺失/未知)
流程章节
## Process
中等:"procedural skill [name] missing ## Process section"
reference
模式章节(二选一)
## Patterns
## Critical Patterns
中等:"reference skill [name] missing (## Patterns or ## Critical Patterns) or (## Examples or ## Code Examples) section"
reference
示例章节(二选一)
## Examples
## Code Examples
(同上 — 当技能既缺失模式章节又缺失示例章节,或仅缺失其中一个时输出)
anti-pattern
反模式章节(二选一)
## Anti-patterns
## Critical Patterns
中等:"anti-pattern skill [name] missing ## Anti-patterns or ## Critical Patterns section"
reference格式验证逻辑:reference技能通过D4b检查的条件是:至少有
## Patterns
/
## Critical Patterns
之一,且至少有
## Examples
/
## Code Examples
之一。使用正则交替:
^## (Patterns|Critical Patterns)
^## (Examples|Code Examples)
(区分大小写)。仅当任一条件不满足时输出中等严重程度结果。
  1. 所有格式类型中,缺失
    **Triggers**
    ## Rules
    仍为中等严重程度结果(未改变)。
  2. 对于
    reference
    anti-pattern
    技能:缺失
    ## Process
    不视为检查结果。
将每个缺失章节的结果添加到FIX_MANIFEST的
required_actions.medium
中,格式如下:
type: skill_quality_action
action_type: add_missing_section
target: [skill path]
missing_sections: ["[section heading]"]

4c. Relevant global tech skills coverage (scored: 0–10 pts)

4c. 相关全局技术技能覆盖度(计分:0–10分)

I read the project stack (package.json) and identify which global technology skills in
~/.claude/skills/
are applicable but not yet installed in the project:
If project usesAvailable global skill
React 18+
react-19/SKILL.md
Next.js 14+
nextjs-15/SKILL.md
TypeScript
typescript/SKILL.md
Zustand
zustand-5/SKILL.md
Tailwind
tailwind-4/SKILL.md
Zod
zod-4/SKILL.md
Playwright
playwright/SKILL.md
Scoring rubric:
CoveragePoints
No relevant global skills detected in stack, OR all applicable ones already added10
≥ 75% of applicable global skills installed8
50–74% installed5
25–49% installed2
< 25% installed (relevant skills exist but none added)0
"Applicable" means: the project stack uses the technology AND a matching global skill exists in
~/.claude/skills/
. Projects with no matching global skills get full credit automatically.
D4 maximum: 20 points (4a+4b registry and content = 10 pts; 4c global skills coverage = 10 pts)

我会读取项目技术栈(package.json),识别
~/.claude/skills/
中适用但尚未安装的全局技术技能:
如果项目使用可用全局技能
React 18+
react-19/SKILL.md
Next.js 14+
nextjs-15/SKILL.md
TypeScript
typescript/SKILL.md
Zustand
zustand-5/SKILL.md
Tailwind
tailwind-4/SKILL.md
Zod
zod-4/SKILL.md
Playwright
playwright/SKILL.md
评分标准
覆盖度得分
技术栈中无相关全局技能,或所有适用技能已安装10
≥75%的适用全局技能已安装8
50–74%已安装5
25–49%已安装2
<25%已安装(存在相关技能但未添加任何一个)0
"适用"指:项目技术栈使用该技术,且
~/.claude/skills/
中有匹配的全局技能。无匹配全局技能的项目自动获得满分。
D4最高分:20分(4a+4b注册表与内容检查=10分;4c全局技能覆盖度=10分)

Dimension 6 — Cross-reference Integrity

维度6 — 交叉引用完整性

Objective: Everything referenced in the Claude configuration must exist on disk.
Checks:
What I verifyWhere I search for references
Docs referenced in CLAUDE.mdSection
## Documentation
.claude/docs/
Templates referenced in CLAUDE.mdTemplates section →
.claude/templates/
Paths mentioned in skillsScan of skills searching for paths (
/lib/
,
/domain/
,
pages/api/
)
Paths mentioned in ai-context/Verify that dirs documented in architecture.md exist
Skill files mentioned in commandsIf a command imports or references a skill
For each broken reference: I report the source file, approximate line, and the path that does not exist.

目标:Claude配置中引用的所有内容必须在磁盘上存在。
检查内容
验证内容搜索引用的位置
CLAUDE.md中引用的文档
## Documentation
章节 →
.claude/docs/
CLAUDE.md中引用的模板Templates章节 →
.claude/templates/
技能中提及的路径扫描技能文件,查找路径(
/lib/
/domain/
pages/api/
ai-context/中提及的路径验证architecture.md中记录的目录是否存在
命令中提及的技能文件如果命令导入或引用某个技能
对于每个无效引用:我会报告源文件、大致行号和不存在的路径。

Dimension 8 — Testing & Verification Integrity

维度8 — 测试与验证完整性

Objective: Verify that the project requires and evidences real tests before archiving SDD changes.
Checks:
目标:验证项目在归档SDD变更前是否要求并提供真实测试证据。
检查内容

8a. Project has testing configuration

8a. 项目有测试配置

CheckSeverity
Project has test runner configured or detectable⚠️ HIGH
Has documented testing strategy (in ai-context/)⚠️ MEDIUM
检查内容严重程度
项目已配置或可检测到测试运行器⚠️ 高
有记录的测试策略(在ai-context/中)⚠️ 中

8b. Archived changes have verify-report

8b. 归档变更有verify-report

Search engram for archive-report artifacts and check whether corresponding verify-report artifacts exist:
  • Does
    verify-report
    exist for each archived change? If not → ⚠️ HIGH
  • Does it mention tool execution results? If not → ⚠️ HIGH
I report:
Archived changes without verify-report: [list]
在Engram中搜索归档报告产物,检查对应的验证报告产物是否存在:
  • 每个归档变更是否都有
    verify-report
    ?如果没有 → ⚠️ 高
  • 是否提及工具执行结果?如果没有 → ⚠️ 高
我会报告:
Archived changes without verify-report: [列表]

8c. Active changes have verification criteria defined

8c. 活跃变更已定义验证标准

Search engram for active SDD changes (those with tasks but no archive-report):
  • If it has
    tasks
    → does the task plan include verification criteria?
  • If it has
    design
    → does the design define how the change will be tested?

在Engram中搜索活跃的SDD变更(有任务但无归档报告的变更):
  • 如果有
    tasks
    → 任务计划是否包含验证标准?
  • 如果有
    design
    → 设计是否定义了如何测试变更?

Dimension 7 — Architecture Compliance

维度7 — 架构合规性

Objective: Verify whether the project's architecture matches its documented baseline by reading the output of
/project-analyze
.
Input:
analysis-report.md
at the project root (produced by the
project-analyze
skill).
Scoring table:
ConditionScoreSeverityMessage
analysis-report.md
absent
0/5CRITICAL"Run /project-analyze first, then re-run /project-audit."
Present +
ai-context/architecture.md
absent
2/5HIGH"No architecture baseline to compare against."
Drift summary =
none
5/5OK
Drift summary =
minor
3/5MEDIUMList drift entries from
analysis-report.md
Drift summary =
significant
0/5HIGHList drift entries from
analysis-report.md
Staleness penalty (D7 additive scoring modifier):
After computing the drift-based D7 score (using the scoring table above), apply the staleness penalty as follows:
  1. This penalty applies ONLY when
    ANALYSIS_REPORT_EXISTS=1
    (i.e., the file exists). When the file is absent, D7 is already 0/5 — no further deduction.
  2. Parse
    ANALYSIS_REPORT_DATE
    from Phase A. Compute the age in days:
    current_audit_date − ANALYSIS_REPORT_DATE
    .
  3. Apply the deduction:
    • Age ≤ 30 days → no penalty; no staleness finding emitted
    • Age 31–60 days → deduct 1 point from the drift-based score (floor: 0); emit a staleness warning: "analysis-report.md is [N] days old (> 30 days) — staleness penalty applied"
    • Age > 60 days → deduct 2 points from the drift-based score (floor: 0); emit a staleness warning: "analysis-report.md is [N] days old (> 60 days) — staleness penalty applied"
  4. The staleness penalty stacks with the drift penalty: a
    minor
    drift score of 3/5 with a 40-day-old report becomes 2/5. The combined score floor is 0 — never negative.
Staleness scoring tiers:
Age of analysis-report.mdStaleness deduction
≤ 30 daysNone
31–60 days−1 pt (floor: 0)
> 60 days−2 pts (floor: 0)
Staleness penalty stacks with drift penalty; floor is 0.
Drift entries: When drift summary is
minor
or
significant
, read the
## Architecture Drift
section of
analysis-report.md
and list each entry in the D7 output block.
FIX_MANIFEST rule: D7 violations go in
violations[]
only — NOT in
required_actions
. The
/project-fix
skill does not auto-fix architecture drift.

目标:通过读取
/project-analyze
的输出,验证项目架构是否与记录的基线一致。
输入:项目根目录的
analysis-report.md
(由
project-analyze
技能生成)。
评分表
条件得分严重程度消息
analysis-report.md
缺失
0/5严重"Run /project-analyze first, then re-run /project-audit."
存在
analysis-report.md
ai-context/architecture.md
缺失
2/5"No architecture baseline to compare against."
漂移摘要 =
none
5/5正常
漂移摘要 =
minor
3/5列出
analysis-report.md
中的漂移条目
漂移摘要 =
significant
0/5列出
analysis-report.md
中的漂移条目
过期惩罚(D7附加评分修正)
使用上述评分表计算基于漂移的D7得分后,应用以下过期惩罚:
  1. 仅当
    ANALYSIS_REPORT_EXISTS=1
    (即文件存在)时才应用此惩罚。如果文件缺失,D7已为0/5,无需进一步扣除。
  2. 从阶段A输出中解析
    ANALYSIS_REPORT_DATE
    ,计算天数:
    current_audit_date − ANALYSIS_REPORT_DATE
  3. 应用扣除:
    • 天数≤30 → 无惩罚;不输出过期警告
    • 天数31–60 → 从基于漂移的得分中扣除1分(最低0分);输出过期警告:"analysis-report.md is [N] days old (> 30 days) — staleness penalty applied"
    • 天数>60 → 从基于漂移的得分中扣除2分(最低0分);输出过期警告:"analysis-report.md is [N] days old (> 60 days) — staleness penalty applied"
  4. 过期惩罚与漂移惩罚叠加:例如,漂移得分为3/5且报告已40天,最终得分为2/5。组合得分最低为0,不会为负。
过期评分等级
analysis-report.md的天数过期扣除分数
≤30天
31–60天−1分(最低0)
>60天−2分(最低0)
过期惩罚与漂移惩罚叠加;最低得分为0。
漂移条目:当漂移摘要为
minor
significant
时,读取
analysis-report.md
## Architecture Drift
章节,在D7输出块中列出每个条目。
FIX_MANIFEST规则:D7违规仅添加到
violations[]
中 — 不添加到
required_actions
/project-fix
技能不会自动修复架构漂移。

Dimension 9 — Project Skills Quality

维度9 — 项目技能质量

Objective: Audit the project's local skills directory against quality criteria and the global skill catalog.
D9-1. Skip condition
Read
$LOCAL_SKILLS_DIR
from the Phase A output. Check whether
$LOCAL_SKILLS_DIR
exists in the target project.
If it does NOT exist:
No [value of $LOCAL_SKILLS_DIR] directory found — Dimension 9 skipped.
No score deduction. Do not add
skill_quality_actions
to FIX_MANIFEST.
If it exists, proceed with D9-2 through D9-5 for each subdirectory found.
Note — global-config circular detection: When auditing the global-config repo itself,
$LOCAL_SKILLS_DIR
resolves to
"skills"
(root level). In this case every subdirectory under
skills/
will have a matching counterpart in
~/.claude/skills/
because they are the same files deployed by
install.sh
. D9-2 duplicate detection will assign disposition
keep
for all of them — this is correct and expected behavior (they are the source of truth, not duplicates).
D9-2. Duplicate detection
For each subdirectory
<name>
under
.claude/skills/
:
  • Check whether
    ~/.claude/skills/<name>/
    exists (exact directory name match)
  • If it exists → candidate disposition:
    move-to-global
    (if local differs from global) or
    delete
    (if identical)
  • If the global catalog is unreadable → emit
    Global catalog unreadable — duplicate check skipped
    at INFO level; assign disposition
    keep
D9-3. Structural completeness
Read each local
.claude/skills/<name>/SKILL.md
. Apply the same format-aware check as D4b (see
docs/format-types.md
for the authoritative contract):
  1. Parse YAML frontmatter block (content between the first
    ---
    pair). Extract
    format:
    value. If absent → treat as
    procedural
    .
  2. If
    format:
    value is unrecognized → emit INFO finding and treat as
    procedural
    .
  3. Apply the format-to-required-section check:
Resolved formatRequired sectionAccepted headings (any one satisfies)Finding if absent
procedural
(or absent/unknown)
Process section
## Process
record as missing
reference
Patterns section (one of)
## Patterns
OR
## Critical Patterns
record as missing
reference
Examples section (one of)
## Examples
OR
## Code Examples
record as missing
anti-pattern
Anti-patterns section (one of)
## Anti-patterns
OR
## Critical Patterns
record as missing
  1. Missing
    **Triggers**
    and
    ## Rules
    are checked for all format types (unchanged).
  2. For
    reference
    or
    anti-pattern
    skills: missing
    ## Process
    is not a finding.
If any required section is absent:
  • Record missing sections per skill
  • Assign disposition:
    update
  • Action:
    add_missing_section
If no
SKILL.md
exists in the directory:
  • Record as
    SKILL.md missing
  • Assign disposition:
    update
  • Action:
    add_missing_section
D9-4. Language compliance
Apply the D4e language-compliance heuristic (defined in Dimension 4) to the body text of each local
SKILL.md
outside fenced code blocks.
If non-English prose is found:
  • Disposition:
    update
  • Action:
    flag_language_violation
  • Severity: INFO only — no score deduction
D9-5. Stack relevance
Extract technology references from the trigger line and title of each local
SKILL.md
.
If a technology name is absent from BOTH
ai-context/stack.md
AND
package.json
/
pyproject.toml
:
  • Disposition:
    update
  • Action:
    flag_irrelevant
  • Severity: INFO only
If neither stack source (
stack.md
nor
package.json
/
pyproject.toml
) is found:
Stack relevance check skipped — no stack source found

目标:根据质量标准和全局技能目录,审计项目的本地技能目录。
D9-1. 跳过条件
从阶段A输出中读取
$LOCAL_SKILLS_DIR
,检查目标项目中是否存在该目录。
如果不存在:
No [value of $LOCAL_SKILLS_DIR] directory found — Dimension 9 skipped.
不扣除分数,不向FIX_MANIFEST添加
skill_quality_actions
如果存在,则对每个子目录执行D9-2至D9-5。
注意 — 全局配置循环检测:审计全局配置仓库本身时,
$LOCAL_SKILLS_DIR
解析为
"skills"
(根目录)。此时
skills/
下的每个子目录在
~/.claude/skills/
中都有对应的副本,因为它们是
install.sh
部署的相同文件。D9-2重复检测会为所有子目录分配
keep
处置 — 这是正确的预期行为(它们是权威来源,而非重复项)。
D9-2. 重复检测
.claude/skills/
下的每个子目录
<name>
  • 检查
    ~/.claude/skills/<name>/
    是否存在(完全匹配目录名)
  • 如果存在 → 候选处置:
    move-to-global
    (如果本地与全局不同)或
    delete
    (如果完全相同)
  • 如果全局目录不可读 → 输出信息级结果:
    Global catalog unreadable — duplicate check skipped
    ,分配处置
    keep
D9-3. 结构完整性
读取每个本地
.claude/skills/<name>/SKILL.md
,应用与D4b相同的格式感知检查(权威定义见
docs/format-types.md
):
  1. 解析YAML前置块(第一个
    ---
    对之间的内容),提取
    format:
    值。如果缺失 → 视为
    procedural
  2. 如果
    format:
    值无法识别 → 输出信息级结果并视为
    procedural
  3. 应用格式到必填章节的检查:
解析后的格式必填章节可接受标题(满足其一即可)缺失时记录结果
procedural
(或缺失/未知)
流程章节
## Process
记录为缺失
reference
模式章节(二选一)
## Patterns
## Critical Patterns
记录为缺失
reference
示例章节(二选一)
## Examples
## Code Examples
记录为缺失
anti-pattern
反模式章节(二选一)
## Anti-patterns
## Critical Patterns
记录为缺失
  1. 所有格式类型中,缺失
    **Triggers**
    ## Rules
    仍需检查(未改变)。
  2. 对于
    reference
    anti-pattern
    技能:缺失
    ## Process
    不视为检查结果。
如果有任何必填章节缺失:
  • 记录每个技能的缺失章节
  • 分配处置:
    update
  • 操作:
    add_missing_section
如果目录中没有
SKILL.md
  • 记录为
    SKILL.md missing
  • 分配处置:
    update
  • 操作:
    add_missing_section
D9-4. 语言合规性
对每个本地
SKILL.md
的正文(排除 fenced 代码块)应用D4e语言合规性启发式检查(定义见维度4)。
如果发现非英文内容:
  • 处置:
    update
  • 操作:
    flag_language_violation
  • 严重程度:仅信息级 — 不扣除分数
D9-5. 技术栈相关性
从每个本地
SKILL.md
的触发行和标题中提取技术引用。
如果技术名称在
ai-context/stack.md
package.json
/
pyproject.toml
中均不存在:
  • 处置:
    update
  • 操作:
    flag_irrelevant
  • 严重程度:仅信息级
如果未找到技术栈来源(
stack.md
package.json
/
pyproject.toml
均不存在):
Stack relevance check skipped — no stack source found

Dimension 10 — Feature Docs Coverage

维度10 — 功能文档覆盖度

Objective: Detect feature/skill documentation gaps across the project using either config-driven or heuristic discovery, and report coverage per feature. Informational only — no score impact.
Skip condition: If no features are detected (neither config-driven nor heuristic) → emit INFO: 'No feature directories detected — Dimension 10 skipped.' No score impact.
Phase A discovery extension: This dimension reads the
FEATURE_DOCS_CONFIG_EXISTS
variable produced by the Phase A bash script (see Rule 8). If
FEATURE_DOCS_CONFIG_EXISTS=1
, use config-driven detection. If
0
, fall back to heuristic detection.
目标:使用配置驱动或启发式发现,检测项目中功能/技能文档的缺口,并按功能报告覆盖度。仅为信息性,不影响评分。
跳过条件:如果未检测到功能(配置驱动和启发式均未检测到)→ 输出信息级结果:'No feature directories detected — Dimension 10 skipped.' 不影响评分。
阶段A发现扩展:该维度读取阶段A bash脚本生成的
FEATURE_DOCS_CONFIG_EXISTS
变量(见规则8)。如果
FEATURE_DOCS_CONFIG_EXISTS=1
,使用配置驱动检测;如果为0,回退到启发式检测。

Config-driven detection

配置驱动检测

If a project
config.yaml
exists and contains a
feature_docs:
key:
  • Read the
    convention
    field (
    skill
    |
    markdown
    |
    mixed
    )
  • Read the
    paths
    list (directories to scan for feature docs)
  • Read the
    feature_detection
    block:
    strategy
    (
    directory
    |
    prefix
    |
    explicit
    ),
    root
    (root directory whose subdirs are treated as features), and
    exclude
    list
Use this configuration as the source of truth for feature names and doc locations.
如果项目存在
config.yaml
且包含
feature_docs:
键:
  • 读取
    convention
    字段(
    skill
    |
    markdown
    |
    mixed
  • 读取
    paths
    列表(扫描功能文档的目录)
  • 读取
    feature_detection
    块:
    strategy
    directory
    |
    prefix
    |
    explicit
    )、
    root
    (其子目录视为功能的根目录)和
    exclude
    列表
使用此配置作为功能名称和文档位置的权威来源。

Heuristic detection fallback

启发式检测回退

If no
feature_docs:
key is present in the project config, run the following heuristic algorithm:
heuristic_sources = []
如果项目配置中没有
feature_docs:
键,运行以下启发式算法:
heuristic_sources = []

Source 1: non-SDD skills in $LOCAL_SKILLS_DIR

来源1:$LOCAL_SKILLS_DIR中的非SDD技能

if $LOCAL_SKILLS_DIR exists: for each subdirectory name in $LOCAL_SKILLS_DIR: if name does NOT start with: sdd-, project-, memory-, skill-: add to heuristic_sources as type=skill
if $LOCAL_SKILLS_DIR exists: for each subdirectory name in $LOCAL_SKILLS_DIR: if name does NOT start with: sdd-, project-, memory-, skill-: add to heuristic_sources as type=skill

Source 2: markdown files in docs/features/ or docs/modules/

来源2:docs/features/或docs/modules/中的markdown文件

if docs/features/ exists: add each *.md file as type=markdown, feature_name = filename without extension if docs/modules/ exists: add each *.md file as type=markdown, feature_name = filename without extension
if docs/features/ exists: add each *.md file as type=markdown, feature_name = filename without extension if docs/modules/ exists: add each *.md file as type=markdown, feature_name = filename without extension

Source 3: subdirs of src/features/, src/modules/, app/ with README.md

来源3:src/features/、src/modules/、app/下带README.md的子目录

for each candidate_root in [src/features/, src/modules/, app/]: if candidate_root exists: for each subdirectory: if subdirectory/README.md exists: add as type=markdown, feature_name = subdirectory name
for each candidate_root in [src/features/, src/modules/, app/]: if candidate_root exists: for each subdirectory: if subdirectory/README.md exists: add as type=markdown, feature_name = subdirectory name

Exclusion list — always skip these directory/feature names:

排除列表 — 始终跳过以下目录/功能名称:

EXCLUDE = [shared, utils, common, lib, types, hooks, components]
if heuristic_sources is empty (after exclusions): emit INFO: "No feature directories detected — Dimension 10 skipped." skip all four checks
undefined
EXCLUDE = [shared, utils, common, lib, types, hooks, components]
if heuristic_sources is empty (after exclusions): emit INFO: "No feature directories detected — Dimension 10 skipped." skip all four checks
undefined

D10 checks (run per detected feature)

D10检查(对每个检测到的功能)

D10-a Coverage: Verify that each detected feature has a corresponding documentation file.
  • If
    convention=skill
    : PASS (✅) if
    $LOCAL_SKILLS_DIR/<feature_name>/SKILL.md
    exists; FAIL (⚠️) otherwise
  • If
    convention=markdown
    : PASS (✅) if at least one
    .md
    file in the configured paths references
    feature_name
    ; FAIL (⚠️) otherwise
  • If
    convention=mixed
    : PASS (✅) if either a skill or a markdown doc is found; FAIL (⚠️) otherwise
D10-b Structural Quality: Verify that the found documentation has proper structure.
  • If doc is a
    SKILL.md
    : PASS (✅) if frontmatter (
    ---
    block) present AND
    **Triggers**
    /
    ## Triggers
    defined AND
    ## Process
    section AND
    ## Rules
    section; WARN (⚠️) if any of the above is missing
  • If doc is a
    .md
    file (not SKILL.md): PASS (✅) if has
    # title
    (H1) AND at least one
    ## section
    (H2); WARN (⚠️) if missing either; N/A if doc not found
D10-c Code Freshness: Scan the doc file for file path references and verify they still exist on disk.
  • Read the doc file content
  • Extract all path-like strings matching:
    /src/[^\s]+
    ,
    /lib/[^\s]+
    ,
    /app/[^\s]+
  • For each extracted path: check if
    [project_root][path]
    exists on disk; if NOT found → flag as stale (⚠️)
  • PASS (✅) if no stale paths found or no paths found in doc; N/A if doc not found
D10-d Registry Alignment: If doc is a SKILL.md in
.claude/skills/
→ verify it appears in the CLAUDE.md Skills Registry section.
  • Read CLAUDE.md (or
    .claude/CLAUDE.md
    )
  • Check if
    feature_name
    appears in the Skills Registry section
  • PASS (✅) if found; INFO (ℹ️) if not found (not a warning — projects may have features without skill entries by design); N/A if doc is not a SKILL.md
D10-a 覆盖度:验证每个检测到的功能是否有对应的文档文件。
  • 如果
    convention=skill
    :通过(✅)如果
    $LOCAL_SKILLS_DIR/<feature_name>/SKILL.md
    存在;否则失败(⚠️)
  • 如果
    convention=markdown
    :通过(✅)如果配置路径中至少有一个
    .md
    文件引用
    feature_name
    ;否则失败(⚠️)
  • 如果
    convention=mixed
    :通过(✅)如果找到技能或markdown文档;否则失败(⚠️)
D10-b 结构质量:验证找到的文档结构是否正确。
  • 如果文档是
    SKILL.md
    :通过(✅)如果存在前置块(
    ---
    块)且定义了
    **Triggers**
    /
    ## Triggers
    ## Process
    章节和
    ## Rules
    章节;如果任何一项缺失则警告(⚠️)
  • 如果文档是
    .md
    文件(非SKILL.md):通过(✅)如果有
    # title
    (H1)和至少一个
    ## section
    (H2);如果缺失任何一项则警告(⚠️);如果未找到文档则不适用
D10-c 代码新鲜度:扫描文档文件中的路径引用,验证它们是否仍存在于磁盘上。
  • 读取文档文件内容
  • 提取所有匹配
    /src/[^\s]+
    /lib/[^\s]+
    /app/[^\s]+
    的路径类字符串
  • 对每个提取的路径:检查
    [项目根目录][path]
    是否存在;如果不存在 → 标记为过期(⚠️)
  • 如果未找到过期路径或文档中无路径则通过(✅);如果未找到文档则不适用
D10-d 注册表一致性:如果文档是
.claude/skills/
中的SKILL.md → 验证是否出现在CLAUDE.md的技能注册表章节中。
  • 读取CLAUDE.md(或
    .claude/CLAUDE.md
  • 检查
    feature_name
    是否出现在技能注册表章节中
  • 如果找到则通过(✅);如果未找到则输出信息级结果(ℹ️)(非警告 — 项目可能有意使功能无技能条目);如果文档不是SKILL.md则不适用

Output format

输出格式

Emit a per-feature coverage table:
FeatureDoc foundStructure OKFreshIn RegistryStatus
[name]✅/❌✅/⚠️/N/A✅/⚠️/N/A✅/ℹ️/N/A✅/⚠️/❌
Status column logic: ✅ if all applicable checks pass; ⚠️ if any check warns; ❌ if D10-a (coverage) fails.
FIX_MANIFEST rule: D10 findings MUST NOT appear in
required_actions
or
skill_quality_actions
in the FIX_MANIFEST. /project-fix does not act on D10 findings.

输出按功能分类的覆盖度表:
功能找到文档结构正确新鲜度在注册表中状态
[名称]✅/❌✅/⚠️/不适用✅/⚠️/不适用✅/ℹ️/不适用✅/⚠️/❌
状态列逻辑:所有适用检查通过则✅;任何检查警告则⚠️;D10-a(覆盖度)失败则❌。
FIX_MANIFEST规则:D10检查结果不得添加到FIX_MANIFEST的
required_actions
skill_quality_actions
中。
/project-fix
不会处理D10结果。

Dimension 11 — Internal Coherence

维度11 — 内部一致性

Objective: Validate that individual skill files and CLAUDE.md are internally self-consistent — numeric claims in headings match actual section counts, numbered sequences have no gaps or duplicates, and frontmatter descriptions agree with the body. Informational only — no score impact.
Skip condition: If
$LOCAL_SKILLS_DIR
does not exist as a directory AND no root
CLAUDE.md
exists → emit INFO:
'No auditable files found — Dimension 11 skipped.'
No score impact.
Scope: All
SKILL.md
files under
$LOCAL_SKILLS_DIR
(emitted by the Phase A script) plus the root
CLAUDE.md
(if it exists).
Tool constraint: D11 uses only Read, Glob, and Grep tools for file analysis. No Bash calls.
目标:验证单个技能文件和CLAUDE.md是否内部自洽 — 标题中的数字声明与实际章节计数匹配,编号序列无缺口或重复,前置块描述与正文一致。仅为信息性,不影响评分。
跳过条件:如果
$LOCAL_SKILLS_DIR
不存在且根目录无
CLAUDE.md
→ 输出信息级结果:
'No auditable files found — Dimension 11 skipped.'
不影响评分。
范围
$LOCAL_SKILLS_DIR
下的所有
SKILL.md
文件(阶段A脚本输出)加上根目录的
CLAUDE.md
(如果存在)。
工具约束:D11仅使用Read、Glob和Grep工具进行文件分析,不调用Bash。

D11-a Count Consistency

D11-a 计数一致性

Extract numeric claims from headings (lines starting with
#
) and blockquote lines (lines starting with
>
) using the pattern:
CLAIM_PATTERN = /(\d+)\s+(Dimensions?|Steps?|Rules?|Phases?|Checks?|Sub-checks?)/i
For each claim found:
  • Identify the keyword (e.g., "Dimensions", "Steps")
  • Count matching sections in the body: heading lines containing the same keyword (case-insensitive)
  • If declared count ≠ actual count → finding with severity INFO
Do NOT match numeric references inside code blocks, examples, or body prose — only headings and blockquote lines.
使用以下模式从标题(以
#
开头的行)和引用块(以
>
开头的行)中提取数字声明:
CLAIM_PATTERN = /(\d+)\s+(Dimensions?|Steps?|Rules?|Phases?|Checks?|Sub-checks?)/i
对每个找到的声明:
  • 识别关键词(如"Dimensions"、"Steps")
  • 统计正文中匹配的章节数:包含相同关键词的标题行(不区分大小写)
  • 如果声明计数≠实际计数 → 输出信息级结果
不匹配代码块、示例或正文中的数字引用 — 仅匹配标题和引用块行。

D11-b Section Numbering Continuity

D11-b 章节编号连续性

Match numbered section patterns in H2/H3/H4 headings:
SEQUENCE_PATTERNS:
  - /^#{2,3}\s+.*Step\s+(\d+)/im     → Step sequences
  - /^#{2,3}\s+.*Dimension\s+(\d+)/im → Dimension sequences
  - /^#{2,3}\s+.*Phase\s+(\d+)/im     → Phase sequences
  - /^#{2,4}\s+.*D(\d+)/m             → D-prefixed sequences (D1, D2, ...)
For each pattern:
  • Collect all matched numbers, sort ascending
  • Gap: a number N is missing where min..max is not contiguous
  • Duplicate: a number appears more than once
  • Report only if the sequence has ≥ 2 members (single item = no sequence to validate)
  • Finding severity: INFO
匹配H2/H3/H4标题中的编号序列模式:
SEQUENCE_PATTERNS:
  - /^#{2,3}\s+.*Step\s+(\d+)/im     → 步骤序列
  - /^#{2,3}\s+.*Dimension\s+(\d+)/im → 维度序列
  - /^#{2,3}\s+.*Phase\s+(\d+)/im     → 阶段序列
  - /^#{2,4}\s+.*D(\d+)/m             → D前缀序列(D1、D2等)
对每个模式:
  • 收集所有匹配的数字,按升序排序
  • 缺口:min..max范围内缺失的数字N
  • 重复:出现多次的数字
  • 仅当序列包含≥2个成员时报告(单个条目无需验证序列)
  • 结果严重程度:信息级

D11-c Frontmatter-Body Alignment

D11-c 前置块与正文一致性

  • Parse YAML frontmatter (between first pair of
    ---
    markers)
  • Extract the
    description
    field
  • If
    description
    contains a numeric claim (reuse
    CLAIM_PATTERN
    ) → verify that claim against the body using the same logic as D11-a
  • If mismatch → finding with severity INFO
  • If no frontmatter or no
    description
    field → skip this check for that file
FIX_MANIFEST rule: D11 findings go in
violations[]
only with severity
info
. Rule names:
D11-count-consistency
,
D11-numbering-continuity
,
D11-frontmatter-body
. D11 findings MUST NOT appear in
required_actions
or
skill_quality_actions
. /project-fix does not act on D11 findings.

  • 解析YAML前置块(第一个
    ---
    对之间的内容)
  • 提取
    description
    字段
  • 如果
    description
    包含数字声明(复用
    CLAIM_PATTERN
    )→ 使用与D11-a相同的逻辑验证是否与正文一致
  • 如果不匹配 → 输出信息级结果
  • 如果没有前置块或
    description
    字段 → 跳过该文件的此检查
FIX_MANIFEST规则:D11结果仅添加到
violations[]
中,严重程度为
info
。规则名称:
D11-count-consistency
D11-numbering-continuity
D11-frontmatter-body
。D11结果不得添加到
required_actions
skill_quality_actions
中。
/project-fix
不会处理D11结果。

Dimension 12 — ADR Coverage

维度12 — ADR覆盖度

Objective: Audit the health and completeness of the ADR (Architecture Decision Record) system when the project references
docs/adr/
. Informational only — no impact on the 100-point score.
Activation condition: Read CLAUDE.md (or
.claude/CLAUDE.md
). Check whether the string
docs/adr/
appears anywhere in the content.
  • If
    docs/adr/
    is NOT found in CLAUDE.md → emit INFO: "ADR Coverage check skipped — docs/adr/ not referenced in CLAUDE.md" and skip all sub-checks below. No findings are added to the FIX_MANIFEST.
  • If
    docs/adr/
    IS found in CLAUDE.md → proceed with the following checks.
D12-1. README existence check:
  • Use
    ADR_README_EXISTS
    from Phase A output.
  • If
    ADR_README_EXISTS=0
    : emit a HIGH finding — "CLAUDE.md references docs/adr/ but docs/adr/README.md is missing"
  • Add to
    required_actions.high
    in the FIX_MANIFEST with
    type: create_file
    ,
    target: docs/adr/README.md
    ,
    reason: "CLAUDE.md references docs/adr/ but docs/adr/README.md is missing"
D12-2. Per-ADR Status field scan:
  1. Use Glob to list all files matching
    docs/adr/NNN-*.md
    (where NNN is a 3-digit prefix, e.g.,
    001-
    ,
    002-
    ).
  2. If no ADR files are found (only README.md or directory empty): emit INFO — "docs/adr/ contains no ADR files yet". No score impact.
  3. For each matched ADR file:
    • Read the file content.
    • Search for a
      ## Status
      section (line starting with
      ## Status
      ) OR a frontmatter
      status:
      field.
    • If neither is found: emit a MEDIUM finding — "ADR file [filename] is missing a valid status field"
    • Add to
      required_actions.medium
      in the FIX_MANIFEST with
      type: update_file
      ,
      target: [docs/adr/filename]
      ,
      reason: "ADR file is missing a valid status field"
    • Valid status values:
      accepted
      ,
      deprecated
      ,
      superseded
      . If a status field IS found, record its value for the output table; do not validate the value (custom statuses are allowed).
FIX_MANIFEST rule: D12 HIGH findings go in
required_actions.high
(actionable by /project-fix). D12 MEDIUM findings go in
required_actions.medium
. D12 INFO findings go in
violations[]
with severity
info
. D12 does NOT reduce the base 100-point score.

目标:当项目引用
docs/adr/
时,审计ADR(架构决策记录)系统的健康度和完整性。仅为信息性,不影响100分基础评分。
激活条件:读取CLAUDE.md(或
.claude/CLAUDE.md
),检查内容中是否出现字符串
docs/adr/
  • 如果CLAUDE.md中未找到
    docs/adr/
    → 输出信息级结果:"ADR Coverage check skipped — docs/adr/ not referenced in CLAUDE.md",并跳过以下所有子检查。不向FIX_MANIFEST添加任何结果。
  • 如果CLAUDE.md中找到
    docs/adr/
    → 执行以下检查。
D12-1. README存在性检查
  • 使用阶段A输出中的
    ADR_README_EXISTS
  • 如果
    ADR_README_EXISTS=0
    :输出高严重程度结果 — "CLAUDE.md references docs/adr/ but docs/adr/README.md is missing"
  • 将该结果添加到FIX_MANIFEST的
    required_actions.high
    中,类型为
    create_file
    ,目标为
    docs/adr/README.md
    ,原因:"CLAUDE.md references docs/adr/ but docs/adr/README.md is missing"
D12-2. 每个ADR的状态字段扫描
  1. 使用Glob列出所有匹配
    docs/adr/NNN-*.md
    的文件(NNN为3位前缀,如
    001-
    002-
    )。
  2. 如果未找到ADR文件(仅存在README.md或目录为空):输出信息级结果 — "docs/adr/ contains no ADR files yet",不影响评分。
  3. 对每个匹配的ADR文件:
    • 读取文件内容。
    • 搜索
      ## Status
      章节(以
      ## Status
      开头的行)或前置块
      status:
      字段。
    • 如果均未找到:输出中等严重程度结果 — "ADR file [filename] is missing a valid status field"
    • 将该结果添加到FIX_MANIFEST的
      required_actions.medium
      中,类型为
      update_file
      ,目标为
      [docs/adr/filename]
      ,原因:"ADR file is missing a valid status field"
    • 有效状态值:
      accepted
      deprecated
      superseded
      。如果找到状态字段,记录其值到输出表中;不验证值(允许自定义状态)。
FIX_MANIFEST规则:D12高严重程度结果添加到
required_actions.high
中(
/project-fix
可处理)。D12中等严重程度结果添加到
required_actions.medium
中。D12信息级结果添加到
violations[]
中,严重程度为
info
。D12不扣除100分基础评分。

Dimension 13 — Spec Coverage

维度13 — 规范覆盖度

Objective: Audit the health of the spec layer — verify that spec artifacts in engram have valid path references. Informational only — no impact on the 100-point score.
Activation condition: Engram is reachable AND
mem_search(query: "sdd/", project: "{project}")
returns spec artifacts.
  • If Engram is not reachable OR no spec artifacts found → emit INFO: "Spec Coverage check skipped — no spec artifacts found in engram" and skip all sub-checks. No findings are added to the FIX_MANIFEST.
  • If condition is met → proceed with the following checks.
D13-1. Per-spec path reference scan:
  1. For each
    spec.md
    that exists (found in D13-1):
    • Read the file content.
    • Extract all path-like references: strings that look like file paths (contain
      /
      and no spaces, not inside URLs, not in fenced code block headers). Look for patterns like
      src/[path]
      ,
      lib/[path]
      ,
      [dir]/[file].[ext]
      .
    • For each extracted path, check whether the file or directory exists at
      [project_root]/[path]
      .
    • If a referenced path does NOT exist: emit an INFO finding — "Spec artifact references a path that no longer exists: [path]"
    • Add to
      violations[]
      in the FIX_MANIFEST with
      rule: "D13-stale-path-reference"
      ,
      severity: "info"
      ,
      file: "engram spec artifact"
  2. INFO findings for stale paths are NOT added to
    required_actions
    — they are advisory only.
FIX_MANIFEST rule: D13 MEDIUM findings (missing spec.md) go in
required_actions.medium
(actionable by /project-fix). D13 INFO findings (stale path references) go in
violations[]
only. D13 does NOT reduce the base 100-point score.

目标:审计规范层的健康度 — 验证Engram中的规范产物是否有有效的路径引用。仅为信息性,不影响100分基础评分。
激活条件:Engram可达且
mem_search(query: "sdd/", project: "{project}")
返回规范产物。
  • 如果Engram不可达或未找到规范产物 → 输出信息级结果:"Spec Coverage check skipped — no spec artifacts found in engram",并跳过以下所有子检查。不向FIX_MANIFEST添加任何结果。
  • 如果满足条件 → 执行以下检查。
D13-1. 每个规范的路径引用扫描
  1. 对每个存在的
    spec.md
    (D13-1中找到的):
    • 读取文件内容。
    • 提取所有路径类引用:看起来像文件路径的字符串(包含
      /
      且无空格,不在URL中,不在fenced代码块标题中),查找
      src/[path]
      lib/[path]
      [dir]/[file].[ext]
      等模式。
    • 对每个提取的路径,检查
      [项目根目录]/[path]
      是否存在。
    • 如果引用的路径不存在:输出信息级结果 — "Spec artifact references a path that no longer exists: [path]"
    • 将该结果添加到FIX_MANIFEST的
      violations[]
      中,规则为
      D13-stale-path-reference
      ,严重程度为
      info
      ,文件为
      engram spec artifact
  2. 过期路径的信息级结果不添加到
    required_actions
    中 — 仅为建议性。
FIX_MANIFEST规则:D13中等严重程度结果(缺失spec.md)添加到
required_actions.medium
中(
/project-fix
可处理)。D13信息级结果(过期路径引用)仅添加到
violations[]
中。D13不扣除100分基础评分。

Dimension 14 — Budget Compliance (Informational — no score impact)

维度14 — 预算合规性(信息性 — 不影响评分)

This dimension runs on every project-audit invocation. It reports character counts against governance budgets defined in ADR-041.
Check 1 — CLAUDE.md budget:
  1. Read
    CLAUDE.md
    at project root; count characters
  2. Determine project type:
    • IF project is detected as global-config (install.sh + sync.sh exist): global budget = 20,000 chars
    • ELSE: project budget = 5,000 chars
  3. IF character count > budget: → Add INFO finding:
    "CLAUDE.md is [N] chars ([N-budget] over [budget] budget). Consider extracting content to skills (ADR-041)."
  4. IF character count <= budget: → Add INFO finding:
    "CLAUDE.md budget OK: [N]/[budget] chars."
Findings are appended to
audit-report.md
in a
## Budget Compliance
section. They do NOT affect any audit score dimension.

该维度在每次project-audit调用时运行,根据ADR-041中定义的治理预算报告字符计数。
检查1 — CLAUDE.md预算
  1. 读取项目根目录的
    CLAUDE.md
    ,统计字符数
  2. 确定项目类型:
    • 如果项目检测为global-config(存在install.sh + sync.sh):全局预算=20,000字符
    • 否则:项目预算=5,000字符
  3. 如果字符数>预算: → 添加信息级结果:
    "CLAUDE.md is [N] chars ([N-budget] over [budget] budget). Consider extracting content to skills (ADR-041)."
  4. 如果字符数≤预算: → 添加信息级结果:
    "CLAUDE.md budget OK: [N]/[budget] chars."
结果会追加到
audit-report.md
## Budget Compliance
章节中,不影响任何审计评分维度。

Report Format

报告格式

The report is saved in
.claude/audit-report.md
with this exact structure:
markdown
undefined
报告保存为
.claude/audit-report.md
,结构如下:
markdown
undefined

Audit Report — [Project Name]

审计报告 — [项目名称]

Generated: [YYYY-MM-DD HH:MM] Score: [XX/100] SDD Ready: [YES|NO|PARTIAL]

生成时间:[YYYY-MM-DD HH:MM] 得分:[XX/100] SDD就绪状态:[YES|NO|PARTIAL]

FIX_MANIFEST

FIX_MANIFEST

<!-- This block is consumed by /project-fix — DO NOT modify manually -->
yaml
score: [XX]
sdd_ready: [true|false|partial]
generated_at: "[timestamp]"
project_root: "[absolute path]"

required_actions:
  critical:
    - id: "[unique-id]"
      type: "[create_file|update_file|create_dir|add_registry_entry|install_skill]"
      target: "[path or element]"
      reason: "[why it is necessary]"
      template: "[template_name if applicable]"
  high:
    - id: "[unique-id]"
      type: "..."
      target: "..."
      reason: "..."
  medium:
    - ...
  low:
    - ...

missing_global_skills:
  - "[skill-name]"

orphaned_changes:
  - name: "[name]"
    last_phase: "[phase]"
    days_inactive: [N]

violations:
  - file: "[path]"
    line: [N]
    rule: "[violated rule]"
    severity: "[critical|high|medium]"

skill_quality_actions:
  - id: "D9-<skill-name>-<action-type>"
    skill_name: "<name>"
    local_path: ".claude/skills/<name>/SKILL.md"
    global_counterpart: "~/.claude/skills/<name>/SKILL.md" # only for duplicates
    action_type: "delete_duplicate|add_missing_section|flag_irrelevant|flag_language"
    disposition: "delete|move-to-global|update|keep"
    missing_sections: ["## Rules", "## Process"] # only for add_missing_section
    detail: "<human-readable reason>"
    severity: "info|warning"

<!-- 此块供/project-fix使用 — 请勿手动修改 -->
yaml
score: [XX]
sdd_ready: [true|false|partial]
generated_at: "[timestamp]"
project_root: "[绝对路径]"

required_actions:
  critical:
    - id: "[唯一ID]"
      type: "[create_file|update_file|create_dir|add_registry_entry|install_skill]"
      target: "[路径或元素]"
      reason: "[必要性说明]"
      template: "[适用的模板名称]"
  high:
    - id: "[唯一ID]"
      type: "..."
      target: "..."
      reason: "..."
  medium:
    - ...
  low:
    - ...

missing_global_skills:
  - "[技能名称]"

orphaned_changes:
  - name: "[名称]"
    last_phase: "[阶段]"
    days_inactive: [N]

violations:
  - file: "[路径]"
    line: [N]
    rule: "[违反的规则]"
    severity: "[critical|high|medium]"

skill_quality_actions:
  - id: "D9-<skill-name>-<action-type>"
    skill_name: "<名称>"
    local_path: ".claude/skills/<name>/SKILL.md"
    global_counterpart: "~/.claude/skills/<name>/SKILL.md" # 仅适用于重复项
    action_type: "delete_duplicate|add_missing_section|flag_irrelevant|flag_language"
    disposition: "delete|move-to-global|update|keep"
    missing_sections: ["## Rules", "## Process"] # 仅适用于add_missing_section
    detail: "<人类可读的原因>"
    severity: "info|warning"

Executive Summary

执行摘要

[3-5 lines describing the general state of the project from the Claude/SDD perspective]

[3-5行,从Claude/SDD角度描述项目的整体状态]

Score: [XX]/100

得分:[XX]/100

DimensionPointsMaxStatus
CLAUDE.md complete and accurate[X]20✅/⚠️/❌
Memory initialized[X]15✅/⚠️/❌
Memory with substantial content[X]10✅/⚠️/❌
SDD Orchestrator operational[X]20✅/⚠️/❌
Skills registry complete and functional[X]20✅/⚠️/❌
Cross-references valid[X]5✅/⚠️/❌
Architecture compliance[X]5✅/⚠️/❌
Testing & Verification integrity[X]5✅/⚠️/❌
Project Skills QualityN/AN/A✅/ℹ️/—
Feature Docs CoverageN/AN/A✅/ℹ️/—
Internal CoherenceN/AN/A✅/ℹ️/—
ADR CoverageN/AN/A✅/ℹ️/—
Spec CoverageN/AN/A✅/ℹ️/—
Budget ComplianceN/AN/A✅/ℹ️/—
TOTAL[X]100
SDD Readiness: [FULL / PARTIAL / NOT CONFIGURED]
  • FULL: Engram reachable, CLAUDE.md mentions /sdd-*, global skills present
  • PARTIAL: Some SDD elements present but incomplete
  • NOT CONFIGURED: Engram not reachable and no SDD references in CLAUDE.md

维度得分最高分状态
CLAUDE.md完整准确[X]20✅/⚠️/❌
内存层已初始化[X]15✅/⚠️/❌
内存层内容充实[X]10✅/⚠️/❌
SDD编排器可用[X]20✅/⚠️/❌
技能注册表完整可用[X]20✅/⚠️/❌
交叉引用有效[X]5✅/⚠️/❌
架构合规性[X]5✅/⚠️/❌
测试与验证完整性[X]5✅/⚠️/❌
项目技能质量不适用不适用✅/ℹ️/—
功能文档覆盖度不适用不适用✅/ℹ️/—
内部一致性不适用不适用✅/ℹ️/—
ADR覆盖度不适用不适用✅/ℹ️/—
规范覆盖度不适用不适用✅/ℹ️/—
预算合规性不适用不适用✅/ℹ️/—
总计[X]100
SDD就绪状态:[FULL / PARTIAL / NOT CONFIGURED]
  • FULL:Engram可达,CLAUDE.md提及/sdd-*,全局技能存在
  • PARTIAL:部分SDD元素存在但不完整
  • NOT CONFIGURED:Engram不可达且CLAUDE.md中无SDD引用

Dimension 1 — CLAUDE.md [OK|WARNING|CRITICAL]

维度1 — CLAUDE.md [OK|WARNING|CRITICAL]

CheckStatusDetail
Exists
.claude/CLAUDE.md
(or root
CLAUDE.md
for global-config repos)
✅/❌
Has >50 lines✅/❌[X] lines
Stack documented✅/⚠️/❌
Stack vs package.json✅/⚠️/❌[specific discrepancies]
Has Architecture section✅/⚠️/❌
Skills registry present✅/⚠️/❌
Mentions SDD (/sdd-*)✅/⚠️/❌
Stack Discrepancies: [List each discrepancy: "Declares React 18, actual ^19.0.0"]
Template path verification:
Template pathExists
docs/templates/prd-template.md✅/❌
docs/templates/adr-template.md✅/❌
[or: "No docs/templates/*.md paths found in CLAUDE.md — check skipped"]

检查内容状态详情
存在
.claude/CLAUDE.md
(全局配置仓库可使用根目录
CLAUDE.md
✅/❌
超过50行✅/❌[X] 行
已记录技术栈✅/⚠️/❌
技术栈与package.json匹配✅/⚠️/❌[具体差异]
包含架构章节✅/⚠️/❌
技能注册表存在✅/⚠️/❌
提及SDD (/sdd-*)✅/⚠️/❌
技术栈差异: [列出每个差异:"Declares React 18, actual ^19.0.0"]
模板路径验证
模板路径存在
docs/templates/prd-template.md✅/❌
docs/templates/adr-template.md✅/❌
[或:"No docs/templates/*.md paths found in CLAUDE.md — check skipped"]

Dimension 2 — Memory [OK|WARNING|CRITICAL]

维度2 — 内存层 [OK|WARNING|CRITICAL]

FileExistsLinesContentCoherence
stack.md✅/❌[N]✅/⚠️/❌✅/⚠️/❌
architecture.md✅/❌[N]✅/⚠️/❌✅/⚠️/❌
conventions.md✅/❌[N]✅/⚠️/❌✅/⚠️/❌
known-issues.md✅/❌[N]✅/⚠️/❌✅/⚠️/❌
changelog-ai.md✅/❌[N]✅/⚠️/❌N/A
Coherence issues detected: [List specific issues with file + what is outdated]
Placeholder phrase detection:
FilePhrase foundSeverity
stack.md"[To be filled]"⚠️ HIGH
[or: "No placeholder phrases detected"]
stack.md technology count: [N] version entries detected (minimum: 3) — ✅/⚠️

文件存在行数内容一致性
stack.md✅/❌[N]✅/⚠️/❌✅/⚠️/❌
architecture.md✅/❌[N]✅/⚠️/❌✅/⚠️/❌
conventions.md✅/❌[N]✅/⚠️/❌✅/⚠️/❌
known-issues.md✅/❌[N]✅/⚠️/❌✅/⚠️/❌
changelog-ai.md✅/❌[N]✅/⚠️/❌不适用
检测到的一致性问题: [列出具体问题,包括文件和过时内容]
占位符短语检测
文件找到的短语严重程度
stack.md"[To be filled]"⚠️ 高
[或:"未检测到占位符短语"]
stack.md技术版本计数:检测到[N]个版本条目(最低要求:3)— ✅/⚠️

Dimension 3 — SDD Orchestrator [OK|WARNING|CRITICAL]

维度3 — SDD编排器 [OK|WARNING|CRITICAL]

Global SDD Skills:
SkillExists
sdd-explore✅/❌
sdd-propose✅/❌
sdd-spec✅/❌
sdd-design✅/❌
sdd-tasks✅/❌
sdd-apply✅/❌
sdd-verify✅/❌
sdd-archive✅/❌
Engram availability:
CheckStatus
Engram MCP reachable✅/❌
CLAUDE.md mentions SDD: ✅/❌
Orphaned changes: [none | list]
Hook script existence:
Hook eventScript pathExists
[event][path]✅/❌
[or: "No hooks key found in settings files — check skipped"]
Active changes — file conflict detection:
FileChange AChange B
[path][change-name][change-name]
[or: "No conflicts detected"]
[or: "Fewer than two active changes have design.md — check skipped"]

全局SDD技能
技能存在
sdd-explore✅/❌
sdd-propose✅/❌
sdd-spec✅/❌
sdd-design✅/❌
sdd-tasks✅/❌
sdd-apply✅/❌
sdd-verify✅/❌
sdd-archive✅/❌
Engram可用性
检查内容状态
Engram MCP可达✅/❌
CLAUDE.md提及SDD:✅/❌
孤立变更:[无 | 列表]
钩子脚本存在性
钩子事件脚本路径存在
[事件][路径]✅/❌
[或:"设置文件中未找到hooks键 — 检查已跳过"]
活跃变更 — 文件冲突检测
文件变更A变更B
[路径][变更名称][变更名称]
[或:"未检测到冲突"]
[或:"少于两个活跃变更有design.md — 检查已跳过"]

Dimension 4 — Skills [OK|WARNING|CRITICAL]

维度4 — 技能 [OK|WARNING|CRITICAL]

Skills in registry but not on disk: [list or "none"]
Skills on disk but not in registry: [list or "none"]
Skills with insufficient content (<30 lines): [list or "none"]
Recommended global tech skills not installed: [list with install command: /skill-add name]

注册表中有但磁盘上没有的技能: [列表或"无"]
磁盘上有但注册表中没有的技能: [列表或"无"]
内容不足的技能(<30行): [列表或"无"]
建议安装的全局技术技能: [列表及安装命令:/skill-add name]

Dimension 6 — Cross-references [OK|WARNING|CRITICAL]

维度6 — 交叉引用 [OK|WARNING|CRITICAL]

Broken references:
Source fileReferenceProblem
[list or "none"]

无效引用
源文件引用内容问题
[列表或"无"]

Dimension 7 — Architecture Compliance [OK|WARNING|CRITICAL]

维度7 — 架构合规性 [OK|WARNING|CRITICAL]

Analysis report found: YES/NO Last analyzed: [date or N/A] Report age: [N days | N/A] Architecture drift status: [none|minor|significant|N/A] Staleness penalty: [none | −1 pt (report is [N] days old, > 30 days) | −2 pts (report is [N] days old, > 60 days)]
Drift entries: (when drift is present)
File/PatternExpectedFound
[entry][expected][found]

找到分析报告:是/否 上次分析时间:[日期或不适用] 报告时长:[N天或不适用] 架构漂移状态:[无/轻微/严重/不适用] 过期惩罚:[无 | −1分(报告已[N]天,>30天) | −2分(报告已[N]天,>60天)]
漂移条目:(当存在漂移时)
文件/模式预期实际
[条目][预期][实际]

Dimension 8 — Testing & Verification [OK|WARNING|CRITICAL]

维度8 — 测试与验证 [OK|WARNING|CRITICAL]

Project has test runner: ✅/❌
Archived changes without verify-report: [list or "none"]
Archived changes with empty verify-report.md (without [x]): [list or "none"]
Verify rules are executable: ✅/⚠️/❌

项目有测试运行器:✅/❌
无verify-report的归档变更: [列表或"无"]
verify-report.md为空的归档变更(无[x]): [列表或"无"]
验证规则可执行:✅/⚠️/❌

Dimension 9 — Project Skills Quality [OK|INFO|SKIPPED]

维度9 — 项目技能质量 [OK|INFO|SKIPPED]

Local skills directory: [value of $LOCAL_SKILLS_DIR] — [N skills found | not found — skipped]
SkillDuplicate of globalStructural completeLanguage OKStack relevantDisposition
[skill-name]⚠️ YES / ❌ NO✅ / ⚠️ (missing: list)✅ / ℹ️ violation✅ / ℹ️ flag / ℹ️ UNKNOWNkeep/update/delete/move-to-global
Skills with missing structural sections: [list or "none"]
Language violations (INFO — manual fix required): [list or "none"]
Stack relevance issues (INFO): [list or "none"]
Note: Dimension 9 does not affect the score in this iteration. Findings are informational unless action_type is
delete_duplicate
.

本地技能目录:[
$LOCAL_SKILLS_DIR
的值] — [找到N个技能 | 未找到 — 已跳过]
技能名称全局重复项结构完整语言合规技术栈相关处置
[技能名称]⚠️ 是 / ❌ 否✅ / ⚠️(缺失:列表)✅ / ℹ️ 违规✅ / ℹ️ 标记 / ℹ️ 未知保留/更新/删除/移至全局
结构章节缺失的技能: [列表或"无"]
语言违规(信息级 — 需手动修复): [列表或"无"]
技术栈相关性问题(信息级): [列表或"无"]
注意:维度9在本次迭代中不影响得分。除非操作类型为
delete_duplicate
,否则结果仅为信息性。

Dimension 10 — Feature Docs Coverage [OK|INFO|SKIPPED]

维度10 — 功能文档覆盖度 [OK|INFO|SKIPPED]

Detection mode: configured | heuristic | skipped Features detected: [N] ([list of names])
FeatureDoc foundStructure OKFreshIn RegistryStatus
[name]✅/❌✅/⚠️/N/A✅/⚠️/N/A✅/ℹ️/N/A✅/⚠️/❌
D10 findings are informational only — they do not affect the score and are not auto-fixed by /project-fix.

检测模式:配置驱动 / 启发式 / 已跳过 检测到的功能:[N]个([名称列表])
功能找到文档结构正确新鲜度在注册表中状态
[名称]✅/❌✅/⚠️/不适用✅/⚠️/不适用✅/ℹ️/不适用✅/⚠️/❌
D10结果仅为信息性 — 不影响得分,且不会被/project-fix自动修复。

Dimension 11 — Internal Coherence [OK|INFO|SKIPPED]

维度11 — 内部一致性 [OK|INFO|SKIPPED]

Skills scanned: [N] from $LOCAL_SKILLS_DIR
SkillCount OKNumbering OKFrontmatter OKFindings
[skill-name]✅/⚠️✅/⚠️✅/⚠️/N/A[detail or "clean"]
Inconsistencies found: [N] across [M] skills (or "None — all skills internally coherent")
D11 findings are informational only — they do not affect the score and are not auto-fixed by /project-fix.

扫描的技能:从
$LOCAL_SKILLS_DIR
中扫描[N]个
技能名称计数一致编号连续前置块一致检查结果
[技能名称]✅/⚠️✅/⚠️✅/⚠️/不适用[详情或"无问题"]
检测到的不一致性:[M]个技能中发现[N]个(或"无 — 所有技能内部一致")
D11结果仅为信息性 — 不影响得分,且不会被/project-fix自动修复。

Dimension 12 — ADR Coverage [OK|INFO|SKIPPED]

维度12 — ADR覆盖度 [OK|INFO|SKIPPED]

Condition: CLAUDE.md references docs/adr/ — YES/NO ADR README exists: ✅/❌ ADRs scanned: [N]
ADRStatus field foundStatus valueFinding
[001-example.md]✅/❌[accepted/deprecated/superseded/—]clean/Missing ## Status section
[or: "ADR Coverage check skipped — docs/adr/ not referenced in CLAUDE.md"] [or: "docs/adr/ contains no ADR files yet"]
D12 findings are informational only — no score impact.

条件:CLAUDE.md引用docs/adr/ — 是/否 ADR README存在:✅/❌ 扫描的ADR:[N]个
ADR文件找到状态字段状态值检查结果
[001-example.md]✅/❌[accepted/deprecated/superseded/—]无问题/缺失## Status章节
[或:"ADR覆盖度检查已跳过 — CLAUDE.md中未引用docs/adr/"] [或:"docs/adr/中尚无ADR文件"]
D12结果仅为信息性 — 不影响得分。

Dimension 13 — Spec Coverage [OK|INFO|SKIPPED]

维度13 — 规范覆盖度 [OK|INFO|SKIPPED]

Condition: Engram reachable and spec artifacts found — YES/NO Domains detected: [list of domain names]
Domainspec.md foundStale pathsStatus
[name]✅/❌[N]✅/⚠️/❌
[or: "Spec Coverage check skipped — no spec artifacts found in engram"]
D13 findings are informational only — no score impact.

条件:Engram可达且找到规范产物 — 是/否 检测到的领域:[领域名称列表]
领域找到spec.md过期路径状态
[名称]✅/❌[N]✅/⚠️/❌
[或:"规范覆盖度检查已跳过 — Engram中未找到规范产物"]
D13结果仅为信息性 — 不影响得分。

Budget Compliance [INFO]

预算合规性 [INFO]

Project type: agent-config (20,000 char global budget) | other project (5,000 char project budget)
CLAUDE.md character count: [N] chars — [OK: N/budget | OVER: N chars over budget]
Budget Compliance findings are informational only — no score impact. See ADR-041 for budget governance details.

项目类型:agent-config(全局预算20,000字符) | 其他项目(项目预算5,000字符)
CLAUDE.md字符数:[N]字符 — [正常:N/预算 | 超出:超出预算N字符]
预算合规性结果仅为信息性 — 不影响得分。预算治理详情见ADR-041。

Required Actions

必要操作

Critical (block SDD):

严重(阻碍SDD运行):

  1. [concrete action] → run
    /project-fix
    or manually: [instruction]
  1. [具体操作] → 运行
    /project-fix
    或手动操作:[说明]

High (degrade quality):

高(降低质量):

  1. [concrete action]
  1. [具体操作]

Medium:

中:

  1. [concrete action]
  1. [具体操作]

Low (optional improvements):

低(可选改进):

  1. [concrete action]

To implement these corrections: run
/project-fix
This report was generated by
/project-audit
— do not modify the FIX_MANIFEST block manually

---
  1. [具体操作]

要实施这些修正:运行
/project-fix
此报告由
/project-audit
生成 — 请勿手动修改FIX_MANIFEST块

---

Detailed Scoring

详细评分

DimensionCriterionMax points
CLAUDE.mdExists + complete structure + accurate stack + SDD refs20
Memory — existenceAll 5 files exist15
Memory — qualitySubstantial content + coherent with code10
SDD OrchestratorGlobal skills + Engram availability + CLAUDE.md refs20
SkillsRegistry accuracy + content depth = 10 pts; global tech skills coverage (D4c) = 10 pts20
Cross-referencesNo broken references5
ArchitectureNo critical violations in samples5
Testing & Verificationconfig.yaml has testing block + archived changes have verify-report.md5
Project Skills QualityInformational only — no score deduction in iteration 1. Flags duplicates, structural gaps, language violations, stack relevance issues.N/A
Feature Docs CoverageInformational only — no score deduction. Detects feature/skill documentation gaps.N/A
Internal CoherenceInformational only — no score deduction. Validates count claims, section numbering, and frontmatter consistency within individual skill files.N/A
ADR CoverageInformational only — no score deduction. Activated when CLAUDE.md references docs/adr/. Verifies README.md exists and each ADR file has a status field. HIGH/MEDIUM findings are actionable by /project-fix.N/A
Spec CoverageInformational only — no score deduction. Activated when engram has spec artifacts. Verifies spec path references are valid on disk. MEDIUM findings are actionable by /project-fix.N/A
Budget ComplianceInformational only — no score deduction. Reports CLAUDE.md character count against ADR-041 governance budgets (20k global / 5k project).N/A
Interpretation:
  • 90-100: SDD fully operational, excellent maintenance
  • 75-89: Ready to use SDD, minor improvements pending
  • 50-74: SDD partially configured, needs
    /project-fix
  • <50: Requires complete setup

维度评分标准最高分
CLAUDE.md存在 + 完整结构 + 准确技术栈 + SDD引用20
内存层 — 存在性所有5个文件存在15
内存层 — 质量内容充实 + 与代码一致10
SDD编排器全局技能 + Engram可用性 + CLAUDE.md引用20
技能注册表准确性 + 内容深度 = 10分;全局技术技能覆盖度(D4c)=10分20
交叉引用无无效引用5
架构样本中无严重违规5
测试与验证config.yaml有测试块 + 归档变更有verify-report.md5
项目技能质量仅为信息性 — 迭代1中不扣分。标记重复项、结构缺口、语言违规、技术栈相关性问题。不适用
功能文档覆盖度仅为信息性 — 不扣分。检测功能/技能文档缺口。不适用
内部一致性仅为信息性 — 不扣分。验证单个技能文件中的计数声明、章节编号和前置块一致性。不适用
ADR覆盖度仅为信息性 — 不扣分。当CLAUDE.md引用docs/adr/时激活。验证README.md存在且每个ADR文件有状态字段。高/中严重程度结果可由/project-fix处理。不适用
规范覆盖度仅为信息性 — 不扣分。当Engram有规范产物时激活。验证规范路径引用在磁盘上有效。中等严重程度结果可由/project-fix处理。不适用
预算合规性仅为信息性 — 不扣分。根据ADR-041治理预算报告CLAUDE.md字符数(全局20k / 项目5k)。不适用
解读
  • 90-100分:SDD完全可用,维护良好
  • 75-89分:可使用SDD,有待 minor 改进
  • 50-74分:SDD部分配置,需运行
    /project-fix
  • <50分:需完整设置

Rules

规则

  1. I always read real files — I never assume the content of a file
  2. I run in a subagent with read tools — never in main context
  3. I always save the report in
    .claude/audit-report.md
    before presenting to the user
  4. The FIX_MANIFEST is valid YAML — I verify that the block is parseable
  5. I never modify anything — this skill is 100% read-only
  6. If I cannot read a file, I report it as ❌ with the exact error, I do not assume it does not exist
  7. When finished, I notify the user: "Report saved in
    .claude/audit-report.md
    . To implement the corrections:
    /project-fix
    "
  8. All shell-based discovery MUST be consolidated into a single Bash script call (Phase A). Maximum 3 Bash calls per audit run. Never issue individual
    ls
    ,
    grep
    ,
    wc -l
    , or
    find
    calls per dimension.
  9. Compatibility behavior must be explicit — if a legacy or repo-specific structure is accepted, the skill documents it as compatibility policy rather than leaving it implicit in a dimension.
    Use the following reference script template for Phase A discovery:
    sh
    #!/usr/bin/env bash
    # project-audit discovery — Phase A
    # Usage: bash <(echo "$SCRIPT") [project_root]
    PROJECT="${1:-.}"
    f() { [ -f "$PROJECT/$1" ] && echo 1 || echo 0; }
    d() { [ -d "$PROJECT/$1" ] && echo 1 || echo 0; }
    lc() { [ -f "$PROJECT/$1" ] && wc -l < "$PROJECT/$1" || echo 0; }
    
    echo "CLAUDE_MD_EXISTS=$(f .claude/CLAUDE.md)"
    echo "ROOT_CLAUDE_MD_EXISTS=$(f CLAUDE.md)"
    echo "ENGRAM_REACHABLE=<check via mem_context>"
    echo "INSTALL_SH_EXISTS=$(f install.sh)"
    echo "SYNC_SH_EXISTS=$(f sync.sh)"
    
    # Global-config detection for LOCAL_SKILLS_DIR
    if [ "$INSTALL_SH_EXISTS" = "1" ] && [ "$SYNC_SH_EXISTS" = "1" ]; then
      LOCAL_SKILLS_DIR="skills"
    elif [ -d "$PROJECT/skills/_shared" ]; then
      LOCAL_SKILLS_DIR="skills"
    else
      LOCAL_SKILLS_DIR=".claude/skills"
    fi
    echo "LOCAL_SKILLS_DIR=$LOCAL_SKILLS_DIR"
    
    echo "STACK_MD_EXISTS=$(f ai-context/stack.md)"
    echo "ARCH_MD_EXISTS=$(f ai-context/architecture.md)"
    echo "CONV_MD_EXISTS=$(f ai-context/conventions.md)"
    echo "ISSUES_MD_EXISTS=$(f ai-context/known-issues.md)"
    echo "CHANGELOG_MD_EXISTS=$(f ai-context/changelog-ai.md)"
    echo "CLAUDE_MD_LINES=$(lc CLAUDE.md)"
    echo "STACK_MD_LINES=$(lc ai-context/stack.md)"
    
    # Orphaned changes — detected via engram search for stale SDD state artifacts
    ORPHANED="<detected via mem_search for sdd/*/state artifacts older than 14 days>"
    fi
    echo "ORPHANED_CHANGES=${ORPHANED:-NONE}"
    
    # SDD phase skills present
    SDD_COUNT=0
    for phase in explore propose spec design tasks apply verify archive; do
      [ -f "$HOME/.claude/skills/sdd-$phase/SKILL.md" ] && SDD_COUNT=$((SDD_COUNT+1))
    done
    echo "SDD_SKILLS_PRESENT=$SDD_COUNT"
    echo "FEATURE_DOCS_CONFIG_EXISTS=<check config.yaml at project root if it exists>"
    echo "ANALYSIS_REPORT_EXISTS=$(f analysis-report.md)"
    echo "ANALYSIS_REPORT_DATE=$(head -5 "$PROJECT/analysis-report.md" 2>/dev/null | grep 'Last analyzed:' | awk '{print $3}' || echo '')"
    echo "ROOT_SETTINGS_JSON_EXISTS=$(f settings.json)"
    echo "DOTCLAUDE_SETTINGS_JSON_EXISTS=$(f .claude/settings.json)"
    echo "SETTINGS_LOCAL_JSON_EXISTS=$(f settings.local.json)"
    echo "ADR_DIR_EXISTS=$(d docs/adr)"
    echo "ADR_README_EXISTS=$(f docs/adr/README.md)"
    echo "ENGRAM_HAS_SPECS=<check via mem_search for sdd/*/spec artifacts>"
    Output key schema (each key is a
    key=value
    line in stdout):
    • CLAUDE_MD_EXISTS
      — 1 if
      .claude/CLAUDE.md
      exists, 0 if absent
    • ROOT_CLAUDE_MD_EXISTS
      — 1 if root
      CLAUDE.md
      exists, 0 if absent
    • ENGRAM_REACHABLE
      — 1 if Engram MCP is reachable, 0 if not
    • INSTALL_SH_EXISTS
      — 1 if
      install.sh
      exists at project root, 0 if absent
    • SYNC_SH_EXISTS
      — 1 if
      sync.sh
      exists at project root, 0 if absent
    • LOCAL_SKILLS_DIR
      — string:
      "skills"
      (global-config detected via Condition A or B) or
      ".claude/skills"
      (standard project)
    • STACK_MD_EXISTS
      — 1 if
      ai-context/stack.md
      exists, 0 if absent
    • ARCH_MD_EXISTS
      — 1 if
      ai-context/architecture.md
      exists, 0 if absent
    • CONV_MD_EXISTS
      — 1 if
      ai-context/conventions.md
      exists, 0 if absent
    • ISSUES_MD_EXISTS
      — 1 if
      ai-context/known-issues.md
      exists, 0 if absent
    • CHANGELOG_MD_EXISTS
      — 1 if
      ai-context/changelog-ai.md
      exists, 0 if absent
    • CLAUDE_MD_LINES
      — integer line count of root
      CLAUDE.md
      (0 if absent)
    • STACK_MD_LINES
      — integer line count of
      ai-context/stack.md
      (0 if absent)
    • ORPHANED_CHANGES
      — comma-separated names of orphaned change dirs, or
      NONE
    • SDD_SKILLS_PRESENT
      — integer count of present
      ~/.claude/skills/sdd-*/SKILL.md
      files (0–8)
    • FEATURE_DOCS_CONFIG_EXISTS
      — 1 if project config.yaml contains a
      feature_docs:
      key, 0 if absent
    • ANALYSIS_REPORT_EXISTS
      — 1 if
      analysis-report.md
      exists at project root, 0 if absent
    • ANALYSIS_REPORT_DATE
      — ISO date string from the
      Last analyzed:
      field of
      analysis-report.md
      , or empty string if absent
    • ROOT_SETTINGS_JSON_EXISTS
      — 1 if
      settings.json
      exists at project root, 0 if absent
    • DOTCLAUDE_SETTINGS_JSON_EXISTS
      — 1 if
      .claude/settings.json
      exists, 0 if absent
    • SETTINGS_LOCAL_JSON_EXISTS
      — 1 if
      settings.local.json
      exists at project root, 0 if absent
    • ADR_DIR_EXISTS
      — 1 if
      docs/adr/
      directory exists, 0 if absent
    • ADR_README_EXISTS
      — 1 if
      docs/adr/README.md
      exists, 0 if absent
    • ENGRAM_HAS_SPECS
      — 1 if engram contains spec artifacts for this project, 0 if absent
    Legacy commands/ detection (Phase A post-script check):
    After running the Phase A script, check whether
    .claude/commands/
    exists in the project root:
    if [ -d "$PROJECT/.claude/commands" ]; then
      emit LOW finding: "Legacy .claude/commands/ directory detected — migrate to .claude/skills/ following the official Claude Code standard."
    fi
    • Severity: LOW (informational)
    • Score penalty: none
    • FIX_MANIFEST entry: none (do NOT add a
      required_actions
      entry for this finding)
  1. 始终读取真实文件 — 绝不假设文件内容
  2. 在子代理中运行,使用读取工具 — 绝不使用主上下文
  3. 始终保存报告,在展示给用户前保存至
    .claude/audit-report.md
  4. FIX_MANIFEST必须是有效的YAML — 验证该块可解析
  5. 绝不修改任何内容 — 该技能100%只读
  6. 如果无法读取文件,报告为❌并附上确切错误,绝不假设文件不存在
  7. 完成后,通知用户:"Report saved in
    .claude/audit-report.md
    . To implement the corrections:
    /project-fix
    "
  8. 所有基于shell的发现必须合并到单个Bash脚本调用中(阶段A)。每次审计运行最多3次Bash调用。绝不为每个维度单独调用
    ls
    grep
    wc -l
    find
  9. 兼容性行为必须明确 — 如果接受遗留或仓库特定结构,技能需将其记录为兼容性策略,而非隐含在维度中。
    阶段A发现可使用以下参考脚本模板:
    sh
    #!/usr/bin/env bash
    # project-audit discovery — Phase A
    # 用法:bash <(echo "$SCRIPT") [project_root]
    PROJECT="${1:-.}"
    f() { [ -f "$PROJECT/$1" ] && echo 1 || echo 0; }
    d() { [ -d "$PROJECT/$1" ] && echo 1 || echo 0; }
    lc() { [ -f "$PROJECT/$1" ] && wc -l < "$PROJECT/$1" || echo 0; }
    
    echo "CLAUDE_MD_EXISTS=$(f .claude/CLAUDE.md)"
    echo "ROOT_CLAUDE_MD_EXISTS=$(f CLAUDE.md)"
    echo "ENGRAM_REACHABLE=<通过mem_context检查>"
    echo "INSTALL_SH_EXISTS=$(f install.sh)"
    echo "SYNC_SH_EXISTS=$(f sync.sh)"
    
    # 全局配置仓库的LOCAL_SKILLS_DIR检测
    if [ "$INSTALL_SH_EXISTS" = "1" ] && [ "$SYNC_SH_EXISTS" = "1" ]; then
      LOCAL_SKILLS_DIR="skills"
    elif [ -d "$PROJECT/skills/_shared" ]; then
      LOCAL_SKILLS_DIR="skills"
    else
      LOCAL_SKILLS_DIR=".claude/skills"
    fi
    echo "LOCAL_SKILLS_DIR=$LOCAL_SKILLS_DIR"
    
    echo "STACK_MD_EXISTS=$(f ai-context/stack.md)"
    echo "ARCH_MD_EXISTS=$(f ai-context/architecture.md)"
    echo "CONV_MD_EXISTS=$(f ai-context/conventions.md)"
    echo "ISSUES_MD_EXISTS=$(f ai-context/known-issues.md)"
    echo "CHANGELOG_MD_EXISTS=$(f ai-context/changelog-ai.md)"
    echo "CLAUDE_MD_LINES=$(lc CLAUDE.md)"
    echo "STACK_MD_LINES=$(lc ai-context/stack.md)"
    
    # 孤立变更 — 通过mem_search检测过期的SDD状态产物
    ORPHANED="<通过mem_search查找14天以上的sdd/*/state产物>"
    fi
    echo "ORPHANED_CHANGES=${ORPHANED:-NONE}"
    
    # SDD阶段技能存在性
    SDD_COUNT=0
    for phase in explore propose spec design tasks apply verify archive; do
      [ -f "$HOME/.claude/skills/sdd-$phase/SKILL.md" ] && SDD_COUNT=$((SDD_COUNT+1))
    done
    echo "SDD_SKILLS_PRESENT=$SDD_COUNT"
    echo "FEATURE_DOCS_CONFIG_EXISTS=<检查项目根目录的config.yaml是否存在>"
    echo "ANALYSIS_REPORT_EXISTS=$(f analysis-report.md)"
    echo "ANALYSIS_REPORT_DATE=$(head -5 "$PROJECT/analysis-report.md" 2>/dev/null | grep 'Last analyzed:' | awk '{print $3}' || echo '')"
    echo "ROOT_SETTINGS_JSON_EXISTS=$(f settings.json)"
    echo "DOTCLAUDE_SETTINGS_JSON_EXISTS=$(f .claude/settings.json)"
    echo "SETTINGS_LOCAL_JSON_EXISTS=$(f settings.local.json)"
    echo "ADR_DIR_EXISTS=$(d docs/adr)"
    echo "ADR_README_EXISTS=$(f docs/adr/README.md)"
    echo "ENGRAM_HAS_SPECS=<通过mem_search查找sdd/*/spec产物>"
    输出键 schema(每个键为stdout中的
    key=value
    行):
    • CLAUDE_MD_EXISTS
      — 1表示
      .claude/CLAUDE.md
      存在,0表示缺失
    • ROOT_CLAUDE_MD_EXISTS
      — 1表示根目录
      CLAUDE.md
      存在,0表示缺失
    • ENGRAM_REACHABLE
      — 1表示Engram MCP可达,0表示不可达
    • INSTALL_SH_EXISTS
      — 1表示项目根目录存在
      install.sh
      ,0表示缺失
    • SYNC_SH_EXISTS
      — 1表示项目根目录存在
      sync.sh
      ,0表示缺失
    • LOCAL_SKILLS_DIR
      — 字符串:
      "skills"
      (通过条件A或B检测为全局配置仓库)或
      ".claude/skills"
      (标准项目)
    • STACK_MD_EXISTS
      — 1表示
      ai-context/stack.md
      存在,0表示缺失
    • ARCH_MD_EXISTS
      — 1表示
      ai-context/architecture.md
      存在,0表示缺失
    • CONV_MD_EXISTS
      — 1表示
      ai-context/conventions.md
      存在,0表示缺失
    • ISSUES_MD_EXISTS
      — 1表示
      ai-context/known-issues.md
      存在,0表示缺失
    • CHANGELOG_MD_EXISTS
      — 1表示
      ai-context/changelog-ai.md
      存在,0表示缺失
    • CLAUDE_MD_LINES
      — 根目录
      CLAUDE.md
      的整数行数(缺失则为0)
    • STACK_MD_LINES
      ai-context/stack.md
      的整数行数(缺失则为0)
    • ORPHANED_CHANGES
      — 孤立变更目录的逗号分隔名称,或
      NONE
    • SDD_SKILLS_PRESENT
      — 存在的
      ~/.claude/skills/sdd-*/SKILL.md
      文件的整数计数(0–8)
    • FEATURE_DOCS_CONFIG_EXISTS
      — 1表示项目config.yaml包含
      feature_docs:
      键,0表示缺失
    • ANALYSIS_REPORT_EXISTS
      — 1表示项目根目录存在
      analysis-report.md
      ,0表示缺失
    • ANALYSIS_REPORT_DATE
      analysis-report.md
      Last analyzed:
      字段的ISO日期字符串,缺失则为空
    • ROOT_SETTINGS_JSON_EXISTS
      — 1表示项目根目录存在
      settings.json
      ,0表示缺失
    • DOTCLAUDE_SETTINGS_JSON_EXISTS
      — 1表示
      .claude/settings.json
      存在,0表示缺失
    • SETTINGS_LOCAL_JSON_EXISTS
      — 1表示项目根目录存在
      settings.local.json
      ,0表示缺失
    • ADR_DIR_EXISTS
      — 1表示
      docs/adr/
      目录存在,0表示缺失
    • ADR_README_EXISTS
      — 1表示
      docs/adr/README.md
      存在,0表示缺失
    • ENGRAM_HAS_SPECS
      — 1表示Engram包含该项目的规范产物,0表示缺失
    遗留命令/检测(阶段A脚本后检查)
    运行阶段A脚本后,检查项目根目录是否存在
    .claude/commands/
    if [ -d "$PROJECT/.claude/commands" ]; then
      emit LOW finding: "Legacy .claude/commands/ directory detected — migrate to .claude/skills/ following the official Claude Code standard."
    fi
    • 严重程度:低(信息性)
    • 评分惩罚:无
    • FIX_MANIFEST条目:无(请勿为该结果添加
      required_actions
      条目)

Phase A extension — analysis-report.md check

阶段A扩展 — analysis-report.md检查

After the Phase A Bash batch completes, the following two variables are available for use by Dimension 7 in Phase B:
  • ANALYSIS_REPORT_EXISTS
    — 1 if
    analysis-report.md
    exists at the project root, 0 if absent
  • ANALYSIS_REPORT_DATE
    — ISO date string from the
    Last analyzed:
    field, or empty string if absent
Important constraints:
  • project-audit
    does NOT invoke
    project-analyze
    automatically.
    analysis-report.md
    is treated as external input produced by a prior
    /project-analyze
    run.
  • D7 in Phase B reads
    ANALYSIS_REPORT_EXISTS
    and
    ANALYSIS_REPORT_DATE
    to compute its score and staleness warning.
  • These two variables are added to the existing Phase A Bash script template — no additional Bash call is introduced. Total Bash calls per audit run remain ≤ 3.
undefined
运行阶段A Bash批量脚本后,以下两个变量可供阶段B的维度7使用:
  • ANALYSIS_REPORT_EXISTS
    — 1表示项目根目录存在
    analysis-report.md
    ,0表示缺失
  • ANALYSIS_REPORT_DATE
    Last analyzed:
    字段的ISO日期字符串,缺失则为空
重要约束
  • project-audit
    不会自动调用
    project-analyze
    analysis-report.md
    视为外部输入,由之前的
    /project-analyze
    运行生成。
  • 阶段B的D7读取
    ANALYSIS_REPORT_EXISTS
    ANALYSIS_REPORT_DATE
    来计算得分和过期警告。
  • 这两个变量已添加到现有阶段A Bash脚本模板中 — 无需额外调用Bash。每次审计运行的Bash调用总数仍≤3。
undefined