agentsclimarketplace

Claude headless p invocation

Skill bokuwalily/claude-code-skills/skills/claude-headless-p-invocation

75 battle-tested Claude Code skills from shipping 20+ apps solo — macOS, Next.js, Vercel, iOS/Expo, Cloudflare, Phaser, local AI media & more

Install
npx -y skills add bokuwalily/claude-code-skills --skill claude-headless-p-invocation

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its author says it does

Copied from the file, not written here

claude -p ヘッドレス実行で system prompt 全ロード + macOS perl alarm timeout + token 制限考慮した実行パターン。発火: 非対話的に claude を呼ぶ自動化スクリプト / cron で claude を回す時 / シェルから 1-shot 実行する時

SKILL.md

1.5 KB, as published. Nobody here has run it

Procedure

  1. 基本形: claude -p "<prompt>" --output-format text で stdout に結果
  2. timeout 付き (macOS は gtimeout 推奨, なければ perl alarm):
perl -e 'alarm shift; exec @ARGV' 300 claude -p "..." || echo "timeout"
  1. MAX_THINKING_TOKENS 抑制: 大型 prompt なら MAX_THINKING_TOKENS=10000 claude -p ...
  2. stderr 分離: claude -p "..." 2> /tmp/claude-err.log で error trace 別保存
  3. stdin pipe: cat input.md | claude -p "summarize" でファイル入力

Pitfalls

  • system prompt 全ロードで cost 高 → 短プロンプトでも 5-50 cents / call
  • session 切れ (8:50am reset) で中断 → claude --resume <session-id> で復旧
  • --output-format text 指定しないと JSON 返ってきて parse 必要
  • macOS timeout コマンドは GNU coreutils 必要 → brew install coreutilsgtimeout 提供
  • 並列 claude -p は token block を急速消費 → 5h 800k cap 注意

Verification

  • exit 0 + stdout 非空 = 成功
  • exit 124 (timeout) または非ゼロ = 失敗
  • ccusage blocks --active --json で block 残量を呼び出し後に確認

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.