project-audit
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chineseproject-audit
project-audit
Deep diagnostic of Claude/SDD configuration. Read-only. Produces a structured report that /project-fix consumes as its spec.
Triggers: , audit project, review claude config, sdd diagnostic, project health check
/project-audit对Claude/SDD配置进行深度诊断。只读模式。生成结构化报告,作为/project-fix的执行依据。
触发方式:、audit project、review claude config、sdd diagnostic、project health check
/project-auditRole 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 implements. Without audit, there is no fix.
/project-fixAbsolute 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.mdThis file persists between sessions and is the input for .
/project-fix完成后,将报告保存至:
[项目根目录]/.claude/audit-report.md该文件会在会话间持久化,作为的输入。
/project-fixAudit Kernel
审计内核
project-audit| Stage | Responsibility | Output |
|---|---|---|
| Discovery | Gather structural facts from the project and runtime environment | Presence/absence facts, path resolution, baseline metadata |
| Evaluation | Apply the dimension rules to the discovered facts and file contents | Findings, score, violations, required actions |
| Report generation | Render the audit state into a persistent artifact | |
The kernel is intentionally stable. Detailed dimension rules can evolve, but the command remains: discover, evaluate, report.
project-audit| 阶段 | 职责 | 输出 |
|---|---|---|
| 发现(Discovery) | 从项目和运行环境中收集结构事实 | 存在/缺失事实、路径解析、基线元数据 |
| 评估(Evaluation) | 将维度规则应用于发现的事实和文件内容 | 检查结果、评分、违规项、必要操作 |
| 报告生成 | 将审计状态渲染为持久化产物 | |
内核设计为稳定不变。具体的维度规则可以迭代,但核心命令始终是:发现、评估、报告。
Dimension Classes
维度类别
project-audit| Class | Dimensions | Score impact | Role |
|---|---|---|---|
| Scored dimensions | D1, D2, D3, D4, D6, D7, D8 | Contribute to the 100-point score | Determine operational health and SDD readiness |
| Informational dimensions | D9, D10, D11, D12, D13, D14 | No base-score impact | Surface 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 , not an implicit side effect of individual dimensions.
project-auditCompatibility rules currently include:
- Repo-shape compatibility: global-config repos may use root , and local skill discovery may resolve to
CLAUDE.mdinstead ofskills/..claude/skills/ - Historical terminology compatibility: archived materials may still mention older section labels, but active skill validation uses the canonical and
## Processheadings.## Rules - 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 repo:
global-config- Condition A: +
install.shexist at project root, ORsync.sh - Condition B: project root contains directory with SDD phase skills
skills/
If detected as global-config:
- Accept at root as equivalent to
CLAUDE.md.claude/CLAUDE.md - Note in report header:
Project Type: global-config - The CLAUDE.md path check passes without penalty
Checks to run:
| Check | How I verify | Severity if fails |
|---|---|---|
Exists | Attempt to read it | ❌ CRITICAL |
| Not empty (>50 lines) | Count lines | ❌ CRITICAL |
| Has Stack section | Search for | ⚠️ HIGH |
| Stack matches package.json/pyproject.toml | Read both, compare key versions | ⚠️ HIGH |
| Has Architecture section | Search for | ⚠️ HIGH |
| Has Skills registry | Search for skills table | ⚠️ HIGH |
| Has Unbreakable Rules | Search for | ⚠️ MEDIUM |
| Has Plan Mode Rules | Search for | ℹ️ LOW |
Mentions SDD (any | Search for text | ⚠️ HIGH |
| References to ai-context/ are correct | Verify that mentioned paths exist | ⚠️ MEDIUM |
For the stack: I read (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.
package.jsonTemplate path verification (D1 additive check):
- Read CLAUDE.md and locate the section (or equivalent section referencing
## Documentation Conventions).docs/templates/ - Extract all paths matching the pattern from that section.
docs/templates/*.md - For each extracted path, check whether the file exists on disk at .
[project_root]/[path] - Skip this check entirely if no pattern is found in CLAUDE.md — no finding is emitted.
docs/templates/*.md
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 in the FIX_MANIFEST with
required_actions.medium,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:项目根目录包含目录,且其中有SDD阶段技能
skills/
如果检测为global-config:
- 接受根目录的作为
CLAUDE.md的等效文件.claude/CLAUDE.md - 在报告头部标注:
Project Type: global-config - CLAUDE.md路径检查自动通过,无惩罚
需执行的检查:
| 检查内容 | 验证方式 | 失败时严重程度 |
|---|---|---|
存在 | 尝试读取该文件 | ❌ 严重 |
| 文件非空(超过50行) | 统计行数 | ❌ 严重 |
| 包含技术栈章节 | 搜索 | ⚠️ 高 |
| 技术栈与package.json/pyproject.toml匹配 | 读取两者内容,对比关键版本 | ⚠️ 高 |
| 包含架构章节 | 搜索 | ⚠️ 高 |
| 包含技能注册表 | 搜索技能表 | ⚠️ 高 |
| 包含不可破规则 | 搜索 | ⚠️ 中 |
| 包含计划模式规则 | 搜索 | ℹ️ 低 |
提及SDD(任何 | 搜索文本 | ⚠️ 高 |
| 对ai-context/的引用正确 | 验证提及的路径是否存在 | ⚠️ 中 |
技术栈检查细节:我会读取(或等效文件),提取最重要的5-10个依赖项,与CLAUDE.md中声明的内容对比,报告具体的版本差异。
package.json模板路径验证(D1附加检查):
- 读取CLAUDE.md,定位章节(或引用
## Documentation Conventions的等效章节)。docs/templates/ - 提取所有匹配模式的路径。
docs/templates/*.md - 对每个提取的路径,检查是否存在。
[项目根目录]/[路径] - 如果CLAUDE.md中未找到模式,则跳过此检查,不输出任何结果。
docs/templates/*.md
评分规则:
- 对于每个缺失的模板路径:输出中等严重程度的检查结果 — "Template path referenced in CLAUDE.md does not exist on disk: [path]"
- 将每个缺失路径添加到FIX_MANIFEST的中,类型为
required_actions.medium,目标为create_file,原因:"Template path referenced in CLAUDE.md does not exist on disk"[path] - 每个缺失路径对应一个检查结果(多个缺失路径会生成多个独立结果)
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:
| File | Minimum acceptable lines |
|---|---|
| > 30 lines |
| > 40 lines |
| > 30 lines |
| > 10 lines (can be brief if the project is new) |
| > 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 (without docs/) or . I check both.
ai-context/docs/ai-context/Placeholder phrase detection (D2 additive check):
While reading each file (already read for line-count and content checks), scan the full file content for the following placeholder phrases:
ai-context/*.md- ,
[To be filled],[empty],[TBD],[placeholder],[To confirm]— case-insensitive match on bracket-enclosed variants (e.g.,[Empty]and[todo]both match)[TODO] - — plain text, case-sensitive (exact uppercase match)
TODO
Scoring rule — placeholder detection:
- For each file whose content contains one or more of the above phrases: emit a HIGH finding — "[filename] appears to contain unfilled placeholder content"
ai-context/*.md - 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 in the FIX_MANIFEST with
required_actions.high,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 (already read for content checks), count the number of lines that contain a version-like string matching any of these patterns:
ai-context/stack.md- (e.g.,
x.y,3.4)19.0 - (e.g.,
x.y.z,19.0.0)5.4.2 - where X is a digit (e.g.,
vX,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 in the FIX_MANIFEST with
required_actions.medium,type: update_file,target: ai-context/stack.mdreason: "stack.md lists fewer than 3 technologies with concrete versions — minimum is 3" - Skip this check if does not exist or contains placeholder content (already caught by the placeholder check above)
stack.md
Additional sub-checks — User documentation freshness:
For each of the following files, apply identical logic:
ai-context/scenarios.mdai-context/quick-reference.md
Logic per file:
- If the file does NOT exist → emit LOW finding:
"[filename] missing — create via /project-onboard or manually following the template in ai-context/" - 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"
- Field absent or malformed → emit LOW:
Severity note: All findings for these sub-checks are LOW (informational). They do NOT deduct from the D2 numeric score.
目标:验证内存层是否存在、内容充实,且与真实代码一致。
存在性检查:
| 文件 | 最小可接受行数 |
|---|---|
| > 30行 |
| > 40行 |
| > 30行 |
| > 10行(新项目可简短) |
| > 5行(至少有一个条目) |
内容检查(对每个存在的文件):
- stack.md:是否提及与package.json相同的版本?我会查找前5个项目依赖项,验证是否已记录。
- architecture.md:是否提及项目中实际存在的目录?我会读取目录结构并交叉验证。
- conventions.md:记录的约定是否与真实代码中使用的模式一致?我会抽取2-3个示例文件进行验证。
- known-issues.md:是否有真实内容,还是空模板?我会搜索或
[To confirm]等短语。[Empty] - changelog-ai.md:是否至少有一个带日期的条目?我会验证格式。
## YYYY-MM-DD
位置说明:路径可以是(不带docs/)或,我会检查这两个位置。
ai-context/docs/ai-context/占位符短语检测(D2附加检查):
在读取每个文件(已用于行数统计和内容检查)时,扫描整个文件内容,查找以下占位符短语:
ai-context/*.md- 、
[To be filled]、[empty]、[TBD]、[placeholder]、[To confirm]— 括号包裹的变体不区分大小写(例如[Empty]和[todo]均匹配)[TODO] - — 纯文本,区分大小写(完全匹配大写)
TODO
评分规则 — 占位符检测:
- 对于每个包含上述短语的文件:输出高严重程度的检查结果 — "[filename] appears to contain unfilled placeholder content"
ai-context/*.md - 即使文件通过行数检查,也将其视为功能上的空文件(不为该文件授予内容/一致性分数)
- 将该结果添加到FIX_MANIFEST的中,类型为
required_actions.high,目标为update_file,原因:"File contains placeholder content and has not been filled in"[ai-context/filename]
stack.md技术版本计数(D2附加检查):
读取(已用于内容检查)后,统计包含以下模式的版本类字符串的行数:
ai-context/stack.md- (例如
x.y、3.4)19.0 - (例如
x.y.z、19.0.0)5.4.2 - (X为数字,例如
vX、v3)v21
评分规则 — 版本计数:
- 如果计数少于3:输出中等严重程度的检查结果 — "stack.md lists fewer than 3 technologies with concrete versions — minimum is 3"
- 将该结果添加到FIX_MANIFEST的中,类型为
required_actions.medium,目标为update_file,原因:"stack.md lists fewer than 3 technologies with concrete versions — minimum is 3"ai-context/stack.md - 如果不存在或包含占位符内容(已被占位符检查捕获),则跳过此检查
stack.md
附加子检查 — 用户文档新鲜度:
对以下每个文件应用相同逻辑:
ai-context/scenarios.mdai-context/quick-reference.md
每个文件的检查逻辑:
- 如果文件不存在 → 输出低严重程度结果:
"[filename] missing — create via /project-onboard or manually following the template in ai-context/" - 如果文件存在 → 读取前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.mdsdd-propose/SKILL.mdsdd-spec/SKILL.mdsdd-design/SKILL.mdsdd-tasks/SKILL.mdsdd-apply/SKILL.mdsdd-verify/SKILL.mdsdd-archive/SKILL.md
If any is missing → ❌ CRITICAL (SDD cannot function without the phases).
我会检查中是否存在以下8个文件:
~/.claude/skills/sdd-explore/SKILL.mdsdd-propose/SKILL.mdsdd-spec/SKILL.mdsdd-design/SKILL.mdsdd-tasks/SKILL.mdsdd-apply/SKILL.mdsdd-verify/SKILL.mdsdd-archive/SKILL.md
如果任何一个缺失 → ❌ 严重(没有这些阶段,SDD无法运行)。
3b. Engram availability
3b. Engram可用性
Check if Engram MCP is reachable (call ):
mem_context- If reachable: active mode = . Log
engram.INFO: project uses engram mode - If not reachable: active mode = . Log
none.WARNING: Engram not reachable — SDD artifacts will not persist
| Check | Severity |
|---|---|
| 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
| Check | Severity |
|---|---|
Contains any | ⚠️ HIGH |
| Has section explaining the SDD flow | ℹ️ LOW |
| 检查内容 | 严重程度 |
|---|---|
包含任何 | ⚠️ 高 |
| 有解释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 is >14 days ago and that have no .
last_updatedarchive-reportI list:
Orphaned changes detected:
- change-name: last completed phase "tasks" (X days inactive)我会在Engram中搜索看似已过期的活跃SDD变更(超过14天无活动):
mem_search(query: "sdd/", project: "{project}")过滤出超过14天且无的状态产物。
last_updatedarchive-report我会列出:
Orphaned changes detected:
- change-name: last completed phase "tasks" (X days inactive)3e. Hook script existence (D3 additive check)
3e. 钩子脚本存在性(D3附加检查)
- If , read
ROOT_SETTINGS_JSON_EXISTS=1at project root.settings.json - If , read
DOTCLAUDE_SETTINGS_JSON_EXISTS=1..claude/settings.json - If , read
SETTINGS_LOCAL_JSON_EXISTS=1at project root.settings.local.json - For each file read above, locate the key in the JSON content and extract all script path values (strings inside hook event arrays or as direct values within the
hooksobject).hooks - For each extracted script path, check whether the file exists on disk at .
[project_root]/[path] - Skip this entire check (emit no finding) when no file that was read contains a key.
hooks
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 in the FIX_MANIFEST with
required_actions.high,type: create_file,target: [path]reason: "Hook script referenced in [filename] not found on disk" - Emit no finding when no key is present in any settings file
hooks
- 如果,读取项目根目录的
ROOT_SETTINGS_JSON_EXISTS=1。settings.json - 如果,读取
DOTCLAUDE_SETTINGS_JSON_EXISTS=1。.claude/settings.json - 如果,读取项目根目录的
SETTINGS_LOCAL_JSON_EXISTS=1。settings.local.json - 对每个读取的文件,定位JSON内容中的键,提取所有脚本路径值(钩子事件数组中的字符串,或
hooks对象内的直接值)。hooks - 对每个提取的脚本路径,检查是否存在。
[项目根目录]/[路径] - 如果读取的文件中没有键,则跳过整个检查(不输出结果)。
hooks
评分规则 — 钩子脚本存在性:
- 对于每个不存在的脚本路径:输出高严重程度的检查结果 — "Hook script referenced in [filename] not found on disk: [path]"
- 将每个缺失的脚本添加到FIX_MANIFEST的中,类型为
required_actions.high,目标为create_file,原因:"Hook script referenced in [filename] not found on disk"[path] - 如果任何设置文件中都没有键,则不输出结果
hooks
3f. Active changes conflict detection (D3 additive check)
3f. 活跃变更冲突检测(D3附加检查)
- Search engram for all active SDD changes (those without an topic_key). List their design artifacts.
archive-report - For each active change that has a design artifact: retrieve the design via and locate the
mem_get_observationsection (or equivalent table with a## File Change Matrixcolumn).File - Extract all file paths from the column of that table.
File - Normalize each extracted path: convert to lowercase and strip any leading prefix.
./ - 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 in the FIX_MANIFEST (NOT to
violations[]) withrequired_actions,rule: "D3-active-changes-conflict", andseverity: "medium"file: [path] - If no overlapping paths exist after intersection, emit no finding
Limitation note: path normalization only handles . Other format inconsistencies (e.g., absolute vs relative paths, different separators) are not caught.
lowercase + strip leading ./- 在Engram中搜索所有活跃的SDD变更(无的变更),列出它们的设计产物。
archive-report - 对每个有设计产物的活跃变更:通过获取设计内容,定位
mem_get_observation章节(或带有## File Change Matrix列的等效表格)。File - 提取列中的所有文件路径。
File - 标准化每个提取的路径:转换为小写并去除开头的前缀。
./ - 如果少于两个活跃变更有,则跳过整个步骤(不输出结果)。
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 → I verify that it is listed in CLAUDE.md
.claude/skills/ - I report: skills in registry but not on disk / skills on disk but not in registry
- 对CLAUDE.md中列出的每个技能 → 验证中是否存在对应的文件/目录
.claude/skills/ - 对中的每个文件 → 验证是否在CLAUDE.md中列出
.claude/skills/ - 我会报告:注册表中有但磁盘上没有的技能 / 磁盘上有但注册表中没有的技能
4b. Minimum content
4b. 最小内容要求
For each skill file ( or directory with ):
.mdSKILL.md- Does it have more than 30 lines? → If not, it is probably a stub
- Format-aware structural check (see for the authoritative contract):
docs/format-types.md- Parse YAML frontmatter block (content between the first pair at the start of the file). Extract
---value. If no frontmatter or noformat:key → treat asformat:.procedural - If value is not one of
format:,procedural,reference→ emit INFO finding:anti-patternand treat as"Unknown format value '[value]' in [skill-name] — defaulting to procedural check".procedural - Apply the check for the resolved format:
- Parse YAML frontmatter block (content between the first
| Resolved format | Required section | Accepted headings (any one satisfies) | Finding if absent |
|---|---|---|---|
| Process section | | MEDIUM: "procedural skill [name] missing ## Process section" |
| Patterns section (one of) | | MEDIUM: "reference skill [name] missing (## Patterns or ## Critical Patterns) or (## Examples or ## Code Examples) section" |
| Examples section (one of) | | (same finding — emitted when skill lacks both a pattern section AND an examples section, or has one but not the other) |
| Anti-patterns section (one of) | | MEDIUM: "anti-pattern skill [name] missing ## Anti-patterns or ## Critical Patterns section" |
Validation logic forformat: A reference skill passes D4b if it has at least one ofreference/## PatternsAND at least one of## Critical Patterns/## Examples. Use regex alternation:## Code Examplesand^## (Patterns|Critical Patterns)(case-sensitive). Emit the MEDIUM finding only when either condition is unsatisfied.^## (Examples|Code Examples)
- Missing and missing
**Triggers**remain MEDIUM findings for all format types (unchanged).## Rules - For a or
referenceskill: missinganti-patternis not a finding.## Process
Add each missing-section finding to in the FIX_MANIFEST with:
required_actions.mediumtype: skill_quality_action
action_type: add_missing_section
target: [skill path]
missing_sections: ["[section heading]"]对每个技能文件(或包含的目录):
.mdSKILL.md- 是否超过30行?→ 如果没有,可能是占位文件
- 格式感知结构检查(权威定义见):
docs/format-types.md- 解析YAML前置块(文件开头第一个对之间的内容),提取
---值。如果没有前置块或format:键 → 视为format:。procedural - 如果值不是
format:、procedural、reference之一 → 输出信息级结果:anti-pattern,并视为"Unknown format value '[value]' in [skill-name] — defaulting to procedural check"。procedural - 根据解析后的格式应用检查:
- 解析YAML前置块(文件开头第一个
| 解析后的格式 | 必填章节 | 可接受标题(满足其一即可) | 缺失时的检查结果 |
|---|---|---|---|
| 流程章节 | | 中等:"procedural skill [name] missing ## Process section" |
| 模式章节(二选一) | | 中等:"reference skill [name] missing (## Patterns or ## Critical Patterns) or (## Examples or ## Code Examples) section" |
| 示例章节(二选一) | | (同上 — 当技能既缺失模式章节又缺失示例章节,或仅缺失其中一个时输出) |
| 反模式章节(二选一) | | 中等:"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)
- 所有格式类型中,缺失和
**Triggers**仍为中等严重程度结果(未改变)。## Rules - 对于或
reference技能:缺失anti-pattern不视为检查结果。## Process
将每个缺失章节的结果添加到FIX_MANIFEST的中,格式如下:
required_actions.mediumtype: 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 are applicable but not yet installed in the project:
~/.claude/skills/| If project uses | Available global skill |
|---|---|
| React 18+ | |
| Next.js 14+ | |
| TypeScript | |
| Zustand | |
| Tailwind | |
| Zod | |
| Playwright | |
Scoring rubric:
| Coverage | Points |
|---|---|
| No relevant global skills detected in stack, OR all applicable ones already added | 10 |
| ≥ 75% of applicable global skills installed | 8 |
| 50–74% installed | 5 |
| 25–49% installed | 2 |
| < 25% installed (relevant skills exist but none added) | 0 |
"Applicable" means: the project stack uses the technology AND a matching global skill exists in . Projects with no matching global skills get full credit automatically.
~/.claude/skills/D4 maximum: 20 points (4a+4b registry and content = 10 pts; 4c global skills coverage = 10 pts)
我会读取项目技术栈(package.json),识别中适用但尚未安装的全局技术技能:
~/.claude/skills/| 如果项目使用 | 可用全局技能 |
|---|---|
| React 18+ | |
| Next.js 14+ | |
| TypeScript | |
| Zustand | |
| Tailwind | |
| Zod | |
| Playwright | |
评分标准:
| 覆盖度 | 得分 |
|---|---|
| 技术栈中无相关全局技能,或所有适用技能已安装 | 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 verify | Where I search for references |
|---|---|
| Docs referenced in CLAUDE.md | Section |
| Templates referenced in CLAUDE.md | Templates section → |
| Paths mentioned in skills | Scan of skills searching for paths ( |
| Paths mentioned in ai-context/ | Verify that dirs documented in architecture.md exist |
| Skill files mentioned in commands | If 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中引用的文档 | |
| CLAUDE.md中引用的模板 | Templates章节 → |
| 技能中提及的路径 | 扫描技能文件,查找路径( |
| 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. 项目有测试配置
| Check | Severity |
|---|---|
| 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 exist for each archived change? If not → ⚠️ HIGH
verify-report - 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 → does the task plan include verification criteria?
tasks - If it has → does the design define how the change will be tested?
design
在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-analyzeInput: at the project root (produced by the skill).
analysis-report.mdproject-analyzeScoring table:
| Condition | Score | Severity | Message |
|---|---|---|---|
| 0/5 | CRITICAL | "Run /project-analyze first, then re-run /project-audit." |
Present + | 2/5 | HIGH | "No architecture baseline to compare against." |
Drift summary = | 5/5 | OK | |
Drift summary = | 3/5 | MEDIUM | List drift entries from |
Drift summary = | 0/5 | HIGH | List drift entries from |
Staleness penalty (D7 additive scoring modifier):
After computing the drift-based D7 score (using the scoring table above), apply the staleness penalty as follows:
- This penalty applies ONLY when (i.e., the file exists). When the file is absent, D7 is already 0/5 — no further deduction.
ANALYSIS_REPORT_EXISTS=1 - Parse from Phase A. Compute the age in days:
ANALYSIS_REPORT_DATE.current_audit_date − ANALYSIS_REPORT_DATE - 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"
- The staleness penalty stacks with the drift penalty: a drift score of 3/5 with a 40-day-old report becomes 2/5. The combined score floor is 0 — never negative.
minor
Staleness scoring tiers:
| Age of analysis-report.md | Staleness deduction |
|---|---|
| ≤ 30 days | None |
| 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 or , read the section of and list each entry in the D7 output block.
minorsignificant## Architecture Driftanalysis-report.mdFIX_MANIFEST rule: D7 violations go in only — NOT in . The skill does not auto-fix architecture drift.
violations[]required_actions/project-fix目标:通过读取的输出,验证项目架构是否与记录的基线一致。
/project-analyze输入:项目根目录的(由技能生成)。
analysis-report.mdproject-analyze评分表:
| 条件 | 得分 | 严重程度 | 消息 |
|---|---|---|---|
| 0/5 | 严重 | "Run /project-analyze first, then re-run /project-audit." |
存在 | 2/5 | 高 | "No architecture baseline to compare against." |
漂移摘要 = | 5/5 | 正常 | |
漂移摘要 = | 3/5 | 中 | 列出 |
漂移摘要 = | 0/5 | 高 | 列出 |
过期惩罚(D7附加评分修正):
使用上述评分表计算基于漂移的D7得分后,应用以下过期惩罚:
- 仅当(即文件存在)时才应用此惩罚。如果文件缺失,D7已为0/5,无需进一步扣除。
ANALYSIS_REPORT_EXISTS=1 - 从阶段A输出中解析,计算天数:
ANALYSIS_REPORT_DATE。current_audit_date − ANALYSIS_REPORT_DATE - 应用扣除:
- 天数≤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"
- 过期惩罚与漂移惩罚叠加:例如,漂移得分为3/5且报告已40天,最终得分为2/5。组合得分最低为0,不会为负。
过期评分等级:
| analysis-report.md的天数 | 过期扣除分数 |
|---|---|
| ≤30天 | 无 |
| 31–60天 | −1分(最低0) |
| >60天 | −2分(最低0) |
过期惩罚与漂移惩罚叠加;最低得分为0。
漂移条目:当漂移摘要为或时,读取的章节,在D7输出块中列出每个条目。
minorsignificantanalysis-report.md## Architecture DriftFIX_MANIFEST规则:D7违规仅添加到中 — 不添加到。技能不会自动修复架构漂移。
violations[]required_actions/project-fixDimension 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 from the Phase A output. Check whether exists in the target project.
$LOCAL_SKILLS_DIR$LOCAL_SKILLS_DIRIf it does NOT exist:
No [value of $LOCAL_SKILLS_DIR] directory found — Dimension 9 skipped.No score deduction. Do not add to FIX_MANIFEST.
skill_quality_actionsIf 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, resolves to (root level). In this case every subdirectory under will have a matching counterpart in because they are the same files deployed by . D9-2 duplicate detection will assign disposition for all of them — this is correct and expected behavior (they are the source of truth, not duplicates).
$LOCAL_SKILLS_DIR"skills"skills/~/.claude/skills/install.shkeepD9-2. Duplicate detection
For each subdirectory under :
<name>.claude/skills/- Check whether exists (exact directory name match)
~/.claude/skills/<name>/ - If it exists → candidate disposition: (if local differs from global) or
move-to-global(if identical)delete - If the global catalog is unreadable → emit at INFO level; assign disposition
Global catalog unreadable — duplicate check skippedkeep
D9-3. Structural completeness
Read each local . Apply the same format-aware check as D4b (see for the authoritative contract):
.claude/skills/<name>/SKILL.mddocs/format-types.md- Parse YAML frontmatter block (content between the first pair). Extract
---value. If absent → treat asformat:.procedural - If value is unrecognized → emit INFO finding and treat as
format:.procedural - Apply the format-to-required-section check:
| Resolved format | Required section | Accepted headings (any one satisfies) | Finding if absent |
|---|---|---|---|
| Process section | | record as missing |
| Patterns section (one of) | | record as missing |
| Examples section (one of) | | record as missing |
| Anti-patterns section (one of) | | record as missing |
- Missing and
**Triggers**are checked for all format types (unchanged).## Rules - For or
referenceskills: missinganti-patternis not a finding.## Process
If any required section is absent:
- Record missing sections per skill
- Assign disposition:
update - Action:
add_missing_section
If no exists in the directory:
SKILL.md- 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 outside fenced code blocks.
SKILL.mdIf 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.mdIf a technology name is absent from BOTH AND /:
ai-context/stack.mdpackage.jsonpyproject.toml- Disposition:
update - Action:
flag_irrelevant - Severity: INFO only
If neither stack source ( nor /) is found:
stack.mdpackage.jsonpyproject.tomlStack 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。
注意 — 全局配置循环检测:审计全局配置仓库本身时,解析为(根目录)。此时下的每个子目录在中都有对应的副本,因为它们是部署的相同文件。D9-2重复检测会为所有子目录分配处置 — 这是正确的预期行为(它们是权威来源,而非重复项)。
$LOCAL_SKILLS_DIR"skills"skills/~/.claude/skills/install.shkeepD9-2. 重复检测
对下的每个子目录:
.claude/skills/<name>- 检查是否存在(完全匹配目录名)
~/.claude/skills/<name>/ - 如果存在 → 候选处置:(如果本地与全局不同)或
move-to-global(如果完全相同)delete - 如果全局目录不可读 → 输出信息级结果:,分配处置
Global catalog unreadable — duplicate check skippedkeep
D9-3. 结构完整性
读取每个本地,应用与D4b相同的格式感知检查(权威定义见):
.claude/skills/<name>/SKILL.mddocs/format-types.md- 解析YAML前置块(第一个对之间的内容),提取
---值。如果缺失 → 视为format:。procedural - 如果值无法识别 → 输出信息级结果并视为
format:。procedural - 应用格式到必填章节的检查:
| 解析后的格式 | 必填章节 | 可接受标题(满足其一即可) | 缺失时记录结果 |
|---|---|---|---|
| 流程章节 | | 记录为缺失 |
| 模式章节(二选一) | | 记录为缺失 |
| 示例章节(二选一) | | 记录为缺失 |
| 反模式章节(二选一) | | 记录为缺失 |
- 所有格式类型中,缺失和
**Triggers**仍需检查(未改变)。## Rules - 对于或
reference技能:缺失anti-pattern不视为检查结果。## Process
如果有任何必填章节缺失:
- 记录每个技能的缺失章节
- 分配处置:
update - 操作:
add_missing_section
如果目录中没有:
SKILL.md- 记录为
SKILL.md missing - 分配处置:
update - 操作:
add_missing_section
D9-4. 语言合规性
对每个本地的正文(排除 fenced 代码块)应用D4e语言合规性启发式检查(定义见维度4)。
SKILL.md如果发现非英文内容:
- 处置:
update - 操作:
flag_language_violation - 严重程度:仅信息级 — 不扣除分数
D9-5. 技术栈相关性
从每个本地的触发行和标题中提取技术引用。
SKILL.md如果技术名称在和/中均不存在:
ai-context/stack.mdpackage.jsonpyproject.toml- 处置:
update - 操作:
flag_irrelevant - 严重程度:仅信息级
如果未找到技术栈来源(和/均不存在):
stack.mdpackage.jsonpyproject.tomlStack relevance check skipped — no stack source foundDimension 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 variable produced by the Phase A bash script (see Rule 8). If , use config-driven detection. If , fall back to heuristic detection.
FEATURE_DOCS_CONFIG_EXISTSFEATURE_DOCS_CONFIG_EXISTS=10目标:使用配置驱动或启发式发现,检测项目中功能/技能文档的缺口,并按功能报告覆盖度。仅为信息性,不影响评分。
跳过条件:如果未检测到功能(配置驱动和启发式均未检测到)→ 输出信息级结果:'No feature directories detected — Dimension 10 skipped.' 不影响评分。
阶段A发现扩展:该维度读取阶段A bash脚本生成的变量(见规则8)。如果,使用配置驱动检测;如果为0,回退到启发式检测。
FEATURE_DOCS_CONFIG_EXISTSFEATURE_DOCS_CONFIG_EXISTS=1Config-driven detection
配置驱动检测
If a project exists and contains a key:
config.yamlfeature_docs:- Read the field (
convention|skill|markdown)mixed - Read the list (directories to scan for feature docs)
paths - Read the block:
feature_detection(strategy|directory|prefix),explicit(root directory whose subdirs are treated as features), androotlistexclude
Use this configuration as the source of truth for feature names and doc locations.
如果项目存在且包含键:
config.yamlfeature_docs:- 读取字段(
convention|skill|markdown)mixed - 读取列表(扫描功能文档的目录)
paths - 读取块:
feature_detection(strategy|directory|prefix)、explicit(其子目录视为功能的根目录)和root列表exclude
使用此配置作为功能名称和文档位置的权威来源。
Heuristic detection fallback
启发式检测回退
If no key is present in the project config, run the following heuristic algorithm:
feature_docs: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
undefinedEXCLUDE = [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
undefinedD10 checks (run per detected feature)
D10检查(对每个检测到的功能)
D10-a Coverage: Verify that each detected feature has a corresponding documentation file.
- If : PASS (✅) if
convention=skillexists; FAIL (⚠️) otherwise$LOCAL_SKILLS_DIR/<feature_name>/SKILL.md - If : PASS (✅) if at least one
convention=markdownfile in the configured paths references.md; FAIL (⚠️) otherwisefeature_name - If : PASS (✅) if either a skill or a markdown doc is found; FAIL (⚠️) otherwise
convention=mixed
D10-b Structural Quality: Verify that the found documentation has proper structure.
- If doc is a : PASS (✅) if frontmatter (
SKILL.mdblock) present AND---/**Triggers**defined AND## Triggerssection AND## Processsection; WARN (⚠️) if any of the above is missing## Rules - If doc is a file (not SKILL.md): PASS (✅) if has
.md(H1) AND at least one# title(H2); WARN (⚠️) if missing either; N/A if doc not found## section
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 exists on disk; if NOT found → flag as stale (⚠️)
[project_root][path] - 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 → verify it appears in the CLAUDE.md Skills Registry section.
.claude/skills/- Read CLAUDE.md (or )
.claude/CLAUDE.md - Check if appears in the Skills Registry section
feature_name - 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 - 如果:通过(✅)如果找到技能或markdown文档;否则失败(⚠️)
convention=mixed
D10-b 结构质量:验证找到的文档结构是否正确。
- 如果文档是:通过(✅)如果存在前置块(
SKILL.md块)且定义了---/**Triggers**、## Triggers章节和## Process章节;如果任何一项缺失则警告(⚠️)## Rules - 如果文档是文件(非SKILL.md):通过(✅)如果有
.md(H1)和至少一个# title(H2);如果缺失任何一项则警告(⚠️);如果未找到文档则不适用## section
D10-c 代码新鲜度:扫描文档文件中的路径引用,验证它们是否仍存在于磁盘上。
- 读取文档文件内容
- 提取所有匹配、
/src/[^\s]+、/lib/[^\s]+的路径类字符串/app/[^\s]+ - 对每个提取的路径:检查是否存在;如果不存在 → 标记为过期(⚠️)
[项目根目录][path] - 如果未找到过期路径或文档中无路径则通过(✅);如果未找到文档则不适用
D10-d 注册表一致性:如果文档是中的SKILL.md → 验证是否出现在CLAUDE.md的技能注册表章节中。
.claude/skills/- 读取CLAUDE.md(或)
.claude/CLAUDE.md - 检查是否出现在技能注册表章节中
feature_name - 如果找到则通过(✅);如果未找到则输出信息级结果(ℹ️)(非警告 — 项目可能有意使功能无技能条目);如果文档不是SKILL.md则不适用
Output format
输出格式
Emit a per-feature coverage table:
| Feature | Doc found | Structure OK | Fresh | In Registry | Status |
|---|---|---|---|---|---|
| [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 or in the FIX_MANIFEST. /project-fix does not act on D10 findings.
required_actionsskill_quality_actions输出按功能分类的覆盖度表:
| 功能 | 找到文档 | 结构正确 | 新鲜度 | 在注册表中 | 状态 |
|---|---|---|---|---|---|
| [名称] | ✅/❌ | ✅/⚠️/不适用 | ✅/⚠️/不适用 | ✅/ℹ️/不适用 | ✅/⚠️/❌ |
状态列逻辑:所有适用检查通过则✅;任何检查警告则⚠️;D10-a(覆盖度)失败则❌。
FIX_MANIFEST规则:D10检查结果不得添加到FIX_MANIFEST的或中。不会处理D10结果。
required_actionsskill_quality_actions/project-fixDimension 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 does not exist as a directory AND no root exists → emit INFO: No score impact.
$LOCAL_SKILLS_DIRCLAUDE.md'No auditable files found — Dimension 11 skipped.'Scope: All files under (emitted by the Phase A script) plus the root (if it exists).
SKILL.md$LOCAL_SKILLS_DIRCLAUDE.mdTool constraint: D11 uses only Read, Glob, and Grep tools for file analysis. No Bash calls.
目标:验证单个技能文件和CLAUDE.md是否内部自洽 — 标题中的数字声明与实际章节计数匹配,编号序列无缺口或重复,前置块描述与正文一致。仅为信息性,不影响评分。
跳过条件:如果不存在且根目录无 → 输出信息级结果: 不影响评分。
$LOCAL_SKILLS_DIRCLAUDE.md'No auditable files found — Dimension 11 skipped.'范围:下的所有文件(阶段A脚本输出)加上根目录的(如果存在)。
$LOCAL_SKILLS_DIRSKILL.mdCLAUDE.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?)/iFor 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 field
description - If contains a numeric claim (reuse
description) → verify that claim against the body using the same logic as D11-aCLAIM_PATTERN - If mismatch → finding with severity INFO
- If no frontmatter or no field → skip this check for that file
description
FIX_MANIFEST rule: D11 findings go in only with severity . Rule names: , , . D11 findings MUST NOT appear in or . /project-fix does not act on D11 findings.
violations[]infoD11-count-consistencyD11-numbering-continuityD11-frontmatter-bodyrequired_actionsskill_quality_actions- 解析YAML前置块(第一个对之间的内容)
--- - 提取字段
description - 如果包含数字声明(复用
description)→ 使用与D11-a相同的逻辑验证是否与正文一致CLAIM_PATTERN - 如果不匹配 → 输出信息级结果
- 如果没有前置块或字段 → 跳过该文件的此检查
description
FIX_MANIFEST规则:D11结果仅添加到中,严重程度为。规则名称:、、。D11结果不得添加到或中。不会处理D11结果。
violations[]infoD11-count-consistencyD11-numbering-continuityD11-frontmatter-bodyrequired_actionsskill_quality_actions/project-fixDimension 12 — ADR Coverage
维度12 — ADR覆盖度
Objective: Audit the health and completeness of the ADR (Architecture Decision Record) system when the project references . Informational only — no impact on the 100-point score.
docs/adr/Activation condition: Read CLAUDE.md (or ). Check whether the string appears anywhere in the content.
.claude/CLAUDE.mddocs/adr/- If 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.
docs/adr/ - If IS found in CLAUDE.md → proceed with the following checks.
docs/adr/
D12-1. README existence check:
- Use from Phase A output.
ADR_README_EXISTS - If : emit a HIGH finding — "CLAUDE.md references docs/adr/ but docs/adr/README.md is missing"
ADR_README_EXISTS=0 - Add to in the FIX_MANIFEST with
required_actions.high,type: create_file,target: docs/adr/README.mdreason: "CLAUDE.md references docs/adr/ but docs/adr/README.md is missing"
D12-2. Per-ADR Status field scan:
- Use Glob to list all files matching (where NNN is a 3-digit prefix, e.g.,
docs/adr/NNN-*.md,001-).002- - If no ADR files are found (only README.md or directory empty): emit INFO — "docs/adr/ contains no ADR files yet". No score impact.
- For each matched ADR file:
- Read the file content.
- Search for a section (line starting with
## Status) OR a frontmatter## Statusfield.status: - If neither is found: emit a MEDIUM finding — "ADR file [filename] is missing a valid status field"
- Add to in the FIX_MANIFEST with
required_actions.medium,type: update_file,target: [docs/adr/filename]reason: "ADR file is missing a valid status field" - Valid status values: ,
accepted,deprecated. If a status field IS found, record its value for the output table; do not validate the value (custom statuses are allowed).superseded
FIX_MANIFEST rule: D12 HIGH findings go in (actionable by /project-fix). D12 MEDIUM findings go in . D12 INFO findings go in with severity . D12 does NOT reduce the base 100-point score.
required_actions.highrequired_actions.mediumviolations[]info目标:当项目引用时,审计ADR(架构决策记录)系统的健康度和完整性。仅为信息性,不影响100分基础评分。
docs/adr/激活条件:读取CLAUDE.md(或),检查内容中是否出现字符串。
.claude/CLAUDE.mddocs/adr/- 如果CLAUDE.md中未找到→ 输出信息级结果:"ADR Coverage check skipped — docs/adr/ not referenced in CLAUDE.md",并跳过以下所有子检查。不向FIX_MANIFEST添加任何结果。
docs/adr/ - 如果CLAUDE.md中找到→ 执行以下检查。
docs/adr/
D12-1. README存在性检查:
- 使用阶段A输出中的。
ADR_README_EXISTS - 如果:输出高严重程度结果 — "CLAUDE.md references docs/adr/ but docs/adr/README.md is missing"
ADR_README_EXISTS=0 - 将该结果添加到FIX_MANIFEST的中,类型为
required_actions.high,目标为create_file,原因:"CLAUDE.md references docs/adr/ but docs/adr/README.md is missing"docs/adr/README.md
D12-2. 每个ADR的状态字段扫描:
- 使用Glob列出所有匹配的文件(NNN为3位前缀,如
docs/adr/NNN-*.md、001-)。002- - 如果未找到ADR文件(仅存在README.md或目录为空):输出信息级结果 — "docs/adr/ contains no ADR files yet",不影响评分。
- 对每个匹配的ADR文件:
- 读取文件内容。
- 搜索章节(以
## Status开头的行)或前置块## Status字段。status: - 如果均未找到:输出中等严重程度结果 — "ADR file [filename] is missing a valid status field"
- 将该结果添加到FIX_MANIFEST的中,类型为
required_actions.medium,目标为update_file,原因:"ADR file is missing a valid status field"[docs/adr/filename] - 有效状态值:、
accepted、deprecated。如果找到状态字段,记录其值到输出表中;不验证值(允许自定义状态)。superseded
FIX_MANIFEST规则:D12高严重程度结果添加到中(可处理)。D12中等严重程度结果添加到中。D12信息级结果添加到中,严重程度为。D12不扣除100分基础评分。
required_actions.high/project-fixrequired_actions.mediumviolations[]infoDimension 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 returns spec artifacts.
mem_search(query: "sdd/", project: "{project}")- 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:
- For each that exists (found in D13-1):
spec.md- 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 in the FIX_MANIFEST with
violations[],rule: "D13-stale-path-reference",severity: "info"file: "engram spec artifact"
- INFO findings for stale paths are NOT added to — they are advisory only.
required_actions
FIX_MANIFEST rule: D13 MEDIUM findings (missing spec.md) go in (actionable by /project-fix). D13 INFO findings (stale path references) go in only. D13 does NOT reduce the base 100-point score.
required_actions.mediumviolations[]目标:审计规范层的健康度 — 验证Engram中的规范产物是否有有效的路径引用。仅为信息性,不影响100分基础评分。
激活条件:Engram可达且返回规范产物。
mem_search(query: "sdd/", project: "{project}")- 如果Engram不可达或未找到规范产物 → 输出信息级结果:"Spec Coverage check skipped — no spec artifacts found in engram",并跳过以下所有子检查。不向FIX_MANIFEST添加任何结果。
- 如果满足条件 → 执行以下检查。
D13-1. 每个规范的路径引用扫描:
- 对每个存在的(D13-1中找到的):
spec.md- 读取文件内容。
- 提取所有路径类引用:看起来像文件路径的字符串(包含且无空格,不在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,文件为infoengram spec artifact
- 过期路径的信息级结果不添加到中 — 仅为建议性。
required_actions
FIX_MANIFEST规则:D13中等严重程度结果(缺失spec.md)添加到中(可处理)。D13信息级结果(过期路径引用)仅添加到中。D13不扣除100分基础评分。
required_actions.medium/project-fixviolations[]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:
- Read at project root; count characters
CLAUDE.md - 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
- IF character count > budget:
→ Add INFO finding:
"CLAUDE.md is [N] chars ([N-budget] over [budget] budget). Consider extracting content to skills (ADR-041)." - IF character count <= budget:
→ Add INFO finding:
"CLAUDE.md budget OK: [N]/[budget] chars."
Findings are appended to in a section. They do NOT affect any audit score dimension.
audit-report.md## Budget Compliance该维度在每次project-audit调用时运行,根据ADR-041中定义的治理预算报告字符计数。
检查1 — CLAUDE.md预算:
- 读取项目根目录的,统计字符数
CLAUDE.md - 确定项目类型:
- 如果项目检测为global-config(存在install.sh + sync.sh):全局预算=20,000字符
- 否则:项目预算=5,000字符
- 如果字符数>预算:
→ 添加信息级结果:
"CLAUDE.md is [N] chars ([N-budget] over [budget] budget). Consider extracting content to skills (ADR-041)." - 如果字符数≤预算:
→ 添加信息级结果:
"CLAUDE.md budget OK: [N]/[budget] chars."
结果会追加到的章节中,不影响任何审计评分维度。
audit-report.md## Budget ComplianceReport Format
报告格式
The report is saved in with this exact structure:
.claude/audit-report.mdmarkdown
undefined报告保存为,结构如下:
.claude/audit-report.mdmarkdown
undefinedAudit 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
| Dimension | Points | Max | Status |
|---|---|---|---|
| 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 Quality | N/A | N/A | ✅/ℹ️/— |
| Feature Docs Coverage | N/A | N/A | ✅/ℹ️/— |
| Internal Coherence | N/A | N/A | ✅/ℹ️/— |
| ADR Coverage | N/A | N/A | ✅/ℹ️/— |
| Spec Coverage | N/A | N/A | ✅/ℹ️/— |
| Budget Compliance | N/A | N/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]
| Check | Status | Detail |
|---|---|---|
Exists | ✅/❌ | |
| 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 path | Exists |
|---|---|
| docs/templates/prd-template.md | ✅/❌ |
| docs/templates/adr-template.md | ✅/❌ |
| [or: "No docs/templates/*.md paths found in CLAUDE.md — check skipped"] |
| 检查内容 | 状态 | 详情 |
|---|---|---|
存在 | ✅/❌ | |
| 超过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]
| File | Exists | Lines | Content | Coherence |
|---|---|---|---|---|
| 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:
| File | Phrase found | Severity |
|---|---|---|
| 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:
| Skill | Exists |
|---|---|
| sdd-explore | ✅/❌ |
| sdd-propose | ✅/❌ |
| sdd-spec | ✅/❌ |
| sdd-design | ✅/❌ |
| sdd-tasks | ✅/❌ |
| sdd-apply | ✅/❌ |
| sdd-verify | ✅/❌ |
| sdd-archive | ✅/❌ |
Engram availability:
| Check | Status |
|---|---|
| Engram MCP reachable | ✅/❌ |
CLAUDE.md mentions SDD: ✅/❌
Orphaned changes: [none | list]
Hook script existence:
| Hook event | Script path | Exists |
|---|---|---|
| [event] | [path] | ✅/❌ |
| [or: "No hooks key found in settings files — check skipped"] |
Active changes — file conflict detection:
| File | Change A | Change 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 file | Reference | Problem |
|---|---|---|
| [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/Pattern | Expected | Found |
|---|---|---|
| [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]
| Skill | Duplicate of global | Structural complete | Language OK | Stack relevant | Disposition |
|---|---|---|---|---|---|
| [skill-name] | ⚠️ YES / ❌ NO | ✅ / ⚠️ (missing: list) | ✅ / ℹ️ violation | ✅ / ℹ️ flag / ℹ️ UNKNOWN | keep/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本地技能目录:[的值] — [找到N个技能 | 未找到 — 已跳过]
$LOCAL_SKILLS_DIR| 技能名称 | 全局重复项 | 结构完整 | 语言合规 | 技术栈相关 | 处置 |
|---|---|---|---|---|---|
| [技能名称] | ⚠️ 是 / ❌ 否 | ✅ / ⚠️(缺失:列表) | ✅ / ℹ️ 违规 | ✅ / ℹ️ 标记 / ℹ️ 未知 | 保留/更新/删除/移至全局 |
结构章节缺失的技能:
[列表或"无"]
语言违规(信息级 — 需手动修复):
[列表或"无"]
技术栈相关性问题(信息级):
[列表或"无"]
注意:维度9在本次迭代中不影响得分。除非操作类型为,否则结果仅为信息性。
delete_duplicateDimension 10 — Feature Docs Coverage [OK|INFO|SKIPPED]
维度10 — 功能文档覆盖度 [OK|INFO|SKIPPED]
Detection mode: configured | heuristic | skipped
Features detected: [N] ([list of names])
| Feature | Doc found | Structure OK | Fresh | In Registry | Status |
|---|---|---|---|---|---|
| [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
| Skill | Count OK | Numbering OK | Frontmatter OK | Findings |
|---|---|---|---|---|
| [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.
扫描的技能:从中扫描[N]个
$LOCAL_SKILLS_DIR| 技能名称 | 计数一致 | 编号连续 | 前置块一致 | 检查结果 |
|---|---|---|---|---|
| [技能名称] | ✅/⚠️ | ✅/⚠️ | ✅/⚠️/不适用 | [详情或"无问题"] |
检测到的不一致性:[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]
| ADR | Status field found | Status value | Finding |
|---|---|---|---|
| [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]
| Domain | spec.md found | Stale paths | Status |
|---|---|---|---|
| [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运行):
- [concrete action] → run or manually: [instruction]
/project-fix
- [具体操作] → 运行或手动操作:[说明]
/project-fix
High (degrade quality):
高(降低质量):
- [concrete action]
- [具体操作]
Medium:
中:
- [concrete action]
- [具体操作]
Low (optional improvements):
低(可选改进):
- [concrete action]
To implement these corrections: run
This report was generated by — do not modify the FIX_MANIFEST block manually
/project-fix/project-audit
---- [具体操作]
要实施这些修正:运行
此报告由生成 — 请勿手动修改FIX_MANIFEST块
/project-fix/project-audit
---Detailed Scoring
详细评分
| Dimension | Criterion | Max points |
|---|---|---|
| CLAUDE.md | Exists + complete structure + accurate stack + SDD refs | 20 |
| Memory — existence | All 5 files exist | 15 |
| Memory — quality | Substantial content + coherent with code | 10 |
| SDD Orchestrator | Global skills + Engram availability + CLAUDE.md refs | 20 |
| Skills | Registry accuracy + content depth = 10 pts; global tech skills coverage (D4c) = 10 pts | 20 |
| Cross-references | No broken references | 5 |
| Architecture | No critical violations in samples | 5 |
| Testing & Verification | config.yaml has testing block + archived changes have verify-report.md | 5 |
| Project Skills Quality | Informational only — no score deduction in iteration 1. Flags duplicates, structural gaps, language violations, stack relevance issues. | N/A |
| Feature Docs Coverage | Informational only — no score deduction. Detects feature/skill documentation gaps. | N/A |
| Internal Coherence | Informational only — no score deduction. Validates count claims, section numbering, and frontmatter consistency within individual skill files. | N/A |
| ADR Coverage | Informational 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 Coverage | Informational 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 Compliance | Informational 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.md | 5 |
| 项目技能质量 | 仅为信息性 — 迭代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
规则
-
I always read real files — I never assume the content of a file
-
I run in a subagent with read tools — never in main context
-
I always save the report inbefore presenting to the user
.claude/audit-report.md -
The FIX_MANIFEST is valid YAML — I verify that the block is parseable
-
I never modify anything — this skill is 100% read-only
-
If I cannot read a file, I report it as ❌ with the exact error, I do not assume it does not exist
-
When finished, I notify the user: "Report saved in. To implement the corrections:
.claude/audit-report.md"/project-fix -
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, orwc -lcalls per dimension.find -
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 aline in stdout):key=value- — 1 if
CLAUDE_MD_EXISTSexists, 0 if absent.claude/CLAUDE.md - — 1 if root
ROOT_CLAUDE_MD_EXISTSexists, 0 if absentCLAUDE.md - — 1 if Engram MCP is reachable, 0 if not
ENGRAM_REACHABLE - — 1 if
INSTALL_SH_EXISTSexists at project root, 0 if absentinstall.sh - — 1 if
SYNC_SH_EXISTSexists at project root, 0 if absentsync.sh - — string:
LOCAL_SKILLS_DIR(global-config detected via Condition A or B) or"skills"(standard project)".claude/skills" - — 1 if
STACK_MD_EXISTSexists, 0 if absentai-context/stack.md - — 1 if
ARCH_MD_EXISTSexists, 0 if absentai-context/architecture.md - — 1 if
CONV_MD_EXISTSexists, 0 if absentai-context/conventions.md - — 1 if
ISSUES_MD_EXISTSexists, 0 if absentai-context/known-issues.md - — 1 if
CHANGELOG_MD_EXISTSexists, 0 if absentai-context/changelog-ai.md - — integer line count of root
CLAUDE_MD_LINES(0 if absent)CLAUDE.md - — integer line count of
STACK_MD_LINES(0 if absent)ai-context/stack.md - — comma-separated names of orphaned change dirs, or
ORPHANED_CHANGESNONE - — integer count of present
SDD_SKILLS_PRESENTfiles (0–8)~/.claude/skills/sdd-*/SKILL.md - — 1 if project config.yaml contains a
FEATURE_DOCS_CONFIG_EXISTSkey, 0 if absentfeature_docs: - — 1 if
ANALYSIS_REPORT_EXISTSexists at project root, 0 if absentanalysis-report.md - — ISO date string from the
ANALYSIS_REPORT_DATEfield ofLast analyzed:, or empty string if absentanalysis-report.md - — 1 if
ROOT_SETTINGS_JSON_EXISTSexists at project root, 0 if absentsettings.json - — 1 if
DOTCLAUDE_SETTINGS_JSON_EXISTSexists, 0 if absent.claude/settings.json - — 1 if
SETTINGS_LOCAL_JSON_EXISTSexists at project root, 0 if absentsettings.local.json - — 1 if
ADR_DIR_EXISTSdirectory exists, 0 if absentdocs/adr/ - — 1 if
ADR_README_EXISTSexists, 0 if absentdocs/adr/README.md - — 1 if engram contains spec artifacts for this project, 0 if absent
ENGRAM_HAS_SPECS
Legacy commands/ detection (Phase A post-script check):After running the Phase A script, check whetherexists in the project root:.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- Severity: LOW (informational)
- Score penalty: none
- FIX_MANIFEST entry: none (do NOT add a entry for this finding)
required_actions
-
始终读取真实文件 — 绝不假设文件内容
-
在子代理中运行,使用读取工具 — 绝不使用主上下文
-
始终保存报告,在展示给用户前保存至
.claude/audit-report.md -
FIX_MANIFEST必须是有效的YAML — 验证该块可解析
-
绝不修改任何内容 — 该技能100%只读
-
如果无法读取文件,报告为❌并附上确切错误,绝不假设文件不存在
-
完成后,通知用户:"Report saved in. To implement the corrections:
.claude/audit-report.md"/project-fix -
所有基于shell的发现必须合并到单个Bash脚本调用中(阶段A)。每次审计运行最多3次Bash调用。绝不为每个维度单独调用、
ls、grep或wc -l。find -
兼容性行为必须明确 — 如果接受遗留或仓库特定结构,技能需将其记录为兼容性策略,而非隐含在维度中。阶段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- — 1表示
CLAUDE_MD_EXISTS存在,0表示缺失.claude/CLAUDE.md - — 1表示根目录
ROOT_CLAUDE_MD_EXISTS存在,0表示缺失CLAUDE.md - — 1表示Engram MCP可达,0表示不可达
ENGRAM_REACHABLE - — 1表示项目根目录存在
INSTALL_SH_EXISTS,0表示缺失install.sh - — 1表示项目根目录存在
SYNC_SH_EXISTS,0表示缺失sync.sh - — 字符串:
LOCAL_SKILLS_DIR(通过条件A或B检测为全局配置仓库)或"skills"(标准项目)".claude/skills" - — 1表示
STACK_MD_EXISTS存在,0表示缺失ai-context/stack.md - — 1表示
ARCH_MD_EXISTS存在,0表示缺失ai-context/architecture.md - — 1表示
CONV_MD_EXISTS存在,0表示缺失ai-context/conventions.md - — 1表示
ISSUES_MD_EXISTS存在,0表示缺失ai-context/known-issues.md - — 1表示
CHANGELOG_MD_EXISTS存在,0表示缺失ai-context/changelog-ai.md - — 根目录
CLAUDE_MD_LINES的整数行数(缺失则为0)CLAUDE.md - —
STACK_MD_LINES的整数行数(缺失则为0)ai-context/stack.md - — 孤立变更目录的逗号分隔名称,或
ORPHANED_CHANGESNONE - — 存在的
SDD_SKILLS_PRESENT文件的整数计数(0–8)~/.claude/skills/sdd-*/SKILL.md - — 1表示项目config.yaml包含
FEATURE_DOCS_CONFIG_EXISTS键,0表示缺失feature_docs: - — 1表示项目根目录存在
ANALYSIS_REPORT_EXISTS,0表示缺失analysis-report.md - —
ANALYSIS_REPORT_DATE中analysis-report.md字段的ISO日期字符串,缺失则为空Last analyzed: - — 1表示项目根目录存在
ROOT_SETTINGS_JSON_EXISTS,0表示缺失settings.json - — 1表示
DOTCLAUDE_SETTINGS_JSON_EXISTS存在,0表示缺失.claude/settings.json - — 1表示项目根目录存在
SETTINGS_LOCAL_JSON_EXISTS,0表示缺失settings.local.json - — 1表示
ADR_DIR_EXISTS目录存在,0表示缺失docs/adr/ - — 1表示
ADR_README_EXISTS存在,0表示缺失docs/adr/README.md - — 1表示Engram包含该项目的规范产物,0表示缺失
ENGRAM_HAS_SPECS
遗留命令/检测(阶段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:
- — 1 if
ANALYSIS_REPORT_EXISTSexists at the project root, 0 if absentanalysis-report.md - — ISO date string from the
ANALYSIS_REPORT_DATEfield, or empty string if absentLast analyzed:
Important constraints:
- does NOT invoke
project-auditautomatically.project-analyzeis treated as external input produced by a prioranalysis-report.mdrun./project-analyze - D7 in Phase B reads and
ANALYSIS_REPORT_EXISTSto compute its score and staleness warning.ANALYSIS_REPORT_DATE - 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使用:
- — 1表示项目根目录存在
ANALYSIS_REPORT_EXISTS,0表示缺失analysis-report.md - —
ANALYSIS_REPORT_DATE字段的ISO日期字符串,缺失则为空Last analyzed:
重要约束:
- 不会自动调用
project-audit。project-analyze视为外部输入,由之前的analysis-report.md运行生成。/project-analyze - 阶段B的D7读取和
ANALYSIS_REPORT_EXISTS来计算得分和过期警告。ANALYSIS_REPORT_DATE - 这两个变量已添加到现有阶段A Bash脚本模板中 — 无需额外调用Bash。每次审计运行的Bash调用总数仍≤3。
undefined