Claude Code & MCP MasterclassModule 1

1.1Claude Code Setup & First Commands — From Install to First Project

30 min 17 code blocks Practice Lab Quiz (4Q)

Claude Code Setup & First Commands

Claude Code is Anthropic's official command-line interface (CLI) for Claude. It transforms your terminal into an AI-assisted development environment. In 2026, developers who master Claude Code automate 60% of their coding time. This lesson teaches you to install, configure, and execute your first projects using Claude Code.

Installation & Setup (10 Minutes)

Step 1: Install Node.js (if not already installed)

  • Download from nodejs.org
  • Install Node 18+ (includes npm)
  • Verify: Open terminal, run node --version and npm --version

Step 2: Install Claude Code

bash
npm install -g @anthropic-ai/claude-code

Verify installation:

bash
claude --version

Expected output: Claude Code v1.x.x

Step 3: Set API Key

bash
claude auth login

This opens a browser. Log in with your Anthropic account, authorize the app, get API key. Paste key into terminal. Claude Code stores it locally in ~/.claude/config.json.

Step 4: Verify Installation

bash
claude --help

You should see list of commands: init, run, chat, project, memory, etc.

Your First Project (30 Minutes)

Let's create a simple CLI tool: "Daily Standup Generator"—converts work log into a professional standup update.

Step 1: Initialize Project

bash
mkdir daily-standup && cd daily-standup
claude init

Claude creates project structure:

code
daily-standup/
├── claude.json       (project config)
├── CLAUDE.md         (project instructions)
├── .claude/
│   └── memory/       (persistent memory folder)
├── main.py           (your code)
└── requirements.txt  (dependencies)

Step 2: Write Your First Prompt Open CLAUDE.md (project instructions) and replace with:

markdown
# Daily Standup Generator

## Purpose
Transform a work log into a professional standup update.

## Input
Plain English list of tasks: "Fixed login bug. Added database migration. Code reviewed 3 PRs."

## Output
Professional standup: "Yesterday: Resolved critical login authentication issue. Executed database migration v2. Reviewed 3 pull requests for quality assurance."

## Rules
- Keep it concise (under 100 words)
- Use professional language
- Include any blockers or risks

Step 3: Execute a Task

bash
claude run "Convert this work log to a standup: Fixed payment bug. Started API documentation. Attended team meeting."

Claude analyzes your CLAUDE.md, understands task, and outputs: "Yesterday: Resolved payment processing issue and initiated comprehensive API documentation. Participated in team sync to align on priorities. No blockers."

Step 4: Create main.py

bash
claude code "Create a Python CLI that takes a work log and outputs a standup update. Save to main.py"

Claude generates Python code:

python
#!/usr/bin/env python3
import sys
from anthropic import Anthropic

client = Anthropic()
conversation_history = []

def generate_standup(work_log):
    conversation_history.append({
        "role": "user",
        "content": f"Convert this work log to a professional standup update: {work_log}"
    })

    response = client.messages.create(
        model="claude-3-5-sonnet-20241022",
        max_tokens=200,
        system="You are a professional standup writer. Convert work logs into concise, professional standup updates.",
        messages=conversation_history
    )

    standup = response.content[0].text
    conversation_history.append({
        "role": "assistant",
        "content": standup
    })

    return standup

if __name__ == "__main__":
    if len(sys.argv) < 2:
        print("Usage: python main.py '<work log>'")
        sys.exit(1)

    work_log = sys.argv[1]
    standup = generate_standup(work_log)
    print("Standup Update:")
    print(standup)

Step 5: Test It

bash
python main.py "Fixed auth bug. Started API docs. Reviewed 3 PRs. Blocked on database migration."

Output: "Yesterday: Resolved critical authentication issue and initiated API documentation. Completed code review for 3 pull requests. Awaiting database migration assistance to proceed with next sprint items."

Perfect. You've built your first AI-assisted CLI in 30 minutes.

Core Claude Code Commands

Interactive Chat

bash
claude chat

Opens interactive terminal where you chat with Claude. Type questions, Claude responds. Type exit to quit. Useful for brainstorming and debugging.

Run Specific Queries

bash
claude run "Explain how blockchain works"

One-off query. Claude answers and exits.

Code Generation

bash
claude code "Create a function that calculates compound interest"

Claude generates code, saves to generated_code.py or suggested_changes.py.

Project Memory

bash
claude memory add "The user prefers Python over JavaScript"

Saves context. All future Claude commands reference this memory.

Review & Iterate

bash
claude review main.py

Claude audits your code, suggests improvements.

Pakistan-Specific Example

Pakistani developer Bilal uses Claude Code to build a WhatsApp bot:

bash
cd whatsapp-bot
claude init
# Create CLAUDE.md:
# WhatsApp Bot for Pakistani E-commerce
# Purpose: Reply to customer inquiries, process orders
# Input: Customer WhatsApp message
# Output: Appropriate response (order status, pricing, support)

claude run "Create a WhatsApp bot handler that replies to order status inquiries"

Claude generates Python code using WATI API. Bilal tests it. In 2 hours, he has a functional WhatsApp bot. Without Claude Code, this would take 8 hours of debugging and Stack Overflow browsing.

Practice Lab

Practice Lab

Task 1: Setup & First CLI — Install Claude Code. Create a project called "my-first-claude". Write CLAUDE.md with a clear purpose (e.g., "Convert Urdu text to English"). Run one command using claude run. Take screenshot of successful output.

Task 2: Code Generation — Use claude code to generate a Python script for a task in your niche. Test the generated code. Document any changes you made (additions, fixes, customizations).

Key Takeaways

Claude Code turns you into a 10x developer:

  • Spend time on architecture, not boilerplate
  • Leverage Claude's code understanding for debugging
  • Iterate fast with AI feedback
  • Build more, code less

Master this tool, and you'll automate yourself out of routine coding work by 60% within 3 months.

Lesson Summary

Includes hands-on practice lab17 runnable code examples4-question knowledge check below

Claude Code Setup & First Commands Quiz

4 questions to test your understanding. Score 60% or higher to pass.