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.
| Item | Description | Example |
|---|---|---|
Plan first | Ask Claude Code to outline the change before editing. Catches misunderstandings early. | |
Small diffs | Iterate in tight loops — small changes, run tests, repeat. | |
Run + verify | Let Claude Code run the tests after each change. Don't manually verify what it can verify. | |
Read before write | Claude reads files before editing. Don't skip this — it's how it understands context. | |
Slash commands
| Item | Description | Example |
|---|---|---|
/init | Bootstrap a CLAUDE.md from the current repo. | |
/clear | Reset conversation state when context is bloated. | |
/compact | Compact the conversation into a tight summary. | |
/cost | Show token spend for the current session. | |
/model | Switch underlying model (Sonnet / Opus / Haiku). | |
Custom slash commands | Add 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.
| Item | Description | Example |
|---|---|---|
Project root CLAUDE.md | Repo-wide rules: build commands, code style, deploy steps, file structure. | |
Per-directory CLAUDE.md | Directory-scoped rules. Claude reads the nearest CLAUDE.md when working in that dir. | |
AGENTS.md | Compatible cross-tool agent rules. Works with Codex, OpenAI Agents SDK, and Claude Code. | |
Keep it short | Big CLAUDE.md files eat context every turn. Aim for under 1000 tokens unless necessary. | |
Tool / MCP design
| Item | Description | Example |
|---|---|---|
MCP servers | Add tools via MCP. Configure in claude_desktop_config.json or via /mcp. | |
Native bash + edit + read | Claude Code ships with native tools. Don't replace them with custom unless needed. | |
Skill files | Package recurring workflows as Skills — scripts + instructions Claude can load. | |
Autonomous loops
| Item | Description | Example |
|---|---|---|
Plan → execute → verify | The reliable autonomous pattern: plan, run, test, fix, repeat. | |
Always-on tests | Tell Claude to run the test suite after every change. Catches regressions early. | |
Use a budget | Set --max-turns or similar so loops can't run away. | |
Human approval gates | Force human approval before destructive actions (DB writes, deploys, force-push). | |
Debug + observability
| Item | Description | Example |
|---|---|---|
/cost | Per-session token spend. | |
Sample transcripts | Save successful + failed sessions for prompt eval improvements. | |
MCP server logs | Each 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.