Most developers barely scratch the surface. This guide covers memory, context control, custom commands, and hooks — the tools that make Claude Code genuinely powerful.
Set up Claude to understand your codebase from day one
Running /init at the start of a new project lets Claude scan your entire codebase before you write a single prompt.
CLAUDE.md summary fileThink of CLAUDE.md as a README written for Claude, not humans. It's included automatically in every request, meaning Claude always starts with full project context — no re-explaining needed.
Project-level. Committed to your repo. Shared with the whole team.
Personal preferences. Not committed. Not shared. Yours alone.
Global rules. Applies to every project you open. Set once, always active.
Prefix any message with # to enter memory mode. Claude writes it straight into CLAUDE.md.
Use @filename to pull a file into the conversation. Works inline in prompts or inside CLAUDE.md for persistent context.
Stay focused. Stop runaway responses. Keep long sessions productive.
Press Esc once to stop a response mid-stream. Redirect Claude immediately to where you actually want it to go. Prevents deep, off-track rabbit holes.
Press Esc twice to strip away distracting history while keeping valuable context. Ideal when a conversation has gone sideways.
Turn your most-used prompts into reusable slash commands
.claude/commands/ folder in your projectaudit.md)/audit)Use $ARGUMENTS as a placeholder to accept dynamic input — file paths, text, flags. Makes commands reusable across any context.
Automate actions before and after Claude does anything
Hooks let you intercept Claude's tool calls — automatically running your own commands before or after Claude acts. Format, test, validate, log, or block — all without lifting a finger.
| Hook | When | Can Block? |
|---|---|---|
| PreToolUse | Before tool runs | ✅ Yes |
| PostToolUse | After tool runs | ❌ No |
Hooks are defined in .claude/settings.json. You can scope them globally, per-project, or locally.
Hooks receive JSON via stdin. Structure varies by type — use a logging helper to inspect the real payload.
Hook input structure can be unpredictable. Log the raw stdin payload first — it saves hours of guesswork.