Recipes / Claude Code use cases
Claude CodeWorkflowDev & code

Treat the workflow, not the agent, as the product

Replies describe running Claude Code headless with claude -p from scripts and cron, wrapped in a simple state machine: task record, bounded run, artifacts, checks, human approval.

From r/ClaudeCode on Reddit

Setup time30 min
CostIncluded in plan
RunsPer automated task
NeedsClaude Code (claude -p), scripts or CI
Last updated2026-10-17

What the source did

  • One commenter runs several headless instances in tmux and chains tasks with a bash script.
  • Another suggests layering: CLAUDE.md rules, then a few skills, then a typecheck hook.
  • Another lays out a safe automation shape that ends in human approval before merge.

Summary written by Agent Cookbook. See the original for the full context.

Copy the prompt

Ours Our version, based on what r/ClaudeCode described. Not their wording. Fill in the [BRACKETS].

claude -p with this prompt, from a script: Task: [TASK RECORD: repo, path, objective, constraints]. Work only in [PATH]. When done, write handoff.md: files changed, assumptions, tests run, open questions. Do not commit. (The script then runs [CHECKS] outside the agent and only notifies me if they pass.)

Approval rule

🛡
Plans and merges are approved by a human; the script never auto-merges.

Set it up

  1. Write a task file per job.
  2. Run claude -p with --allowedTools limited to what the task needs.
  3. Run checks outside the agent.
  4. Review handoff.md and approve the merge.

Common failures

⚠
  • Automating plan approval too early.
  • No artifact means you can't tell the run happened; always write handoff.md.

Variations

  • Same pattern with codex exec.

Get the 10 best agent setups. Free.

Plus new recipes every week. One email, no spam.

Unsubscribe anytime. Privacy

Related recipes

More Claude Code use cases →

Read original ↗