project-fix

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

project-fix

project-fix

Implements the corrections found by /project-audit. Reads audit-report.md as a spec and executes each required action.
Triggers:
/project-fix
, apply audit corrections, fix claude project, implement audit

执行/project-audit工具发现的修正内容。读取audit-report.md作为规范并执行每项必要操作。
触发方式
/project-fix
、应用审计修正、修复Claude项目、执行审计修正

Role in the SDD meta-configuration flow

在SDD元配置流程中的角色

This skill is the equivalent of the APPLY phase of the SDD cycle, applied to project configuration:
/project-audit  →  audit-report.md  →  /project-fix  →  /project-audit (verify)
     (spec)           (artifact)          (apply)           (verify)
The
audit-report.md
generated by
/project-audit
is the INPUT of this skill. Without that artifact, this skill cannot operate.
Absolute rule: This skill NEVER invents corrections. It only implements what is in
FIX_MANIFEST
from audit-report.md.

本技能相当于SDD周期中的APPLY阶段,应用于项目配置:
/project-audit  →  audit-report.md  →  /project-fix  →  /project-audit (验证)
     (规范)           (产物)          (应用)           (验证)
/project-audit
生成的
audit-report.md
是本技能的输入。没有该产物,本技能无法运行。
绝对规则:本技能绝不会自行发明修正内容,仅执行audit-report.md中
FIX_MANIFEST
里的内容。

Prerequisite: audit-report.md

前置条件:audit-report.md

Before anything else, I verify that
.claude/audit-report.md
exists.
If it does NOT exist:
❌ .claude/audit-report.md not found

This skill requires /project-audit to have been run first.
The audit report is the specification I implement.

Please run: /project-audit
If it exists but is more than 7 days old:
⚠️ The audit-report.md is [N] days old (generated: [date])

Options:
  1. Use the existing report anyway (may be outdated)
  2. Run /project-audit first for a fresh diagnosis

How would you like to proceed?

在执行任何操作前,我会先验证
.claude/audit-report.md
是否存在。
如果该文件不存在:
❌ .claude/audit-report.md 未找到

本技能需要先运行/project-audit。
审计报告是我执行操作的规范依据。

请运行:/project-audit
如果文件存在但已超过7天:
⚠️ audit-report.md 已过期[N]天(生成时间:[日期])

选项:
  1. 仍使用现有报告(可能已过时)
  2. 先运行/project-audit获取最新诊断结果

您希望如何操作?

Execution Model

执行模型

project-fix
operates as a stable executor with three stages:
StageResponsibilityOutput
Manifest intakeRead and validate
audit-report.md
and its
FIX_MANIFEST
Parsed action lists, readiness to execute
Phase executionApply the permitted actions in severity and phase orderCreated files, modified files, skip/failure outcomes
Final reportingRecord the run and present the resulting state
ai-context/changelog-ai.md
entry and final fix summary
The execution model is intentionally stable. Detailed handlers may evolve, but the command remains: intake, execute, report.

project-fix
作为稳定的执行器,包含三个阶段:
阶段职责输出
清单导入读取并验证
audit-report.md
及其
FIX_MANIFEST
解析后的操作列表、执行就绪状态
阶段执行按严重程度和阶段顺序执行允许的操作创建的文件、修改的文件、跳过/失败结果
最终报告记录运行情况并展示最终状态
ai-context/changelog-ai.md
条目和最终修复总结
执行模型设计为稳定可靠。具体处理逻辑可能会演进,但核心命令始终是:导入、执行、报告。

Action Classes

操作类别

project-fix
uses three action classes.
ClassTypical examplesSide effectsConfirmation model
Automatic actionscreate missing files, append missing sections, add safe markersYesExecuted inside the approved phase flow
Guided actionsdelete duplicate local skills, optional phase execution decisionsYesExplicit confirmation required
Informational actions
move-to-global
, language violations, deprecated or unknown manifest items
No automatic side effectsReport only
Notes:
  • The class is more important than the specific handler name. Handlers are implementations of one of these three behavior types.
  • Informational actions may still be important, but they never acquire automatic mutation behavior just because they appear in the manifest.

project-fix
使用三类操作。
类别典型示例副作用确认机制
自动操作创建缺失文件、追加缺失章节、添加安全标记在已批准的阶段流程中自动执行
引导式操作删除重复的本地技能、可选阶段执行决策需要明确的用户确认
信息类操作
move-to-global
、语言违规、已弃用或未知的清单项
无自动副作用仅进行报告
注意事项:
  • 操作类别比具体处理程序名称更重要。处理程序是这三类行为类型的具体实现。
  • 信息类操作可能仍然很重要,但绝不会因为出现在清单中就自动获得修改权限。

Compatibility Policy

兼容性政策

Compatibility behavior is a separate policy layer of
project-fix
, not an implicit side effect of individual handlers.
Compatibility rules currently include:
  • Stale-manifest compatibility: if an older audit report contains deprecated action types, the command preserves safety first and avoids speculative edits.
  • Deprecated mechanism compatibility: any action that targets
    .claude/commands/
    is skipped because commands/ is deprecated.
  • Two-tier placement compatibility:
    move-to-global
    remains informational only; no automated writes to
    ~/.claude/skills/
    are allowed.
  • Unknown-action compatibility: unsupported or unknown action types are downgraded to skip-or-recommendation behavior, never automatic mutation.
This policy MUST be explicit whenever compatibility behavior affects whether an action is executed.

兼容性行为是
project-fix
的独立政策层,并非单个处理程序的隐式副作用。
当前的兼容性规则包括:
  • 过时清单兼容性:如果旧版审计报告包含已弃用的操作类型,命令会优先保障安全,避免推测性编辑。
  • 已弃用机制兼容性:任何针对
    .claude/commands/
    的操作都会被跳过,因为commands/已被弃用。
  • 双层放置兼容性
    move-to-global
    仅作为信息类操作;不允许自动写入
    ~/.claude/skills/
  • 未知操作兼容性:不支持或未知的操作类型会降级为跳过或建议行为,绝不会自动执行修改。
当兼容性行为影响操作是否执行时,必须明确说明。

Process

流程

Step 1 — Read and parse the FIX_MANIFEST

步骤1 — 读取并解析FIX_MANIFEST

I read the
FIX_MANIFEST
block from
audit-report.md
. I extract:
  • required_actions.critical[]
  • required_actions.high[]
  • required_actions.medium[]
  • required_actions.low[]
  • missing_global_skills[]
  • orphaned_changes[]
  • violations[]
  • skill_quality_actions[]
    (Dimension 9 — may be absent if D9 was skipped)
I normalize the parsed items into action classes:
  • Automatic: safe file creation or additive update actions described by the manifest
  • Guided: destructive or user-choice actions that require explicit confirmation before side effects
  • Informational: recommendation-only, deprecated, or unknown action types that must not execute automatically
If an action type is deprecated, unsupported, or unknown:
  • I do NOT execute it automatically
  • I report it as
    skipped
    or
    recommendation only
  • I preserve the rest of the fix run
I present the user a summary of what I am going to do:
📋 Fix Plan — [Project Name]
Based on audit from [date]
Current score: [XX]/100

Actions to execute:
  ❌ Critical : [N] actions
  ⚠️ High     : [N] actions
  ℹ️ Medium   : [N] actions
  💡 Low      : [N] actions (optional)

Execute all corrections? (critical + high + medium)
  S → Execute all recommended
  C → Critical only (minimum for functional SDD)
  R → Review one by one
  N → Cancel
I wait for the user's response before continuing.

我会读取audit-report.md中的
FIX_MANIFEST
块,提取以下内容:
  • required_actions.critical[]
  • required_actions.high[]
  • required_actions.medium[]
  • required_actions.low[]
  • missing_global_skills[]
  • orphaned_changes[]
  • violations[]
  • skill_quality_actions[]
    (维度9 — 如果跳过D9则不存在)
我会将解析后的条目归类为操作类别:
  • 自动操作:清单中描述的安全文件创建或增量更新操作
  • 引导式操作:破坏性或需要用户选择的操作,执行前需明确确认
  • 信息类操作:仅建议、已弃用或未知的操作类型,绝不会自动执行
如果操作类型已弃用、不支持或未知:
  • 我不会自动执行
  • 会将其标记为
    已跳过
    仅建议
  • 继续执行其他修复操作
我会向用户展示即将执行的操作摘要:
📋 修复计划 — [项目名称]
基于[日期]的审计结果
当前得分:[XX]/100

待执行操作:
  ❌ 严重 : [N] 项
  ⚠️ 高优先级 : [N] 项
  ℹ️ 中优先级   : [N] 项
  💡 低优先级      : [N] 项(可选)

是否执行所有修正?(严重 + 高优先级 + 中优先级)
  S → 执行所有推荐操作
  C → 仅执行严重级别(SDD可用的最低要求)
  R → 逐项审核
  N → 取消
我会等待用户回复后再继续。

Step 2 — Execute by phases

步骤2 — 分阶段执行

I process actions in order of severity. Each phase has a checkpoint.
我会按严重程度顺序处理操作,每个阶段都有检查点。

Phase 1 — Critical Corrections (block SDD)

阶段1 — 严重修正(阻碍SDD运行)

Mode detection (run once): Check if Engram MCP is reachable (
mem_context
) → if yes: active mode =
engram
; if no: active mode =
none
.
I execute in this order:
1.1 Create missing global SDD skills
yaml
type: install_skill
target: "[skill-name]"
If any global SDD skill is missing from
~/.claude/skills/
, I notify the user — I cannot create them automatically, but I indicate exactly what is missing and where they should be.
1.2 Update CLAUDE.md — add SDD section
yaml
type: update_file
target: .claude/CLAUDE.md
section: sdd_section
If CLAUDE.md does not mention
/sdd-*
, I add this section at the end of CLAUDE.md:
markdown
undefined
模式检测(仅运行一次): 检查Engram MCP是否可达(
mem_context
)→ 如果可达:激活模式 =
engram
;如果不可达:激活模式 =
none
我会按以下顺序执行:
1.1 创建缺失的全局SDD技能
yaml
type: install_skill
target: "[技能名称]"
如果
~/.claude/skills/
中缺失任何全局SDD技能,我会通知用户 — 我无法自动创建它们,但会明确指出缺失的技能及其安装位置。
1.2 更新CLAUDE.md — 添加SDD章节
yaml
type: update_file
target: .claude/CLAUDE.md
section: sdd_section
如果CLAUDE.md未提及
/sdd-*
命令,我会在CLAUDE.md末尾添加以下章节:
markdown
undefined

SDD — Spec-Driven Development

SDD — 规范驱动开发

This project uses SDD. Artifacts are persisted to Engram.
CommandAction
/sdd-explore <topic>
Explore without committing to changes
/sdd-propose <change>
Create a change proposal
/sdd-apply <change>
Implement the task plan
/sdd-verify <change>
Validate implementation against specs
/sdd-status
View status of active changes
Multi-phase flows (explore → propose → spec+design → tasks, or the full cycle) are handled by the orchestrator as meta-commands — type them directly in conversation, they do not appear as skills.
Full flow: explore → propose → spec + design → tasks → apply → verify → archive

**Checkpoint**: I present the critical actions executed and ask for confirmation to continue with high-priority ones.

---
本项目使用SDD。产物将持久化到Engram。
命令操作
/sdd-explore <主题>
探索项目但不提交变更
/sdd-propose <变更>
创建变更提案
/sdd-apply <变更>
执行任务计划
/sdd-verify <变更>
根据规范验证实现效果
/sdd-status
查看活跃变更的状态
多阶段流程(探索 → 提案 → 规范+设计 → 任务,或完整周期)由编排器作为元命令处理 — 直接在对话中输入即可,不会作为技能显示。
完整流程:探索 → 提案 → 规范 + 设计 → 任务 → 应用 → 验证 → 归档

**检查点**:我会展示已执行的严重操作,并请求用户确认是否继续执行高优先级操作。

---

Phase 2 — High Corrections (degrade quality)

阶段2 — 高优先级修正(影响质量)

2.1 Create missing memory files
yaml
type: create_file
target: ai-context/[file].md
template: [stack|architecture|conventions|known-issues|changelog-ai]
For each missing file, I generate real content based on what I can detect from the project:
  • stack.md: I read
    package.json
    /
    pyproject.toml
    , generate dependency table with real versions
  • architecture.md: I read folder structure and config files, document the detected pattern
  • conventions.md: I read 3-5 existing code files, infer and document real conventions
  • known-issues.md: Start with a "Production Safety Rules" section and leave structure to be filled
  • changelog-ai.md: Create with initial entry documenting this fix
2.2 Update stack in CLAUDE.md
yaml
type: update_file
target: .claude/CLAUDE.md
section: tech_stack
If the declared versions do not match package.json, I update the Tech Stack table with the real values.
2.3 Fix Skills registry
yaml
type: add_registry_entry / remove_registry_entry
target: .claude/CLAUDE.md
section: skills_registry
  • Add to the registry the skills that are on disk but not listed
  • Mark as
    [MISSING FILE]
    the skills listed but without a file (do not remove them, inform)
Checkpoint: I present high-priority actions executed. I ask for confirmation to continue with medium-priority ones.

2.1 创建缺失的内存文件
yaml
type: create_file
target: ai-context/[文件].md
template: [stack|architecture|conventions|known-issues|changelog-ai]
对于每个缺失的文件,我会根据项目检测到的内容生成真实内容:
  • stack.md:读取
    package.json
    /
    pyproject.toml
    ,生成包含真实版本的依赖表
  • architecture.md:读取文件夹结构和配置文件,记录检测到的架构模式
  • conventions.md:读取3-5个现有代码文件,推断并记录真实的编码规范
  • known-issues.md:以“生产安全规则”章节开头,预留后续填充的结构
  • changelog-ai.md:创建文件并添加记录本次修复的初始条目
2.2 更新CLAUDE.md中的技术栈
yaml
type: update_file
target: .claude/CLAUDE.md
section: tech_stack
如果声明的版本与package.json不符,我会更新技术栈表格中的真实版本值。
2.3 修复技能注册表
yaml
type: add_registry_entry / remove_registry_entry
target: .claude/CLAUDE.md
section: skills_registry
  • 将磁盘上存在但未列出的技能添加到注册表
  • 对已列出但无对应文件的技能标记为
    [MISSING FILE]
    (不删除,仅通知)
检查点:我会展示已执行的高优先级操作,请求用户确认是否继续执行中优先级操作。

Phase 3 — Medium Corrections

阶段3 — 中优先级修正

3.1 Add missing sections in CLAUDE.md If sections such as Unbreakable Rules, Plan Mode Rules, Quick Reference are missing — I add the corresponding ones with content inferred from the project.
3.2 Update Folder Structure in CLAUDE.md If directories exist in
.claude/
that are not documented in CLAUDE.md, I add them to the Folder Structure table.
3.3 Fix broken cross-references For broken references where the destination file does NOT exist and should: I create it with minimal content. For references where the file exists but the path is misspelled: I fix the path.
Checkpoint: I present medium-priority actions. I offer to execute low-priority ones.

3.1 补充CLAUDE.md中缺失的章节 如果存在Unbreakable Rules、Plan Mode Rules、Quick Reference等缺失章节 — 我会添加相应章节,并根据项目内容推断填充内容。
3.2 更新CLAUDE.md中的文件夹结构 如果
.claude/
中存在的目录未在CLAUDE.md中记录,我会将其添加到文件夹结构表格中。
3.3 修复损坏的交叉引用 对于目标文件不存在但应存在的损坏引用:我会创建包含最小内容的文件。对于文件存在但路径拼写错误的引用:我会修正路径。
检查点:我会展示已执行的中优先级操作,询问用户是否执行低优先级操作。

Phase 4 — Low Corrections (optional, I ask first)

阶段4 — 低优先级修正(可选,需先询问用户)

4.1 Install recommended global tech skills For each recommended global skill not installed locally:
Recommended skill: react-19
Available at: ~/.claude/skills/react-19/SKILL.md
To install it in this project: /skill-add react-19
I do not install automatically — I only inform with the exact command.
4.2 Notify architecture violations Violations found in Dimension 7 are NOT auto-corrected — they are code changes that require human review. I present them with context:
⚠️ Architecture violations (require manual review):
  - src/pages/api/payment.js:45 — Business logic in API route
  - src/components/Cart.jsx:23 — Direct service import (should use hook)

4.1 安装推荐的全局技术技能 对于每个未在本地安装的推荐全局技能:
推荐技能:react-19
获取路径:~/.claude/skills/react-19/SKILL.md
在本项目中安装:/skill-add react-19
我不会自动安装 — 仅告知用户准确的安装命令。
4.2 通知架构违规情况 在维度7中发现的违规情况不会自动修正 — 这些是需要人工审核的代码变更。我会附带上下文展示:
⚠️ 架构违规(需人工审核):
  - src/pages/api/payment.js:45 — API路由中包含业务逻辑
  - src/components/Cart.jsx:23 — 直接导入服务(应使用Hook)

Phase 5 — Dimension 9 Corrections (Project Skills Quality)

阶段5 — 维度9修正(项目技能质量)

5.1 Parse
skill_quality_actions
Read
skill_quality_actions[]
from FIX_MANIFEST.
If the key is absent or the list is empty:
  • Skip Phase 5 silently — no output, no prompt
If actions are present, present the Phase 5 checkpoint:
Phase 5 — Skill Quality Actions
[N] actions found in Dimension 9

Actions to process:
  [N] delete_duplicate — local skills that duplicate a global skill
  [N] add_missing_section — local skills missing structural sections
  [N] flag_irrelevant — skills potentially irrelevant to current stack (INFO)
  [N] flag_language — skills with non-English content (INFO — manual fix)
  [N] move-to-global — skills recommended for promotion to global catalog (manual)

Proceed with Phase 5? [Y/n]
If user declines, skip Phase 5 entirely.

5.2
delete_duplicate
handler
For each action with
action_type: delete_duplicate
:
⚠️ Duplicate skill found:
  Local  : [local_path]
  Global : [global_counterpart]
  Detail : [detail]

Delete local copy? [y/N]
  • On
    y
    : delete
    .claude/skills/<name>/
    directory recursively. Log to
    ai-context/changelog-ai.md
    .
  • On
    N
    : mark
    skipped (user declined)
    . Continue to next action.
  • If directory no longer exists: mark
    skipped (already deleted)
    . Continue.

5.3
add_missing_section
handler
For each action with
action_type: add_missing_section
:
  1. Check if the target file exists. If not: mark
    failed (file not found)
    and notify user. Continue.
  2. Read current content of local
    SKILL.md
    .
  3. Determine format type: parse YAML frontmatter block (content between first
    ---
    pair). Extract
    format:
    value. If absent or unrecognized → treat as
    procedural
    . This step reads the skill file at repair time; do NOT rely solely on the FIX_MANIFEST entry for the format value.
  4. For each section in
    missing_sections[]
    :
    • Check if section heading already exists (idempotency guard) — if yes: mark
      skipped (section already present)
      .
    • Check for
      <!-- AUDIT: stub added by project-fix
      marker — if present: mark
      skipped (stub already added)
      .
    • Otherwise: select stub template matching the resolved format (see table below) and append it at the end of the file.
Format-aware stub selection (authoritative contract in
docs/format-types.md
):
Resolved formatMissing section being addedStub to insert
procedural
(or absent/unknown)
## Process
Process stub (see below)
reference
## Patterns
Patterns stub (see below)
anti-pattern
## Anti-patterns
Anti-patterns stub (see below)
any format
## Rules
Rules stub (see below)
any format
**Triggers**
Triggers stub (see below)
Stub templates:
For missing
## Rules
:
markdown
<!-- AUDIT: stub added by project-fix [YYYY-MM-DD] — fill in before using this skill -->
5.1 解析
skill_quality_actions
读取FIX_MANIFEST中的
skill_quality_actions[]
如果该键不存在或列表为空:
  • 静默跳过阶段5 — 不输出、不提示
如果存在操作,展示阶段5检查点:
阶段5 — 技能质量操作
在维度9中发现[N]项操作

待处理操作:
  [N] delete_duplicate — 与全局技能重复的本地技能
  [N] add_missing_section — 缺失结构章节的本地技能
  [N] flag_irrelevant — 可能与当前技术栈无关的技能(仅通知)
  [N] flag_language — 包含非英文内容的技能(仅通知 — 需手动修复)
  [N] move-to-global — 建议升级到全局目录的技能(需手动操作)

是否继续执行阶段5?[Y/n]
如果用户拒绝,则完全跳过阶段5。

5.2
delete_duplicate
处理程序
对于每个
action_type: delete_duplicate
的操作:
⚠️ 发现重复技能:
  本地  : [本地路径]
  全局 : [全局对应技能]
  详情 : [详情]

是否删除本地副本?[y/N]
  • 输入
    y
    :递归删除
    .claude/skills/<name>/
    目录。记录到
    ai-context/changelog-ai.md
  • 输入
    N
    :标记为
    已跳过(用户拒绝)
    ,继续处理下一个操作。
  • 如果目录已不存在:标记为
    已跳过(已删除)
    ,继续处理下一个操作。

5.3
add_missing_section
处理程序
对于每个
action_type: add_missing_section
的操作:
  1. 检查目标文件是否存在。如果不存在:标记为
    失败(文件未找到)
    并通知用户,继续处理下一个操作。
  2. 读取本地
    SKILL.md
    的当前内容。
  3. 确定格式类型:解析YAML前置块(第一个
    ---
    对之间的内容),提取
    format:
    值。如果不存在或无法识别 → 视为
    procedural
    。此步骤在修复时读取技能文件,请勿仅依赖FIX_MANIFEST条目中的格式值。
  4. 对于
    missing_sections[]
    中的每个章节:
    • 检查章节标题是否已存在(幂等性检查)— 如果存在:标记为
      已跳过(章节已存在)
    • 检查是否存在
      <!-- AUDIT: stub added by project-fix
      标记 — 如果存在:标记为
      已跳过(已添加占位内容)
    • 否则:选择与解析格式匹配的占位模板(见下表)并追加到文件末尾。
感知格式的占位模板选择(权威定义在
docs/format-types.md
中):
解析后的格式待添加的缺失章节插入的占位内容
procedural
(或不存在/未知)
## Process
流程占位模板(见下文)
reference
## Patterns
模式占位模板(见下文)
anti-pattern
## Anti-patterns
反模式占位模板(见下文)
任意格式
## Rules
规则占位模板(见下文)
任意格式
**Triggers**
触发方式占位模板(见下文)
占位模板:
缺失
## Rules
时:
markdown
<!-- AUDIT: stub added by project-fix [YYYY-MM-DD] — 使用此技能前请填充内容 -->

Rules

Rules

Scaffold note: replace this text with the concrete constraints and invariants for this skill.

For missing `## Process` (format: procedural or absent):

```markdown
<!-- AUDIT: stub added by project-fix [YYYY-MM-DD] -->
脚手架提示:替换此文本为该技能的具体约束和规则。

缺失`## Process`时(格式为procedural或不存在):

```markdown
<!-- AUDIT: stub added by project-fix [YYYY-MM-DD] -->

Process

Process

Scaffold note: replace this text with the real step-by-step process instructions.

For missing `## Patterns` (format: reference):

```markdown
<!-- AUDIT: stub added by project-fix [YYYY-MM-DD] -->
脚手架提示:替换此文本为真实的分步流程说明。

缺失`## Patterns`时(格式为reference):

```markdown
<!-- AUDIT: stub added by project-fix [YYYY-MM-DD] -->

Patterns

Patterns

Scaffold note: replace this text with the core patterns and examples for this technology or library.

For missing `## Anti-patterns` (format: anti-pattern):

```markdown
<!-- AUDIT: stub added by project-fix [YYYY-MM-DD] -->
脚手架提示:替换此文本为该技术或库的核心模式及示例。

缺失`## Anti-patterns`时(格式为anti-pattern):

```markdown
<!-- AUDIT: stub added by project-fix [YYYY-MM-DD] -->

Anti-patterns

Anti-patterns

Scaffold note: replace this text with the anti-patterns to avoid and their corrections.

For missing `**Triggers**`:

```markdown
<!-- AUDIT: stub added by project-fix [YYYY-MM-DD] -->

**Triggers**: Replace this scaffold text with the slash command and natural-language triggers for this skill.
Log each modification to
ai-context/changelog-ai.md
.

5.4
flag_irrelevant
handler
For each action with
action_type: flag_irrelevant
:
  1. Read current content of local
    SKILL.md
    .
  2. Check if
    <!-- AUDIT: skill may be irrelevant
    is already the first line — if yes: mark
    skipped (already flagged)
    .
  3. Otherwise: prepend the following comment block as the first line of the file:
markdown
<!-- AUDIT: skill may be irrelevant to current project stack. Review and delete if unused. Added by project-fix [YYYY-MM-DD] -->
Log to
ai-context/changelog-ai.md
.

flag_language
handler
For each action with
action_type: flag_language
:
  • Report to user:
    ℹ️ Language violation in: [local_path]
    Detail: [detail]
    Action required: translate content to English manually.
    This file has NOT been modified.
  • Log the finding to
    ai-context/changelog-ai.md
    .
  • Do NOT modify the SKILL.md file.

move-to-global
handler
Before listing individual skills, print the following note once per fix run (not once per skill):
ℹ️ Two-tier skill model reminder:
   .claude/skills/ is project-local (versioned in repo — team-visible).
   ~/.claude/skills/ is machine-global (available across all projects but not present for collaborators who clone).
For each action with disposition
move-to-global
:
ℹ️ Manual action required — [local_path]
This skill may be a candidate for promotion to the global catalog.

To promote manually:
  1. Copy: cp [local_path] ~/.claude/skills/[skill_name]/SKILL.md
  2. Register in agent-config repo: skills/[skill_name]/SKILL.md
  3. Run install.sh to deploy
  4. Run /skill-add [skill_name] in the original project to add a registry reference
  5. Delete the local copy after verifying the global version works
No automated action taken.

Checkpoint after Phase 5:
Phase 5 complete — [N] actions processed

  ✅ deleted  : [N]
  ✅ stubs added : [N]
  ✅ flagged irrelevant : [N]
  ℹ️ language violations : [N] (manual fix required)
  ℹ️ move-to-global : [N] (manual — see instructions above)
  ⏭️ skipped : [N]
  ❌ failed : [N]

脚手架提示:替换此文本为需要避免的反模式及修正方法。

缺失`**Triggers**`时:

```markdown
<!-- AUDIT: stub added by project-fix [YYYY-MM-DD] -->

**触发方式**:替换此脚手架文本为该技能的斜杠命令和自然语言触发词。
将每项修改记录到
ai-context/changelog-ai.md

5.4
flag_irrelevant
处理程序
对于每个
action_type: flag_irrelevant
的操作:
  1. 读取本地
    SKILL.md
    的当前内容。
  2. 检查第一行是否已存在
    <!-- AUDIT: skill may be irrelevant
    — 如果存在:标记为
    已跳过(已标记)
  3. 否则:在文件第一行添加以下注释块:
markdown
<!-- AUDIT: skill may be irrelevant to current project stack. Review and delete if unused. Added by project-fix [YYYY-MM-DD] -->
记录到
ai-context/changelog-ai.md

flag_language
处理程序
对于每个
action_type: flag_language
的操作:
  • 向用户报告:
    ℹ️ 语言违规文件:[本地路径]
    详情:[详情]
    需执行操作:手动将内容翻译为英文。
    本文件未被修改。
  • 将发现记录到
    ai-context/changelog-ai.md
  • 不修改SKILL.md文件。

move-to-global
处理程序
在列出单个技能前,每次修复运行仅打印一次以下提示(而非每个技能打印一次):
ℹ️ 双层技能模型提示:
   .claude/skills/ 是项目本地技能(在仓库中版本化 — 团队可见)。
   ~/.claude/skills/ 是机器全局技能(可在所有项目中使用,但克隆仓库的协作者无法看到)。
对于每个标记为
move-to-global
的操作:
ℹ️ 需手动操作 — [本地路径]
此技能可能适合升级到全局目录。

手动升级步骤:
  1. 复制:cp [本地路径] ~/.claude/skills/[技能名称]/SKILL.md
  2. 在agent-config仓库中注册:skills/[技能名称]/SKILL.md
  3. 运行install.sh部署
  4. 在原项目中运行/skill-add [技能名称]添加注册表引用
  5. 验证全局版本可用后删除本地副本
不执行自动化操作。

阶段5完成后检查点:
阶段5完成 — 已处理[N]项操作

  ✅ 已删除  : [N]
  ✅ 已添加占位内容 : [N]
  ✅ 已标记无关 : [N]
  ℹ️ 语言违规 : [N](需手动修复)
  ℹ️ 需升级到全局 : [N](需手动操作 — 见上述说明)
  ⏭️ 已跳过 : [N]
  ❌ 失败 : [N]

Step 3 — Record in changelog

步骤3 — 记录到变更日志

When done, I add an entry to
ai-context/changelog-ai.md
:
markdown
undefined
完成所有操作后,我会向
ai-context/changelog-ai.md
添加一条条目:
markdown
undefined

[YYYY-MM-DD] — project-fix executed

[YYYY-MM-DD] — 执行project-fix

Score before: [XX]/100 Actions executed: [N] critical, [N] high, [N] medium Files created: [list] Files modified: [list] SDD Readiness: [FULL|PARTIAL|NOT CONFIGURED] → [final state] Notes: [any important decision made]

---
修复前得分: [XX]/100 已执行操作: [N]项严重、[N]项高优先级、[N]项中优先级 已创建文件: [列表] 已修改文件: [列表] SDD就绪状态: [完全就绪|部分就绪|未配置] → [最终状态] 备注: [任何重要决策]

---

Step 4 — Final report

步骤4 — 最终报告

✅ Fix completed — [Project Name]

Actions executed:
  ✅ [N] critical
  ✅ [N] high
  ✅ [N] medium
  ⏭️ [N] low (informed, not auto-executed)

Files created:    [list]
Files modified:   [list]

SDD Status: [FULL / PARTIAL / NOT CONFIGURED]
  - Engram: [✅ reachable | ❌ not reachable]
  - Global SDD skills: [✅ complete | ⚠️ missing: list]
  - CLAUDE.md mentions /sdd-*: [✅ yes | ✅ added]

To verify the result:
  → /project-audit  (should show a higher score)
  → To start development with SDD: /sdd-explore <topic> or /sdd-propose <change-name>

Changes recorded in: ai-context/changelog-ai.md

✅ 修复完成 — [项目名称]

已执行操作:
  ✅ [N]项严重
  ✅ [N]项高优先级
  ✅ [N]项中优先级
  ⏭️ [N]项低优先级(仅通知,未自动执行)

已创建文件:    [列表]
已修改文件:   [列表]

SDD状态: [完全就绪 / 部分就绪 / 未配置]
  - Engram: [✅ 可达 | ❌ 不可达]
  - 全局SDD技能: [✅ 完整 | ⚠️ 缺失: 列表]
  - CLAUDE.md提及/sdd-*: [✅ 是 | ✅ 已添加]

验证修复结果:
  → /project-audit (应显示更高得分)
  → 开始使用SDD开发:/sdd-explore <主题> 或 /sdd-propose <变更名称>

变更记录已保存至: ai-context/changelog-ai.md

Internal templates

内部模板

Template: SDD section

模板:SDD章节

See Step 2 — 1.2 above for the CLAUDE.md SDD section template.
见步骤2 — 1.2中的CLAUDE.md SDD章节模板。

Template: changelog entry

模板:变更日志条目

markdown
undefined
markdown
undefined

[YYYY-MM-DD] — [description of the change]

[YYYY-MM-DD] — [变更描述]

Type: [Feature|Bug Fix|Refactor|Config|Documentation] Agent: Claude [model] Modified files:
  • path/file.ext
    — [what was done]
Decisions made:
  • [decision and its reason]
Notes: [anything important for future sessions]

---
类型: [功能新增|Bug修复|重构|配置更新|文档更新] 代理: Claude [模型] 已修改文件:
  • path/file.ext
    — [操作说明]
已做决策:
  • [决策内容及原因]
备注: [对未来会话重要的信息]

---

Rules

规则

  1. Without audit-report.md I do not operate — I ask the user to run
    /project-audit
    first
  2. I only implement what is in FIX_MANIFEST — I never invent additional corrections
  3. Checkpoint between phases — I never execute the next phase without user confirmation
  4. I do not fix production code — I report architecture violations but do not touch them
  5. I always record in changelog — each fix is documented in
    ai-context/changelog-ai.md
  6. If a file already has more complete content than the template, I do not overwrite it — I do an intelligent merge or add only the missing sections
  7. Idempotent: running
    /project-fix
    twice on the same project must not cause duplications
  8. When done, I always suggest: "Run
    /project-audit
    to verify the new score"
  9. NEVER touch
    .claude/commands/
    — commands/ is a deprecated mechanism; this skill does not create, modify, or delete files under that path. Any FIX_MANIFEST action of type
    fix_commands_registry
    or targeting
    .claude/commands/
    MUST be skipped and noted in the output as 'skipped — commands/ is deprecated'.
  10. Unknown or deprecated action types never gain automatic side effects — if an action cannot be mapped to a supported handler safely, it is downgraded to a skip or recommendation outcome.
  1. 无audit-report.md则无法运行 — 我会要求用户先运行
    /project-audit
  2. 仅执行FIX_MANIFEST中的内容 — 绝不会自行添加额外修正
  3. 阶段间设置检查点 — 未获得用户确认绝不会执行下一阶段
  4. 不修复生产代码 — 仅报告架构违规情况,不修改代码
  5. 始终记录到变更日志 — 每次修复都记录在
    ai-context/changelog-ai.md
  6. 如果文件已有比模板更完整的内容,不覆盖 — 执行智能合并或仅添加缺失章节
  7. 幂等性:在同一项目中运行
    /project-fix
    两次不会导致重复内容
  8. 完成后始终建议:"运行
    /project-audit
    验证新得分"
  9. 绝不修改
    .claude/commands/
    — commands/是已弃用的机制;本技能不会在该路径下创建、修改或删除文件。任何针对
    .claude/commands/
    或类型为
    fix_commands_registry
    的FIX_MANIFEST操作必须跳过,并在输出中注明'已跳过 — commands/已弃用'。
  10. 未知或已弃用的操作类型绝不会自动执行修改 — 如果操作无法安全映射到支持的处理程序,将降级为跳过或建议结果。