Home
cd ../playbooks
Developer ToolsBeginner

Explanatory Coding Mode

Get educational insights about implementation choices and codebase patterns as Claude works — formatted, codebase-specific commentary woven into the session, not a generic tutorial.

2 minutes
By AnthropicSource
#output-style#learning#codebase-onboarding#session-start#official

Claude just refactored your auth middleware and you have no idea why it made the choices it did. You could ask, but that's another round trip — and by the time you think to ask, you've already moved on and lost the moment where the explanation would have stuck.

Who it's for: developers learning an unfamiliar codebase, engineers onboarding onto a new team's project, anyone maintaining a repo they inherited, developers who want to understand the 'why' behind AI-generated changes, not just the 'what'

Example

"Add rate limiting to the API" → Before implementing, a boxed insight explaining why the existing middleware order matters and which existing pattern to match; after implementing, a second insight explaining why a sliding window was chosen over a fixed one, tied to how the codebase already handles session TTLs

CLAUDE.md Template

New here? 3-minute setup guide → | Already set up? Copy the template below.

Or install from your terminal:
npx ccplaybooks add explanatory-coding-mode
# Explanatory Coding Mode

## Your Role

You are in **explanatory mode**. As you help with my task, you also teach me about the codebase you're working in. You are clear and educational, providing helpful explanations while staying focused on the task.

Balance educational content with task completion. When providing insights, you may exceed typical length constraints — but stay focused and relevant. Explanation is a supplement to the work, not a replacement for it.

---

## Insights

Get new playbooks like this one

One email a week with new Claude Code workflows. Free, like everything here.

No spam. Unsubscribe anytime.

README.md

What This Does

Recreates the deprecated "Explanatory" output style as a CLAUDE.md instruction set. Claude provides brief, formatted educational insights before and after writing code — focused specifically on this codebase's patterns and trade-offs, not general programming theory. Insights appear in conversation, never as comments injected into your source files.


Quick Start

Step 1: Navigate to Your Project

cd ~/your-project

Step 2: Download the Template

Click Download above, then:

mv ~/Downloads/CLAUDE.md ./

Step 3: Start Working

claude

Work normally — the insights appear automatically as Claude writes code.


What "Codebase-Specific" Means

The whole value of this mode is specificity. A generic insight teaches nothing you couldn't get from a textbook; a codebase-specific one teaches you this project.

Generic (low value) Codebase-specific (the actual goal)
"Dependency injection makes code testable" "This repo injects the DB client through the constructor rather than importing it — that's why UserService takes a db param instead of reaching for the singleton"
"Error handling is important" "This codebase swallows errors at the route boundary and re-throws typed errors from the service layer — following that split rather than catching here"

Tips & Best Practices

  • Insights arrive as you go, not saved for a summary at the end — the value is catching the reasoning while it's still attached to the decision
  • Nothing gets written into your source files — insights live in conversation only
  • Costs extra tokens — both the added instructions and the longer responses. Worth it when understanding matters as much as shipping; skip it for repetitive work in a codebase you already know

When to Use This

Best for unfamiliar codebases, onboarding, and inherited repos. Less useful for time-critical fixes or bulk mechanical work.

If you want to go further and actually write some of the code yourself at key decision points rather than just reading explanations, pair this with the Learning Mode Coding Coach playbook — it includes everything here plus interactive contribution requests.

$Related Playbooks

Developer Tools

7-Phase Feature Development Workflow

Structured feature development that explores the codebase, asks every clarifying question up front, presents multiple architecture options with a recommendation, and runs a three-angle quality review before calling it done.

5 minutes
Intermediate
Developer Tools

Firecrawl Developer Research: Code, Issues & PRs

Investigate library and API bugs, behavior, and version discrepancies using public repository code, issues, and pull requests when the docs aren't enough

10 minutes
Intermediate
Developer Tools

Firecrawl Docs Reader: Answers From Official Documentation

Answer library, SDK, and API questions from current official docs, with version-matched code and citations instead of remembered guesses

10 minutes
Beginner
Developer Tools

Frontend UX Pattern Library

Concrete, research-backed patterns for SaaS dashboards, landing pages, and forms — plus accessibility requirements, Tailwind implementation gotchas, and a pre-delivery checklist that treats accessibility as a launch blocker, not a nice-to-have.

5 minutes
Intermediate
Developer Tools

AI Crawler Access Audit: Who Can Actually Read Your Site

Maps 14 AI crawlers against your robots.txt, meta tags, and HTTP headers, then returns an access score and the exact rules to change

10 minutes
Intermediate
Developer Tools

llms.txt Generator & Auditor

Generate and validate llms.txt, the root-level Markdown file that tells AI systems what your site is and which pages to cite

10 minutes
Intermediate
Developer Tools

Full-Output Enforcement: No Placeholders, No Stubs

A short rule set that bans TODO comments, skeleton code, and 'rest follows the same pattern' shortcuts so Claude always delivers complete, runnable output

2 minutes
Beginner
Developer Tools

Ginkgo Table and Dynamic Specs

Parameterize and generate Ginkgo test specs correctly — DescribeTable/Entry, the four ways to name an entry, DescribeTableSubtree for multi-It rows, reusable entry sets, and the one gotcha (Entry params evaluate at construction time, not BeforeEach time) that causes most table-spec bugs.

5 minutes
Intermediate
Developer Tools

Ginkgo Timeouts and Async Testing

Make Ginkgo specs interruptible and test asynchronous behavior correctly — SpecContext cancellation, NodeTimeout/SpecTimeout/GracePeriod, Eventually/Consistently with proper context propagation, and the two goroutine rules (GinkgoRecover, poll-don't-block) that prevent one failed assertion from crashing an entire Go test suite.

5 minutes
Intermediate
Developer Tools

Writing Ginkgo Specs

Author correct Ginkgo specs — container vs. subject vs. setup nodes, the declare-in-container/initialize-in-setup rule that prevents the most common Ginkgo bug, JustBeforeEach for separating creation from configuration, DeferCleanup for restore-not-clear teardown, and GinkgoHelper() for failure locations that point at the caller instead of the helper.

5 minutes
Beginner
Developer Tools

Git Conflict Resolution Framework

A plan-first framework for resolving Git merge conflicts by combining both branches' intent instead of blindly picking a side — categorized resolution patterns for imports, tests, generated files, configs, code logic, and struct definitions, with a mandatory approval step before any file is touched.

5 minutes
Intermediate
Developer Tools

Git Commit & PR Automation

Three streamlined git workflows: commit with an auto-drafted message matching your repo's style, ship a full commit-push-PR in one step, and clean up branches deleted on the remote.

5 minutes
Beginner

Browse all Developer Tools playbooks →