Try free

Last updated 13 October 2026

Using slash commands in Claude Code

Managing session context in the terminal

Terminal based coding agents often start to slow down or provide less accurate answers after several long exchanges. This happens because the context window fills up with previous file contents, bash outputs, and previous thoughts. You can solve this immediately by using the /compact command. This command asks the agent to create a summary of the conversation history so far. This summary replaces the detailed logs of previous messages, which frees up substantial space in the context window for new tasks. It is a vital tool for long development sessions where you need to maintain progress without hitting token limits.

If a session has become too cluttered or you want to pivot to a completely different task within the same repository, you should use the /clear command. This wipes the current conversation history while keeping you inside the same folder and session environment. It is much faster than quitting the terminal and restarting the agent. It ensures the agent starts with a clean slate and does not carry over any irrelevant context or incorrect assumptions from the previous task. This helps you maintain high precision when moving from a debugging phase to a feature implementation phase.

Controlling permission modes and tool access

Security and speed are often at odds when working with an autonomous agent. You can manage this balance by cycling through permission modes using the Shift-Tab shortcut. The default mode requires you to approve every action the agent takes. If you are working on a trusted local project and want to move faster, you can switch to the acceptEdits mode. This allows the agent to modify files using the Edit or Write tools without stopping for your permission on every single line of code. For high risk operations where you only want to see a proposal, the plan mode restricts the agent to only reading files and describing its intentions.

You can view your current settings at any time by typing the /permissions command. This shows you which tools are currently authorized and which ones require a manual check. If you need to change these rules permanently, you should edit the .claude/settings.json file in your project root. You can specify different permission levels for specific tools like Bash or WebSearch. For personal overrides that you do not want to commit to a shared repository, use the .claude/settings.local.json file. This allows you to have a bypassPermissions workflow on your local machine while your team maintains more restrictive defaults.

Standardizing project instructions with project files

Instead of typing the same setup instructions every time you start a session, you can use the CLAUDE.md file. This file sits in your repository root and acts as the primary source of truth for the agent. It should contain your build commands, test patterns, and specific code style requirements. The agent reads this file automatically at the start of every session. This ensures that every piece of code the agent writes follows your project standards without you having to remind it. You can also place a CLAUDE.md file in any subdirectory to provide specific context for that part of the codebase.

If you have personal preferences that apply to every project you work on, you can use the global instructions file located at ~/.claude/CLAUDE.md. This is the best place to put your general coding philosophy or preferred libraries. If you always want your agent to use a specific framework or follow a certain naming convention, putting it here saves you from repeating yourself in every new repository. The agent combines these global instructions with the local project files to build a complete understanding of how you want it to behave.

Monitoring resource usage and status

Keeping track of the cost and complexity of your agent sessions is necessary for professional development. You can use the /cost command to see the financial expense of the current session in real time. This includes the tokens consumed by the files the agent has read using the Read or Glob tools. If you need to see your overall activity over a longer period, the /usage command provides a summary of your total resource consumption. These tools help you decide when it is time to use /compact or /clear to manage your budget effectively.

The /status command provides a snapshot of what the agent is doing at any given moment. It shows you the current state of the conversation and whether any tools are currently running or waiting for input. This is particularly useful when you have the agent performing long running tasks using the Bash or Task tools. It helps you understand if the agent is stuck or if it is simply processing a large amount of data. If you ever feel the agent is taking a wrong turn, you can press the Escape key once to interrupt its current action.

Optimizing workflows for multiple projects

Managing multiple development streams often leads to a cluttered terminal history. You can use the claude --resume command to see a list of your previous sessions and pick up exactly where you left off. This is useful for returning to a bug fix after a meeting or a break. However, navigating a text list can become difficult when you are handling many concurrent projects. This is an area where adhdTerminal provides a concrete advantage. adhdTerminal is a native app for macOS and Windows, made by MINDBALANCER OU in Estonia, and it is not affiliated with Anthropic.

The app runs many Claude Code sessions side by side as tiles on a wall. Each tile has a colour, a number and a name. It shows whether it is working, waiting for you, done or idle. It also shows the last exchanges of its conversation. Tiles reopen in the same place after a restart and resume the same session automatically. A free iPhone app mirrors the wall over an end to end encrypted link and can answer a prompt or send the next task. It costs 99 dollars once, and one key runs one computer at a time. This layout helps you see the status of every active project at once without searching through terminal history.

Extending functionality with custom commands and agents

You can create your own slash commands to automate repetitive tasks. These are defined as markdown files inside the .claude/commands directory. For example, you could create a command that runs your linting suite and formats the code. When you type that command name in a session, the agent follows the instructions in the markdown file. This allows you to build a library of project-specific shortcuts that any developer on your team can use. It significantly reduces the amount of manual prompting required for standard maintenance tasks.

For even more complex workflows, you can use subagents. These are defined in the .claude/agents directory. You can invoke them using the /agents command. Subagents are useful for breaking down a large project into specialized roles. One subagent might be configured to only handle documentation while another focuses on database architecture. You can also use /hooks to trigger specific actions at events like SessionStart or PostToolUse. This level of customization allows you to build a development environment that acts as a cohesive team rather than a single assistant.

Configuring the terminal and editor integration

The agent needs to know how to interact with your specific development environment. You can use the /terminal-setup command to configure how it handles shell interactions and command execution. If you have a preferred text editor, the /ide or /vim commands will adjust the agent's behavior to match your tools. This ensures that when the agent suggests an edit or opens a file, it does so in a way that fits your existing workflow. You can also use Ctrl-R within the terminal to search through your shell history, which is useful for repeating commands the agent has previously suggested.

If you need to share the results of a session or archive it for documentation, use the /export command. This generates a full transcript of the conversation that you can save to a file. It is a great way to keep a record of how a complex problem was solved. If you find that the agent is not behaving as expected, the /doctor command or the claude doctor command will check your installation for issues. It looks for problems with your configuration, network connection, or API keys to ensure everything is running correctly.

Maintaining and updating the agent environment

Keeping your tools updated ensures you have the latest tool definitions and performance improvements. You can run the claude update command to pull the latest version of the agent. This is a simple way to stay current with the latest capabilities and bug fixes. If you need to manage your access levels or change accounts, the /login and /logout commands handle your authentication state. These commands are essential for managing your connection to the backend services that power the agent's logic.

Finally, the /help command is your most important resource for exploring available features. It provides a comprehensive list of every slash command and tool available in your current version. If you ever forget how to use a specific feature like MCP server management or memory controls, /help will provide the exact syntax you need. It serves as an on-demand manual that helps you master the terminal interface without leaving your development flow. Use it whenever you are unsure about the best way to prompt the agent for a specific outcome.

Questions people ask

How can I return to a previous point in a conversation?

You can press the Escape key twice to see a list of earlier messages in the current session. This allows you to select a specific point in the history and branch off from there. It is the fastest way to recover if the agent makes a mistake or if you want to try a different approach to a problem.

Where are the global settings for Claude Code stored?

Global settings are stored in your home directory at ~/.claude/settings.json. This file allows you to set default permissions and configurations that apply to every project you work on. You can use it to define which tools are allowed to run by default across your entire system.

How do I manage external MCP servers?

You can manage MCP servers by using the claude mcp command from your shell or the /mcp command inside an active session. These servers are configured in the .mcp.json file. This allows the agent to connect to external data sources or specialized tools that are not part of the standard built-in set.

Read next

More on claude code basics·All posts