---
title: "Claude Code Command Cheat Sheet"
date: "2026-05-26"
author: "Graham"
description: "A practical Claude Code command cheat sheet for starting sessions, reviewing diffs, running tests, planning features, and staying safe."
tags: ["Claude Code", "Power of AI"]
url: "https://powerofai.ca/claude-code/commands"
readTime: "8 min"
---

# Claude Code Command Cheat Sheet

This cheat sheet is for real Claude Code sessions. The point is not memorizing commands. The point is giving Claude narrow, testable work and keeping your review loop clean.

## Quick picks

- **Start safely: Explain before editing.** Ask Claude to inspect and plan before making changes.
- **Work cleanly: One task per session.** Smaller sessions are easier to review and revert.
- **Finish properly: Run tests and summarize diff.** Never accept silent edits.

## Session rules that prevent mess

Start with a clean git status. Keep work scoped. Ask for a plan before edits. Review the diff yourself. If the work is important, ask another model or another Claude session to review it.

- Use a branch or worktree for larger changes.
- Do not paste secrets.
- Do not run broad autonomous modes in a production repo casually.
- Prefer explicit test commands over "test everything" when the repo is large.

## A clean three-step loop

Use Claude Code in three passes: understand, change, verify. The first pass should be read-only. The second pass should be narrow. The third pass should explain the diff and run the checks that actually matter.

This rhythm makes the tool feel less mysterious. You are not hoping the agent got it right. You are giving it a smaller job, reviewing the evidence, and deciding what ships.

- Before edits: ask for architecture, risk, and likely files.
- During edits: keep the task small and testable.
- After edits: ask for a code-review summary and verify with your own eyes.

## Command cheat sheet

### claude

Start an interactive Claude Code session in the current project.

```bash
claude
```

Run this from the repo root after checking `git status`.

### claude -p "explain this repo"

Print a one-off answer without entering the full interactive loop.

```bash
claude -p "explain this repo"
```

Useful for quick architecture summaries, scripts, and CI-style checks.

### claude --continue

Continue the most recent session for the current directory.

```bash
claude --continue
```

Use this when you closed the terminal but want to keep the same thread of work.

### claude --resume <session-id>

Resume a specific prior session by ID.

```bash
claude --resume <session-id>
```

Useful when you have several projects or want to return to a known conversation.

### /init

Create or update a project guide file so Claude understands local conventions.

```bash
/init
```

Run this early in a repo and review the generated guidance before relying on it.

### /permissions

View or change what Claude Code is allowed to read, edit, and run.

```bash
/permissions
```

Check this before broad refactors, dependency installs, or commands with side effects.

### /compact focus on the current diff and test status

Compress a long conversation while preserving the part that matters.

```bash
/compact focus on the current diff and test status
```

Use it before the context window gets messy, not after you are already lost.

### /review

Ask for a code-review pass over recent changes.

```bash
/review
```

Treat the result like a second reviewer, then inspect the diff yourself.

## Copyable prompts

### Understand a repo

```text
Read the project structure and explain the architecture. Do not edit files yet. Tell me the main entry points, data flow, build commands, and likely risk areas.
```

### Plan a feature

```text
Plan the smallest safe implementation for [FEATURE]. List files likely to change, tests to run, and questions you need answered. Do not edit yet.
```

### Implement narrowly

```text
Implement [TASK]. Keep the change scoped. Follow existing patterns. Run the relevant tests or explain why they cannot run.
```

### Review the diff

```text
Review the current git diff as if you are doing a code review. Prioritize bugs, regressions, security issues, and missing tests. Give file-specific findings.
```

### Handoff summary

```text
Summarize what changed, why, how to test it, what risk remains, and any follow-up cleanup that should not block this change.
```

## Related Power of AI pages

- [Claude Code Hub](/claude-code): Install and workflow overview.
- [Claude Code vs Codex](/claude-code-vs-codex): Choose the right coding agent.
- [Claude Code Deep Dive](/article/claude-code-game-changer): Understand the agentic loop.

## Sources and official references

- [Anthropic Claude Code docs](https://docs.anthropic.com/en/docs/claude-code)

