Cheatsheet

Claude Code cheatsheet (2026 patterns + commands + workflows)

Production patterns for Claude Code in 2026: slash commands, plan-first workflow, multi-file refactor, tool design via MCP, agent loops, autonomous PR loops, and the patterns that actually ship.

Core workflow

Claude Code defaults are good. Lean on them before customising.

ItemDescriptionExample
Plan firstAsk Claude Code to outline the change before editing. Catches misunderstandings early.
Small diffsIterate in tight loops — small changes, run tests, repeat.
Run + verifyLet Claude Code run the tests after each change. Don't manually verify what it can verify.
Read before writeClaude reads files before editing. Don't skip this — it's how it understands context.

Slash commands

ItemDescriptionExample
/initBootstrap a CLAUDE.md from the current repo.
/clearReset conversation state when context is bloated.
/compactCompact the conversation into a tight summary.
/costShow token spend for the current session.
/modelSwitch underlying model (Sonnet / Opus / Haiku).
Custom slash commandsAdd Markdown files in ~/.claude/commands or .claude/commands for reusable workflows.

CLAUDE.md and AGENTS.md

Project-level memory. Put rules, conventions, and gotchas here.

ItemDescriptionExample
Project root CLAUDE.mdRepo-wide rules: build commands, code style, deploy steps, file structure.
Per-directory CLAUDE.mdDirectory-scoped rules. Claude reads the nearest CLAUDE.md when working in that dir.
AGENTS.mdCompatible cross-tool agent rules. Works with Codex, OpenAI Agents SDK, and Claude Code.
Keep it shortBig CLAUDE.md files eat context every turn. Aim for under 1000 tokens unless necessary.

Tool / MCP design

ItemDescriptionExample
MCP serversAdd tools via MCP. Configure in claude_desktop_config.json or via /mcp.
Native bash + edit + readClaude Code ships with native tools. Don't replace them with custom unless needed.
Skill filesPackage recurring workflows as Skills — scripts + instructions Claude can load.

Autonomous loops

ItemDescriptionExample
Plan → execute → verifyThe reliable autonomous pattern: plan, run, test, fix, repeat.
Always-on testsTell Claude to run the test suite after every change. Catches regressions early.
Use a budgetSet --max-turns or similar so loops can't run away.
Human approval gatesForce human approval before destructive actions (DB writes, deploys, force-push).

Debug + observability

ItemDescriptionExample
/costPer-session token spend.
Sample transcriptsSave successful + failed sessions for prompt eval improvements.
MCP server logsEach MCP server logs separately — check there when tool calls fail.

FAQ

Best Claude Code workflow in 2026?

Plan first, small diffs, run + verify in tight loops, tests on every change.

Where do I put project conventions?

CLAUDE.md at the repo root for repo-wide rules; per-directory CLAUDE.md for scoped rules; AGENTS.md if you want cross-tool compatibility.

Should I write custom MCP servers?

Only when native tools don't cover what you need. Most repos work fine with bash + edit + read.

Last updated: 2026-06-01.