Understand AI, understand Claude, and learn to wield it well.
A single, honest walkthrough of what these systems actually are — the plain-English version and the under-the-hood version, side by side. Written for everyone; tuned for people who build.
What is AI, really?
Strip away the marketing and "AI" means one thing: software that learns patterns from data instead of being told every rule by a programmer.
For most of computing history, software did exactly what a human wrote down: if this, then that. A tax program knows the tax rules because someone typed them in. Artificial intelligence flips that. Instead of hand-writing the rules, you show the system thousands (or billions) of examples and let it infer the patterns itself.
That single shift — from programmed to learned — is why AI can do fuzzy things traditional code is terrible at: recognizing a cat in a photo, translating a sentence, or writing a paragraph that sounds human. Nobody can write down the exact rules for "what makes a sentence sound natural." But a system can learn them from enough examples.
The nested vocabulary
These words get used interchangeably in the press, but they nest inside each other like Russian dolls. Getting them straight is the fastest way to sound like you know what you're talking about.
Artificial Intelligence
The whole field — any technique that makes machines do things we'd call "intelligent." The outer doll.
Machine Learning
The dominant approach inside AI: learn patterns from data rather than following explicit rules.
Deep Learning
ML using neural networks with many layers. Powers modern vision and language.
Large Language Models
Deep-learning models trained on huge amounts of text to predict and generate language. Claude is one.
Generative AI (like Claude, ChatGPT, or image models) creates new content — text, code, images. Predictive / discriminative AI (spam filters, fraud detection, recommendation engines) classifies or scores existing things. Both are AI; only the first writes you an essay.
For developers: what actually changed
If you write software, the mental-model shift is this: a large language model is a probabilistic function, not a deterministic one. You call it with text, it returns text — but the same input can produce different outputs, and it has no database it "looks things up" in. It generates a plausible continuation based on patterns learned during training.
That has two immediate consequences you'll feel every day:
- It can be wrong with total confidence. There's no internal "I don't know" flag unless the behavior was trained in. (More on hallucination in the next chapter.)
- It's stateless between calls. The model doesn't remember your last request unless you send that history back to it every time. Everything it "knows" about your conversation lives in the context window you provide.
AI isn't a robot brain that "knows" things. It's an extraordinarily good pattern-completer trained on a large slice of human writing. Astonishingly capable, occasionally confidently wrong, and always worth verifying on things that matter.
The concepts that actually matter
The working vocabulary. Learn these dozen ideas and almost every AI headline, product page, and API doc becomes legible.
Tokens — the atoms of the model
Models don't read letters or words. They read tokens — chunks of text, usually a few characters long. Common words are often one token; rarer words split into pieces. As a rough rule of thumb in English, 1 token ≈ 4 characters ≈ ¾ of a word.
Tokens are the unit of everything: context limits are measured in tokens, and you're billed per token in and per token out. Type below to see roughly how text gets carved up.
This is a simplified splitter for intuition. Real tokenizers (like Claude's) use byte-pair encoding and are model-specific. For exact counts, use a token-counting endpoint — never an estimate from a different model's tokenizer, which can be off by 20%+.
The context window — the model's short-term memory
The context window is everything the model can "see" in a single request: your system instructions, the conversation so far, any documents you pasted, and the answer it's writing. It's measured in tokens, and it's finite.
Today's frontier models have very large windows — Claude's current models offer up to 1 million tokens (roughly a 700,000-word book). But large doesn't mean infinite, and — crucially — bigger isn't automatically better.
Keep adding turns and watch what happens as the window fills.
Context rot — the failure mode nobody warns you about
Context rot is the observed decline in an AI's reliability as its context window fills up. More text in the window isn't free: the model can lose track of instructions buried in the middle, contradict things said thousands of tokens earlier, or fixate on stale details. Quality can degrade well before you hit the hard token limit.
The practical implication is counterintuitive: curating what's in the window beats cramming it full. A focused 20K-token context often outperforms a bloated 500K-token one on the same task.
Compaction (summarize old turns into a shorter form), context editing (prune stale tool outputs), retrieval (pull in only the relevant snippet, not the whole doc), and simply starting fresh when a conversation has drifted. Claude Code and the Claude API expose several of these directly.
Models, parameters & weights
A model is the trained artifact you actually call — a giant grid of numbers called parameters (or weights) that encode everything it learned. "Bigger model" usually means more parameters, which tends to mean more capability but also more cost and latency. That's why model families exist: a range from fast-and-cheap to slow-and-brilliant, so you can match the model to the job.
The rest of the vocabulary, defined
- Training pretraining → fine-tuning
- Pretraining is the expensive phase: predict-the-next-token over a vast text corpus, learning language and world knowledge. Fine-tuning then shapes that raw model toward being helpful, honest, and safe on specific tasks.This is why a model has a "knowledge cutoff" — it only knows what was in its training data.
- Inference
- The act of running the trained model to get an output. Every time you send a prompt, that's one inference. It's what you pay for and wait on.
- Temperature
- A dial (roughly 0–1) on how random the model's word choices are. Low = focused and repeatable; high = varied and creative. See the demo below.Note: newer frontier models increasingly manage this internally rather than exposing a raw dial.
- Hallucination
- When the model produces confident, fluent text that is simply false — an invented citation, a wrong date, a fabricated API. Not lying; just pattern-completion gone off-distribution.The single biggest reason to verify AI output on anything consequential.
- Prompt + system prompt
- The prompt is your input. The system prompt is a higher-priority instruction set that frames the whole conversation ("You are a careful code reviewer…") and shapes tone, rules, and role.
- Embeddings
- Text (or images) turned into a list of numbers that captures meaning, so that similar things sit close together in mathematical space. The engine behind semantic search and retrieval.
- RAG retrieval-augmented generation
- Instead of relying on training memory, fetch relevant documents at query time and feed them into the context. How you get an AI to answer from your data accurately and with citations.
- Tool use function calling
- Letting the model call real functions — search the web, run code, query a database, send an email. The model decides when and with what arguments; your code executes and returns the result.
- Agents
- A model in a loop: it takes an action (via a tool), observes the result, decides the next action, and repeats until a goal is met. Claude Code is an agent for software tasks.
- MCP Model Context Protocol
- An open standard for connecting models to external tools and data sources through a common interface — think "USB-C for AI tools." Introduced by Anthropic, now widely adopted.
- Reasoning / "thinking"
- Modern models can spend extra tokens working through a problem step-by-step before answering. More thinking generally means better answers on hard tasks, at the cost of more tokens and latency.
- Multimodal
- A model that handles more than text — reading images, PDFs, and diagrams alongside your words. Claude's current models are multimodal on input.
What is Claude?
Claude is a family of large language models built by Anthropic, an AI-safety company. The name matters less than the philosophy behind it.
Claude is Anthropic's family of AI models. You can talk to it in a chat app, call it through an API, or let it work directly in your codebase via Claude Code. Under the hood it's an LLM like the ones described above — but its defining trait is an unusually strong emphasis on being helpful, honest, and harmless.
Anthropic was founded in 2021 by researchers focused on making powerful AI systems reliable and steerable. That safety-first framing isn't just branding — it shows up in how Claude is trained and how it behaves.
Constitutional AI — Claude's distinctive training idea
Most assistants are aligned largely through RLHF, where humans rate thousands of responses. Anthropic pioneered a complementary technique called Constitutional AI: the model is given an explicit set of written principles (a "constitution") and trained to critique and revise its own outputs against them. It learns to self-correct toward stated values rather than relying only on human labelers for every judgment.
The practical upshot: Claude tends to be candid about uncertainty, reluctant to help with genuinely harmful requests, and willing to push back — while still being a capable partner for the enormous space of legitimate technical, creative, and analytical work.
The model family — matching the model to the job
Claude ships as a tiered family so you can trade capability against speed and cost. The tiers are stable ideas even as version numbers advance:
Opus — the flagship
The most capable tier. For the hardest reasoning, long-horizon agentic work, and complex coding. Highest cost and latency.
Sonnet — the workhorse
The balanced default. Near-flagship quality on most coding and everyday tasks at a fraction of the cost. Where most work lives.
Haiku — the sprinter
Fastest and cheapest. Ideal for high-volume, latency-sensitive, or simpler tasks where speed beats raw depth.
| Model | Tier | Context | Best for |
|---|---|---|---|
| Claude Opus 4.8 | Flagship | 1M | Deep reasoning, autonomous agents, hard code |
| Claude Sonnet 5 | Balanced | 1M | Everyday coding & knowledge work — the default |
| Claude Haiku 4.5 | Fast | 200K | High-volume, low-latency, simpler tasks |
Anthropic's naming is tier + version — "Opus 4.8" is the Opus tier at version 4.8. Higher versions are newer and generally more capable across the board. When in doubt, start with Sonnet: it's the sweet spot for the vast majority of work. Reach for Opus when a task is genuinely hard, Haiku when volume and speed dominate.
How Claude actually works
Two lenses on the same machine. First the one-sentence version, then the real pipeline for readers who want the mechanism.
Claude reads your text as tokens, and repeatedly predicts the single most plausible next token — one at a time — until it has composed a complete, coherent response.
That's genuinely the core loop. Everything else is detail about how it predicts so well. The answer is an architecture called the Transformer — the 2017 breakthrough behind essentially every modern LLM.
The inference pipeline, step by step
Attention — the idea that made it all work
The Transformer's superpower is the attention mechanism. When processing each token, the model weighs how much every other token in the context should influence it. In the sentence "The trophy didn't fit in the suitcase because it was too big," attention is how the model figures out that "it" refers to the trophy, not the suitcase.
Scaled across billions of parameters and a giant context window, this ability to dynamically relate every piece of text to every other piece is what produces the eerie coherence of modern models.
How a raw model becomes Claude
Because Claude predicts plausible continuations, it has no built-in fact-checker and no live access to the world unless you give it tools. That's why it can hallucinate, why it has a knowledge cutoff, and why grounding it with retrieval, tools, and verification matters so much in practice. The architecture is the reason for the caveats.
How to use Claude
There are three front doors — a chat app, an API, and a coding agent. Pick by what you're trying to do.
Claude apps
The web, desktop, and mobile chat interface at claude.ai. Zero setup. Best for writing, thinking, research, analysis, and learning — including uploading documents and images.
Claude Code
An agentic coding tool that lives in your terminal and IDE. It reads your codebase, edits files, runs commands, and ships features. The developer's daily driver.
The API
Programmatic access for building Claude into your own products — chatbots, pipelines, agents. Available in every major language via official SDKs.
Prompting — the one skill that transfers everywhere
Whichever door you use, the quality of what you get out is tied to the quality of what you put in. Good prompting isn't magic incantations — it's clear communication with an eager, literal, knowledgeable collaborator. Five habits cover most of it:
1 · Give role & context
Say who Claude should be and why you're asking. "You're a senior Postgres DBA reviewing this migration for a high-traffic app" beats "check this SQL."
2 · Be specific about the output
State the format, length, and audience. Want a table? A one-paragraph summary? Code with no explanation? Ask for it explicitly.
3 · Show, don't just tell
One or two examples of the input→output you want ("few-shot" prompting) steers the model far more reliably than adjectives.
4 · Let it think
For hard problems, ask it to reason step by step before answering, or hand it the full task up front so it can plan.
5 · Iterate
Treat the first response as a draft. Point at what's wrong specifically — "too formal," "you missed the edge case where X" — and refine.
6 · Give it the "why"
Explaining the goal behind a request ("this is for execs who'll skim it") helps Claude make better judgment calls you didn't spell out.
Under-specifying ("make it better" — better how?), burying the ask in a wall of context, trusting without verifying on facts and figures, and letting one chat run forever until context rot sets in. Start a fresh conversation when the topic shifts.
A first look at the API
For developers, calling Claude is a few lines. Here's the shape of it (Python), so the pieces from earlier chapters click into place:
# pip install anthropic from anthropic import Anthropic client = Anthropic() # reads your API key from the environment message = client.messages.create( model="claude-sonnet-5", # pick a tier for the job max_tokens=1024, # cap the response length (in tokens) system="You are a concise technical writer.", # system prompt messages=[ {"role": "user", "content": "Explain context rot in two sentences."} ], ) print(message.content[0].text)
You choose a model, set a system prompt, and pass the conversation as a list of messages. Because the API is stateless, you send the full history each turn — the model's memory is exactly the context you provide. Everything from Chapter 2 is right there in the call.
Becoming a Claude expert
Fluency isn't knowing more trivia — it's building the instincts and the tooling to get consistently great results, especially with Claude Code.
The path, in five rungs
Conversational
You get useful answers from the chat app and can refine them. You know to verify facts and start fresh when a chat drifts.
Deliberate prompter
You reach for roles, examples, and explicit output specs by reflex. You match the model tier to the task and know when to let Claude think longer.
Claude Code operator
You drive real work in the terminal — plan mode, precise scoping, reviewing diffs — and treat Claude as a fast, tireless pair-programmer, not an oracle.
System builder
You extend Claude with custom skills, subagents, MCP servers, and hooks. You design context deliberately and automate your workflows.
Force multiplier
You orchestrate agents, evaluate outputs rigorously, and teach others. You know the failure modes cold and design around them.
Claude Code — the expert's toolkit
This is where developers compound their leverage. The features below turn Claude Code from a chatbot in a terminal into a customizable, automatable engineering partner.
- CLAUDE.md
- A project file where you record how your codebase works, conventions to follow, and commands to run. Loaded automatically — it's how Claude learns your project's rules once instead of every session.
- Plan mode
- Have Claude research and propose a plan before it touches a single file. You approve or adjust, then it executes. The single biggest lever for quality on non-trivial tasks.
- Skills
- Packaged instructions and assets for a repeatable task, loaded on demand when relevant. Teach Claude your team's exact procedure for, say, writing migrations or reviewing PRs — once.
- Subagents
- Spawn focused helper agents for parallel or independent work — one exploring the codebase while another writes tests — each with its own clean context. Parallelism without context rot.
- MCP servers
- Connect Claude to external systems — GitHub, databases, your ticket tracker, internal APIs — through the Model Context Protocol. This is how Claude reaches beyond your local files.
- Hooks
- Shell commands the harness runs automatically at defined moments (e.g. run the linter after every edit, or block a risky command). Automation that you control, not the model.
- Slash commands
- Reusable prompts you invoke with
/name— your own/review,/ship, or/standup. Turn a great prompt you keep retyping into a one-word command. - Memory & context hygiene
- Persist durable facts across sessions, and actively manage what's in the window — compact, clear, or restart. Experts treat context as a resource to curate, not a bucket to fill.
The mindset that separates experts
Verify, then trust
Experts assume any factual or numerical claim needs checking, and build that check into the workflow — tests, review, a second pass — rather than hoping.
Design the context
They decide deliberately what goes into the window and what stays out. Less, but more relevant, beats more of everything.
Right-size the task
They scope requests so a single agent turn can succeed, and break big goals into verifiable steps — instead of asking for a mountain and getting rubble.
Evaluate honestly
They test prompts and workflows against real examples and keep what measurably works, rather than trusting vibes or a single lucky run.
Know the failure modes
Hallucination, context rot, over-eager edits, literal instruction-following. Naming a failure mode is the first step to designing around it.
Stay current, stay skeptical
Models and tools move fast. Experts re-check assumptions on new releases and read the docs rather than relying on last year's mental model.
An expert isn't someone who trusts Claude more — it's someone who understands exactly where it's brilliant and where it's brittle, and builds their tools and habits so the brilliance compounds and the brittleness is caught.
Pocket glossary
Every term in this guide, in one place, for quick reference.
- Agent
- A model running in an act–observe–decide loop toward a goal.
- Alignment
- Training a model to behave in line with human intentions and values.
- Attention
- The mechanism letting each token weigh the influence of every other token.
- Constitutional AI
- Anthropic's method of aligning a model against a written set of principles.
- Context window
- All the tokens a model can see in one request.
- Context rot
- Reliability decline as the context window fills with too much or stale content.
- Embedding
- A numeric vector representing the meaning of text or images.
- Fine-tuning
- Adapting a pretrained model toward specific behaviors or tasks.
- Hallucination
- Confident, fluent output that is factually wrong or fabricated.
- Inference
- Running a trained model to produce an output.
- LLM
- Large Language Model — a text-trained deep-learning model.
- MCP
- Model Context Protocol — open standard connecting models to tools and data.
- Multimodal
- Handling more than text, e.g. images and PDFs.
- Parameters / weights
- The learned numbers that make up a trained model.
- Pretraining
- The large-scale next-token phase that builds raw capability.
- Prompt
- The input you give the model; the system prompt frames the whole session.
- RAG
- Retrieval-Augmented Generation — fetch relevant docs into context at query time.
- RLHF
- Reinforcement Learning from Human Feedback.
- Temperature
- A dial on output randomness / creativity.
- Token
- The chunk of text a model reads and generates; the unit of context and billing.
- Tool use
- The model calling real functions your code executes.
- Transformer
- The neural-network architecture behind modern LLMs.