Tips // Claude in practice

Tips for working better with Claude

One short tip at a time, with an example you can copy. Move through them at random or search for what you need.

Claude CodeIntermediateClaude Code

JSON output for other systems: the schema goes in the prompt

--output-format json returns JSON, but you define the expected structure in the prompt, and it is worth validating it in the pipeline.

The flag changes the format from prose to JSON; the fields, types and nesting are requested in the prompt text. The course makes clear that this guides the output but does not guarantee it: if you need strict conformance, validate the format, add retries and test in a controlled run before production.

Example
claude -p 'List all API endpoints in this codebase. Output a JSON array where each item has "path" (string) and "method" (string).' \
  --output-format json
#headless#json#ci#structured-output