Claude Code Masterclass Guide

Reference lecture by Michele Torti: YouTube


This masterclass explains how to progress from beginner-level Claude Code usage to building agentic workflows and automated AI systems.


Course Overview and Roadmap

The masterclass is organized into five core modules:

  1. Foundations — Installation, workspace hosting, permissions, built-in commands, and project context through CLAUDE.md.
  2. Customization — Custom skills, slash commands, lifecycle hooks, and Model Context Protocol (MCP) integrations.
  3. Prompt Engineering — Structuring inputs for reliable and consistent Claude Code outputs.
  4. Agentic Workflows — Sub-agents, agent teams, workflow optimization, and continuous deployment.
  5. Real-World Builds — End-to-end implementation of practical projects.

Module 1: Foundations

Pricing Tiers and Billing

Claude Code access is available through standard Claude subscriptions or Anthropic Console API usage.

For most beginner and day-to-day workflows, a direct Claude subscription may be easier to budget for than usage-based API billing. API costs can increase as the number of requests, context tokens, tool calls, and generated outputs increases.

Note: Pricing, message limits, and product capabilities may change over time. The values below reflect the lecture’s approximate figures and should not be treated as current commercial pricing.

Plan tier Approximate monthly cost Approximate usage allocation Suitable for
Free $0 No Claude Code access according to the lecture Standard Claude web-interface testing
Pro Approximately $17–$20/month Approximately 45 messages per five-hour period Beginners and everyday productivity
Max 5× Approximately $100/month Approximately 225 messages per five-hour period Power users and heavier workflows
Max 20× Approximately $200/month Approximately 20× Pro usage capacity Very heavy or continuous workflows

Subscription and API Billing

Access method Billing model Main consideration
Claude subscription Fixed monthly plan with usage limits Easier to budget for regular usage
Anthropic Console API Usage-based billing Costs vary according to tokens, requests, and tool usage

Agentic coding sessions may consume more usage than ordinary chat sessions because Claude Code can:

  • Read multiple files.
  • Inspect directories.
  • Generate implementation plans.
  • Modify files.
  • Execute commands.
  • Use external tools.
  • Repeat testing and verification steps.
  • Maintain a large working context.

Workspace Environments and IDE Setup

Claude Code can be used across several integrated development environments and execution environments.

Environment Main strength Main limitation
Visual Studio Code General-purpose IDE with file navigation and official Anthropic extension Requires IDE installation and workspace setup
Cursor AI-focused coding environment with native AI features Users may pay separately for Cursor and Claude usage
Google Antigravity VS Code-like environment with access to Google’s ecosystem Adds another product and configuration layer
Terminal CLI Lightweight, direct command-line access Less approachable for beginners
Claude Desktop Familiar desktop interface Less visual control over project files and directories

Visual Studio Code

Visual Studio Code is presented as the recommended standard IDE for beginners.

It provides:

  • A file and folder explorer.
  • A project workspace.
  • An integrated terminal.
  • An extension system.
  • Visual access to Claude Code.
  • A place to inspect and review generated files.

Installing Claude Code in an IDE

The general installation workflow is:

  1. Download and open Visual Studio Code or Google Antigravity.
  2. Open the Extensions panel.
  3. Search for Claude Code.
  4. Verify that the publisher is Anthropic.
  5. Install the official extension.
  6. Authenticate using a Claude subscription or API credentials.
  7. Open the target project folder.
  8. Start Claude Code within that workspace.

Keyboard shortcuts for opening the Extensions panel are:

Operating system Shortcut
Windows/Linux Ctrl+Shift+X
macOS Cmd+Shift+X

Workspace Scope

Claude Code operates within the currently opened project folder.

The active workspace defines the files and directories Claude Code can inspect and modify.

+----------------------+
| Open Project Folder  |
+----------------------+
           |
           v
+----------------------+
| Start Claude Code    |
+----------------------+
           |
           v
+----------------------+
| Inspect Project      |
| Files and Folders    |
+----------------------+
           |
           v
+----------------------+
| Build, Edit, Test,   |
| and Review           |
+----------------------+

Interface Controls and Permission Modes

Claude Code provides multiple permission modes that control how aggressively it can edit files or execute terminal commands.

Permission mode Behavior Recommended use
Ask before edits Requests approval before writing or editing files Review-oriented workflows
Edit automatically Applies edits without asking for every individual change Routine, low-risk tasks
Plan mode Creates a structured implementation plan before execution Complex or high-impact tasks
Bypass permissions Skips confirmation prompts for edits and command execution Controlled sandboxes only

Ask Before Edits

Claude Code requests approval before making file changes or executing certain actions.

This mode is useful when:

  • Reviewing unfamiliar code.
  • Working with sensitive repositories.
  • Learning how Claude Code operates.
  • Making high-impact changes.
  • Maintaining strict human oversight.

Edit Automatically

Claude Code applies file edits without asking for approval before every change.

This mode is useful for:

  • Small changes.
  • Repetitive edits.
  • Well-understood tasks.
  • Low-risk project maintenance.

The user should still inspect the final result.

Plan Mode

Plan mode separates planning from execution.

User Request
      |
      v
+----------------------+
| Claude Creates Plan  |
+----------------------+
      |
      v
+----------------------+
| User Reviews Plan    |
+----------------------+
      |
      v
+----------------------+
| User Approves Plan   |
+----------------------+
      |
      v
+----------------------+
| Claude Executes      |
| Approved Work        |
+----------------------+

Plan mode is useful when:

  • The task affects several files.
  • The implementation requires design decisions.
  • The change is difficult to reverse.
  • The user wants to review the approach first.
  • The project contains strict conventions or business rules.

Bypass Permissions

Bypass permissions skips confirmation prompts for edits and terminal commands.

This setting may be convenient, but it increases the potential impact of mistakes. Claude Code may be able to:

  • Modify files.
  • Delete or overwrite content.
  • Execute shell commands.
  • Install dependencies.
  • Access connected tools.
  • Change project state without asking.

Use this mode only in controlled environments where the consequences of unwanted changes are understood and limited.

More Convenience
        |
        v
Fewer Approval Prompts
        |
        v
Greater Potential Impact
        |
        v
Requires Stronger Oversight

Effort Control

Claude Code includes an effort setting with three levels:

Effort level Expected behavior Trade-off
Low Faster and lighter processing May provide less analysis
Medium Balanced reasoning and speed Recommended general-purpose setting
High More extensive reasoning and verification May consume more usage and take longer

Essential Built-In Slash Commands

Slash commands provide direct access to common Claude Code operations.

Command Purpose Description
/clear Reset conversation Clears the current conversation context
/context Inspect token usage Displays context usage and its breakdown
/compact Compress conversation Summarizes earlier messages to free context space
/init Initialize project instructions Inspects an existing repository and generates CLAUDE.md
/prime Refresh project context Loads project instructions, skills, and commands
/hooks Manage hooks Opens the hook configuration interface

/clear

The /clear command starts a fresh conversation context.

It is useful when:

  • The current conversation contains irrelevant information.
  • The user is starting an unrelated task.
  • The conversation has become confusing.
  • The user wants to reduce accumulated context.

Clearing the conversation does not delete project files.

/context

The /context command displays how the available context is being used.

A context report may include:

  • System instructions.
  • Tool definitions.
  • Skills.
  • Conversation messages.
  • MCP tools.
  • Reserved buffer.
  • Remaining free space.

/compact

The /compact command summarizes an existing conversation so that work can continue with less context consumption.

Long Conversation
        |
        v
+----------------------+
| Preserve Important   |
| Decisions and Tasks  |
+----------------------+
        |
        v
+----------------------+
| Generate Compact     |
| Conversation Summary |
+----------------------+
        |
        v
Continue Work with
Additional Context Space

Important project requirements should be stored in files such as CLAUDE.md or directive documents rather than only in a conversation.

/init

The /init command analyzes an existing project and generates an initial CLAUDE.md file.

It is most useful when:

  • A repository already contains code.
  • The project lacks persistent Claude Code instructions.
  • The user wants Claude Code to document the existing structure.
  • The user wants an initial project context file to review and refine.

/prime

The /prime command refreshes the session with project-specific context.

Depending on the configuration, this may include:

  • CLAUDE.md.
  • Custom skills.
  • Custom slash commands.
  • Project conventions.
  • Relevant documentation.

/hooks

The /hooks command opens the hook configuration interface and allows the user to inspect or modify event-driven actions.


Project Memory: The CLAUDE.md File

The CLAUDE.md file acts as the project instruction manual for Claude Code.

It provides persistent context about:

  • What the project does.
  • Which technologies it uses.
  • How files should be organized.
  • Which rules Claude must follow.
  • Which actions require approval.
  • What outputs are expected.
New Claude Code Session
        |
        v
Read CLAUDE.md
        |
        v
Understand Project Context
        |
        v
Apply Rules and Guardrails
        |
        v
Execute User Task

The Four Pillars of CLAUDE.md

A useful CLAUDE.md file should cover four major areas.

Pillar Purpose Typical content
Product description Explains what the project does Business purpose, users, objectives
Technology stack Describes the implementation environment Languages, frameworks, APIs, services
Rules and guardrails Defines required and prohibited behavior Naming, formatting, security, design rules
Folder structure Explains where files belong Directories, output locations, file conventions

Product Description

The product description explains:

  • What the application or business does.
  • Who uses it.
  • What problem it solves.
  • What the main project objectives are.
  • Which outputs the project should produce.

Technology Stack

The technology-stack section records the tools used by the project, such as:

  • Programming languages.
  • Frameworks.
  • Databases.
  • APIs.
  • Hosting services.
  • Automation platforms.
  • Package managers.
  • Build tools.

Rules and Guardrails

Rules and guardrails help Claude Code produce more consistent results.

They may define:

  • Naming conventions.
  • Formatting standards.
  • Color palettes.
  • Font choices.
  • Required libraries.
  • Prohibited dependencies.
  • Security requirements.
  • File-placement rules.
  • Testing expectations.
  • Content tone.
  • Business logic constraints.

Folder Structure

The folder-structure section explains where different types of files should be placed.

A well-defined structure prevents files from being scattered across the workspace.


Project Organization

Three-Layer Architecture

For a new project, the masterclass recommends separating instructions, decisions, and execution.

my-project/
├── CLAUDE.md
├── .env
├── directives/
├── decisions/
├── execution/
└── tmp/
Directory or file Purpose
CLAUDE.md Persistent project instructions
.env API keys and sensitive configuration
directives/ SOPs, instructions, and objectives
decisions/ Architectural decisions and decision trees
execution/ Executable code, scripts, and build artifacts
tmp/ Temporary generation outputs

Directives

Directives explain what should be done.

They may contain:

  • Objectives.
  • Inputs.
  • Expected outputs.
  • Step-by-step procedures.
  • Edge cases.
  • Business rules.
  • Quality requirements.

Decisions

Decision documents explain how choices should be made.

They may contain:

  • Conditional logic.
  • Selection criteria.
  • Architectural decisions.
  • Policies.
  • Routing rules.
  • Escalation conditions.

Execution

Execution contains the operational implementation.

It may contain:

  • Scripts.
  • Automation workflows.
  • Build files.
  • Data-processing code.
  • Integration logic.
  • Generated operational artifacts.

Environment Variables

The .env file stores sensitive configuration such as:

  • API keys.
  • Passwords.
  • Authentication tokens.
  • Service credentials.
  • Environment-specific settings.

Do not commit secrets to a public repository.

CLAUDE.md
  -> Project Instructions

directives/
  -> Business Procedures

decisions/
  -> Logic and Policies

execution/
  -> Operational Implementation

.env
  -> Secrets and Configuration

Initializing a New Project

Method 1: Create CLAUDE.md First

For a new project:

  1. Create a project folder.
  2. Create a CLAUDE.md file.
  3. Describe the project.
  4. Define the technology stack.
  5. Add rules and guardrails.
  6. Describe the folder structure.
  7. Ask Claude Code to initialize the project.
  8. Review the generated directories and files.
Create Empty Workspace
        |
        v
Write CLAUDE.md
        |
        v
Define Architecture and Rules
        |
        v
Ask Claude Code to Initialize
        |
        v
Create Directories and Files
        |
        v
Review Workspace

A generalized initialization prompt is:

Initialize this project based on the instructions in CLAUDE.md.

Create the required folder structure, configuration files,
and initial documentation. Do not introduce technologies
that are not specified in CLAUDE.md.

Explain what you create and identify anything that requires
my approval.

Method 2: Initialize an Existing Repository

For an existing repository, run:

/init

Claude Code analyzes the repository and generates an initial CLAUDE.md file.

The workflow is:

  1. Open the existing project folder.
  2. Start Claude Code.
  3. Run /init.
  4. Allow Claude Code to inspect the repository.
  5. Review the generated CLAUDE.md.
  6. Correct inaccurate assumptions.
  7. Add missing rules and conventions.
  8. Continue working with the refined project instructions.
Existing Project
        |
        v
Run /init
        |
        v
Inspect Files and Folders
        |
        v
Generate CLAUDE.md
        |
        v
Review and Refine
        |
        v
Continue Project Work
Project scenario Recommended method
New project with no structure Create CLAUDE.md, then initialize the project
Existing project with files and folders Run /init, then review the generated file

Module 2: Customization

Skills Architecture

Skills are reusable, step-by-step instruction packages that guide Claude Code through complex procedures.

Examples include:

  • Frontend design.
  • Diagram creation.
  • Lead extraction.
  • Data analysis.
  • Content generation.
  • Research workflows.
  • Deployment procedures.
  • Testing and verification.

A skill allows a procedure to be reused without rewriting the complete prompt every time.

Skill Directory Layout

Custom skills are stored in the .claude/skills/ directory.

.claude/
└── skills/
    └── lead-generation-system/
        ├── SKILL.md
        ├── references/
        └── scripts/
Path Purpose
SKILL.md Main skill instructions and metadata
references/ Templates, examples, guidelines, and supporting documents
scripts/ Optional Python, JavaScript, or shell automation scripts

Use a descriptive directory name instead of a generic / directory.

Anatomy of a SKILL.md File

A skill file typically contains YAML metadata followed by Markdown instructions.

***
name: lead-generation-system
description: Extracts and qualifies business leads from a target market.
***

# Lead Generation System

## Prerequisites

- Apify API token configured in `.env`.
- Required scraping permissions.
- Target niche and location.
- Desired result limit.

## Inputs

- Target niche.
- Geographic area.
- Maximum number of leads.
- Qualification criteria.

## Procedure

1. Fetch target leads using the configured scraper.
2. Filter results to retain entries containing website and phone details.
3. Extract content from home, about, and service pages.
4. Analyze the extracted value propositions.
5. Export the cleaned dataset to CSV.

## Outputs

- Qualified lead dataset.
- Source URLs.
- Contact information.
- Qualification notes.
- CSV export.

## Quality Checks

- Confirm that required fields are present.
- Remove duplicate businesses.
- Verify that URLs are valid.
- Record failed extraction attempts.

Skill Design Principles

A reliable skill should specify:

  • Its purpose.
  • When it should be triggered.
  • Required inputs.
  • Prerequisites.
  • Step-by-step procedure.
  • Expected outputs.
  • Error-handling behavior.
  • Quality checks.
  • File locations.
  • Security requirements.

Automated Skill Creation and Evaluation

Skill Creation

The skill-creator workflow can be used to generate a new skill from an existing successful procedure.

A skill may be created by:

  • Installing an official skill-creation plugin.
  • Asking Claude Code to convert a successful workflow into a reusable skill.
  • Extracting repeated instructions from a project.
  • Turning a manual SOP into structured instructions.

Evaluation Framework

Automated evaluations help determine whether a skill:

  • Recognizes the correct user intent.
  • Follows the required procedure.
  • Produces the expected output.
  • Respects formatting requirements.
  • Handles edge cases.
  • Avoids triggering for unrelated requests.

A possible evaluation structure is:

.claude/
└── skills/
    └── lead-generation-system/
        ├── SKILL.md
        └── evals/
            ├── eval.json
            └── trigger_eval.json
Evaluation file Purpose
eval.json Tests the skill’s output and execution behavior
trigger_eval.json Tests whether the skill triggers for appropriate prompts

A typical evaluation loop is:

Create Skill
    |
    v
Run Evaluation Cases
    |
    v
Measure Pass/Fail Results
    |
    v
Identify Weaknesses
    |
    v
Update SKILL.md
    |
    v
Run Evaluations Again

Evaluation metrics may include:

  • Pass rate.
  • Output completeness.
  • Format compliance.
  • Intent-recognition accuracy.
  • Error-handling quality.
  • Correct file placement.
  • Required-field coverage.

Custom Slash Commands

Custom slash commands provide short commands for invoking predefined skills or workflows.

Command Directory Layout

Custom commands are stored in .claude/commands/.

.claude/
└── commands/
    ├── generate-titles.md
    └── lead-gen.md

Command Mapping Example

The file .claude/commands/lead-gen.md may contain:

When the user calls `/lead-gen`, invoke the
`lead-generation-system` skill.

Ask for:

- Target niche.
- Geographic location.
- Desired result limit.

Then execute the skill and save the output
to the project's designated output directory.

Invoking a Custom Command

Once the command is configured, the user can run:

/lead-gen

The command can then:

  1. Ask for missing inputs.
  2. Load the relevant skill.
  3. Execute the defined workflow.
  4. Validate the output.
  5. Save the results to the correct location.
/lead-gen
    |
    v
Load Lead Generation Skill
    |
    v
Collect Required Inputs
    |
    v
Run Workflow
    |
    v
Validate Results
    |
    v
Save Output

Event-Driven Hooks

Hooks execute automatic actions at specific Claude Code lifecycle events.

They can be used to:

  • Validate commands before execution.
  • Format files after edits.
  • Run tests after code changes.
  • Send notifications when a task finishes.
  • Record errors.
  • Trigger cleanup procedures.
  • Enforce project rules.

Hook Configuration

Hooks may be configured in a Claude Code settings file such as .claude/settings.json.

A conceptual notification example is:

{
  "hooks": {
    "post_response": [
      {
        "type": "command",
        "command": "osascript -e 'display notification \"Claude Code task complete!\" with title \"Claude Code\"'"
      }
    ]
  }
}

Platform note: The osascript command is specific to macOS. Windows and Linux require different notification mechanisms.

Common Lifecycle Triggers

Trigger Typical use
Pre-tool use Validate or authorize an action before execution
Post-tool use Format files, update logs, or perform cleanup
Post-tool-use failure Send alerts or record diagnostic information
Post-response Notify the user when Claude finishes a task

Hook Flow

Claude Code Event
        |
        v
+----------------------+
| Match Hook Trigger   |
+----------------------+
        |
        v
+----------------------+
| Execute Command or   |
| Automation Script    |
+----------------------+
        |
        v
+----------------------+
| Continue, Notify,    |
| Log, or Block Action |
+----------------------+

Hook Safety

Hooks can execute commands automatically, so they should be designed carefully.

Recommended safeguards include:

  • Validate input before executing commands.
  • Avoid destructive shell commands.
  • Restrict access to sensitive files.
  • Log important actions.
  • Handle failures explicitly.
  • Test hooks in a sandbox.
  • Require approval for high-impact operations.
  • Avoid embedding credentials directly in configuration files.

Formatting and Maintenance Notes

  • Use CLAUDE.md consistently for project-level instructions.
  • Use uppercase SKILL.md for skill files unless the project convention specifies otherwise.
  • Use descriptive directory names.
  • Keep tables compact enough to render on mobile screens.
  • Use blank lines before and after every table.
  • Do not place blank lines inside a table unless the table is intentionally split.
  • Keep each table cell concise.
  • Use <br> only when a cell genuinely requires multiple lines.
  • Prefer separate tables over very wide tables.
  • Keep code fences closed and separated from surrounding paragraphs.
  • Use backticks for commands, filenames, paths, and code identifiers.
  • Avoid using HTML line breaks inside ordinary prose.

This site uses Just the Docs, a documentation theme for Jekyll.