Claude Code: Slash Commands That Changed How I Build

The slash commands you actually need — and the workflows that make AI-assisted coding feel like a superpower

Sai Teja
Sai Teja Punyapu July 8, 2026

I've tried most AI coding tools out there. Claude Code stuck — not because the model is smarter (though it often is), but because of slash commands. They give you precise control over context, mode, and behavior without leaving the terminal. Once you learn them, going back to a plain chat window feels like coding without keyboard shortcuts.

This is the guide I wish I had on day one: every slash command that matters, when to use it, and the workflows that actually save time.

What Are Slash Commands?

In Claude Code, anything starting with / is a slash command — a built-in instruction that changes how the session behaves. Unlike typing a natural language request, slash commands are deterministic: they do exactly one thing, every time.

Why Slash Commands Matter

  • Predictable — same input, same behavior
  • Fast — no need to explain what you want in prose
  • Context-aware — many commands operate on your codebase directly
  • Composable — chain them into repeatable workflows

Essential Built-In Commands

/help

Lists all available slash commands and custom commands in your project. Run this first in any new session. Claude Code evolves quickly — /help is always the source of truth.

/clear

Wipes the conversation history and starts fresh. Use this when:

  • You're switching to a completely different task
  • The conversation has gone off-track and context is polluted
  • You want to reduce token usage mid-session

Pro tip: Don't clear mid-debug. The model often needs the error history to fix the issue. Clear only after the task is done or abandoned.

/compact

This is the command I use most. It summarizes the conversation history into a condensed form, freeing up context window space while preserving key decisions and code changes.

Use /compact when:

  • You've been working on a large feature and the context is getting full
  • The model starts "forgetting" earlier decisions
  • You want to continue the same task but need breathing room

/clear vs. /compact: /clear deletes everything. /compact keeps the essence. If you're mid-feature, always prefer /compact.

/model

Switches the underlying model (e.g., between Sonnet and Opus variants). Use Opus for complex architectural decisions and Sonnet for faster iteration on smaller tasks. Switching mid-session lets you optimize cost vs. capability.

/cost

Shows token usage and estimated cost for the current session. Run this periodically on long sessions — agentic loops can burn through tokens fast if you're not watching.

/memory

Manages Claude Code's persistent memory — facts about your project, preferences, and conventions that carry across sessions. This is how you teach Claude Code things like "we use tabs not spaces" or "always run tests before committing."

/init

Generates a CLAUDE.md file for your project — a context document that Claude Code reads at the start of every session. It captures project structure, conventions, and key commands. Run /init once when onboarding a new repo.

Example CLAUDE.md snippet

# Project: saitejapunyapu.com
- Static site hosted on Netlify
- No build step — edit HTML/CSS/JS directly
- Jarvis chatbot uses netlify/functions/jarvis.js
- Always update sitemap.xml when adding pages

/review

Asks Claude to review your recent changes like a code reviewer — checking for bugs, style issues, and missed edge cases. I run /review before every commit on non-trivial changes.

/diff

Shows the git diff of your current changes. Useful when you've lost track of what Claude modified and want a quick audit before committing.

File and Code Commands

/add & /remove

Explicitly add or remove files from Claude's context. By default, Claude Code is smart about what it reads, but sometimes you need to point it at a specific file:

  • /add src/api/handler.py — include this file in context
  • /remove node_modules/ — exclude a directory

/grep

Search the codebase for a pattern without leaving Claude Code. Faster than switching to another terminal when you're mid-conversation and need to find where something is defined.

Custom Slash Commands

This is where Claude Code gets really powerful. You can define your own commands in .claude/commands/ as markdown files. Each file becomes a /command-name you can invoke.

Example: .claude/commands/deploy-check.md

Check this project is ready to deploy:
1. Verify no console.log statements in production code
2. Check all meta tags use saitejapunyapu.com domain
3. Confirm sitemap.xml includes all pages
4. Run git status and summarize uncommitted changes

Now you type /deploy-check and Claude runs that checklist every time. This is how you turn repeated workflows into one-keystroke operations.

Custom Command Ideas That Work

  • /pr-summary — generate a pull request description from git diff
  • /seo-check — audit a page's meta tags, headings, and schema markup
  • /test-gen — generate unit tests for the currently focused file
  • /explain — explain the selected code block like you're a junior dev
  • /commit — stage changes and write a conventional commit message

Keep custom commands focused. A command that does 10 things is harder to debug than three commands that each do one thing well. Start with 2–3 commands for your most repeated workflows.

Workflows I Use Daily

The Feature Build Loop

  1. /init (first time only) — generate CLAUDE.md
  2. Describe the feature in natural language
  3. Let Claude implement
  4. /review — catch issues before I test
  5. Test manually, report bugs in natural language
  6. /compact — when context gets heavy
  7. /commit or manual git commit

The Debug Loop

  1. Paste the error message
  2. Claude investigates (don't /clear — it needs the error trail)
  3. /diff — verify the fix didn't break anything else
  4. /review — sanity check

The Content Update Loop

For my portfolio site, I have a custom /site-update command that reminds Claude to update index.html, sitemap.xml, and jarvis.js knowledge base whenever content changes. One command, three files, zero forgotten updates.

Tips for Getting the Most Out of Slash Commands

  • Learn 5 commands first: /help, /clear, /compact, /review, /init
  • Build custom commands for repeated tasks — if you do it more than twice, make it a slash command
  • Keep CLAUDE.md updated — it's the single highest-ROI file in any Claude Code project
  • Watch /cost on long sessions — compact early, clear when switching tasks
  • Don't over-command — natural language is still great for exploratory work; slash commands are for structured operations

The difference between someone who "tried Claude Code" and someone who ships with it daily comes down to slash commands. They're the keyboard shortcuts of AI-assisted development — invisible until you learn them, then impossible to live without.

Start Here

Open Claude Code in your current project. Run /help. Then /init. Then build one custom command for something you do every day. That's it — you'll feel the difference immediately.

Claude Code Slash Commands AI Coding Developer Tools

About Sai Teja Punyapu

Data Engineer Intern at Conifer Health Solutions and MS Business Analytics & AI student at UT Dallas. Building with AI tools daily and writing about what actually works.