Advertisement
Verified Partner
Enterprise Cloud Infrastructure, GPU Clusters & AI APIs
Deploy high-throughput inference and quant trading pipelines with ultra-low latency.
Explore Platform β†’

Claude Code Cheatsheet: Commands, Slash Commands, CLAUDE.md and MCP

By Dr. Aris Thorne β€’ Beginner β€’ 5 min read β€’ Updated 2026-09-15

What You Will Master in This Tutorial

  • Set up Python 3.12+ and write clean, readable, PEP 8-compliant code.
  • Work with fundamental data structures: Lists, Dictionaries, Sets, and Tuples.
  • Control program execution flow with conditionals, loops, and list comprehensions.
  • Encapsulate logic into reusable functions with type hints and default arguments.
  • Understand Object-Oriented Programming (OOP) in Python: Classes, Methods, and Inheritance.
  • Test and execute your scripts interactively using the Online Code Playground.

Print it, pin it, or keep it in a second tab. This is the dense reference for Claude Code, Anthropic's terminal-based coding agent: the commands you will use daily, the slash commands worth memorizing, a production-ready CLAUDE.md template, and MCP wiring. For the guided walkthrough, read our Claude Code mastery tutorial afterwards.

Install and start

CommandWhat it does
npm install -g @anthropic-ai/claude-codeInstall Claude Code globally (Node.js 18+)
claudeStart an interactive session in the current folder
claude "fix the failing test in auth.py"Start with an initial prompt
claude -p "explain this codebase"Print mode: one-shot answer, no session (great for scripts)
cat error.log | claude -p "what caused this?"Pipe input into a one-shot query
claude -cContinue the most recent conversation in this folder
claude --resumePick a previous session to resume
claude updateUpdate to the latest version
claude doctorDiagnose installation and environment problems
claude mcp listList configured MCP servers (see below)

Essential slash commands (inside a session)

CommandUse it to
/initGenerate a starter CLAUDE.md from your codebase
/clearWipe context and start fresh β€” the most underrated command; use between unrelated tasks
/compactSummarize the conversation to free context while keeping the thread
/contextSee what is filling the context window
/costShow token usage and cost of the session
/modelSwitch model (for example to a faster/cheaper one for grunt work)
/permissionsReview and adjust which tools/commands need approval
/reviewReview a pull request
/agentsCreate and manage subagents for specialized tasks
/memoryEdit memory files (CLAUDE.md and auto-memory)
/mcpCheck MCP server status and authenticate
/vimToggle Vim editing mode in the prompt
/helpFull list of commands for your version

Keyboard and prompt tricks

  • Esc β€” stop Claude mid-action. Esc twice β€” edit a previous message.
  • Shift+Tab β€” cycle permission modes, including Plan mode (proposes, does not execute) and auto-accept edits.
  • @path/to/file β€” reference a file so Claude reads it directly.
  • # your note at the start of a prompt β€” save the note to project memory (CLAUDE.md).
  • ! prefix β€” run a shell command yourself inside the session (for example !npm test) and keep its output in context.
  • "think" / "think hard" / "ultrathink" in a prompt β€” ask for progressively deeper reasoning on hard problems (and accept the extra cost).
  • Ctrl+R β€” search prompt history. Ctrl+C β€” interrupt/exit.

CLAUDE.md template (copy, adapt, commit it)

# Project: [Name]

## What this is
One paragraph: what the project does, who uses it, the stack.

## Commands
- Install: `npm install`
- Dev: `npm run dev`
- Test: `npm test` (single file: `npm test -- path/to/file.test.ts`)
- Lint/typecheck: `npm run lint && npm run typecheck`
- Build: `npm run build`

## Architecture
- Entry point: src/main.ts β€” keep it thin.
- Business logic lives in src/services/, never in route handlers.
- Data access only through src/db/ (no raw SQL in services).

## Rules
- TypeScript strict. No `any` without a comment explaining why.
- All new endpoints need a test. Run the full test suite before saying "done".
- Never edit migrations that are already merged; create a new one.
- Match the style of the file you are editing; do not reformat unrelated code.

## Gotchas
- The payments webhook is fragile: read docs/payments.md before touching it.
- Local .env uses staging keys. Never print secrets in output or logs.

Keep it short β€” Claude reads this every session, so every line costs context. Put long runbooks in separate docs and link them.

Connect MCP servers

# Project-scoped (shared via .mcp.json in the repo)
claude mcp add github -- npx -y @modelcontextprotocol/server-github

# From a JSON config (remote server with headers)
claude mcp add --transport http sentry https://mcp.sentry.dev/mcp

# Inspect and remove
claude mcp list
claude mcp remove github

Equivalent .mcp.json at your repo root:

{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-filesystem", "/path/to/project"]
    },
    "postgres": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-postgres",
               "postgresql://user:pass@localhost:5432/app"]
    }
  }
}

New to MCP itself? Start with our MCP guide and the companion MCP servers cheatsheet.

Daily workflow that works

  1. Plan first: for anything non-trivial, use Plan mode (Shift+Tab) and approve the approach before code changes.
  2. Small loops: one task, run tests, review the diff, commit. Then /clear before the next unrelated task.
  3. Show, do not tell: paste the error, the log, the failing test β€” do not describe them from memory.
  4. Verify like a skeptic: ask Claude to run the test suite and the linter, and read the diff yourself. "It should work" is not verification.
  5. Feed the memory: when Claude makes the same mistake twice, add one line to CLAUDE.md.

Troubleshooting quick hits

  • It keeps asking permission for everything: tune /permissions or allowlist safe commands in .claude/settings.json.
  • Answers feel generic: your CLAUDE.md is thin or missing; run /init and add commands and gotchas.
  • Context fills instantly: stop pasting whole repos β€” reference files with @, use /compact, and split work across subagents.
  • MCP server will not connect: claude mcp list for status, test the server's command manually in a terminal, and check that required API keys are in your environment.

More references in our cheatsheets library.

Knowledge Check: Test Your Understanding

1. Which Python data structure provides constant-time O(1) key lookups?

Frequently Asked Questions

How long does it take to learn Python for beginners?
With daily practice of 1-2 hours, most beginners grasp core syntax, data structures, and functions within 3 to 4 weeks, and can build basic automation scripts and data projects in 6 to 8 weeks.
Can I run Python directly in my browser?
Yes! You can use our built-in Online Code Playground (/tools/online-code-playground/) to run Python code instantly without setting up any local environment.