Skip to content
YanX
All writing

Research Notes

Anthropic Developer Courses: Claude API, Agent Skills, Claude Code & MCP

Notes from Anthropic's developer-focused courses: Building With The Claude API, Introduction To Agent Skills, Claude Code In Action, and Model Context Protocol.

Published Updated 4 min read

Note: My notes from Anthropic's developer-focused courses: Building With The Claude API, Introduction To Agent Skills, Claude Code In Action, Introduction To Model Context Protocol, and MCP Advanced Topics. All free at anthropic.skilljar.com.


🔌 1. Building With The Claude API

This course covers everything you need to integrate Claude into your own applications using the Anthropic API.

Getting Started

pip install anthropic

Your first API call:

import anthropic

client = anthropic.Anthropic(api_key="your-api-key")

message = client.messages.create(
    model="claude-opus-4-5",
    max_tokens=1024,
    messages=[
        {"role": "user", "content": "Explain transformers in one paragraph."}
    ]
)
print(message.content[0].text)

Key Concepts

Models — Anthropic offers a model family with different capability/cost tradeoffs:

Model Best For
claude-opus-4-5 Complex reasoning, difficult tasks
claude-sonnet-4-5 Balanced speed and intelligence
claude-haiku-3-5 Fast, cost-effective for simpler tasks

Messages API — conversations are structured as an array of {role, content} objects:

messages = [
    {"role": "user", "content": "What is 2 + 2?"},
    {"role": "assistant", "content": "4"},
    {"role": "user", "content": "Multiply that by 10."}
]

System Prompts — set Claude's persona, constraints, and context:

message = client.messages.create(
    model="claude-sonnet-4-5",
    max_tokens=512,
    system="You are a concise technical writer. Respond in bullet points only.",
    messages=[{"role": "user", "content": "Explain REST APIs."}]
)

Streaming — for real-time output:

with client.messages.stream(
    model="claude-sonnet-4-5",
    max_tokens=512,
    messages=[{"role": "user", "content": "Write a poem."}]
) as stream:
    for text in stream.text_stream:
        print(text, end="", flush=True)

Vision (Multimodal)

Send images alongside text:

import base64

with open("image.jpg", "rb") as f:
    image_data = base64.standard_b64encode(f.read()).decode("utf-8")

message = client.messages.create(
    model="claude-opus-4-5",
    max_tokens=1024,
    messages=[{
        "role": "user",
        "content": [
            {"type": "image", "source": {"type": "base64", "media_type": "image/jpeg", "data": image_data}},
            {"type": "text", "text": "Describe this image."}
        ]
    }]
)

🤖 2. Introduction To Agent Skills

Agents are AI systems that can take actions — not just answer questions.

What Makes an Agent?

flowchart LR
    P["👁️ Perceive\n(input/tool result)"]:::step --> R["🧠 Reason\n(decide next action)"]:::step
    R --> A["⚡ Act\n(call tool / output)"]:::step
    A --> O["📊 Observe\n(result)"]:::step
    O --> P

    classDef step fill:#4A90D9,stroke:#2c5f8a,color:#fff

An agent is a loop:

  1. Perceive — receive input (user message, tool result, environment state)
  2. Reason — decide what to do next
  3. Act — call a tool, produce output, or ask for clarification
  4. Observe — receive the result of the action
  5. Repeat until the task is complete

Tool Use (Function Calling)

Define tools as JSON schemas:

tools = [
    {
        "name": "get_weather",
        "description": "Get the current weather for a city.",
        "input_schema": {
            "type": "object",
            "properties": {
                "city": {"type": "string", "description": "City name"}
            },
            "required": ["city"]
        }
    }
]

response = client.messages.create(
    model="claude-opus-4-5",
    max_tokens=1024,
    tools=tools,
    messages=[{"role": "user", "content": "What's the weather in Singapore?"}]
)

When Claude wants to call the tool, it returns a tool_use block. You execute the tool and return the result:

if response.stop_reason == "tool_use":
    tool_call = next(b for b in response.content if b.type == "tool_use")
    result = get_weather(tool_call.input["city"])
    messages.append({"role": "assistant", "content": response.content})
    messages.append({
        "role": "user",
        "content": [{"type": "tool_result", "tool_use_id": tool_call.id, "content": result}]
    })

Agentic Patterns

  • ReAct — Reason + Act in alternating steps
  • Plan and Execute — decompose task into subtasks, execute each
  • Multi-agent — multiple Claude instances with different roles collaborating

💻 3. Claude Code In Action

Claude Code is Anthropic's agentic coding tool that runs in your terminal, reads your codebase, and makes real edits.

Setup

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

Core Workflow

Claude Code operates with broad file system access. You describe what you want, and it reads, edits, runs, and iterates:

> Add input validation to the login form in src/auth/login.py

Key Commands

Command What it does
/help Show all commands
/memory View and edit Claude's memory of your project
/review Request a code review of recent changes
Shift+Tab Toggle auto-accept mode

Tip: Use CLAUDE.md — place a CLAUDE.md in your project root with conventions, stack details, and style preferences. This single file dramatically improves output quality.


🔌 4. Introduction To Model Context Protocol (MCP)

MCP is an open protocol that standardises how AI models connect to external data sources and tools. Think of it as USB-C for AI integrations.

Why MCP?

Before MCP, every AI integration was bespoke — a different API, schema, and auth mechanism per tool. MCP defines a standard interface so any MCP-compatible AI can connect to any MCP server.

Architecture

flowchart LR
    C["🤖 Claude\n(MCP Client)"]:::client <--> S["🖥️ MCP Server"]:::server
    S <--> D["📦 Data Source\n/ Tool"]:::data

    classDef client fill:#4A90D9,stroke:#2c5f8a,color:#fff
    classDef server fill:#9B6EBD,stroke:#6b4785,color:#fff
    classDef data fill:#5BA85A,stroke:#3a6e39,color:#fff

Three primitives:

  • Resources — data the server exposes (files, database rows, API responses)
  • Tools — actions Claude can invoke (run a query, send a message, create a file)
  • Prompts — reusable prompt templates

Building a Simple MCP Server (Python)

from mcp.server import Server
from mcp.server.stdio import stdio_server
from mcp.types import Tool, TextContent

app = Server("my-server")

@app.list_tools()
async def list_tools():
    return [
        Tool(
            name="get_time",
            description="Returns the current time",
            inputSchema={"type": "object", "properties": {}}
        )
    ]

@app.call_tool()
async def call_tool(name: str, arguments: dict):
    if name == "get_time":
        from datetime import datetime
        return [TextContent(type="text", text=datetime.now().isoformat())]

async def main():
    async with stdio_server() as streams:
        await app.run(*streams)

Connecting to Claude Desktop

Add to ~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "my-server": {
      "command": "python",
      "args": ["/path/to/your/server.py"]
    }
  }
}

🔧 5. Model Context Protocol: Advanced Topics

Authentication & Security

@app.call_tool()
async def call_tool(name: str, arguments: dict):
    # Always validate inputs
    if not isinstance(arguments.get("query"), str):
        raise ValueError("query must be a string")
    # Sanitise before passing to databases or shell

Warning: Always validate MCP tool inputs. MCP servers can be called by any connected AI client — treat them like a public API.

Remote MCP Servers (HTTP/SSE)

For production deployments, use HTTP transport instead of stdio:

from mcp.server.sse import SseServerTransport
from starlette.applications import Starlette

transport = SseServerTransport("/messages")
# Mount to a web framework like Starlette or FastAPI

Multi-Server Composition

One Claude client can connect to multiple MCP servers simultaneously — e.g., a file system server + a database server + a web search server, all available in the same conversation.


💡 Key Takeaways

  1. The API is simple — a few lines of Python gets you a working Claude integration
  2. Tool use unlocks agentic power — Claude can coordinate complex multi-step tasks when given the right tools
  3. MCP standardises AI integrations — invest in MCP servers once, use across any compatible client
  4. Claude Code changes how you code — it's not autocomplete; it's a collaborator that understands your whole codebase
  5. Security matters — validate tool inputs, don't expose sensitive APIs without auth

Source: Anthropic Learning Platform · Anthropic Docs · MCP Spec


Part of my Anthropic developer notes series. Next: building production-grade MCP servers with authentication and remote HTTP transport.

Tags

  • #Anthropic
  • #MCP

Found this useful? Leave a like.