Learn how to use slash commands to control Claude Code sessions through the SDK
/
. These commands can be sent through the SDK to perform actions like clearing conversation history, compacting messages, or getting help.
/compact
- Compact Conversation History/compact
command reduces the size of your conversation history by summarizing older messages while preserving important context:
/clear
- Clear Conversation/clear
command starts a fresh conversation by clearing all previous history:
.claude/commands/
- Available only in the current project~/.claude/commands/
- Available across all your projects.md
extension) becomes the command name.claude/commands/refactor.md
:
/refactor
command that you can use through the SDK.
.claude/commands/security-check.md
:
.claude/commands/fix-issue.md
:
.claude/commands/git-commit.md
:
@
prefix:
Create .claude/commands/review-config.md
:
.claude/commands/code-review.md
:
.claude/commands/test.md
: