AI-101

Lesson 9

Information Commands

AI Confidence: 90%

AI-generated

Information Commands

Learning Objectives

Check token usage and costs with /cost

View session and connection status with /status

See uncommitted code changes with /diff

Diagnose installation problems with /doctor

Enable debug logging with /debug for troubleshooting

Introduction

As you work with Claude Code, you will want to know things. How many tokens have I used? What changes have I made? Is my connection working? These information commands answer those questions without changing anything.

This lesson covers the commands that show you useful data. You will learn to track your usage, view your changes, and diagnose problems when things go wrong. These commands are your window into what Claude Code is doing.

Checking Usage with /cost

Token usage determines how quickly you approach rate limits and, for API users, how much you pay. The /cost command shows your consumption:

[@portabletext/react] Unknown block type "codeBlock", specify a component for it in the `components.types` prop

The output includes:

Total tokens used in this session

Breakdown by input tokens (what you sent) and output tokens (what Claude generated)

Context window usage percentage

Cost estimate (for API users)

For subscription users (Pro, Max), the cost is included in your monthly fee. But token usage still matters because it affects context window and rate limits.

What the numbers mean:

Input tokens: Your messages plus files Claude read

Output tokens: Claude's responses plus thinking tokens

Context tokens: What is currently in Claude's working memory

If context usage is high (over 70%), consider running /compact or /clear.

Checking usage over time:

[@portabletext/react] Unknown block type "codeBlock", specify a component for it in the `components.types` prop

This shows usage patterns across sessions: daily usage, session history, streaks, and model preferences. It helps you understand your Claude Code habits.

Viewing Status with /status

The /status command shows information about your current session:

[@portabletext/react] Unknown block type "codeBlock", specify a component for it in the `components.types` prop

You see:

Claude Code version

Current model

Account information

Connection status

Plugin and MCP server status

This is useful when something feels wrong. If responses are slow, /status might show a connection issue. If Claude seems less capable than usual, you might be on a different model than expected.

/status works even while Claude is responding. You do not have to wait for the current response to finish.

You can also access status through /config and selecting the Status tab.

Viewing Changes with /diff

As you work with Claude Code, files change. The /diff command shows what has changed:

[@portabletext/react] Unknown block type "codeBlock", specify a component for it in the `components.types` prop

This opens an interactive diff viewer showing:

Uncommitted changes (your current git diff)

Per-turn diffs (changes Claude made in each response)

Use arrow keys to navigate:

Left/Right: Switch between git diff view and turn-by-turn view

Up/Down: Browse files within the current view

The per-turn view is especially useful. If Claude made changes across several responses, you can see exactly what changed in each one. This helps you understand the progression and find where something went wrong if needed.

Diagnosing with /doctor

When things are not working, /doctor diagnoses common problems:

[@portabletext/react] Unknown block type "codeBlock", specify a component for it in the `components.types` prop

This command checks:

Installation integrity

Configuration validity

Connection to Anthropic servers

Plugin and MCP server health

Common misconfigurations

If something is wrong, /doctor tells you what and often suggests how to fix it.

Run /doctor when:

Claude Code behaves unexpectedly

You see error messages you do not understand

After installation if something seems off

After updating plugins or MCP servers

Debug Logging with /debug

For deeper troubleshooting, /debug enables detailed logging:

[@portabletext/react] Unknown block type "codeBlock", specify a component for it in the `components.types` prop

Debug logging captures internal operations that are normally hidden. When you report a bug or investigate a complex issue, these logs provide the detail needed to understand what happened.

After running /debug, logs are written to a session debug file. You can also provide a description of the issue:

[@portabletext/react] Unknown block type "codeBlock", specify a component for it in the `components.types` prop

This tells Claude Code what you are investigating and helps it focus the logging.

Debug mode adds overhead, so do not leave it on all the time. Enable it when troubleshooting, then disable it when done.

Other Information Commands

Several other commands provide useful information:

`/help` lists all available commands with brief descriptions:

[@portabletext/react] Unknown block type "codeBlock", specify a component for it in the `components.types` prop

Use this when you cannot remember a command name.

`/release-notes` shows what changed in recent versions:

[@portabletext/react] Unknown block type "codeBlock", specify a component for it in the `components.types` prop

This opens an interactive version picker. Select a version to see its changes.

`/insights` generates a report analyzing your Claude Code usage:

[@portabletext/react] Unknown block type "codeBlock", specify a component for it in the `components.types` prop

This shows project areas you work on most, interaction patterns, and friction points. It helps you understand how you use Claude Code and where you might improve.

`/usage` shows your plan limits and rate limit status:

[@portabletext/react] Unknown block type "codeBlock", specify a component for it in the `components.types` prop

This is more plan-focused than /cost. It shows how close you are to hitting rate limits rather than raw token counts.

Practical Patterns

Here is how to use information commands effectively:

Check /cost periodically. Especially during long sessions, glance at token usage. High context usage means it is time for /compact or /clear.

Use /diff before committing. After Claude makes changes, run /diff to review everything before you commit. The per-turn view helps you understand what changed and why.

Run /doctor when stuck. If Claude Code is not behaving normally, /doctor often identifies the problem faster than trial and error.

Check /status when slow. If responses feel sluggish, /status shows connection health and current model. You might have a connection issue or be on a slower model than expected.

Review /stats weekly. Understanding your usage patterns helps you work more effectively. You might discover you use more tokens than expected on certain activities.

Key Takeaways

/cost shows token usage, context percentage, and cost estimates

/status displays version, model, connection, and account information

/diff shows uncommitted changes and per-turn diffs from Claude

/doctor diagnoses installation and configuration problems

/debug enables detailed logging for troubleshooting

Check these commands regularly to understand what Claude Code is doing

Try It Yourself

Practice with information commands:

Start Claude Code in a project.

Ask Claude a few questions to generate some usage.

Run /cost to see token usage.

Run /status to see your session information.

Ask Claude to make a small change to a file.

Run /diff and explore the turn-by-turn changes.

Run /help to see the full command list.

Run /doctor to check your installation health.

Run /release-notes to see what changed in recent versions.

This exercise familiarizes you with the information available at any time.

Sources

https://code.claude.com/docs/en/costs - Token usage, cost tracking, /cost command details

https://code.claude.com/docs/en/commands - Complete command reference including /status, /diff, /doctor

https://code.claude.com/docs/en/troubleshooting - Diagnostic commands and common issues