spacehub

surshar / claude-code

Claude Code is an agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster by executing routine tasks, explaining complex code, and handling git workflows - all through natural language commands.

Built by Anthropic · github.com/anthropics

Merge pull request #10495 from anthropics/dickson/explanatory-output-styleBrowse files
Implement Explanatory output style as a plugin
Dickson Tsai authored on Oct 29, 2025 · GitHub committed on Oct 29, 2025 parents 21bbc9f + 8b47e22 · commit 0c7d02b56f97
4 changed files+111 -0compared with 21bbc9f
Aplugins/explanatory-output-style/.claude-plugin/plugin.json
Aplugins/explanatory-output-style/README.md
Aplugins/explanatory-output-style/hooks/hooks.json
Aplugins/explanatory-output-style/hooks-handlers/session-start.sh
@@ -1,0 +1,9 @@
1+{
2+ "name": "explanatory-output-style",
3+ "version": "1.0.0",
4+ "description": "Adds educational insights about implementation choices and codebase patterns (mimics the deprecated Explanatory output style)",
5+ "author": {
6+ "name": "Dickson Tsai",
7+ "email": "dickson@anthropic.com"
8+ }
9+}
@@ -1,0 +1,72 @@
1+# Explanatory Output Style Plugin
2+
3+This plugin recreates the deprecated Explanatory output style as a SessionStart
4+hook.
5+
6+WARNING: Do not install this plugin unless you are fine with incurring the token
7+cost of this plugin's additional instructions and output.
8+
9+## What it does
10+
11+When enabled, this plugin automatically adds instructions at the start of each
12+session that encourage Claude to:
13+
14+1. Provide educational insights about implementation choices
15+2. Explain codebase patterns and decisions
16+3. Balance task completion with learning opportunities
17+
18+## How it works
19+
20+The plugin uses a SessionStart hook to inject additional context into every
21+session. This context instructs Claude to provide brief educational explanations
22+before and after writing code, formatted as:
23+
24+```
25+`★ Insight ─────────────────────────────────────`
26+[2-3 key educational points]
27+`─────────────────────────────────────────────────`
28+```
29+
30+## Usage
31+
32+Once installed, the plugin activates automatically at the start of every
33+session. No additional configuration is needed.
34+
35+The insights focus on:
36+
37+- Specific implementation choices for your codebase
38+- Patterns and conventions in your code
39+- Trade-offs and design decisions
40+- Codebase-specific details rather than general programming concepts
41+
42+## Migration from Output Styles
43+
44+This plugin replaces the deprecated "Explanatory" output style setting. If you
45+previously used:
46+
47+```json
48+{
49+ "outputStyle": "Explanatory"
50+}
51+```
52+
53+You can now achieve the same behavior by installing this plugin instead.
54+
55+More generally, this SessionStart hook pattern is roughly equivalent to
56+CLAUDE.md, but it is more flexible and allows for distribution through plugins.
57+
58+Note: Output styles that involve tasks besides software development, are better
59+expressed as
60+[subagents](https://docs.claude.com/en/docs/claude-code/sub-agents), not as
61+SessionStart hooks. Subagents change the system prompt while SessionStart hooks
62+add to the default system prompt.
63+
64+## Managing changes
65+
66+- Disable the plugin - keep the code installed on your device
67+- Uninstall the plugin - remove the code from your device
68+- Update the plugin - create a local copy of this plugin to personalize this
69+ plugin
70+ - Hint: Ask Claude to read
71+ https://docs.claude.com/en/docs/claude-code/plugins.md and set it up for
72+ you!
@@ -1,0 +1,15 @@
1+{
2+ "description": "Explanatory mode hook that adds educational insights instructions",
3+ "hooks": {
4+ "SessionStart": [
5+ {
6+ "hooks": [
7+ {
8+ "type": "command",
9+ "command": "${CLAUDE_PLUGIN_ROOT}/hooks-handlers/session-start.sh"
10+ }
11+ ]
12+ }
13+ ]
14+ }
15+}
@@ -1,0 +1,15 @@
1+#!/bin/bash
2+
3+# Output the explanatory mode instructions as additionalContext
4+# This mimics the deprecated Explanatory output style
5+
6+cat << 'EOF'
7+{
8+ "hookSpecificOutput": {
9+ "hookEventName": "SessionStart",
10+ "additionalContext": "You are in 'explanatory' output style mode, where you should provide educational insights about the codebase as you help with the user's task.\n\nYou should be clear and educational, providing helpful explanations while remaining focused on the task. Balance educational content with task completion. When providing insights, you may exceed typical length constraints, but remain focused and relevant.\n\n## Insights\nIn order to encourage learning, before and after writing code, always provide brief educational explanations about implementation choices using (with backticks):\n\"`★ Insight ─────────────────────────────────────`\n[2-3 key educational points]\n`─────────────────────────────────────────────────`\"\n\nThese insights should be included in the conversation, not in the codebase. You should generally focus on interesting insights that are specific to the codebase or the code you just wrote, rather than general programming concepts. Do not wait until the end to provide insights. Provide them as you write code."
11+ }
12+}
13+EOF
14+
15+exit 0