写在前面

为简化表达,以下使用cc代指Claude Code。

其中带有标记的文章或仓库链接是十分推荐阅读学习的。


常用命令

终端命令

这部分命令在终端中直接执行。

命令 说明 备注
claude –version 查看版本

@ 和 !

这部分命令需要在终端中启动cc后,在cc交互页面中执行。

符号 作用 示例
@ 感知:将文件/资源注入上下文 解释 @src/auth.ts 的逻辑
! 行动:在提示框中直接执行 Shell ! git log –oneline -5(结果注入上下文)

斜杠命令

这部分命令需要在终端中启动cc后,在cc交互页面中执行。

命令 说明 备注
/model
/status
/config
/permissions
/compact
/clear
/init
/cost
/context

常用配置项


扩展

MCP

Skill

Plugin


实用工具

1、ccusage


实用仓库

1、opcode

https://github.com/winfunc/opcode

A powerful GUI app and Toolkit for Claude Code - Create custom agents, manage interactive Claude Code sessions, run secure background agents, and more.

2、everything-claude-code

https://github.com/affaan-m/everything-claude-code

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

3、superpowers

https://github.com/obra/superpowers

An agentic skills framework & software development methodology that works.

4、claude-code-tips

https://github.com/ykdojo/claude-code-tips

45 tips for getting the most out of Claude Code, from basics to advanced - includes a custom status line script, cutting the system prompt in half, using Gemini CLI as Claude Code’s minion, and Claude Code running itself in a container. Also includes the dx plugin.

5、skills

https://github.com/anthropics/skills

Public repository for Agent Skills.


最佳实践

如何编写CLAUDE.md

应该如何拆分会话


常见错误和解决方法

1、API Error: The model has reached its context window limit.

![](D:\GitRepositories\My Projects\Claude Code使用指南\images\达到上下文窗口限制.png)

达到上下文窗口限制。

![](D:\GitRepositories\My Projects\Claude Code使用指南\images\clear和compact命令.png)

可以使用/clear清空当前会话的上下文,但这会导致cc不再记得之前聊过什么,可能会影响它对项目的理解。

可以使用/compact压缩上下文。

2、Unable to connect

![](D:\GitRepositories\My Projects\Claude Code使用指南\images\unable connect.png)

检查 .claude.json 文件的 hasCompletedOnboarding 参数,该参数含义为是否已完成新手引导,配置为true时可跳过登录等环节。

MacOS & Linux 为 ~/.claude.json, Windows 为用户目录/.claude.json

注意:该参数需要配置在最高层级。

 {  
 	"hasCompletedOnboarding": true
 }

3、Usage Policy

![](D:\GitRepositories\My Projects\Claude Code使用指南\images\usage policy .png)

暂不清楚是何原因导致的,但是换种问法,就能正常继续对话。


文章分享

https://zhuanlan.zhihu.com/p/2009744974980331332