claude-config-optimizer
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseClaude Config Optimizer Skill
Claude配置优化器技能
Rules and tracking for Claude Code configuration optimization.
用于Claude Code配置优化的规则与跟踪机制。
1. Config File Location
1. 配置文件位置
User's Claude Code config is stored at:
@/ghq/github.com/i9wa4/dotfiles/config/agents/
@/ghq/github.com/i9wa4/dotfiles/config/claude/
Key files:
- - Main settings
settings.json - - Persona and core rules
CLAUDE.md - - Detailed rules (auto-loaded at startup)
rules/ - - Specialized knowledge (loaded on demand)
skills/ - - Custom agents
agents/ - - Slash commands
commands/
用户的Claude Code配置存储在以下路径:
@/ghq/github.com/i9wa4/dotfiles/config/agents/
@/ghq/github.com/i9wa4/dotfiles/config/claude/
关键文件:
- - 主配置文件
settings.json - - 角色设定与核心规则
CLAUDE.md - - 详细规则(启动时自动加载)
rules/ - - 专业知识(按需加载)
skills/ - - 自定义Agent
agents/ - - 斜杠命令
commands/
2. Fetch CHANGELOG
2. 获取CHANGELOG
Use command to fetch the latest CHANGELOG:
ghsh
gh api repos/anthropics/claude-code/contents/CHANGELOG.md \
--jq '.content' | base64 -d > .i9wa4/tmp/claude-code-changelog.mdThen read the file to analyze.
使用命令获取最新的CHANGELOG:
ghsh
gh api repos/anthropics/claude-code/contents/CHANGELOG.md \
--jq '.content' | base64 -d > .i9wa4/tmp/claude-code-changelog.md随后读取该文件进行分析。
3. CHANGELOG Operations
3. CHANGELOG操作
3.1. Latest Release Summary
3.1. 最新版本发布摘要
- Fetch CHANGELOG using the command above
- Extract the first section
## x.x.x - Categorize changes into:
- New features (Added)
- Bug fixes (Fixed)
- Improvements (Improved/Changed)
- Deprecations (Deprecated)
- Present in Japanese with brief explanations
- 使用上述命令获取CHANGELOG
- 提取第一个章节
## x.x.x - 将变更分类为:
- 新功能(Added)
- Bug修复(Fixed)
- 改进(Improved/Changed)
- 弃用(Deprecated)
- 以日语呈现并附带简要说明
3.2. Version Diff
3.2. 版本差异对比
- Ask user for start and end versions
- Extract all sections between those versions
- Summarize cumulative changes
- Highlight breaking changes and deprecations
- 询问用户起始版本和结束版本
- 提取这两个版本之间的所有章节
- 汇总累计变更
- 突出显示破坏性变更和弃用内容
3.3. Breaking Changes Detection
3.3. 破坏性变更检测
- Search for keywords: ,
Deprecated,Removed,BreakingChanged - List affected settings and migration paths
- Check user's config for affected settings
- 搜索关键词:、
Deprecated、Removed、BreakingChanged - 列出受影响的配置项和迁移路径
- 检查用户配置中是否存在受影响的设置
4. Specification Reference
4. 规范参考
For detailed questions about Claude Code specifications, features, and usage:
- YOU MUST: Use the subagent via Task tool
claude-code-guide - Example queries: hooks, MCP servers, settings, IDE integrations
text
Task tool with subagent_type: claude-code-guide对于Claude Code规范、功能和使用的详细问题:
- 必须:通过Task工具调用子Agent
claude-code-guide - 示例查询:hooks、MCP服务器、设置、IDE集成
text
Task tool with subagent_type: claude-code-guide5. Settings Categories
5. 配置分类
| Category | Examples |
|---|---|
| Display | |
| Behavior | |
| Tools | |
| MCP | MCP server configurations |
| Hooks | PreToolUse, PostToolUse, Stop hooks |
| Plans | |
| 分类 | 示例 |
|---|---|
| 显示 | |
| 行为 | |
| 工具 | |
| MCP | MCP服务器配置 |
| Hooks | PreToolUse、PostToolUse、Stop hooks |
| 计划 | |
6. CLAUDE.md Design Guidelines
6. CLAUDE.md设计指南
- YOU MUST: Focus only on persona and core guidelines
- YOU MUST: Split detailed rules into
rules/ - NEVER: Include unnecessary information at startup (reference links, usage details)
- 必须:仅聚焦于角色设定和核心准则
- 必须:将详细规则拆分至目录
rules/ - 禁止:在启动时包含不必要的信息(参考链接、使用细节)
7. Configuration Usage
7. 配置使用方式
| Type | Load Timing | Purpose |
|---|---|---|
| CLAUDE.md / rules/ | Full load at startup | Global rules always applied |
| commands/ | Explicit user invocation | Predefined prompts, workflows |
| skills/ | Auto-triggered by conversation | Specialized knowledge |
| agents/ | Delegated via Task tool | Independent context |
| 类型 | 加载时机 | 用途 |
|---|---|---|
| CLAUDE.md / rules/ | 启动时完整加载 | 始终应用的全局规则 |
| commands/ | 用户显式调用 | 预定义提示词、工作流 |
| skills/ | 对话时自动触发 | 专业知识 |
| agents/ | 通过Task工具委托 | 独立上下文 |
8. Optimization Checklist
8. 优化检查清单
8.1. CLAUDE.md Review
8.1. CLAUDE.md审核
Check the following when editing CLAUDE.md:
- Is the persona definition concise?
- Are basic rules truly needed at all times?
- Can detailed explanations be moved to rules/ or skills/?
- Have reference links been moved to skills?
编辑CLAUDE.md时需检查以下内容:
- 角色定义是否简洁?
- 基础规则是否确实需要始终生效?
- 详细说明是否可以移至rules/或skills/?
- 参考链接是否已移至skills?
8.2. Permission System Review
8.2. 权限系统审核
Check settings.json permissions block:
- Are deny rules using modern syntax not deprecated
Bash(cmd *)?:* - Are critical commands blocked (git push, git rebase, git reset, rm, sudo)?
- Is blocked to prevent cross-repo operations?
git -C * - Is defaultMode appropriate ("plan" or "dontAsk")?
- Are sensitive paths blocked (secrets, .env, .ssh, keys, tokens)?
- Are allow rules necessary or can defaultMode handle it?
检查settings.json中的权限块:
- 拒绝规则是否使用现代语法而非已弃用的
Bash(cmd *)?:* - 关键命令是否被阻止(git push、git rebase、git reset、rm、sudo)?
- 是否被阻止以防止跨仓库操作?
git -C * - defaultMode是否合适("plan"或"dontAsk")?
- 敏感路径是否被阻止(secrets、.env、.ssh、keys、tokens)?
- 允许规则是否必要,或者defaultMode是否可以处理?
9. File Structure Maintenance
9. 文件结构维护
When adding/removing files in rules/, skills/, agents/, or commands/:
- YOU MUST: Update corresponding table in CLAUDE.md section 4
- YOU MUST: Keep tables alphabetically sorted or logically grouped
- IMPORTANT: Verify actual files match documentation after changes
在rules/、skills/、agents/或commands/中添加/删除文件时:
- 必须:更新CLAUDE.md第4节中的对应表格
- 必须:保持表格按字母顺序排序或逻辑分组
- 重要:变更后验证实际文件是否与文档一致
10. Optimization Tracking
10. 优化跟踪
Last reviewed Claude Code version: v2.1.37 (2026-02-09)
最近审核的Claude Code版本:v2.1.37(2026-02-09)
10.1. Applied Optimizations
10.1. 已应用的优化
- Persona definition minimized
- Rules split into rules/ directory
- Skills split into skills/ directory
- Agents split into agents/ directory
- Commands split into commands/ directory
- Reference links moved to skills
- setting - set to "follow CLAUDE.md's instructions"
language - setting - set to "auto:1"
mcpToolSearch - env - set to "true" (force enable)
ENABLE_TOOL_SEARCH - setting - set to ".i9wa4/plans"
plansDirectory - Permission system reviewed - sandbox bypass fix confirmed (v2.1.34)
- Permission deny rules migrated - deprecated to modern
:*syntax* - Fast mode - available for Opus 4.6 (v2.1.36)
- Agent teams - enabled via
CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS - Automatic memory - enabled by default (v2.1.32)
- 角色定义已最小化
- 规则拆分至rules/目录
- 技能拆分至skills/目录
- Agent拆分至agents/目录
- 命令拆分至commands/目录
- 参考链接已移至skills
- 设置 - 设为"follow CLAUDE.md's instructions"
language - 设置 - 设为"auto:1"
mcpToolSearch - 环境变量 - 设为"true"(强制启用)
ENABLE_TOOL_SEARCH - 设置 - 设为".i9wa4/plans"
plansDirectory - 权限系统已审核 - 沙箱绕过修复已确认(v2.1.34)
- 权限拒绝规则已迁移 - 从已弃用的语法改为现代
:*语法* - 快速模式 - 对Opus 4.6可用(v2.1.36)
- Agent团队 - 通过启用
CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS - 自动记忆 - 默认启用(v2.1.32)
10.2. Pending Considerations
10.2. 待考虑事项
- SQL schema validation - moved to databricks skill (Section 8)
- TeammateIdle/TaskCompleted hooks - for future agent workflow automation
- Agent memory frontmatter - for stateful agents
memory: user|project|local - Task(agent_type) restrictions - enhanced security for subagent spawning
- SQL模式验证 - 移至databricks技能(第8节)
- TeammateIdle/TaskCompleted hooks - 用于未来的Agent工作流自动化
- Agent记忆前置元数据 - 用于有状态Agent
memory: user|project|local - Task(agent_type)限制 - 增强子Agent生成的安全性
10.3. Not Adopting
10.3. 不采用的配置
- - keep default (show duration)
showTurnDuration - - keep default (animations enabled)
reducedMotionMode - Keybindings customization - use defaults
- Completion status reporting - no consumer for this output
- - 保留默认值(显示时长)
showTurnDuration - - 保留默认值(启用动画)
reducedMotionMode - 快捷键自定义 - 使用默认设置
- 完成状态报告 - 无此输出的消费者
10.4. Version Notes
10.4. 版本说明
- v2.1.37: /fast immediately available after /extra-usage
- v2.1.36: Fast mode for Opus 4.6
- v2.1.34: Sandbox bypass vulnerability fixed (security), agent teams crash fix
- v2.1.33: TeammateIdle/TaskCompleted hooks, agent memory frontmatter, Task(agent_type) restrictions, tmux agent sessions fix
- v2.1.32: Claude Opus 4.6 available, automatic memory, agent teams research preview, skills auto-load from --add-dir, Bash template literal fix
- v2.1.31: PDF lock fix, sandbox error fix, system prompt improvement for dedicated tools
- v2.1.30: Read tool param for PDFs,
pagescommand, MCP OAuth pre-configured credentials, reduced motion mode/debug - v2.1.29: SessionStart hook saved_hook_context performance fix
- v2.1.27: --from-pr flag, auto PR-session linking, debug log improvements
- v2.1.23: spinnerVerbs setting, terminal rendering perf, mTLS/proxy fix
- v2.1.21: Zenkaku number input (JP IME), auto-compact timing fix, task ID reuse fix
- v2.1.20: PR review status indicator, --add-dir CLAUDE.md loading, TaskUpdate delete, config backup rotation, background agent permission prompt
- v2.1.19: CLAUDE_CODE_ENABLE_TASKS env, $ARGUMENTS[0] syntax, skill approval change
- v2.1.18: Customizable keybindings (/keybindings command)
- v2.1.16: New task management system with dependency tracking
- v2.1.15: npm deprecation notice, React Compiler UI perf, MCP stdio timeout fix
- v2.1.14: Bash history autocomplete, plugin pinning to git SHA, memory fixes
- v2.1.10: Setup hook, OAuth URL copy shortcut, heredoc template literal fix
- v2.1.9: plansDirectory, auto:N for MCP, PreToolUse additionalContext
- v2.1.7: keybindings.json, showTurnDuration, MCP tool search auto mode
- v2.1.3: Merged slash commands and skills
- v2.1.0: language setting, skill hot-reload, context: fork
- v2.1.37:/fast命令可在/extra-usage后立即使用
- v2.1.36:Opus 4.6支持快速模式
- v2.1.34:修复沙箱绕过漏洞(安全)、修复Agent团队崩溃问题
- v2.1.33:新增TeammateIdle/TaskCompleted hooks、Agent记忆前置元数据、Task(agent_type)限制、修复tmux Agent会话问题
- v2.1.32:Claude Opus 4.6可用、自动记忆、Agent团队研究预览、从--add-dir自动加载技能、修复Bash模板字面量问题
- v2.1.31:修复PDF锁定问题、修复沙箱错误、改进专用工具的系统提示
- v2.1.30:Read工具支持PDF的参数、新增/debug命令、MCP OAuth预配置凭据、减少动画模式
pages - v2.1.29:修复SessionStart hook的saved_hook_context性能问题
- v2.1.27:新增--from-pr标志、自动PR会话关联、改进调试日志
- v2.1.23:新增spinnerVerbs设置、优化终端渲染性能、修复mTLS/代理问题
- v2.1.21:支持全角数字输入(日语输入法)、修复自动压缩计时问题、修复任务ID重用问题
- v2.1.20:PR审核状态指示器、--add-dir加载CLAUDE.md、删除TaskUpdate、配置备份轮换、后台Agent权限提示
- v2.1.19:新增CLAUDE_CODE_ENABLE_TASKS环境变量、$ARGUMENTS[0]语法、技能审批变更
- v2.1.18:可自定义快捷键(/keybindings命令)
- v2.1.16:新增带依赖跟踪的任务管理系统
- v2.1.15:npm弃用通知、React Compiler UI性能优化、修复MCP标准输入输出超时问题
- v2.1.14:Bash历史自动补全、插件固定到git SHA、修复记忆问题
- v2.1.10:新增Setup hook、OAuth URL复制快捷方式、修复heredoc模板字面量问题
- v2.1.9:新增plansDirectory、MCP的auto:N模式、PreToolUse的additionalContext
- v2.1.7:新增keybindings.json、showTurnDuration、MCP工具搜索自动模式
- v2.1.3:合并斜杠命令与技能
- v2.1.0:新增language设置、技能热重载、context: fork
11. Response Format (CHANGELOG)
11. CHANGELOG响应格式
text
undefinedtext
undefinedClaude Code vX.X.X
Claude Code vX.X.X
New Features
New Features
Bug Fixes
Bug Fixes
- [Fix description]
- [Fix description]
Improvements
Improvements
- [Improvement description]
- [Improvement description]
Deprecated/Removed
Deprecated/Removed
12. site2skill Usage
12. site2skill使用方法
Convert documentation websites into Claude Agent Skills.
Requirements: Python 3.10+, wget ()
brew install wgetsh
uvx --from git+https://github.com/laiso/site2skill site2skill <URL> <SKILL_NAME>将文档网站转换为Claude Agent技能。
要求:Python 3.10+、wget()
brew install wgetsh
uvx --from git+https://github.com/laiso/site2skill site2skill <URL> <SKILL_NAME>Example
示例
uvx --from git+https://github.com/laiso/site2skill site2skill https://docs.pay.jp/v1/ payjp
Options:
- `--output, -o` - Output directory (default: `.claude/skills`)
- `--skill-output` - Where to save .skill file (default: current directory)
- `--skip-fetch` - Skip download (reuse existing files)
- `--clean` - Remove temporary files after completion
To update existing skill docs, re-run without `--skip-fetch`.uvx --from git+https://github.com/laiso/site2skill site2skill https://docs.pay.jp/v1/ payjp
选项:
- `--output, -o` - 输出目录(默认:`.claude/skills`)
- `--skill-output` - .skill文件保存路径(默认:当前目录)
- `--skip-fetch` - 跳过下载(重用现有文件)
- `--clean` - 完成后删除临时文件
要更新现有技能文档,重新运行时不添加`--skip-fetch`参数即可。13. Reference Links
13. 参考链接
Official Documentation:
- Best Practices: https://code.claude.com/docs/en/best-practices.md
- Docs Map: https://code.claude.com/docs/en/claude_code_docs_map.md
Community Resources:
- Claude Code config: https://blog.atusy.net/2025/12/15/claude-code-user-config/
- CLAUDE.md minimization: https://blog.atusy.net/2025/12/17/minimizing-claude-md/
- site2skill: https://github.com/laiso/site2skill
官方文档:
- 最佳实践:https://code.claude.com/docs/en/best-practices.md
- 文档地图:https://code.claude.com/docs/en/claude_code_docs_map.md
社区资源:
- Claude Code配置:https://blog.atusy.net/2025/12/15/claude-code-user-config/
- CLAUDE.md最小化:https://blog.atusy.net/2025/12/17/minimizing-claude-md/
- site2skill:https://github.com/laiso/site2skill
14. Permission System Reference
14. 权限系统参考
14.1. Permission Modes
14.1. 权限模式
| Mode | Description |
|---|---|
| Prompts for permission on first use of each tool |
| Auto-accepts file edit permissions for the session |
| Plan Mode: analyze only, no modifications |
| Auto-denies unless pre-approved via allow rules |
| Skips all prompts (use only in isolated environments) |
| 模式 | 描述 |
|---|---|
| 首次使用每个工具时提示获取权限 |
| 会话期间自动接受文件编辑权限 |
| 仅分析,不进行修改 |
| 自动拒绝,除非通过允许规则预先批准 |
| 跳过所有提示(仅在隔离环境中使用) |
14.2. Rule Evaluation Order
14.2. 规则评估顺序
Rules are evaluated: deny -> ask -> allow. First matching rule wins.
规则评估顺序:拒绝 -> 询问 -> 允许。第一个匹配的规则生效。
14.3. Bash Wildcard Patterns
14.3. Bash通配符模式
json
{
"permissions": {
"allow": [
"Bash(npm run *)",
"Bash(git commit *)",
"Bash(* --version)",
"Bash(* --help *)"
],
"deny": ["Bash(git push *)"]
}
}NOTE: Space before matters: matches but not .
*Bash(ls *)ls -lalsofjson
{
"permissions": {
"allow": [
"Bash(npm run *)",
"Bash(git commit *)",
"Bash(* --version)",
"Bash(* --help *)"
],
"deny": ["Bash(git push *)"]
}
}注意:前的空格很重要:匹配但不匹配。
*Bash(ls *)ls -lalsof14.4. Read/Edit Path Patterns
14.4. 读取/编辑路径模式
| Pattern | Meaning | Example |
|---|---|---|
| Absolute path from root | |
| Path from home directory | |
| Relative to settings file | |
| Relative to current directory | |
NOTE: matches single directory, matches recursively.
***| 模式 | 含义 | 示例 |
|---|---|---|
| 从根目录开始的绝对路径 | |
| 从用户主目录开始的路径 | |
| 相对于配置文件的路径 | |
| 相对于当前目录的路径 | |
注意:匹配单个目录,递归匹配所有目录。
***14.5. MCP and Task Permissions
14.5. MCP与Task权限
json
{
"permissions": {
"allow": ["mcp__puppeteer__*"],
"deny": ["Task(Explore)"]
}
}json
{
"permissions": {
"allow": ["mcp__puppeteer__*"],
"deny": ["Task(Explore)"]
}
}14.6. Managed Settings Locations
14.6. 托管配置位置
| Platform | Path |
|---|---|
| macOS | |
| Linux/WSL | |
| Windows | |
| 平台 | 路径 |
|---|---|
| macOS | |
| Linux/WSL | |
| Windows | |
14.7. Managed-Only Settings
14.7. 仅托管配置项
| Setting | Description |
|---|---|
| Set to "disable" to prevent bypass mode |
| Only managed rules apply |
| Only managed/SDK hooks allowed |
| 配置项 | 描述 |
|---|---|
| 设置为"disable"以防止绕过模式 |
| 仅应用托管规则 |
| 仅允许托管/SDK hooks |
15. Insights-Based Recommendations
15. 基于使用分析的建议
Based on usage analysis (55K messages, 4.7K sessions):
基于使用分析(55K条消息,4.7K次会话):
15.1. Applied
15.1. 已应用
- Schema validation for DB operations: See databricks skill Section 8
- 数据库操作的模式验证:参见databricks技能第8节
15.2. Not Applied
15.2. 未应用
- Completion status reporting: No consumer for this output
- PreToolUse hook for SQL: Handled by skill guidance instead
- 完成状态报告:无此输出的消费者
- SQL的PreToolUse hook:由技能指导处理
16. References
16. 参考资料
- Hooks Reference:
https://code.claude.com/docs/en/hooks - Permissions Reference:
https://code.claude.com/docs/en/permissions - Skills Dynamic Context:
https://code.claude.com/docs/en/skills#inject-dynamic-context - Vercel AGENTS.md Guide:
https://vercel.com/blog/agents-md
- Hooks参考:
https://code.claude.com/docs/en/hooks - 权限参考:
https://code.claude.com/docs/en/permissions - 技能动态上下文:
https://code.claude.com/docs/en/skills#inject-dynamic-context - Vercel AGENTS.md指南:
https://vercel.com/blog/agents-md