POWER USER FEATURES
Once you're comfortable with basics, these features speed up your workflow significantly.
Built-In Slash Commands
Claude Code has built-in commands starting with /:
/help Show all available commands
/context Check context usage
/compact Compress context manually
/clear Clear conversation history
/init Generate CLAUDE.md from codebase
/permissions View/manage tool permissions
Custom Slash Commands
You can create your own commands. They're just markdown files.
Global commands (work everywhere):
mkdir -p ~/.claude/commands
Project commands (work in specific project):
mkdir -p .claude/commands
Creating a Command
Example: A code review command.
Create ~/.claude/commands/review.md:
Review the code in $ARGUMENTS for:
1. Security vulnerabilities
2. Performance issues
3. Perl best practices
4. Missing error handling
Be concise and actionable.
Now in any Claude Code session:
/review lib/Auth.pm
The $ARGUMENTS placeholder gets replaced with whatever you type after the command.
Command With Multiple Arguments
Create ~/.claude/commands/compare.md:
Compare $1 and $2:
- What are the key differences?
- Which approach is better and why?
- Any shared patterns?
Use it:
/compare lib/OldAuth.pm lib/NewAuth.pm
$1 is first argument, $2 is second, etc.
Useful Custom Commands
Safe commit checker:
~/.claude/commands/commit.md:
Review all uncommitted changes (git diff HEAD).
Before I commit, check for:
- TODO or FIXME comments that shouldn't be committed
- Commented-out code
- Debug statements (print, console.log, dd())
- Hardcoded test values
- Sensitive data (API keys, passwords)
If clean, suggest a commit message.
If issues found, list them.
Test writer:
~/.claude/commands/test.md:
Write tests for $ARGUMENTS:
- Test normal operation
- Test edge cases
- Test error conditions
- Use Test::More conventions
- Include setup/teardown if needed
Explain command:
~/.claude/commands/explain.md:
Explain $ARGUMENTS in detail:
- What does it do?
- How does it work?
- What are the key parts?
- Any non-obvious behavior?
Assume I'm familiar with Perl but new to this codebase.
Session Management
Continue last session:
claude --continue
Resume a specific session:
claude --resume
This opens a picker showing recent sessions.
Useful when:
- Terminal crashed
- You closed it accidentally
- Want to revisit yesterday's work
Context Commands
Check usage:
/context
Shows:
- Current context percentage
- Which files are loaded
- CLAUDE.md status
Manual compact:
/compact
Summarizes conversation and clears old messages. Good habit after completing a major task.
Auto-compact threshold (in settings.json):
"env": {
"CLAUDE_AUTOCOMPACT_PCT_OVERRIDE": "75"
}
Triggers automatic compaction at 75% context usage.
File Commands
Add additional directories:
/add-dir ~/shared/libraries
Now Claude can see files outside your current project. Useful for referencing shared code.
Permission Management
Interactive permission editor:
/permissions
Shows what's allowed/denied. You can adjust here instead of editing settings.json.
Status Line
Claude Code shows status info at the bottom. Customize with:
/statusline
Shows model, context usage, and other info. Useful for monitoring.
MCP Integration
Model Context Protocol (MCP) lets you add external tools. Not covered in depth here, but you can add MCP servers:
claude mcp add postgres
Then Claude can query databases, interact with APIs, etc.
View configured MCP servers:
/mcp
Working on Multiple Files
If you're changing many related files:
> Read @lib/Controller/*.pm and understand the pattern.
> Now apply the same pattern to @lib/Controller/NewThing.pm
Claude keeps the pattern consistent across files.
Batch Operations
For repetitive tasks across many files:
> For each file in @lib/Model/*.pm:
> 1. Add proper documentation header
> 2. Add "use strict; use warnings;"
> 3. List what you changed
Claude processes them systematically.
Debugging Sessions
When Claude seems stuck or confused:
/context
Check if context is nearly full. If yes, /compact.
> Summarize what we've discussed so far
See if Claude's understanding matches yours.
> Start fresh on this problem
Reset approach without clearing history.
Tips From Power Users
1. Keep commands short and focused
A 500-word command file costs context every time it loads.
2. Use project commands for project-specific tasks
Global: generic utilities
Project: specific to that codebase
3. Chain commands mentally
/review lib/App.pm
[fix issues]
/test lib/App.pm
[verify]
/commit
4. Alias claude for convenience
Add to ~/.zshrc:
alias c='claude'
alias cc='claude --continue'
5. Use /compact after major milestones
Finished a feature? /compact
Fixed a bug? /compact
Don't wait for context to fill
Summary
Custom commands:
~/.claude/commands/name.md Global
.claude/commands/name.md Project
Use $ARGUMENTS, $1, $2, etc.
Session management:
claude --continue Resume last
claude --resume Pick from history
Context management:
/context Check usage
/compact Compress
Auto-compact via settings.json
Built-in commands:
/help, /init, /permissions, /mcp
Next chapter: Troubleshooting common issues.