cli-reference

Document Claude Code CLI flags, options, and usage patterns.

5|1|Updated Oct 30, 2025
One-click install
npx skills add https://github.com/reggiechan74/claude-plugins --skill cli-reference
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cli-reference
Source: https://github.com/reggiechan74/claude-plugins/tree/main/plugins/claude-code-metaskill/skills/cli-reference
Command: npx skills add https://github.com/reggiechan74/claude-plugins --skill cli-reference

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Users need a comprehensive guide to Claude Code's command-line interface (CLI) to leverage its full power for interactive sessions, automation, and scripting. This Skill provides a complete reference, making advanced usage accessible.

Core Features & Use Cases

  • Command Overview: Detailed usage for interactive, non-interactive, and maintenance commands, covering all core functionalities.
  • Key Flags & Options: Explanations for essential, configuration, output, and advanced CLI flags to customize behavior.
  • Permission Modes & Model Aliases: Understand how to control tool access and select AI models for specific tasks.
  • Use Case: If you need to run Claude Code in a script, consult this reference to find the --print, --output-format json, and --allowedTools flags for programmatic execution and seamless integration.

Quick Start

Show me how to use the --print flag to run a non-interactive query.

Frequently Asked Questions about cli-reference

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I run Claude Code in non-interactive mode from a script?

Use the `--print` flag to execute a single query without entering interactive mode. Pair it with `--output-format json` to get structured output suitable for programmatic parsing and automation workflows.

What command-line flags control which tools Claude Code can access?

The `--allowedTools` flag restricts which tools Claude Code can invoke during execution. This controls permissions for file operations, terminal commands, and other integrations, letting you enforce security policies in automated scripts.

How do I set up Claude Code to run automated tasks with custom configuration?

Combine environment variables with CLI flags like `--output-format`, `--print`, and `--allowedTools` to configure behavior for scripting. Pass model selection and permission settings at invocation to customize each automation workflow.

What are the syntax and usage patterns for Claude Code's essential flags?

Essential flags like `--print` for queries, `--output-format json` for structured responses, and `--allowedTools` for permissions define core CLI behavior. The reference provides complete flag definitions, aliases, and example commands for both interactive and batch modes.

Can I use environment variables to configure Claude Code's default behavior?

Yes. Claude Code supports environment variables for configuration across sessions, allowing you to set defaults for model selection, output formats, and tool permissions without repeating flags in every command invocation.

What output formats does Claude Code support for programmatic integration?

Claude Code supports JSON output format via the `--output-format json` flag, enabling seamless integration with scripts, pipelines, and other tools that consume structured data.