• Coding agents
  • Getting started

The Slash Commands I Use in Claude Code and Codex

By

Published

Summary

The slash commands I use most in Claude Code and Codex, side by side: start a fresh conversation, shorten a long one, change the model, resume earlier work and reconnect a service. The one to learn first is /clear, and there is a prompt here that saves a handoff note before you use it.

You type a slash command into a coding agent's message box to control the tool itself, where a normal message asks the agent to do some work. I use both Claude Code and Codex, so the tables below give the command for each. Most have the same name. Where only one tool has a command for the job, the other column says so, and the last column explains what to do instead.

The commands I use most

Two terms appear in this table. The context window is everything the agent can see at once: your messages, its replies, the files it has read and the output of every command it has run. An MCP server connects the agent to an outside tool or source of data.

The slash commands I use most
What it’s forClaude CodeCodexGood to know
Start a new conversation/clear/clear/newEmpties the context window. The old conversation is saved and comes back with /resume. Codex’s /clear also wipes the terminal view; /new leaves it on screen.
Shorten the history and keep going/compact/compactReplaces the conversation so far with a summary. Use it in the middle of one task; use /clear for a new task. Claude Code accepts instructions on what the summary should keep.
Ask a side question while the agent works/btw/side/btwClaude Code gives one answer from what is already in the conversation, without reading files or running commands. Codex opens a separate side chat and returns you to the main one afterwards.
Change the model/model/modelThe most capable model for planning, architecture and hard bugs; a smaller, faster one for routine edits and simple questions.
Change how much the model reasons/effortClaude Code onlyLevels run from low to max. Codex has no separate command: you choose the reasoning effort inside its /model picker.
Keep working until a goal is met/goal/goalThe agent keeps taking turns until the goal is met. Write a goal that can be checked, such as a passing test command. /goal clear stops it; Codex also has /goal pause and /goal resume.
Carry on from your phone/remote-control/rcClaude Code onlyOpens the current session in the Claude app and at claude.ai. Your computer stays on with the terminal open, and you need a Claude subscription sign-in. In Codex you set this up in the ChatGPT desktop app under Settings, Connections, then use Remote in the mobile app.
Resume an earlier conversation/resume/resumeOpens the list of saved conversations. From the terminal: claude --continue or codex resume --last for the most recent one.
Name a session/rename/renameMakes a session easy to find in the resume list, which matters most when several are running at once.
Check or reconnect MCP servers/mcp/mcpClaude Code lists servers, handles sign-in and reconnects one with /mcp reconnect name. Codex only lists them; add a server or sign in from the terminal with codex mcp add and codex mcp login.
Copy the conversation to try something else/branch/fork/forkThe original stays untouched. In Claude Code, /branch moves you into the copy, while /fork runs the copy as a background session and leaves you where you are. Codex’s /fork clones the chat into a new one.

Others worth knowing

Other slash commands worth knowing
What it’s forClaude CodeCodexGood to know
See how full the context is/context/statusHelps you decide when to compact or clear. Codex’s version also shows the model, permissions and token usage.
Go back to an earlier point/rewindClaude Code onlyRestores the conversation, the code or both to an earlier message; pressing Esc twice opens the same menu. In Codex, Esc twice lets you edit your previous message and continue in a new chat, but it does not put files back. Use Git for that.
Plan before changing anything/plan/planThe agent reads and proposes a plan without editing files. Correcting a plan is much cheaper than correcting code.
Review the changes/code-review/reviewChecks the current changes for bugs before you commit. A clean review is useful evidence, but it does not prove the feature works.
Set what the agent may do without asking/permissions/permissionsCheck this before setting a goal or leaving a session running while you are away.
Check your usage/usage/status/usageShows how much of your plan’s allowance you have used. In Codex, the first covers the session and the second the account.
Create the project instructions file/init/initDrafts CLAUDE.md in Claude Code and AGENTS.md in Codex by looking at the project. Edit the result down to the rules you actually need.
List your skills/skills/skillsCall a skill by name with /skill-name in Claude Code or $skill-name in Codex.

Both tools add and rename commands often, so if one of these is missing, type / on its own in either tool to see the list your version supports.

Before you clear, write a handoff

/clear is the command I would learn first. A long session fills the context window with material that has nothing to do with your next task, and the agent's work gets worse as that builds up.

I clear between unrelated tasks. I also clear when I have corrected the agent more than twice on the same problem, because by then the conversation is full of failed attempts. A fresh conversation with a better prompt usually does better than another correction.

The new conversation knows nothing about the old one, so before I clear I ask the agent to write a handoff note into the project. The next conversation reads the note and carries on from there. I use this prompt:

Write a handoff before clearing

Before I clear this conversation, write a handoff note for the next session. Save it as docs/handoffs/YYYY-MM-DD-short-topic.md using today's date, and create the folder if it does not exist.

Write it for an agent that has seen none of this conversation. Include:
1. Goal: what we are trying to achieve and why.
2. Current state: what is finished, what is partly done, and whether there are changes that have not been committed.
3. Files: the files you changed or that matter most, each with one line on why.
4. Decisions: what we decided and the reason, including options we rejected.
5. If we were debugging: the exact symptom and how to reproduce it, every fix you tried and what happened, what you have ruled out, and your current best guess.
6. Checks: the commands you ran, which passed and which failed. Say plainly if something was not checked.
7. Next steps, in order, and any open questions for me.

Only include facts from this conversation and the project files. Do not guess. When you finish, tell me the file path and stop.

Paste this into your project conversation.

The list of fixes already tried is the part that matters most when debugging. Without it, a fresh agent often repeats the first fix the previous one attempted.

Commit your work before clearing, so the handoff note and the code it describes are saved together.

After clearing, my first message is: “Read docs/handoffs/ and open the most recent note, then tell me what you understand before changing anything.” The reply shows me whether the note was good enough.

Once the work is finished, delete or archive the handoff note, so an old note is never mistaken for the current state.

Turn a process you repeat into a skill

An agent skill is a saved set of instructions for a particular kind of task, such as writing a release note or checking a page on a phone-sized screen. When I notice I have explained the same process twice, I ask the agent to turn it into a skill. Each tool guards its own skills folder, so expect it to ask your permission before writing there, or to tell you it isn't allowed to.

Once the skill exists, the agent can pick it itself when your request matches its description, or you can call it by name: /skill-name in Claude Code, $skill-name in Codex.

To see one made step by step, Part 10 of Getting Started with Coding Agents turns a saved routine into a skill in both tools.

Ahmed Gadir

About the author

Ahmed Gadir

I’m a senior software engineer and the founder of GadirLabs. I’ve been building software since 2018, from enterprise React platforms to my own apps. I enjoy understanding how things work. I help founders turn AI-built prototypes into products ready for real users.

More about Ahmed