Przeskocz do głównej treści
Część 1 z 6
6 min read

Część 1 z 6

Core Survival Kit

Learn the 5 essential Claude Code commands that prevent most beginner frustration. Master context management, the foundation of every AI workflow.

Informacja: Treść dostępna wyłącznie w języku angielskim, aby zachować precyzję terminologii technicznej.

Claude Code, Part 1: Core Survival Kit

Most people struggle with Claude Code for one reason: they keep bad context.

These 5 commands fix that.


Learn These 5. Nothing Else Yet.

# Command When
1 /clear Between tasks → fresh start
2 /compact Between phases → keep context, drop noise
3 /context When things feel off → check context usage
4 /plan Before complex tasks → plan first
5 /cost When you want session cost or plan-limit usage

That's it. Master these before adding anything else.

The mental model: Claude Code is only as good as the context you give it. These five commands control that context.


1. /clear: Fresh Start Between Tasks

Starts a new conversation with empty context. The previous conversation isn't destroyed; it stays available in /resume if you need it back. To free context while continuing the same conversation, use /compact instead.

/clear

When to use:

  • Switching to a different task
  • After committing, since old context just wastes tokens
  • Session feels confused or contradictory

The #1 beginner mistake:

Keeping everything in one session. You debug a bug, then add a feature, then refactor, all in the same conversation. By the third task, Claude Code is mixing context from all three. Answers get worse. Behavior gets unpredictable.

Fix: /clear between tasks. Always. It costs 2 seconds and saves 20 minutes of confused output.


2. /compact: Keep the Essence, Drop the Noise

Compresses conversation history into a summary. Frees context window space without losing everything.

/compact

The key feature: you can pass focus instructions for the summary.

/compact focus on the auth module changes and test results
/compact focus on the API schema; the debugging steps aren't important
/compact focus on the migration

Without instructions, the summary covers everything equally. With focus instructions, it prioritizes what you tell it to.

When to use:

  • Finished designing → compact before implementing
  • Finished implementing → compact before reviewing
  • Context feels heavy but you're still on the same task

The difference from /clear:

  • /clear = nuclear reset, everything gone
  • /compact = smart compression, keeps the important stuff

The habit: Compact between phases. Clear between tasks.


3. /context: Your Context Dashboard

Visualizes current context usage as a colored grid. Shows optimization suggestions for context-heavy tools, memory bloat, and capacity warnings.

/context

What you'll see: A visual grid that shows context consumption at a glance. When usage is high, you'll get suggestions for what's consuming the most space and how to free it.

When to use:

  • When Claude Code starts giving inconsistent or repetitive answers
  • Before starting a complex task (do you have room?)
  • After loading multiple files
  • Before deciding: /compact or /clear?

The rule of thumb: If the grid looks mostly full, compact or clear before continuing.


4. /plan: See the Plan Before Any Code Changes

Enters plan mode. Claude Code reads files and runs shell commands to explore the codebase, then writes a plan of what it would do. It cannot edit your source in plan mode. You see exactly what would change before a single line is written.

/plan

You can also cycle modes with Shift+Tab: defaultacceptEditsplan (the optional auto and bypassPermissions modes slot in after plan when they're enabled).

Why this matters: Without a plan, you say "add caching" and Claude Code changes 12 files. With a plan, Claude Code says "here are the 3 files, this pattern, these risks", and you can say "go", "just the service layer", or "no, that's wrong, try again". AI writes code fast; the slow part is fixing the wrong code. Plan mode flips the order: two minutes of planning saves twenty of fixing.

When the plan lands, you have options (per the docs):

  • Approve and start in auto mode (research preview; needs Opus 4.6+ or Sonnet 4.6 on the direct Anthropic API (not Bedrock/Vertex/Foundry), works on all plans, with an admin enabling it on Team/Enterprise; check the docs for current eligibility)
  • Approve and accept edits: auto-accepts edits going forward
  • Approve and review each edit manually
  • Keep planning with feedback: reject, tell Claude Code what's off, iterate
  • Refine with Ultraplan: browser-based review on the web
  • Bail out: Shift+Tab exits plan mode

When to use: Any task that touches more than one file, involves an architectural decision, or lives in code you don't know well. Skip plan mode only for trivial changes (typo, log line, rename).

Example prompt:

I need to add email verification to the signup flow.
Explore the auth module first. Don't change anything.
Then propose a plan with files, approach, and risks.

The habit: /plan before any non-trivial change. Iterate the plan until it matches what you want, then approve. Code only gets written from a plan you've read.


5. /cost: Session Cost and Plan Limits

Shows what the current session has cost or used. /cost, /usage, and /stats are aliases for the same screen; /stats opens directly on the Stats tab. The dollar figure is a local estimate, not your actual bill.

/cost

Example output (API plan):

Total cost:            $0.55
Total duration (API):  6m 19.7s
Total duration (wall): 6h 33m 10.2s
Total code changes:    0 lines added, 0 lines removed

What you'll see:

  • On API plans: session cost in dollars, API duration, code-change tally.
  • On Pro / Max / Team / Enterprise: how much of your plan window is left, plus daily and weekly activity stats.

When to use: When something feels unusually expensive (long agentic loops, repeated retries) or when you want to know how much plan headroom you have before kicking off a big task. Check it when you're curious, not on a timer.


The One Rule

Clear between tasks. Compact between phases. Plan before coding.

If you do nothing else, these three habits prevent most of the frustration beginners experience with Claude Code. Most problems aren't Claude Code being bad. They're sessions being polluted with old context from three tasks ago.

Ta lekcja jest częścią Claude Code Field Guide, darmowego dodatku do Claude and the Code. Książka uczy myślenia stojącego za komendami.

Ukończyłeś 1 z 6 lekcji.

Chcesz pełną metodologię?

Field Guide uczy komend. Książka uczy myślenia.