claude-code
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseClaude Code
Claude Code
Summary
摘要
Goal: Help users install, configure, troubleshoot, and extend Claude Code CLI (skills, hooks, MCP, slash commands).
| Step | Action | Key Notes |
|---|---|---|
| 1 | Identify problem category | Setup, Hook Issues, MCP Issues, Context, Extensibility, Configuration |
| 2 | Execute category-specific diagnosis | Check prerequisites, configs, scripts, settings |
| 3 | Apply fix | Step-by-step solution with verification |
| 4 | Output report | Problem, Solution, Files Changed, Verification |
Key Principles:
- Load reference files on-demand per topic (10 reference docs available)
- Never modify settings without user approval
- For app code use /
featureskills, not this onedebug
目标: 帮助用户安装、配置、排查故障并扩展Claude Code CLI(skills、hooks、MCP、斜杠命令)。
| 步骤 | 操作 | 关键说明 |
|---|---|---|
| 1 | 识别问题类别 | 安装、Hook问题、MCP问题、上下文、可扩展性、配置 |
| 2 | 执行对应类别的诊断 | 检查前置依赖、配置项、脚本、设置 |
| 3 | 应用修复方案 | 附带验证环节的分步解决方案 |
| 4 | 输出报告 | 问题、解决方案、变更文件、验证结果 |
核心原则:
- 按需加载对应主题的参考文件(共10份参考文档可用)
- 未经用户许可绝不修改任何设置
- 应用代码相关问题请使用/
featureskill,不要使用本指南debug
Purpose
用途
Help users install, configure, troubleshoot, and extend Claude Code CLI -- Anthropic's agentic coding tool with skills, hooks, MCP servers, and slash commands.
帮助用户安装、配置、排查故障并扩展Claude Code CLI——Anthropic出品的具备skills、hooks、MCP服务器和斜杠命令能力的智能Agent编程工具。
When to Use
适用场景
- Setting up Claude Code for the first time
- Troubleshooting hooks that don't fire or produce errors
- Diagnosing MCP server connection failures
- Understanding or resolving context window limits
- Creating or modifying slash commands and agent skills
- Configuring settings (model, allowed tools, output style)
- 首次设置Claude Code
- 排查Hook不触发或报错问题
- 诊断MCP服务器连接失败问题
- 理解或解决上下文窗口限制问题
- 创建或修改斜杠命令和Agent skill
- 配置设置(模型、允许使用的工具、输出样式)
When NOT to Use
不适用场景
- Writing application code -- use ,
feature, ordebugskillsrefactoring - Creating MCP servers from scratch -- use skill
mcp-builder - Managing existing MCP connections -- use skill
mcp-management
- 编写应用代码——请使用、
feature或debugskillrefactoring - 从零创建MCP服务器——请使用skill
mcp-builder - 管理现有MCP连接——请使用skill
mcp-management
Workflow
工作流程
Step 1: Identify Problem Category
步骤1:识别问题类别
| User Says | Category | Go To |
|---|---|---|
| "install", "set up", "authenticate" | Setup | Step 2A |
| "hook not firing", "hook error" | Hook Issues | Step 2B |
| "MCP not connecting", "MCP error" | MCP Issues | Step 2C |
| "context too long", "compaction", "token limit" | Context Issues | Step 2D |
| "create skill", "create command" | Extensibility | Step 2E |
| "configure", "settings", "model" | Configuration | Step 2F |
| 用户话术 | 类别 | 跳转至 |
|---|---|---|
| "install", "set up", "authenticate" | 安装 | 步骤2A |
| "hook not firing", "hook error" | Hook问题 | 步骤2B |
| "MCP not connecting", "MCP error" | MCP问题 | 步骤2C |
| "context too long", "compaction", "token limit" | 上下文问题 | 步骤2D |
| "create skill", "create command" | 可扩展性 | 步骤2E |
| "configure", "settings", "model" | 配置 | 步骤2F |
Step 2A: Setup
步骤2A:安装
- Check prerequisites: Node.js 18+, npm
- Verify authentication:
claude auth status - Verify project detection: check for in project root
CLAUDE.md
- 检查前置依赖:Node.js 18+、npm
- 验证身份认证状态:
claude auth status - 验证项目识别:检查项目根目录是否存在
CLAUDE.md
Step 2B: Hook Issues
步骤2B:Hook问题
- Read the hook file causing issues
- Check hook event type matches expected trigger
- Verify hook script is executable with correct shebang
- Check for hook registration
.claude/settings.json - Test hook in isolation with mock input
Common fixes:
- Hook not firing: wrong event name or tool matcher pattern
- Hook errors: script not finding dependencies (check relative paths)
- Hook blocks unexpectedly: PreToolUse returning incorrectly
{ "decision": "block" }
- 读取出现问题的Hook文件
- 检查Hook事件类型是否与预期触发条件匹配
- 验证Hook脚本具备可执行权限且shebang正确
- 检查中是否完成Hook注册
.claude/settings.json - 使用模拟输入单独测试Hook运行状态
常见修复方案:
- Hook不触发:事件名称错误或工具匹配模式不正确
- Hook报错:脚本找不到依赖(检查相对路径)
- Hook意外阻塞:PreToolUse错误返回
{ "decision": "block" }
Step 2C: MCP Issues
步骤2C:MCP问题
- Check for server configuration
.mcp.json - Verify the MCP server process can start manually
- Check environment variables (API keys in )
.env.local - Test connectivity:
claude mcp list
- 检查中的服务器配置
.mcp.json - 验证MCP服务器进程可手动启动
- 检查环境变量(中的API密钥)
.env.local - 测试连通性:
claude mcp list
Step 2D: Context Issues
步骤2D:上下文问题
- Check current context usage
- Suggest command if approaching limit
/compact - Review if large files are being read unnecessarily
- Verify hook for session continuity
session-resume.cjs
- 检查当前上下文使用量
- 接近限制时建议使用命令
/compact - 排查是否存在不必要的大文件读取
- 验证Hook的会话连续性配置
session-resume.cjs
Step 2E: Extensibility
步骤2E:可扩展性
- For skills: read for structure
references/agent-skills.md - For commands: create
.claude/skills/{name}.md - Verify SKILL.md frontmatter has required fields (name, version, description)
- 技能开发:参考了解结构规范
references/agent-skills.md - 命令创建:生成文件
.claude/skills/{name}.md - 验证SKILL.md头部元数据包含必填字段(名称、版本、描述)
Step 2F: Configuration
步骤2F:配置
- Settings locations: (project),
.claude/settings.json(user)~/.claude/settings.json - IMPORTANT: Never modify settings without user approval
- 配置文件位置:(项目级)、
.claude/settings.json(用户级)~/.claude/settings.json - 重要提示:未经用户许可绝不修改任何配置
Output Format
输出格式
markdown
undefinedmarkdown
undefinedClaude Code: [Issue/Task Summary]
Claude Code: [Issue/Task Summary]
Problem
Problem
[What was wrong or what was requested]
[What was wrong or what was requested]
Solution
Solution
[Step-by-step fix or setup instructions]
[Step-by-step fix or setup instructions]
Files Changed
Files Changed
[List any config files modified]
[List any config files modified]
Verification
Verification
[How to confirm the fix works]
undefined[How to confirm the fix works]
undefinedReference Guide
参考指南
Load references as needed for specific topics:
| Topic | Reference File |
|---|---|
| Installation & setup | |
| Creating skills | |
| Hooks system | |
| Configuration | |
| Troubleshooting | |
| IDE integration | |
| CI/CD | |
| Advanced features | |
| API reference | |
| Best practices | |
按需加载对应主题的参考文件:
| 主题 | 参考文件 |
|---|---|
| 安装与设置 | |
| 技能创建 | |
| Hooks系统 | |
| 配置说明 | |
| 故障排查 | |
| IDE集成 | |
| CI/CD | |
| 高级功能 | |
| API参考 | |
| 最佳实践 | |
Related Skills
相关Skill
- -- creating new MCP servers
mcp-builder - -- managing MCP connections
mcp-management - -- creating new agent skills
skill-plan
IMPORTANT Task Planning Notes (MUST FOLLOW)
- Always plan and break work into many small todo tasks
- Always add a final review todo task to verify work quality and identify fixes/enhancements
- ——创建新的MCP服务器
mcp-builder - ——管理MCP连接
mcp-management - ——创建新的Agent skill
skill-plan
重要任务规划说明(必须遵守)
- 始终将工作拆分为多个小型待办任务
- 始终添加最终审核待办任务,验证工作质量并识别需要修复/优化的内容