YouTip LogoYouTip

Claude Code Outputstyles

Output Style allows you to customize the interaction style and response method of Claude Code, making it suitable for more use cases beyond software development, while retaining core features such as running local scripts, reading and writing files, and tracking to-do items. Its essence is to change the interaction logic and response style of Claude Code 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)** | Daily software engineering tasks | Focuses on efficiently completing coding, debugging, refactoring, etc., with concise and direct replies | | **Explanatory Style (explanatory)** | Learn-as-you-do scenarios | Explains implementation ideas, design patterns, and other knowledge points while completing tasks, suitable for developers who want to deeply understand the code | | **Learning Style (learning)** | Active practice-based learning | Collaborates with you to complete tasks, adds `TODO(human)` markers at key positions, guiding you to implement core code snippets yourself instead of directly giving the answer | * * * ## How It Works When switching output styles, Claude Code adjusts the system prompt according to the following rules: 1. All styles remove default constraint instructions like "concise replies, efficient output" 2. Custom styles remove coding-related instructions like "verify code with tests" by default (if you need to keep them, you can enable `keep-coding-instructions: true` in the style file) 3. Each style appends custom rules at the end of the system prompt, overriding the default behavior 4. Compliance checks are triggered during the conversation 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 `.claude/settings.local.json` file in the project directory and **only takes effect for the current project**: **Method 1: Menu Selection** β€” Enter the command, then select the target style in the interactive menu: /output-style **Method 2: Direct Specification** β€” Add the style name directly after the command, completing it in one step: /output-style explanatory/output-style learning/output-style default > Besides using commands to switch, you can also directly edit the `.claude/settings.local.json` (project-level) or `~/.claude/settings.json` (global-level) files, modifying the value of the `outputStyle` field to switch styles. * * * ## Creating Custom Output Styles If the built-in styles do not meet your needs, you can define an exclusive style through a Markdown file. ### 1. File Save Location | Level | Save Path | Scope | | --- | --- | --- | | **User Level** | `~/.claude/output-styles/` | Available for all projects of the current user | | **Project Level** | `.claude/output-styles/` (under the project root directory) | Only available for the current project, can be committed to git to share with the team | ### 2. File Format A custom style file consists of two parts: the **YAML frontmatter** at the top (metadata configuration) and the **Markdown body** below (specific instruction content). ## Example --- name: data-analyst # Style name, displayed in the /output-style menu (uses filename if not filled in) description: Focuses on transforming complex data into visual reports and analytical conclusions # Style description, displayed as explanatory text in the menu (optional) keep-coding-instructions: false # Whether to keep default coding-related instructions # false (default): Remove coding instructions, suitable for non-development scenarios # true: Keep coding instructions, superimposing custom rules on top --- # Role Positioning You are a professional data analysis assistant, skilled in using Python to process various structured data, and transforming complex data into concise and easy-to-understand visual reports. ## Response Rules 1. All analyses must include three parts: "Conclusion + Data Support + Optimization Suggestions" 2. Generated code must be accompanied by detailed comments, prioritizing the use of Pandas and Matplotlib 3. Avoid jargon stacking, explain complex concepts in plain language ## Format Requirements 1. Bold the conclusion section 2. Wrap code blocks using ```python tags 3. Present the suggestions section using an ordered list ## Special Scenarios 1. When encountering missing data, proactively prompt the user to supplement key information instead of throwing an error directly 2. When generating visual charts, use Chinese labels and a light theme by default ### 3. Frontmatter Parameter Description | Parameter Name | Required | Description | Default Value | | --- | --- | --- | --- | | `name` | No | Style name, displayed in the `/output-style` menu. If not filled, the filename (without the .md suffix) is used | Filename | | `description` | No | A brief description of the style's function, displayed as explanatory text in the menu to help distinguish multiple custom styles | None | | `keep-coding-instructions` | No | Whether to keep coding-related instructions in the default system prompt. When set to `true`, custom instructions will be superimposed on top of the default coding instructions | `false` | ### 4. Usage Steps 1. Create a `.md` file according to the above format (e.g., `data-analyst.md`) 2. Place the file in the corresponding directory: * Available for all projects: `~/.claude/output-styles/data-analyst.md` * Only available for the current project: `.claude/output-styles/data-analyst.md` 3. Execute `/output-style` in Claude Code, and you will see and be able to select the newly created style in the menu * * * ## Differences from Related Features Output styles look similar to the following features, but they act on different levels: | Comparison Object | Core Difference | | --- | --- | | **Output Style vs CLAUDE.md** | Output styles **replace** the default software engineering system prompt, fundamentally changing Claude's working mode; CLAUDE.md appends project background and conventions in the form of user messages, without modifying the system prompt itself | | **Output Style vs --append-system-prompt** | Output styles replace and turn off the default prompt; `--append-system-prompt` appends content at the end of the default prompt, both retain the original prompt | | **Output Style vs Subagent** | Output styles modify the main agent's system prompt, affecting the global interaction style; a subagent is an independent task processing module that can customize models, tools, and trigger conditions, returning results after processing specific subtasks | | **Output Style vs Custom Slash Commands** | Output styles are "stored system prompts" that determine Claude's overall interaction style; custom slash commands are "stored user prompts" used to quickly execute a specific instruction or task | * * * ## Custom Style Template Below is a universal custom output style template. Replace the content in `` with your actual needs, save it as a `.md` file, and it's ready to use: ## Example --- name: [Style name, e.g.: Writing Assistant] description: [One-sentence description of purpose, e.g.: Focuses on technical document writing, outputting well-structured and accurately expressed content] keep-coding-instructions: --- # I. Core Positioning [Define Claude's role and expertise, e.g.: You are a professional technical document writing assistant, skilled at transforming complex technical concepts into clear and easy-to-understand text] # II. Response Rules [Define Claude's reply logic, e.g.: 1. Each reply must include three parts: "Core Viewpoint + Detailed Explanation + Example" 2. Use active voice, avoid passive sentence structures 3. Provide a brief explanation when professional terms appear for the first time] # III. Format Requirements [Specify the output layout format, e.g.: 1. Use ## second-level headings for titles 2. Use code blocks for code examples, and indicate the language type 3. Mark key information in bold] # IV. Special Scenario Handling [Processing rules for specific situations, e.g.: 1. When examples are needed, prioritize real-world scenarios over abstract examples 2. When encountering unclear requirements, confirm the intent before starting to write]
← Claude Code Cli RefMl Hypothesis Limitations β†’