MODULE 1 · GETTING STARTED / 20 MIN Free NOVEMBER 2026 EDITION · CLAUDE CODE 2.1.318
Sessions, slash commands and context
Use slash commands, resume earlier work, and manage the context window so long sessions stay sharp.
Updated 5 November 2026 · Reviewed 5 November 2026
What you’ll be able to do
Keep long working sessions focused, pick up where you left off, and know which built-in command to reach for.
Slash commands you’ll use constantly
Type / in a session to see the full list. The essentials:
| Command | What it does |
|---|---|
/help | Lists commands and shortcuts |
/clear | Starts a fresh conversation (project memory still loads) |
/compact [instructions] | Summarises the conversation to free up context |
/context | Shows what’s filling the context window, as a grid |
/rewind | Restores code and/or conversation from a checkpoint, or summarises part of the history |
/btw <question> | Asks a side question without adding it to the conversation |
/resume | Opens an earlier session (paste a PR URL to find the session that made it) |
/usage | Session cost, plan limits and what’s driving them (/cost is an alias) |
/model, /effort | Switch model, or how hard it thinks (Module 4) |
/init | Generates a CLAUDE.md for the project (Module 2) |
/permissions | Shows and edits allow/ask/deny rules |
/doctor | Checks your setup and offers fixes |
/powerup | Short interactive lessons on Claude Code features |
What “context” means and why you manage it
Everything in the conversation is in the model’s context window: your messages, files it read, command output and its own replies. The window is large but not infinite, and it fills faster than you’d expect when Claude reads big files or long test logs.
Rules of thumb:
- One task per conversation. Finished?
/clear. - Long task still going?
/compactwith a hint about what to keep, for example/compact keep the decisions about the database schema. - Unsure?
/contextshows what’s using space. - Quick question that shouldn’t clutter the task? Use
/btw. - Long, noisy debugging stretch? Open the rewind menu and choose Summarize from here to compress just that part.
- Cleared by mistake? Right after
/clear, the rewind menu offers the previous session at the top of the list.
When the window fills up, Claude Code compacts automatically. Compacting yourself at a natural break point keeps more control over what survives.
Exercise: one session, three moves
In your loop-practice repo from the last lesson:
- Start
claudeand ask: “Add atruncate(text, max)helper with tests.” Let it finish. - Run
/contextand look at the breakdown. - Run
/compact keep a note of the helpers that exist and their tests. - Ask: “What helpers exist in this repo and how are they tested?” Check that the summary kept what matters.
- Run
/clear, then ask the same question. Notice that Claude now has to re-read the files, because the conversation memory is gone. - Exit with
/exit, then runclaude --continue. You’re back in the last conversation. - Ask a side question with
/btw what does node:test's describe() do?and notice it doesn’t become part of the task’s history.
Running a one-off from your shell
You don’t always need an interactive session. Print mode answers and exits:
claude -p "List the exported functions in this repo, one per line"
You can pipe into it, too:
git diff | claude -p "Write a one-line commit message for this diff"
This is the seed of automation, which we come back to in Module 8.
Verify it worked
- You used
/context,/compactand/clear, and can explain the difference - You resumed a session with
claude --continue - You got an answer from
claude -pwithout entering a session
Next: using Claude Code from inside your editor.
Knowledge check
3 QUESTIONS · PASS MARK 80%Tip: select the text that's wrong before clicking, and it's quoted in your report.