Creating and Customizing Output Styles
Learning objectives
By the end of this chapter, you will be able to:
- Explain what an output style is — a reusable definition that reshapes *how* Claude Code responds (role, tone, output format) by modifying its system prompt, not *what* it knows — name the built-in styles (Default, Explanatory, Learning, and the newer Proactive), and select one with `/config` → Output style (the standalone `/output-style` command the book uses was removed).
- Author a custom output style as a Markdown file with YAML frontmatter — `description` plus the load-bearing `keep-coding-instructions` — at user scope (`~/.claude/output-styles/`) or project scope (`.claude/output-styles/`), and explain that selecting it drops Claude Code's built-in software-engineering instructions unless `keep-coding-instructions: true`.
- Distinguish output styles from the other ways to shape Claude Code's behavior — CLAUDE.md (a user message added *after* the system prompt), `--append-system-prompt` (a one-off append), subagents (a separately scoped helper), and Skills (loaded on demand) — and pick the right tool for a given need.
- Use a structured-output style (YAML) so the format itself carries meaning (dependencies, priority, hierarchy), and build an advanced style that adds workflow *instructions* — asking Claude to generate a complete HTML page and save it to disk — in the style definition itself, while recognizing that a style is system-prompt text (a strong nudge, not a guaranteed action: execution still depends on tools, permissions, and Claude following it; for steps that must run every time, use a hook or script).
- Customize the status line: configure it with the `/statusline` command or the `statusLine` key in `settings.json`, and explain the data flow — Claude Code pipes session JSON (model, context usage, cost, active output style, `transcript_path`) to your script on stdin, and whatever the script prints to stdout becomes the persistent status bar, with ANSI color support.
- Describe how several Claude Code instances, each with a distinct output style and role, can act as a 'team of specialized agents,' and judge that framing honestly against the documented alternatives — subagents and (experimental) agent teams — for role-specialized parallel work.
Before we start — system prompts, output styles, stdin/stdout, and ANSI
Skim this if you're already comfortable with what a system prompt is, what gets piped through stdin/stdout, and what YAML and ANSI escape codes are. If any of that is fuzzy, read it first — the whole chapter rests on these ideas.
The system prompt vs. your prompts. Every time you talk to Claude Code, the model receives two kinds of text. Your user prompt is the request you just typed ("fix this bug"). The system prompt is a large block of standing instructions Claude Code sends on every turn, before your request — it tells the model who it is ("you are Claude Code, a software-engineering assistant"), how to use its tools, how to be safe, and how to write code. You normally never see it. This chapter is about editing that standing block — because changing it changes how Claude behaves on every single response.
An output style is the feature for doing exactly that. It's a small, named, reusable definition that modifies the system prompt to set a role, a tone, and an output format. Claude Code ships a few built-in styles and lets you write your own as plain files. Switch styles and Claude keeps all its knowledge and tools — it just presents differently: terse bullets, structured YAML, an HTML page, a patient teacher's voice. The book's framing is worth keeping: output styles change "how responses are structured and delivered… the communication protocol between the user and the model."
A status line is the thin, always-visible strip at the very bottom of the terminal — like a car's dashboard. It's optional and fully customizable. You point Claude Code at a small script; Claude feeds that script live information about the session, and whatever the script prints shows up in the strip.
stdin and stdout (the pipe). Command-line programs have a standard input stream (stdin — text flowing in) and a standard output stream (stdout — text flowing out). Claude Code talks to your status-line script through these: it writes a blob of JSON to the script's stdin, and reads back whatever the script prints to stdout. If you've ever run cat file | grep foo, you've used a pipe — the same idea.
JSON and YAML are two ways to write structured data. JSON ({"key": "value"}) is what Claude Code pipes to your status-line script. YAML is a more human-readable format that uses indentation instead of braces — and in this chapter it shows up twice: as the frontmatter at the top of a style file, and as an output format you can ask Claude to respond in.
Frontmatter is a small YAML block fenced by --- lines at the very top of a Markdown file. You met it in Chapters 3 and 7 (skills and subagents). Output style files use the same pattern: a frontmatter block of metadata, then a Markdown body of instructions.
ANSI escape codes are special character sequences (like \033[1;32m) that terminals interpret as "switch to bold green," etc., rather than printing literally. They're how a status-line script adds color.
Where this sits relative to Chapter 7. Chapter 7 gave you subagents — handing a scoped job to a specialist with its own system prompt. This chapter zooms back out to the main session and asks a different question: not "who do I delegate to?" but "how do I want this assistant to talk to me and what should the interface show?" By the end you'll treat Claude Code less like a fixed appliance and more like a studio you wire up for the task in front of you.
How to read this chapter. Each numbered section ends with an > Analogy — … box that restates the idea in plain language. Lean on them or skim them as you like.
Why this chapter matters
For seven chapters Claude Code has talked to you in one voice — the default software-engineering assistant. That voice is a deliberate design choice baked into its system prompt, and for most coding work it's the right one. But it's a choice, not the choice. When you're reviewing a PR you might want terse, severity-grouped bullets. When you're onboarding a teammate you might want a patient, explain-as-you-go tutor. When you're feeding Claude's output to another tool you might want rigid YAML or JSON. Re-typing "be concise, use bullets, no preamble" on every turn is friction; worse, it's unreliable.
Output styles remove that friction by letting you engineer the communication protocol itself — once, in a file, versioned with your repo. The book puts the shift plainly: you move from consuming Claude's output to designing how it's produced. And because a style is just a system-prompt modification, the same mechanism reaches surprisingly far: a style can make Claude think in structured data, or instruct it to carry out a small workflow (write a file, open it) — with the usual caveat that an instruction is a request, not a guarantee, and any file-writing or browser-opening still depends on Claude's available tools, your permissions, and Claude actually following the instruction.
This chapter builds that up in order. First, what an output style is and how you select or write one. Then how it works — it rewrites part of the system prompt — and how that differs from the other knobs you already know (CLAUDE.md, --append-system-prompt, subagents, Skills). Then two richer styles: one that responds in YAML, and one that emits a complete HTML page and asks Claude to save it. Then the status line — runtime customization of the interface, driven by a script you write. Finally, the book's closing vision: running several specialized instances side by side as a "team" — which we'll take seriously and check honestly against what the docs actually recommend.
A note on currency. Claude Code moves fast, and this is one of the chapters where it shows. The book drives everything through a standalone/output-stylecommand — that command was removed (deprecated in v2.1.73, removed in v2.1.91); you now pick a style through/config. The set of built-in styles has also grown. We teach the current surface and flag the book's version as you go, with soft wording where the exact shape keeps moving. Verify againstcode.claude.com/docs/en/output-stylesbefore you rely on a specific command name.
Lesson
1. What an output style is — and how you pick or write one
An output style changes how Claude responds, not what it knows. It sets a role, a tone, and an output format by modifying Claude Code's system prompt. Reach for one when "you keep re-prompting for the same voice or format every turn, or when you want Claude to act as something other than a software engineer."
The built-in styles. Claude Code ships a small set of ready-made styles. The Default style is the ordinary software-engineering system prompt you've used all along. As of writing there are three more:
- Explanatory — completes tasks the usual way but adds educational "Insights" along the way, explaining implementation choices and codebase patterns.
- Learning — a collaborative, learn-by-doing mode: Claude shares insights and asks you to write small strategic pieces yourself, dropping
TODO(human)markers in the code for you to fill in. - Proactive — Claude executes immediately and makes reasonable assumptions instead of pausing for routine decisions, preferring action over planning (you still see permission prompts before tools run).
The book lists only Default / Explanatory / Learning — and even flags, in a margin note, that "the built-in output styles available in Claude Code may evolve over time… depending on your installed version, you may see additional styles." That note has already come true: Proactive is a newer addition. Treat the built-in list as a moving target and check /config on your own install.
Selecting a style. The book lists and switches styles with a standalone /output-style command. That command no longer exists — it was deprecated in v2.1.73 and removed in v2.1.91. Today you switch styles one of two ways:
# The interactive way: run /config, then choose "Output style" from the menu.
/config
Your choice is saved to .claude/settings.local.json (the per-project, per-user settings file). Or set it without the menu by editing the outputStyle field in any settings file directly:
{
"outputStyle": "Explanatory"
}
Because the output style is part of the system prompt — which Claude Code reads once at session start — a change takes effect after /clear or in a new session.
Writing your own. A custom output style is just a Markdown file: a YAML frontmatter block of metadata, then a Markdown body of instructions to add to the system prompt. Where the file lives sets its scope:
~/.claude/output-styles/ # user scope — available in all your projects
.claude/output-styles/ # project scope — committed to the repo, shared with the team
(A third, managed-policy location exists for organization-administered settings, and plugins can ship styles in an output-styles/ directory — but the two above are the ones you'll create yourself. Project styles win over user styles of the same name.)
The book's first example is a user-scoped style at ~/.claude/output-styles/minimal-bullets.md:
---
description: Concise bullet-point responses with direct communication
---
# Communication Style
- Use bullet points for all responses
- Be direct and to the point
- Use nested bullets for hierarchy
- Skip preamble and transitions
# Tone
- Professional and concise
- No hedging or qualifications
The frontmatter carries metadata; the body below it becomes the instructions added to the system prompt. The frontmatter fields are few, and only one of them is load-bearing:
description— a short summary shown in the/configpicker. (The file name becomes the style's name unless you override it with anamefield.)keep-coding-instructions— a boolean, defaulting tofalse. This is the field the book never mentions, and it matters a great deal — §2 is about exactly what it does.force-for-plugin— for plugin-shipped styles only; auto-applies the style whenever the plugin is enabled.
Once the file exists, the style shows up in /config alongside the built-ins, and selecting it makes it active. From then on, Claude applies its instructions to every request — the minimal-bullets style turns answers into terse, filler-free nested bullets.
Analogy — the dress-code card by the door A new hire's skills don't change when they swap outfits. But a laminated card by the door says "front-of-house today: blazer, formal, brief" or "back-office: casual, chatty." An output style is that card for Claude: it doesn't change what Claude knows or which tools it has — it changes how it shows up. A few cards come pre-printed (Default, Explanatory, Learning, Proactive); you can also write your own and hang it in the personal closet (~/.claude/…) or the shared one by the project's front door (.claude/…).
2. How output styles work — rewriting the system prompt
Here's the mechanism, and the one nuance that the book half-explains. Output styles modify Claude Code's system prompt directly. Concretely:
- Every output style adds its instructions to the end of the system prompt, and sets up reminders so Claude keeps following them through the conversation.
- A custom style leaves out Claude Code's built-in software-engineering instructions — the standing guidance about how to scope changes, write comments, and verify work — unless you set
keep-coding-instructions: true.
The book sees the first half of this: "Selecting an output style replaces parts of Claude Code's system prompt… Claude Code removes its default software engineering instructions and substitutes them with the selected style's instructions." What it omits is the escape hatch. That default-false behavior is perfect when Claude isn't doing software engineering at all (a writing assistant, a data analyst). But when you only want to change how Claude communicates while it keeps coding the way you trust — "always lead with a diagram," say — you set keep-coding-instructions: true, and you get both your custom instructions and the engineering brain underneath:
---
name: Diagrams first
description: Lead every explanation with a diagram
keep-coding-instructions: true
---
When explaining code, architecture, or data flow, start with a Mermaid
diagram showing the structure, then explain in prose.
Get this wrong and you'll be surprised: a custom style with no keep-coding-instructions flag will quietly strip out the coding guidance, and Claude may stop scoping or verifying changes the way you expect. So the rule of thumb: non-coding role → omit it (default false); change the voice but keep coding → set it true.
keep-coding-instructions decides whether Claude Code's software-engineering block survives. CLAUDE.md works at a different layer entirely. Pedagogical diagram by this training, not from the book.This is also the moment to place output styles among the other behavior-shaping tools you already know. They are not interchangeable — each works at a different layer:
| Tool | How it works | Reach for it when |
|---|---|---|
| Output style | Modifies the system prompt itself | You want a different role, tone, or default format every turn, swappable and shareable |
| CLAUDE.md | Adds a user message after the system prompt | Claude should always know your project conventions and codebase context |
--append-system-prompt | Appends to the system prompt without removing anything | A one-off addition for a single (often headless -p) invocation |
| Subagent (Ch. 7) | Runs a helper with its own system prompt, model, and tools | You want a separately scoped specialist for a focused task |
| Skill (Ch. 3) | Loads task-specific instructions on demand | You have a reusable workflow that should activate only when relevant |
The sharpest distinction is the first two. CLAUDE.md is advisory project context delivered as a user message — Claude reads it and tries to follow it. An output style is the system prompt — it sets the role itself. That's why the docs are emphatic: "For instructions about your project, conventions, or codebase, use CLAUDE.md instead" of an output style.
Analogy — the script vs. the sticky note The actor (the model) is the same person every night. Their standing script (the system prompt) tells them who they're playing and how to deliver lines. An output style rewrites pages of that script — and keep-coding-instructions is the director deciding whether to keep the "you're a meticulous engineer" pages or tear them out for a "you're a friendly writing coach" role. CLAUDE.md isn't in the script at all: it's a sticky note slipped to the actor after rehearsal — "remember, this theater's curtain is heavy, pull slowly." Helpful context, but it doesn't change who they're playing.
3. Structured output — making the format carry the meaning
So far the styles changed tone. The more interesting move is changing the shape of the output — and the book's worked example is a YAML style. The argument for it is subtle and worth getting: when you ask Claude to answer in YAML, "the format itself becomes a communication protocol." Prose is linear — one sentence after another. YAML is hierarchical — and that hierarchy can encode meaning that prose only gestures at:
- Dependencies become parent–child nesting.
- Priority can be read from ordering.
- The structure of the problem is mirrored in the structure of the answer.
The book demonstrates with a project-scoped style. You create .claude/output-styles/yaml-concise.md:
---
description: Concise YAML-formatted responses for structured tasks
---
# Output Format
- All responses must be formatted as valid YAML
- Use hierarchy and nesting to express relationships
- Keep replies concise — no full sentences unless necessary
# Structure
- Use top-level keys to represent major sections
- Nest subconcepts under their parent context
- Use lists for enumerations and sequences
- Use key-value pairs for properties and attributes
# Tone
- No prose, no filler, no transitional language
- Let the YAML structure carry the meaning
With that style active, asking Claude to plan an authentication-bug fix no longer returns a paragraph or a flat to-do list — it returns a structured plan whose shape is the architecture of the work:
investigate:
auth_flow: &flow
- login_endpoint
reproduce: "invalid_token_scenario"
fix:
dependencies: [*flow]
files_to_modify:
auth.js:
scope: "token refresh logic"
risk: "low"
middleware.js:
scope: "validation checks"
risk: "urgent"
verify:
tests: ["auth_integration", "token_expiry"]
manual_check: "login flow end-to-end"
metadata:
estimated_time: "2 hours"
rollback_plan: "revert commits"
monitoring: "error_rate_dashboard"
The book's point lands here: this "mirrors how YAML is used in configuration systems such as Kubernetes and Docker Compose" — the format nudges Claude toward thinking in relationships and dependencies rather than sequential narration. Two practical payoffs follow. First, it's machine-readable: a downstream script or tool can parse this directly, which is exactly when a rigid format earns its keep. Second, defining it at project scope means everyone on the repo who selects the style gets the same structured contract — the format is versioned with the code.
There's a deeper framing the book makes, and it's the thesis of the chapter: by designing the output format, "control over interaction is therefore not limited to model providers; developers… define and control the communication protocol." You're no longer accepting whatever shape the model defaults to — you're specifying it.
Analogy — the form vs. the blank page Hand someone a blank page and "tell me about the bug" and you get a wandering paragraph. Hand them a form — boxes for investigate, fix, files & risk, verify, rollback — and the boxes do half the thinking: they force dependencies and priorities into the open and leave no room for filler. A YAML output style is that form. The shape of the form shapes the answer.
4. A style that asks for more — HTML generation and embedded workflow instructions
The last output-style move is the one that pushes a format toward a behavior. The book's advanced example is a project-scoped style, .claude/output-styles/retro-ASCII_blog.md, that instructs Claude to answer with a complete HTML page styled like a vintage ASCII-art blog. The whole instruction set lives in one Markdown file — the book emphasizes it needs no extra scripting or plugins:
---
description: Format responses as retro HTML pages with ASCII art styling like a vintage blog
---
Format all responses as complete HTML pages with retro ASCII art styling.
Follow these guidelines:
## HTML Structure
- Always provide complete HTML5 documents with proper DOCTYPE, head, and body tags
- Use semantic HTML elements (header, main, section, article, aside, footer)
## ASCII Art Styling
- Use ASCII art for headers, dividers, and decorative elements
- Create borders using characters like =, |, +, _, ^, #, -, *
- Use monospace fonts throughout for consistent ASCII alignment
## CSS Requirements
- Embed CSS in <style> tags in the HTML head
- Use monospace fonts (Courier New, Monaco, Consolas, monospace)
- Set background to dark colors (#1a1a1a, #2d2d2d) with light text
- Use retro color schemes (green on black, amber on black, etc.)
- Add subtle glow effects or text shadows for retro terminal feel
Select that style, ask "What are output styles?", and Claude emits valid HTML markup. But raw markup printed in the terminal isn't useful — and that exposes the key idea. The book first instructs Claude, by hand, to dump the HTML to a file (output-styles-blog.html) so it can be opened in a browser. Doing that every time is repetitive. So the book's move is to embed the workflow into the style definition itself by appending a short instruction:
## Workflow
- Save the HTML response to a file after writing it, then open it in the browser
Now the style doesn't merely describe a format — it asks Claude to run a small procedure: generate the HTML, write it to disk, open it. As the book stresses, "no callable logic is introduced. The prompt remains minimal" — the style is pure instructions. But be precise about what that buys you: an output style is system-prompt text, not an execution engine. It can ask Claude to save a file and open a browser, but whether that actually happens on a given turn still depends on the tools Claude has, your permission settings, the session mode, and Claude choosing to follow the instruction — it is a strong nudge, not a guarantee. (And the book is candid that the rendered page is intentionally ugly; the point is to prove there are "no inherent limitations imposed by predefined templates" — you could just as easily have each response write a new page into a Next.js app.)
So the honest framing: a style is not just a costume — it can carry standing instructions that ask Claude to take actions. That's why output styles "influence not only how responses look but also how they are operationalized." Just don't mistake a nudge for a contract: when you need a step to run deterministically every time — on a guaranteed lifecycle event, regardless of what Claude decides — reach for a hook or a script, not an output style. (Hooks and the broader extension surface are the deterministic counterpart to a style's instructions.)
Analogy — the note on the order ticket vs. the conveyor belt Embedding a workflow in an output style is like writing "and please file a copy when you're done" at the bottom of every order ticket. A conscientious clerk will usually do it — but it's still a request to a person who needs the filing cabinet (the tools), the keys (permissions), and the will to follow through; on a busy day it might get skipped. If you need the copy filed every single time, no exceptions, you don't rely on a note — you put a conveyor belt at the end of the line that files it automatically (a hook or script). The style is the note; the hook is the belt. Use the note for "usually do this," the belt for "always do this."
5. Customizing the status line
The second half of the chapter leaves output formatting and customizes the interface at runtime. The status line is the persistent strip at the bottom of the terminal; you make it show whatever you want by pointing Claude Code at a script. There are two ways to set it up, and the book uses the first:
- The
/statuslinecommand. Describe what you want in natural language; Claude Code generates a script file in~/.claude/and updates your settings automatically. The book's prompt:
``text /statusline I want you to create a statusline that displays the current used output-style. ``
- Manual configuration. Add a
statusLineblock to a settings file yourself. The book uses the user-scoped~/.claude/settings.json; the project-scoped.claude/settings.jsonis equally valid:
``json { "statusLine": { "type": "command", "command": "uv run ~/.claude/statusline.py" } } ``
type is command; command is any shell command that runs your script. (The book runs Python through the uv package manager — uv run … — but a status line can run a shell script, a Node.js file, or anything executable. Plain python3 … works fine for a stdlib-only script.)
The data flow is the thing to understand. Claude Code writes a blob of JSON describing the session to your script's stdin; your script reads it, decides what to display, and prints to stdout; whatever it prints becomes the status line. The book's minimal Python script reads the active style:
import json
import sys
input_data = json.load(sys.stdin)
style = input_data.get("output_style", "default")
print(style)
One correction worth knowing. The current JSON schema nests the style name: the field isoutput_style.name, not a bareoutput_stylestring. So a robust read today isinput_data.get("output_style", {}).get("name", "default"). The book's one-liner above reflects an earlier shape — keep it as the idea, but use the nested field on a current install. (The canonical minimal examples in the docs readmodel.display_nameandcontext_window.used_percentage, which are unambiguous.)
Color is just ANSI escape codes in what you print:
print(f"\033[1;32m{style}\033[0m") # bold green
What's actually in that JSON is far richer than the book shows — and it's the reason the status line is powerful. The session object includes (among others):
model.display_name/model.id— the active model;output_style.name— the active style (the book's example);context_window.used_percentage/remaining_percentage/context_window_size— live context budget (great for a usage bar);cost.total_cost_usdand duration fields — running session cost;workspace.current_dirandworkspace.repo— directory and git info;transcript_path— a path to the session's transcript file (used next);- and conditional extras like
agent.name,pr,worktree, and subscriptionrate_limits.
The schema grows between releases, so check code.claude.com/docs/en/statusline for the current field list rather than memorizing it.
Extending it — the last user prompt. The book's richer example uses transcript_path to show the last thing you asked. Claude Code stores each session's messages as a JSONL file (one JSON object per line) under ~/.claude/projects/<encoded-project-path>/. The extended script opens the transcript, scans from the end for the most recent role: "user" message, skips command invocations (lines starting with /) and assistant replies, and prints it:
import json
import sys
import os
def get_last_user_prompt(transcript_path):
"""Extract the last user prompt from the transcript file."""
try:
if not os.path.exists(transcript_path):
return "No transcript found"
with open(transcript_path, "r") as f:
content = f.read().strip()
if not content:
return "Empty transcript"
for line in reversed(content.split("\n")):
try:
entry = json.loads(line)
if entry.get("type") == "message" and entry.get("role") == "user":
message_content = entry.get("message", "")
if message_content.startswith("/"): # skip slash commands
continue
return message_content
except Exception:
continue
return "No user prompt found"
except Exception as e:
return f"Error reading transcript: {e}"
The three moves the book names are worth memorizing because they generalize to any status-line feature: (1) read structured runtime input from stdin; (2) pull the field you need (transcript_path) out of it; (3) do your own work (open the transcript, filter, format) and print the result to stdout. The status line is, in the book's words, proof that "Claude Code is extensible beyond output formatting" — it lets executable logic shape the development environment itself.
Analogy — the car dashboard A status line is the dashboard strip: speed, fuel, gear, always in view while you drive. The car (Claude Code) constantly feeds raw telemetry through a wire (the JSON on stdin); a small module you install (your script) decides which gauges to light up and how to paint them, then sends the rendered readout to the glass (stdout). Want a different gauge — cost, context %, the last thing you typed? Rewire the module. Nothing about the engine changes; you've just chosen what the driver sees.
6. A team of specialized instances — and an honest look at the idea
The chapter ends with a vision. Because an output style is a per-session setting, you can open several Claude Code instances at once — separate terminals on the same repo — and give each a different style and role. The book paints it as a small start-up team: a frontend-engineer instance using terse bullets, a backend-engineer instance answering in an OpenAPI spec format, a devops instance in YAML, a security-review instance in a careful explanatory voice. Switching terminals "becomes equivalent to switching between specialized team members," and — neatly tying the chapter together — the status line is what tells you which instance you're looking at, since the interface doesn't otherwise advertise the active style. The book's thesis lands here: "Claude Code is not a single fixed interface, but a configurable system that can be shaped into task-specific agents."
That's a genuinely useful mental model, and the mechanics are real: output styles are per-session, so nothing stops you from running role-flavored instances side by side (Chapter 6 already had you running parallel terminal instances; this just gives each one a voice). But it's worth being precise about what's documented practice versus what's the book's framing, because the gap matters when you build for real:
- "One instance per output style" is the book's metaphor, not a documented architecture. The official guidance on running work in parallel ("Run multiple Claude sessions") never proposes coordinating a team by output style. Output styles change presentation; they don't give instances a shared task list or let them talk to each other.
- For genuinely role-specialized, parallel work, the documented tools are the ones from Chapter 7. Subagents are the stable, lightweight way to hand a focused role (a security reviewer, a test writer) a scoped task in its own context. Agent teams are the heavier, coordinated option where teammates share a task list and message each other — but they're experimental and disabled by default, gated behind the
CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMSsetting, with known limitations. Reach for those when you need real coordination; reach for parallel styled instances when you just want a few differently-voiced sessions you switch between yourself.
So take the book's "team of specialized agents" as an inspiring direction and a true statement about how configurable Claude Code is — while remembering that the production-grade way to get a coordinated team is subagents (today) or agent teams (experimental), not a row of terminals distinguished only by their output style.
Analogy — the open-plan office with labeled desks Seating a frontend dev, a backend dev, and a DevOps engineer at separate desks — each with their own working style, a nameplate (the status line) telling you whose desk you're at — is a real and useful way to organize. But a functioning firm doesn't coordinate purely by desk decor: it has a manager who routes work and a way for people to talk to each other. The labeled desks are your styled instances; the manager and the inter-desk phone are subagents and agent teams. Use the desks for "let me switch hats"; bring in the manager when the work genuinely needs a coordinated crew.
The whole chapter in one image — you're at the mixing board
Analogy — pedagogical summary, drawing on all six sections
Stop thinking of yourself as a listener tuning in to whatever the station plays. You're the producer at the mixing board.
You choose the format. Default, Explanatory, Learning, Proactive — or a card you printed yourself (output styles). And you decide, with one switch, whether the engineer's training stays in the booth or gets swapped out for a writer's (keep-coding-instructions).
You wire the channels. Route the signal into a structured shape so the form itself carries the meaning (YAML), or wire in a standing action so every take is automatically bounced to disk and played back (embedded HTML workflow).
You light the VU meters. The status line is your row of gauges — model, context %, cost, the last thing you said — fed live down a cable (JSON on stdin) and painted however you like (stdout + ANSI), always glowing at the bottom of the board.
You staff the booths. Several instances, each with its own voice and role, a nameplate on each — useful for switching hats, and a true sign that Claude Code is a configurable studio, not a sealed appliance. Just remember: a coordinated crew (subagents, agent teams) is a different rig than a few booths you walk between. Either way, the console is yours. That's the whole chapter: you design the communication protocol; Claude runs it.
Activity — Audit and design your own output style
Ten minutes, individual, no setup required. You'll decide where output styles fit in your work and sketch one — sharpening the judgment the practical exercise then exercises live.
- Spot the repeated re-prompt. Think back over your last few Claude sessions. What did you keep asking for — "be concise," "just the diff," "explain it like I'm new," "answer in JSON"? That recurring instruction is a candidate for an output style. Write it down.
- Pick the layer. Is what you want really an output style (a role/tone/format you want every turn), or is it project context (→ CLAUDE.md), a one-off (→
--append-system-prompt), or a scoped specialist (→ a subagent)? Justify your choice using the §2 table. Getting this right is half the skill. - Draft the frontmatter. Write a
descriptionand, deliberately, decidekeep-coding-instructions: is Claude still doing software engineering in this style (→true) or acting as something else entirely (→ omit it /false)? State why. - Draft three body rules. Write the three instructions that most define the style's voice or format (e.g., "respond only in valid YAML," "lead with a one-line verdict," "no preamble"). If your style should ask Claude to do something each turn (write a file, run a check), add that as a
## Workflowrule too — remembering it's an instruction Claude usually follows, not a guaranteed action (for that, you'd use a hook). - Decide scope. User (
~/.claude/output-styles/) or project (.claude/output-styles/)? Would your team benefit from this exact format being versioned in the repo?
Keep the result — steps 3–4 are literally a style file, and you'll create something very close to it next.
Practical exercise — Reshape the interface: two output styles and a live status line
~35–45 minutes. Hands-on. No web framework, nonpm, no accounts — just Claude Code, a tiny throwaway folder, and (for the status line) Python 3, which you almost certainly already have. You'll select a built-in style, write two custom styles, prove whatkeep-coding-instructionsdoes, then build a status line that shows the active style live.
Everything happens in a throwaway sandbox — nothing here touches the training repo, and the status line is configured at project scope so it's fully self-contained and easy to undo.
Setup (3 min). Create a sandbox with one small file to talk about:
mkdir -p ~/cct-ch8-lab && cd ~/cct-ch8-lab
git init -q
cat > greet.py <<'PY'
def greet(name):
return "Hello, " + name # no input validation; no type hint
PY
git add . && git commit -q -m "init output-styles sandbox"
Part 1 — meet the built-in styles (5 min). Start claude in the sandbox, then open the config menu and choose Output style:
/config
Switch to Explanatory (or Learning). The output style is read once at session start, so the change takes effect after you run /clear (or start a new session) — do that now, then ask: What does greet.py do and how would you harden it? Notice the extra "Insights" / teaching voice versus the Default style.
Expected outcome: after the /clear, the same question produces a noticeably different presentation. (If you ask without clearing first, you'll still get the old style — that's the "read once at session start" rule, not a bug.) (Note: the book uses a standalone /output-style command here — it was removed in v2.1.91, so use /config. If your build still has /output-style, you're on an old version.)
Part 2 — write a custom style (10 min). Create a project-scoped style by hand:
mkdir -p .claude/output-styles
cat > .claude/output-styles/minimal-bullets.md <<'MD'
---
description: Concise bullet-point responses with direct communication
---
# Communication Style
- Use bullet points for all responses
- Be direct and to the point
- Use nested bullets for hierarchy
- Skip preamble and transitions
# Tone
- Professional and concise
- No hedging or qualifications
MD
Run /config → Output style and pick minimal-bullets. Because the style is read once at session start, run /clear (or start a new session) so it takes effect, then re-ask the greet.py question.
Expected outcome: after the /clear, the answer is now terse nested bullets, no filler — your file is shaping every response.
Part 3 — prove what keep-coding-instructions does (7 min). This is the field the book omits, so feel it directly. Add a second style without the flag, and ask it to actually change code:
cat > .claude/output-styles/plain-tutor.md <<'MD'
---
description: Friendly plain-English explanations, no jargon
---
Explain everything in plain, friendly English. Assume the reader is new to programming.
Avoid jargon; define any term you must use.
MD
Select plain-tutor, then run /clear (or start a new session) so it takes effect, and ask: Add input validation to greet.py. Now edit the file to add keep-coding-instructions: true to the frontmatter, start a fresh session (or /clear), reselect it, and ask the same thing.
Expected outcome: with the flag absent (default false), the style stripped Claude Code's software-engineering instructions — it leans explanatory and may not scope/verify the edit the way you'd expect. With keep-coding-instructions: true, you get the friendly voice and the disciplined coding behavior. That difference is the whole point of the flag.
Part 4 — a live status line (12 min). Build it manually so it stays self-contained in the sandbox. Drop in this stdlib-only script:
cat > .claude/statusline.py <<'PY'
import json, sys
data = json.load(sys.stdin)
style = data.get("output_style", {}).get("name", "default") # current schema: output_style.name
model = data.get("model", {}).get("display_name", "?")
pct = int(data.get("context_window", {}).get("used_percentage", 0) or 0)
print(f"\033[1;32m{model}\033[0m · {pct}% · style: {style}") # bold-green model, then context % and style
PY
Then add a statusLine block to the project settings file, .claude/settings.json (a supported manual configuration path):
{
"statusLine": { "type": "command", "command": "python3 .claude/statusline.py" }
}
Start a fresh session in the sandbox — a status bar appears at the bottom showing the model, context %, and the active style.
Faster alternative — let Claude write it. Run /statusline with a natural-language description and Claude Code generates a script in ~/.claude/ and updates your settings automatically:
/statusline show the active output style, the model name, and the context percentage
Note this writes to your global ~/.claude/ config (there is no project-settings picker), so it touches configuration outside the sandbox — the manual path above is what keeps this lab self-contained and easy to undo.
Now confirm the style segment is live: switch the output style via /config, then run /clear (or start a new session) so the change takes effect. The status line reports the active style (output_style.name), so after the clear its style segment shows the new style.
Expected outcome: a persistent bar showing the model, context %, and the active style in green; after switching a style and clearing, the style segment reflects the new style. You've closed the loop: a script you control, fed live session JSON, painting the interface. (Windows: use python instead of python3, and forward slashes in the path.)
Success checklist
- [ ] You switched to a built-in style via
/config(not the removed/output-style), ran/clear(or started a new session) so it took effect, and saw the same question answered differently. - [ ] You wrote
.claude/output-styles/minimal-bullets.md, made it the active style, and (after/clear/new session) responses became terse bullets. - [ ] You demonstrated
keep-coding-instructions: the default (false) dropped the coding behavior; true kept the voice and the engineering discipline. - [ ] A status line is live at the bottom of the terminal, built from a script that reads session JSON on stdin and prints to stdout.
- [ ] After switching a style (and
/clear/new session), the status line's style segment reflects the new style.
Common pitfalls - Reaching for the old command./output-stylewas removed in v2.1.91. Use/config→ Output style, or setoutputStylein a settings file. - Forgetting the style is read at session start. A new or edited style takes effect after/clearor a fresh session — not mid-turn. - Omittingkeep-coding-instructionswhen you still want coding. A custom style defaults to dropping the software-engineering instructions. If you only meant to change the voice, set it totrue. - Reading the wrong status-line field. The active style isoutput_style.name(nested), not a bareoutput_stylestring. The book's one-liner is from an older schema. - Editing global config by accident. The book points the status line at~/.claude/settings.json(global). Keep the lab self-contained by using the project.claude/settings.jsoninstead, and delete thestatusLineblock to undo. - Using an output style for project facts. Conventions, build commands, and codebase context belong in CLAUDE.md (a user message after the system prompt), not in a style (which is the system prompt).
Knowledge check — try the quiz
Once you've read the lesson and worked the lab, take the chapter quiz from the navigation bar. Six questions: five grounded in the book chapter, one synthesis question that ties output styles to the other behavior-shaping tools (CLAUDE.md, --append-system-prompt, subagents, Skills) and to honest multi-instance practice. Passing score is 5/6 — retake it until you're confident.
Further reading & enrichment sources
- Anthropic docs — "Output styles" (
https://code.claude.com/docs/en/output-styles). The canonical reference: the four built-in styles (Default, Proactive, Explanatory, Learning), selecting via/config(the standalone/output-stylecommand was deprecated in v2.1.73 and removed in v2.1.91), the frontmatter fields (name,description,keep-coding-instructions,force-for-plugin), the three storage locations, the "How output styles work" mechanics (instructions appended to the system prompt; software-engineering instructions dropped unlesskeep-coding-instructions: true), and the "Comparisons to related features" table. - Anthropic docs — "Customize your status line" (
https://code.claude.com/docs/en/statusline). The/statuslinecommand and thestatusLinesettings block; the full JSON schema piped on stdin (model,output_style.name,context_window,cost,workspace,transcript_path, and conditional fields); multi-line output, ANSI color and OSC 8 hyperlinks, refresh cadence, and the workspace-trust requirement. - Anthropic docs — "Settings" (
https://code.claude.com/docs/en/settings). WhereoutputStyleandstatusLinelive and how settings precedence resolves them — highest to lowest: managed → command-line arguments → local project (.claude/settings.local.json) → shared project (.claude/settings.json) → user (~/.claude/settings.json) (permission rules are the exception — they merge across scopes rather than override). - Anthropic docs — "Memory / CLAUDE.md" (
https://code.claude.com/docs/en/memory). Why CLAUDE.md is project context added after the system prompt, not a system-prompt modification — the key contrast with output styles. - Anthropic docs — CLI reference (
https://code.claude.com/docs/en/cli-reference).--append-system-prompt(append to the system prompt for one invocation) and--system-prompt/--system-prompt-file(replace it entirely) — the headless cousins of an output style. - Anthropic docs — "How Claude Code uses prompt caching" (
https://code.claude.com/docs/en/prompt-caching). Why an output-style change is read once at session start and what it does to the cache. - Anthropic docs — "Best practices: run multiple Claude sessions" (
https://code.claude.com/docs/en/best-practices) plus "Subagents" (https://code.claude.com/docs/en/sub-agents) and "Agent teams" (https://code.claude.com/docs/en/agent-teams). The documented ways to run role-specialized work in parallel — the honest counterpart to the book's "team of specialized agents" framing; agent teams remain experimental and disabled by default.
Knowledge check
6 questions. Passing score: 5.
Instructor notes & source coverage
Source Ledger — Chapter 8: Creating and Customizing Output Styles
Primary source (the book)
- Source PDF:
source-pdfs/08-chapter-08.pdf(39 pages) - Extracted source:
extracted-chapters/08-chapter-08.md(visual extraction, with<!-- page N -->markers for all 39 pages). There is no usable.txtfor this chapter — see the Extraction caveat at the end. - Extraction tool: none of the usual text extractors worked — the Chapter 8 PDF is image-only (each page is composed of rendered images; the image-only check
python -c "import pypdf; print(sum(len(p.extract_text() or '') for p in pypdf.PdfReader('source-pdfs/08-chapter-08.pdf').pages))"printed0). The chapter was extracted by rendering all 39 pages to PNG at 150 DPI with PyMuPDF (fitz) intowork/08-chapter-08-pages/and transcribing them visually intoextracted-chapters/08-chapter-08.md. Extraction style: to avoid reproducing a copyrighted Packt chapter at length, the explanatory prose is captured as faithful section-by-section summaries, while every heading, code block, command, YAML/JSON, file path, key name, and flag is captured verbatim (these are the load-bearing/functional elements the lesson needs). Treat code/config/paths in the extract as exact; treat prose as a structural summary, and re-open the page images for exact sentence wording. - Book's main sections (from the extract, in order): "Creating a custom output style with Claude Code" (the
/output-stylepicker; built-in Default/Explanatory/Learning; the user-scopedminimal-bullets.md; "How output styles work" = replaces the software-engineering instructions; pp. 1–6); "Why YAML" + "Creating YAML as an output style" (the project-scopedyaml-concise.md; the YAML task-plan example; pp. 6–13); "Creating an advanced project-level output style" (retro-ASCII_blog.md→ HTML page; "Automating file generation" = embedding a## Workflowinstruction; pp. 13–19); "Working with multiple output styles" (launching a second instance; specialized output-style workflows; pp. 19–22); "Customizing the status line in Claude Code" (/statusline; thestatusLinesettings key +uv run ~/.claude/statusline.py; the minimalstatusline.pyreadingoutput_style; ANSI color; the extendedget_last_user_promptreadingtranscript_path; pp. 22–34); "The future of AI coding: a team of specialized agents" (multiple instances by role/output-style; the Neo-Genius start-up-team illustration; namingfrontend-engineer/backend-engineer/devops/security-review; pp. 35–38); "Summary" (pp. 38–39).
Enrichment sources
The lesson silently incorporates material from the official Claude Code documentation. Per project convention, no inline > Source: or > Enrichment — ... labels appear in the learner-facing lesson — the only in-lesson labelled callouts are the > Analogy — ... boxes. This source ledger is the single source of provenance.
- [E1] Anthropic docs — Output styles —
https://code.claude.com/docs/en/output-styles - [E2] Anthropic docs — Customize your status line —
https://code.claude.com/docs/en/statusline - [E3] Anthropic docs — Settings —
https://code.claude.com/docs/en/settings - [E4] Anthropic docs — Memory / CLAUDE.md —
https://code.claude.com/docs/en/memory - [E5] Anthropic docs — CLI reference (
--append-system-prompt/--system-prompt) —https://code.claude.com/docs/en/cli-reference - [E6] Anthropic docs — How Claude Code uses prompt caching —
https://code.claude.com/docs/en/prompt-caching - [E7] Anthropic docs — Best practices: run multiple Claude sessions —
https://code.claude.com/docs/en/best-practices - [E8] Anthropic docs — Subagents —
https://code.claude.com/docs/en/sub-agents - [E9] Anthropic docs — Agent teams —
https://code.claude.com/docs/en/agent-teams
Unlike Chapter 7 (which was largely current), this chapter's central surface had drifted materially — the book's primary command, /output-style, no longer exists (deprecated v2.1.73, removed v2.1.91), and the built-in style list and the custom-style frontmatter both grew. All facts were verified against the canonical docs before authoring (and the load-bearing pages — [E1] output-styles and [E2] statusline — were fetched directly, not taken from a summary). Enrichment is used to (a) correct the removed /output-style command → /config → Output style; (b) complete the built-in style set (add Proactive), the frontmatter (keep-coding-instructions, force-for-plugin), the third managed-policy scope, and the full status-line JSON schema; (c) clarify the system-prompt mechanics (instructions appended; software-engineering block dropped unless keep-coding-instructions: true) and the contrast with CLAUDE.md / --append-system-prompt / subagents / Skills; and (d) reframe honestly the book's "team of specialized agents" against the documented parallel-work tools (subagents / experimental agent teams).
Pedagogical enrichment by the training author
Not from the book and not from the docs — written for this training, inventoried here for separate audit. No inline labels in the lesson except the > Analogy — ... callouts.
- Newcomer preface (
## Before we start — system prompts, output styles, stdin/stdout, and ANSI). Defines system prompt vs user prompt, what an output style and a status line are, stdin/stdout/pipes, JSON vs YAML, frontmatter, ANSI escape codes, and the bridge from Chapter 7 (subagents shape a delegated helper; this chapter reshapes the main session's interface). Grounded in [E1], [E2]. - Per-section analogies. Six
> Analogy — ...callouts, one per numbered section: §1 the dress-code card by the door; §2 the script vs. the sticky note; §3 the form vs. the blank page; §4 the note on the order ticket vs. the conveyor belt (a style's workflow instruction is a request, like a note; a hook is the deterministic conveyor belt); §5 the car dashboard; §6 the open-plan office with labeled desks. - Whole-chapter analogy (
## The whole chapter in one image — you're at the mixing board). A sustained producer-at-the-mixing-board analogy threading all six sections (choose the format → wire the channels → light the VU meters → staff the booths). - Two SVG diagrams (the book's figures are screenshots/illustrations and are not reproduced — we have no rights, and they're image-only besides):
- Figure 8.A — how an output style rewrites the system prompt: three stacked-block columns (Default; custom with
keep-coding-instructions: false→ software-engineering block removed, custom instructions appended; custom withtrue→ all kept), plus a footnote that CLAUDE.md is not part of the system prompt (added as a user message after it). - Figure 8.B — the status-line data flow: session JSON →
stdin→statusline.py(read, pick fields, ANSI) →stdout→ the rendered status bar. - Each SVG
figcaptionexplicitly notes it is "Pedagogical diagram by this training, not from the book." (See the Diagram-count note below for why this chapter ships two, not three.) - Conceptual activity — "Audit and design your own output style." Ten-minute individual exercise: spot a repeated re-prompt, pick the right layer (output style vs CLAUDE.md vs
--append-system-promptvs subagent) using the §2 table, draft frontmatter (with a deliberatekeep-coding-instructionsdecision), draft three body rules (+ an optional## Workflowrule), and choose scope. Grounded in §1/§2/§4. - Practical exercise — "Reshape the interface: two output styles and a live status line." A ~35–45 min hands-on lab on a framework-free, stdlib-only sandbox (
~/cct-ch8-lab/with one tinygreet.py), outside the training repo. Part 1 selects a built-in style via/config(not the removed/output-style) and runs/clear(or starts a new session) so it takes effect — the lab makes the "read once at session start" rule explicit at every style switch; Part 2 hand-writes a project-scopedminimal-bullets.md(select →/clear→ re-ask); Part 3 demonstrateskeep-coding-instructions(default-false drops the coding behavior;truekeeps it); Part 4 builds a status line manually (a hand-written stdlibstatusline.py+ astatusLineblock in project.claude/settings.json) as the primary, self-contained, reversible path, with the/statuslinecommand presented as a faster alternative that generates a script in global~/.claude/and updates settings automatically (no project-settings picker). Uses plainpython3(book usesuv run) so no extra installs are required.
Diagram-count note. This chapter intentionally ships two original SVG diagrams (8.A system-prompt rewrite; 8.B status-line data flow). The §6 "team of specialized instances" idea is conveyed through prose, the comparison table, and the labeled-desks analogy rather than a third SVG, because the honest framing (it's the book's metaphor, not a documented architecture) is better carried in text than in a diagram that might imply it's a first-class feature. Earlier chapters shipped 3–4 diagrams; two is a deliberate choice here, not an omission.
Quiz items and learning objectives remain grounded in the book chapter and the labelled enrichment; none of the analogies, diagrams, the activity, or the exercise steps are themselves assessed.
Objective → Source Mapping
| Learning Objective | Source Section (page) | Enrichment | Confidence | Notes |
|---|---|---|---|---|
Explain what an output style is (reshapes how Claude responds by modifying the system prompt), name the built-in styles, and select one with /config (the removed /output-style). | Book "Creating a custom output style" (pp. 1–5) | [E1] | High | The "how responses are structured/delivered" framing and the Default/Explanatory/Learning list are the book's. Proactive, and the /config-not-/output-style selection, are corrected/completed from [E1] (see Drift). |
Author a custom style (Markdown + YAML frontmatter; description + keep-coding-instructions; user vs project scope) and explain that selecting it drops the software-engineering instructions unless keep-coding-instructions: true. | Book "Creating and reviewing a new output style" + "How output styles work" (pp. 3–6) | [E1] | High | The minimal-bullets.md example, the two scope directories, and "removes its default software engineering instructions and substitutes them" are the book's. keep-coding-instructions (default false), the full frontmatter, and the managed-policy scope are completed from [E1] — the book never mentions the flag (see Drift). |
Distinguish output styles from CLAUDE.md, --append-system-prompt, subagents, and Skills, and pick the right one. | n/a — not in the book as a comparison | [E1], [E4], [E5], [E8] | High — synthesis | The comparison table is from [E1]'s "Comparisons to related features"; the CLAUDE.md = "user message after the system prompt" contrast is from [E1]/[E4]; the flags from [E5]; subagents from [E8] (Chapter 7). The book does not contrast these tools — this is enrichment. |
| Use a YAML structured-output style and build an advanced style that carries workflow instructions (HTML generation + a request to save the file), understanding it's a nudge not a guarantee. | Book "Why YAML" / "Creating YAML as an output style" + "Creating an advanced project-level output style" / "Automating file generation" (pp. 6–19) | [E1] | High | The YAML "format-as-protocol" argument, the yaml-concise.md/retro-ASCII_blog.md files, and the ## Workflow instruction are the book's. Softened (see Drift): the lesson reframes the embedded ## Workflow step as an instruction (system-prompt text), not deterministic execution — whether it runs depends on tools/permissions/session mode and Claude following it; for must-run steps the lesson points to hooks/scripts. The book's "no callable logic is introduced" / "no code or plugins" framing is kept as the book's wording but not presented as a guaranteed workflow engine. |
Customize the status line: configure via /statusline or the statusLine settings key; explain the stdin-JSON → script → stdout flow (model, context, cost, output style, transcript_path); ANSI color. | Book "Customizing the status line" → "Implementing the status line logic" / "ANSI color support" / the get_last_user_prompt extension (pp. 22–34) | [E2] | High | The /statusline command, the statusLine config block, the minimal/extended Python scripts, and ANSI color are the book's (and current). The full JSON schema and the output_style.name nesting are completed/corrected from [E2] (book's input_data.get("output_style", "default") reads a bare string; current schema nests .name) — see Drift. |
| Describe the "team of specialized agents" idea and judge it honestly against subagents / agent teams. | Book "Working with multiple output styles" + "The future of AI coding: a team of specialized agents" (pp. 19–22, 35–38) | [E7], [E8], [E9] | High — synthesis | The multiple-instances-by-role vision is the book's. The honest reframe (one-instance-per-style is the book's metaphor, not a documented architecture; subagents [stable] / agent teams [experimental, gated] are the documented parallel-work tools) is from [E7]/[E8]/[E9] (see Drift). |
Lesson Section → Source Mapping
| Lesson section | Source location | Enrichment | Confidence | Notes |
|---|---|---|---|---|
| Preface — system prompt vs user prompt; output style; status line; stdin/stdout; JSON/YAML; frontmatter; ANSI; bridge from Chapter 7 | Concepts introduced across the book chapter | [E1], [E2] | High | Pedagogical re-framing for newcomers. The Chapter-7 bridge is the lesson's. |
"Why this chapter matters" — engineering the communication protocol; the "moves from consuming to designing output" thesis; currency note on /output-style removal | Book intro (pp. 1, 15) | [E1] | High | The thesis is the book's; the /output-style-removed currency note is from [E1] (see Drift). |
§1 — what an output style is; built-in styles; selecting via /config; the minimal-bullets.md file; scopes; frontmatter fields | Book pp. 1–5 | [E1] | High | Book's example preserved; Proactive, /config selection, keep-coding-instructions/force-for-plugin, and the managed-policy scope from [E1] (see Drift). |
| §1 — analogy: the dress-code card by the door | n/a — pedagogical | n/a | n/a | Original. |
§2 — how output styles work (system-prompt modification; instructions appended; software-engineering block dropped unless keep-coding-instructions: true); read once at session start; the comparison table | Book "How output styles work" (pp. 5–6) | [E1], [E4], [E5], [E6], [E8] | High | The "replaces the software-engineering instructions" mechanic is the book's; the keep-coding-instructions escape hatch, "appended to the end," "read once at session start," and the full comparison table are from [E1] (table) / [E4]/[E5]/[E8] (see Drift). |
| §2 — Figure 8.A (system-prompt rewrite; keep-coding-instructions; CLAUDE.md footnote) | n/a — pedagogical diagram | [E1] | n/a | Original SVG. |
| §2 — analogy: the script vs. the sticky note | n/a — pedagogical | n/a | n/a | Original. |
§3 — Why YAML; the yaml-concise.md style; the YAML task-plan example; format-as-protocol; project scope | Book pp. 6–13 (incl. the auth-bug YAML plan and the "definition/location/file_structure/functionality" response) | — | High | Faithfully the book's; the Kubernetes/Docker-Compose comparison is the book's own. No correction. |
| §3 — analogy: the form vs. the blank page | n/a — pedagogical | n/a | n/a | Original. |
§4 — advanced HTML style (retro-ASCII_blog.md); adding the ## Workflow instruction (save + open); "no callable logic"; the nudge-not-a-guarantee caveat + the hook/script pointer | Book pp. 13–19 | [E1] | High | The style file, the ## Workflow snippet (book p. 18, "Save the HTML file after writing it…"), and "no callable logic is introduced" are the book's. Softened (see Drift): the lesson reframes the workflow step as a system-prompt instruction — a strong nudge, not deterministic execution (depends on tools/permissions/session mode + Claude following it) — and explicitly points to hooks/scripts for steps that must run every time. The long style file is trimmed to representative blocks. |
| §4 — analogy: the note on the order ticket vs. the conveyor belt | n/a — pedagogical | n/a | n/a | Original. Restates that a style's workflow instruction is a request (a note), while a hook/script is the deterministic mechanism (the belt). |
§5 — status line: /statusline + statusLine settings block; stdin-JSON→script→stdout; minimal statusline.py; output_style.name correction; ANSI; the get_last_user_prompt/transcript_path extension; the full JSON schema | Book pp. 22–34 | [E2] | High | The command, config block, both Python scripts, and ANSI are the book's and current. The output_style.name nesting correction and the richer field list are from [E2] (see Drift). Corrected (see Drift): the lesson describes /statusline as "generates a script in ~/.claude/ and updates your settings automatically" per [E2] — it does not repeat the book's "spawns a sub-agent" claim (unsupported by the docs) and does not imply a project-settings picker. The book targets global ~/.claude/settings.json; [E2] confirms project-scoped .claude/settings.json is equally valid. |
| §5 — Figure 8.B (status-line data flow) | n/a — pedagogical diagram | [E2] | n/a | Original SVG. |
| §5 — analogy: the car dashboard | n/a — pedagogical | n/a | n/a | Original. |
| §6 — multiple instances by role/output-style; status line to tell them apart; the "configurable system, not a fixed interface" thesis; the honest reframe to subagents / agent teams | Book pp. 19–22, 35–38 | [E7], [E8], [E9] | High | The vision and the thesis are the book's. The honest reframe (book's metaphor vs documented subagents/agent teams; agent teams experimental + gated) is from [E7]/[E8]/[E9] (see Drift). |
| §6 — analogy: the open-plan office with labeled desks | n/a — pedagogical | n/a | n/a | Original. |
| Whole-chapter analogy: you're at the mixing board | n/a — pedagogical synthesis | n/a | n/a | Original. |
| Activity: Audit and design your own output style | n/a — pedagogical | [E1] | n/a | Original. Grounded in §1/§2/§4. |
| Practical exercise: two output styles + a live status line (stdlib sandbox) | Book pp. 1–34 recombined into a framework-free lab | [E1], [E2] | High — original sequencing | Every step grounded in the book + [E1]/[E2]. Sandbox ~/cct-ch8-lab/ is outside the training repo, uses no npm/Node, and configures the status line at project scope for reversibility. |
Unsupported / Pedagogical-Only Claims
Statements in the learner-facing lesson that are not from the book and not directly from the labelled enrichment, listed for isolated audit.
| Item | Justification |
|---|---|
| Dress-code-card analogy (§1) | Pedagogical analogy. No external claim. |
| Script-vs-sticky-note analogy (§2) | Pedagogical analogy. Restates output style (system prompt) vs CLAUDE.md (user message after). |
| Form-vs-blank-page analogy (§3) | Pedagogical analogy. Restates the YAML format-as-protocol argument. |
| Order-ticket-vs-conveyor-belt analogy (§4) | Pedagogical analogy. Restates that a style's workflow instruction is a request (a note), not a guarantee, and a hook/script is the deterministic mechanism (the belt). |
| Car-dashboard analogy (§5) | Pedagogical analogy. Restates the status-line data flow. |
| Labeled-desks analogy (§6) | Pedagogical analogy. Restates the multi-instance idea + the coordination caveat. |
| Mixing-board whole-chapter analogy | Pedagogical synthesis. No new claims. |
| Figures 8.A–8.B (SVGs) | Original SVGs. Visually restate the system-prompt rewrite and the status-line data flow. |
The greet.py sandbox file (practical exercise) | Authored for this training as a trivially-flawed function (no validation/type hint) to give the styles something to talk about and edit. |
Using project-scoped .claude/settings.json for the lab's status line | Lesson choice for reversibility/self-containment; [E2] confirms project scope is valid. The book uses global ~/.claude/settings.json. |
Using plain python3 to run the status-line script | Lesson choice so no extra tooling is needed; the script is stdlib-only. The book runs it via uv run. |
Quiz Item → Source Mapping
| Quiz ID | Answer | Item | Source location | Enrichment | Confidence |
|---|---|---|---|---|---|
| q1 | a | What an output style is (modifies the system prompt to change how Claude responds) and how to select one now (/config, not the removed /output-style); the built-in styles incl. Proactive. | Book pp. 1–5 | [E1] | High — the definition and built-in trio are the book's; the /config selection, the /output-style removal, and Proactive are from [E1] (see Drift). |
| q2 | b | Custom-style structure (Markdown + YAML frontmatter; user/project scope) and keep-coding-instructions (default false; drops the software-engineering instructions unless true). | Book pp. 3–6 | [E1] | High — the file structure and "removes the SE instructions" are the book's; keep-coding-instructions (the answer's crux) is from [E1] (book omits it). |
| q3 | c | Why respond in YAML (format-as-protocol: dependencies→nesting, priority→ordering, structure mirrors the problem; machine-readable). | Book pp. 6–12 | — | High — entirely the book's argument. |
| q4 | b | The advanced HTML style carries workflow instructions (ask Claude to save the file + open the browser) in the style definition — a strong nudge, not a guaranteed action (depends on tools/permissions/session + Claude following it); for must-run steps, use a hook/script. | Book pp. 13–19 | [E1] | High — the book's "Automating file generation" / "no callable logic is introduced," softened per the Drift table (execution is not guaranteed; hooks/scripts are the deterministic path). |
| q5 | a | Status-line config (/statusline or the statusLine block) and the stdin-JSON → script → stdout flow (model/style/context/cost/transcript_path); ANSI color. | Book pp. 22–34 | [E2] | High — the command, config, scripts, and ANSI are the book's; the explanation notes the output_style.name nesting correction from [E2]. |
| q6 | b | Synthesis: output style vs CLAUDE.md vs --append-system-prompt vs subagent vs Skill, plus the honest multi-instance framing (subagents stable / agent teams experimental-gated; "one instance per output style" is the book's metaphor). | Book pp. 19–38 + the layer distinctions | [E1], [E4], [E5], [E7], [E8], [E9] | High — the one enrichment-grounded synthesis question. The comparison is from [E1]/[E4]/[E5]/[E8]; the parallel-work reframe and the CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS gating from [E7]/[E9]. |
Drift / Corrections Applied
This chapter's central surface had drifted materially since the book — unlike Chapter 7. The book's primary command was removed, and the built-in styles and frontmatter both grew. All items verified against the canonical docs ([E1] output-styles and [E2] statusline fetched directly). The book's original wording is preserved verbatim in extracted-chapters/ and is not edited.
2026-06-15 accuracy re-audit. A follow-up review (verified against [E1] output-styles, [E2] statusline, [E3] settings, [E5] cli-reference) tightened five things across the lesson, quiz, this ledger, and the training-output mirror: (1) every place that switched an output style now makes the/clear-or-new-session step explicit before observing the change (it was stated as a rule but the practical steps implied immediate effect); (2) the embedded-workflow claims were softened from "the style carries out a procedure on every response" to "the style asks Claude to — an instruction, not a guaranteed action — and for must-run steps use a hook/script"; (3) the book's "/statuslinespawns a sub-agent" claim was dropped (unsupported by [E2]; the docs say it generates a script in~/.claude/and updates settings automatically) and the practical exercise no longer implies a project-settings picker; (4) the settings-precedence summary was corrected from the wrong "managed → user → project → local" to the documented managed → command-line args → local → project → user; (5) the §4 analogy was reworked (rubber-stamp → order-ticket-note vs. conveyor-belt) to carry the nudge-vs-guarantee distinction. The new rows below (marked 2026-06-15) record each. The verbatim extract was not edited.
| Item | Book position | Current / correct position | Lesson treatment |
|---|---|---|---|
/output-style command removed (CORRECTION — central) | The book lists and switches output styles with a standalone /output-style command throughout (extract pp. 2, 5–6, and every figure). | The standalone /output-style command was deprecated in v2.1.73 and removed in v2.1.91. You now switch styles via /config → Output style (saved to .claude/settings.local.json) or by setting the outputStyle field in a settings file. | A prominent currency note in "Why this chapter matters" plus §1 teach /config/outputStyle as current and flag /output-style as removed (with the version). The practical-exercise Part 1 and the common-pitfalls call it out. q1 makes the correction part of the correct answer. Soft-worded ("verify against the docs") per the project rule. |
| Built-in styles: Proactive added (COMPLETION) | Book lists three built-ins: Default, Explanatory, Learning (extract pp. 2–3) — and flags in a margin note that the set "may evolve over time." | Current [E1] lists four: Default, Proactive (executes immediately, prefers action over planning; still shows permission prompts), Explanatory, Learning. | §1 lists all four with one-line descriptions, quotes the book's own "may evolve" note, and tells the learner to check /config on their install. |
keep-coding-instructions frontmatter field (COMPLETION — load-bearing) | The book says selecting a custom style "removes its default software engineering instructions and substitutes them" (extract p. 5) but never mentions any way to keep them. | Per [E1], a custom style drops Claude Code's software-engineering instructions only if keep-coding-instructions is false (the default); set it true to keep both the engineering brain and your custom instructions. | §2 is built around this field (with Figure 8.A and the Diagrams first example), and the practical-exercise Part 3 makes the learner feel the difference. q2's correct answer hinges on it. Framed as the field "the book never mentions." |
| Custom-style frontmatter & third scope (COMPLETION) | Book shows only a description frontmatter line and two scopes (user ~/.claude/output-styles/, project .claude/output-styles/) (extract pp. 3–4, 10). | [E1] documents frontmatter name, description, keep-coding-instructions, force-for-plugin, and a third managed-policy location (plus plugins shipping styles in output-styles/). | §1 lists the frontmatter fields and notes the managed-policy scope + plugin styles as a parenthetical; the two user-authored scopes stay the focus. |
| Output-style ↔ system-prompt mechanics (CLARIFICATION) | Book says the style "replaces parts of Claude Code's system prompt" and "the modified system prompt is sent directly to the LLM with each request" (extract pp. 5–6) — correct but partial. | [E1]: instructions are appended to the end of the system prompt; the style is read once at session start (changes apply after /clear/restart); reminders keep Claude adhering. | §1/§2 state "appended to the end" and "read once at session start"; the practical exercise notes the take-effect-after-/clear behavior. Grounded in [E1]/[E6]. |
| Output style vs CLAUDE.md / flags / subagents / Skills (COMPLETION — synthesis) | The book does not contrast output styles with these other tools. | [E1]'s "Comparisons to related features" table: output style modifies the system prompt; CLAUDE.md adds a user message after it; --append-system-prompt appends one-off; agents = scoped helper; Skills = on-demand. | §2 reproduces the comparison table and stresses the output-style-vs-CLAUDE.md distinction ("for project conventions, use CLAUDE.md instead"). q6 is the synthesis question. Pure enrichment, labeled here. |
Status-line JSON field is output_style.name (CORRECTION) | The book's minimal script reads a bare string: style = input_data.get("output_style", "default") (extract p. 25). | Per [E2], the field is nested: output_style.name. The book's read returns the dict, not the name. | §5 reproduces the book's one-liner, then explicitly corrects it: a robust current read is input_data.get("output_style", {}).get("name", "default"). The practical-exercise hand-written script uses the nested field; q5's explanation notes it; common-pitfalls flags it. |
| Status-line JSON schema is much larger (COMPLETION) | Book surfaces output_style and transcript_path (extract pp. 25, 29). | [E2] documents a large schema: model.display_name/id, output_style.name, context_window.used_percentage/remaining_percentage/context_window_size, cost.total_cost_usd, workspace.current_dir/repo, transcript_path, and conditional agent/pr/worktree/rate_limits. | §5 lists the richer field set and links [E2] for the current schema (soft-worded — "the schema grows between releases"). |
| Status-line settings scope (SOFTENING) | Book points the statusLine config at global ~/.claude/settings.json (extract pp. 23–24). | [E2]: both user (~/.claude/settings.json) and project (.claude/settings.json) are valid. | §5 notes project scope is also valid; the practical exercise uses project scope for reversibility. The book's global path is preserved as the book's choice. |
uv run vs python3 (NOTE, not a correction) | Book runs the status-line script via the UV package manager (uv run ~/.claude/statusline.py, extract pp. 23–24). | A status line can run any executable; the book's script is stdlib-only, so plain python3 works without installing uv. | §5 keeps the book's uv run example and the practical exercise uses python3 so no extra install is needed — both noted. |
| "Team of specialized agents" framing (FRAMING / SOFTENING) | The book presents running one instance per role/output-style as the path to a coordinated "team of specialized agents" (extract pp. 19–22, 35–38). | Per [E7]/[E8]/[E9]: output styles are per-session (so styled instances are real and useful), but the documented way to do coordinated, role-specialized parallel work is subagents (stable) or agent teams (experimental, disabled by default behind CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS). "One instance per output style" is the book's metaphor, not a documented architecture; the parallel-work docs never coordinate by output style. | §6 takes the vision seriously and draws the honest line (metaphor vs documented tools; agent teams experimental + gated). The closing analogy and q6 carry the same nuance. The thesis ("a configurable system, not a fixed interface") is kept as the book's. |
Output-style switch needs /clear/new session — made explicit (CLARIFICATION — 2026-06-15) | The book switches styles with /output-style and shows the new style taking effect in the same session. | Per [E1], the output style is read once at session start; a change takes effect after /clear or a new session. | Row above (system-prompt mechanics) already stated the rule; the 2026-06-15 re-audit made it operational — practical-exercise Parts 1–4 now insert an explicit /clear-or-new-session step before observing any style change, the "Expected outcome" lines note that asking without clearing returns the old style, and the success-checklist items name the /clear step. The common-pitfalls "read at session start" item is retained. |
| Embedded-workflow determinism softened (SOFTENING — 2026-06-15) | The book frames the ## Workflow instruction as the style reliably saving/opening files ("Claude Code generates the HTML page, writes it to disk, and opens it"; "no callable logic is introduced"). | An output style is system-prompt text: it can ask Claude to save a file / open a browser, but execution still depends on Claude's available tools, the user's permissions, the session mode, and Claude following the instruction. It's a strong nudge, not a guaranteed action; for deterministic per-event execution, the documented mechanism is a hook or script, not an output style. | §4 (heading "asks for more… embedded workflow instructions"), its prose, the §4 analogy (order-ticket note vs. conveyor belt), frontmatter objective 4, the activity step-4 note, and q4 (option + explanation) were all reworded from "carries out a procedure / on every response / the instructions are the program" to "asks Claude to… nudge-not-guarantee… use a hook/script for must-run steps." The book's "no callable logic"/"no code or plugins" wording is kept only as the book's phrasing, not as a guaranteed-workflow claim. |
/statusline "spawns a sub-agent" claim dropped + no project-settings picker (CORRECTION — 2026-06-15) | The book says running /statusline "initializes and spawns a sub-agent" that inspects settings and writes the script (extract pp. 23–24); an earlier draft of the lesson repeated this and had the lab choose "project settings" from the command. | Per [E2], the /statusline command "accepts natural language instructions… generates a script file in ~/.claude/ and updates your settings automatically." The docs do not describe a helper subagent, and there is no documented project-settings picker — project-scoped .claude/settings.json is a supported manual configuration path. | §5 now says /statusline "generates a script in ~/.claude/ and updates your settings automatically" (no subagent claim). Practical-exercise Part 4 makes the manual project-scoped .claude/settings.json path primary (self-contained/reversible) and presents /statusline as a faster alternative that writes to global ~/.claude/ with no project picker. |
| Settings precedence corrected (CORRECTION — 2026-06-15) | n/a — not in the book; an earlier draft's Further Reading summarized precedence as "managed → user → project → local." | Per [E3], highest→lowest is: Managed → command-line arguments → Local (.claude/settings.local.json) → Project (.claude/settings.json) → User (~/.claude/settings.json) (permission rules are the exception — they merge across scopes rather than override). | The Further Reading "Settings" bullet was corrected to the documented order with the permission-merge caveat. (No other artifact stated a precedence order.) |
| Canonical docs host (NOTE) | n/a | The canonical host is code.claude.com; docs.claude.com / docs.anthropic.com mirror/redirect. | The lesson and further reading cite code.claude.com throughout. |
Extraction caveat (image-only PDF, summarized prose)
source-pdfs/08-chapter-08.pdf is an image-only PDF — every page is a set of rendered images with no text layer (the image-only check printed 0). Standard extraction was impossible. The source-of-truth extracted-chapters/08-chapter-08.md was produced by rendering each of the 39 pages to PNG at 150 DPI (PyMuPDF / fitz) into work/08-chapter-08-pages/ and transcribing the images visually. Consequences a reviewer should know:
- Mixed-fidelity extract. To avoid reproducing a copyrighted Packt chapter at length, the explanatory prose in the extract is captured as faithful section-by-section summaries, while headings, code blocks, commands, YAML/JSON, file paths, key names, and flags are verbatim (these are the functional elements the lesson depends on). Treat code/config/paths as exact; treat prose as a structural summary. If exact sentence wording is needed for a citation, re-open the page images in
work/08-chapter-08-pages/. - Page markers are reliable (clean per-page boundaries), but printed book page numbers are unknown —
<!-- page N -->is the PDF page index, not the book's printed page. There is no.txtmirror. - The book's figures are screenshots/illustrations (terminal/editor/browser captures, plus the "Human–AI collaboration" and "Neo-Genius" illustrations). They are not transcribed pixel-for-pixel and not reproduced in the lesson (we have no rights, and they're bitmaps). Figure captions and the gist are preserved in the extract as
[Figure: …]placeholders. The two lesson diagrams are original pedagogical SVGs. - A few code regions were screenshots (Figs 8.12/8.17 of
statusline.py); the same code is given in clean body text on pp. 25–26 and 32–33, which is what the lesson uses. Two prose lines were partly cut by the page fold/UI chrome (the page-18## Workflowsnippet; the page-10yaml-concisedescription:line) — captured as far as legible and noted in the extract. - Re-transcription, not OCR. No OCR engine or PDF rasterizer was available locally; PyMuPDF was installed specifically to render the pages. If exact wording matters for a citation, cross-check against the printed book.
Source PDF: source-pdfs/08-chapter-08.pdf
Extracted source: extracted-chapters/08-chapter-08.md