[FEATURE] Add --output-style flag for non-interactive mode

Status Fixed / completed
Maintainer reply ✓ Yes — dicksontsai
Activity 5 comments · opened Sep 10, 2025 · closed Sep 11, 2025
💡 Likely answer: A maintainer (dicksontsai, collaborator) responded on this thread — see the highlighted reply below.

Preflight Checklist

  • [x] I have searched existing requests and this feature hasn't been requested yet
  • [x] This is a single feature request (not multiple features)

Problem Statement

Currently, output styles work perfectly in interactive mode via /output-style <CUSTOM_STYLE>, but there's no equivalent for non-interactive/programmatic usage with --print mode. This creates a gap for automation workflows that need consistent, structured responses.

Verbose and error-prone

claude --print --append-system-prompt "CRITICAL: Output pure JSON without explanations..."  "Analyze strength & weakness of architecture"

Proposed Solution

# Clean and intuitive
claude --print --output-style architecture-json "Analyze strength & weakness of architecture"

Alternative Solutions

_No response_

Priority

High - Significant impact on productivity

Feature Category

CLI commands and flags

Use Case Example

  • CI/CD Integration: Automated analysis reports with consistent JSON structure
  • Docker/Container Workflows: Microservices orchestration requiring predictable output

formats

  • API Integration: Programmatic consumption of Claude responses
  • Batch Processing: Large-scale analysis with standardized output schemas

Additional Context

Implementation Details

The feature should:

  1. Load output styles from ~/.claude/output-styles/*.md
  2. Apply the style's system prompt when --print and --output-style are used together
  3. Provide clear error messages for invalid style names

Benefits

  • Consistency: Eliminates manual system prompt management
  • Maintainability: Centralized style definitions in .md files
  • Developer Experience: Matches the intuitive /output-style command from interactive mode
  • Automation-Friendly: Essential for programmatic Claude Code usage

View original on GitHub ↗

5 Comments

dicksontsai collaborator · 1 year ago

You can specify outputStyle through the settings flag:

claude --settings "{\"outputStyle\": \"Explanatory\"}"
0x4rm4nd · 1 year ago
You can specify outputStyle through the settings flag: `` claude --settings "{\"outputStyle\": \"Explanatory\"}" ``

@dicksontsai Unfortunately, it does not seem to work with custom output style.

armand@MacBook-Pro-de-Armand ~ % claude --dangerously-skip-permissions   
╭───────────────────────────────────────────────────╮
│ ✻ Welcome to Claude Code!                         │
│                                                   │
│   /help for help, /status for your current setup  │
│                                                   │
│   cwd: /Users/Armand                              │
╰───────────────────────────────────────────────────╯

> /output-style 
  ⎿  Set output style to json

> What is the capital of France

⏺ {"short_description": "france-capital-query", "complexity_level": 1, "focus_areas":
  ["general-knowledge"]}

> /output-style 
  ⎿  Set output style to default

> What is the capital of France

⏺ Paris

armand@MacBook-Pro-de-Armand ~ % claude --settings "{\"outputStyle\": \"json\"}" -p "What is the capital of France"
The capital of France is Paris.
dicksontsai collaborator · 1 year ago

What does your output style menu look like? The name has to match exactly. /output-style does a case-insensitive search.

0x4rm4nd · 1 year ago

Name was matching perfectly, this was kind of odd.
I tried again with a simpler prompt, and indeed it was formatting the output the way I expected it to be with your solution.

Probably the custom output style prompt was somehow confusing for the agent and the results I had were pure bad luck.

Sorry for the confusion & thanks for your follow-up.

github-actions[bot] · 1 year ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.