Claude Code Cheatsheet, A Complete Beginners Guide for Developers

Learn Claude Code from the ground up with this cheatsheet: define your CLAUDE.md, use slash commands, manage context, delegate via subagents, enforce rules with hooks, and integrate with CI using GitHub Actions.

Ashley Goolam

Ashley Goolam

20 November 2025

Claude Code Cheatsheet, A Complete Beginners Guide for Developers

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.

claude code

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-code

Start using Claude Code:

cd your-project
claude
💡
Want a great API Testing tool that generates beautiful API Documentation?

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!
button

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

# 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.

claude code /context
Screenshot of Shrivu Claude Code "/context"

b. Commands for restarting or shrinking context:

3. Slash Commands

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)
claude code "/" commands

4. Plan Mode

5. Subagents & Task Delegation

claude code subagents

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.

claude code skills

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:

 2. Token Efficiency:

d. Use Case:

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:

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

Installation:

# Typescript:
npm install @anthropic-ai/claude-agent-sdk

# Python:
pip install claude-agent-sdk

8. Claude Code GitHub Actions (GHA)

What is Claude Code GitHub Actions?
Learn Claude Code Github Action! This tutorial shows how to automate coding, create PRs, and fix bugs in GitHub repos using AI-powered Github Actions.

9. Settings & Configuration

a. In settings.json, you can configure:

{
  "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

  1. 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.
  2. Thinking Modes (Cheat): Some users dial Claude’s reasoning mode to think, think hard, think harder, or ultrathink to adjust how deeply it reasons.
  3. Custom Commands: Define reusable slash commands in .claude/commands with dynamic placeholders ($argument). Great for testing, building, or reviewing.
  4. Session History: Use claude --resume or claude --continue to pick up older sessions. Claude stores all session history locally.
  5. Feedback Loop: Review agent behavior via GitHub Action logs or historical session data and update your CLAUDE.md to 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 a great API Testing tool that generates beautiful API Documentation?

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!
button

Explore more

How to Fix the "Your Current Account Is Not Eligible for Antigravity" Error

How to Fix the "Your Current Account Is Not Eligible for Antigravity" Error

Learn how to fix the “Your current account is not eligible for Antigravity” error. This guide explains what causes it and provides step-by-step solutions to fix it for good.

20 November 2025

TOON vs JSON in LLMs: What is It and Will it Replace JSON in AI Agents?

TOON vs JSON in LLMs: What is It and Will it Replace JSON in AI Agents?

TOON (Token-Oriented Object Notation) is a compact, schema-aware format built for LLM inputs. Learn how it saves tokens, improves structure, and compares to JSON, YAML, and compressed JSON — plus whether it’s poised to replace JSON in AI agents.

19 November 2025

How to Use Google Gemini 3 API: Your Beginner's Guide to AI Magic

How to Use Google Gemini 3 API: Your Beginner's Guide to AI Magic

Learn how to use Google Gemini API with this beginner's guide. Discover how to test Gemini API requests easily using Apidog and start building powerful AI applications.

19 November 2025

Practice API Design-first in Apidog

Discover an easier way to build and use APIs