skip to content

How do you write and share a custom Claude Code output style, and what does its keep-coding-instructions field control?

level: middleimportance: should knowfreq 10%

answer

  1. a Markdown file with frontmatter
  2. user, project or managed folder
  3. file name unless name is set
  4. coding instructions dropped by default
  5. restart to pick up edits

basics

~10 s

A custom style is a Markdown file in ~/.claude/output-styles or a project's .claude/output-styles, with name, description and keep-coding-instructions frontmatter. Unless keep-coding-instructions is true, Claude Code leaves out its built-in software-engineering instructions.

solid answer

~40 s

Write a Markdown file: YAML frontmatter, then the instructions. Save it in `~/.claude/output-styles` for yourself or `.claude/output-styles` in the repository for the team; a managed-policy folder also exists. The file name is the style name unless the frontmatter sets `name`, and `description` shows in the picker. The key field is `keep-coding-instructions`, default `false`: a custom style then leaves out Claude Code's software-engineering instructions, such as how to scope changes, write comments and verify work. Set it to `true` when you only change how Claude communicates. To share, commit the file and set `outputStyle` to the style's exact name in `.claude/settings.json`. The terminal reads style files at startup, so restart after creating or editing one.

code

markdown · 13 lines
markdown
---
name: Team terse
description: Result first, numbered findings, no recaps
keep-coding-instructions: true
---

Lead every response with the outcome in one sentence.

## Reviews

- Number each finding and cite the file and line.
- Say which findings block a merge and which are suggestions.
- Skip any summary of what you just did.

go deeper

for a junior

Recall that a custom style is a Markdown file with frontmatter in ~/.claude/output-styles or .claude/output-styles, selected with /output-style or /config.

for a middle

Explain the frontmatter fields and their defaults, that keep-coding-instructions defaults to false and drops the engineering instructions, and how outputStyle in .claude/settings.json shares a team default.

for a senior

Diagnose why a custom style made Claude write code differently: missing or unparsed keep-coding-instructions, a stale file read at startup, or a local selection outranking the shared default.

for a principal

Weigh shipping a team voice as a committed project style against a plugin style that can force itself, and keep anything that must hold in hooks or permission settings rather than prose.

## What a custom style is A **custom output style** is a Markdown file: YAML **frontmatter** between `---` markers, followed by the instructions Claude should follow for every response in the session. Use one when a built-in style is not close enough, for example a team voice for reviews, or a role that is not a software engineer at all, such as a writing assistant or data analyst. ## Where the file lives | Level | Location | Who gets it | |---|---|---| | User | `~/.claude/output-styles/` | You, in every project | | Project | `.claude/output-styles/` in the repository | Everyone who clones it | | Managed policy | `.claude/output-styles` inside the managed settings directory | Everyone the organisation's policy reaches | | Plugin | an `output-styles/` directory in the plugin | Everyone who installs the plugin | Project styles load from every `.claude/output-styles/` between the working directory and the repository root. When two nested directories define a style with the same name, the one **closest to the working directory** wins. ## The frontmatter All fields are optional and use lowercase hyphenated names. | Field | Default | Effect | |---|---|---| | `name` | the file name | Name shown in the `/config` picker and used to select the style | | `description` | none | Text shown under the name in the picker | | `keep-coding-instructions` | `false` | `true` keeps Claude Code's built-in software-engineering instructions alongside the style | | `force-for-plugin` | `false` | Plugin styles only: applies the style whenever the plugin is enabled, overriding the user's `outputStyle` | ## What keep-coding-instructions controls The four non-default built-in styles keep Claude Code's engineering instructions and add their own. A **custom** style behaves differently: unless `keep-coding-instructions: true` is set, Claude Code **leaves out** its built-in software-engineering instructions, such as how to scope changes, write comments and verify work. That is right for a non-coding role and surprising for a team that only wanted a different voice: Claude keeps editing code, but without the guidance that normally shapes how it works. Rule of thumb: - Changing **how Claude communicates** while it still writes code: set `keep-coding-instructions: true`. - Turning Claude into **something other than a software engineer**: leave it out. ## Selecting and sharing a style 1. Write the file, for example `.claude/output-styles/team-terse.md`. 2. Commit it so teammates receive it with the repository. 3. Select it with `/output-style <name>` or the **Output style** entry in `/config`. Both write `.claude/settings.local.json`, which stays on your machine. 4. For a team default, set `outputStyle` to the style's **exact** name in the shared `.claude/settings.json`. The value is case-sensitive, and a value that matches no style name gives you Default. 5. Restart Claude Code in the terminal after creating or editing the file: style files are read at startup. ## Writing instructions that work - **Keep the style about voice, format and role.** Project facts such as build commands and conventions belong in CLAUDE.md, which stays loaded whichever style is active, so a teammate who switches styles does not lose them. - **Keep procedures out.** A release checklist or review procedure fits a skill, which loads only when invoked or when the task matches, instead of shaping every unrelated response. - **Keep it short.** The style's instructions travel with every request and add input tokens, though prompt caching reduces that cost after the first request in a session. ## Pitfalls - **Silent frontmatter failures.** A misspelled field is ignored without an error. If the YAML does not parse, the style still loads under its file name with **no fields set**, so `keep-coding-instructions` falls back to `false` and the engineering instructions disappear. `claude --debug` shows the parse error. - **A local choice outranks the team default.** A developer who picked a style with `/output-style` has it saved in `.claude/settings.local.json`, which takes precedence over the shared project file. - **Styles stay out of subagents.** Output styles apply to the main conversation and to a fork; other subagents run their own system prompt. - **It is still guidance.** Nothing enforces a style's instructions; a rule that must always hold belongs in a hook or a permission setting.

  • You fix a wording problem in the style file during a running terminal session, but Claude still answers the old way. Why?
    In the terminal, Claude Code reads output style files when it starts, so a file created or edited during a session is not picked up. Restart Claude Code, then select the style again if needed. Switching between styles that are already loaded applies from your next message.
  • The style's frontmatter has a YAML syntax error. What does Claude Code do with the file?
    It still loads the style under its file name, but with no frontmatter fields set. That quietly makes `keep-coding-instructions` false, so Claude Code's engineering instructions are left out, and drops the `name` and `description`. Run `claude --debug` to see the parse error.
  • Two nested .claude/output-styles directories in a monorepo define a style with the same name. Which one is used?
    Claude Code loads project styles from every `.claude/output-styles/` between the working directory and the repository root, and on a name collision it uses the one closest to the working directory. A package can override a repository-wide style by defining the same name nearer to where you run Claude Code.

  • Custom styles keep Claude Code's coding instructions unless told otherwise.
  • A misspelled frontmatter field makes the style fail to load with an error.
  • Edits to a style file apply at once in a running terminal session.
  • Only ~/.claude can hold custom styles; a repository cannot ship one.
  • outputStyle should be set to the style file's path.
  • keep-coding-instructions makes subagents use the style too.