Skip to main content
Recreates the deprecated Explanatory output style as a SessionStart hook, providing educational context about your code.
This plugin adds additional instructions and output to every session, which will increase token usage and costs.

Overview

The Explanatory Output Style plugin automatically enhances Claude’s responses with educational insights about:
  • Implementation choices and trade-offs
  • Codebase patterns and conventions
  • Design decisions specific to your project
  • Why certain approaches were chosen

Installation

This plugin is bundled with Claude Code. To enable it:
/plugin enable explanatory-output-style

How It Works

The plugin uses a SessionStart hook to inject additional context at the beginning of every session. This instructs Claude to provide brief educational explanations before and after writing code.

Insight Format

Educational insights appear in this format:
★ Insight ─────────────────────────────────────
[2-3 key educational points]
─────────────────────────────────────────────────

What You’ll Learn

Implementation Choices

Why specific approaches were selected for your codebase

Patterns & Conventions

Existing patterns in your code and how they’re applied

Trade-offs

Design decisions and their implications

Codebase-Specific Details

Insights tailored to your project, not generic advice

Example Interaction

When you ask Claude to implement a feature, you’ll see:
"Add authentication to the API"
Claude’s response:
★ Insight ─────────────────────────────────────
• Your codebase uses JWT tokens stored in httpOnly cookies
  for security (prevents XSS token theft)
• The middleware pattern in auth/middleware.ts follows your
  existing approach for request preprocessing
• Session timeout is set to 24h to match your user
  experience requirements from config/app.ts
─────────────────────────────────────────────────

Let me implement the authentication middleware...

[Code implementation]

★ Insight ─────────────────────────────────────
• Added rate limiting on login endpoint to prevent brute
  force attacks (consistent with your API security policy)
• Error messages intentionally vague ("Invalid credentials")
  to avoid username enumeration attacks
─────────────────────────────────────────────────

Migration from Output Styles

This plugin replaces the deprecated outputStyle setting:

Before (deprecated)

{
  "outputStyle": "Explanatory"
}

After (current)

/plugin enable explanatory-output-style

SessionStart Hook Pattern

This plugin demonstrates the SessionStart hook pattern, which is:
  • More flexible than the old output styles
  • Distributable through plugins
  • Similar to CLAUDE.md but for runtime behavior
For tasks beyond software development, use subagents instead of SessionStart hooks. Subagents change the system prompt, while SessionStart hooks add to it.

Managing the Plugin

Keep installed but turn off temporarily:
/plugin disable explanatory-output-style

Token Usage

The plugin adds approximately:
  • ~200 tokens to system prompt (per session)
  • ~50-150 tokens per insight shown
For a typical 20-turn session with 5 insights: ~450-950 additional tokens

Details

Name: explanatory-output-styleType: SessionStart HookAuthor: Dickson Tsai ([email protected])Version: 1.0.0Hook File: hooks-handlers/session-start.sh

Learning Output Style

Interactive learning with code contributions

Plugin Development

Create your own SessionStart hooks

Build docs developers (and LLMs) love