Check the code changes in this conversation to determine whether the project's CLAUDE.md needs to be updated.
Overview
This skill helps you check, after completing a development task, whether there are new patterns, conventions, or project knowledge worth recording in CLAUDE.md.
How to Use
/check-claude-md
Call it after completing a feature development, bug fix, or refactor.
Workflow
Phase 1: Collect the changes in this session
- Review the conversation history - Identify which files were modified or created in this conversation
- Classify the change types:
- New feature code
- Bug fix
- Refactor
- Configuration change
- Dependency update
Phase 2: Analyze whether there is anything worth recording
Check the following categories of content worth recording:
2.1 Project conventions and patterns
- Newly established naming conventions
- New directory structure rules
- New code organization patterns
- New error handling approaches
2.2 Technical decisions
- Reasons for choosing a certain library/framework
- Architecture decisions and their rationale
- Performance optimization strategies
- Security considerations
2.3 Development process
- New testing strategies
- New build/deploy steps
- New environment configuration requirements
2.4 Pitfall guide
- Problems encountered and their solutions
- Edge cases that need attention
- Dependency version compatibility issues
Phase 3: Read the existing CLAUDE.md
- Look for CLAUDE.md in the project root directory
- If it does not exist, prompt whether it needs to be created
- Analyze the existing content to avoid duplication
Phase 4: Generate update suggestions
Output format:
## 本次改动摘要
- [改动 1]
- [改动 2]
- ...
## 建议更新 CLAUDE.md
### 需要新增的内容
#### [章节名称]
[具体内容]
### 需要修改的内容
[原内容] → [新内容]
## 不需要更新的原因(如适用)
[说明为什么本次改动不需要记录]
Phase 5: Confirm and execute
- Show the suggestions - Display the specific update content
- Ask for confirmation - Use AskUserQuestion to ask the user whether they agree to the update
- Execute the update - After the user confirms, use the Edit tool to update CLAUDE.md
Key instructions
Judgment principles
Worth recording:
- Decisions that provide guidance for future development
- Non-obvious but important conventions
- Pitfalls encountered and their solutions
- Project-specific patterns
Not worth recording:
- Obvious code (such as simple CRUD)
- One-off fixes (with no general significance)
- General best practices (already in the global CLAUDE.md)
- Specific business logic details
Must follow
- Do not over-record - CLAUDE.md should be concise and only record what is truly important
- Avoid duplication - Check the existing content and do not repeat existing rules
- Maintain consistency - The new content should be consistent with the style of the existing CLAUDE.md
- Must confirm - User confirmation must be obtained before updating
Prohibitions
- Do not record temporary code - Such as debug code, experimental code
- Do not record specific implementation - CLAUDE.md is guiding principles, not code documentation
- Do not modify without confirmation - Suggestions must be shown first, and wait for user confirmation
Output Example
Scenario: The user completed a refactor of API error handling
## 本次改动摘要
- 重构了 API 错误处理,统一使用 `AppError` 类
- 新增了 `src/errors/index.ts` 错误定义文件
- 所有 API 路由统一返回 `{ error: string, code: string }` 格式
## 建议更新 CLAUDE.md
### 需要新增的内容
#### 错误处理
- 所有 API 错误使用 `AppError` 类(位于 `src/errors/index.ts`)
- 错误响应格式:`{ error: string, code: string }`
- 不要在路由中直接 throw Error,使用 `throw new AppError()`
---
是否要将以上内容添加到 CLAUDE.md?
Coordination with Other Tools
- Usually called manually after completing a feature or fix
- Can be called before commit to ensure important decisions are recorded
- It is recommended to form a habit: after modifying the code →
/check-claude-md→ commit