Use /cost to Track Token Spending
Check how many tokens you've used and the estimated cost of the current session — so you know when to compact before hitting the context ceiling.
/cost Practical tips and tricks to get more from Claude Code.
Check how many tokens you've used and the estimated cost of the current session — so you know when to compact before hitting the context ceiling.
/cost Wipe the conversation history and reset context to zero without restarting Claude Code — use this when switching tasks or when Claude starts drifting.
/clear Stop Claude immediately when it's heading in the wrong direction — before it wastes tokens on a bad path that cascades into hundreds of useless lines.
Escape Let Claude Code scan your project and auto-generate a CLAUDE.md file instead of writing one from scratch — then customize to fit your workflow.
/init Send command output directly into Claude via stdin — pipe failed tests, build errors, or logs and get a focused diagnosis without copy-pasting anything.
npm test 2>&1 | claude -p "explain failures" Skip interactive mode and send a prompt directly from the command line with -p — pipe files in, chain tools, or embed Claude in shell scripts.
claude -p "explain this error" < error.log Ask Claude to plan before coding when a task spans multiple files — catch wrong assumptions early instead of rolling back half-done changes.
plan before you code Choose your Claude model at startup — default to Sonnet for everyday coding, switch to Opus only for deep architecture problems to cut costs.
claude --model sonnet The six-section CLAUDE.md structure that gives Claude Code maximum project understanding — so it stops asking questions you've already answered.
# Project Overview
# Tech Stack
# Architecture
# Conventions
# Common Commands
# Known Issues
Free up context window space by compressing history when Claude Code slows down — recovering 40–60% of your context budget without losing key info.
/compact Skip AI interpretation and execute shell commands instantly with ! — run tests, check git status, or any command where you don't need Claude's input.
! npm test