On this page
  1. Commands for setting up a project
  2. Commands for managing context and sessions
  3. Commands for extensions
  4. Commands for reviewing and shipping
  5. How does /goal decide when you’re done?
  6. How does /loop work?
  7. Which scheduler should you use?
  8. How do you make your own commands?
  9. Tips for using commands
  10. Summary
  11. References

Slash commands control Claude Code from inside a session: type / at the start of a message to see them. There are four kinds: built-in commands such as /init, /context, /compact, /rewind and /permissions; bundled skills such as /code-review, /verify and /loop; your own skills; and prompts from connected MCP servers. A handful cover most of a working day, and two of them, /goal and /loop, change how long Claude can work without you.

The descriptions below follow the official commands reference, grouped by the job you’re doing rather than alphabetically, with the long-running commands explained in depth at the end.

Map of Claude Code slash commands grouped by job: set up, manage context, extend, review and ship, and long-running work
The commands worth learning, grouped by what you're trying to do.

Commands for setting up a project

CommandWhat it does
/initCreates a CLAUDE.md guide for the project
/memoryEdits CLAUDE.md files, toggles auto memory and shows its entries
/permissionsManages allow, ask and deny rules for tools
/model, /effortSwitches the model and its effort level
/configOpens settings, or sets one with key=value
/statuslineConfigures the status line, for example to show context usage
/terminal-setupInstalls a Shift+Enter shortcut for new lines in supported terminals
/install-github-appSets up the Claude GitHub App and GitHub Actions workflows

Commands for managing context and sessions

CommandWhat it does
/contextShows context usage as a coloured grid, with suggestions
/compact [instructions]Summarises the conversation to free space, optionally with a focus
/clearStarts a new conversation with empty context (and clears any active goal)
/btw [question]Asks a side question without adding it to the conversation
/rewindRestores conversation and code to an earlier point (also /checkpoint, /undo)
/resume, /rename, /branchReopens a past session, names the current one, or forks it into a new session
/exportExports the conversation as plain text
/usageShows session cost, plan usage limits and activity (also /cost)

Commands for extensions

CommandWhat it does
/plugin, /reload-pluginsBrowses, installs and toggles plugins; applies plugin changes without restarting
/reload-skillsPicks up a skills folder created after the session started
/mcpManages MCP server connections and logins
/hooksShows configured hooks by event
/agents, /subtaskManages subagents; starts a fork that inherits the conversation
/add-dirAdds another working directory to the session
/sandboxToggles sandbox mode where supported

Commands for reviewing and shipping

CommandWhat it does
/code-reviewReviews the current diff, a PR, a branch or a path for correctness; options include an effort level, --fix and --comment
/security-reviewAnalyses your branch’s changes for vulnerabilities such as injection and auth issues
/simplifyReviews changed code for clean-up and applies fixes, with four review agents in parallel
/verifyBuilds and runs your app to confirm a change actually works
/batchSplits a large change into 5 to 30 units and runs them in parallel
/debugTurns on debug logging and troubleshoots from the session log
/doctorChecks your installation, settings, extensions and CLAUDE.md, and proposes fixes

How does /goal decide when you’re done?

/goal sets a completion condition, and Claude keeps working turn after turn without you prompting each step. Under the hood it is a session-scoped, prompt-based Stop hook: after every turn, Claude Code sends the condition and the conversation to a small fast model, which returns one of three verdicts with a short reason.

  • Not yet met: Claude starts another turn and uses the reason as guidance.
  • Met: the goal clears and an achieved entry is recorded.
  • Impossible: the goal clears with the reason recorded, so you don’t loop forever.
/goal all tests in test/auth pass and the lint step is clean
/goal                 # status: condition, run time, turns, tokens, last reason
/goal clear           # also: stop, off, reset, none, cancel

The evaluator doesn’t run commands or read files itself; it judges only what Claude has shown in the conversation. So write conditions Claude’s own output can prove: one measurable end state, a stated check such as “npm test exits 0″, and any constraints, such as “no other test file is modified”. Conditions can be up to 4,000 characters, and a clause like “or stop after 20 turns” bounds the run. A goal also clears on errors you have to fix, such as a failed login, an exhausted credit balance or a context overflow compaction couldn’t clear.

/goal doesn’t change your permission mode. In Manual mode Claude still asks before tools you haven’t allowed, so long unattended goals pair with auto mode: auto mode removes per-tool prompts and /goal removes per-turn prompts. It works with claude -p too, running the whole loop in one invocation.

How does /loop work?

/loop re-runs a prompt on a schedule while the session is open. What you pass decides how it behaves:

You typeWhat happens
/loop 5m check the deployRuns on a fixed interval; units are s, m, h and d, rounded to whole-minute cron steps
/loop check whether CI passedClaude picks the delay after each run, between one minute and one hour, based on what it saw
/loopRuns a built-in maintenance prompt: continue unfinished work, tend the branch’s pull request, then clean-up passes

Details worth knowing:

  • Your own default prompt: a .claude/loop.md (or ~/.claude/loop.md) replaces the maintenance prompt for a bare /loop; content past 25,000 bytes is truncated.
  • Limits: recurring tasks expire seven days after creation, and a session holds up to 50 scheduled tasks.
  • Timing: tasks fire between your turns, never mid-response, and recurring tasks are deliberately shifted by a small delay so many sessions don’t hit the API at once.
  • Skills in loops: /loop 20m /review-pr 1234 re-runs a skill, but only one Claude may invoke itself; skills with disable-model-invocation: true arrive as plain text.
  • Stopping: press Esc to cancel a self-paced loop, or ask Claude to cancel a fixed one.

Which scheduler should you use?

Cloud routines (/schedule)Desktop scheduled tasks/loop
Runs onAnthropic’s cloudYour machineYour machine
Needs your machine onNoYesYes
Needs an open sessionNoNoYes
Access to local filesNo, a fresh cloneYesYes
Minimum interval1 hour1 minute1 minute

Use cloud routines for work that must run reliably without your computer, desktop tasks when you need local files and tools, and /loop for quick polling during a session. For CI-driven schedules, GitHub Actions is the fourth option.

How do you make your own commands?

Any skill is a command: a folder with a SKILL.md in .claude/skills/ becomes /folder-name, and a plugin’s skills appear as /plugin-name:skill-name. The older single-file format in .claude/commands/ still works. Our guide to Claude Code skills covers arguments, injected command output, pre-approved tools and who may run a skill.

Tips for using commands

  • Commands queue: if you send one while Claude is responding, it runs after the turn finishes. A few, such as /status, /tasks and /usage, run immediately.
  • Chain skills: up to six skills at the start of one message, with the rest of the text passed to each.
  • Use /compact with a focus: /compact Focus on the API changes keeps what matters when you summarise.
  • Put the commands you always run in CLAUDE.md, so Claude knows them too; see our CLAUDE.md guide.

Custom commands are skills now, so our free Claude Code skill generator builds them too: fill in the name, description and steps, and copy the SKILL.md it writes.

Summary

Learn a small core first: /init, /context, /compact, /clear, /rewind, /permissions, /plugin and /code-review. When you start leaving Claude to work, use /goal with a condition its output can prove, /loop for polling inside a session and cloud routines for anything that must run without you. For the hook that powers /goal, see our guide to Claude Code hooks.

References