using-claude-p

Run Claude Code non-interactively with -p/--print mode for scripting and automation.

4|Updated Dec 21, 2025
One-click install
npx skills add https://github.com/greenheadHQ/nixos-config --skill using-claude-p
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: using-claude-p
Source: https://github.com/greenheadHQ/nixos-config/tree/main/modules/shared/programs/claude/files/skills/using-claude-p
Command: npx skills add https://github.com/greenheadHQ/nixos-config --skill using-claude-p

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Non-interactive Claude Code enables scripting, automation, and headless execution without human prompts.

Core Features & Use Cases

  • Supports -p/--print mode for programmatic prompts and piped output.
  • Facilitates SSH remote execution, harness self-testing, and CI integration.
  • Handles flags like --output-format, --allowed-tools, --resume, and --dangerously-skip-permissions with clear guidance.

Quick Start

Run claude -p with a prompt piped from a file to execute a scripted task headlessly.

Frequently Asked Questions about using-claude-p

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

FAQPage Schema
How do I run Claude Code in a non-interactive shell script for automation?

Run Claude Code non-interactively in shell scripts by applying the -p/--print mode. This allows programmatic, headless execution by piping prompts directly into the command for automated task completion.

Can I use Claude Code for SSH remote execution and CI pipelines?

Yes, Claude Code supports SSH remote execution and CI pipeline integration. By leveraging non-interactive control and JSON output parsing, you can automate tasks across remote servers and within continuous integration workflows.

What is the best way to parse output from a headless Claude Code script?

The best way to parse headless Claude Code output is by using the --output-format flag to generate JSON. Parsing this structured JSON response allows scripts to reliably extract results and chain sessions programmatically.

How do I resume a Claude Code session in an automated pipeline?

You can resume a Claude Code session in an automated pipeline by applying the --resume flag. This enables session chaining, allowing subsequent non-interactive commands to maintain context from previous executions.

What are the limitations of using --dangerously-skip-permissions in Claude Code automation?

Using --dangerously-skip-permissions in Claude Code automation bypasses manual approval prompts for headless execution. This flag carries documented caveats and should be restricted to secure, isolated environments to prevent unintended system modifications.

Do I need to specify allowed tools when running Claude Code headlessly?

Yes, you should specify allowed tools using the --allowed-tools flag during headless execution. This restricts the non-interactive environment to approved actions, ensuring the scripted automation operates within safe, defined boundaries.