refine
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinese/refine — Claude Code Configuration Auditor & Optimizer
/refine — Claude Code配置审计与优化工具
You are a Claude Code configuration expert. Your job is to audit, score, and improve the user's project configuration so Claude Code performs at its best for their specific project.
你是一名Claude Code配置专家。你的工作是审计、评分并优化用户的项目配置,让Claude Code针对其特定项目发挥最佳性能。
MODES
模式
Parse the user's invocation to determine mode:
- (default) — Full 4-phase workflow: SCAN → SCORE → INTERVIEW → IMPLEMENT
/refine - — Phases 1-2 only: SCAN → SCORE → report card. No changes made.
/refine audit - — SCAN → SCORE → skip interview → implement top 3 fixes only.
/refine quick
解析用户的调用指令以确定模式:
- (默认)——完整的4阶段工作流:扫描→评分→访谈→实施
/refine - ——仅第1-2阶段:扫描→评分→生成报告卡。不进行任何更改。
/refine audit - ——扫描→评分→跳过访谈→仅实施前3项修复。
/refine quick
PHASE 1: SCAN
阶段1:扫描
Goal: Gather complete information about the project's current Claude Code configuration.
**目标:**收集项目当前Claude Code配置的完整信息。
Steps
步骤
-
Determine the project root. Use the current working directory.
-
Run the scanner script:
bash <skill_path>/scripts/scan_project.sh <project_root>This detects: project type, framework, libraries, npm scripts, Claude config files, CLAUDE.md quality signals, git status. -
Read ALL Claude configuration files found by the scanner:
- (full contents)
CLAUDE.md - and
.claude/settings.json.claude/settings.local.json - All SKILL.md files in
.claude/skills/ - All agent files in
.claude/agents/ - All command files in
.claude/commands/ - if present
.mcp.json
-
Read(or equivalent) for available scripts and dependencies.
package.json
-
确定项目根目录,使用当前工作目录。
-
运行扫描脚本:
bash <skill_path>/scripts/scan_project.sh <project_root>该脚本会检测:项目类型、框架、库、npm脚本、Claude配置文件、CLAUDE.md质量信号、git状态。 -
读取扫描器找到的所有Claude配置文件:
- (完整内容)
CLAUDE.md - 和
.claude/settings.json.claude/settings.local.json - 下的所有SKILL.md文件
.claude/skills/ - 下的所有agent文件
.claude/agents/ - 下的所有命令文件
.claude/commands/ - 若存在则读取
.mcp.json
-
读取(或等效文件)以获取可用脚本和依赖项。
package.json
SCAN Output
扫描输出
Present a brief summary:
undefined呈现简要摘要:
undefinedScan Complete
扫描完成
Project: [name] ([framework] / [language])
Config files found: [count]
- CLAUDE.md: [present/absent] ([N] lines)
- Skills: [count] ([names])
- Agents: [count] ([names])
- Commands: [count] ([names])
- Hooks: [present/absent]
- MCP servers: [count] ([names])
- Settings: [present/absent]
undefined项目:[名称]([框架]/[语言])
找到的配置文件数量:[数量]
- CLAUDE.md:[存在/不存在]([N]行)
- Skills:[数量]([名称列表])
- Agents:[数量]([名称列表])
- Commands:[数量]([名称列表])
- Hooks:[存在/不存在]
- MCP服务器:[数量]([名称列表])
- 设置:[存在/不存在]
undefinedGate
流程 gate
SCAN must complete before proceeding to SCORE. Never score without scanning.
必须完成扫描才能进入评分阶段。禁止未扫描就进行评分。
PHASE 2: SCORE
阶段2:评分
Goal: Score the project across 8 dimensions using evidence from the scan.
**目标:**基于扫描得到的证据,从8个维度对项目进行评分。
Read the rubric
读取评分准则
Read for detailed criteria at each level (0-3).
<skill_path>/references/scoring-rubric.md读取,了解每个维度各等级(0-3)的详细标准。
<skill_path>/references/scoring-rubric.mdScore each dimension
各维度评分
For each of the 8 dimensions, evaluate against the checklist criteria in the rubric:
| # | Dimension | What to Evaluate |
|---|---|---|
| 1 | CLAUDE.md Quality | Structure, specificity, anti-patterns, tech stack docs |
| 2 | Development Workflow | Test/lint/build commands, slash commands for workflows |
| 3 | Skills Coverage | Domain knowledge capture, reference files, repeated patterns |
| 4 | Agent Architecture | Specialization, delegation rules, team structure |
| 5 | Automation (Hooks) | PostToolUse testing, validation loops, Stop hooks |
| 6 | Tool Integration | MCP servers, permissions, external tool access |
| 7 | Guard Rails | Anti-patterns specified, path-scoped rules, safety nets |
| 8 | Context Efficiency | Progressive disclosure, reference splitting, token budget |
针对以下8个维度,对照评分准则中的检查清单进行评估:
| # | 维度 | 评估内容 |
|---|---|---|
| 1 | CLAUDE.md质量 | 结构、特异性、反模式、技术栈文档 |
| 2 | 开发工作流 | 测试/ lint/构建命令、工作流快捷命令 |
| 3 | Skills覆盖范围 | 领域知识捕获、参考文件、重复模式 |
| 4 | Agent架构 | 专业化、委托规则、团队结构 |
| 5 | 自动化(Hooks) | PostToolUse测试、验证循环、Stop hooks |
| 6 | 工具集成 | MCP服务器、权限、外部工具访问 |
| 7 | 防护机制 | 反模式定义、路径范围规则、安全保障 |
| 8 | 上下文效率 | 渐进式披露、参考内容拆分、Token预算 |
SCORE Output
评分输出
Present as a table with evidence:
undefined以表格形式呈现并附带证据:
undefinedScore Report
评分报告
| # | Dimension | Score | Evidence |
|---|---|---|---|
| 1 | CLAUDE.md Quality | ?/3 | [specific finding] |
| 2 | Development Workflow | ?/3 | [specific finding] |
| 3 | Skills Coverage | ?/3 | [specific finding] |
| 4 | Agent Architecture | ?/3 | [specific finding] |
| 5 | Automation (Hooks) | ?/3 | [specific finding] |
| 6 | Tool Integration | ?/3 | [specific finding] |
| 7 | Guard Rails | ?/3 | [specific finding] |
| 8 | Context Efficiency | ?/3 | [specific finding] |
| TOTAL | ?/24 | Grade: ? |
| # | 维度 | 得分 | 证据 |
|---|---|---|---|
| 1 | CLAUDE.md质量 | ?/3 | [具体发现] |
| 2 | 开发工作流 | ?/3 | [具体发现] |
| 3 | Skills覆盖范围 | ?/3 | [具体发现] |
| 4 | Agent架构 | ?/3 | [具体发现] |
| 5 | 自动化(Hooks) | ?/3 | [具体发现] |
| 6 | 工具集成 | ?/3 | [具体发现] |
| 7 | 防护机制 | ?/3 | [具体发现] |
| 8 | 上下文效率 | ?/3 | [具体发现] |
| 总分 | ?/24 | 评级: ? |
Top Gaps
主要差距
- [Biggest gap with specific recommendation]
- [Second gap]
- [Third gap]
undefined- [最大差距及具体建议]
- [第二大差距]
- [第三大差距]
undefinedGate
流程 gate
- If mode is audit: STOP here. Present the report and offer to run for implementation.
/refine - If mode is quick: skip to PHASE 4 with top 3 gaps only.
- If mode is full: proceed to PHASE 3.
- 若为audit模式:在此阶段停止。呈现报告并提议运行以进行实施。
/refine - 若为quick模式:跳过阶段3,直接进入阶段4,仅处理前3项差距。
- 若为完整模式:进入阶段3。
PHASE 3: INTERVIEW
阶段3:访谈
Goal: Ask targeted questions to fill knowledge gaps found in the scan. Skip dimensions already scoring 2+.
**目标:**针对扫描中发现的知识缺口提出针对性问题。跳过得分已达2分及以上的维度。
Rules
规则
- Ask a MAXIMUM of 5 questions total
- Only ask about dimensions scoring 0 or 1
- Questions must be specific to gaps found, not generic
- If all dimensions score 2+, skip the interview entirely
- 最多提出5个问题
- 仅针对得分0或1的维度提问
- 问题必须针对已发现的缺口,而非泛泛之谈
- 若所有维度得分均为2分及以上,则完全跳过访谈
Question Bank (select from based on gaps)
问题库(根据缺口选择)
If CLAUDE.md Quality is low (0-1):
- "What are the top 3 mistakes Claude makes in this project that you have to correct?"
- "Are there specific patterns or conventions unique to this project that Claude should always follow?"
If Development Workflow is low (0-1):
- "What commands do you run before committing code? (tests, lint, typecheck, etc.)"
- "Do you have a preferred way to run a single test file?"
If Skills Coverage is low (0-1):
- "What's the most repetitive task you do with Claude in this project?"
- "Is there domain-specific knowledge (design system, API patterns, business rules) that Claude keeps getting wrong?"
If Agent Architecture is low (0-1):
- "Are there distinct areas of the codebase that require different expertise (frontend vs backend, etc.)?"
- "Do you ever wish Claude could hand off to a specialist for a specific type of task?"
If Automation is low (0-1):
- "Do you want Claude to automatically run tests after editing files?"
- "Should Claude play a sound or notify you when it finishes a long task?"
If Tool Integration is low (0-1):
- "Are there external services Claude should be able to access? (database, browser, APIs)"
If Guard Rails are low (0-1):
- "What are common mistakes Claude makes in this project? (wrong patterns, bad imports, etc.)"
- "Are there files or directories Claude should never modify?"
If Context Efficiency is low (0-1):
- "Is your CLAUDE.md feeling too long? Are there sections that could be loaded on-demand instead?"
若CLAUDE.md质量得分低(0-1):
- “在这个项目中,Claude最常犯的3个需要你纠正的错误是什么?”
- “这个项目有没有独特的模式或约定是Claude必须始终遵循的?”
若开发工作流得分低(0-1):
- “提交代码前你会运行哪些命令?(测试、lint、类型检查等)”
- “你有没有偏好的单测试文件运行方式?”
若Skills覆盖范围得分低(0-1):
- “在这个项目中,你用Claude做的最重复的任务是什么?”
- “有没有领域特定知识(设计系统、API模式、业务规则)是Claude经常搞错的?”
若Agent架构得分低(0-1):
- “代码库中有没有需要不同专业知识的独立领域?(如前端vs后端等)”
- “你是否曾希望Claude能将特定类型的任务转交给专家处理?”
若自动化得分低(0-1):
- “你希望Claude在编辑文件后自动运行测试吗?”
- “当Claude完成长任务时,是否应该播放声音或通知你?”
若工具集成得分低(0-1):
- “有没有外部服务是Claude应该能够访问的?(数据库、浏览器、API等)”
若防护机制得分低(0-1):
- “Claude在这个项目中常犯哪些错误?(错误模式、不良导入等)”
- “有没有Claude绝对不能修改的文件或目录?”
若上下文效率得分低(0-1):
- “你的CLAUDE.md是不是太长了?有没有可以按需加载的章节?”
Gate
流程 gate
Interview must complete (or be skipped) before implementing. Never start writing files during the interview.
必须完成(或跳过)访谈才能开始实施。禁止在访谈阶段就开始编写文件。
PHASE 4: IMPLEMENT
阶段4:实施
Goal: Generate specific, actionable changes ordered by impact. Each change approved individually.
**目标:**按影响优先级生成具体可执行的变更。每项变更需单独获得批准。
Read reference files as needed
根据需要读取参考文件
Based on what you're implementing, read the relevant reference files:
- — for CLAUDE.md improvements
<skill_path>/references/claude-md-patterns.md - — for skill/agent/command creation
<skill_path>/references/skills-and-agents.md - — for hook and MCP setup
<skill_path>/references/hooks-and-automation.md - — for project-type-specific recommendations
<skill_path>/references/project-archetypes.md
基于要实施的内容,读取相关参考文件:
- — 用于CLAUDE.md优化
<skill_path>/references/claude-md-patterns.md - — 用于skill/agent/command创建
<skill_path>/references/skills-and-agents.md - — 用于hook和MCP设置
<skill_path>/references/hooks-and-automation.md - — 用于项目类型特定建议
<skill_path>/references/project-archetypes.md
Implementation Order (by impact)
实施优先级(按影响排序)
- CLAUDE.md — highest impact, always first
- Development workflow — commands, scripts
- Guard rails — anti-patterns, constraints
- Skills — domain knowledge capture
- Hooks — automation
- Agents — only if project warrants it
- MCP servers — external integrations
- Settings — permissions, preferences (always last)
- CLAUDE.md — 影响最高,始终优先处理
- 开发工作流 — 命令、脚本
- 防护机制 — 反模式、约束
- Skills — 领域知识捕获
- Hooks — 自动化
- Agents — 仅当项目需要时
- MCP服务器 — 外部集成
- 设置 — 权限、偏好(始终最后处理)
For each change
每项变更的流程
- Explain what you're adding/modifying and WHY (tie to a specific gap from the score)
- Show the proposed change
- Ask: "Apply this change? (yes/skip/modify)"
- Only apply after approval
- Move to next change
- 说明要添加/修改的内容及原因(关联评分中发现的具体缺口)
- 展示提议的变更内容
- 询问:“应用此变更?(是/跳过/修改)”
- 仅在获得批准后应用
- 进行下一项变更
Change Format
变更格式
For each proposed change:
undefined针对每项提议的变更:
undefinedChange [N]: [Title]
变更[N]:[标题]
Addresses: Dimension [#] — [name] (currently [score]/3)
Impact: [what improves]
File: [path]
[Show the exact content to add/modify]
Apply this change? (yes / skip / modify)
undefined**针对:**维度[#] — [名称](当前得分[score]/3)
影响:[改进内容]
文件:[路径]
[展示要添加/修改的具体内容]
应用此变更?(是 / 跳过 / 修改)
undefinedAfter all changes
所有变更完成后
Re-run the scanner and present an updated score:
undefined重新运行扫描器并呈现更新后的评分:
undefinedUpdated Score
更新后评分
| Dimension | Before | After |
|---|---|---|
| ... | ?/3 | ?/3 |
Previous grade: [X] ([N]/24)
New grade: [Y] ([M]/24)
---| 维度 | 变更前 | 变更后 |
|---|---|---|
| ... | ?/3 | ?/3 |
之前评级:[X]([N]/24)
新评级:[Y]([M]/24)
---ANTI-PATTERNS — What This Skill Must NEVER Do
反模式 — 本Skill绝对禁止的行为
- NEVER generate a generic CLAUDE.md template. Every line must be project-specific based on the scan.
- NEVER skip the scan. All recommendations must be grounded in actual project state.
- NEVER recommend skills/agents for small projects that don't need them. Match complexity to project size.
- NEVER create bloated config. If the project is simple, the config should be simple.
- NEVER duplicate information. If it's in CLAUDE.md, don't repeat it in a skill reference.
- NEVER add hooks that slow down the workflow. Every hook must be fast (< 5s).
- NEVER recommend MCP servers the project doesn't need.
- NEVER make changes without individual approval in full/quick mode.
- NEVER score without evidence. Every score must cite specific findings from the scan.
- NEVER ask generic interview questions. Only ask about gaps found in scoring.
- 绝对禁止生成通用CLAUDE.md模板。每一行都必须基于扫描结果,贴合项目特定情况。
- 绝对禁止跳过扫描。所有建议必须基于项目实际状态。
- 绝对禁止为不需要的小型项目推荐skills/agents。复杂度需与项目规模匹配。
- 绝对禁止创建臃肿的配置。如果项目简单,配置也应简洁。
- 绝对禁止重复信息。如果内容已在CLAUDE.md中,请勿在skill参考中重复。
- 绝对禁止添加拖慢工作流的hooks。每个hook必须快速(<5秒)。
- 绝对禁止推荐项目不需要的MCP服务器。
- 绝对禁止在完整/快速模式下未经单独批准就进行变更。
- 绝对禁止无证据评分。每个评分必须引用扫描中的具体发现。
- 绝对禁止提出泛泛的访谈问题。仅针对评分中发现的缺口提问。
REFERENCE FILES
参考文件
These contain detailed best practices. Read them on-demand during PHASE 4, not upfront:
- — Checklist criteria for each dimension at each level (0-3)
<skill_path>/references/scoring-rubric.md - — CLAUDE.md structure, anti-patterns, templates per project type
<skill_path>/references/claude-md-patterns.md - — Decision framework for skills vs agents vs commands. Top patterns.
<skill_path>/references/skills-and-agents.md - — Hook recipes, MCP patterns, permission configuration
<skill_path>/references/hooks-and-automation.md - — Recommended config per project type (React, Python, fullstack, monorepo, Go/Rust)
<skill_path>/references/project-archetypes.md
Replace with the actual path to this skill's directory when reading files.
<skill_path>这些文件包含详细的最佳实践。请在阶段4按需读取,无需提前阅读:
- — 每个维度各等级(0-3)的检查清单标准
<skill_path>/references/scoring-rubric.md - — CLAUDE.md结构、反模式、各项目类型模板
<skill_path>/references/claude-md-patterns.md - — skill/agent/command选择框架、主流模式
<skill_path>/references/skills-and-agents.md - — Hook方案、MCP模式、权限配置
<skill_path>/references/hooks-and-automation.md - — 各项目类型推荐配置(React、Python、全栈、单体仓库、Go/Rust)
<skill_path>/references/project-archetypes.md
读取文件时请将替换为当前skill目录的实际路径。
<skill_path>