If you're diving into Claude Code, Anthropic’s powerful AI-powered coding assistant, having a clear reference is essential. This Claude Code Cheatsheet is meant for developers who want a practical, beginner-friendly guide covering setup, workflows, configuration, and advanced tips. By the end, you’ll feel more confident using Claude Code in your local environment or as part of your CI/CD processes.

What Is Claude Code?
Claude Code is a CLI-based AI coding tool by Anthropic. It allows developers to generate, refactor, test, and document code using Claude’s advanced models. Rather than a simple chat interface, Claude Code behaves like an AI IDE: it understands your repository structure, applies guardrails defined in configuration files, can run bash commands, and integrates with Git workflows.
Install Claude Code:
# MacOS/Linux:
curl -fsSL https://claude.ai/install.sh | bash
# Windows:
irm https://claude.ai/install.ps1 | iex
# NPM:
npm install -g @anthropic-ai/claude-code
# Homebrew:
brew install --cask claude-codeStart using Claude Code:
cd your-project
claudeWant an integrated, All-in-One platform for your Developer Team to work together with maximum productivity?
Apidog delivers all your demands, and replaces Postman at a much more affordable price!
Key Components of Claude Code — Your Cheatsheet
Here are the essential building blocks and features you’ll want to know when getting started with Claude Code:
1. CLAUDE.md — Agent Manifest
- The
CLAUDE.mdfile is the “constitution” for your agent: it defines how Claude behaves in your repository. - Use it to document approved tools, common workflows, and constraints.
- Best practice: Keep it short, focused on key guardrails, and avoid embedding very large docs.
# MyProject CLAUDE.md
## Project Overview
This is a Node.js + Express REST API for a task management application.
## Technology Stack
- Backend: Node.js (ES6), Express
- Database: PostgreSQL
- Testing: Jest
- Linting & Style: ESLint, Prettier
## Development Commands
- `npm install` — Install dependencies
- `npm run dev` — Start development server
- `npm run test` — Run all tests
- `npm run lint` — Run linter
## Coding Standards
- Use 2-space indentation.
- Always use `async / await` instead of `.then()` chains.
- Functions must have JSDoc comments.
- Prefer composition over inheritance.
## Git Workflow
- Feature branches must follow this pattern: `feature/FOO`
- Use `git rebase` instead of `merge` for updating branches.
- When committing: write descriptive commit messages that follow the Conventional Commits format.
## File Structure Guidance
- `src/` — Your main application code
- `tests/` — Test files
- `scripts/` — Utility or setup scripts
- `migrations/` — Database migrations
## Known Issues / Workarounds
- `db.connect()` sometimes times out; in that case, retry twice.
- For large JSON payloads, use streaming to avoid memory issues.
## Memory / Style Preferences
- Always ask for clarification if the request is ambiguous.
- Do not generate new `.md` files unless explicitly instructed.
- Include a `co-authored-by Claude` line in generated commits.2. Context Management
a. Use /context to inspect your current Claude session’s token usage.

b. Commands for restarting or shrinking context:
/clear+/catchup: Clears all conversation and then reloads files from a commit or branch.- A “Document & Clear” flow: have Claude dump its plan to a Markdown file, clear memory, then reload from that file.
3. Slash Commands
- Slash commands are shortcuts to predefined prompts.
- Examples:
| Command | Description |
|---|---|
/catchup |
Ask Claude to read and load any changed files in your git branch |
/clear |
Clear the conversation history (memory reset) |
/add-dir |
Add directories to Claude’s workspace |
/mcp |
Manage Model Context Protocol (MCP) servers |
/model |
Switch which Claude model to use (e.g. Sonnet, Opus) |
/pr |
Prepare a pull request (if configured via slash commands) |
- Keep slash commands minimal and focused; don’t rely on them for every task.

4. Plan Mode
- Use planning mode when starting complex tasks. Claude will outline a plan before writing code.
- You can then review, edit, or approve that plan before asking Claude to execute.
- Ideal for large feature work, refactoring, or architectural changes.
5. Subagents & Task Delegation
- Claude Code supports subagents, letting you delegate parts of work to “clones” of the main agent.
- Shrivu prefers a “Master-Clone” architecture: the main agent spawns clones via
Task(...), rather than using rigid specialized subagents. - This preserves flexibility while avoiding fragmentation of context.
- Access Claude Code's subagents using the slash command:
/agents.

6. Claude Skills vs. MCP — What’s the Difference?
a. Claude Skills are pre-built “modules” that teach Claude how to perform specific tasks. They’re written in Markdown or code, and they load only when needed. You can use Skills to define workflows like formatting reports, summarizing data, or enforcing your team’s style.

b. Model Context Protocol (MCP), on the other hand, is a protocol for connecting Claude to outside data and tools — such as databases, your codebase, or business systems. It’s like a “universal adapter” that lets Claude access and act on external resources without custom per-tool integrations.
c. Key Differences:
1. Purpose:
- Skills encode procedural knowledge.
- MCP handles tool and data connectivity.
2. Token Efficiency:
- Skills load only when needed, using relatively few tokens.
- MCP tool definitions can take up significant token space if many are enabled.
d. Use Case:
- Use Skills to teach Claude domain-specific workflows (e.g., “when writing status reports, always include X, Y, Z”).
- Use MCP when Claude needs to read/write data, call APIs, or access external systems like Git or a database.
In practice, the two work best together: MCP gives Claude access to your data, and Skills teach Claude how to use that data in a structured, repeatable way.
6. Hooks
a. Hooks are your way to enforce rules automatically.
b. Two common types:
- Block-at-submit: For example, a
PreToolUsehook can blockgit commitunless tests have passed. - Hint hooks: Non-blocking; they provide guidance or suggestions without stopping execution.
c. Avoid “block-at-write” hooks — letting Claude complete its plan and then validating is more stable.
# Example Hook in .claude/settings.toml
[[hooks]]
# The event that triggers the hook.
event = "PostToolUse"
# (Optional) Conditions for the hook to run.
[hooks.matcher]
tool_name = "edit_file"
file_paths = ["*.py", "api/**/*.py"]
# The shell command to execute.
command = "ruff check --fix $CLAUDE_FILE_PATHS && black $CLAUDE_FILE_PATHS"
# (Optional) Whether to run the command in the background.
run_in_background = false 7. CLI SDK
- The Claude Code SDK enables you to script Claude interactions: useful for batch processing, building internal tools, or prototyping agents.
- Use it to run parallel refactors, to generate code from templates, or as a lightweight agent inside CI/CD workflows.
Installation:
# Typescript:
npm install @anthropic-ai/claude-agent-sdk
# Python:
pip install claude-agent-sdk8. Claude Code GitHub Actions (GHA)
- You can integrate Claude Code directly into GitHub Actions.
- Use it to auto-generate pull requests, enforce code standards, or run CLAUDE.md-driven checks as part of your CI pipeline.
- Because logs are stored, you can audit agent behavior and improve your CLAUDE.md file over time.

9. Settings & Configuration
a. In settings.json, you can configure:
- Proxy (
HTTPS_PROXY) — useful for debugging CLI traffic. - Timeouts (
MCP_TOOL_TIMEOUT,BASH_MAX_TIMEOUT_MS) — increase these if you run long tasks. - API key (
ANTHROPIC_API_KEY) — use your key from Anthropic or a helper script. - Permissions — control which system tools Claude Code is allowed to execute.
{
"permissions": {
"allow": [
"Bash(npm run lint)",
"Bash(npm run test:*)",
"Read(~/.zshrc)"
],
"deny": [
"Bash(curl:*)",
"Read(./.env)",
"Read(./.env.*)",
"Read(./secrets/**)"
]
},
"env": {
"CLAUDE_CODE_ENABLE_TELEMETRY": "1",
"OTEL_METRICS_EXPORTER": "otlp"
},
"companyAnnouncements": [
"Welcome to Acme Corp! Review our code guidelines at docs.acme.com",
"Reminder: Code reviews required for all PRs",
"New security policy in effect"
]
}Advanced Features & Productivity Tips
- Model Switching: Choose Claude 4 Sonnet or Opus depending on your task. Sonnet is fast and cost-efficient; Opus is more capable for complex, multi-file changes.
- Thinking Modes (Cheat): Some users dial Claude’s reasoning mode to
think,think hard,think harder, orultrathinkto adjust how deeply it reasons. - Custom Commands: Define reusable slash commands in
.claude/commandswith dynamic placeholders ($argument). Great for testing, building, or reviewing. - Session History: Use
claude --resumeorclaude --continueto pick up older sessions. Claude stores all session history locally. - Feedback Loop: Review agent behavior via GitHub Action logs or historical session data and update your
CLAUDE.mdto fix misunderstandings or enforce better guardrails.
Frequently Asked Questions (FAQ)
Q1. What is the purpose of CLAUDE.md?
Ans: CLAUDE.md acts as the agent’s manifesto. It defines rules, tools, and conventions for Claude Code to follow. It helps standardize behavior across your repository.
Q2. Should I use subagents or just simple tasks?
Ans: Use subagents if you want strict modular workflows. But many find the Master-Clone pattern (using Task(...)) more flexible — you keep context while delegating subtasks.
Q3. How do I restart a Claude session without losing everything?
Ans: Use /clear to reset the chat, and then /catchup to load files from your Git branch so Claude has full context again.
Q4. What are hooks, and why do I need them?
Ans: Hooks enforce rules or checks when Claude commits work. For example, a block-at-submit hook can ensure tests pass before Git commit is allowed.
Q5. How can I integrate Claude Code into CI/CD?
Ans: Use the Claude Code GitHub Action to run tasks, validate code, generate pull requests, or enforce your CLAUDE.md guardrails in automated pipelines.
Conclusion
This Claude Code Cheatsheet gives you a practical, structured overview of how to use Claude Code effectively. From writing a well-crafted CLAUDE.md file to leveraging slash commands, subagents, hooks, and CI integration — these patterns form a solid foundation for using Claude Code as a reliable AI-powered development partner.
By mastering these features, new developers can rapidly onboard, and more experienced engineers can streamline their workflows, enforce guardrails, and scale Claude-assisted productivity. Claude Code is more than just a code-generation tool — it is a programmable, agentic system that adapts to your team’s needs.
Want an integrated, All-in-One platform for your Developer Team to work together with maximum productivity?
Apidog delivers all your demands, and replaces Postman at a much more affordable price!



