Claude Code Commands Every Developer Wishes They Knew Earlier
- Posted on June 2, 2026
- AI Tools
- By MmantraTech
- 31 Views
The difference between average and power Claude Code users often comes down to slash commands. Discover all 16 commands, see them in action, and learn how they can transform the way you interact with Claude during software development.
Most developers stumble across Claude Code's slash commands by accident — finding /compact when Claude starts forgetting things, or discovering /agents buried deep in a help screen. There are commands worth knowing, and each one solves a specific, real problem you will hit during development.
This article walks through every major Claude Code slash command with plain English, a real-life analogy, a concrete scenario, and a terminal example you can try right now.
Table of contents
- /skills — Reusable workflow packs
- /context — Check your AI's working memory
- /compact — Compress and free space
- /clear — Start fresh
- /agents — Use specialist AI helpers
- /mcp — Connect external tools securely
- /memory — Save long-term project facts
- /permissions — Control what Claude can do
- /model — Switch AI models on demand
- /doctor — Run diagnostics
- /config — Open Claude settings
- /cost — Track usage and spending
- /init — Create your project rulebook
- /btw — Quick questions without polluting context
- /simplify — Automatic code cleanup
- /batch — Run independent tasks in parallel
- How these commands work together
- Conclusion
/skills — Reusable workflow packs
A skill in Claude Code is a saved, reusable set of instructions you can trigger by name. Instead of typing the same instructions over and over at the start of every session, you define them once as a skill and invoke them in seconds.
Analogy: A skill is like a saved recipe. You write it once, and anyone can cook the same dish perfectly every time without reading the full recipe again.
Real example
Imagine you write blog posts regularly and always need Claude to follow the same rules: use SEO-friendly headings, keep paragraphs under four sentences, include a meta description, and never add inline styles. Without skills, you paste those instructions every single session.
With a skill named blog-writer, you just type:
# List all available skills
/skills
# Invoke the blog-writer skill for this session
/skills use blog-writer
Claude immediately applies all the rules from that skill — no copying, no forgetting a step. Teams benefit the most from skills: everyone runs the same instructions with zero drift.
/context — Check your AI's working memory
Claude Code has a context window — a fixed amount of memory it can hold at one time. Every message you send, every file you share, and every response Claude gives takes up space in that window. When the window fills up, Claude starts losing earlier parts of the conversation.
Analogy: It is like asking an employee: "Show me the notes you are currently working from." The
/contextcommand tells you exactly how full that notebook is.
Real example
You have spent two hours on a project — designing a database schema, writing the login module, fixing a dashboard bug, and building a REST API. You run /context all to see the current state:
/context all
## Context Usage
Model: claude-sonnet-4-6
Tokens: 152k / 200k (76%)
Category Tokens Usage
──────────────────────────────────────────
System prompt 6.6k 3.3%
System tools 18.3k 9.1%
Memory files 2.3k 1.1%
Messages 124.8k 62.4%
──────────────────────────────────────────
Free space 48.0k 24.0%
Free space at 24% is a warning sign. If you continue without compressing, Claude will start dropping context from earlier in the session — exactly when you need it to remember the database schema decisions you made an hour ago. Time to run /compact.
/compact — Compress and free space
After a long session, your conversation is full of completed tasks, back-and-forth debugging, and resolved questions. Most of that detail is no longer needed — but it is still consuming space. /compact tells Claude to summarize everything into a concise record, keeping the important facts and discarding the noise.
Analogy: Cleaning your desk at the end of a work sprint — you keep the important documents and throw away sticky notes that no longer matter.
Real example
You have completed the login module and the dashboard. You no longer need the step-by-step debugging conversation — you just need Claude to remember that both features are done and what the final structure looks like. You run:
/compact
Claude creates a concise summary: "Login module completed with JWT auth, dashboard built with Chart.js, API endpoint at /api/dashboard/stats." Everything else is discarded. Context drops from 76% back to under 20%, and you have a clear runway for the next feature.
The key difference from /clear: /compact keeps a summary. /clear deletes everything. Always use /compact when you are still working on the same project.
/clear — Start fresh
When you finish one project completely and move on to something unrelated, use /clear to wipe the conversation and start a brand-new session. All prior context is removed immediately — no summary, no leftovers.
Analogy: Erasing the whiteboard before the next meeting starts. Nothing from the last session bleeds into the new one.
Real example
You spent the morning working on a Laravel e-commerce project. After lunch you need to switch to a Python data pipeline for a completely different client. Running /clear before you start ensures Claude is not trying to apply Laravel thinking to Python work.
/clear
Use /clear when switching between unrelated projects. Use /compact when continuing the same project across a long session. These two commands together give you complete control over what Claude holds in memory.
/agents — Use specialist AI helpers
/agents lets you create, manage, and switch between multiple AI agents — each configured for a specific role. Instead of one generalist handling everything, you build a small team of specialists.
Analogy: Hiring specialists instead of asking one person to design, code, test, and deploy. A backend developer, a tester, and a code reviewer each do their job without stepping on each other.
Real example
You are building a SaaS product. You set up three agents:
- Backend Agent — writes Laravel controllers, migrations, and API endpoints
- Tester Agent — generates PHPUnit test cases for everything the backend builds
- Reviewer Agent — audits finished code for security issues and optimization gaps
# List all active agents
/agents
# Create a new agent
/agents new backend-dev
Each agent has a focused scope and does not drift into tasks outside its role. When the backend agent finishes a feature, you hand it to the tester — exactly like a real development team.
/mcp — Connect external tools securely
MCP stands for Model Context Protocol — an open standard for connecting Claude Code to databases, APIs, and other external systems. The /mcp command manages these server connections.
Analogy: Giving an employee a secure keycard to access specific company systems — they can only enter the rooms they are authorised for.
Real example
With MCP configured, Claude can connect directly to your local MySQL database and inspect the schema, create GitHub pull requests from code it just wrote, or read Google Drive documents to gather requirements — all without you copying and pasting anything.
# List active MCP server connections
/mcp
# MCP servers you might see:
# github Connected
# mysql Connected
# google-drive Connected
MCP is what separates Claude Code from a simple chat assistant. With the right connections active, Claude participates in your real infrastructure — not just your conversations.
/memory — Save long-term project facts
Regular conversation context resets every session. /memory manages persistent memory — facts that survive across sessions and are automatically available at the start of every new conversation.
Analogy: A permanent notebook versus a temporary sticky note. Sticky notes disappear. The notebook is always there.
Real example
You are working on a Laravel project that uses PHP 8.3, follows PSR-12 standards, and connects to a MySQL database on port 3306. Without memory, you explain this every single session. With memory:
# View current memory entries
/memory
# Saved entries might look like:
# - Project: E-commerce SaaS
# - Stack: Laravel 12, PHP 8.3, MySQL 8.4
# - Standards: PSR-12, ESLint for JS
# - DB host: 127.0.0.1 port 3306
Every session starts with these facts loaded automatically. Claude never asks "what framework are you using?" again. For long-running projects, this alone saves hours of repeated context-setting across weeks of work.
/permissions — Control what Claude can do
By default, Claude Code asks before performing sensitive actions. /permissions lets you customize exactly what Claude can do automatically versus what requires your explicit approval first.
Analogy: Setting employee access levels in a company system — some doors open automatically, others always require manager approval.
Real example
On your local development machine you trust completely, you set file editing to Allow so Claude can edit code without asking every time. For terminal commands that touch the database, you keep it on Ask First. For anything related to git push, you set Ask First always — no accidental deployments.
# Open permissions panel
/permissions
# Example permission states:
# Edit files → Allow (auto-approved on local machine)
# Run terminal → Ask First
# Git push → Ask First
# External access → Deny
On production-adjacent systems or shared servers, keep everything on Ask First. On a local dev machine where you are iterating fast, Allow on file edits removes friction without adding risk.
/model — Switch AI models on demand
Different Claude models have different strengths and costs. /model lets you switch mid-session — so you can use the most powerful model when you need deep reasoning, and a faster, cheaper model when you just need a quick answer.
Analogy: Choosing between a junior developer, a senior developer, and a principal architect based on what the task actually needs. You would not book the principal architect to fix a typo.
Real example
You are designing a multi-tenant database architecture — a complex problem that benefits from deep reasoning. You switch to Opus. Once the architecture is decided and you are writing the boilerplate code, you switch back to Sonnet. For small tasks like renaming variables or formatting a JSON file, Haiku is fast and costs a fraction of Opus.
# Open model selector
/model
# Available models:
# claude-opus-4-8 Best reasoning — architecture, complex bugs
# claude-sonnet-4-6 Balanced — everyday coding, feature building
# claude-haiku-4-5 Fastest — simple lookups, formatting, rewrites
Matching the model to the task is one of the most practical ways to control API costs without sacrificing quality where it matters.
/doctor — Run diagnostics before anything else
When Claude Code behaves unexpectedly — an agent not responding, a tool failing silently, a command having no effect — run /doctor before spending time debugging manually.
Analogy: Taking your car to a mechanic for a full health check before a long trip. Better to find the problem in the garage than on the motorway.
Real example
You come back to Claude Code after a system update. Your MCP GitHub connection is not working — Claude can no longer create pull requests. Instead of digging through config files, you run:
/doctor
Claude Code Diagnostics
───────────────────────────────────
Installation OK
Memory system OK
MCP servers WARNING: github — connection timeout
Active agents OK
Configuration OK
Recommendation: Reconnect the github MCP server in /mcp settings.
Problem found in seconds. /doctor should always be your first step when something feels broken — it saves the guesswork.
/config — Open Claude Code settings
/config opens the main Claude Code settings panel where you can customize behaviour, preferences, and defaults for your environment.
Analogy: Opening the settings page on your phone — everything you need to adjust how the tool behaves is in one place.
Real example
You want to change the default model, adjust how Claude handles long responses, or set up environment-specific preferences for a new machine. Instead of editing config files by hand, you open the visual settings panel:
/config
Common settings you will find here include default model selection, response verbosity, auto-compact thresholds, and language preferences. Think of it as your personal Claude Code control panel.
/cost — Track usage and spending in real time
/cost shows a real-time breakdown of token consumption and estimated cost for the current session — input tokens, output tokens, session total, and weekly running total.
Analogy: Checking your electricity meter before the monthly bill arrives. You want to see it before you are surprised, not after.
Real example
You are near the end of a long coding session and want to know what the day's work cost before closing up. You run:
/cost
Session Usage
─────────────────────────────
Input tokens : 142,350
Output tokens : 18,720
Session cost : ~$0.42
─────────────────────────────
Weekly total : ~$3.18
For individual developers this is a curiosity check. For teams sharing an API key or managing client budgets, /cost is a practical monitoring tool. Running it at the end of each session builds a clear picture of your AI spend over time.
/init — Create your project rulebook
/init creates a CLAUDE.md file in the current directory — a permanent instruction file that Claude reads automatically at the start of every session in that project. It becomes Claude's rulebook for your codebase.
Analogy: Writing the employee handbook before the first day of work. Every developer, human or AI, works from the same rules from day one.
Real example
You start a new Laravel project. Before writing a single line of code, you run /init and fill in the generated CLAUDE.md with:
/init
Created: CLAUDE.md
Claude will read this file automatically at the start of every session in this directory.
Your CLAUDE.md might include entries like "Use Laravel 12 and PHP 8.3", "Always follow PSR-12 standards", "Never run database migrations on production without a confirmation step", and "The admin panel lives at /admin — never expose it without middleware." Claude reads all of this before writing a single line. No repeated instructions, no missed rules.
/btw — Quick questions without polluting context
When you have a side question unrelated to your current task, /btw creates a temporary thread that does not consume your main context window. You get the answer and the main conversation stays focused.
Analogy: Asking a quick question during a meeting without changing the main agenda. The meeting continues exactly where it left off.
Real example
You are deep in a Laravel feature build. Suddenly you wonder about the difference between Redis and Memcached for caching. Without /btw, asking that question adds hundreds of tokens of off-topic content to your main session. With /btw:
/btw What is the difference between Redis and Memcached for Laravel caching?
Claude answers the question in a side context. Your main Laravel build session is completely unaffected. The off-topic answer does not crowd out the work you actually care about.
/simplify — Automatic code cleanup
After fast-moving build sessions, code accumulates complexity — unnecessarily deep nesting, duplicated logic, verbose variable names, leftover debug comments. /simplify runs an automatic cleanup pass that reduces complexity and improves readability without changing functionality.
Analogy: Asking a professional editor to simplify a complicated document — the meaning stays the same, but the writing becomes cleaner and easier to understand.
Real example
You have just finished a complex feature under time pressure. The code works but it is messy — deeply nested conditionals, repeated database calls, and temporary variables that served their debugging purpose but are no longer needed. You run:
/simplify
Claude reviews the recent changes, identifies what can be reduced or combined, and presents a cleaner version for your review. This is especially useful before code review, before merging a PR, or at the end of a sprint when you want to leave the codebase in better shape than you found it.
/batch — Run independent tasks in parallel
When you have multiple unrelated tasks — build the login system, update the dashboard layout, write the API documentation — /batch splits them into independent streams and processes them in parallel instead of one after another.
Analogy: Assigning different jobs to different team members at the same time, rather than making everyone wait for each task to finish before the next one starts.
Real example
You have three independent features to build for a sprint: a user profile page, a notification system, and an export-to-CSV feature. None of them depend on each other. Instead of waiting for each one to complete before starting the next, you use /batch:
/batch
Task 1: Build user profile page with avatar upload
Task 2: Build notification system with read/unread status
Task 3: Build CSV export for the orders table
Claude works on all three simultaneously. Your sprint moves faster, and you review three completed features at once instead of reviewing one, waiting, reviewing the next, and so on.
How these commands work together in a real project
Understanding each command individually is useful. Seeing how they combine is what makes Claude Code genuinely powerful. Here is a real project workflow from start to finish:
- /init — Create CLAUDE.md with your stack, standards, and critical rules before writing any code
- /memory — Save project-specific facts that need to survive across sessions
- /agents — Set up a Backend agent, a Tester, and a Code Reviewer for your team structure
- /permissions — Set Allow on file edits for local dev, Ask First on terminal commands
- /mcp — Connect your GitHub and database MCP servers
- /context — Check available space before starting a large feature
- /compact — Compress the session after each major feature is complete
- /cost — Review usage at the end of each session
- /clear — Start fresh when switching to a completely unrelated project
Daily commands most developers actually use:
/context — see what Claude is remembering
/compact — free space when memory fills up
/cost — check session spend before closing
/clear — start fresh for the next project
/agents — delegate to specialists
/btw — quick side questions without interrupting flow
As your projects grow more complex, /mcp, /batch, /simplify, and /permissions become increasingly valuable. Start with the daily six and add the others as you need them.
Conclusion
Knowing your Claude Code slash commands is the difference between using an AI chat window and using a full development assistant. Each command solves a real problem: memory filling up, sessions getting confused, tasks taking longer than they should, or Claude not knowing your project's rules.
Start today with three commands: run /context all to see your current memory state, try /cost to see what today's session cost, and use /init if you have not already set up a CLAUDE.md for your main project. Those three will immediately change how you work. The rest will follow naturally.
Want to see how Claude Code holds up against other AI coding tools? Read the Claude Code vs Cursor IDE comparison for a deeper look at how the full tool stacks up in real development workflows.
Write a Response