Essential CLI Commands
Claude Code has dozens of commands. Most of them you'll never use. These are the 10 I use every day.
The Commands That Matter
/help - Your Quick Reference
/helpShows all available commands. Use it when you can't remember something.
/init - Initialize CLAUDE.md
/initCreates the CLAUDE.md file by analyzing your project. Always run this when starting with a new project.
/context - View Token Usage
/contextShows how many tokens you're using in the current session. Crucial for not running out of context.
Pro Tip: If you're above 60%, consider running /clear and starting fresh.
/clear - Clean Context
/clearClears conversation history. Use it between features to keep context focused.
/compact - Summarize History
/compactSummarizes conversation history instead of deleting it. Useful when you want to keep some context but reduce tokens.
/status - Project Status
/statusShows current project state - git branch, modified files, etc.
/permissions - Configure Permissions
/permissionsOpens the permissions panel. Configure which commands Claude can execute without asking.
/config - Configuration
/configShows current Claude Code configuration. Useful for debugging.
/cost - View Costs
/costShows current session usage and estimated costs. Important for controlling expenses.
# - Add Rule to CLAUDE.md
# Always use TypeScript strict modeAny line you start with # gets added directly to CLAUDE.md. Super useful for adding rules while you work.
Keyboard Shortcuts
These save you clicks:
| Shortcut | Action |
|---|---|
Shift + Tab | Change mode (Default → Auto → Plan) |
Esc | Stop Claude immediately |
Ctrl + C | Cancel current command |
Tab | Autocomplete files/paths |
Up Arrow | Previous command |
Git Commands
Claude has built-in Git commands:
/git status # View status
/git diff # View changes
/git commit # Create commitBut honestly, I prefer using normal Git commands. Claude understands them just fine.
Lesser-Known But Useful Commands
/doctor - Diagnostics
/doctorRuns diagnostics to verify everything is configured correctly. Use it if something isn't working.
/mcp - Manage MCPs
/mcp list # View installed MCPs
/mcp add [name] # Add MCPFor managing external integrations.
/agents - Create Sub-Agents
/agentsOpens the wizard for creating sub-agents. We cover this in detail in the advanced module.
Mistakes That Cost Me Hours
Mistake 1: Forgetting /clear Between Features
The error: I worked on 3 features in a row in the same chat. Claude started mixing context and broke code from the first feature.
The cost: 1 hour rollback + debugging.
The lesson: One chat = one feature. /clear religiously when you finish something.
Mistake 2: Ignoring /context
The error: I didn't check token usage. Halfway through a big refactor, Claude started "forgetting" important files.
The cost: Had to redo the refactor from scratch because context was saturated.
The lesson: Check /context every 15-20 minutes on long tasks.
Daily Workflow with Commands
My typical workflow:
- Start project:
/init(if new) - Before each feature:
/clear - During work:
/contextevery 15 min - Add rules:
# [rule]while working - Finish feature:
/clear
Quick Cheatsheet
/help → View all commands
/init → Create CLAUDE.md
/clear → Clean context
/context → View token usage
/cost → View session costs
/compact → Summarize history
Shift+Tab → Change mode
Esc → Stop Claude
# text → Add rule to CLAUDE.md
Challenge: Try This
Before moving to the next lesson:
- Open Claude Code and run
/help - Run
/contextto see your current usage - Add a rule with
# Always use TypeScript - Verify it was added to your CLAUDE.md
Estimated time: 5 minutes
Next Step
Now that you know the basic commands, let's see how to configure security permissions.