$ recombobulate _
home / tips / use-output-format-for-structured-json-responses
0

Use --output-format for Structured JSON Responses

bagwaa @bagwaa · Mar 25, 2026 · Workflows
use-output-format-for-structured-json-responses

Need Claude to return data in a format you can pipe into another tool? The --output-format flag forces structured JSON output.

claude -p "list all TODO comments in this project" --output-format json

Instead of a conversational response, you get clean, parseable JSON that you can feed directly into jq, a script, or another command.

This is essential for building automation on top of Claude Code. A few examples:

# Extract function names and pipe to another tool
claude -p "list all exported functions in src/utils/" \
  --output-format json | jq '.result'

# Generate a structured changelog
claude -p "summarise changes since last tag as JSON with
fields: type, scope, description" --output-format json

# Chain Claude into a shell pipeline
claude -p "analyse this error log" --output-format json \
  < /var/log/app.log | jq '.suggestions[]'

Combine this with the -p (print/pipe) flag for non-interactive usage. Together they turn Claude Code from a conversational tool into a programmable one.

# Non-interactive + structured output = scriptable Claude
claude -p "what dependencies are outdated?" \
  --output-format json > outdated.json

When you need data, not conversation — --output-format json makes Claude Code scriptable.

~/recombobulate $ tip --comments --count=0

Log in to leave a comment.

~/recombobulate $ tip --related --limit=3
0
Scan Pending Changes for Security Issues with /security-review

The /security-review command scans your uncommitted changes for injection vectors, auth gaps, hardcoded secrets, and other common vulnerabilities.

bagwaa @bagwaa · 1 hour ago
0
Run Setup Scripts on Every Session with the SessionStart Hook

The SessionStart hook fires when any session begins or resumes, making it ideal for loading environment variables and running one-time setup scripts.

bagwaa @bagwaa · 1 hour ago
0
Write Property-Based Tests with fast-check and Claude

Ask Claude to write property-based tests for your functions using fast-check — it identifies the mathematical invariants in your code and generates tests that cover inputs you'd never enumerate by hand.

bagwaa @bagwaa · 2 hours ago