1. Session Management
| Command | What it does | When to use |
|---|---|---|
/clear | Wipe the entire conversation | Switching to a completely different task |
/compact | Compress context, keep what matters | When context > 60% — e.g. /compact focus on API changes |
/resume | Continue a previous session | Pick from the session list |
/rename | Name the session so you can find it later | Use before exiting — e.g. /rename oauth-migration |
/rewind | Roll back to the last checkpoint | Undo button — Esc+Esc or /rewind |
Optimal workflow:
/rename 'task-name'→ work →/clear→ new task Fixed the same issue twice? →/clearand rewrite the prompt.
2. Model & Mode
Picking the right model saves 40–80% on cost.
| Command | What it does | When to use |
|---|---|---|
/model | Switch model mid-conversation | Context stays intact — e.g. /model claude-sonnet-4-6 |
/effort | Set thinking level: low / medium / high | Persistent for the session — /effort high → /effort medium to reset |
/fast | Faster replies, fewer tokens | Brainstorming, simple questions |
/plan | Plan before coding | Approve the plan, then execute — Shift+Tab toggle in VS Code |
| Model | Best for | Cost |
|---|---|---|
| Haiku 4.5 | Brainstorm, sub-agents | Cheapest |
| Sonnet 4.6 | Daily coding, 90% of tasks | $3/MTok |
| Opus 4.6 | Architecture, complex problems | $5/MTok |
Thinking depth:
think → 4K tokens → design patterns
think hard → 10K tokens → DB migration
ultrathink → 31K tokens → architecture
⚠ CLI only — does not work on the web
3. Context & Cost
| Command | What it does | Notes |
|---|---|---|
/cost | View cost for current session | Total, duration, tokens — e.g. Total cost: $0.55 |
/stats | Detailed usage stats | Cache hits, model used |
/context | See how much context window is used | Like a fuel gauge — /compact when > 60% |
@file.ts | Reference a specific file in your prompt | Autocompletes with @ |
@file#5-20 | Reference specific lines | Saves context — e.g. @utils.py#47-55 fix this function |
Real token savings:
CLAUDE.mdunder 200 lines → -62% startup tokensnode_modules/in.gitignore→ -30–40% context/clearbetween tasks → -50–80% tokens- Skills cache → -95–98% on repeated workflows
4. Keyboard Shortcuts (VS Code)
| Shortcut | What it does | Tip |
|---|---|---|
Ctrl+I | Inline edit selected code | Select code → Ctrl+I → describe the change |
Ctrl+Shift+C | Toggle sidebar chat | Most used shortcut daily |
Ctrl+Enter | Send message | Instead of clicking Send |
Ctrl+Shift+N | Open new chat | Clean context for a new task |
Ctrl+R | Search prompt history | Fuzzy search — type a few keywords |
Ctrl+G | Open plan in text editor | Plan Mode → Ctrl+G → edit → save |
Plan Mode workflow:
Shift+Tab→ Plan Mode → Claude generates plan →Ctrl+Gto edit →Shift+Tab→ Implement
5. Quick Prefixes
| Prefix | What it does | Example |
|---|---|---|
! | Run bash without Claude’s approval | !git status · !npm install |
# | Save directly to CLAUDE.md memory | # Always use snake_case for DB columns |
@ | Autocomplete file path | Look at @src/auth/middleware.ts |
/btw | Ask a side question without polluting context | /btw what's the diff between access_token and refresh_token? |
ultrathink | 31K tokens for complex problems | ultrathink about this architecture |
When to use what:
!→ quick bash, safe operations@→ reference files in your project#→ conventions and rules to remember long-term/btw→ side questions unrelated to current taskultrathink→ architecture, complex debugging
6. CLI Pipes & Flags
# Run a single prompt and exit (no interactive session)
claude -p "Explain this project" --output-format json
# Continue a named session
claude --resume
# Specify a model on startup
claude --model claude-opus-4-6
# Pipe git log for analysis
git log --oneline -20 | claude -p "summarize for standup"
# Pipe a file for review
cat error.log | claude -p "find the root cause"
In CI/CD:
claude -p "Review PR for security" --output-format json
git diff | claude -p "flag issues" # Pre-commit hook
claude -p "check for regressions" # Nightly review
7. Workflow Combos
Plan → Code
Shift+Tab (Plan Mode) → Claude generates plan → Ctrl+G to edit → Shift+Tab (implement)
Save & resume a complex task
/rename 'oauth-migration' → work → exit terminal → claude --resume → pick 'oauth-migration'
Optimize cost per task
/fast → brainstorm → /model sonnet → implement → /model opus → architecture → /clear between tasks
Free up context in a long session
/context → check % used → over 60%? → /compact focus on X → continue without losing important context
Debug loop (when Claude goes off track)
Claude does something wrong → /rewind → same issue twice? → /clear → rewrite with a more detailed prompt
Pro Tips
Two-Correction Rule — Fix the same issue max 2 times. On the 3rd attempt → /clear and rewrite the prompt with more detail.
CLAUDE.md — Claude reads this every session. Keep it under 200 lines. Structure: ## Tech Stack ## Commands ## Rules ## Avoid.
Hooks > Memory — Use hooks for mandatory rules. They run every time without reminders. Example: PostToolUse → eslint --fix {{file}}.
Turn good prompts into Skills — Write once, trigger automatically. Type publish blog → skill runs automatically.
Search old sessions — grep -r "ultrathink" ~/.claude/projects/
Power User Checklist
-
CLAUDE.mdin every project -
/compactbefore 60% context - 3+ custom skill files
-
--resumeinstead of re-explaining context - 1 hook for auto-formatting code
-
ultrathinkfor architecture decisions -
/costcheck daily -
/clearbetween tasks