Claude Code Output Styles
Output Style lets you customize Claude Code's interaction style and response approach, adapting it to more use cases beyond software development, while retaining core functions like running local scripts, reading and writing files, and tracking to-dos.
Essentially, it changes Claude Code's interaction logic and response style by modifying the System Prompt.
Built-in output styles
Claude Code provides 3 out-of-the-box output styles:
| Style Name | Applicable scenarios | Core features |
|---|---|---|
| Default style (default) | Everyday software engineering tasks | Focuses on efficiently completing coding, debugging, refactoring, etc., with concise and direct replies |
| Explanatory style (explanatory) | Learn-by-doing scenarios | Explains implementation ideas, design patterns, and other concepts while completing tasks, suitable for developers who want to understand code deeply |
| Learning style (learning) | Active hands-on learning | Collaborates with you on tasks, adding TODO(human) markers at key points to guide you to implement core code snippets yourself, rather than giving answers directly |
How It Works
When switching output styles, Claude Code adjusts the system prompt according to these rules:
- All styles remove default constraint instructions like "concise replies, efficient output"
- Custom styles by default remove coding-related instructions like "verify code with tests" (to keep them, enable
keep-coding-instructions: true) - Each style appends custom rules at the end of the system prompt, overriding default behavior
- Compliance checks are triggered during conversations to ensure Claude always follows the current style's instructions
Switching output styles
There are two ways to switch styles; the configuration is saved in the project directory's .claude/settings.local.json file, theonly effective for the current project:
Method 1: Menu selection- After entering the command, select the target style in the interactive menu:
/output-style
Method 2: Specify directly- Add the style name directly after the command, in one step:
/output-style explanatory
/output-style learning
/output-style default
Besides switching with commands, you can also directly edit
.claude/settings.local.json(project level) or~/.claude/settings.json(global level) files, modifying theoutputStylefield's value to switch styles.
Creating custom output styles
If the built-in styles do not meet your needs, you can define your own styles through Markdown files.
1. File save location
| Level | Save path | Scope |
|---|---|---|
| User level | ~/.claude/output-styles/ |
Available to all projects of the current user |
| project-level | .claude/output-styles/(in the project root directory) |
Available only to the current project, can be committed to git and shared with the team |
2. File format
A custom style file consists of two parts: the top YAML frontmatter(metadata configuration) and the lower Markdown body(specific instruction content).
Example
name
:
data-analyst
Style name, shown in the /output-style menu (uses the filename if not filled)
description
:
Focuses on transforming complex data into visual reports and analysis conclusions
Style description, shown in the menu's descriptive text (optional)
keep-coding-instructions
:
false
Whether to retain default coding-related instructions
false (default): removes coding instructions, suitable for non-development scenarios
true: retains coding instructions while layering custom rules on top
Role definition
You are a professional data analysis assistant, skilled at using Python to process various structured data,
and transforming complex data into concise, easy-to-understand visual reports.
Response rules
1
. All analyses must contain three parts: "Conclusion + Data Support + Optimization Suggestions"
2
. Generated code must include detailed comments; prefer Pandas and Matplotlib
3
. Avoid piling up jargon; explain complex concepts in plain language
Format requirements
1
. Display the conclusion section in bold
2
. Wrap code blocks with ```python tags
3
. Present suggestions as an ordered list
Special scenarios
1
. When encountering missing data, proactively prompt the user to provide key information rather than throwing an error directly
2
. When generating visualizations, use Chinese labels and a light theme by default
3. Frontmatter parameter descriptions
| Parameter name | Required | Description | Default value |
|---|---|---|---|
name |
No | Style name, shown in the /output-style menu. Uses the filename if not filled (without the .md extension) |
File Name |
description |
No | A brief description of the style's function, shown in the menu's descriptive text to help distinguish multiple custom styles | None |
keep-coding-instructions |
No | Whether to retain coding-related instructions in the default system prompt. Set to true , and custom instructions will be layered on top of the default coding instructions |
false |
4. Usage steps
- Create a
.mdfile in the above format (for example,data-analyst.md) - and place the file in the appropriate directory:
~/.claude/output-styles/data-analyst.md.claude/output-styles/data-analyst.md- Run
/output-stylein Claude Code, and you will see and be able to select the newly created style in the menu
Differences from related features
Output styles may seem similar to the following features, but they work at different levels:
| Comparison target | Core difference |
|---|---|
| Output style vs CLAUDE.md | Output stylesReplacementreplace the default software engineering system prompt, fundamentally changing Claude's working mode; CLAUDE.md appends project background and conventions as user messages, without modifying the system prompt itself |
| Output style vs --append-system-prompt | Output style replaces and disables the default prompt;--append-system-prompt --append-system-prompt appends content at the end of the default prompt; both retain the original prompt |
| Output style vs Subagent | Output style modifies the main agent's system prompt, affecting the global interaction style; a subagent is an independent task-processing module with customizable model, tools, and trigger conditions, which returns results after handling a specific subtask |
| Output style vs custom slash commands | An output style is a "stored system prompt" that determines Claude's overall interaction style; a custom slash command is a "stored user prompt" used to quickly execute a specific instruction or task |
Custom style template
The following is a general custom output style template; replace the [ ] content with your actual needs, save as .md a file, and it is ready to use:
Example
name
:
[
Style name, for example: Writing Assistant
]
description
:
[
A one-sentence description of its purpose, for example: focuses on technical document writing, producing clearly structured and accurately expressed content
]
keep-coding-instructions
:
[
true or false
]
I. Core positioning
[
Define Claude's role and expertise, for example:
You are a professional technical document writing assistant, skilled at transforming complex technical concepts into clear and understandable text
]
II. Response rules
[
Define Claude's reply logic, for example:
1
. Every reply must contain three parts: "Core Point + Detailed Explanation + Example"
2
. Use active voice; avoid passive constructions
3
. Include a brief explanation when a technical term first appears
]
III. Formatting Requirements
[
Specify the layout format of the output, for example:
1
. Use headings
Heading 2
2
. Use code blocks for code examples and label the language type
3
. Mark key information in bold
]
IV. Special Scenario Handling
[
Rules for handling specific situations, for example:
1
. When examples are needed, prefer real scenarios over abstract ones
2
. When facing unclear requirements, confirm the intent before starting to write
]