Tech Update / Adventures with Claude Code #13

Claude Code without a terminal – headless and GitHub Actions

So far I've always been sitting next to it: I type, Claude works, I check. For some tasks I eventually asked myself: do I actually need to be there?

I don't. Claude Code also runs without a chat window.

🤖 Headless: claude -p

With -p, Claude gets a single task, prints the answer to the console and exits. That means Claude fits into any script, pipe or cron job:

git diff main | claude -p "Review these changes for security issues. Answer in five sentences."

Two options I use all the time:

  • --output-format json for output another script will process.
  • --allowedTools defines exactly which tools Claude may use.

Typical uses for us: generating a changelog from commits, finding missing translations in the i18n files, explaining lint errors in plain language.

🐙 GitHub Actions

Run /install-github-app in Claude Code to set up the GitHub app and workflow. After that, an @claude in an issue or pull request is enough: Claude reviews, answers questions or implements the task directly as a commit. Results show up as comments, right where the team already works.

A word of caution:

Without a terminal, nobody is there to confirm “Allow?”. So keep permissions tight: only the tools the job really needs (see part 7). The API key belongs in repository secrets, never in the code. And every run costs tokens, so don't trigger it on every push.

My rule of thumb:

  • Recurring and repetitive? claude -p in a script.
  • Team work on issues and PRs? GitHub Action.
  • Unclear or creative? Interactive, with you sitting next to it.

← Back to overview