Promptles
Claude Code

Headless Mode (claude -p)

intermediate

Definition

Running Claude Code as a single command, `claude -p "..."`, so it does one task, prints the answer, and exits without opening a chat, which lets scripts and scheduled jobs use it.

In the wild

Every morning a scheduled job runs `claude -p "Summarize yesterday's error log in three bullets"` and posts the result to the team chat.

More from Claude Code