C.W.K.
Stream
Lesson 05 of 13 · published

Slash Commands & /init, /compact, /cost, /effort

~14 min · slash-commands, compact, cost, effort, model

Level 0🌱 Novice
0 XP0/70 lessons0/11 achievements
0/120 XP to next level120 XP to go0% complete

Built-in commands you'll actually use

Slash commands are deterministic — they execute fixed logic, not AI prompts. The dozen or so built-ins cover the moments when you don't want the model interpreting you.

The ones that pay rent every session: /compact when context gets large (summarizes history, frees tokens), /cost to see real-time spend, /effort low|medium|high|max to dial reasoning depth, /model to switch mid-session, /permissions to inspect rules, /init for project bootstrap. /help dumps the full list any time.

Custom slash commands live in .claude/commands/name.md — write a markdown file, get a /name. $ARGUMENTS in the body is replaced with whatever you typed after the command name. Two minutes to set up, you stop retyping the same review prompt.

Code

Six commands worth memorizing·bash
# Inside any Claude Code session:

/compact       # squeeze conversation history, save tokens
/cost          # show session $$$ spent and cache savings
/effort high   # dial up reasoning for the next message
/model opus    # switch model mid-session
/permissions   # inspect / edit allow-ask-deny rules
/init          # generate a CLAUDE.md from project state
/help          # full list with descriptions
A custom /review command·markdown
# .claude/commands/review.md
Review the file at $ARGUMENTS for:

1. Logic bugs and edge cases
2. Security issues (SQL injection, XSS, auth bypass)
3. Performance concerns (N+1 queries, blocking I/O)
4. Style violations against our CLAUDE.md standards

Output a prioritized list with severity (HIGH/MEDIUM/LOW)
and file:line references.

External links

Exercise

Write a custom slash command for a task you do every day (review a diff, summarize a log, generate a commit message). Save it to .claude/commands/, run it on real input, iterate the prompt twice. Commit when it's worth keeping.

Progress

Progress is local-only — sign in to sync across devices.
Spotted a bug or have feedback on this page?Report an Issue

Comments 0

🔔 Reply notifications (sign in)
Sign inPlease sign in to comment.

No comments yet — be the first.