Getting Started with Claude Code
Interactive Commands: How to Work with Claude Code Effectively
A practical guide to every Claude Code slash command, keyboard shortcut, and interaction pattern — what each one does and when to use it.
The Claude Code Interactive Interface
When you run claude in a project directory, you enter an interactive session. This is a persistent REPL where you issue natural language instructions, Claude Code takes actions, and you review results — all without leaving the terminal.
Understanding the command set makes the difference between an efficient workflow and a frustrating one.
Slash Commands
/help
Displays all available commands and a brief description of each.
/help/clear
Clears the conversation history and resets context. Use when:
- The conversation has become long and Claude is losing track of earlier context
- You've completed one task and are starting a different one
- Claude is making decisions that contradict your earlier instructions
/clearAfter clearing, Claude still has access to your files — it just loses the conversation history. Re-state any important constraints when starting a new thread.
/compact
Compresses the current conversation into a concise summary, preserving essential context while freeing up context window space. More useful than /clear when you want to continue the same task but have accumulated a lot of back-and-forth.
/compact/status
Shows the current state of Claude Code: model in use, context size, active working directory.
/status/add-file and /remove-file
Explicitly add or remove files from the active context. By default, Claude Code discovers files as needed. These commands let you pre-load specific files or reduce context by removing ones that are no longer relevant.
/add-file src/components/UserProfile.tsx
/remove-file src/legacy/OldAuth.ts/memory
Displays and edits Claude Code's persistent memory — information stored across sessions. You can add project notes, coding preferences, or reminders that persist between invocations.
/memory/init
Generates a CLAUDE.md file for the current project by analyzing the codebase. If you don't have a CLAUDE.md yet, this is the fastest way to create one.
/initReview the generated file carefully and adjust it to match your actual conventions.
Keyboard Shortcuts
| Shortcut | Action |
|---|---|
| Ctrl+C | Cancel current operation |
| Ctrl+D | Exit Claude Code |
| Up arrow | Navigate to previous prompt |
| Tab | Autocomplete file paths in prompts |
| Shift+Enter | Multi-line input (start a new line without submitting) |
Permission Prompts
When Claude Code wants to run a shell command, modify a file, or take any irreversible action, it presents a permission prompt:
Claude wants to run: npm test
[y]es / [n]o / [a]lways (for this command) / [s]kipy — Allow this one instance.
n — Deny. Claude will try an alternative approach.
a — Always allow this specific command for the rest of the session.
s — Skip this step entirely without a replacement.
The permission system is your primary safety control. Use it actively, especially for write operations and shell commands in unfamiliar projects.
Working Modes
Interactive Mode (Default)
claudeOpens a persistent REPL. You converse with Claude Code over multiple turns. Best for exploratory work, debugging, and multi-step tasks.
One-Shot Mode
claude -p "Add a loading spinner to the LoginButton component"Executes one task and exits. Best for well-defined, single-step changes you want to script or automate.
Continue Mode
claude --continueResumes the most recent conversation, preserving history. Useful when you closed a session and want to pick up exactly where you left off.
Resume Mode
claude --resumeLists recent sessions and lets you select which one to resume. Useful when you have multiple active projects with separate conversation threads.
Effective Prompting in Claude Code
Unlike chat AI where formatting is optional, Claude Code prompts benefit from specificity about scope:
Too vague:
Fix the authMore effective:
The login form in src/pages/auth/LoginPage.tsx submits but doesn't
redirect to /dashboard after successful auth. The auth state updates
(I can see it in React DevTools) but useNavigate doesn't fire.
Look at LoginPage.tsx, AuthContext.tsx, and the router config
in App.tsx. Find the cause and fix it.The more specific your problem description, file locations, and expected vs. actual behavior, the more targeted and accurate Claude Code's response will be.
Key Takeaways
- /clear resets conversation history; /compact summarizes it — use /compact when you want to continue a long task
- Permission prompts are your safety mechanism — engage with them actively rather than always approving
- Interactive mode is for exploration and multi-step tasks; one-shot mode (-p) is for scripting and automation
- Specific prompts with file locations and behavioral descriptions produce better results than vague requests
---
Try It Yourself: Start a Claude Code session on a project with at least 5 files. Run /init to generate a CLAUDE.md, then /status to see what model and context information Claude Code reports. Evaluate the generated CLAUDE.md — what did it get right about your project? What would you add or correct?